@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../assets/fonts/dm-sans-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Playfair Display";
  font-style: normal;
  font-weight: 500 600;
  font-display: swap;
  src: url("../assets/fonts/playfair-display-latin.woff2") format("woff2");
}

:root {
  --ivory: #faf7ef;
  --ivory-deep: #f1e9dc;
  --paper: #fffdf8;
  --emerald: #004c3f;
  --emerald-dark: #00382f;
  --gold: #c69b4a;
  --gold-light: #e7c98c;
  --taupe: #c9b8a6;
  --taupe-soft: #e5d9cb;
  --ink: #17342e;
  --muted: #65736e;
  --wrong: #9b6715;
  --shadow: 0 26px 70px rgba(0, 56, 47, .1);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--ivory); }
body { min-height: 100vh; margin: 0; background: radial-gradient(circle at 50% 0, #fffdf8 0, var(--ivory) 58%); color: var(--ink); font-family: "DM Sans", Arial, sans-serif; line-height: 1.55; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
img { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: "Playfair Display", Georgia, serif; font-weight: 500; line-height: 1.12; }

.skip-link { position: fixed; top: -5rem; left: 1rem; z-index: 100; padding: .75rem 1rem; background: var(--paper); border: 1px solid var(--gold); }
.skip-link:focus { top: 1rem; }
.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; }

.iq-shell { min-height: 100vh; display: grid; place-items: center; padding: clamp(1rem, 4vw, 3.25rem); }
.screen { width: min(760px, 100%); min-height: min(810px, calc(100vh - 2rem)); display: flex; flex-direction: column; padding: clamp(1.4rem, 5vw, 3.5rem); background: rgba(255, 253, 248, .92); border: 1px solid var(--taupe-soft); border-radius: 26px; box-shadow: var(--shadow); }
.start-screen { align-items: center; justify-content: center; text-align: center; }
.start-logo { width: clamp(190px, 38vw, 290px); height: auto; margin-bottom: clamp(2.5rem, 7vh, 5rem); }
.overline { margin-bottom: .85rem; color: var(--gold); font-size: .74rem; font-weight: 600; letter-spacing: .19em; text-transform: uppercase; }
.start-screen h1 { margin-bottom: 1.2rem; color: var(--emerald); font-size: clamp(2.55rem, 8vw, 5rem); letter-spacing: -.025em; text-transform: uppercase; }
.start-question { max-width: 460px; margin-bottom: 0; font: 500 clamp(1.2rem, 3.2vw, 1.65rem) "Playfair Display", Georgia, serif; }
.gold-rule { width: 92px; height: 1px; margin: 2rem auto; background: var(--gold); }
.start-count { margin-bottom: 2.25rem; color: var(--muted); }
.supporting-line { margin: .9rem 0 0; color: var(--muted); font-size: .88rem; }

.primary-button, .secondary-button, .quiet-button, .option-button, .share-button {
  min-height: 52px;
  border-radius: 9px;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, background-color .16s ease, border-color .16s ease;
}
.primary-button { min-width: min(100%, 300px); padding: .9rem 1.5rem; background: var(--emerald); color: var(--ivory); border: 1px solid var(--emerald); font-weight: 600; letter-spacing: .025em; text-transform: uppercase; }
.secondary-button { padding: .85rem 1.25rem; background: transparent; color: var(--emerald); border: 1px solid var(--emerald); font-weight: 600; }
.quiet-button { padding: .75rem 1rem; background: transparent; color: var(--muted); border: 1px solid var(--taupe); }
.primary-button:hover, .secondary-button:hover, .quiet-button:hover, .option-button:hover, .share-button:hover,
.primary-button:focus-visible, .secondary-button:focus-visible, .quiet-button:focus-visible, .option-button:focus-visible, .share-button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(0, 56, 47, .12);
}
button:focus-visible, a:focus-visible { outline: 3px solid var(--gold-light); outline-offset: 3px; }
button:disabled { cursor: wait; opacity: .7; }

.game-header { display: grid; grid-template-columns: 116px 1fr auto; align-items: center; gap: 1.3rem; margin-bottom: 1rem; }
.game-logo img { width: 112px; height: auto; }
.question-counter { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.final-label { color: var(--gold); font-size: .68rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.progress-track { grid-column: 1 / -1; height: 5px; overflow: hidden; background: var(--ivory-deep); border-radius: 99px; }
.progress-bar { height: 100%; background: var(--emerald); border-radius: inherit; transition: width .35s ease; }
.question-body { flex: 1; display: flex; flex-direction: column; padding-top: clamp(1.25rem, 4vw, 2.6rem); }
.mechanic-label { margin-bottom: .7rem; color: var(--gold); font-size: .68rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; }
.question-title { max-width: 650px; margin: 0 auto 1.5rem; color: var(--ink); font-size: clamp(1.45rem, 4vw, 2.25rem); text-align: center; }
.question-actions { margin-top: auto; }

.visual-stage { position: relative; min-height: 230px; display: grid; place-items: center; overflow: hidden; margin: 0 auto 1.6rem; width: min(100%, 590px); background: linear-gradient(145deg, #f4ede2, #fffdf8); border: 1px solid var(--taupe-soft); border-radius: 16px; }
.visual-stage::before { content: ""; position: absolute; width: 260px; height: 260px; background: radial-gradient(circle, rgba(198, 155, 74, .12), transparent 68%); }
.visual-caption { position: absolute; right: .8rem; bottom: .65rem; color: var(--muted); font-size: .66rem; letter-spacing: .08em; text-transform: uppercase; }
.asset-photo { width: 100%; height: 290px; object-fit: contain; background: var(--ivory-deep); }
.procedural-mark { position: relative; width: 148px; height: 148px; display: grid; place-items: center; color: var(--emerald); border: 1px solid var(--gold); border-radius: 50%; font: 500 2.2rem "Playfair Display", Georgia, serif; }
.procedural-mark::before, .procedural-mark::after { content: ""; position: absolute; inset: 17px; border: 1px solid rgba(0, 76, 63, .34); transform: rotate(45deg); }
.procedural-mark::after { inset: 32px; transform: rotate(0); }
.procedural-mark span { position: relative; z-index: 1; padding: .35rem; background: var(--ivory); border-radius: 50%; }
.pattern-stage { background-color: #efe6d7; background-image: linear-gradient(45deg, rgba(0, 76, 63, .13) 25%, transparent 25%), linear-gradient(-45deg, rgba(0, 76, 63, .13) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, rgba(198, 155, 74, .2) 75%), linear-gradient(-45deg, transparent 75%, rgba(198, 155, 74, .2) 75%); background-size: 42px 42px; background-position: 0 0, 0 21px, 21px -21px, -21px 0; }
.closeup-stage .procedural-mark { border-radius: 18px; transform: rotate(-7deg); }
.silhouette-shape { position: relative; width: 210px; height: 135px; margin-top: 34px; background: var(--emerald-dark); border-radius: 12px 12px 24px 24px; box-shadow: 0 18px 28px rgba(0, 56, 47, .18); }
.silhouette-shape::before { content: ""; position: absolute; width: 92px; height: 68px; left: 50%; top: -52px; border: 13px solid var(--emerald-dark); border-bottom: 0; border-radius: 70px 70px 0 0; transform: translateX(-50%); }
.silhouette-shape::after { content: ""; position: absolute; inset: 22px 18px auto; height: 1px; background: rgba(250, 247, 239, .23); }
.silhouette-shape.variant-1 { width: 175px; height: 150px; border-radius: 35px 35px 14px 14px; }
.silhouette-shape.variant-2 { width: 250px; height: 110px; transform: skewX(-4deg); }
.silhouette-shape.variant-3 { width: 190px; height: 155px; border-radius: 8px; }
.staging-note { position: absolute; left: .75rem; top: .75rem; z-index: 2; padding: .3rem .5rem; background: rgba(255, 253, 248, .86); color: var(--wrong); border: 1px solid var(--gold-light); border-radius: 99px; font-size: .61rem; letter-spacing: .08em; text-transform: uppercase; }

.clue-panel { width: min(100%, 560px); margin: 0 auto 1.6rem; padding: 1.5rem; background: var(--ivory-deep); border: 1px solid var(--taupe-soft); border-radius: 14px; text-align: center; }
.clue-count { color: var(--gold); font: 500 1.15rem "Playfair Display", Georgia, serif; text-transform: uppercase; }
.clue-copy { min-height: 54px; margin: 1rem 0; font-size: 1.05rem; }
.clue-dots { display: flex; justify-content: center; gap: .55rem; margin-top: 1rem; }
.clue-dots i { width: 10px; height: 10px; border: 1px solid var(--gold); border-radius: 50%; }
.clue-dots i.active { background: var(--gold); }

.options { display: grid; gap: .72rem; width: min(100%, 620px); margin: 0 auto; }
.options.image-options, .options.match-options { grid-template-columns: 1fr 1fr; }
.option-button { display: grid; grid-template-columns: 32px 1fr; align-items: center; min-height: 56px; padding: .7rem .85rem; background: var(--paper); color: var(--ink); border: 1px solid var(--taupe-soft); text-align: left; }
.option-letter { display: grid; width: 26px; height: 26px; place-items: center; color: var(--emerald); background: var(--ivory-deep); border-radius: 50%; font-size: .78rem; font-weight: 600; }
.image-options .option-button { grid-template-columns: 58px 1fr; min-height: 90px; }
.image-option-art { width: 50px; height: 50px; display: grid; place-items: center; background: linear-gradient(135deg, var(--emerald-dark), var(--emerald)); color: var(--gold-light); border-radius: 9px; font-family: "Playfair Display", Georgia, serif; }
.match-options .option-button { min-height: 94px; grid-template-columns: 1fr; }
.match-map { display: flex; flex-wrap: wrap; gap: .35rem; }
.match-chip { padding: .27rem .45rem; background: var(--ivory-deep); border-radius: 5px; font-size: .74rem; }
.option-button.selected { color: var(--ivory); background: var(--emerald); border-color: var(--emerald); }
.option-button.locked { cursor: default; }

.source-link { align-self: center; margin: 1.15rem auto 0; color: var(--muted); font-size: .72rem; text-decoration: none; }
.source-link:hover { color: var(--emerald); text-decoration: underline; }

.feedback-screen { justify-content: space-between; text-align: center; }
.feedback-content { flex: 1; display: grid; place-items: center; padding-block: 2rem; }
.feedback-mark { display: grid; width: 94px; height: 94px; place-items: center; margin: 0 auto 1.25rem; border: 2px solid currentColor; border-radius: 50%; font-size: 2.8rem; line-height: 1; }
.feedback-mark.correct { color: var(--emerald); }
.feedback-mark.wrong { color: var(--wrong); }
.feedback-title { margin-bottom: .65rem; color: var(--emerald); font-size: clamp(2rem, 6vw, 3rem); }
.feedback-title.wrong { color: var(--wrong); }
.correct-answer { margin: .4rem 0 1.1rem; color: var(--muted); }
.learning-card { width: min(100%, 540px); padding: 1.4rem; background: var(--ivory-deep); border-left: 3px solid var(--gold); text-align: left; }
.learning-card strong { display: block; margin-bottom: .3rem; color: var(--emerald); }

.recovery-screen { align-items: center; justify-content: center; text-align: center; }
.recovery-icon { width: 72px; height: 72px; display: grid; place-items: center; margin-bottom: 1.6rem; color: var(--gold); border: 1px solid var(--gold); border-radius: 50%; font: 500 2rem "Playfair Display", Georgia, serif; }
.recovery-screen h1 { color: var(--emerald); font-size: clamp(2rem, 7vw, 3.5rem); }
.recovery-screen p { max-width: 470px; color: var(--muted); }
.stacked-actions { width: min(100%, 340px); display: grid; gap: .85rem; margin-top: 1.5rem; }

.result-screen { align-items: center; text-align: center; }
.result-screen .game-header { width: 100%; }
.result-content { width: 100%; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1rem 0; }
.result-kicker { margin-bottom: .25rem; color: var(--emerald); font: 500 .82rem "Playfair Display", Georgia, serif; letter-spacing: .08em; text-transform: uppercase; }
.result-score { margin: .2rem 0; color: var(--emerald); font: 500 clamp(5rem, 18vw, 8.5rem) "Playfair Display", Georgia, serif; line-height: 1; }
.result-level { margin-bottom: .8rem; color: var(--gold); font: 500 clamp(1.2rem, 4vw, 1.7rem) "Playfair Display", Georgia, serif; text-transform: uppercase; }
.result-description { max-width: 470px; margin-bottom: 1.15rem; color: var(--muted); }
.personal-best { margin-bottom: 1.6rem; padding: .45rem .75rem; background: var(--ivory-deep); border-radius: 99px; color: var(--emerald); font-size: .78rem; }
.result-actions { width: min(100%, 390px); display: grid; gap: .72rem; }
.discover-link { margin-top: 1.35rem; color: var(--emerald); font-size: .78rem; font-weight: 600; text-decoration: none; text-transform: uppercase; }
.disclaimer { max-width: 520px; margin: 1.5rem auto 0; color: var(--muted); font-size: .68rem; }

.share-screen { align-items: center; }
.share-card { width: min(100%, 470px); aspect-ratio: 4 / 5; display: flex; flex-direction: column; align-items: center; justify-content: center; margin: .8rem auto 1.4rem; padding: 2.2rem; background: var(--ivory); border: 2px solid var(--gold); border-radius: 18px; box-shadow: 0 20px 48px rgba(0, 56, 47, .12); text-align: center; }
.share-card img { width: 138px; margin-bottom: 2.5rem; }
.share-card h1 { margin-bottom: .4rem; color: var(--emerald); font-size: clamp(1.4rem, 5vw, 2.2rem); text-transform: uppercase; }
.share-card-score { color: var(--emerald); font: 500 clamp(4.6rem, 17vw, 7rem) "Playfair Display", Georgia, serif; line-height: 1; }
.share-card-level { margin: .35rem 0 2rem; color: var(--gold); font: 500 1.1rem "Playfair Display", Georgia, serif; text-transform: uppercase; }
.share-card-question { margin-bottom: .6rem; }
.share-card-url { color: var(--emerald); font-weight: 600; }
.share-title { margin-bottom: .4rem; color: var(--emerald); font-size: 1.4rem; }
.share-grid { width: min(100%, 470px); display: grid; grid-template-columns: repeat(5, 1fr); gap: .55rem; }
.share-button { min-width: 0; min-height: 58px; display: grid; place-items: center; padding: .5rem; background: var(--paper); color: var(--emerald); border: 1px solid var(--gold); font-size: .72rem; }
.share-button strong { display: block; font-size: 1.05rem; }
.share-footer-actions { width: min(100%, 470px); display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin-top: .9rem; }

.toast { position: fixed; left: 50%; bottom: max(1.5rem, env(safe-area-inset-bottom)); z-index: 50; max-width: calc(100% - 2rem); padding: .75rem 1rem; background: var(--emerald-dark); color: var(--ivory); border: 1px solid var(--gold); border-radius: 8px; opacity: 0; pointer-events: none; transform: translate(-50%, 20px); transition: opacity .2s ease, transform .2s ease; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

.sources-header { min-height: 86px; display: flex; align-items: center; justify-content: space-between; padding: 1rem clamp(1.25rem, 6vw, 6rem); background: rgba(250, 247, 239, .94); border-bottom: 1px solid var(--taupe-soft); }
.sources-header img { width: 128px; }
.quiet-link { color: var(--emerald); font-size: .88rem; font-weight: 600; text-decoration: none; }
.sources-page { width: min(1120px, calc(100% - 2rem)); margin: 0 auto; padding: clamp(3.5rem, 8vw, 7rem) 0; }
.sources-page > h1 { margin-bottom: 1.2rem; color: var(--emerald); font-size: clamp(2.5rem, 7vw, 5rem); }
.sources-intro { max-width: 800px; color: var(--muted); font-size: 1.02rem; }
.sources-key { display: flex; flex-wrap: wrap; gap: 1.2rem; margin: 2rem 0; padding: 1rem 0; border-block: 1px solid var(--taupe-soft); color: var(--muted); font-size: .8rem; }
.sources-key span { display: flex; align-items: center; gap: .45rem; }
.status-dot { width: 9px; height: 9px; display: inline-block; border-radius: 50%; }
.status-dot.ready { background: var(--emerald); }
.status-dot.pending { background: var(--gold); }
.sources-list { display: grid; gap: 1rem; }
.source-record { scroll-margin-top: 1.5rem; padding: 1.4rem; background: var(--paper); border: 1px solid var(--taupe-soft); border-radius: 12px; }
.source-record:target { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(198, 155, 74, .13); }
.source-record-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.source-id { color: var(--gold); font-weight: 600; letter-spacing: .08em; }
.source-status { padding: .3rem .55rem; border-radius: 99px; font-size: .68rem; }
.source-status.ready { background: rgba(0, 76, 63, .09); color: var(--emerald); }
.source-status.pending { background: rgba(198, 155, 74, .14); color: var(--wrong); }
.source-record h2 { margin: .7rem 0 1rem; color: var(--emerald); font-size: 1.35rem; }
.source-record dl { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem 1.5rem; margin: 0 0 1rem; }
.source-record dl div { padding-top: .7rem; border-top: 1px solid var(--taupe-soft); }
.source-record dt { color: var(--muted); font-size: .68rem; letter-spacing: .07em; text-transform: uppercase; }
.source-record dd { margin: .2rem 0 0; font-size: .86rem; }
.source-original { color: var(--emerald); font-size: .8rem; font-weight: 600; }
.notice-card { padding: 2rem; background: var(--paper); border: 1px solid var(--taupe-soft); }

@media (max-width: 640px) {
  .iq-shell { display: block; padding: 0; }
  .screen { min-height: 100vh; border: 0; border-radius: 0; box-shadow: none; padding: max(1.1rem, env(safe-area-inset-top)) 1rem max(1.25rem, env(safe-area-inset-bottom)); }
  .start-logo { margin-bottom: 3rem; }
  .game-header { grid-template-columns: 92px 1fr auto; gap: .7rem; }
  .game-logo img { width: 88px; }
  .question-body { padding-top: 1rem; }
  .visual-stage { min-height: 205px; }
  .options.image-options, .options.match-options { grid-template-columns: 1fr; }
  .image-options .option-button { min-height: 70px; }
  .share-grid { grid-template-columns: repeat(3, 1fr); }
  .share-footer-actions { grid-template-columns: 1fr; }
  .sources-header { min-height: 72px; }
  .sources-header img { width: 104px; }
  .source-record dl { grid-template-columns: 1fr; }
  .source-status { text-align: right; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
