    :root {
      --bg: #0f0f1a;
      --surface: #1c1c2e;
      --surface2: #2a2a3e;
      --accent: #7c5cbf;
      --accent2: #a78bfa;
      --danger: #ef4444;
      --success: #22c55e;
      --text: #e2e8f0;
      --text-muted: #94a3b8;
      --radius: 14px;
    }

    * { box-sizing: border-box; margin: 0; padding: 0; }


    body {
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      background: #2a1a4e;
      color: var(--text);
      min-height: 100vh;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 24px 16px;
    }

    /* iPhone 15 Pro frame simulation */
    .iphone-frame {
      position: relative;
      width: min(390px, 100vw);
      height: min(844px, 100dvh);
      background: var(--bg);
      border-radius: 54px;
      border: 10px solid #1a1a2a;
      box-shadow:
        0 0 0 2px #3a3a5a,
        0 0 0 4px #111,
        0 30px 80px rgba(0,0,0,0.7),
        inset 0 0 0 1px rgba(255,255,255,0.05);
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: 60px 0 40px;
      overflow: hidden;
    }
    /* Dynamic Island notch */
    .iphone-frame::before {
      content: '';
      position: absolute;
      top: 14px; left: 50%;
      transform: translateX(-50%);
      width: 120px; height: 36px;
      background: #1a1a2a;
      border-radius: 20px;
      z-index: 10;
    }
    /* Side buttons */
    .iphone-frame::after {
      content: '';
      position: absolute;
      right: -14px; top: 140px;
      width: 4px; height: 80px;
      background: #2a2a3a;
      border-radius: 2px;
      box-shadow: 0 100px 0 #2a2a3a;
    }

    .card {
      background: var(--surface);
      border-radius: var(--radius);
      padding: 28px 24px;
      width: 100%;
      max-width: 560px;
      box-shadow: 0 4px 24px rgba(0,0,0,0.4);
    }

    .phase { display: none; }
    .phase.active { display: block; }

    /* Spinner phase needs to fill the frame so VHS layout can flex-grow */
    #phaseSpinner.active {
      display: flex;
      flex-direction: column;
      flex: 1;
      align-self: stretch;
      width: 100%;
      min-height: 0;
      overflow: hidden;
    }

    #phaseRecord.active {
      display: flex;
      flex-direction: column;
      flex: 1;
      width: 100%;
      max-width: 560px;
    }

    /* Recording screen */
    .prompt-label {
      font-size: 0.75rem;
      text-transform: uppercase;
      letter-spacing: 0.15em;
      color: rgba(255,255,255,0.35);
      margin-bottom: 8px;
    }
    .prompt-text {
      font-size: 1.5rem;
      font-weight: 700;
      color: #ff6b35;
      margin-bottom: 6px;
    }
    .prompt-hint {
      font-size: 0.9rem;
      color: var(--text-muted);
      margin-bottom: 20px;
    }
    .meter-wrap {
      height: 8px;
      background: var(--surface2);
      border-radius: 99px;
      overflow: hidden;
      margin-bottom: 16px;
      display: none;
    }
    .meter-fill {
      height: 100%;
      background: linear-gradient(90deg, var(--success), #facc15, var(--danger));
      border-radius: 99px;
      width: 0%;
      transition: width 0.08s;
    }
    .record-btn {
      width: 100%;
      flex: 1;
      min-height: 80px;
      border: none;
      border-radius: var(--radius);
      font-size: 1.4rem;
      font-weight: 700;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      transition: transform 0.1s, opacity 0.2s;
    }
    .record-btn:active { transform: scale(0.97); }
    .record-btn.idle { background: #ff6b35; color: white; }
    .record-btn.recording {
      background: var(--danger);
      color: white;
      animation: pulse 1.2s infinite;
    }
    @keyframes pulse {
      0%, 100% { opacity: 1; }
      50% { opacity: 0.75; }
    }
    .dot { width: 12px; height: 12px; border-radius: 50%; background: white; display: inline-block; }

    /* Review screen */
    .review-label { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 14px; }
    audio { width: 100%; margin-bottom: 14px; border-radius: 8px; accent-color: var(--accent); }

    /* Buttons */
    .btn-row { display: flex; gap: 10px; }
    .btn {
      flex: 1;
      padding: 16px;
      border: none;
      border-radius: var(--radius);
      font-size: 1rem;
      font-weight: 600;
      cursor: pointer;
      transition: opacity 0.15s, transform 0.1s;
    }
    .btn:active { transform: scale(0.97); }
    .btn-outline { background: var(--surface2); color: var(--text); border: 1px solid #3a3a5c; }
    .btn-primary { background: var(--accent); color: white; }
    .btn-success { background: var(--success); color: white; }

    /* Start / Ready screens */
    .hero-icon { font-size: 4rem; text-align: center; margin-bottom: 16px; }
    .phase-title { font-size: 1.3rem; font-weight: 800; margin-bottom: 10px; text-align: center; color: #fff; }
    .phase-desc { color: var(--text-muted); font-size: 0.88rem; line-height: 1.6; text-align: center; margin-bottom: 20px; }

    /* Playback screen — story-status now lives in the TV status bar */
    .story-status { font-size: 9px; font-weight: 700; color: rgba(255,255,255,0.4); letter-spacing: 2px; text-transform: uppercase; }

    /* ── AUTH SCREEN ── */
    #phaseAuth.active {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: flex-start;
      width: 100%;
      flex: 1;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
    }

    /* VHS store header bar at top of auth */
    .auth-vhs-header {
      width: 100%;
      background: #0f0f1a;
      padding: 10px 16px 8px;
      flex-shrink: 0;
      border-bottom: 2px solid #ff6b35;
    }
    .auth-store-name {
      font-size: 14px;
      font-weight: 900;
      color: rgba(255,255,255,0.5);
      letter-spacing: -0.5px;
      text-transform: uppercase;
    }
    .auth-store-sub {
      font-size: 8px;
      color: rgba(255,255,255,0.25);
      letter-spacing: 2px;
      font-weight: 400;
      text-transform: uppercase;
    }

    /* Hero area: logo + tagline */
    .auth-hero {
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: 28px 24px 20px;
      width: 100%;
    }

    .auth-logo {
      font-family: 'Fredoka One', 'Arial Black', sans-serif;
      font-size: 2.4rem;
      margin-bottom: 2px;
      text-align: center;
      color: white;
    }
    .auth-logo span { color: #ff6b35; }
    .auth-tagline {
      color: var(--text-muted);
      font-size: 0.82rem;
      text-align: center;
      letter-spacing: 0.5px;
    }

    /* Card */
    .auth-card {
      background: var(--surface);
      border-radius: var(--radius);
      padding: 20px;
      width: calc(100% - 32px);
      margin: 0 16px;
      box-shadow: 0 4px 24px rgba(0,0,0,0.4);
      border: 1px solid #2a2a4e;
      flex-shrink: 0;
    }
    .auth-member-label {
      font-size: 9px;
      font-weight: 800;
      color: #ff6b35;
      letter-spacing: 3px;
      text-transform: uppercase;
      margin-bottom: 12px;
    }
    .auth-tabs {
      display: flex;
      gap: 4px;
      margin-bottom: 16px;
      background: var(--surface2);
      border-radius: 8px;
      padding: 4px;
    }
    .auth-tab {
      flex: 1;
      padding: 8px;
      border: none;
      border-radius: 6px;
      font-size: 0.85rem;
      font-weight: 600;
      cursor: pointer;
      background: transparent;
      color: var(--text-muted);
      transition: all 0.15s;
    }
    .auth-tab.active { background: #ff6b35; color: white; }
    .auth-input {
      width: 100%;
      padding: 12px 14px;
      border: 1px solid #3a3a5c;
      border-radius: 10px;
      background: var(--surface2);
      color: var(--text);
      font-size: 1rem;
      margin-bottom: 12px;
      outline: none;
      transition: border-color 0.15s;
    }
    .auth-input:focus { border-color: #ff6b35; }
    .auth-submit {
      width: 100%;
      padding: 14px;
      border: none;
      border-radius: 10px;
      background: #ff6b35;
      color: white;
      font-size: 1rem;
      font-weight: 700;
      cursor: pointer;
      transition: opacity 0.15s;
      margin-top: 4px;
      letter-spacing: 0.5px;
    }
    .auth-submit:active { opacity: 0.8; }
    .auth-submit:disabled { opacity: 0.5; cursor: default; }
    .auth-divider {
      display: flex;
      align-items: center;
      gap: 10px;
      margin: 14px 0;
      color: var(--text-muted);
      font-size: 0.8rem;
    }
    .auth-divider::before, .auth-divider::after {
      content: '';
      flex: 1;
      height: 1px;
      background: #3a3a5c;
    }
    .auth-magic {
      width: 100%;
      padding: 12px;
      border: 1px solid #3a3a5c;
      border-radius: 10px;
      background: transparent;
      color: var(--text-muted);
      font-size: 0.88rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.15s;
    }
    .auth-magic:hover { border-color: #ff6b35; color: #ff6b35; }
    .auth-msg {
      font-size: 0.82rem;
      text-align: center;
      margin-top: 12px;
      min-height: 1.2em;
      color: var(--text-muted);
    }
    .auth-msg.error { color: #ef4444; }
    .auth-msg.success { color: #22c55e; }

    /* ── LIBRARY SCREEN ── */
    /* lib-header, lib-scroll, story-card etc. come after; these are additions */
    .lib-header-left {
      display: flex;
      align-items: center;
      gap: 10px;
    }
    /* VHS cassette icon in library header */
    .lib-vhs-icon {
      width: 40px;
      height: 28px;
      background: linear-gradient(180deg, #2a2a3e, #1a1a2e);
      border-radius: 3px 3px 6px 6px;
      border: 1px solid #3a3a5c;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }
    .lib-vhs-icon-inner {
      width: 28px;
      height: 12px;
      background: #0a0a14;
      border-radius: 2px 2px 6px 6px;
      border: 1px solid #ff6b35;
      display: flex;
      align-items: center;
      justify-content: space-evenly;
      padding: 1px 3px;
    }
    .lib-vhs-reel {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: #1a1a2e;
      border: 1.5px solid #ff6b35;
    }
    .lib-title-sub {
      font-size: 9px;
      color: rgba(255,255,255,0.3);
      letter-spacing: 2px;
      text-transform: uppercase;
      font-weight: 400;
    }

    /* Story cards: VHS tape box style */
    .story-card {
      position: relative;
      overflow: hidden;
    }
    /* Tape accent stripe on left edge */
    .story-card::before {
      content: '';
      position: absolute;
      left: 0;
      top: 0;
      bottom: 0;
      width: 4px;
      background: #ff6b35;
      opacity: 0.6;
      border-radius: 12px 0 0 12px;
    }
    .story-card.coming-soon::before {
      background: #555;
    }
    .story-card-top {
      padding-left: 4px;
    }

    /* ── PASSWORD RESET SCREEN ── */
    #phaseReset.active {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      width: 100%;
      padding: 32px 24px;
      flex: 1;
    }
    .reset-icon {
      font-size: 3rem;
      margin-bottom: 12px;
    }
    .reset-title {
      font-family: 'Fredoka One', 'Arial Black', sans-serif;
      font-size: 1.6rem;
      color: #ff6b35;
      margin-bottom: 6px;
      text-align: center;
    }
    .reset-subtitle {
      color: var(--text-muted);
      font-size: 0.85rem;
      margin-bottom: 28px;
      text-align: center;
    }
    .reset-card {
      background: var(--surface);
      border-radius: var(--radius);
      padding: 24px;
      width: 100%;
      box-shadow: 0 4px 24px rgba(0,0,0,0.4);
      border: 1px solid #ff6b35;
    }

    /* ── LIBRARY SCREEN ── */
    #phaseLibrary.active {
      display: flex;
      flex-direction: column;
      width: 100%;
      flex: 1;
      overflow: hidden;
    }
    .lib-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 12px 16px 10px;
      flex-shrink: 0;
      background: #0f0f1a;
      border-bottom: 2px solid #ff6b35;
    }
    .lib-title {
      font-family: 'Fredoka One', sans-serif;
      font-size: 1.1rem;
      color: #fff;
      line-height: 1.1;
    }
    .lib-user {
      font-size: 0.75rem;
      color: var(--text-muted);
      cursor: pointer;
      padding: 4px 8px;
      border-radius: 6px;
      background: var(--surface2);
    }
    .lib-user:hover { color: var(--text); }
    .lib-scroll {
      flex: 1;
      overflow-y: auto;
      padding: 8px 16px 24px;
      -webkit-overflow-scrolling: touch;
    }
    .lib-scroll::-webkit-scrollbar { width: 4px; }
    .lib-scroll::-webkit-scrollbar-track { background: transparent; }
    .lib-scroll::-webkit-scrollbar-thumb { background: #3a3a5c; border-radius: 2px; }
    .story-card {
      background: var(--surface);
      border-radius: 12px;
      padding: 14px 16px;
      margin-bottom: 10px;
      border: 1px solid #2a2a4e;
      transition: border-color 0.15s;
    }
    .story-card.coming-soon { opacity: 0.5; }
    .story-card-top {
      display: flex;
      align-items: flex-start;
      gap: 12px;
      margin-bottom: 8px;
    }
    .story-card-emoji { font-size: 1.8rem; flex-shrink: 0; line-height: 1; }
    .story-card-info { flex: 1; min-width: 0; }
    .story-card-title {
      font-weight: 700;
      font-size: 0.95rem;
      color: var(--text);
      margin-bottom: 2px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .story-card-desc {
      font-size: 0.78rem;
      color: var(--text-muted);
      line-height: 1.4;
    }
    .story-card-meta {
      font-size: 0.72rem;
      color: var(--text-muted);
      margin-bottom: 10px;
    }
    .story-card-actions { display: flex; gap: 8px; }
    .slot-select {
      flex: 1;
      padding: 8px 10px;
      border: 1px solid #3a3a5c;
      border-radius: 8px;
      background: var(--surface2);
      color: var(--text);
      font-size: 0.78rem;
      cursor: pointer;
      outline: none;
    }
    .lib-spinner-btn {
      margin: 8px 16px 12px;
      padding: 14px;
      border: none;
      border-radius: 12px;
      background: #ff6b35;
      color: white;
      font-size: 1rem;
      font-weight: 700;
      cursor: pointer;
      width: calc(100% - 32px);
      flex-shrink: 0;
      letter-spacing: 0.3px;
    }
    .lib-spinner-btn:active { opacity: 0.85; }
    .lib-gen-access {
      margin: 0 16px 16px;
      padding: 14px;
      border-radius: 12px;
      background: var(--surface);
      border: 1px solid #3a3a5c;
      text-align: center;
      flex-shrink: 0;
    }
    .lib-gen-access-label {
      font-size: 0.8rem;
      color: var(--text-muted);
      margin-bottom: 10px;
    }
    .lib-gen-access-btn {
      font-size: 0.85rem;
      padding: 8px 18px;
      width: 100%;
    }
    .lib-loading {
      text-align: center;
      color: var(--text-muted);
      padding: 40px 20px;
      font-size: 0.9rem;
    }

    /* ── VHS VIDEO STORE VIEW ── */
    #vhsView {
      display: flex;
      flex-direction: column;
      width: 100%;
      flex: 1;
      overflow: hidden;
      background: #1a1a2a;
    }

    /* ── VHS: TWO-COLUMN LAYOUT (tablet-landscape + desktop) ── */
    :root[data-layout="tablet-landscape"] #vhsView,
    :root[data-layout="desktop"] #vhsView {
      display: grid !important;
      grid-template-columns: 1fr 2fr;
      grid-template-rows: auto 1fr auto;
      grid-template-areas:
        "header  header"
        "left    right"
        "bottom  bottom";
    }

    :root[data-layout="tablet-landscape"] .vhs-header,
    :root[data-layout="desktop"] .vhs-header {
      grid-area: header;
      padding: 6px 16px;
      min-height: 0;
    }

    :root[data-layout="tablet-landscape"] .vhs-store-name,
    :root[data-layout="desktop"] .vhs-store-name {
      font-size: 18px;
    }

    :root[data-layout="tablet-landscape"] .vhs-store-sub,
    :root[data-layout="desktop"] .vhs-store-sub {
      font-size: 11px;
    }

    /* ── LEFT COLUMN: featured banner ── */
    :root[data-layout="tablet-landscape"] .vhs-featured,
    :root[data-layout="desktop"] .vhs-featured {
      grid-area: left;
      margin: 0;
      border-radius: 0;
      border: none;
      border-right: 2px solid #2a2a3e;
      position: relative;
      overflow: hidden;
      display: block;
    }

    /* Jacket: fills the entire left column absolutely */
    :root[data-layout="tablet-landscape"] .vhs-feat-jacket,
    :root[data-layout="desktop"] .vhs-feat-jacket {
      position: absolute;
      inset: 0;
      display: flex;
      align-items: flex-start;
      justify-content: center;
      background: #0d0820;
      overflow: hidden;
      cursor: pointer;
    }

    :root[data-layout="tablet-landscape"] .vhs-jacket-img,
    :root[data-layout="desktop"] .vhs-jacket-img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      object-position: top center;
      display: block;
    }

    /* Sliding overlay — anchored to bottom, max 55% of column height */
    :root[data-layout="tablet-landscape"] .vhs-feat-overlay,
    :root[data-layout="desktop"] .vhs-feat-overlay {
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      max-height: 55%;
      display: flex;
      flex-direction: column;
      overflow: hidden;
      background: linear-gradient(to bottom, transparent 0px, rgba(13,8,32,0.95) 24px, #0d0820 48px);
      transform: translateY(0);
      transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
      cursor: pointer;
      padding-top: 24px;
    }
    :root[data-layout="tablet-landscape"] .vhs-feat-overlay.revealed,
    :root[data-layout="desktop"] .vhs-feat-overlay.revealed {
      transform: translateY(100%);
    }

    /* Spine: horizontal accent bar at top of overlay */
    :root[data-layout="tablet-landscape"] .vhs-feat-spine,
    :root[data-layout="desktop"] .vhs-feat-spine {
      width: 100%;
      height: 8px;
      flex-shrink: 0;
    }

    /* Emoji fallback — centered in jacket area */
    :root[data-layout="tablet-landscape"] .vhs-feat-art,
    :root[data-layout="desktop"] .vhs-feat-art {
      position: absolute;
      inset: 0;
      font-size: 80px;
      display: none;
      align-items: center;
      justify-content: center;
      background: #0d0820;
      width: auto;
    }

    /* Info block */
    :root[data-layout="tablet-landscape"] .vhs-feat-info,
    :root[data-layout="desktop"] .vhs-feat-info {
      padding: 16px 20px 10px;
      flex-shrink: 0;
    }

    :root[data-layout="tablet-landscape"] .vhs-feat-badge,
    :root[data-layout="desktop"] .vhs-feat-badge {
      font-size: 11px;
      letter-spacing: 3px;
      margin-bottom: 6px;
    }

    :root[data-layout="tablet-landscape"] .vhs-feat-title,
    :root[data-layout="desktop"] .vhs-feat-title {
      font-size: 22px;
      white-space: normal;
      line-height: 1.2;
      margin-bottom: 6px;
    }

    :root[data-layout="tablet-landscape"] .vhs-feat-desc,
    :root[data-layout="desktop"] .vhs-feat-desc {
      display: none; /* description shown in prompt list instead */
    }

    :root[data-layout="tablet-landscape"] .vhs-feat-meta,
    :root[data-layout="desktop"] .vhs-feat-meta {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
    }

    :root[data-layout="tablet-landscape"] .vhs-rating,
    :root[data-layout="desktop"] .vhs-rating {
      font-size: 13px;
      padding: 5px 12px;
    }

    :root[data-layout="tablet-landscape"] .vhs-blanks-count,
    :root[data-layout="desktop"] .vhs-blanks-count {
      font-size: 13px;
    }

    /* Runtime placeholder */
    .vhs-runtime {
      display: none; /* hidden on mobile */
    }
    :root[data-layout="tablet-landscape"] .vhs-runtime,
    :root[data-layout="desktop"] .vhs-runtime {
      display: inline;
      font-size: 13px;
      color: #666;
      letter-spacing: 1px;
    }

    /* Prompt list — fills space, clips with fade */
    .vhs-prompt-list-wrap {
      display: none; /* hidden on mobile */
    }
    :root[data-layout="tablet-landscape"] .vhs-prompt-list-wrap,
    :root[data-layout="desktop"] .vhs-prompt-list-wrap {
      display: flex;
      flex-direction: column;
      flex: 0 1 auto;
      min-height: 0;
      padding: 10px 20px 0;
      position: relative;
      overflow: hidden;
      /* Fade bottom edge */
      -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
      mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
    }

    :root[data-layout="tablet-landscape"] .vhs-prompt-list-label,
    :root[data-layout="desktop"] .vhs-prompt-list-label {
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 3px;
      color: rgba(255,255,255,0.25);
      text-transform: uppercase;
      color: #ff6b35;
      margin-bottom: 8px;
      flex-shrink: 0;
    }

    :root[data-layout="tablet-landscape"] .vhs-prompt-list,
    :root[data-layout="desktop"] .vhs-prompt-list {
      list-style: none;
      padding: 0;
      margin: 0;
      overflow: hidden;
    }

    :root[data-layout="tablet-landscape"] .vhs-prompt-list li,
    :root[data-layout="desktop"] .vhs-prompt-list li {
      font-size: 14px;
      color: #aaa;
      padding: 5px 0;
      border-bottom: 1px solid #1e1e2e;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    :root[data-layout="tablet-landscape"] .vhs-prompt-list li:first-child,
    :root[data-layout="desktop"] .vhs-prompt-list li:first-child {
      color: #ccc;
    }

    /* Play button: full width, large, anchored to bottom of left col */
    :root[data-layout="tablet-landscape"] .vhs-rent-btn,
    :root[data-layout="desktop"] .vhs-rent-btn {
      width: calc(100% - 40px);
      margin: 12px 20px 20px;
      padding: 20px;
      font-size: 18px;
      letter-spacing: 2px;
      border-radius: 14px;
      flex-shrink: 0;
    }

    /* ── RIGHT COLUMN: tape grid left, genre tabs on far right ── */
    :root[data-layout="tablet-landscape"] #vhsRight,
    :root[data-layout="desktop"] #vhsRight {
      grid-area: right;
      display: flex;
      flex-direction: row;
      overflow: hidden;
      min-height: 0;
    }

    /* Tape shelf: 4 columns, 2 rows visible, scrolls vertically */
    :root[data-layout="tablet-landscape"] .vhs-shelf,
    :root[data-layout="desktop"] .vhs-shelf {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      grid-auto-rows: auto;
      gap: 12px;
      padding: 12px;
      align-content: start;
      overflow-x: hidden;
      overflow-y: auto;
      flex: 1;
      scrollbar-width: none;
      -ms-overflow-style: none;
    }
    :root[data-layout="tablet-landscape"] .vhs-shelf::-webkit-scrollbar,
    :root[data-layout="desktop"] .vhs-shelf::-webkit-scrollbar {
      display: none;
    }

    /* Each tape: full cell width, height driven by aspect ratio */
    :root[data-layout="tablet-landscape"] .vhs-tape,
    :root[data-layout="desktop"] .vhs-tape {
      width: 100% !important;
      height: auto !important;
      flex-shrink: 0;
      display: block;
    }

    /* Body: full width, 1:2 aspect ratio — matches 300×600 source jacket */
    :root[data-layout="tablet-landscape"] .vhs-tape-body,
    :root[data-layout="desktop"] .vhs-tape-body {
      width: 100% !important;
      height: auto !important;
      aspect-ratio: 1 / 2;
      border-radius: 8px;
      overflow: hidden;
      display: block;
    }

    /* Hide everything except the body on desktop */
    :root[data-layout="tablet-landscape"] .vhs-tape-base,
    :root[data-layout="desktop"] .vhs-tape-base,
    :root[data-layout="tablet-landscape"] .vhs-tape > :not(.vhs-tape-body),
    :root[data-layout="desktop"] .vhs-tape > :not(.vhs-tape-body) {
      display: none !important;
    }

    :root[data-layout="tablet-landscape"] .vhs-tape-label,
    :root[data-layout="desktop"] .vhs-tape-label {
      padding: 10px 8px;
    }

    :root[data-layout="tablet-landscape"] .vhs-tape-emoji,
    :root[data-layout="desktop"] .vhs-tape-emoji {
      font-size: 36px;
      margin-bottom: 8px;
    }

    :root[data-layout="tablet-landscape"] .vhs-tape-title,
    :root[data-layout="desktop"] .vhs-tape-title {
      font-size: 11px;
      color: rgba(0,0,0,0.8);
    }

    /* Hide tape base/reels on desktop — too small to be useful */
    :root[data-layout="tablet-landscape"] .vhs-tape-base,
    :root[data-layout="desktop"] .vhs-tape-base {
      display: none;
    }

    /* Genre tabs: narrow vertical strip on far right (thumb zone) */
    :root[data-layout="tablet-landscape"] .vhs-genre-bar,
    :root[data-layout="desktop"] .vhs-genre-bar {
      display: flex;
      flex-direction: column;
      border-bottom: none;
      border-left: 2px solid #ff6b35;
      width: 36px;
      flex-shrink: 0;
      overflow-y: auto;
      overflow-x: hidden;
      scrollbar-width: none;
      background: #0f0f1a;
      order: 2;
    }

    :root[data-layout="tablet-landscape"] .vhs-genre-tab,
    :root[data-layout="desktop"] .vhs-genre-tab {
      writing-mode: vertical-rl;
      transform: rotate(180deg);
      padding: 12px 0;
      font-size: 9px;
      letter-spacing: 2px;
      border-bottom: none;
      border-right: 3px solid transparent;
      margin-bottom: 0;
      text-align: center;
      display: flex;
      align-items: center;
      justify-content: center;
      flex: 1;
      min-height: 56px;
    }

    :root[data-layout="tablet-landscape"] .vhs-genre-tab.active,
    :root[data-layout="desktop"] .vhs-genre-tab.active {
      color: #fff;
      background: #ff6b35;
      border-right-color: transparent;
      border-bottom-color: transparent;
    }

    /* ── BOTTOM BAR: play controls only, no redundant title ── */
    :root[data-layout="tablet-landscape"] .vhs-bottom-bar,
    :root[data-layout="desktop"] .vhs-bottom-bar {
      grid-area: bottom;
      margin-top: 0;
      padding: 6px 16px;
      justify-content: flex-end;
      min-height: 0;
    }

    :root[data-layout="tablet-landscape"] .vhs-selected-info,
    :root[data-layout="desktop"] .vhs-selected-info {
      display: none;
    }

    :root[data-layout="tablet-landscape"] .vhs-tape-icon,
    :root[data-layout="desktop"] .vhs-tape-icon {
      display: none;
    }

    :root[data-layout="tablet-landscape"] .vhs-lib-btn,
    :root[data-layout="desktop"] .vhs-lib-btn {
      width: 48px;
      height: 48px;
      font-size: 20px;
      border-radius: 10px;
    }

    :root[data-layout="tablet-landscape"] .vhs-play-big,
    :root[data-layout="desktop"] .vhs-play-big {
      width: 48px;
      height: 48px;
      font-size: 20px;
      border-radius: 10px;
    }

    /* ── VHS: TABLET PORTRAIT LAYOUT (768–1023px, portrait) ── */
    /*
     * Design goals (from landscape lessons):
     *   - Full screen usage, no dead space
     *   - Emphasis colors on interactive elements only
     *   - Large touch targets (56px+ buttons)
     *   - Jacket hero image as dominant visual
     *   - Same sliding overlay reveal mechanic as landscape
     *   - 4-column tape grid (no horizontal scroll — tapes are the UI)
     */

    :root[data-layout="tablet-portrait"] #vhsView {
      display: flex !important;
      flex-direction: column;
      height: 100%;
      overflow: hidden;
      background: #0d0820;
    }

    /* Header: slim dark bar — same visual language as landscape */
    :root[data-layout="tablet-portrait"] .vhs-header {
      background: #0f0f1a;
      padding: 8px 20px;
      min-height: 0;
      flex-shrink: 0;
    }

    :root[data-layout="tablet-portrait"] .vhs-store-name {
      font-size: 20px;
    }

    :root[data-layout="tablet-portrait"] .vhs-store-sub {
      font-size: 11px;
    }

    /* Hero jacket: top ~30% of screen — decorative, shows selected cover */
    :root[data-layout="tablet-portrait"] .vhs-featured {
      position: relative;
      width: 100%;
      height: 30dvh;
      flex-shrink: 0;
      overflow: hidden;
      margin: 0;
      border-radius: 0;
      border: none;
      background: #0d0820;
      display: block;
      cursor: default;
    }

    /* Jacket image fills the hero strip — tap to dismiss the info overlay */
    :root[data-layout="tablet-portrait"] .vhs-feat-jacket {
      position: absolute;
      inset: 0;
      display: flex;
      align-items: flex-start;
      justify-content: center;
      background: #0d0820;
      overflow: hidden;
      cursor: pointer;
    }

    :root[data-layout="tablet-portrait"] .vhs-jacket-img {
      display: block;
      width: 100%;
      height: 100%;
      object-fit: cover;
      object-position: top center;
    }

    /* Emoji fallback fills hero area */
    :root[data-layout="tablet-portrait"] .vhs-feat-art {
      position: absolute;
      inset: 0;
      font-size: 80px !important;
      display: none;
      align-items: center;
      justify-content: center;
      background: #0d0820;
      width: auto !important;
    }

    /* Overlay: breaks out of .vhs-featured and covers the bottom half (genre bar + tape grid)
       Uses position:fixed so it escapes .vhs-featured's overflow:hidden clip */
    :root[data-layout="tablet-portrait"] .vhs-feat-overlay {
      position: fixed;
      left: 0;
      right: 0;
      bottom: 0;
      /* Height = everything below the jacket hero + header */
      height: calc(100dvh - 30dvh - 42px); /* 42px ≈ header */
      display: flex;
      flex-direction: column;
      justify-content: flex-end;
      overflow: hidden;
      background: linear-gradient(to bottom, transparent 0%, rgba(13,8,32,0.92) 20%, #0d0820 45%);
      padding-top: 48px;
      cursor: default;
      /* Slide up from below on selection */
      transform: translateY(100%);
      transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
      z-index: 10;
    }

    /* Shown when a tape is selected — slides up over the tape grid */
    :root[data-layout="tablet-portrait"] .vhs-feat-overlay.portrait-visible {
      transform: translateY(0);
    }

    /* .revealed has no effect in portrait — portrait-visible controls visibility */
    :root[data-layout="tablet-portrait"] .vhs-feat-overlay.revealed {
      transform: translateY(100%);
    }
    :root[data-layout="tablet-portrait"] .vhs-feat-overlay.revealed.portrait-visible {
      transform: translateY(0);
    }

    /* Spine: suppress in portrait — overlay has gradient top instead */
    :root[data-layout="tablet-portrait"] .vhs-feat-spine {
      display: none;
    }

    /* Info block */
    :root[data-layout="tablet-portrait"] .vhs-feat-info {
      padding: 16px 24px 10px;
      flex-shrink: 0;
    }

    :root[data-layout="tablet-portrait"] .vhs-feat-badge {
      font-size: 10px;
      letter-spacing: 3px;
      margin-bottom: 6px;
    }

    :root[data-layout="tablet-portrait"] .vhs-feat-title {
      font-size: 26px !important;
      font-weight: 800;
      color: #fff;
      white-space: normal;
      line-height: 1.15;
      margin-bottom: 8px;
    }

    :root[data-layout="tablet-portrait"] .vhs-feat-desc {
      display: block;
      font-size: 13px;
      color: #aaa;
      line-height: 1.5;
      margin-bottom: 10px;
    }

    :root[data-layout="tablet-portrait"] .vhs-feat-meta {
      display: flex;
      align-items: center;
      gap: 12px;
      flex-wrap: wrap;
    }

    :root[data-layout="tablet-portrait"] .vhs-rating {
      font-size: 14px;
      padding: 5px 12px;
    }

    :root[data-layout="tablet-portrait"] .vhs-blanks-count {
      font-size: 14px;
    }

    :root[data-layout="tablet-portrait"] .vhs-runtime {
      display: none;
    }

    /* Word prompts — shown in portrait overlay */
    :root[data-layout="tablet-portrait"] .vhs-prompt-list-wrap {
      display: flex;
      flex-direction: column;
      flex: 0 1 auto;
      min-height: 0;
      padding: 10px 24px 0;
      overflow: hidden;
      -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
      mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
    }

    :root[data-layout="tablet-portrait"] .vhs-prompt-list-label {
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 3px;
      color: #ff6b35;
      text-transform: uppercase;
      margin-bottom: 6px;
      flex-shrink: 0;
    }

    :root[data-layout="tablet-portrait"] .vhs-prompt-list {
      list-style: none;
      padding: 0;
      margin: 0;
      overflow: hidden;
    }

    :root[data-layout="tablet-portrait"] .vhs-prompt-list li {
      font-size: 13px;
      color: #aaa;
      padding: 4px 0;
      border-bottom: 1px solid #1e1e2e;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    :root[data-layout="tablet-portrait"] .vhs-prompt-list li:first-child {
      color: #ccc;
    }

    /* Play button: large, full width, anchored to bottom of overlay */
    :root[data-layout="tablet-portrait"] .vhs-rent-btn {
      width: calc(100% - 48px);
      margin: 16px 24px 24px;
      padding: 20px;
      font-size: 20px;
      letter-spacing: 2px;
      border-radius: 14px;
      flex-shrink: 0;
    }

    /* Genre tabs: horizontal pill row, bigger touch target than mobile */
    :root[data-layout="tablet-portrait"] .vhs-genre-bar {
      display: flex;
      flex-direction: row;
      overflow-x: auto;
      scrollbar-width: none;
      padding: 10px 16px;
      gap: 8px;
      flex-shrink: 0;
      background: #0f0f1a;
      border-bottom: 1px solid #1e1e2e;
    }

    :root[data-layout="tablet-portrait"] .vhs-genre-bar::-webkit-scrollbar {
      display: none;
    }

    :root[data-layout="tablet-portrait"] .vhs-genre-tab {
      writing-mode: horizontal-tb;
      transform: none;
      padding: 10px 20px;
      font-size: 13px;
      letter-spacing: 1px;
      border-bottom: none;
      border-radius: 20px;
      background: rgba(255,255,255,0.06);
      color: rgba(255,255,255,0.5);
      min-width: auto;
      white-space: nowrap;
      flex-shrink: 0;
    }

    :root[data-layout="tablet-portrait"] .vhs-genre-tab.active {
      background: #ff6b35;
      color: #fff;
      border-bottom-color: transparent;
    }

    /* Tape shelf: 4-column grid filling the remaining space */
    :root[data-layout="tablet-portrait"] #vhsRight {
      display: flex;
      flex-direction: column;
      flex: 1;
      min-height: 0;
      overflow: hidden;
    }

    :root[data-layout="tablet-portrait"] .vhs-shelf {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      grid-auto-rows: auto;
      gap: 12px;
      padding: 14px 16px;
      align-content: start;
      overflow-x: hidden;
      overflow-y: auto;
      flex: 1;
      scrollbar-width: none;
    }

    :root[data-layout="tablet-portrait"] .vhs-shelf::-webkit-scrollbar {
      display: none;
    }

    /* Tapes: full cell width, aspect-ratio drives height */
    :root[data-layout="tablet-portrait"] .vhs-tape {
      width: 100% !important;
      height: auto !important;
      flex-shrink: 0;
      display: block;
    }

    :root[data-layout="tablet-portrait"] .vhs-tape-body {
      width: 100% !important;
      height: auto !important;
      aspect-ratio: 1 / 2;
      border-radius: 8px;
      overflow: hidden;
      display: block;
    }

    /* Hide base/reels — jacket image is the whole tape card */
    :root[data-layout="tablet-portrait"] .vhs-tape-base,
    :root[data-layout="tablet-portrait"] .vhs-tape > :not(.vhs-tape-body) {
      display: none !important;
    }

    /* Bottom bar: prominent — lib, big play, funhouse */
    :root[data-layout="tablet-portrait"] .vhs-bottom-bar {
      padding: 12px 20px;
      gap: 12px;
      justify-content: flex-end;
      flex-shrink: 0;
      margin-top: 0;
    }

    :root[data-layout="tablet-portrait"] .vhs-selected-info {
      display: none; /* story name visible in hero overlay instead */
    }

    :root[data-layout="tablet-portrait"] .vhs-tape-icon {
      display: none;
    }

    :root[data-layout="tablet-portrait"] .vhs-lib-btn {
      width: 56px;
      height: 56px;
      font-size: 22px;
      border-radius: 12px;
    }

    :root[data-layout="tablet-portrait"] .vhs-play-big {
      flex: 1;            /* fills remaining width */
      height: 56px;
      font-size: 22px;
      border-radius: 12px;
      max-width: 320px;   /* don't let it get absurdly wide */
    }

    .vhs-header {
      background: #0f0f1a;
      padding: 10px 16px 8px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-shrink: 0;
    }
    .vhs-store-name {
      font-size: 16px;
      font-weight: 900;
      color: rgba(255,255,255,0.5);
      letter-spacing: -0.5px;
      text-transform: uppercase;
    }
    .vhs-store-sub {
      font-size: 9px;
      display: block;
      color: rgba(255,255,255,0.25);
      letter-spacing: 2px;
      font-weight: 400;
      text-transform: uppercase;
    }
    .vhs-lib-btn {
      background: rgba(255,255,255,0.1);
      border: none;
      border-radius: 6px;
      font-size: 18px;
      width: 36px;
      height: 36px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }
    .vhs-lib-btn:active { opacity: 0.7; }

    .vhs-genre-bar {
      display: flex;
      gap: 0;
      background: #0f0f1a;
      overflow-x: auto;
      scrollbar-width: none;
      border-bottom: 2px solid #ff6b35;
      flex-shrink: 0;
    }
    .vhs-genre-bar::-webkit-scrollbar { display: none; }
    .vhs-genre-tab {
      padding: 8px 14px;
      font-size: 10px;
      font-weight: 700;
      color: #666;
      letter-spacing: 1.5px;
      text-transform: uppercase;
      white-space: nowrap;
      cursor: pointer;
      transition: color 0.15s;
      flex-shrink: 0;
      border-bottom: 2px solid transparent;
      margin-bottom: -2px;
    }
    .vhs-genre-tab.active { color: #ff6b35; border-bottom-color: #ff6b35; }

    /* Genre count badge — muted number after the label */
    .vhs-genre-count {
      opacity: 0.5;
      font-size: 0.8em;
      font-weight: 600;
      margin-left: 4px;
    }
    /* On vertical tabs (landscape/desktop) the count sits below via writing-mode */
    :root[data-layout="tablet-landscape"] .vhs-genre-count,
    :root[data-layout="desktop"] .vhs-genre-count {
      display: block;
      margin-left: 0;
      margin-top: 2px;
      font-size: 0.75em;
    }

    /* ── VHS FEATURED: mobile — jacket hero fills most of the screen ── */
    .vhs-featured {
      /* Mobile: flex column, jacket hero takes all remaining space above shelf */
      position: relative;
      flex: 1;
      min-height: 0;
      overflow: hidden;
      background: #0d0820;
      display: flex;
      flex-direction: column;
    }
    .vhs-feat-spine {
      /* Hidden on mobile — spine is a landscape/desktop detail */
      display: none;
    }
    /* Jacket container — fills the hero area */
    .vhs-feat-jacket {
      position: absolute;
      inset: 0;
      display: flex;
      align-items: flex-start;
      justify-content: center;
      background: #0d0820;
      overflow: hidden;
      cursor: pointer;
    }
    .vhs-jacket-img {
      display: block;
      width: 100%;
      height: 100%;
      object-fit: cover;
      object-position: top center;
    }

    /* Tape jacket image inside shelf cards */
    .vhs-tape-jacket-img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
      border-radius: 8px;
    }

    /* Emoji fallback */
    .vhs-feat-art {
      position: absolute;
      inset: 0;
      background: #1a0a2e;
      display: none;
      align-items: center;
      justify-content: center;
      font-size: 64px;
      width: auto;
    }

    /* Info overlay: anchored to bottom of the jacket hero, hidden until tape tap */
    .vhs-feat-overlay {
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      background: linear-gradient(to bottom, transparent 0%, rgba(13,8,32,0.9) 30%, #0d0820 60%);
      padding-top: 40px;
      cursor: pointer;
      /* Start hidden below; slides up on portrait-visible */
      transform: translateY(100%);
      transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }
    /* portrait-visible slides the overlay up (shared mobile + tablet-portrait mechanic) */
    .vhs-feat-overlay.portrait-visible {
      transform: translateY(0);
    }
    .vhs-feat-spine {
      display: none;
    }
    .vhs-feat-info {
      padding: 8px 14px 6px;
    }
    .vhs-feat-badge {
      font-size: 8px;
      font-weight: 800;
      color: rgba(255,255,255,0.3);
      letter-spacing: 2px;
      text-transform: uppercase;
      margin-bottom: 3px;
    }
    .vhs-feat-title {
      font-size: 18px;
      font-weight: 800;
      color: #fff;
      line-height: 1.2;
      margin-bottom: 4px;
      white-space: normal;
    }
    .vhs-feat-desc {
      font-size: 11px;
      color: #aaa;
      line-height: 1.4;
      margin-bottom: 4px;
    }
    .vhs-feat-meta {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-top: 4px;
      margin-bottom: 8px;
    }
    .vhs-rating {
      background: rgba(255,255,255,0.12);
      color: rgba(255,255,255,0.4);
      font-size: 9px;
      font-weight: 800;
      padding: 2px 6px;
      border-radius: 3px;
    }
    .vhs-blanks-count {
      font-size: 10px;
      color: #888;
      letter-spacing: 1px;
      text-transform: uppercase;
    }
    .vhs-rent-btn {
      display: none; /* Play lives in bottom bar on mobile */
    }
    .vhs-rent-btn:active { opacity: 0.8; }

    .vhs-shelf-label {
      padding: 8px 16px 5px;
      font-size: 10px;
      font-weight: 700;
      color: #888;
      letter-spacing: 3px;
      text-transform: uppercase;
      display: flex;
      align-items: center;
      gap: 8px;
      flex-shrink: 0;
    }
    .vhs-shelf-label::after {
      content: '';
      flex: 1;
      height: 1px;
      background: #2a2a3e;
    }

    /* Tape shelf: compact horizontal strip below the jacket hero */
    .vhs-shelf {
      padding: 0 12px 6px;
      display: flex;
      gap: 8px;
      overflow-x: auto;
      scrollbar-width: none;
      flex-shrink: 0;
    }
    .vhs-shelf::-webkit-scrollbar { display: none; }

    .vhs-tape {
      flex-shrink: 0;
      width: 64px;
      cursor: pointer;
      position: relative;
    }
    .vhs-tape-body {
      height: 90px;
      border-radius: 3px 3px 0 0;
      display: flex;
      flex-direction: column;
      overflow: hidden;
      border: 1px solid rgba(255,255,255,0.08);
      transition: outline 0.1s;
    }
    .vhs-tape-label {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 5px 4px;
      text-align: center;
    }
    .vhs-tape-emoji { font-size: 18px; margin-bottom: 3px; }
    .vhs-tape-title {
      font-size: 7px;
      font-weight: 800;
      color: rgba(0,0,0,0.85);
      line-height: 1.2;
      text-transform: uppercase;
      letter-spacing: 0.3px;
    }
    .vhs-tape-base {
      height: 18px;
      background: #1a1a2a;
      border-radius: 0 0 2px 2px;
      border: 1px solid rgba(255,255,255,0.08);
      border-top: 2px solid rgba(0,0,0,0.3);
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
    }
    .vhs-reel {
      width: 10px;
      height: 10px;
      border-radius: 50%;
      background: #333;
      border: 2px solid #555;
      position: relative;
    }
    .vhs-reel::after {
      content: '';
      position: absolute;
      width: 3px;
      height: 3px;
      background: #111;
      border-radius: 50%;
      top: 50%;
      left: 50%;
      transform: translate(-50%,-50%);
    }

    /* Tape color palettes — slot 0-7 */
    .vhs-tape[data-slot="0"] .vhs-tape-body { background: #e63946; }
    .vhs-tape[data-slot="1"] .vhs-tape-body { background: #457b9d; }
    .vhs-tape[data-slot="2"] .vhs-tape-body { background: #2d6a4f; }
    .vhs-tape[data-slot="3"] .vhs-tape-body { background: #f4a261; }
    .vhs-tape[data-slot="4"] .vhs-tape-body { background: #7b2d8b; }
    .vhs-tape[data-slot="5"] .vhs-tape-body { background: #2b4f7a; }
    .vhs-tape[data-slot="6"] .vhs-tape-body { background: #8b4513; }
    .vhs-tape[data-slot="7"] .vhs-tape-body { background: #1a5c3a; }

    .vhs-tape.locked .vhs-tape-body { filter: brightness(0.35) saturate(0.2); }
    .vhs-tape.locked::after {
      content: '🔒';
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -60%);
      font-size: 16px;
    }
    .vhs-tape.selected .vhs-tape-body {
      outline: 2px solid #ff6b35;
      outline-offset: 2px;
    }

    .vhs-bottom-bar {
      background: #0f0f1a;
      border-top: 1px solid #2a2a3e;
      padding: 10px 14px;
      display: flex;
      align-items: center;
      gap: 8px;
      flex-shrink: 0;
      margin-top: auto;
    }

    /* On mobile the lib button lives in the bottom bar but stays hidden —
       mobile users access library via phaseLibrary flow separately */
    :root[data-layout="mobile"] .vhs-bottom-bar .vhs-lib-btn {
      display: none;
    }
    .vhs-tape-icon {
      width: 34px;
      height: 24px;
      background: #ff6b35;
      border-radius: 3px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }
    .vhs-tape-icon-inner {
      width: 22px;
      height: 14px;
      background: rgba(0,0,0,0.3);
      border-radius: 2px;
      display: flex;
      align-items: center;
      justify-content: space-evenly;
      padding: 2px;
    }
    .vhs-tape-icon-reel {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: #fff;
      opacity: 0.8;
    }
    .vhs-selected-info { flex: 1; min-width: 0; }
    .vhs-selected-name {
      font-size: 12px;
      font-weight: 700;
      color: #fff;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .vhs-selected-sub {
      font-size: 9px;
      color: #888;
      margin-top: 1px;
    }
    .vhs-play-big {
      background: #ff6b35;
      border: none;
      border-radius: 8px;
      width: 40px;
      height: 40px;
      font-size: 16px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      color: #fff;
      font-weight: 900;
    }
    .vhs-play-big:active { opacity: 0.8; }

    /* ══════════════════════════════════════════════════════════════════════
       RESPONSIVE LAYOUT SYSTEM
       Triggered by data-layout on <html> (set by device.js).
       Tiers: mobile (default) | tablet-portrait | tablet-landscape | desktop
    ══════════════════════════════════════════════════════════════════════ */

    /* ── TABLET PORTRAIT (768–1023px, portrait) ─────────────────────────── */
    :root[data-layout="tablet-portrait"] body {
      background: #1a0d2e;
      padding: 0;
      justify-content: flex-start;
      align-items: stretch;
    }

    :root[data-layout="tablet-portrait"] .iphone-frame {
      /* Strip the phone chrome — fill the full viewport */
      width: 100%;
      height: 100dvh;           /* dynamic viewport height */
      border-radius: 0;
      border: none;
      box-shadow: none;
      padding: 0;
      padding-top: var(--safe-top, env(safe-area-inset-top, 0px));
      padding-bottom: var(--safe-bottom, env(safe-area-inset-bottom, 0px));
    }

    /* Hide Dynamic Island notch and side button on non-phone frames */
    :root[data-layout="tablet-portrait"] .iphone-frame::before,
    :root[data-layout="tablet-portrait"] .iphone-frame::after {
      display: none;
    }

    /* ── TABLET LANDSCAPE (768–1023px, landscape) ───────────────────────── */
    :root[data-layout="tablet-landscape"] body {
      background: #1a0d2e;
      padding: 0;
      justify-content: center;
      align-items: stretch;
    }

    :root[data-layout="tablet-landscape"] .iphone-frame {
      width: 100%;
      height: 100dvh;
      border-radius: 0;
      border: none;
      box-shadow: none;
      padding: 0;
      padding-top: var(--safe-top, env(safe-area-inset-top, 0px));
      padding-bottom: var(--safe-bottom, env(safe-area-inset-bottom, 0px));
      padding-left: var(--safe-left, env(safe-area-inset-left, 0px));
      padding-right: var(--safe-right, env(safe-area-inset-right, 0px));
      /* Landscape: content is wider; cap it so the app doesn't stretch absurdly wide */
      max-width: 900px;
      margin: 0 auto;
    }

    :root[data-layout="tablet-landscape"] .iphone-frame::before,
    :root[data-layout="tablet-landscape"] .iphone-frame::after {
      display: none;
    }

    /* ── DESKTOP (≥ 1024px) ─────────────────────────────────────────────── */
    :root[data-layout="desktop"] body {
      background: #0d0820;
      padding: 0;
      justify-content: center;
      align-items: center;
      min-height: 100dvh;
    }

    :root[data-layout="desktop"] .iphone-frame {
      width: min(1100px, 95vw);
      max-width: 1100px;
      height: min(820px, 95dvh);
      border-radius: 24px;
      border: 1px solid #2a2a4e;
      box-shadow:
        0 0 0 1px #1a1a3a,
        0 40px 100px rgba(0,0,0,0.8);
      padding: 0;
    }

    /* Keep notch hidden on desktop — looks odd on a card */
    :root[data-layout="desktop"] .iphone-frame::before,
    :root[data-layout="desktop"] .iphone-frame::after {
      display: none;
    }

    /* ── SHARED: full-width phases on non-mobile ─────────────────────────── */
    :root[data-layout="tablet-portrait"] .phase,
    :root[data-layout="tablet-landscape"] .phase,
    :root[data-layout="desktop"] .phase {
      /* Phases already default to display:none; active overrides handle display */
    }

    /* Expand auth / reset / record screens to fill their container */
    :root[data-layout="tablet-portrait"] #phaseAuth.active,
    :root[data-layout="tablet-landscape"] #phaseAuth.active,
    :root[data-layout="desktop"] #phaseAuth.active {
      padding: 48px 32px;
    }

    :root[data-layout="tablet-portrait"] .auth-card,
    :root[data-layout="tablet-landscape"] .auth-card,
    :root[data-layout="desktop"] .auth-card {
      max-width: 420px;
      margin: 0 auto;
    }

    /* Library gets more breathing room */
    :root[data-layout="tablet-portrait"] #phaseLibrary.active,
    :root[data-layout="tablet-landscape"] #phaseLibrary.active,
    :root[data-layout="desktop"] #phaseLibrary.active {
      padding-top: 0;
    }

    /* Recording screen */
    :root[data-layout="tablet-portrait"] #phaseRecord.active,
    :root[data-layout="tablet-landscape"] #phaseRecord.active,
    :root[data-layout="desktop"] #phaseRecord.active {
      padding: 32px 32px;
    }

    /* VHS tape shelf: tapes can be a bit larger on bigger screens */
    :root[data-layout="tablet-portrait"] .vhs-tape,
    :root[data-layout="tablet-landscape"] .vhs-tape,
    :root[data-layout="desktop"] .vhs-tape {
      width: 76px;
    }

    :root[data-layout="tablet-portrait"] .vhs-tape-body,
    :root[data-layout="tablet-landscape"] .vhs-tape-body,
    :root[data-layout="desktop"] .vhs-tape-body {
      height: 108px;
    }

    /* Featured banner gets a bit more padding */
    :root[data-layout="tablet-portrait"] .vhs-feat-art,
    :root[data-layout="tablet-landscape"] .vhs-feat-art,
    :root[data-layout="desktop"] .vhs-feat-art {
      width: 80px;
      font-size: 32px;
    }

    :root[data-layout="tablet-portrait"] .vhs-feat-title,
    :root[data-layout="tablet-landscape"] .vhs-feat-title,
    :root[data-layout="desktop"] .vhs-feat-title {
      font-size: 16px;
    }

    :root[data-layout="tablet-portrait"] .vhs-feat-desc,
    :root[data-layout="tablet-landscape"] .vhs-feat-desc,
    :root[data-layout="desktop"] .vhs-feat-desc {
      font-size: 11px;
    }

    /* ── MOBILE — strip phone frame, fill viewport ───────────────────────── */
    :root[data-layout="mobile"] body {
      background: #0d0820;
      padding: 0;
      justify-content: flex-start;
      align-items: stretch;
    }

    :root[data-layout="mobile"] .iphone-frame {
      width: 100%;
      height: 100dvh;
      border-radius: 0;
      border: none;
      box-shadow: none;
      padding: 0;
      padding-top: var(--safe-top, env(safe-area-inset-top, 0px));
      padding-bottom: var(--safe-bottom, env(safe-area-inset-bottom, 0px));
    }

    :root[data-layout="mobile"] .iphone-frame::before,
    :root[data-layout="mobile"] .iphone-frame::after {
      display: none;
    }

    /* ── MOBILE: VHS layout — jacket hero fills, shelf is a compact strip ── */

    :root[data-layout="mobile"] #vhsView {
      display: flex;
      flex-direction: column;
      height: 100%;
      overflow: hidden;
    }

    :root[data-layout="mobile"] .vhs-header {
      flex-shrink: 0;
    }

    :root[data-layout="mobile"] .vhs-featured {
      flex: 1;
      min-height: 0;
      margin: 0;
      border-radius: 0;
      border: none;
    }

    /* Right container: compact bottom block — genre bar on top, shelf below */
    :root[data-layout="mobile"] #vhsRight {
      flex-shrink: 0;
      display: flex;
      flex-direction: column;
      background: #0f0f1a;
      border-top: 1px solid #1e1e2e;
      transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                  opacity 0.35s ease;
      max-height: 200px; /* large enough to never clip; collapses to 0 in fullscreen */
      overflow: hidden;
    }

    /* Fullscreen mode: collapse genre bar + shelf to reveal full jacket */
    :root[data-layout="mobile"] #vhsView.jacket-fullscreen #vhsRight {
      max-height: 0;
      opacity: 0;
      pointer-events: none;
    }

    :root[data-layout="mobile"] #vhsView.jacket-fullscreen .vhs-header {
      opacity: 0;
      pointer-events: none;
      max-height: 0;
      overflow: hidden;
    }

    /* Genre bar: tighter on mobile */
    :root[data-layout="mobile"] .vhs-genre-bar {
      padding: 0;
      border-bottom: 1px solid #1e1e2e;
    }

    :root[data-layout="mobile"] .vhs-genre-tab {
      padding: 6px 10px;
      font-size: 9px;
    }

    /* Tape shelf: horizontal, compact */
    :root[data-layout="mobile"] .vhs-shelf {
      padding: 8px 12px 8px;
      gap: 8px;
      background: #0f0f1a;
    }

    /* Tapes: portrait cards sized for horizontal strip */
    :root[data-layout="mobile"] .vhs-tape {
      width: 48px;
    }

    :root[data-layout="mobile"] .vhs-tape-body {
      width: 48px;
      height: 72px;
      border-radius: 4px;
      overflow: hidden;
    }

    /* Show jacket image in shelf cards on mobile */
    :root[data-layout="mobile"] .vhs-tape-jacket-img {
      display: block;
      border-radius: 4px;
    }

    /* Hide text label — jacket image is enough at this size */
    :root[data-layout="mobile"] .vhs-tape-label,
    :root[data-layout="mobile"] .vhs-tape-base {
      display: none;
    }

    /* Bottom bar: lib + play + funhouse */
    :root[data-layout="mobile"] .vhs-bottom-bar {
      margin-top: 0;
      padding: 8px 14px;
      padding-bottom: max(8px, var(--safe-bottom, 0px));
      justify-content: flex-end;
      transition: opacity 0.35s ease;
    }

    :root[data-layout="mobile"] #vhsView.jacket-fullscreen .vhs-bottom-bar {
      opacity: 0;
      pointer-events: none;
    }

    /* Show lib button on mobile */
    :root[data-layout="mobile"] .vhs-bottom-bar .vhs-lib-btn {
      display: flex;
      width: 44px;
      height: 44px;
    }

    :root[data-layout="mobile"] .vhs-selected-info {
      flex: 1;
    }

    :root[data-layout="mobile"] .vhs-play-big {
      width: 44px;
      height: 44px;
    }

    /* ══════════════════════════════════════════════════════
       VHS BRANDING — non-VHS screens
    ══════════════════════════════════════════════════════ */

    /* Orange button (replaces purple btn-primary on branded screens) */
    .btn-orange {
      background: #ff6b35;
      color: white;
      border: none;
    }
    .btn-orange:active { opacity: 0.85; }

    /* ── START (Let's Go) SCREEN ── */
    #phaseStart.active {
      display: flex !important;
      flex-direction: column;
      align-items: center;
      width: 100%;
      padding: 20px 20px 24px;
      flex: 1;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
    }
    .start-now-playing {
      font-size: 9px;
      font-weight: 800;
      color: #ff6b35;
      letter-spacing: 4px;
      text-transform: uppercase;
      margin-bottom: 14px;
      align-self: flex-start;
    }
    /* Jacket image on start screen */
    .start-jacket-wrap {
      width: 100%;
      display: flex;
      justify-content: center;
      margin-bottom: 16px;
    }
    .start-jacket-img-wrap {
      position: relative;
      width: 140px;
      height: 280px; /* 1:2 ratio matching the 300×600 jacket source */
      border-radius: 6px;
      overflow: hidden;
      box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 0 0 2px #ff6b3544;
    }
    .start-jacket-img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }
    .start-jacket-emoji {
      position: absolute;
      inset: 0;
      display: none;
      align-items: center;
      justify-content: center;
      font-size: 56px;
      background: #1a0a2e;
    }
    /* VHS tape label-strip styling for title */
    .start-tape-label {
      display: flex;
      align-items: center;
      gap: 8px;
      width: 100%;
      margin-bottom: 12px;
    }
    .start-tape-label-line {
      flex: 1;
      height: 1px;
      background: rgba(255,107,53,0.3);
    }
    .start-tape-title {
      font-size: 1rem;
      font-weight: 800;
      color: #fff;
      letter-spacing: 0.3px;
      text-align: center;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 70%;
    }
    #phaseStart .phase-desc {
      font-size: 0.88rem;
      color: var(--text-muted);
      line-height: 1.6;
      text-align: center;
      margin-bottom: 20px;
      width: 100%;
    }
    /* Let's Go button — centered, not full width */
    .start-go-btn {
      padding: 12px 40px;
      font-size: 1rem;
      width: auto;
      min-width: 160px;
    }

    /* ── REVIEW SCREEN ACTIVE ── */
    #phaseReview.active {
      display: flex !important;
      flex-direction: column;
      width: 100%;
      padding: 24px;
    }

    /* ── RECORDING SCREEN ── */
    .rec-booth-label {
      font-size: 10px;
      font-weight: 800;
      letter-spacing: 3px;
      text-transform: uppercase;
      color: rgba(255,107,53,0.7);
      text-align: center;
      margin-bottom: 6px;
    }
    .rec-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 12px;
      width: 100%;
    }
    .rec-counter {
      font-size: 10px;
      font-weight: 800;
      color: rgba(255,255,255,0.4);
      letter-spacing: 2px;
      text-transform: uppercase;
    }
    .rec-indicator {
      display: flex;
      align-items: center;
      gap: 5px;
      font-size: 10px;
      font-weight: 800;
      letter-spacing: 2px;
      color: rgba(255,255,255,0.25);
      transition: color 0.2s;
    }
    .rec-indicator.active {
      color: #ef4444;
    }
    .rec-dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: rgba(255,255,255,0.2);
      transition: background 0.2s;
    }
    .rec-indicator.active .rec-dot {
      background: #ef4444;
      animation: pulse 1s infinite;
    }
    /* Tape-counter style progress bar */
    .rec-progress-bar-wrap {
      width: 100%;
      height: 4px;
      background: rgba(255,255,255,0.06);
      border-radius: 2px;
      margin-bottom: 20px;
      overflow: hidden;
    }
    .rec-progress-bar {
      height: 100%;
      background: linear-gradient(90deg, #ff6b35, #ffaa72);
      border-radius: 2px;
      width: 0%;
      transition: width 0.4s ease;
    }

    /* ── REVIEW SCREEN ── */
    .review-vhs-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 16px;
    }
    .review-vhs-label {
      font-size: 9px;
      font-weight: 800;
      color: #ff6b35;
      letter-spacing: 3px;
      text-transform: uppercase;
    }
    .review-vhs-icon {
      font-size: 12px;
      color: rgba(255,255,255,0.3);
      letter-spacing: -2px;
    }

    /* ── READY SCREEN ── */
    #phaseReady.active {
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: 28px 24px;
    }
    .ready-tape-wrap {
      display: flex;
      justify-content: center;
      margin-bottom: 20px;
    }
    .ready-tape {
      display: flex;
      flex-direction: column;
      align-items: center;
    }
    .ready-tape-body {
      width: 180px;
      height: 108px;
      background: linear-gradient(180deg, #2d1f4e 0%, #1a1230 100%);
      border-radius: 6px 6px 0 0;
      border: 2px solid #3a3060;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: space-around;
      padding: 10px 12px 6px;
      box-shadow: 0 6px 20px rgba(0,0,0,0.5);
      position: relative;
    }
    /* Orange accent stripe on ready tape */
    .ready-tape-body::before {
      content: '';
      position: absolute;
      top: 0; left: 0; right: 0;
      height: 3px;
      background: #ff6b35;
      border-radius: 6px 6px 0 0;
    }
    .ready-tape-window {
      width: 140px;
      height: 42px;
      background: #080612;
      border-radius: 4px 4px 20px 20px;
      border: 1.5px solid #ff6b35;
      display: flex;
      align-items: center;
      padding: 5px 10px;
      gap: 0;
    }
    .ready-tape-reel {
      width: 28px;
      height: 28px;
      border-radius: 50%;
      background: #1a1230;
      border: 2px solid #ff6b35;
      position: relative;
      flex-shrink: 0;
    }
    .ready-tape-reel::after {
      content: '';
      position: absolute;
      width: 8px;
      height: 8px;
      background: #ff6b35;
      border-radius: 50%;
      top: 50%; left: 50%;
      transform: translate(-50%, -50%);
    }
    /* Full reel (left) has solid center — recorded */
    .ready-tape-reel.full {
      background: #2a1a4e;
      border-color: #ff6b35;
    }
    /* Empty reel (right) has more space — played out */
    .ready-tape-reel.empty {
      background: #0d0820;
      border-color: #555;
    }
    .ready-tape-reel.empty::after {
      background: #444;
    }
    .ready-tape-tape {
      flex: 1;
      height: 3px;
      background: #333;
      margin: 0 4px;
    }
    .ready-tape-label-strip {
      text-align: center;
    }
    .ready-tape-label-title {
      font-size: 9px;
      font-weight: 800;
      color: #ff6b35;
      letter-spacing: 2.5px;
      text-transform: uppercase;
    }
    .ready-tape-label-sub {
      font-size: 7px;
      color: rgba(255,255,255,0.3);
      letter-spacing: 2px;
      text-transform: uppercase;
      margin-top: 2px;
    }
    .ready-tape-base {
      width: 184px;
      height: 20px;
      background: #111;
      border-radius: 0 0 4px 4px;
      border: 2px solid #2a2040;
      border-top: none;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .ready-tape-slot {
      width: 60px;
      height: 6px;
      background: #080612;
      border-radius: 3px;
      border: 1px solid #333;
    }
    #phaseReady .phase-title {
      color: #fff;
      margin-bottom: 4px;
    }
    #phaseReady .phase-desc {
      margin-bottom: 20px;
    }

    /* ── PLAYBACK / CAPTION SCREEN ── */
    #phasePlay.active {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: flex-start;
      flex: 1;
      width: 100%;
      padding: 16px;
    }
    .play-screen {
      display: flex;
      flex-direction: column;
      align-items: center;
      width: 100%;
      gap: 16px;
    }
    /* TV / monitor outer frame */
    .play-tv-frame {
      width: 100%;
      max-width: 340px;
      background: linear-gradient(180deg, #1e1e2e 0%, #141420 100%);
      border-radius: 16px 16px 8px 8px;
      border: 3px solid #2a2a40;
      box-shadow:
        0 0 0 1px #3a3a5a,
        0 8px 32px rgba(0,0,0,0.7),
        inset 0 1px 0 rgba(255,255,255,0.05);
      overflow: hidden;
    }
    /* The screen surface */
    .play-tv-screen {
      position: relative;
      width: 100%;
      aspect-ratio: 4/3;
      background: #050510;
      overflow: hidden;
      display: flex;
      flex-direction: column;
      justify-content: flex-end;
    }
    /* CRT scanlines overlay */
    .play-scanlines {
      position: absolute;
      inset: 0;
      pointer-events: none;
      background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0,0,0,0.15) 2px,
        rgba(0,0,0,0.15) 4px
      );
      z-index: 1;
    }
    /* CC label badge (top-left) */
    .play-cc-label {
      position: absolute;
      top: 10px;
      left: 12px;
      font-size: 9px;
      font-weight: 800;
      color: rgba(255,255,255,0.7);
      background: rgba(0,0,0,0.6);
      padding: 2px 6px;
      border-radius: 3px;
      letter-spacing: 1px;
      z-index: 2;
      border: 1px solid rgba(255,255,255,0.2);
    }
    /* Caption text area */
    .play-cc-text {
      position: absolute;
      top: 36px; /* below the CC badge */
      left: 0;
      right: 0;
      z-index: 2;
      padding: 8px 14px 10px;
      font-family: 'Anton', Arial Narrow, Impact, sans-serif;
      font-weight: 400;
      font-size: 1.3rem;
      letter-spacing: 0.05em;
      line-height: 1.45;
      color: #fff;
      text-shadow: 0 1px 6px rgba(0,0,0,0.9), 0 0 8px rgba(255,255,255,0.2);
      background: linear-gradient(rgba(0,0,0,0.75) 80%, transparent 100%);
      word-wrap: break-word;
      hyphens: auto;
      max-height: 55%;
      overflow: hidden;
      opacity: 1;
      animation: ccFadeIn 0.35s ease forwards;
    }
    /* Fade-in animation for new captions */
    @keyframes ccFadeIn {
      from { opacity: 0; transform: translateY(3px); }
      to   { opacity: 1; transform: translateY(0); }
    }
    /* Status bar at bottom of screen */
    .play-status-bar {
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      height: 32px;
      background: rgba(0,0,0,0.75);
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 12px;
      z-index: 3;
      border-top: 1px solid rgba(255,255,255,0.06);
    }
    .play-status-left {
      display: flex;
      align-items: center;
      gap: 6px;
    }
    /* REC dot on playback screen — lights up during narrator */
    .play-rec-dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: rgba(255,255,255,0.15);
      transition: background 0.2s;
    }
    .play-rec-dot.active {
      background: #ef4444;
      animation: pulse 1s infinite;
    }
    .play-status-text {
      font-size: 9px;
      font-weight: 700;
      color: rgba(255,255,255,0.4);
      letter-spacing: 2px;
      text-transform: uppercase;
    }
    .play-timecode {
      font-family: 'Courier New', Courier, monospace;
      font-size: 10px;
      color: rgba(255,107,53,0.7);
      letter-spacing: 1px;
    }
    /* TV bezel bottom with knobs */
    .play-tv-bezel-bottom {
      height: 28px;
      background: linear-gradient(180deg, #141420 0%, #1a1a28 100%);
      display: flex;
      align-items: center;
      justify-content: flex-end;
      padding: 0 16px;
      gap: 8px;
      border-top: 1px solid rgba(255,255,255,0.04);
    }
    .play-tv-knob {
      width: 14px;
      height: 14px;
      border-radius: 50%;
      background: radial-gradient(circle at 35% 35%, #3a3a5a, #1a1a2e);
      border: 1px solid #4a4a6a;
    }
    /* Controls below TV — Play Again only */
    .play-controls {
      display: flex;
      gap: 10px;
      width: 100%;
      max-width: 340px;
    }
    .play-ctrl-btn {
      flex: 1;
      padding: 12px;
      font-size: 0.9rem;
    }
    /* Bottom actions pinned to bottom of phasePlay */
    .play-bottom-actions {
      display: flex;
      flex-direction: column;
      gap: 10px;
      width: 100%;
      max-width: 340px;
      margin-top: auto;
      padding-top: 12px;
    }
    .play-bottom-btn {
      width: 100%;
      padding: 12px;
      font-size: 0.9rem;
    }

    /* Color the user-clip caption differently in JS */
    .play-cc-text[data-type="clip"] {
      color: #ff9955;
      letter-spacing: 2px;
    }
    .play-cc-text[data-type="narrator"] {
      color: #e2e8f0;
    }
    .play-cc-text[data-type="end"] {
      color: #ff6b35;
      text-align: center;
      font-size: 1.5rem;
    }