/* Neutral interface system, adapted from DESIGN (14).md.
   Phone artwork and its LCD retain their original, physical colors. */
@font-face { font-family: "Geist"; src: url("./assets/fonts/geist-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Geist"; src: url("./assets/fonts/geist-500.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Geist"; src: url("./assets/fonts/geist-600.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Geist"; src: url("./assets/fonts/geist-700.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Nokia Cellphone"; src: url("./assets/fonts/nokia-cellphone.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }

html[data-theme="night"] {
  --ui-bg: #000000; --ui-ink: #ffffff; --ui-muted: #999999;
  --ui-line: rgba(255,255,255,.13); --ui-surface: #212121;
  --ui-raised: #292929; --ui-floating: #333333; --ui-key: #e5e5e5;
  --ui-wash: rgba(0,0,0,.55); --ui-accent: #006ce8; --ui-accent-text: #ffffff;
  --ui-accent-hover: #005bc4;
}
html[data-theme="day"] {
  --ui-bg: #f5f5f5; --ui-ink: #171717; --ui-muted: #666666;
  --ui-line: rgba(0,0,0,.13); --ui-surface: #ffffff;
  --ui-raised: #eeeeee; --ui-floating: #e5e5e5; --ui-key: #333333;
  --ui-wash: transparent; --ui-accent: #006ce8; --ui-accent-text: #ffffff;
  --ui-accent-hover: #005bc4;
}
html[data-theme] {
  --ui-font: "Geist", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --nokia-font: "Nokia Cellphone", monospace;
  --ink: var(--ui-ink); --muted: var(--ui-muted); --fine: var(--ui-muted);
  --accent: var(--ui-accent); --accent-bright: var(--ui-accent);
  --line: var(--ui-line); --panel: var(--ui-surface);
  --navy: var(--ui-surface); --navy-deep: var(--ui-bg);
  font-family: var(--ui-font); font-synthesis: none;
}
html[data-theme] body {
  background: var(--ui-bg); color: var(--ui-ink); font-family: var(--ui-font);
  font-size: 14px; line-height: 1.5; letter-spacing: -.01em;
}
html[data-theme] button, html[data-theme] input, html[data-theme] select,
html[data-theme] dialog, html[data-theme] .maker-open { font-family: var(--ui-font); }
html[data-theme] h1, html[data-theme] h2 { font-family: var(--ui-font); text-wrap: balance; }
html[data-theme] .page-shell { max-width: 1440px; padding-inline: clamp(24px, 4vw, 64px); }
html[data-theme] #desk-light { display: none; }
html[data-theme] body[data-surface="studio"] .desk-surface { background: var(--ui-bg); filter: none; transform: none; }
html[data-theme] body[data-surface="studio"] .page-shell::before { background: transparent; }
html[data-theme="night"] body[data-surface]:not([data-surface="studio"]) .desk-surface {
  filter: brightness(.38) saturate(.25); transform: none;
}
/* Preserve the arcade carpet's colored corners under a lighter night wash. */
html[data-theme="night"] body[data-surface="carpet"]:not([data-surface="studio"]) .desk-surface {
  filter: brightness(.85) saturate(.95);
}
html[data-theme="night"] body[data-surface="carpet"] { --ui-wash: rgba(0,0,0,.28); }
html[data-theme="night"] body[data-surface="mountain"] .desk-surface,
html[data-theme="night"] body[data-surface="custom"] .desk-surface { filter: blur(28px) brightness(.38) saturate(.25); transform: scale(1.08); }
html[data-theme="night"] body[data-surface] .page-shell::before { background: var(--ui-wash); }
html[data-theme="night"] body[data-surface="studio"] .page-shell::before { background: transparent; }
html[data-theme="day"] body[data-surface] .desk-surface { background: var(--ui-bg); filter: none; transform: none; }
html[data-theme="day"] body .page-shell::before { background: transparent; }

/* Header and three aligned desktop columns. */
@media (min-width: 701px) {
  html[data-theme] .site-header { height: 128px; padding-block: 20px; align-items: center; }
  /* Allow for the artwork's transparent top margin when aligning its visible edge. */
  html[data-theme] .brand { position: static; align-self: flex-start; width: 216px; height: auto; padding-top: 16px; transform: none; }
  html[data-theme] .experience {
    grid-template-columns: minmax(220px, .95fr) minmax(300px, 1.65fr) minmax(200px, .8fr);
    gap: clamp(20px, 3vw, 48px); padding-block: 8px 28px;
    align-items: center; flex: 1 0 auto;
  }
  html[data-theme] .phone-area { width: min(100%, calc((100dvh - 180px) * .666667), 600px); margin: 0; }
  html[data-theme] .score-panel { grid-column: auto; margin: 0; align-self: center; width: 100%; max-width: 260px; }
}
html[data-theme] .intro { max-width: 304px; }
html[data-theme] .intro h1.hero-logo { font-family: var(--nokia-font); font-size: 48px; font-weight: 400; line-height: 1.2; letter-spacing: 0; -webkit-font-smoothing: auto; }
@media (max-width: 1199px) { html[data-theme] .intro h1.hero-logo { font-size: 40px; } }
@media (max-width: 1100px) { html[data-theme] .intro h1.hero-logo { font-size: 32px; } }
html[data-theme] .hero-logo > span { white-space: nowrap; }
.intro-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; }
html[data-theme] .learn-more {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 2px;
  color: var(--ui-muted); font-size: 13px; text-decoration: underline; text-underline-offset: 4px;
  transition: color 160ms ease, scale 160ms cubic-bezier(.2, 0, 0, 1);
}
html[data-theme] .learn-more:hover { color: var(--ui-ink); }
html[data-theme] .learn-more:active { scale: .96; }
html[data-theme] .learn-more:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: 3px; border-radius: 4px; }
.hero-logo > span { display: block; }
html[data-theme] .hero-echo { color: var(--ui-muted); }
html[data-theme] .eyebrow, html[data-theme] .instruction-label,
html[data-theme] .score-panel-toggle, html[data-theme] .cover-kicker,
html[data-theme] .maker-dialog-kicker, html[data-theme] .maker-overline,
html[data-theme] .mobile-score-kicker, html[data-theme] .mobile-score-label {
  color: var(--ui-muted); font-family: var(--ui-font); font-size: 11px;
  font-weight: 500; letter-spacing: .06em; line-height: 1.4;
}
html[data-theme] .eyebrow { margin-bottom: 12px; }
html[data-theme] .intro-copy { max-width: 28ch; margin: 12px 0 20px; font-size: 14px; font-weight: 400; line-height: 1.5; letter-spacing: -.015em; }
html[data-theme] .header-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 7px; background: var(--ui-surface); color: var(--ui-ink); font-size: 13px; font-weight: 500; }
html[data-theme] .header-button:hover, html[data-theme] .header-button[aria-expanded="true"] { border-color: var(--ui-line); background: var(--ui-raised); }
html[data-theme] .chevron { width: 6px; height: 6px; border-width: 1.5px; margin: 0 2px 3px 2px; }
.theme-icon { position: relative; display: inline-grid; place-items: center; width: 18px; height: 18px; }
.theme-icon svg { grid-area: 1 / 1; width: 18px; height: 18px; transition: opacity 180ms ease, scale 180ms cubic-bezier(.2,0,0,1); }
html[data-theme="night"] .theme-moon, html[data-theme="day"] .theme-sun { opacity: 0; scale: .25; }
html[data-theme="night"] .theme-sun, html[data-theme="day"] .theme-moon { opacity: 1; scale: 1; }
html[data-theme] .primary-button, html[data-theme] .secondary-button,
html[data-theme] .share-button, html[data-theme] #download-card {
  border: 1px solid transparent; border-radius: 7px; background: var(--ui-accent);
  color: var(--ui-accent-text); font-size: 14px; font-weight: 500; box-shadow: none;
}
html[data-theme] .primary-button { min-width: 176px; min-height: 48px; padding-inline: 16px; }
html[data-theme] #start-button .action-icon { display: grid; place-items: center; width: 20px; height: 20px; }
.action-icon svg { display: block; width: 18px; height: 18px; }
html[data-theme] #start-button:hover .action-icon { transform: none; }
html[data-theme] .primary-button:hover, html[data-theme] .secondary-button:hover,
html[data-theme] .share-button:hover, html[data-theme] #download-card:hover { background: var(--ui-accent-hover); color: #ffffff; transform: none; box-shadow: none; }

/* A short, aligned key guide replaces the dense instruction paragraph. */
html[data-theme] .instructions { margin-top: 24px; padding-top: 0; border: 0; box-shadow: none; }
.control-guide { display: grid; gap: 6px; margin: 12px 0 0; }
.control-guide > div { display: grid; grid-template-columns: 104px 1fr; align-items: center; gap: 12px; }
.control-guide dt { display: flex; gap: 4px; }
.control-guide dd { margin: 0; color: var(--ui-muted); font-size: 12px; }
.control-guide kbd { display: grid; place-items: center; width: 23px; height: 24px; border: 1px solid var(--ui-line); border-radius: 7px; background: var(--ui-surface); color: var(--ui-ink); font: 500 11px/1 var(--ui-font); }
html[data-theme] .instructions .keyboard-hint { margin: 12px 0 0; font-size: 12px; line-height: 1.5; }
html[data-theme] .music-control { width: 100%; margin-top: 16px; padding-top: 12px; }
html[data-theme] .music-mute { color: var(--ui-ink); border-radius: 7px; box-shadow: none; }
html[data-theme] .music-mute:hover { border-color: var(--ui-line); background: var(--ui-raised); }
html[data-theme] #music-volume::-webkit-slider-runnable-track { height: 4px; background: linear-gradient(90deg,var(--ui-key) 0 var(--range-fill,10%),var(--ui-line) var(--range-fill,10%) 100%); }
html[data-theme] #music-volume::-webkit-slider-thumb { width: 20px; height: 20px; margin-top: -8px; border: 0; border-radius: 100px; background: var(--ui-key); box-shadow: none; }
html[data-theme] #music-volume::-moz-range-track { height: 4px; }
html[data-theme] #music-volume::-moz-range-progress { height: 4px; background: var(--ui-key); }
html[data-theme] #music-volume::-moz-range-thumb { width: 20px; height: 20px; border: 0; border-radius: 100px; background: var(--ui-key); box-shadow: none; }
html[data-theme] #music-volume-value { font-weight: 400; }
html[data-theme] .maker-open { color: var(--ui-muted); min-height: 44px; margin-top: 4px; padding: 0; font-size: 12px; }
html[data-theme] .phone-caption { font-size: 10px; font-weight: 400; letter-spacing: .03em; margin-top: 0; }
html[data-theme] .phone, html[data-theme] body[data-phase="running"] .phone { filter: drop-shadow(0 18px 24px rgba(0,0,0,.2)); translate: 0 0; }

/* Neutral score, settings, and collection surfaces. */
html[data-theme] .score-panel { padding: 20px; border-radius: 16px; border: 1px solid var(--ui-line); background: var(--ui-surface); box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
html[data-theme] .score-value, html[data-theme] .score-value.t-digit-group { color: var(--ui-ink); font-size: clamp(48px, 4.2vw, 64px); font-weight: 500; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
html[data-theme] .score-panel-toggle { margin: -4px 0 8px; letter-spacing: .06em; }
html[data-theme] .score-panel[data-collapsed="true"] { border-radius: 16px; }
html[data-theme] .share-card-button { font-size: 12px; font-weight: 500; border-radius: 7px; background: var(--ui-raised); color: var(--ui-ink); }
html[data-theme] .share-card-button:hover { background: var(--ui-floating); color: var(--ui-ink); }
html[data-theme] .share-grid button, html[data-theme] .share-grid a { border-radius: 7px; font-size: 12px; font-weight: 500; }
html[data-theme] .story-preview { border-radius: 16px; padding: 8px; background: var(--ui-raised); }
html[data-theme] .story-preview img { border-radius: 7px; }
html[data-theme] .story-preview strong { font-weight: 500; }
html[data-theme] .settings-panel, html[data-theme] .maker-dialog, html[data-theme] .cover-dialog { border-radius: 24px; background: var(--ui-surface); color: var(--ui-ink); box-shadow: none; }
html[data-theme] .settings-panel { top: 108px; padding: 24px; max-height: calc(100dvh - 124px); width: min(360px, calc(100vw - 48px)); }
html[data-theme] .settings-head h2 { font-size: 20px; font-weight: 600; letter-spacing: -.022em; }
html[data-theme] .settings-head button { color: var(--ui-ink); }
html[data-theme] .setting-group legend, html[data-theme] .select-label,
html[data-theme] .cover-setting { font-weight: 500; letter-spacing: .06em; }
html[data-theme] .toggle-track { background: var(--ui-muted); }
html[data-theme] .toggle-track::after { background: #ffffff; }
html[data-theme] .toggle-row input:checked + .toggle-track { background: var(--ui-accent); }
html[data-theme] .surface-option, html[data-theme] #speed-select,
html[data-theme] .sound-setting-button, html[data-theme] #cover-settings-open { background: var(--ui-raised); color: var(--ui-ink); border-radius: 7px; font-weight: 500; }
html[data-theme] .surface-option:hover { background: var(--ui-floating); border-color: var(--ui-line); }
html[data-theme] .surface-option.selected { background: var(--ui-floating); border-color: var(--ui-key); color: var(--ui-ink); box-shadow: none; }
html[data-theme] .sound-setting-button span { color: inherit; }
.swatch-studio { background: #000000; }
html[data-theme] .maker-dialog::backdrop, html[data-theme] .cover-dialog::backdrop { background: rgba(0,0,0,.65); }
html[data-theme] .maker-dialog-top, html[data-theme] .cover-dialog-top { padding: 12px 16px 12px 24px; background: var(--ui-surface); }
html[data-theme] .maker-dialog-top button, html[data-theme] .cover-dialog-top button { border-radius: 10px; width: 44px; height: 44px; background: var(--ui-raised); }
html[data-theme] .maker-dialog-body, html[data-theme] .cover-dialog-body { padding: 24px; }
html[data-theme] .maker-dialog h2, html[data-theme] .cover-dialog h2 { font-size: 36px; font-weight: 600; letter-spacing: -.04em; line-height: 1.15; }
html[data-theme] .maker-dialog h2 span { color: inherit; }
html[data-theme] .maker-overline { color: var(--ui-muted); }
.maker-live-dot { display: none; }
html[data-theme] .maker-contact a:hover { color: var(--ui-ink); text-decoration-thickness: 2px; }
html[data-theme] .cover-card { border-radius: 16px; background: var(--ui-raised); padding: 12px; gap: 12px; }
html[data-theme] .cover-card:hover { background: var(--ui-floating); border-color: var(--ui-line); transform: none; }
html[data-theme] .cover-card:active { transform: scale(.96); }
html[data-theme] .cover-card[aria-pressed="true"] { border-color: var(--ui-key); background: var(--ui-floating); }
.cover-card-copy strong { font-weight: 500; }
.cover-card-copy em, .cover-card-indicator { color: var(--ui-ink); font-weight: 400; }
.cover-card-indicator svg { display: block; width: 15px; height: 15px; }
.cover-progress-track span { background: var(--ui-key); }
html[data-theme] .cover-fitting { color: var(--ui-muted); }
html[data-theme] .mobile-new-cover { background: var(--ui-raised); border-color: var(--ui-line); font-weight: 500; }
html[data-theme] .toast { border-radius: 10px; background: var(--ui-floating); color: var(--ui-ink); font-size: 13px; font-weight: 500; }

@media (min-width: 701px) and (max-width: 1000px) {
  html[data-theme] .site-header { height: 112px; }
  html[data-theme] .brand { width: 184px; padding-top: 9px; }
  html[data-theme] .experience { grid-template-columns: minmax(220px,.9fr) minmax(260px,1.35fr); grid-template-rows: auto auto; gap: 20px; }
  html[data-theme] .intro { grid-column: 1; grid-row: 1; align-self: end; }
  html[data-theme] .phone-area { grid-column: 2; grid-row: 1 / 3; width: min(100%, calc((100dvh - 152px) * .666667), 480px); }
  html[data-theme] .score-panel { grid-column: 1; grid-row: 2; justify-self: start; align-self: start; max-width: 304px; }
  html[data-theme] .score-panel-toggle { margin-bottom: 0; }
  html[data-theme] .score-value { font-size: 40px; }
  html[data-theme] .instructions { margin-top: 24px; padding-top: 0; }
  html[data-theme] .music-control { margin-top: 16px; padding-top: 12px; }
}

/* Keep the phone-only mobile flow; align the glass controls and neutral sheets. */
@media (max-width: 700px) {
  html[data-theme] .page-shell { padding-inline: 0; }
  html[data-theme="night"] body { background: var(--ui-bg); }
  .mobile-opening { background: #000000; }
  .mobile-opening-status { color: #999999; font-family: var(--ui-font); }
  html[data-theme] #theme-toggle, html[data-theme] .mobile-glass-button {
    border-color: var(--ui-line); background: var(--ui-raised); color: var(--ui-ink);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.08); font-family: var(--ui-font);
    font-weight: 500; backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  }
  html[data-theme] #theme-toggle::before, html[data-theme] .mobile-glass-button::before { display: none; }
  html[data-theme] .header-actions { gap: 8px; }
  html[data-theme] .mobile-sheet, html[data-theme] .mobile-sheet-top { background: var(--ui-surface); }
  html[data-theme] .mobile-sheet { border-radius: 24px 24px 0 0; box-shadow: none; }
  html[data-theme] .mobile-sheet-top { padding-top: 18px; }
  html[data-theme] .mobile-sheet-top button { background: var(--ui-raised); border-radius: 10px; }
  html[data-theme] .maker-dialog-body, html[data-theme] .cover-dialog-body { padding: 16px 24px max(24px,env(safe-area-inset-bottom)); }
  html[data-theme] .maker-dialog h2 { font-size: 36px; }
  html[data-theme] .mobile-score-dialog h2 { font-weight: 600; }
  html[data-theme] .mobile-score-dialog .score-value,
  html[data-theme] .mobile-score-dialog .score-value.t-digit-group { color: var(--ui-ink); }
  html[data-theme] .cover-card { padding: 8px 12px; }
  html[data-theme] .mobile-score-dialog .score-panel { background: transparent; box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
  .theme-icon svg, html[data-theme] .header-button, html[data-theme] .primary-button,
  html[data-theme] .phone { transition: none !important; }
  html[data-theme] .learn-more { transition: none; }
  html[data-theme] .learn-more:active { scale: 1; }
}
