@layer views {
  /* ── the iPhone preview for SwiftUI lessons (app/run/screen.js). Always iOS light mode, like a new app. ── */
  .preview { display: grid; justify-items: center; gap: 8px; padding: 6px 0 4px; }
  /* A SwiftUI lesson's output panel opens tall enough for the phone. */
  .lp[data-lang="swiftui"] .con[data-open="true"] { height: min(62dvh, 600px); }
  @media (max-width: 899px) { .lp[data-lang="swiftui"] .con[data-open="true"] { height: min(74dvh, 640px); } }
  .phone {
    position: relative; width: 300px; max-width: 100%; border-radius: 40px; padding: 10px; background: #111114;
    box-shadow: 0 0 0 1.5px #3a3a40, 0 14px 40px rgba(0, 0, 0, .35); color-scheme: light;
    &[data-busy="true"] .phone-screen { opacity: .55; }
  }
  .phone-bar {
    position: absolute; inset: 10px 10px auto; height: 34px; display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; font: 600 12px/1 -apple-system, "SF Pro Text", system-ui, sans-serif; color: #000; z-index: 2; pointer-events: none;
  }
  .phone-island { width: 74px; height: 22px; border-radius: 12px; background: #000; }
  .phone-home { position: absolute; left: 50%; bottom: 16px; width: 96px; height: 4px; margin-left: -48px; border-radius: 3px; background: #000; opacity: .8; }
  .phone-screen {
    min-height: 440px; max-height: 560px; overflow: auto; border-radius: 30px; background: #fff; color: #000;
    padding: 44px 14px 28px; display: flex; flex-direction: column; align-items: center; justify-content: center;
    font: 400 17px/1.25 -apple-system, "SF Pro Text", "SF Pro Display", system-ui, sans-serif; letter-spacing: -0.01em;
    transition: opacity .15s; --ui-tint: #007AFF; --ui-fill: #000;
    &.is-nav { justify-content: flex-start; align-items: stretch; padding-top: 40px; }
  }
  .ui-blank { color: #8e8e93; font-size: 14px; }

  .ui-text { white-space: pre-wrap; overflow-wrap: anywhere; }
  .ui-image { display: inline-block; line-height: 1; font-size: 1.1em; color: inherit; }
  .ui-image[data-missing="true"] { font-size: .9em; opacity: .5; }
  .ui-label { display: inline-flex; align-items: center; gap: 8px; }
  .ui-stack { display: flex; min-width: 0; }
  .ui-v { flex-direction: column; }
  .ui-h { flex-direction: row; }
  .ui-v > .ui-spacer { flex: 1 1 8px; min-height: 8px; }
  .ui-h > .ui-spacer { flex: 1 1 8px; min-width: 8px; }
  .ui-z { display: grid; & > * { grid-area: 1 / 1; } }
  .ui-group { display: contents; }
  .ui-divider { align-self: stretch; height: 1px; background: rgba(60, 60, 67, .29); }
  .ui-divider-v { width: 1px; height: auto; }
  .ui-color { align-self: stretch; flex: 1 1 auto; min-width: 20px; min-height: 20px; }
  .ui-z > .ui-color { width: 100%; height: 100%; }
  .ui-shape { flex: 1 1 auto; align-self: stretch; min-width: 10px; min-height: 10px; }
  .ui-shape-circle { border-radius: 50%; aspect-ratio: 1; }
  .ui-shape-capsule { border-radius: 999px; }
  .ui-mod { display: flex; flex-direction: column; align-items: stretch; min-width: 0; }
  .ui-inherit { display: contents; }
  .ui-frame { display: grid; flex: none; }
  .ui-clip { overflow: hidden; }
  .ui-backed { position: relative; display: grid; & > * { grid-area: 1 / 1; } & > .ui-back { display: grid; & > * { width: 100%; height: 100%; } } }
  .ui-clamp .ui-text { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: var(--ui-lines); overflow: hidden; }
  .ui-disabled { opacity: .4; pointer-events: none; }
  .ui-scale-large .ui-image { font-size: 1.4em; }
  .ui-scale-small .ui-image { font-size: .85em; }

  .ui-button {
    font: inherit; color: var(--ui-tint); background: none; border: 0; padding: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    &[data-role="destructive"] { color: #FF3B30; }
    &:active { opacity: .5; }
    flex: none; white-space: nowrap;
  }
  /* A row that's a button reads like a row: its label from the leading edge, across the row. */
  .ui-row > .ui-button { flex: 1 1 auto; justify-content: flex-start; white-space: normal; text-align: left; }
  .ui-h > .ui-field { flex: 1 1 auto; }
  .ui-bs-bordered .ui-button { background: color-mix(in srgb, var(--ui-tint) 15%, transparent); padding: 7px 14px; border-radius: 8px; }
  .ui-bs-borderedProminent .ui-button { background: var(--ui-tint); color: #fff; padding: 7px 14px; border-radius: 8px; font-weight: 600; }
  .ui-tappable { cursor: pointer; }
  .ui-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; align-self: stretch; }
  .ui-toggle-label { display: flex; min-width: 0; }
  .ui-switch {
    position: relative; flex: none; width: 51px; height: 31px; border-radius: 16px; border: 0; padding: 0; cursor: pointer; background: rgba(120, 120, 128, .16); transition: background .2s;
    & i { position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 1px 1px rgba(0,0,0,.16); transition: transform .2s; }
    &[aria-checked="true"] { background: #34C759; & i { transform: translateX(20px); } }
  }
  .ui-field { font: inherit; color: #000; background: transparent; border: 0; border-bottom: 1px solid rgba(60, 60, 67, .29); padding: 6px 2px; align-self: stretch; min-width: 0; outline: none; }
  .ui-fs-roundedBorder .ui-field { border: 1px solid rgba(60, 60, 67, .29); border-radius: 6px; padding: 6px 8px; }
  .ui-stepper { display: flex; align-items: center; justify-content: space-between; gap: 12px; align-self: stretch; }
  .ui-stepper-buttons { display: inline-flex; border-radius: 8px; background: rgba(120, 120, 128, .12); overflow: hidden;
    & button { font: 500 20px/1 system-ui; width: 46px; height: 32px; border: 0; background: none; color: #000; cursor: pointer; }
    & button + button { border-left: 1px solid rgba(60, 60, 67, .29); } }

  .ui-list { align-self: stretch; display: grid; gap: 18px; margin: 0 -14px; padding: 12px 14px; background: #F2F2F7; flex: 1 1 auto; }
  .ui-section { display: grid; gap: 6px; }
  .ui-section-header { margin: 0 0 0 14px; font-size: 13px; color: rgba(60, 60, 67, .6); text-transform: uppercase; }
  .ui-rows { background: #fff; border-radius: 10px; overflow: hidden; }
  .ui-row { display: flex; align-items: center; min-height: 44px; padding: 8px 16px; & + .ui-row { box-shadow: inset 16px 1px 0 #fff, inset 0 1px 0 rgba(60, 60, 67, .29); } & > * { flex: 1 1 auto; } }
  .ui-scroll { overflow: auto; align-self: stretch; }
  .ui-nav { display: flex; flex-direction: column; align-self: stretch; flex: 1 1 auto; min-height: 0; }
  .ui-nav-title { margin: 6px 2px 10px; font-size: 34px; font-weight: 700; letter-spacing: .01em; color: #000; }
  .ui-nav-body { display: flex; flex-direction: column; flex: 1 1 auto; align-items: stretch; }
}
