/* noonish — styles */

@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/dm-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
                 U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
                 U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --yellow: #F5D84C;
  --yellow-deep: #DFBE27;
  --yellow-soft: #FFF2B8;
  --green: #20BD83;
  --green-text: #0B6B49;
  --bg: #FFF9F0;
  --card: #FFFDF9;
  --card-2: #FAF2E5;
  --ink: #171717;
  --ink-soft: #3F3A31;
  --muted: #665D4D;
  --border: #E5D9C8;
  --border-strong: #CDBEA8;
  --hero-bg: #F5D84C;
  --hero-ink: #171717;
  --hero-muted: #4A4022;
  --hero-eyebrow-bg: rgba(23, 23, 23, 0.08);
  --hero-progress-bg: rgba(255, 255, 255, 0.34);
  --dot-base: rgba(23, 23, 23, 0.2);
  --dot-on: #171717;
  --header-bg: #FFF9F0;
  --btn-bg: #171717;
  --btn-fg: #FFF9F0;
  --btn-hover: #2E2A23;
  --chart-bar: #DFCFB8;
  --chart-you: #171717;
  --chart-answer: #83745E;
  --danger: #A8321D;
  --focus: #171717;
  --focus-ring: rgba(23, 23, 23, 0.14);
  --shadow: 0 10px 34px rgba(66, 50, 21, 0.07);
  --shadow-lift: 0 16px 42px rgba(66, 50, 21, 0.12);
  --radius: 24px;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #151513;
  --card: #1E1E1B;
  --card-2: #252520;
  --ink: #F7F1E5;
  --ink-soft: #DDD3C2;
  --muted: #B0A48F;
  --border: #34332C;
  --border-strong: #4C493E;
  --hero-bg: #1A1A17;
  --hero-ink: #F7F1E5;
  --hero-muted: #CFC4AF;
  --hero-eyebrow-bg: rgba(245, 216, 76, 0.13);
  --hero-progress-bg: rgba(255, 255, 255, 0.06);
  --dot-base: rgba(247, 241, 229, 0.22);
  --dot-on: #F5D84C;
  --header-bg: #151513;
  --btn-bg: #F5D84C;
  --btn-fg: #171717;
  --btn-hover: #FFE566;
  --chart-bar: #3D3B33;
  --chart-you: #F5D84C;
  --chart-answer: #B5A996;
  --danger: #FF9A85;
  --focus: #F5D84C;
  --focus-ring: rgba(245, 216, 76, 0.25);
  --shadow: 0 12px 38px rgba(0, 0, 0, 0.28);
  --shadow-lift: 0 18px 48px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: "DM Sans", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, figure, dl, dd {
  margin: 0;
}

h1, h2, h3 {
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

ul, ol {
  margin: 0;
  padding: 0;
}

img {
  max-width: 100%;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: inherit;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2.5px;
}

[hidden] {
  display: none !important;
}

::selection {
  background: var(--yellow);
  color: #171717;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 200;
  background: var(--ink);
  color: var(--bg);
  padding: 12px 18px;
  border-radius: 10px;
  font-weight: 700;
  text-decoration: none;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 12px;
}

.wrap {
  width: min(1120px, calc(100% - 48px));
  margin-inline: auto;
}

.wrap.narrow {
  width: min(700px, calc(100% - 48px));
}

.site-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1 0 auto;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 4px 0;
  background: none;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  color: var(--ink);
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--yellow);
  color: #171717;
  display: grid;
  place-items: center;
  flex: none;
}

.brand-mark svg {
  width: 28px;
  height: 28px;
  display: block;
}

.brand-word {
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1;
  transform: translateY(-0.5px);
}

.brand:hover .brand-mark {
  transform: rotate(-3deg);
}

.brand-mark {
  transition: transform 0.2s ease;
}

.theme-toggle {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.theme-toggle:hover {
  background: var(--card-2);
  border-color: var(--ink-soft);
}

.theme-toggle:active {
  transform: scale(0.96);
}

.theme-icon {
  width: 21px;
  height: 21px;
  display: block;
}

[data-theme="light"] .icon-sun,
[data-theme="dark"] .icon-moon {
  display: none;
}

.storage-banner {
  background: var(--yellow-soft);
  color: #3B310B;
  border-bottom: 1px solid rgba(23, 23, 23, 0.12);
  padding: 9px 24px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.4;
}

[data-theme="dark"] .storage-banner {
  background: #3B3110;
  color: #F5D84C;
  border-bottom-color: #4E4116;
}

/* ---------- Shared type ---------- */

.eyebrow {
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.145em;
  text-transform: uppercase;
  line-height: 1.4;
  color: var(--ink-soft);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 24px;
  border: 1.5px solid transparent;
  border-radius: 14px;
  background: none;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.065em;
  text-transform: uppercase;
  line-height: 1.1;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--btn-bg);
  color: var(--btn-fg);
}

.btn-primary:hover {
  background: var(--btn-hover);
}

.btn-outline {
  border-color: var(--border-strong);
  background: transparent;
  color: var(--ink);
}

.btn-outline:hover {
  border-color: var(--ink);
  background: var(--card-2);
}

.btn-small {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 11.5px;
  letter-spacing: 0.05em;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

.text-btn {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  cursor: pointer;
}

.text-btn:hover {
  text-decoration-thickness: 2px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- Home / hero ---------- */

.home-screen {
  background: var(--bg);
}

.hero {
  position: relative;
  overflow: hidden;
  background: var(--hero-bg);
  color: var(--hero-ink);
  border-bottom: 1px solid transparent;
  padding: clamp(48px, 7vw, 88px) 0 clamp(48px, 7vw, 86px);
}

[data-theme="dark"] .hero {
  border-bottom-color: var(--border);
}

.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 390px);
  align-items: center;
  gap: 32px;
}

.hero-copy {
  max-width: 720px;
}

.hero .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--hero-eyebrow-bg);
  color: var(--hero-ink);
  padding: 7px 12px;
  border-radius: 999px;
  margin-bottom: clamp(18px, 2.6vw, 26px);
}

.hero-title {
  font-size: clamp(3.5rem, 7.4vw, 6.5rem);
  line-height: 0.94;
  letter-spacing: -0.06em;
  font-weight: 800;
  max-width: 10ch;
  margin-bottom: clamp(18px, 2.4vw, 26px);
}

.hero-lede {
  font-size: clamp(1.06rem, 1.9vw, 1.3rem);
  line-height: 1.45;
  font-weight: 500;
  letter-spacing: -0.012em;
  max-width: 36ch;
  color: var(--hero-muted);
}

.hero-actions {
  margin-top: clamp(26px, 3.4vw, 36px);
}

.btn-hero {
  min-height: 60px;
  padding-inline: 32px;
  border-radius: 16px;
  font-size: 14.5px;
  box-shadow: 0 10px 26px rgba(30, 22, 4, 0.18);
}

[data-theme="dark"] .btn-hero {
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
}

.hero-meta {
  margin-top: 14px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--hero-muted);
}

.home-progress {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 8px 13px;
  border-radius: 999px;
  background: var(--hero-progress-bg);
  color: var(--hero-ink);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.2;
}

.home-progress-dots {
  display: inline-flex;
  gap: 4px;
}

.home-progress-dots i {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dot-base);
}

.home-progress-dots i.is-done {
  background: var(--dot-on);
}

.home-progress-dots i.is-current {
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--dot-on);
}

.hero-demo {
  margin-top: clamp(22px, 3vw, 30px);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--hero-muted);
  opacity: 0.82;
  max-width: 46ch;
}

.hero-clock {
  justify-self: end;
  width: 100%;
  max-width: 400px;
  color: var(--hero-ink);
  opacity: 0.085;
  transform: translateX(2%);
  pointer-events: none;
}

[data-theme="dark"] .hero-clock {
  color: var(--yellow);
  opacity: 0.16;
}

.hero-clock svg {
  display: block;
  width: 100%;
  height: auto;
}

/* ---------- How it works ---------- */

.how {
  padding: clamp(48px, 6vw, 76px) 0 clamp(44px, 6vw, 70px);
}

.how-head {
  max-width: 640px;
  margin-bottom: 28px;
}

.how-head h2 {
  margin-top: 10px;
  font-size: clamp(1.8rem, 3.4vw, 2.75rem);
  letter-spacing: -0.035em;
}

.steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.step {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px 23px 26px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 0 rgba(90, 70, 35, 0.02);
}

.step-num {
  font-size: 42px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.06em;
  color: var(--yellow-deep);
}

[data-theme="dark"] .step-num {
  color: var(--yellow);
}

.step h3 {
  margin-top: 16px;
  font-size: 18px;
  letter-spacing: -0.015em;
}

.step p {
  margin-top: 8px;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--muted);
}

.sample-card {
  margin-top: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.85fr);
  gap: 28px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px 26px;
}

.sample-copy .eyebrow {
  color: var(--muted);
}

.sample-answer {
  margin-top: 10px;
  font-size: clamp(1.4rem, 2.4vw, 1.75rem);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.sample-answer strong {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.sample-answer-label {
  color: var(--muted);
  font-size: 0.82em;
}

.sample-sub {
  margin-top: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-soft);
}

.sample-note {
  margin-top: 10px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 46ch;
}

.sample-chart {
  min-width: 0;
  position: relative;
  padding-top: 52px;
}

.sample-chart .chart-plot {
  height: 96px;
}

.sample-chart .chart-marker .flag {
  font-size: 8px;
}

.sample-chart .chart-axis {
  font-size: 8.5px;
}

.demo-line {
  margin-top: 18px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 80ch;
}

.demo-line strong {
  color: var(--ink-soft);
}

/* ---------- Game shell ---------- */

.game-screen {
  padding: 24px 0 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.game-wrap {
  max-width: 1080px;
}

.game-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.game-top .eyebrow {
  color: var(--muted);
}

.progress-dots {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.progress-dots li {
  width: 28px;
  height: 6px;
  border-radius: 999px;
  background: var(--border);
}

.progress-dots li.is-done {
  background: var(--ink);
}

.progress-dots li.is-current {
  background: var(--yellow);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

.game-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.85fr);
  gap: 22px;
  align-items: stretch;
}

.photo-card {
  margin: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.photo-frame {
  position: relative;
  border-radius: 17px;
  overflow: hidden;
  background: var(--card-2);
  aspect-ratio: var(--photo-ar, 3 / 2);
  max-height: 62vh;
  min-height: 190px;
  display: grid;
  place-items: center;
}

[data-theme="dark"] .photo-frame {
  background: #10100E;
}

.photo-frame.has-error::after {
  content: "Photograph unavailable";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  background: var(--card-2);
}

.photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.photo-frame.is-loaded img {
  opacity: 1;
}

.photo-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--card-2);
}

.photo-loading span {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid var(--border-strong);
  border-top-color: var(--ink-soft);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.photo-error {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 22px;
  text-align: center;
  background: var(--card-2);
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.5;
}

.photo-error strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
}

.photo-error .btn {
  margin-top: 7px;
}

.photo-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 8px 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.demo-pill {
  flex: none;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.13em;
  color: var(--muted);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 3px 7px;
  line-height: 1.2;
}

.guess-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.guess-head h1 {
  font-size: 25px;
  letter-spacing: -0.025em;
  line-height: 1.12;
}

.panel-sub {
  margin-top: 5px;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.45;
}

.time-control {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.time-readout {
  text-align: center;
  margin-bottom: 2px;
}

.time-value {
  display: block;
  font-size: clamp(2.7rem, 4.4vw, 3.5rem);
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.005em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.time-control.is-neutral .time-value {
  color: var(--muted);
  font-weight: 700;
}

.time-hint {
  display: block;
  margin-top: 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.3;
}

.time-slider {
  --fill: 0%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 36px;
  margin: 2px 0 0;
  background-image: linear-gradient(to right, var(--ink), var(--ink)),
                    linear-gradient(to right, var(--border-strong), var(--border-strong));
  background-size: var(--fill) 8px, 100% 8px;
  background-position: left center, left center;
  background-repeat: no-repeat;
  border-radius: 999px;
  cursor: pointer;
  touch-action: pan-y;
}

.time-slider::-webkit-slider-runnable-track {
  height: 8px;
  background: transparent;
  border: 0;
}

.time-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  margin-top: -10px;
  border-radius: 50%;
  background: var(--yellow);
  border: 3px solid var(--ink);
  box-shadow: 0 2px 7px rgba(30, 25, 12, 0.25);
  cursor: grab;
  transition: opacity 0.15s ease, transform 0.12s ease;
}

.time-slider::-moz-range-track {
  height: 8px;
  background: transparent;
  border: 0;
}

.time-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--yellow);
  border: 3px solid var(--ink);
  box-shadow: 0 2px 7px rgba(30, 25, 12, 0.25);
  cursor: grab;
}

.time-control.is-neutral .time-slider::-webkit-slider-thumb {
  opacity: 0.62;
}

.time-control.is-neutral .time-slider::-moz-range-thumb {
  opacity: 0.62;
}

.time-slider:active::-webkit-slider-thumb {
  cursor: grabbing;
  transform: scale(1.06);
}

.time-slider:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

.time-scale {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: -3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.time-type {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 7px;
  padding-top: 13px;
  border-top: 1px solid var(--border);
}

.time-type label {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink-soft);
}

.time-input {
  width: 104px;
  flex: none;
  height: 42px;
  padding: 0 8px;
  border: 1.5px solid var(--border-strong);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  text-align: center;
  font-size: 17px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.time-input::placeholder {
  color: var(--muted);
  font-weight: 600;
  opacity: 0.75;
}

.time-input:hover {
  border-color: var(--ink-soft);
}

.time-input:focus {
  outline: none;
  border-color: var(--ink-soft);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.time-input.is-invalid {
  border-color: var(--danger);
}

.time-help {
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted);
}

.field-error {
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--danger);
}

.btn-lock {
  width: 100%;
  min-height: 56px;
  margin-top: auto;
}

/* ---------- Result ---------- */

.result-view {
  min-width: 0;
}

.result-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.9fr);
  gap: 22px;
  align-items: stretch;
}

.result-photo .photo-frame {
  max-height: 54vh;
}

.result-card {
  background: var(--yellow);
  color: #171717;
  border-radius: var(--radius);
  padding: 30px 30px 26px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 14px 36px rgba(66, 50, 21, 0.14);
  min-width: 0;
}

.result-card .eyebrow {
  color: #5B4A09;
}

.result-title {
  margin-top: 16px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.result-time {
  font-size: clamp(4.4rem, 8vw, 6rem);
  line-height: 0.98;
  font-weight: 800;
  letter-spacing: -0.055em;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.result-place {
  margin-top: 8px;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.35;
  color: #3E3308;
}

.result-rule {
  height: 1px;
  background: rgba(23, 23, 23, 0.18);
  margin: 22px 0 18px;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.result-stats dt {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #5B4A09;
}

.result-stats dd {
  margin-top: 3px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.result-gap {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(23, 23, 23, 0.18);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  color: #2B2407;
}

.result-gap .verdict {
  display: inline-block;
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 5px;
  background: rgba(23, 23, 23, 0.1);
  margin-right: 6px;
  vertical-align: 1px;
}

.chart-card {
  margin-top: 22px;
  padding: 26px;
  min-width: 0;
}

.chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.chart-head h2 {
  font-size: 19px;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.chart-sub {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.45;
}

.badge {
  flex: none;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.115em;
  color: var(--muted);
  background: var(--card-2);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 5px 9px;
  line-height: 1.2;
}

.chart {
  position: relative;
  margin-top: 14px;
  padding-top: 56px;
  min-width: 0;
}

.chart-plot {
  position: relative;
  height: 150px;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  border-bottom: 1.5px solid var(--border-strong);
}

.chart-plot i {
  display: block;
  flex: 1 1 0;
  min-width: 0;
  min-height: 1px;
  background: var(--chart-bar);
  border-radius: 2px 2px 0 0;
}

.chart-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 2px solid var(--chart-you);
  z-index: 2;
}

.chart-marker.answer {
  border-left: 1.5px dashed var(--chart-answer);
  z-index: 1;
}

.chart-marker .flag {
  position: absolute;
  top: -46px;
  left: 0;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.11em;
  line-height: 1.2;
  padding: 3px 6px;
  border-radius: 5px;
  white-space: nowrap;
}

.chart-marker.answer .flag {
  top: -20px;
  background: var(--card-2);
  color: var(--muted);
  border: 1px solid var(--border-strong);
}

.chart-marker .flag.is-start {
  transform: translateX(0);
}

.chart-marker .flag.is-end {
  transform: translateX(-100%);
}

.chart-axis {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  margin-top: 7px;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: center;
  margin-top: 14px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-soft);
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-line {
  display: inline-block;
  width: 15px;
  height: 0;
  border-top: 2px solid var(--chart-you);
}

.legend-line.legend-answer {
  border-top: 1.5px dashed var(--chart-answer);
}

.legend-bar {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--chart-bar);
}

.chart-note {
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
}

.result-actions {
  margin-top: 22px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.credits {
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 620px;
}

.credits a {
  color: var(--ink-soft);
  font-weight: 600;
}

.credits p + p {
  margin-top: 3px;
}

.credit-demo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: var(--muted);
}

.credit-demo .mini-tag {
  font-size: 8px;
  letter-spacing: 0.11em;
  font-weight: 800;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 2px 4px;
}

.btn-next {
  flex: none;
  min-width: 210px;
  min-height: 54px;
}

/* ---------- Final ---------- */

.final-screen {
  padding: 34px 0 76px;
}

.final-wrap {
  max-width: 900px;
}

.score-card {
  position: relative;
  overflow: hidden;
  background: var(--yellow);
  color: #171717;
  border-radius: 28px;
  padding: clamp(28px, 5vw, 44px) 30px;
  text-align: center;
  box-shadow: 0 16px 40px rgba(66, 50, 21, 0.15);
}

.score-card .eyebrow {
  color: #5B4A09;
}

.score-value {
  margin-top: 12px;
  font-size: clamp(4.2rem, 10vw, 6.8rem);
  line-height: 0.95;
  letter-spacing: -0.06em;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.score-sub {
  margin-top: 10px;
  font-size: 14px;
  font-weight: 700;
  color: #3E3308;
}

.score-date {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #5B4A09;
}

.final-list-card {
  margin-top: 22px;
  padding: 26px;
}

.final-list-card h2 {
  font-size: 19px;
  letter-spacing: -0.025em;
}

.final-list {
  list-style: none;
  margin-top: 14px;
}

.final-list li {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.final-list li:first-child {
  border-top: 0;
  padding-top: 4px;
}

.final-thumb {
  width: 54px;
  height: 54px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--card-2);
}

.final-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.final-place {
  min-width: 0;
}

.final-place strong {
  display: block;
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.final-place span {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 1px;
}

.final-stats {
  display: flex;
  gap: 22px;
  text-align: right;
}

.q-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 48px;
}

.q-stat span {
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.q-stat b {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

.q-stat.is-error b {
  color: var(--green-text);
}

.final-actions {
  margin-top: 24px;
  text-align: center;
}

.final-actions .btn {
  min-height: 54px;
  min-width: 220px;
}

.countdown {
  margin-top: 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.final-note {
  margin-top: 18px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--muted);
  text-align: center;
}

/* ---------- Error screen ---------- */

.error-screen {
  padding: 56px 0 90px;
}

.error-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(28px, 5vw, 48px);
  text-align: center;
  box-shadow: var(--shadow);
}

.error-card h1 {
  margin-top: 12px;
  font-size: clamp(2rem, 4vw, 2.8rem);
  letter-spacing: -0.035em;
}

.error-card p {
  margin: 14px auto 0;
  max-width: 46ch;
  color: var(--muted);
  font-size: 15px;
}

.error-card .btn {
  margin-top: 24px;
}

.notfound {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 60px 0 80px;
  text-align: center;
}

.notfound h1 {
  margin-top: 12px;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  letter-spacing: -0.04em;
}

.notfound p {
  margin: 14px auto 0;
  max-width: 44ch;
  color: var(--muted);
}

.notfound .btn {
  margin-top: 26px;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 22px 0 26px;
  background: var(--bg);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 24px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--muted);
}

.footer-tagline {
  font-weight: 700;
  color: var(--ink-soft);
}

.footer-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.footer-dot {
  opacity: 0.6;
}

/* ---------- Dialog ---------- */

.credits-dialog {
  width: min(660px, calc(100% - 32px));
  max-height: min(84vh, 780px);
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.credits-dialog::backdrop {
  background: rgba(12, 11, 8, 0.6);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.dialog-head h2 {
  font-size: 19px;
  letter-spacing: -0.025em;
}

.dialog-close {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--card-2);
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.dialog-close:hover {
  background: var(--border);
}

.dialog-body {
  padding: 18px 22px 24px;
  overflow-y: auto;
  max-height: calc(min(84vh, 780px) - 76px);
}

.dialog-note {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
}

.dialog-small {
  margin-top: 14px;
  font-size: 11.5px;
}

.credits-list {
  list-style: none;
  margin-top: 16px;
  border-top: 1px solid var(--border);
}

.credits-list li {
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.credits-list strong {
  color: var(--ink-soft);
  font-weight: 700;
}

.credits-list a {
  color: var(--ink-soft);
}

/* ---------- Toast / noscript ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 120;
  max-width: calc(100% - 32px);
  background: var(--ink);
  color: var(--bg);
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  animation: toast-in 0.2s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.noscript {
  position: fixed;
  inset: auto 16px 16px;
  z-index: 200;
  background: var(--ink);
  color: var(--bg);
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

/* ---------- Responsive ---------- */

@media (max-width: 1000px) {
  .game-grid {
    grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.9fr);
  }

  .result-grid {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.92fr);
  }

  .result-card {
    padding: 26px;
  }
}

@media (max-width: 880px) {
  .game-grid,
  .result-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .photo-frame {
    max-height: 56vh;
  }

  .result-photo .photo-frame {
    max-height: 42vh;
  }

  .result-card {
    padding: 28px;
  }

  .result-actions {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 16px;
  }

  .btn-next {
    width: 100%;
  }
}

@media (max-width: 820px) {
  .wrap {
    width: calc(100% - 36px);
  }

  .wrap.narrow {
    width: calc(100% - 36px);
  }

  .hero-inner {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-clock {
    display: none;
  }

  .hero-title {
    max-width: 12ch;
  }

  .steps {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .step {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    column-gap: 14px;
    padding: 20px;
  }

  .step-num {
    grid-row: span 2;
    font-size: 32px;
    padding-top: 2px;
  }

  .step h3 {
    margin-top: 0;
  }

  .sample-card {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    padding: 20px;
  }

  .header-inner {
    min-height: 68px;
  }

  .site-header {
    position: sticky;
  }

  .final-stats {
    gap: 16px;
  }
}

@media (max-width: 600px) {
  body {
    font-size: 16px;
  }

  .header-inner {
    min-height: 64px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
  }

  .brand-word {
    font-size: 21px;
  }

  .theme-toggle {
    width: 42px;
    height: 42px;
  }

  .hero {
    padding-top: 40px;
    padding-bottom: 44px;
  }

  .hero-title {
    font-size: clamp(3.1rem, 15vw, 4.4rem);
    letter-spacing: -0.06em;
  }

  .hero-lede {
    font-size: 16.5px;
    max-width: 34ch;
  }

  .btn-hero {
    width: 100%;
    min-height: 58px;
  }

  .hero-meta {
    font-size: 12.5px;
  }

  .hero-demo {
    font-size: 10.5px;
    max-width: 36ch;
  }

  .how {
    padding-top: 42px;
  }

  .sample-answer {
    font-size: 1.3rem;
  }

  .demo-line {
    font-size: 11.5px;
  }

  .game-screen {
    padding: 22px 0 56px;
  }

  .game-top {
    margin-bottom: 12px;
  }

  .progress-dots li {
    width: 22px;
    height: 5px;
  }

  .photo-card {
    padding: 8px;
    border-radius: 20px;
  }

  .photo-frame {
    border-radius: 14px;
    min-height: 150px;
    max-height: 48vh;
  }

  .photo-caption {
    font-size: 12px;
    padding: 10px 5px 3px;
  }

  .guess-card {
    padding: 20px 18px;
    border-radius: 20px;
    gap: 15px;
  }

  .guess-head h1 {
    font-size: 22px;
  }

  .time-control {
    padding: 17px 14px 15px;
    border-radius: 15px;
  }

  .time-value {
    font-size: 3rem;
  }

  .time-slider {
    height: 42px;
  }

  .time-slider::-webkit-slider-thumb {
    width: 30px;
    height: 30px;
    margin-top: -11px;
  }

  .time-slider::-moz-range-thumb {
    width: 26px;
    height: 26px;
  }

  .time-scale {
    font-size: 9.5px;
  }

  .time-type {
    gap: 10px;
  }

  .time-type label {
    font-size: 12px;
    max-width: 13ch;
  }

  .time-input {
    width: 96px;
    height: 44px;
  }

  .result-card {
    padding: 24px 22px;
    border-radius: 20px;
  }

  .result-time {
    font-size: 4.5rem;
  }

  .result-stats dd {
    font-size: 19px;
  }

  .chart-card {
    padding: 20px 17px;
    border-radius: 20px;
    margin-top: 16px;
  }

  .chart-plot {
    height: 118px;
    gap: 1.5px;
  }

  .chart {
    padding-top: 50px;
    margin-top: 8px;
  }

  .chart-marker .flag {
    font-size: 8px;
    padding: 2.5px 5px;
  }

  .chart-axis {
    font-size: 8.5px;
  }

  .chart-head h2 {
    font-size: 17px;
  }

  .badge {
    font-size: 8px;
    padding: 4px 7px;
  }

  .result-actions {
    margin-top: 16px;
  }

  .final-screen {
    padding: 24px 0 56px;
  }

  .score-card {
    border-radius: 22px;
    padding: 28px 18px;
  }

  .score-value {
    font-size: 4.2rem;
  }

  .final-list-card {
    padding: 20px 17px;
    border-radius: 20px;
  }

  .final-list li {
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 12px;
    padding: 13px 0;
  }

  .final-thumb {
    width: 46px;
    height: 46px;
    border-radius: 8px;
  }

  .final-stats {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding: 9px 0 2px;
    border-top: 1px dashed var(--border);
    text-align: left;
  }

  .q-stat {
    min-width: 0;
  }

  .q-stat span {
    font-size: 8px;
  }

  .q-stat b {
    font-size: 13px;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .footer-links {
    gap: 6px;
  }

  .credits-dialog {
    width: calc(100% - 20px);
    max-height: 88vh;
  }

  .dialog-body {
    max-height: calc(88vh - 70px);
    padding: 16px 18px 22px;
  }

  .dialog-head {
    padding: 15px 18px;
  }
}

@media (max-width: 380px) {
  .wrap,
  .wrap.narrow {
    width: calc(100% - 28px);
  }

  .hero-title {
    font-size: 3rem;
  }

  .time-type {
    flex-direction: column;
    align-items: flex-start;
  }

  .time-input {
    width: 100%;
    height: 46px;
  }

  .chart-label {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
