:root {
  color-scheme: light;
  --paper: #eaf3f8;
  --sheet: #fcfcf9;
  --ink: #17334d;
  --blue: #315c87;
  --rule: #bdcdd7;
  --incorrect: #a13b2e;
  font-family: "Source Sans 3", sans-serif;
  color: var(--ink);
  background: #f7fafb;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100dvh; padding: 2rem 0; }
a { color: var(--ink); }
button, input { font: inherit; }
button { min-height: 48px; border-radius: 12px; padding: .65rem 1.2rem; font-weight: 600; cursor: pointer; touch-action: manipulation; }
button:focus-visible, a:focus-visible, input:focus-visible, [tabindex="-1"]:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
h1, h2, .clue-value, .clue-label, .guess-form > label, .next-clue, .attempt-note { font-family: Literata, Georgia, serif; }
h1, h2 { margin: 0; line-height: 1.16; }
.page-shell { position: relative; isolation: isolate; width: min(calc(100% - 2rem), 850px); margin: 0 auto; padding: 1.75rem .5rem 1rem; border-radius: 22px; background: radial-gradient(ellipse at 35% 20%, #fff9, transparent 65%), var(--paper); box-shadow: inset 0 0 30px #d4e4ee55; }
.page-shell::before, .paper::after { position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: url("art/paper-grain.svg") repeat; opacity: .22; content: ""; pointer-events: none; }
.site-header { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: .8rem; padding: .3rem 1rem; }
.site-header h1 { min-width: 0; overflow-wrap: anywhere; font-size: clamp(1.65rem, 5.5vw, 3.1rem); text-align: center; }
.site-header a { display: inline-flex; gap: .35rem; align-items: center; min-height: 48px; font-size: 1.15rem; text-decoration: none; }
.home-link span { font-size: 2rem; line-height: 1; }
.header-stats { justify-self: end; padding: .3rem; border: 0; border-radius: 4px; background: transparent; color: var(--ink); font-size: 1.15rem; font-weight: 400; }
.passport-heading { position: relative; min-height: 245px; margin: .7rem 0 1.25rem; }
.globe { position: absolute; top: .5rem; left: 1rem; width: clamp(110px, 25vw, 215px); height: auto; opacity: .62; mix-blend-mode: multiply; }
.date-stamp { position: absolute; top: 1.8rem; right: 3.7rem; display: grid; gap: .4rem; padding: .8rem 1.3rem; border: 3px double #a13b2e; outline: 1px dashed #a13b2eaa; outline-offset: 4px; border-radius: 7px; color: #92382c; background: #ffffff20; font: 500 1.4rem/1.4 Literata, Georgia, serif; text-align: center; letter-spacing: .09em; text-transform: uppercase; transform: rotate(-6deg); }
.date-stamp::after { position: absolute; top: 10%; left: calc(100% - 3px); width: 76px; height: 80%; background: url("art/postmark.svg") center / 100% 100% no-repeat; content: ""; pointer-events: none; }
.date-stamp time { display: block; white-space: nowrap; }
.attempt-progress { position: absolute; inset: auto 0 0; text-align: center; }
.attempt-count { margin: 0 0 .7rem; font-size: 1.4rem; }
.attempt-dots { display: flex; justify-content: center; gap: .75rem; }
.attempt-dots span { width: 25px; height: 25px; border: 1.5px solid #52799c; border-radius: 50%; box-shadow: inset 1px 2px 3px #fff; background: #ffffff88; }
.attempt-dots .filled { background: var(--blue); box-shadow: inset 1px 2px 3px #ffffff33; }
.paper { --margin: 74px; position: relative; isolation: isolate; padding: 2.3rem 1.8rem 1.8rem calc(var(--margin) + 27px); border: 1px solid #dbe6e9; border-radius: 22px; background: linear-gradient(to right, transparent calc(var(--margin) - 1px), #ce989880 var(--margin), transparent calc(var(--margin) + 2px)), linear-gradient(#e2e9eb88 1px, transparent 1px) 0 2.4rem / 100% 76px, var(--sheet); box-shadow: 0 5px 14px #567d9326, inset 0 1px 3px #fff; }
.paper::before { position: absolute; inset: 2.6rem auto 1.8rem 18px; width: 26px; background: radial-gradient(circle at 13px 13px, #bfd3df 0, #dce8ed 10px, #a9c3d388 13px, transparent 14px) 0 0 / 26px 76px repeat-y; content: ""; pointer-events: none; }
.paper::after { opacity: .15; }
.welcome { text-align: center; padding-top: 3rem; padding-bottom: 3rem; }
.welcome h2, .result h2 { font-size: clamp(1.6rem, 4.5vw, 2.4rem); }
.welcome-copy { margin: 1rem auto; max-width: 30rem; font: 500 1.4rem/1.6 Literata, Georgia, serif; }
.instructions { max-width: 31rem; margin: .5rem auto 1.5rem; font-size: 1.1rem; line-height: 1.5; color: #334f68; }
.saved-note, .storage-message { color: #334f68; font-size: .95rem; }
.primary-button { border: 2px solid #244b72; background: linear-gradient(125deg, #315c87, #254771); color: #fff; box-shadow: inset 0 1px 2px #ffffff44; }
.primary-button:hover { background: #24496f; }
.secondary-button { border: 2px solid var(--blue); background: #ffffff55; color: var(--ink); }
.secondary-button:hover { background: #e7f1f8; }
.clue-list { list-style: none; margin: 0; padding: 0; counter-reset: clue; }
.clue-row { counter-increment: clue; display: grid; grid-template-columns: 4rem minmax(0, 1fr); column-gap: 2rem; padding: 1.5rem 0 1.75rem; border-bottom: 1px solid var(--rule); }
.clue-row::before { grid-column: 1; grid-row: 1 / 3; content: counter(clue, decimal-leading-zero); padding: .2rem 1rem 0 0; border-right: 1px solid #c7d3d9; color: var(--incorrect); font: 400 2.5rem/1.3 Literata, Georgia, serif; font-variant-numeric: tabular-nums; }
.clue-row > span:not(.attempt-note) { min-width: 0; }
.clue-row.active { margin: 0 -.8rem; padding-right: .8rem; padding-left: .8rem; border-bottom: 0; border-radius: 8px; background: #dcecf3aa; }
.clue-label { display: block; margin-bottom: .25rem; font-size: 1.6rem; font-weight: 400; line-height: 1.45; overflow-wrap: anywhere; }
.clue-value { display: block; overflow-wrap: anywhere; font-size: 2.5rem; font-weight: 400; line-height: 1.4; }
.attempt-note { grid-column: 2; display: flex; align-items: center; flex-wrap: wrap; gap: .4rem .7rem; min-height: 86px; margin-top: .9rem; padding: 1rem 1.2rem; border: 1px solid #d8b8b5; border-radius: 12px; background: #f5eae888; font-size: 1.4rem; font-weight: 400; line-height: 1.5; overflow-wrap: anywhere; }
.attempt-caption { color: #515a61; font-size: 1.2rem; }
.attempt-note.skipped { border-color: #d7dfe4; background: #e7edf1aa; }
.attempt-note .incorrect, .attempt-note .correct { margin-left: auto; padding-left: .8rem; border-left: 1px solid #d8b8b5; color: var(--incorrect); font-family: "Source Sans 3", sans-serif; font-weight: 600; }
.attempt-note .correct { color: #265a42; }
.guess-form { margin-top: 1rem; }
.guess-form > label { display: block; margin-bottom: .5rem; font-size: 1.6rem; }
.input-wrap { position: relative; }
.input-wrap::after { position: absolute; right: 1.1rem; top: calc(50% - .6rem); width: .75rem; height: .75rem; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(45deg); content: ""; pointer-events: none; }
.input-wrap input { width: 100%; min-height: 88px; padding: .7rem 2.6rem .7rem 1.25rem; border: 2px solid #718ba3; border-radius: 12px; background: #ffffff77; color: var(--ink); font-size: 1.6rem; box-shadow: inset 0 1px 4px #17334d0c; }
.input-wrap input::placeholder { color: #64717b; opacity: 1; }
#suggestions-container { position: absolute; z-index: 3; inset: calc(100% + 2px) 0 auto; max-height: 16rem; overflow-y: auto; margin: 0; padding: .25rem; list-style: none; border: 1px solid #718ba3; border-radius: 10px; background: var(--sheet); box-shadow: 0 8px 18px #17334d22; }
.suggestion-item { min-height: 44px; padding: .6rem .7rem; border-radius: 5px; cursor: pointer; }
.suggestion-item[aria-selected="true"], .suggestion-item:hover { background: #dcecf3; }
.message { margin: .5rem 0; color: var(--incorrect); font-weight: 600; }
.storage-message { margin: .5rem 0; }
.message:empty, .storage-message:empty { display: none; }
.actions { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 1rem; margin-top: 1rem; }
.actions button { min-width: 0; min-height: 82px; overflow-wrap: anywhere; font-size: 1.6rem; }
.next-clue { margin: 1.8rem 0 0; padding: 1.2rem 0 .2rem; border-top: 1px solid var(--rule); text-align: center; font-size: 1.35rem; overflow-wrap: anywhere; }
.next-clue span { color: #626970; font-size: 1.1rem; }
.eyebrow { margin: 0 0 .8rem; color: #3e5c78; font-size: .85rem; font-weight: 700; letter-spacing: .1em; }
.result { text-align: center; }
.result h2 { margin: .3rem 0 .6rem; }
.result-country { display: flex; max-width: 100%; min-width: 0; flex-wrap: wrap; align-items: center; justify-content: center; gap: .6rem; overflow-wrap: anywhere; }
.result-country > img { flex: 0 0 auto; }
.result-country img { width: 2.5rem; height: auto; border: 1px solid var(--rule); }
.result-message { margin: .3rem 0 1rem; font-weight: 600; }
.result-attempts { padding: 0; margin: 0 0 1rem; list-style-position: inside; text-align: left; }
.result-attempts li { padding: .5rem 0; border-bottom: 1px solid var(--rule); overflow-wrap: anywhere; }
.result-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; margin: 1rem 0 1.3rem; text-align: left; }
.result-fact { padding: .7rem; border: 1px solid var(--rule); border-radius: 6px; background: #ffffff55; overflow-wrap: anywhere; }
.page-footer { display: flex; justify-content: center; flex-wrap: wrap; gap: .5rem 1.5rem; margin-top: .8rem; color: #3e5c78; font-size: .85rem; }
.page-footer a { display: inline-flex; align-items: center; min-height: 44px; text-underline-offset: 4px; }
.page-footer span { align-self: center; }
.visually-hidden { 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; top: .5rem; left: .5rem; z-index: 20; padding: .6rem 1rem; transform: translateY(-200%); background: var(--sheet); }
.skip-link:focus { transform: none; }
[hidden] { display: none !important; }
.stats-popup-overlay { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 1rem; background: #10253b99; }
.stats-popup { width: min(100%, 680px); max-height: min(90vh, 760px); overflow: auto; overscroll-behavior: contain; padding: 1.2rem; border: 1px solid var(--rule); border-radius: 16px; background: var(--sheet); box-shadow: 0 18px 60px #06152566; }
.stats-popup-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.stats-popup-title { margin: 0; font: 600 1.35rem Literata, Georgia, serif; }
.stats-popup-close, .stats-popup-tab { min-height: 44px; border: 1px solid var(--blue); background: white; color: var(--blue); }
.stats-popup-tabs { display: flex; gap: .5rem; margin: .8rem 0; }
.stats-popup-tab.is-active { background: var(--blue); color: white; }
.stats-popup-summary { margin: .7rem 0; }
.stats-chart { display: grid; gap: .5rem; }
.stats-chart-row { display: grid; grid-template-columns: 7rem minmax(4rem, 1fr) 2rem; align-items: center; gap: .5rem; font-size: .9rem; }
.stats-chart-track { height: .75rem; overflow: hidden; border-radius: 99px; background: #e7eef5; }
.stats-chart-fill { height: 100%; border-radius: inherit; background: var(--blue); }
.stats-chart-value { text-align: right; }
.stats-popup-kofi { display: block; margin-top: 1rem; text-align: center; }
@media (max-width: 600px) {
  body { padding: .5rem 0; }
  .page-shell { width: calc(100% - 1rem); padding: 1rem .65rem .5rem; border-radius: 14px; }
  .site-header { grid-template-columns: minmax(0, 1fr) auto; gap: .2rem; padding: .3rem .2rem; }
  .site-header h1 { grid-row: 2; grid-column: 1 / -1; margin-top: .2rem; font-size: 2rem; }
  .site-header a, .header-stats { font-size: 1rem; }
  .passport-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 1rem; min-height: 200px; margin: .5rem 0 1rem; padding-bottom: 80px; }
  .globe { position: static; width: 120px; margin-top: 1rem; }
  .date-stamp { position: relative; top: auto; right: auto; max-width: calc(100% - 30px); margin: 1.8rem 1rem 0 0; gap: .2rem; padding: .5rem .65rem; font-size: .8rem; letter-spacing: .06em; }
  .date-stamp time { white-space: normal; }
  .date-stamp::after { width: 30px; }
  .attempt-count { font-size: 1.15rem; }
  .attempt-dots { gap: .6rem; }
  .attempt-dots span { width: 19px; height: 19px; }
  .paper { --margin: 36px; padding: 1rem .85rem 1.1rem calc(var(--margin) + 12px); border-radius: 15px; }
  .paper::before { left: 9px; width: 16px; background-size: 16px 60px; background-image: radial-gradient(circle at 8px 8px, #bfd3df 0, #dce8ed 5px, #a9c3d388 8px, transparent 9px); }
  .clue-row { grid-template-columns: 1.65rem minmax(0, 1fr); column-gap: .65rem; padding: 1rem 0; }
  .clue-row::before { padding-right: .3rem; font-size: 1.2rem; }
  .clue-row.active { margin: 0 -.4rem; padding-right: .4rem; padding-left: .4rem; }
  .clue-label { font-size: 1rem; }
  .clue-value { font-size: 1.5rem; }
  .attempt-note { min-height: 0; gap: .2rem .4rem; padding: .65rem; font-size: 1rem; }
  .attempt-caption { flex-basis: 100%; font-size: .85rem; }
  .attempt-note .incorrect, .attempt-note .correct { padding-left: .4rem; }
  .guess-form > label { font-size: 1.05rem; }
  .input-wrap input { min-height: 54px; padding-left: .65rem; padding-right: 1.8rem; font-size: 1.1rem; }
  .input-wrap::after { top: 1.1rem; right: .75rem; width: .6rem; height: .6rem; }
  .actions { gap: .65rem; }
  .actions button { min-height: 52px; padding: .6rem .4rem; font-size: 1.1rem; }
  .next-clue { margin-top: 1.3rem; font-size: 1rem; }
  .welcome { padding-top: 1.5rem; padding-bottom: 1.5rem; }
  .welcome-copy { font-size: 1.1rem; }
  .instructions { font-size: 1rem; }
  .result-facts { grid-template-columns: 1fr; }
  .stats-chart-row { grid-template-columns: minmax(0, 1fr) 2rem; }
  .stats-chart-label { grid-column: 1 / -1; }
  .stats-chart-track { grid-column: 1; grid-row: 2; }
  .stats-chart-value { grid-column: 2; grid-row: 2; }
}
@media (prefers-reduced-motion: no-preference) {
  .clue-row.reveal { animation: reveal .25s ease-out both; }
  @keyframes reveal { from { opacity: .4; transform: translateY(4px); } to { opacity: 1; transform: none; } }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }
