.mobile-opening, .mobile-score-label, .mobile-music-mute, .mobile-about-open { display: none; }

@media (max-width: 700px) {
  .mobile-opening {
    position: relative; z-index: 5; display: none; place-items: center;
    width: 100%; height: 100svh;
    overflow: hidden; background: #020403;
  }
  html.mobile-intro-active .mobile-opening { display: grid; }
  .mobile-opening img {
    display: block; width: min(82vw, 370px); height: auto;
    opacity: 1; transform: translateY(-12px) scale(1);
    animation: mobile-logo-reveal 620ms cubic-bezier(.2, 0, 0, 1) both;
    transition: opacity 260ms ease, transform 420ms cubic-bezier(.2, 0, 0, 1);
  }
  @keyframes mobile-logo-reveal {
    from { opacity: 0; transform: translateY(8px) scale(.94); }
    to { opacity: 1; transform: translateY(-12px) scale(1); }
  }
  .mobile-opening.is-leaving img { opacity: .28; transform: translateY(-22px) scale(1.06); }
  .mobile-opening-status {
    position: absolute; left: 20px; right: 20px; bottom: max(34px, env(safe-area-inset-bottom));
    margin: 0; color: #aebbb0; text-align: center;
    font: 500 12px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  }

  html[data-theme="night"] body { background: #050806; }
  html[data-theme="night"] body .desk-surface,
  html[data-theme="night"] body #desk-light { display: none; }
  html[data-theme="night"] .page-shell::before { background: transparent; }
  html[data-theme] .page-shell {
    min-height: 100dvh;
    padding-inline: 0;
  }

  html[data-theme] .site-header {
    display: flex; align-items: center; justify-content: center;
    height: calc(156px + env(safe-area-inset-top)); padding: 0;
  }
  html[data-theme] .brand {
    position: absolute; z-index: 2; top: calc(18px + env(safe-area-inset-top)); left: 50%;
    display: block; width: min(41vw, 155px); height: auto; min-width: 0;
    transform: translateX(-50%);
  }
  html[data-theme] .brand img { width: 100%; height: auto; }
  html[data-theme] .header-actions {
    position: absolute; top: calc(105px + env(safe-area-inset-top)); left: 0;
    display: flex; align-items: center; justify-content: center;
    width: 100%; gap: 8px; margin: 0;
    padding-inline: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right));
  }
  html[data-theme] #settings-toggle, html[data-theme] .settings-panel { display: none !important; }
  html[data-theme] #theme-toggle,
  html[data-theme] .mobile-glass-button {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    flex: 0 0 auto; height: 44px; min-height: 44px; padding: 0 12px; gap: 6px;
    border: 1px solid rgba(255, 255, 255, .37); border-radius: 999px;
    background: linear-gradient(145deg, rgba(255, 255, 255, .23), rgba(255, 255, 255, .05)), rgba(30, 41, 42, .48);
    color: #f4f7ef; box-shadow: 0 7px 22px rgba(0, 0, 0, .22), inset 0 1px 0 rgba(255, 255, 255, .34), inset 0 -1px 0 rgba(255, 255, 255, .09);
    backdrop-filter: blur(18px) saturate(1.5); -webkit-backdrop-filter: blur(18px) saturate(1.5);
    font: 600 12px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    white-space: nowrap; cursor: pointer; touch-action: manipulation;
    transition: scale 180ms cubic-bezier(.2,0,0,1), background-color 180ms ease, box-shadow 180ms ease;
  }
  html[data-theme] #theme-toggle { width: 99px; }
  html[data-theme] #theme-label { display: inline; }
  html[data-theme] #theme-toggle .theme-icon { color: inherit; font-size: 18px; line-height: 1; }
  html[data-theme] .mobile-glass-button::before,
  html[data-theme] #theme-toggle::before {
    content: ""; position: absolute; inset: 1px; border-radius: inherit;
    background: radial-gradient(ellipse at 26% 0%, rgba(255,255,255,.22), transparent 65%);
    pointer-events: none;
  }
  html[data-theme] #theme-toggle:active,
  html[data-theme] .mobile-glass-button:active { scale: .96; }
  html[data-theme="day"] #theme-toggle,
  html[data-theme="day"] .mobile-glass-button {
    border-color: rgba(255, 255, 255, .84);
    background: linear-gradient(145deg, rgba(255,255,255,.88), rgba(255,255,255,.37)), rgba(247, 240, 230, .55);
    color: #2a3b31;
    box-shadow: 0 7px 19px rgba(49, 54, 41, .11), inset 0 1px 0 rgba(255,255,255,.95), inset 0 -1px 0 rgba(96, 92, 75, .11);
  }
  html[data-theme] .mobile-music-mute { display: inline-flex; width: 88px; }
  .mobile-music-mute svg { width: 18px; height: 18px; flex: 0 0 18px; }
  .mobile-music-mute .speaker-off,
  .mobile-music-mute[aria-pressed="true"] .speaker-on { display: none; }
  .mobile-music-mute[aria-pressed="true"] .speaker-off { display: block; }
  html[data-theme] .mobile-about-open {
    width: 76px;
  }
  @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    html[data-theme="night"] #theme-toggle,
    html[data-theme="night"] .mobile-glass-button { background: #293531; }
  }

  html[data-theme] .experience {
    display: flex; flex-direction: column; align-items: center;
    gap: 0; min-height: 0; padding: 0 0 calc(20px + env(safe-area-inset-bottom));
  }
  html[data-theme] .intro { display: none; }
  html[data-theme] .phone-area {
    order: 0; flex: 0 0 auto; align-self: center;
    width: clamp(320px, min(142vw, 600px, calc(66.667dvh - 120px - env(safe-area-inset-top) - env(safe-area-inset-bottom))), 600px); max-width: none;
    margin: 0; padding: 0; transform-origin: center top;
    transition: opacity 520ms ease, scale 680ms cubic-bezier(.2, 0, 0, 1);
  }
  .mobile-intro-active .phone-area { opacity: .55; scale: .86; }
  html[data-theme] .phone { width: 100%; }
  html[data-theme] .phone-caption { display: none; }

  html[data-theme] .mobile-sheet {
    position: fixed; inset: auto 0 0; width: 100%; max-width: none;
    max-height: min(82dvh, 680px); margin: 0; padding: 0;
    border: 1px solid var(--ui-line); border-bottom: 0;
    border-radius: 24px 24px 0 0; overflow-y: auto;
    background: var(--ui-bg); color: var(--ui-ink);
    box-shadow: 0 -20px 60px rgba(0,0,0,.35);
    overscroll-behavior: contain;
    transform: translateY(var(--sheet-drag, 0px));
    transition: transform 220ms cubic-bezier(.2,0,0,1);
  }
  html[data-theme] .mobile-sheet::backdrop { background: rgba(0, 0, 0, .66); }
  html[data-theme] .mobile-sheet[open] { animation: mobile-sheet-in 340ms cubic-bezier(.2,0,0,1) both; }
  @keyframes mobile-sheet-in { from { transform: translateY(100%); } to { transform: translateY(0); } }
  html[data-theme] .mobile-sheet.is-dragging { animation: none; transition: none; }
  html[data-theme] .mobile-sheet.is-closing { animation: none; transform: translateY(100%); }
  html[data-theme] .mobile-sheet-top {
    position: sticky; z-index: 1; top: 0; min-height: 72px;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 18px 16px 0 24px; background: var(--ui-bg);
    touch-action: none;
  }
  html[data-theme] .mobile-sheet-top::before {
    content: ""; position: absolute; top: 9px; left: 50%;
    width: 36px; height: 4px; border-radius: 999px;
    background: var(--ui-muted); opacity: .45; transform: translateX(-50%);
  }
  html[data-theme] .mobile-sheet-top button {
    display: grid; place-items: center; width: 44px; height: 44px;
    border: 1px solid var(--ui-line); border-radius: 12px;
    background: var(--ui-surface); color: var(--ui-ink); font-size: 24px;
    transition: scale 180ms cubic-bezier(.2,0,0,1);
  }
  html[data-theme] .mobile-sheet-top button:active { scale: .96; }
  html[data-theme] .maker-dialog-body { padding: 24px 24px max(30px, env(safe-area-inset-bottom)); }
  html[data-theme] .maker-dialog h2 { font-size: clamp(36px, 10vw, 44px); }
  html[data-theme] .maker-dialog-body > p:not(.maker-overline) { font-size: 15px; line-height: 1.55; }

  html[data-theme] .mobile-score-dialog-body { padding: 5px 24px max(28px, env(safe-area-inset-bottom)); }
  .mobile-score-kicker { color: var(--ui-muted); font-size: 11px; font-weight: 700; letter-spacing: .11em; }
  html[data-theme] .mobile-score-dialog h2 {
    margin: 0; color: var(--ui-ink); font-size: clamp(27px, 7vw, 34px);
    font-weight: 620; letter-spacing: -.045em; line-height: 1.1; text-wrap: balance;
  }
  html[data-theme] #mobile-score-description {
    margin: 9px 0 18px; color: var(--ui-muted); font-size: 14px; line-height: 1.45; text-wrap: pretty;
  }
  html[data-theme] .mobile-score-dialog .score-panel {
    width: 100%; max-width: none; margin: 0; padding: 0; border: 0;
    border-radius: 0; background: transparent; box-shadow: none; backdrop-filter: none;
  }
  html[data-theme] .mobile-score-dialog .score-value,
  html[data-theme] .mobile-score-dialog .score-value.t-digit-group {
    color: var(--ui-accent); font-size: clamp(56px, 16vw, 72px); line-height: 1;
    font-variant-numeric: tabular-nums;
  }
  html[data-theme] .mobile-score-dialog .share-button { display: none; }
  html[data-theme] .mobile-score-dialog .share-options {
    display: grid; grid-column: 1 / -1; grid-row: 3; margin-top: 18px;
    border-top: 1px solid var(--ui-line);
  }
  html[data-theme] .mobile-score-dialog .story-preview { margin-top: 14px; }
  html[data-theme] .mobile-score-dialog .share-grid button,
  html[data-theme] .mobile-score-dialog .share-grid a { min-height: 44px; }
  html[data-theme] .mobile-score-dismiss-hint {
    margin: 19px 0 0; color: var(--ui-muted); font-size: 12px;
    line-height: 1.35; text-align: center;
  }

  html[data-theme] .score-panel {
    display: none; order: 2; align-self: center; grid-template-columns: minmax(0, 1fr) 112px;
    grid-template-rows: auto auto auto; align-items: center; gap: 0 8px;
    width: min(100%, 390px); max-width: 390px; margin: 12px 0 0;
    padding: 11px 12px; border-radius: 16px;
    background: var(--ui-surface);
  }
  html[data-theme] .score-panel-toggle { display: none; }
  html[data-theme] .mobile-score-label {
    display: block; grid-column: 1; grid-row: 1;
    color: var(--ui-muted); font-size: 10px; font-weight: 700; letter-spacing: .12em;
  }
  html[data-theme] .score-value, html[data-theme] .score-value.t-digit-group {
    grid-column: 1; grid-row: 2; margin: 0; font-size: 34px; font-weight: 650;
    line-height: 1.08; letter-spacing: -.06em;
  }
  html[data-theme] .score-panel-content,
  html[data-theme] .score-panel-content-inner { display: contents; }
  html[data-theme] .share-button {
    grid-column: 2; grid-row: 1 / 3; align-self: center;
    width: 112px; min-height: 44px; margin: 0; padding-inline: 12px;
    font-size: 12px; border-radius: 12px;
  }
  html[data-theme] .share-options {
    grid-column: 1 / -1; grid-row: 3; min-width: 0;
    margin: 0; opacity: 1; transition: none;
  }
  html[data-theme] .score-panel[data-sharing="false"] .share-options {
    grid-template-rows: 0fr; opacity: 0;
  }
  html[data-theme] .score-panel[data-sharing="true"] .share-options {
    margin-top: 13px; border-top: 1px solid var(--ui-line);
  }
  html[data-theme] .share-options-inner { padding-top: 0; }

  html[data-theme] body[data-phase="over"] .score-panel { display: grid; overflow: visible; max-height: none; }
}

@media (max-width: 700px) and (max-height: 700px) {
  html[data-theme] .phone-area { width: clamp(320px, min(142vw, calc(66.667dvh - 120px - env(safe-area-inset-top) - env(safe-area-inset-bottom))), 600px); }
}

@media (max-width: 700px) and (prefers-reduced-motion: reduce) {
  html.mobile-intro-active .mobile-opening { display: none; }
  html[data-theme] .phone-area, html[data-theme] .mobile-sheet,
  html[data-theme] .mobile-glass-button, html[data-theme] #theme-toggle { transition: none !important; animation: none !important; }
}
@media (max-width: 700px) and (prefers-reduced-transparency: reduce) {
  html[data-theme] #theme-toggle, html[data-theme] .mobile-glass-button {
    backdrop-filter: none; -webkit-backdrop-filter: none;
    background: #304039;
  }
  html[data-theme="day"] #theme-toggle, html[data-theme="day"] .mobile-glass-button { background: #fffaf2; }
}
