:root {
  font-family: "Avenir Next", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #392a38;
  background: #fff8e9;
  color-scheme: light;
  --ink: #392a38;
  --muted: #695667;
  --line: #392a38;
  --paper: #fffdf6;
  --yellow: #ffdb72;
  --lavender: #eedff7;
  --pink: #ffd9cb;
  --shadow: 4px 5px 0 var(--line);
}
* { box-sizing: border-box; }
body { min-height: 100vh; min-height: 100dvh; margin: 0; }
button { font: inherit; touch-action: manipulation; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible { outline: 3px solid #72569a; outline-offset: 5px; }
[tabindex="-1"]:focus { outline: 0; }
[hidden] { display: none !important; }
::selection { background: var(--yellow); color: var(--ink); }

.shell {
  --edge: clamp(22px, 5vw, 56px);
  display: flex; flex-direction: column; width: min(100%, 1136px);
  min-height: 100vh; min-height: 100dvh; margin-inline: auto;
  padding-inline: max(var(--edge), env(safe-area-inset-left)) max(var(--edge), env(safe-area-inset-right));
  padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom);
}
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 90px; border-bottom: 1px solid #e8d8ca; }
.brand {
  display: inline-flex; align-items: center; gap: 10px; min-width: 0; min-height: 44px; padding: 0; border: 0;
  background: transparent; color: var(--ink); text-align: left; font-size: 1rem;
  font-weight: 820; line-height: 1.05; letter-spacing: -.035em; cursor: pointer;
}
.brand-icon {
  display: flex; flex: 0 0 38px; align-items: center; justify-content: center; gap: 3px; height: 38px;
  border: 1.75px solid var(--line); border-radius: 12px; background: var(--yellow); color: var(--ink);
}
.brand-icon i { display: block; width: 3px; height: 12px; border-radius: 3px; background: currentColor; transform: rotate(-20deg); }
.brand-icon i:nth-child(2) { height: 17px; }
.brand-icon i:nth-child(3) { height: 9px; }
.how-button, .secondary {
  border: 1.5px solid var(--line); border-radius: 10px; padding: 9px 13px; color: var(--ink);
  background: var(--paper); font-size: .875rem; font-weight: 730; cursor: pointer;
}
.how-button { flex-shrink: 0; min-height: 44px; }

main { flex: 1; min-width: 0; }
.hero {
  display: flex; flex-direction: column; align-items: center; width: min(100%, 730px);
  margin-inline: auto; padding-block: clamp(26px, 4.8vh, 48px) 30px; text-align: center;
}
.eyebrow {
  margin: 0; color: #70453d; font-size: .875rem; font-weight: 820;
  letter-spacing: .105em; text-transform: uppercase;
}
.hero h1 {
  margin: 23px 0 4px; font-size: clamp(2.7rem, 7.5vw, 5.4rem);
  font-weight: 880; line-height: .98; letter-spacing: -.069em; text-wrap: balance;
}
.hero h1 em { color: #a73446; font-style: normal; }
.intro {
  max-width: 53ch; margin: 12px 0 0; color: #554153; font-size: clamp(1.05rem, 2vw, 1.22rem);
  font-weight: 620; line-height: 1.42; text-wrap: balance;
}
.hero-rules { margin: 15px 0 0; color: var(--ink); font-size: .95rem; font-weight: 750; text-wrap: balance; }
.hero-rules span { padding-inline: 4px; }
.hero-tip, .home-stats { margin: 14px 0 0; color: var(--muted); font-size: .875rem; line-height: 1.5; text-wrap: balance; }
.home-stats { margin-top: 12px; padding-top: 12px; border-top: 1px solid #e8d8ca; font-weight: 720; }
.hero-actions { width: min(100%, 400px); margin-top: 17px; }
.hero-actions .primary { width: 100%; }
.result-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 11px 15px; }
.primary {
  display: inline-flex; min-height: 53px; align-items: center; justify-content: center; gap: 10px;
  padding: 11px 19px; border: 2px solid var(--line); border-radius: 11px;
  background: var(--yellow); color: var(--ink); font-weight: 820; cursor: pointer;
  box-shadow: 2px 3px 0 var(--line); transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.primary:active { transform: translateY(2px); box-shadow: none; }
.primary:disabled { opacity: .62; cursor: wait; }
.play { width: 0; height: 0; border-top: 6px solid transparent; border-bottom: 6px solid transparent; border-left: 9px solid currentColor; }
.start-status { margin: 11px 0 0; color: #8d2941; font-weight: 650; }
.hero-image {
  position: relative; width: min(100% - 8px, 410px); aspect-ratio: 1.62; overflow: hidden; border: 2px solid var(--line);
  border-radius: 20px; background: #ffcda9; box-shadow: 4px 5px 0 var(--line); transform: rotate(-2deg);
}
.hero-image img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 52%; }
.footer { display: flex; justify-content: center; padding-block: 18px 23px; border-top: 1px solid #e8d8ca; color: var(--muted); font-size: .875rem; }

.round { width: min(100%, 790px); margin: clamp(29px, 5.4vh, 55px) auto 43px; }
.round-header { display: flex; align-items: center; gap: 15px; margin-bottom: 20px; }
#round-count { flex-shrink: 0; font-size: .95rem; font-weight: 780; font-variant-numeric: tabular-nums; }
.confidence { display: flex; flex: 1; align-items: center; min-width: 0; gap: 9px; }
.confidence label { flex-shrink: 0; color: var(--muted); font-size: .875rem; font-weight: 750; }
.confidence-value { flex: 0 0 4ch; text-align: right; font-weight: 820; font-variant-numeric: tabular-nums; }
.confidence meter {
  display: block; width: 0; min-width: 18px; flex: 1; height: 13px; overflow: hidden;
  border: 1.5px solid var(--line); border-radius: 9px; background: var(--paper); appearance: none;
}
.confidence meter::-webkit-meter-bar { height: 100%; border: 0; border-radius: 0; background: var(--paper); }
.confidence meter::-webkit-meter-optimum-value { background: #ac88d0; border-radius: 0; }
.confidence meter::-moz-meter-bar { background: #ac88d0; }
.question-panel {
  padding: clamp(21px, 4.6vw, 51px); border: 2px solid var(--line); border-radius: 22px;
  background: var(--lavender); box-shadow: var(--shadow);
}
.category {
  display: inline-block; margin-bottom: 13px; border-radius: 7px; padding: 4px 8px;
  background: var(--paper); font-size: .875rem; font-weight: 740;
}
.question-panel h1 { max-width: 27ch; margin: 0; font-size: clamp(1.8rem, 4.5vw, 3.5rem); font-weight: 830; line-height: 1.1; letter-spacing: -.045em; text-wrap: pretty; overflow-wrap: anywhere; }
.answers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 19px; }
.option {
  display: flex; min-height: 57px; width: 100%; align-items: center; gap: 11px; padding: 9px 12px;
  border: 1.75px solid var(--line); border-radius: 11px; background: var(--paper); box-shadow: 2px 2px 0 var(--line);
  color: var(--ink); text-align: left; font-size: 1rem; line-height: 1.33; font-weight: 710; cursor: pointer;
}
.option:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--line); }
.option kbd { display: grid; flex: 0 0 27px; height: 27px; place-items: center; border: 1px solid var(--line); border-radius: 5px; background: #f6edfa; color: var(--ink); font-family: inherit; font-size: .875rem; }
.option span { min-width: 0; overflow-wrap: anywhere; }
.option-unknown { grid-column: 1 / -1; border: 1.5px dashed #9d7b85; color: #5c4659; background: transparent; box-shadow: none; font-weight: 640; }
.option-unknown kbd { border-color: #9d7b85; background: transparent; }

.reveal {
  display: grid; align-content: center; justify-items: center; gap: 18px;
  width: min(100%, 510px); min-height: 238px; margin: clamp(28px, 6vh, 60px) auto 36px;
  padding: 26px; border: 2px solid var(--line); border-radius: 22px;
  background: var(--lavender); box-shadow: var(--shadow); text-align: center;
}
.reveal h1 { margin: 0; font-size: clamp(1.55rem, 5.4vw, 2.6rem); letter-spacing: -.042em; }
.reveal-dots { display: flex; gap: 9px; }
.reveal-dots i { width: 13px; height: 13px; border: 1.5px solid var(--line); border-radius: 50%; background: var(--yellow); }
.reveal-dots i:nth-child(2) { background: var(--pink); animation-delay: 65ms; }
.reveal-dots i:nth-child(3) { background: #cbb7e9; animation-delay: 130ms; }

.results {
  display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "age" "controls";
  width: min(100%, 870px); gap: 16px; margin: clamp(28px, 6vh, 60px) auto 44px;
}
.results:has(.result-clues:not([hidden])) {
  grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
  grid-template-areas: "age clues" "controls clues";
}
.result-panel, .result-clues, .result-controls {
  padding: clamp(21px, 4vw, 34px); border: 2px solid var(--line); border-radius: 21px;
  background: var(--paper); box-shadow: var(--shadow);
}
.result-panel { grid-area: age; background: var(--pink); }
.result-clues { grid-area: clues; }
.result-controls { grid-area: controls; }
.result-panel h1 { margin: 10px 0 8px; font-size: clamp(2rem, 6vw, 3.6rem); letter-spacing: -.055em; line-height: 1.06; }
.result-age {
  display: inline-block; color: #a73446; font-size: clamp(4rem, 16vw, 7rem);
  font-weight: 875; line-height: .9; font-variant-numeric: tabular-nums;
}
.result-detail { margin: 13px 0 0; color: #5c4659; font-size: 1.06rem; line-height: 1.52; }
.feedback { margin: -3px 0 21px; padding-bottom: 14px; border-bottom: 1px solid #bf9eab; }
.feedback p { margin: 0 0 8px; font-size: .9rem; line-height: 1.42; }
.feedback-actions { display: flex; gap: 8px; }
.feedback-actions button { min-width: 56px; min-height: 44px; }
.result-actions .secondary { min-height: 53px; }
.result-message { margin: 12px 0 0; color: var(--muted); font-size: .875rem; }
.result-message:empty { margin: 0; }
.result-clues h2 { margin: 0 0 15px; font-size: 1.22rem; }
.result-clues ul { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.result-clues li { padding-top: 10px; border-top: 1px solid #e4d6de; color: #5c4659; line-height: 1.45; }
.result-clues strong { display: block; margin-top: 3px; color: var(--ink); }

dialog { width: min(100% - 34px, 470px); max-height: 86dvh; overflow: auto; padding: 0; border: 2px solid var(--line); border-radius: 18px; background: var(--paper); color: var(--ink); box-shadow: var(--shadow); }
dialog::backdrop { background: #3b2f3a77; }
.dialog-inner { padding: clamp(21px, 5vw, 38px); }
.dialog-inner h2 { margin-top: 0; font-size: 1.85rem; letter-spacing: -.04em; }
.dialog-inner p { color: #5c4659; line-height: 1.55; }
.dialog-inner button { margin-top: 8px; }

@media (hover: hover) and (pointer: fine) {
  .how-button:hover, .secondary:hover { background: var(--yellow); }
  .primary:hover { background: #ffe89e; transform: translateY(-2px); box-shadow: 2px 5px 0 var(--line); }
  .option:hover { background: #ffe6a1; }
}
@media (pointer: coarse) {
  .option kbd { display: none; }
}
@media (max-width: 670px) {
  .shell { --edge: 15px; }
  .top { min-height: 59px; gap: 9px; }
  .brand { gap: 7px; font-size: .9rem; }
  .brand-icon { flex-basis: 32px; height: 32px; border-radius: 9px; }
  .how-button { padding-inline: 9px; }
  .hero { padding-block: 24px 22px; }
  .hero-image { width: min(88% - 8px, 355px); aspect-ratio: 1.68; }
  .hero h1 { margin-top: 17px; font-size: clamp(2.25rem, 9vw, 4.25rem); }
  .intro { max-width: 36ch; margin-top: 10px; font-size: 1rem; }
  .hero-rules { margin-top: 12px; font-size: .875rem; line-height: 1.35; }
  .hero-actions { margin-top: 15px; }
  .hero-tip { margin-top: 12px; }
  .footer { padding-block: 13px 15px; }

  .round { margin: 19px auto 27px; }
  .round-header { gap: 9px; margin-bottom: 12px; }
  .confidence { gap: 6px; }
  .question-panel { padding: 16px; border-radius: 16px; }
  .category { margin-bottom: 9px; }
  .question-panel h1 { font-size: clamp(1.4rem, 6.4vw, 2.25rem); line-height: 1.15; }
  .answers { grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 13px; }
  .option { min-height: 49px; padding: 8px 11px; }

  .reveal { min-height: 195px; margin-top: 23px; }
  .results { gap: 12px; margin: 20px auto 28px; }
  .results:has(.result-clues:not([hidden])) {
    grid-template-columns: minmax(0, 1fr); grid-template-areas: "age" "clues" "controls";
  }
  .result-panel, .result-clues, .result-controls { padding: 17px; border-radius: 16px; }
  .result-panel { text-align: center; }
  .result-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 125px), 1fr)); gap: 9px; }
  .result-actions button { padding-inline: 8px; }
}
@media (max-width: 365px) {
  .shell { --edge: 12px; }
  .hero h1 { font-size: 2.19rem; }
  #round-count, .confidence label, .brand { font-size: .82rem; }
}
@media (max-width: 670px) and (max-height: 650px) {
  .hero { padding-top: 17px; }
  .hero-image { width: min(76% - 8px, 300px); aspect-ratio: 1.76; }
}
@media (prefers-reduced-motion: no-preference) {
  .reveal-dots i { animation-name: reveal-dot; animation-duration: 410ms; animation-timing-function: ease-out; }
  .result-age { animation: age-in 320ms cubic-bezier(.18, .75, .28, 1.18) both; }
  .result-clues { animation: clues-in 330ms 85ms ease-out both; }
}
@media (prefers-reduced-motion: reduce) {
  .primary { transition: none; }
}
@keyframes reveal-dot {
  0%, 100% { transform: translateY(0); }
  46% { transform: translateY(-8px); }
}
@keyframes age-in {
  from { opacity: 0; transform: scale(.86); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes clues-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 671px) and (max-height: 800px) {
  .top { min-height: 72px; }
  .hero { padding-block: 25px 20px; }
  .hero-image { width: min(100% - 8px, 365px); aspect-ratio: 1.85; }
  .hero h1 { margin-top: 17px; font-size: clamp(3.25rem, 6vw, 4.55rem); }
  .intro { margin-top: 8px; }
  .hero-rules { margin-top: 11px; }
  .hero-actions { margin-top: 14px; }
  .hero-tip { margin-top: 11px; }
}
