  :root {
    /* Solid (not transparent): in iframes transparent body often shows white under WebKit */
    --bg: #0a0a0a;
    --phone-body: #0a0a0a;
    --screen-bg: #000000;
    --surface: #141416;
    --surface-2: #1c1c1e;
    --border: #2a2a2c;
    --border-soft: #1f1f21;
    --text: #ffffff;
    --text-dim: #8e8e93;
    --text-dim-2: #636366;
    --yellow: #F2DF1E;
    --yellow-soft: rgba(242, 223, 30, 0.12);
    --blue: #3d7bff;
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Inter, system-ui, sans-serif;

    /* iOS-style easing */
    --ease-ios: cubic-bezier(0.32, 0.72, 0, 1);
    --ease-ios-in: cubic-bezier(0.55, 0, 0.1, 1);
    --scene-duration: 4200ms;
  }

  * { box-sizing: border-box; }

  html { color-scheme: dark; }

  html, body {
    margin: 0; padding: 0;
    background: var(--bg);
    font-family: var(--font);
    color: var(--text);
    min-height: 100%;
    height: 100%;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  /*
   * Fixed to the *embedded* or top-level view: 100dvh/100% on a div often overshoots
   * inside an iframe, so fitWalkthrough() saw too much room and the demo did not shrink.
   * Fixed + inset:0 always matches the iframe (or window) for resize + fit scale.
   */
  .walkthrough-viewport {
    position: fixed;
    inset: 0;
    box-sizing: border-box;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
  }

  .walkthrough-bounds {
    position: relative;
    overflow: hidden;
    margin: 0 auto;
    flex: 0 0 auto;
  }

  .walkthrough-scaled {
    position: relative;
    display: inline-block;
    vertical-align: top;
    transform-origin: 0 0;
    will-change: transform;
  }

  .stage {
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
  }

  /* ---------- iPhone frame ---------- */
  .phone {
    position: relative;
    width: 360px;
    height: 735px;
    background: #050505;
    border-radius: 56px;
    padding: 11px;
    box-shadow:
      0 0 0 2px #2f2f2f,
      0 0 0 3px #111,
      inset 0 0 0 1px rgba(255,255,255,0.04);
  }

  .phone .side-btn {
    position: absolute;
    background: linear-gradient(to right, #2a2a2a, #141414);
    border-radius: 2px;
  }
  .phone .side-btn.power { right: -3px; top: 165px; width: 3px; height: 68px; }
  .phone .side-btn.vol-up { left: -3px; top: 148px; width: 3px; height: 48px; }
  .phone .side-btn.vol-down { left: -3px; top: 210px; width: 3px; height: 48px; }
  .phone .side-btn.silent { left: -3px; top: 108px; width: 3px; height: 26px; }

  /* ---------- Screen ---------- */
  .screen {
    position: relative;
    width: 100%; height: 100%;
    background: var(--screen-bg);
    border-radius: 46px;
    overflow: hidden;
  }

  /* Dynamic Island */
  .island {
    position: absolute;
    top: 11px; left: 50%;
    transform: translateX(-50%);
    width: 118px; height: 34px;
    background: #000;
    border-radius: 20px;
    z-index: 40;
  }

  /* Status bar */
  .status {
    position: absolute;
    top: 16px; left: 0; right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 32px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    z-index: 20;
    pointer-events: none;
  }
  .status .right { display: flex; gap: 5px; align-items: center; }
  .signal { width: 17px; height: 11px; display:inline-block;
    background: var(--text);
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 10'><rect x='0' y='7' width='2.5' height='3' rx='0.5'/><rect x='4' y='5' width='2.5' height='5' rx='0.5'/><rect x='8' y='2.5' width='2.5' height='7.5' rx='0.5'/><rect x='12' y='0' width='2.5' height='10' rx='0.5'/></svg>");
    mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 10'><rect x='0' y='7' width='2.5' height='3' rx='0.5'/><rect x='4' y='5' width='2.5' height='5' rx='0.5'/><rect x='8' y='2.5' width='2.5' height='7.5' rx='0.5'/><rect x='12' y='0' width='2.5' height='10' rx='0.5'/></svg>");
  }
  .wifi { width: 16px; height: 11px; display:inline-block;
    background: var(--text);
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 11'><path fill='black' d='M8 11l3-3a4.2 4.2 0 00-6 0l3 3zm0-5.5a6.5 6.5 0 014.6 1.9l1.5-1.5a8.6 8.6 0 00-12.2 0L3.4 7.4A6.5 6.5 0 018 5.5zM8 0a11 11 0 017.8 3.2l-1.4 1.4A9 9 0 008 2a9 9 0 00-6.4 2.6L0.2 3.2A11 11 0 018 0z'/></svg>");
    mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 11'><path fill='black' d='M8 11l3-3a4.2 4.2 0 00-6 0l3 3zm0-5.5a6.5 6.5 0 014.6 1.9l1.5-1.5a8.6 8.6 0 00-12.2 0L3.4 7.4A6.5 6.5 0 018 5.5zM8 0a11 11 0 017.8 3.2l-1.4 1.4A9 9 0 008 2a9 9 0 00-6.4 2.6L0.2 3.2A11 11 0 018 0z'/></svg>");
  }
  .battery {
    width: 27px; height: 13px;
    border: 1.3px solid var(--text);
    border-radius: 3.5px;
    position: relative;
    display: inline-block;
  }
  .battery::after { content: ""; position: absolute; right: -3px; top: 3.5px; width: 2px; height: 5px; background: var(--text); border-radius: 1px; }
  .battery::before { content: ""; position: absolute; left: 1.2px; top: 1.2px; bottom: 1.2px; width: 85%; background: var(--text); border-radius: 1.5px; }

  /* ---------- Persistent app chrome ---------- */
  .app-chrome {
    position: absolute;
    top: 54px; left: 0; right: 0;
    z-index: 10;
    background: var(--screen-bg);
    padding-bottom: 6px;
  }

  .app-header {
    padding: 4px 20px 14px;
    display: flex;
    align-items: center;
    gap: 16px;
  }
  .back {
    color: var(--yellow);
    font-size: 17px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 3px;
  }
  .back::before {
    content: "";
    display: inline-block;
    width: 9px; height: 15px;
    background: var(--yellow);
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 14'><path d='M7 1L1 7l6 6' stroke='black' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 14'><path d='M7 1L1 7l6 6' stroke='black' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  }
  .page-title {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--text);
    transition: opacity 0.4s var(--ease-ios);
  }

  /* Tab bar — horizontal scroll, yellow-filled active pill */
  .tab-bar {
    position: relative;
    overflow-x: hidden;
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
            mask-image: linear-gradient(to right, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
  }
  .tab-track {
    position: relative;
    display: inline-flex;
    gap: 8px;
    padding: 2px 14px 6px;
    transition: transform 0.75s var(--ease-ios);
    will-change: transform;
  }
  .tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    min-width: 104px;
    padding: 0 20px;
    color: var(--text-dim);
    font-size: 14px;
    font-weight: 500;
    border-radius: 999px;
    background: var(--surface-2);
    flex: 0 0 auto;
    transition:
      background-color 0.32s ease-out,
      color 0.32s ease-out;
  }
  .tab.active {
    color: #0a0a0a;
    font-weight: 600;
    background: var(--yellow);
  }
  .tab .sparkle {
    display: inline-block;
    margin-right: 5px;
    font-size: 13px;
    vertical-align: 0;
  }

  /* ---------- Scenes ---------- */
  .scenes {
    position: absolute;
    top: 162px;
    left: 0; right: 0; bottom: 0;
    overflow: hidden;
  }

  .scene {
    position: absolute;
    inset: 0;
    padding: 6px 20px 20px;
    opacity: 0;
    transition: opacity 0.22s ease-out;
    will-change: opacity;
    pointer-events: none;
    overflow: hidden;
  }
  .scene.active {
    opacity: 1;
    pointer-events: auto;
  }

  .section-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-dim);
    letter-spacing: 1.3px;
    text-transform: uppercase;
    margin: 10px 0 9px;
  }

  /* ---------- Overview ---------- */
  .stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 2px;
  }
  .stat-card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    padding: 14px 14px 13px;
    height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
  .stat-label {
    font-size: 10px;
    color: var(--text-dim);
    letter-spacing: 1.8px;
    text-transform: uppercase;
  }
  .stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--yellow);
    letter-spacing: -0.3px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
  }
  .stat-value.white { color: var(--text); font-size: 16px; }
  .stat-sub {
    font-size: 12px;
    color: var(--text-dim);
  }
  .stat-pill {
    display: inline-block;
    background: var(--yellow);
    color: #0a0a0a;
    font-size: 13px;
    font-weight: 600;
    padding: 5px 14px;
    border-radius: 999px;
    align-self: flex-start;
  }

  .about-card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    padding: 15px 15px;
    margin-bottom: 10px;
  }
  .work-label {
    font-size: 10px;
    color: var(--text-dim);
    letter-spacing: 1.8px;
    text-transform: uppercase;
    margin-bottom: 6px;
  }
  .work-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--yellow);
    letter-spacing: -0.3px;
    margin-bottom: 8px;
    line-height: 1;
  }
  .about-desc {
    font-size: 12.5px;
    color: var(--text-dim);
    line-height: 1.4;
  }
  .desc-card {
    font-size: 13px;
    color: var(--text);
    line-height: 1.5;
  }

  /* ---------- Milestones ---------- */
  .milestones-hint {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.45;
    margin: 2px 0 16px;
  }
  .new-row {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
  }
  .new-input {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    padding: 13px 16px;
    font-size: 14px;
    color: var(--text-dim);
  }
  .add-btn {
    width: 48px;
    height: 48px;
    background: var(--yellow);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 500;
    color: #0a0a0a;
    line-height: 1;
  }
  .ms-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-soft);
  }
  .ms-item:last-child { border-bottom: none; }
  .checkbox {
    width: 24px; height: 24px;
    border-radius: 7px;
    border: 1.5px solid var(--border);
    background: transparent;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .checkbox.checked {
    background: var(--yellow);
    border-color: var(--yellow);
  }
  .checkbox.checked::after {
    content: "";
    display: block;
    width: 11px; height: 6px;
    border-left: 2px solid #0a0a0a;
    border-bottom: 2px solid #0a0a0a;
    transform: rotate(-45deg) translate(1px, -2px);
  }
  .ms-label {
    flex: 1;
    font-size: 15px;
    color: var(--text);
  }
  .ms-item.done .ms-label {
    color: var(--text-dim);
    text-decoration: line-through;
  }
  .trash {
    width: 17px;
    height: 19px;
    opacity: 0.35;
    background: var(--text-dim);
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 18'><path fill='black' d='M5 2a1 1 0 011-1h4a1 1 0 011 1v1h4v2H1V3h4V2zm-2 4h10l-1 10a2 2 0 01-2 2H6a2 2 0 01-2-2L3 6z'/></svg>");
    mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 18'><path fill='black' d='M5 2a1 1 0 011-1h4a1 1 0 011 1v1h4v2H1V3h4V2zm-2 4h10l-1 10a2 2 0 01-2 2H6a2 2 0 01-2-2L3 6z'/></svg>");
  }

  /* ---------- Production categories ---------- */
  .prod-hint {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.45;
    margin: 2px 0 14px;
  }
  .cat-card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    padding: 16px 18px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .cat-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.2px;
  }
  .cat-sub {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 3px;
  }
  .chevron {
    color: var(--yellow);
    font-size: 20px;
    font-weight: 500;
  }

  /* Production sub-header */
  .sub-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0 12px;
    border-bottom: 1px solid var(--border-soft);
    margin-bottom: 14px;
  }
  .sub-back {
    color: var(--yellow);
    font-size: 15px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 3px;
  }
  .sub-back::before {
    content: "";
    display: inline-block;
    width: 8px; height: 13px;
    background: var(--yellow);
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 14'><path d='M7 1L1 7l6 6' stroke='black' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 14'><path d='M7 1L1 7l6 6' stroke='black' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  }
  .sub-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.2px;
  }

  .big-title {
    font-size: 21px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: var(--text);
    text-transform: uppercase;
    margin-bottom: 4px;
  }
  .note {
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.45;
    margin-bottom: 12px;
  }

  /* Weather */
  .weather-input {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
  }
  .weather-input .new-input {
    padding: 12px 16px;
    font-size: 15px;
    color: var(--text);
    font-weight: 500;
  }
  .load-btn {
    background: var(--blue);
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    padding: 0 22px;
    height: 46px;
    display: flex;
    align-items: center;
    border-radius: 14px;
  }
  .loc-line {
    font-size: 12px;
    color: var(--text-dim);
    margin: 6px 2px 10px;
  }
  .weather-table {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    padding: 0 14px;
  }
  .wt-head {
    display: grid;
    grid-template-columns: 1fr 1fr 52px;
    font-size: 10.5px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--text-dim);
    padding: 11px 0;
    border-bottom: 1px solid var(--border-soft);
  }
  .wt-head span:nth-child(2) { text-align: right; }
  .wt-head span:nth-child(3) { text-align: right; }
  .wt-row {
    display: grid;
    grid-template-columns: 1fr 1fr 52px;
    align-items: center;
    padding: 11px 0;
    border-bottom: 1px solid var(--border-soft);
    font-size: 12px;
  }
  .wt-row:last-child { border-bottom: none; }
  .wt-day { font-weight: 600; color: var(--text); font-size: 13.5px; }
  .wt-cond { font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }
  .wt-temp { text-align: right; color: var(--yellow); font-weight: 600; font-variant-numeric: tabular-nums; font-size: 13px; }
  .wt-rain { text-align: right; color: var(--text-dim); font-variant-numeric: tabular-nums; font-size: 13px; }

  /* Shotlist */
  .shot-row {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-soft);
  }
  .shot-row:last-child { border-bottom: none; }
  .shot-num {
    font-size: 14px;
    color: var(--text-dim);
    font-weight: 500;
    text-align: center;
  }
  .shot-title {
    font-size: 15px;
    color: var(--text);
    font-weight: 500;
  }
  .shot-meta {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 2px;
  }
  .badge {
    padding: 6px 16px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    color: #fff;
    background: var(--blue);
  }

  /* Crew */
  .crew-line {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 18px 0;
    border-bottom: 1px solid var(--border-soft);
  }
  .crew-line:first-child { padding-top: 8px; }
  .crew-line:last-child { border-bottom: none; }
  .crew-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.2px;
  }
  .crew-role {
    font-size: 13px;
    color: var(--text-dim);
    margin-top: 3px;
  }
  .crew-right {
    font-size: 13.5px;
    color: var(--text-dim);
    text-align: right;
  }

  /* Messages */
  .msg-wrap { padding: 4px 0; }
  .msg-group { margin-bottom: 16px; }
  .msg-who {
    font-size: 12.5px;
    color: var(--text);
    margin-bottom: 6px;
    font-weight: 500;
  }
  .msg-who.me { text-align: right; color: var(--text-dim); font-size: 12px; }
  .msg-bubble {
    display: inline-block;
    max-width: 82%;
    padding: 11px 15px;
    font-size: 14.5px;
    line-height: 1.4;
    border-radius: 16px;
    background: var(--surface);
    color: var(--text);
  }
  .msg-bubble.me {
    background: var(--yellow-soft);
    border: 1px solid rgba(242, 223, 30, 0.55);
    color: var(--text);
  }
  .msg-group.me { text-align: right; }

  /* Brief AI */
  .brief-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 11px;
    margin-top: 4px;
  }
  .brief-card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    padding: 15px;
    height: 130px;
    display: flex;
    flex-direction: column;
    transition: border-color 0.4s var(--ease-ios);
  }
  .brief-card.selected {
    border-color: var(--yellow);
    border-width: 1.5px;
  }
  .brief-icon {
    width: 24px; height: 24px;
    margin-bottom: 12px;
    color: var(--text);
  }
  .brief-icon svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .brief-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
    letter-spacing: -0.1px;
  }
  .brief-sub {
    font-size: 11.5px;
    color: var(--text-dim);
    line-height: 1.35;
  }
  .ctx-label {
    font-size: 10.5px;
    color: var(--text-dim);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin: 18px 0 8px;
  }
  .ctx-label i { text-transform: none; letter-spacing: 0; font-style: normal; color: var(--text-dim-2); font-size: 11px; }
  .ctx-box {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    padding: 13px 15px;
    font-size: 13px;
    color: var(--text);
    line-height: 1.45;
    min-height: 66px;
  }
  .generate-btn {
    margin-top: 14px;
    background: var(--yellow);
    color: #0a0a0a;
    font-weight: 700;
    font-size: 15px;
    text-align: center;
    padding: 14px;
    border-radius: 16px;
    letter-spacing: -0.1px;
  }

  /* ---------- Caption & progress ---------- */
  .caption {
    font-size: 13px;
    color: #ffffff;
    font-weight: 500;
    letter-spacing: 0.2px;
    text-align: center;
    min-height: 18px;
    transition: opacity 0.2s ease-out;
  }
  .progress {
    display: flex;
    gap: 4px;
    width: 280px;
  }
  .progress-dot {
    flex: 1;
    height: 3px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
  }
  .progress-dot.active::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--yellow);
    transform: scaleX(0);
    transform-origin: left;
    animation: fill var(--scene-duration) linear forwards;
  }
  .progress-dot.done { background: var(--yellow); }
  @keyframes fill { to { transform: scaleX(1); } }
