/* PinDrop. Mobile-first, designed for 360px and up.
   System fonts only (no webfonts), so nothing extra to download. */

/* Light "block-print" look: warm cream paper, aubergine ink, and a colourway for each city (saffron, rani pink, peacock, jamun).
   The look follows the device's light/dark setting; data-theme="light" or "dark" on <html> forces one. */
:root {
  color-scheme: light;
  --head-ink: #2b1238;
  --k: 1; /* clue text scale: 1.5 on desktop */
  --clue-fs: 24px; /* one clue text size for every clue; see maxChars in clue-types.json */

  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --serif: ui-serif, Georgia, "Iowan Old Style", "Times New Roman", serif;
  --tap: 44px;
  --radius: 8px;
  --shadow: 0 1px 0 rgb(0 0 0 / .05), 0 10px 24px -14px rgb(43 18 56 / .35);

  --bg: #fbefd6;
  --paper: #fff7e6;
  --ink: #2b1238;
  --muted: #6a5570;
  --border: #ecd9b2;
  --hl: #ffe9c9;
  --land: #f3e0b8;
  --land-line: #9a7f55;
  --dot: #7a5f3c;
  --visited: #2b1238;
  --focus: #0b57d0;
  --halo: #fff7e6;
  --head-bg: #2b1238;
  --stage: #fff7e6;
  --panel: #fffaf0;
  --edge: #b9a07a;
  --pip: #e8d5ae;
  --chip-bg: rgb(43 18 56 / .84);
  --chip-ink: #fff2dc;
  --paisley: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg opacity='.055' fill='none' stroke='%232b1238' stroke-width='1.6' stroke-linecap='round'%3E%3Cg transform='translate(30 32) rotate(20)'%3E%3Cpath d='M0 -14C10 -14 15 -2 10 8C6 15 -6 15 -9 7C-12 -1 -9 -9 -3 -9C2 -9 4 -4 1 -1'/%3E%3Ccircle cy='4' r='2.2' fill='%232b1238'/%3E%3C/g%3E%3Cg transform='translate(90 92) rotate(200)'%3E%3Cpath d='M0 -14C10 -14 15 -2 10 8C6 15 -6 15 -9 7C-12 -1 -9 -9 -3 -9C2 -9 4 -4 1 -1'/%3E%3Ccircle cy='4' r='2.2' fill='%232b1238'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");

  /* one colourway per city of the trail: colour, text on it, readable text colour, light tint */
  --cw0: #ec6a00; --cw0-ink: #2b1238; --cw0-text: #b24d00; --cw0-tint: #ffe3c2;
  --cw1: #c2185b; --cw1-ink: #ffffff; --cw1-text: #c2185b; --cw1-tint: #fbd9e6;
  --cw2: #007a8a; --cw2-ink: #ffffff; --cw2-text: #00697a; --cw2-tint: #cdeef0;
  --cw3: #5a2a8c; --cw3-ink: #ffffff; --cw3-text: #5a2a8c; --cw3-tint: #e6d9f4;
  /* before a city is set (results, loading) */
  --c: var(--cw1); --c-ink: var(--cw1-ink); --c-text: var(--cw1-text); --c-tint: var(--cw1-tint);
}
/* the accent follows the current city, so it is set on body (where --c can change) */
body { --accent: var(--c); --accent-ink: var(--c-ink); --sel: var(--c); --accent-soft: color-mix(in srgb, var(--c) 24%, transparent); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --head-ink: #fff2dc;
    --shadow: 0 1px 0 rgb(0 0 0 / .05), 0 10px 24px -14px rgb(0 0 0 / .6);
    --bg: #1c0b26; --paper: #2a1238; --ink: #fff2dc; --muted: #cdb4d6; --border: #4a2a5e; --hl: #3d1f52;
    --land: #3d1f52; --land-line: #a98bc0; --dot: #cbb0dc; --visited: #fff2dc; --focus: #8ab4ff; --halo: #2a1238;
    --head-bg: #120619; --stage: #2a1238; --panel: #35184a; --edge: #8a6aa0; --pip: #4d2d62;
    --chip-bg: rgb(28 11 38 / .84); --chip-ink: #fff2dc;
    --paisley: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg opacity='.07' fill='none' stroke='%23fff2dc' stroke-width='1.6' stroke-linecap='round'%3E%3Cg transform='translate(30 32) rotate(20)'%3E%3Cpath d='M0 -14C10 -14 15 -2 10 8C6 15 -6 15 -9 7C-12 -1 -9 -9 -3 -9C2 -9 4 -4 1 -1'/%3E%3Ccircle cy='4' r='2.2' fill='%23fff2dc'/%3E%3C/g%3E%3Cg transform='translate(90 92) rotate(200)'%3E%3Cpath d='M0 -14C10 -14 15 -2 10 8C6 15 -6 15 -9 7C-12 -1 -9 -9 -3 -9C2 -9 4 -4 1 -1'/%3E%3Ccircle cy='4' r='2.2' fill='%23fff2dc'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    --cw0: #ff9a3c; --cw0-ink: #2b1238; --cw0-text: #ffab5e; --cw0-tint: #4a2a3a;
    --cw1: #ff5c9a; --cw1-ink: #2b0a1a; --cw1-text: #ff86b4; --cw1-tint: #4d1d4a;
    --cw2: #2ec4d6; --cw2-ink: #04252b; --cw2-text: #5fd8e6; --cw2-tint: #1d3a5c;
    --cw3: #b58cf0; --cw3-ink: #1c0b26; --cw3-text: #caa8f6; --cw3-tint: #3f2a70;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --head-ink: #fff2dc;
  --shadow: 0 1px 0 rgb(0 0 0 / .05), 0 10px 24px -14px rgb(0 0 0 / .6);
  --bg: #1c0b26; --paper: #2a1238; --ink: #fff2dc; --muted: #cdb4d6; --border: #4a2a5e; --hl: #3d1f52;
  --land: #3d1f52; --land-line: #a98bc0; --dot: #cbb0dc; --visited: #fff2dc; --focus: #8ab4ff; --halo: #2a1238;
  --head-bg: #120619; --stage: #2a1238; --panel: #35184a; --edge: #8a6aa0; --pip: #4d2d62;
  --chip-bg: rgb(28 11 38 / .84); --chip-ink: #fff2dc;
  --paisley: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg opacity='.07' fill='none' stroke='%23fff2dc' stroke-width='1.6' stroke-linecap='round'%3E%3Cg transform='translate(30 32) rotate(20)'%3E%3Cpath d='M0 -14C10 -14 15 -2 10 8C6 15 -6 15 -9 7C-12 -1 -9 -9 -3 -9C2 -9 4 -4 1 -1'/%3E%3Ccircle cy='4' r='2.2' fill='%23fff2dc'/%3E%3C/g%3E%3Cg transform='translate(90 92) rotate(200)'%3E%3Cpath d='M0 -14C10 -14 15 -2 10 8C6 15 -6 15 -9 7C-12 -1 -9 -9 -3 -9C2 -9 4 -4 1 -1'/%3E%3Ccircle cy='4' r='2.2' fill='%23fff2dc'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  --cw0: #ff9a3c; --cw0-ink: #2b1238; --cw0-text: #ffab5e; --cw0-tint: #4a2a3a;
  --cw1: #ff5c9a; --cw1-ink: #2b0a1a; --cw1-text: #ff86b4; --cw1-tint: #4d1d4a;
  --cw2: #2ec4d6; --cw2-ink: #04252b; --cw2-text: #5fd8e6; --cw2-tint: #1d3a5c;
  --cw3: #b58cf0; --cw3-ink: #1c0b26; --cw3-text: #caa8f6; --cw3-tint: #3f2a70;
}

/* the city you are on picks the colourway */
body[data-city="0"] { --c: var(--cw0); --c-ink: var(--cw0-ink); --c-text: var(--cw0-text); --c-tint: var(--cw0-tint); }
body[data-city="1"] { --c: var(--cw1); --c-ink: var(--cw1-ink); --c-text: var(--cw1-text); --c-tint: var(--cw1-tint); }
body[data-city="2"] { --c: var(--cw2); --c-ink: var(--cw2-ink); --c-text: var(--cw2-text); --c-tint: var(--cw2-tint); }
body[data-city="3"] { --c: var(--cw3); --c-ink: var(--cw3-ink); --c-text: var(--cw3-text); --c-tint: var(--cw3-tint); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  min-height: 100vh;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { line-height: 1.2; }
#app, .top-inner, .foot { max-width: 560px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
#app { padding-top: 14px; padding-bottom: 8px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 8px; top: -60px; z-index: 50; background: var(--paper); color: var(--ink);
  padding: 10px 14px; border-radius: 6px; border: 2px solid var(--focus); font-weight: 600;
}
.skip:focus { top: 8px; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }

/* ---- header ---- */
[hidden] { display: none !important; }
.top { background: var(--bg); color: var(--ink); }
.top-inner { display: flex; align-items: center; justify-content: space-between; min-height: 48px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { margin: 0; display: flex; align-items: center; gap: 10px; font: 800 .95rem/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; }
.logo-pin { color: var(--accent); flex: none; }
.stamp { font: 600 .75rem/1 var(--mono); color: var(--muted); }
.stamp:empty { display: none; }
.meta { display: flex; align-items: center; gap: 16px; }
/* the city counter: one coloured pill per city. Done = filled, current = filled with a ring, still to come = dashed outline */
.citybar-wrap { flex: none; padding: 4px 16px 12px; }
body:not(.is-playing) .citybar-wrap { padding: 4px 0 14px; } /* the results page already has its own side margins */
.citybar { list-style: none; display: flex; gap: 8px; margin: 0; padding: 0; }
.citybar li {
  --pc: var(--c); --pi: var(--c-ink); --pt: var(--c-text);
  flex: 1 1 0; min-width: 0; height: 44px; display: flex; align-items: center; justify-content: center; gap: 4px; box-sizing: border-box;
  border: 2px dashed var(--pc); border-radius: 12px; color: var(--pt); font: 700 .8125rem/1 var(--mono); letter-spacing: .01em; white-space: nowrap;
}
.citybar li.done, .citybar li.current { background: var(--pc); border-style: solid; color: var(--pi); }
.citybar li.current { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--pc); }
.citybar li.missed { opacity: .55; }
.citybar li.pop { animation: pip-pop .5s ease-out; }
.citybar.all-done li { font-size: .75rem; padding: 0 4px; gap: 3px; }
.citybar .tick { flex: none; font-size: .875rem; }
.citybar .pill-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.citybar li { padding: 0 6px; flex: .78 1 0; }
.citybar li.done { flex: 1.45 1 0; }
.citybar li.current { flex: 1.1 1 0; } /* names need more room than "City 3" */
@keyframes pip-pop { 0% { transform: scale(.85); } 60% { transform: scale(1.06); } 100% { transform: none; } }
.band { height: 6px; background: var(--c); transition: background-color .4s ease; }
.streak { display: flex; align-items: center; gap: 5px; font: 700 .8rem/1 var(--mono); }
.streak svg { color: var(--accent); }
/* the "?" that reopens "How to play": a small circle with a 44 px tap area */
.help { width: 44px; height: 44px; margin: 0 -8px 0 -6px; padding: 0; display: flex; align-items: center; justify-content: center; border: 0; background: transparent; color: var(--muted); cursor: pointer; touch-action: manipulation; }
.help span { width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; border: 1.5px solid var(--edge); border-radius: 50%; font: 700 .8125rem/1 var(--mono); }
.help:hover span { color: var(--ink); border-color: var(--ink); }

/* ---- notices ---- */
.notice { border-left: 4px solid var(--accent); background: var(--paper); border-radius: 0 6px 6px 0; padding: 10px 12px; margin: 0 0 12px; font-size: .9rem; box-shadow: var(--shadow); }
.notice p { margin: 0 0 8px; }
.notice-warn { border-left-color: #c77d0a; }
.notice-dev { border-left-color: #8a7a1a; background: #fff3c4; color: #4d3f00; }
:root[data-theme="dark"] .notice-dev { border-left-color: #c9b23a; background: #2e2a12; color: #f1e6a6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .notice-dev { border-left-color: #c9b23a; background: #2e2a12; color: #f1e6a6; } }
.notice-info .btn { width: 100%; }

/* ---- loading / error state ---- */
.status-box { text-align: center; padding: 28px 8px; }
.status-title { margin: 0 0 6px; font: 800 1.1rem/1.3 var(--mono); letter-spacing: .04em; text-transform: uppercase; }
.status { margin: 0 0 16px; color: var(--muted); }
.status:empty { display: none; }
.status-box .btn { min-width: 180px; }

/* ---- cards (results) ---- */
/* the results card has the same look as the clue slide: paisley paper and the thin frame with corner diamonds */
.card { position: relative; background: var(--stage) var(--paisley); border: 0; border-radius: 0; padding: 24px 22px 20px; }
.kicker { margin: 0 0 2px; font: 700 .7rem/1.3 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }
.placeholder {
  display: flex; align-items: center; justify-content: center; text-align: center; width: 100%; aspect-ratio: 4 / 3; padding: 16px;
  border-radius: 4px; background: var(--land); border: 1px solid var(--border); color: var(--muted); font: .85rem/1.4 var(--mono);
}
img.placeholder, .hero img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 4px; background: var(--land); border: 1px solid var(--border); }

/* ---- buttons ---- */
.btn {
  min-height: var(--tap); min-width: var(--tap); padding: 0 16px; border-radius: 6px;
  font: 700 .95rem/1 system-ui, sans-serif; cursor: pointer; border: 1.5px solid transparent; touch-action: manipulation;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:active { filter: brightness(.92); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-icon { background: var(--paper); color: var(--ink); border-color: var(--border); padding: 0; font-size: 1.3rem; box-shadow: var(--shadow); }
.btn:disabled { opacity: .5; cursor: default; }

/* ---- the play screen: one full-height slide between the clue tabs and the guess bar ---- */
body.is-playing { height: 100vh; height: 100dvh; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
body.is-playing #app { flex: 1; min-height: 0; width: 100%; max-width: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
body.is-playing .notice { margin: 0 16px 8px; }
body.is-playing .foot { display: none; }
#game:not([hidden]) { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.col { width: 100%; max-width: 780px; margin: 0 auto; box-sizing: border-box; }

/* clue tabs: 1 to 5, unlocked ones tappable, locked ones dashed */
.stage {
  position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden;
  background: var(--stage) var(--paisley); padding: 10px;
}
/* a quiet block-print frame: one thin, see-through line in the city's colour and a small diamond in each corner */
.frame { position: absolute; inset: 0; z-index: 8; pointer-events: none; border: 1.5px solid color-mix(in srgb, var(--c) 38%, transparent); transition: border-color .4s ease; }
.frame i { position: absolute; width: 7px; height: 7px; background: color-mix(in srgb, var(--c) 55%, transparent); transform: rotate(45deg); }
.frame i:nth-child(1) { left: -1px; top: -1px; } .frame i:nth-child(2) { right: -1px; top: -1px; }
.frame i:nth-child(3) { left: -1px; bottom: -1px; } .frame i:nth-child(4) { right: -1px; bottom: -1px; }
.stage[data-display="image"] { background-image: none; }
.stage-bg { position: absolute; left: -40px; top: -40px; width: calc(100% + 80px); height: calc(100% + 80px); max-width: none; object-fit: cover; filter: blur(34px) brightness(.5) saturate(1.2); opacity: 0; transition: opacity .25s ease; }
.stage[data-display="image"] .stage-bg { opacity: 1; }
.stage-col { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.meta-strip { flex: none; display: flex; align-items: center; justify-content: space-between; padding: 12px 24px 4px; font: 600 .75rem/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.stage[data-display="image"] .meta-strip { color: #fff2dc; }
.route { margin: 0; font: inherit; letter-spacing: inherit; text-transform: inherit; }
/* "Clue 2/5" with arrows to look back at earlier clues; a dot on the forward arrow says a newer clue is waiting */
.clue-nav { display: flex; align-items: center; gap: 10px; margin-left: -8px; }
.route { font-size: .875rem; letter-spacing: .08em; }
/* filled arrow buttons in the city's colour; the forward one has a dot while a newer clue is waiting */
.clue-step {
  position: relative; width: 44px; height: 44px; margin-block: -8px; padding: 0; display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--accent); border-radius: 12px; background: var(--accent); color: var(--accent-ink); cursor: pointer; touch-action: manipulation;
}
.clue-step svg { width: 20px; height: 20px; }
.clue-step:disabled { background: color-mix(in srgb, var(--accent) 14%, transparent); color: color-mix(in srgb, var(--accent) 55%, transparent); border-color: transparent; cursor: default; }
.clue-step.is-latest::after { content: ""; position: absolute; right: -3px; top: -3px; width: 12px; height: 12px; border-radius: 50%; background: var(--ink); border: 2px solid var(--bg); }
.route:focus { outline: none; }

/* The bottom strip is kept free for the map thumbnail, so it never sits on the clue. */
.clue-view { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0 24px 112px; overflow-y: auto; }
.clue-view > * { margin-block: auto; animation: clue-in .2s ease both; }
@keyframes clue-in { from { opacity: 0; } }
.stage[data-display="image"] .clue-view { padding: 0; overflow: hidden; } /* the picture uses the whole slide, so it does not shrink the frame */
.rule { width: 44px; height: 4px; border-radius: 2px; background: var(--accent); margin-bottom: 18px; }
.clue-text { margin: 0; font: var(--clue-fs)/1.38 var(--serif); text-wrap: pretty; }
.clue-ask { margin: 20px 0 0; font: 700 .8125rem/1.3 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--c-text, var(--accent)); }
.clue-state { margin: 0; font: calc(2.75rem * var(--k))/1.15 var(--serif); text-wrap: balance; }
.letters { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.letters-word { display: flex; gap: 8px; }
.letter {
  box-sizing: border-box; display: flex; align-items: center; justify-content: center;
  width: calc(40px * var(--k)); height: calc(52px * var(--k)); border: 2px solid var(--edge); border-radius: 10px;
  font: 700 calc(26px * var(--k))/1 var(--mono);
}
.letter.is-first { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.clue-fig { margin: 0; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.clue-fig img { display: block; flex: 1; min-height: 0; width: 100%; object-fit: contain; }
.clue-fig .placeholder { flex: 1; aspect-ratio: auto; }
.clue-fig figcaption { margin-top: 8px; font: italic 1rem/1.45 var(--serif); }
/* Text with a picture: the slide is split into two equal sections, one for the text and one for the picture.
   splitHorizontal: text above, picture below. splitVertical: text left, picture right (stacked on a narrow screen). */
.clue-view[data-display^="split"] { overflow: hidden; }
.clue-view[data-display^="split"] > .clue-block { flex: 1 1 0; min-height: 0; min-width: 0; margin-block: 0; overflow-y: auto; display: flex; flex-direction: column; }
.clue-view[data-display^="split"] > .clue-block > :first-child { margin-top: auto; }
.clue-view[data-display^="split"] > .clue-block > :last-child { margin-bottom: auto; }
.clue-view[data-display^="split"] .clue-fig { flex: 1 1 0; min-width: 0; margin-top: 16px; }
.clue-view[data-display^="split"] .clue-fig img { object-position: left center; }
@media (min-width: 600px) {
  .clue-view[data-display="splitVertical"] { flex-direction: row; gap: 28px; }
  .clue-view[data-display="splitVertical"] .clue-fig { margin-top: 0; align-self: center; flex: 0 1 46%; }
  .clue-view[data-display="splitVertical"] .clue-fig img { object-position: center; }
}

/* picture-in-picture map */
.pip {
  position: absolute; right: 22px; bottom: 22px; z-index: 3; width: 86px; height: 98px; padding: 0; overflow: hidden; cursor: pointer;
  color: var(--ink); background: var(--panel); border: 2px solid var(--accent); border-radius: 16px; box-shadow: 0 10px 28px rgb(43 18 56 / .28);
}
.pip-map { position: absolute; inset: 8px; display: flex; align-items: center; justify-content: center; }
.pip-frame { position: relative; display: block; width: 100%; max-height: 100%; aspect-ratio: 540 / 600; }
.pip-map svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.pip-expand { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: 7px; background: var(--bg); color: var(--ink); }
.pip-trail { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
.pip-trail.cw-0 { stroke: var(--cw0); } .pip-trail.cw-1 { stroke: var(--cw1); } .pip-trail.cw-2 { stroke: var(--cw2); } .pip-trail.cw-3 { stroke: var(--cw3); }
.pip-visited { fill: var(--ink); }
.pip-visited.cw-0 { fill: var(--cw0); } .pip-visited.cw-1 { fill: var(--cw1); } .pip-visited.cw-2 { fill: var(--cw2); }
.pip-ring { fill: var(--accent-soft); }
.pip-current { fill: var(--ink); }
.pip-current.cw-0 { fill: var(--cw0); } .pip-current.cw-1 { fill: var(--cw1); } .pip-current.cw-2 { fill: var(--cw2); }
.pip-dots { position: absolute; inset: 0; pointer-events: none; }
.pip-guess { position: absolute; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; border-radius: 50%; background: var(--b); border: 1.5px solid var(--ink); }

.map-panel { position: absolute; inset: 0; z-index: 6; display: flex; align-items: center; justify-content: center; overflow: hidden; background: var(--panel); }
.map-panel { container-type: size; }
.map-panel .map { width: 100%; background: transparent; border: 0; border-radius: 0; box-shadow: none; }
/* the whole of India always fits the panel, whatever its shape (wide and short, or tall and narrow) */
.map-panel .map svg { width: min(100cqw, 90cqh); margin: 0 auto; }
.map-panel .btn-icon { background: var(--bg); border-color: var(--edge); box-shadow: none; }
.map-close { position: absolute; right: 10px; top: 10px; border-radius: 50%; }
.zoom { position: absolute; left: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 6px; }

/* guess bar */
.guessbar { flex: none; background: var(--bg); padding: 12px 16px max(16px, env(safe-area-inset-bottom)); }
.guessbar .col { position: relative; }
.feedback { margin: 0 0 10px; display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: .875rem; line-height: 1.35; }
.swatch { flex: none; width: 14px; height: 14px; border-radius: 4px; background: var(--b); border: 1.5px solid var(--ink); }
.feedback:empty { display: none; }
.guess-log { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-wrap: nowrap; gap: 6px; overflow-x: auto; }
.guess-log:empty { display: none; }
/* A guess is a pill in its distance band's colour, with the city name as text. */
.band-veryclose { --b: #c8281e; --bf: #ffffff; }
.band-close { --b: #f08a24; --bf: #1a0a05; }
.band-far { --b: #f5c518; --bf: #1a1500; }
.band-veryfar { --b: #2b66c4; --bf: #ffffff; }
.band-farthest { --b: #dce6f2; --bf: #101826; }
.guess-log li.pill { flex: none; display: flex; align-items: center; min-height: 34px; padding: 0 14px; border-radius: 999px; background: var(--b); color: var(--bf); font-size: .9rem; font-weight: 700; white-space: nowrap; }
.guess { margin: 0; }
.guess-row { display: flex; gap: 8px; }
.combo { position: relative; flex: 1; min-width: 0; }
#city-input {
  width: 100%; height: 52px; padding: 0 14px; font: 500 16px/1.2 system-ui, sans-serif; /* 16px stops iOS zoom */
  color: var(--ink); background: var(--panel); border: 2px solid var(--accent); border-radius: 12px;
}
#city-input::placeholder { color: var(--muted); opacity: 1; }
#city-input:focus { border-color: var(--focus); outline: 2px solid var(--focus); outline-offset: 1px; }
.guess-row .btn { height: 52px; min-width: 92px; border-radius: 12px; font-size: 1rem; }
.list {
  position: absolute; left: 0; right: 0; bottom: 100%; margin: 0 0 8px; padding: 4px 0; list-style: none;
  background: var(--panel); border: 1.5px solid var(--ink); border-radius: 12px;
  max-height: min(40vh, 352px); overflow-y: auto; z-index: 20; box-shadow: 0 14px 32px rgb(0 0 0 / .45);
}
.list li { min-height: var(--tap); display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 14px; cursor: pointer; }
.list li[aria-selected="true"] { background: var(--hl); box-shadow: inset 3px 0 0 var(--accent); font-weight: 600; }
.list li .state { color: var(--muted); font-size: .8rem; }
.list li.empty { color: var(--muted); cursor: default; }

/* desktop: the same slide, bigger, in a centred column. The empty space either side is kept free on purpose (room for ads later). */
@media (min-width: 900px) {
  :root { --k: 1.5; --clue-fs: 28px; }
  /* about half the screen wide, with a quarter either side (room for ads later); never narrower than 720px */
  body.is-playing #app { width: clamp(720px, 50vw, 1000px); max-width: 100%; margin: 0 auto; }
  .col { margin-left: 0; } /* tabs, clue and guess box all share the left edge */
  .top-inner { max-width: none; padding: 0 32px; min-height: 64px; }
  .citybar-wrap { padding: 8px 32px 20px; }
  .citybar li { height: 56px; font-size: 1rem; }
  .meta-strip { padding: 18px 0 4px; font-size: .8125rem; }
  .clue-view, .stage[data-display="image"] .clue-view { padding: 0 0 8px; }
  .stage { padding: 14px 162px 14px 42px; } /* keep clear of the frame and the map thumbnail */
  .clue-view > * { margin-block: auto; }
  .rule { margin-bottom: 26px; }
  .clue-ask { margin-top: 28px; font-size: 1rem; }
  .letters { gap: 12px 30px; }
  .letters-word { gap: 12px; }
  .pip { right: 34px; bottom: 30px; width: 112px; height: 128px; }
  .guessbar { padding: 16px 32px 28px; }
  #city-input { height: 60px; font-size: 18px; }
  .guess-row .btn { height: 60px; min-width: 128px; font-size: 1.125rem; }
  .feedback { font-size: 1rem; }
  .guess-log li.pill { min-height: 40px; font-size: .95rem; }
}

/* an open map floats beside the clue only on very wide screens; otherwise it covers the slide, as on a phone */
@media (min-width: 1900px) {
  .map-panel { inset: auto 24px 20px auto; width: auto; max-width: 400px; height: calc(100% - 40px); aspect-ratio: 540 / 600; border: 1.5px solid var(--edge); border-radius: 20px; box-shadow: 0 18px 48px rgb(0 0 0 / .5); }
  .zoom { flex-direction: row; } /* a row, so the buttons do not cover much of a small map */
  #game.map-open .stage-col { max-width: 620px; } /* the clue narrows so the map never covers it */
}

/* ---- a city found (or missed): a full-slide moment before the trail moves on ---- */
.arrival {
  position: absolute; inset: 9px; z-index: 7; display: flex; flex-direction: column; overflow: hidden;
  background: var(--c-tint) var(--paisley); color: var(--ink);
}
.arrival-band {
  flex: none; display: flex; align-items: center; justify-content: space-between; height: 44px; padding: 0 20px;
  background: var(--c); color: var(--c-ink); font: 700 .75rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase;
}
.arrival-tag { display: flex; align-items: center; gap: 8px; }
.arrival.is-lost #arr-check { display: none; }
.arrival-body { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; padding: 0 24px; position: relative; z-index: 2; }
.seal { width: 76px; height: 76px; margin: 0 0 18px; display: block; animation: seal-in .7s ease-out both; }
.seal-petals { fill: var(--c); }
.seal-petals ellipse { rx: 9; ry: 14; }
.seal-core { fill: var(--c-tint); }
.seal-tick { fill: none; stroke: var(--c); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.arrival.is-lost .seal { display: none; }
.arrival-head { margin: 0 0 8px; font: 700 .8125rem/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--c-text); animation: rise .45s .1s ease-out both; }
.arrival-name { margin: 0; font: calc(2.5rem * var(--k))/1.05 var(--serif); color: var(--c-text); text-wrap: balance; animation: pop .6s .2s cubic-bezier(.2, .9, .3, 1.2) both; }
.arrival-state { margin: 10px 0 0; font: 600 1rem/1.3 system-ui, sans-serif; color: var(--muted); animation: rise .5s .45s ease-out both; }
.arrival-pts { margin: 18px 0 0; font: 800 1.4rem/1 var(--mono); animation: rise .5s .5s ease-out both; }
.arrival-pts:empty { display: none; }
.arrival-route { flex: none; list-style: none; margin: 0; padding: 8px 16px 26px; display: flex; align-items: flex-start; position: relative; z-index: 2; }
.arrival-route li { position: relative; flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.arrival-route .node {
  position: relative; z-index: 1; box-sizing: border-box; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font: 800 .9rem/1 var(--mono); background: var(--n); color: var(--ni); box-shadow: 0 0 0 3px var(--c-tint);
}
.arrival-route .link { position: absolute; top: 13px; right: 50%; width: 100%; height: 0; border-top: 3px solid var(--n); z-index: 0; }
.arrival-route li:first-child .link { display: none; }
.arrival-route .name { font: 700 .6875rem/1.2 system-ui, sans-serif; text-align: center; min-height: 1.2em; overflow-wrap: anywhere; }
.arrival-route li.now .node { width: 40px; height: 40px; margin-top: -6px; box-shadow: 0 0 0 4px var(--c-tint), 0 0 0 6px var(--n); animation: pop .6s .3s cubic-bezier(.2, .9, .3, 1.2) both; }
.arrival-route li.now .link { top: 13px; }
.arrival-route li.now.is-lost .node { background: var(--c-tint); border: 3px solid var(--n); color: transparent; }
.arrival-route li.future .node { background: var(--c-tint); border: 2px dashed var(--n); color: var(--n); }
.arrival-route li.future .link { border-top-style: dashed; opacity: .55; }
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }
.confetti span { position: absolute; top: 0; animation: confetti-fall var(--t, 3s) var(--d, 0s) cubic-bezier(.3, .6, .4, 1) both; }
@keyframes confetti-fall {
  0% { transform: translate3d(0, -30px, 0) rotate(0deg); opacity: 0; }
  12% { opacity: 1; }
  100% { transform: translate3d(var(--dx), 760px, 0) rotate(var(--rot)); opacity: 0; }
}
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
@keyframes rise { 0% { transform: translateY(14px); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes seal-in { 0% { transform: scale(.3) rotate(-90deg); opacity: 0; } 70% { transform: scale(1.1) rotate(8deg); opacity: 1; } 100% { transform: none; } }

/* while the moment shows: no guessing, no map, the button moves you on */
.next-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 52px; border-radius: 12px; font-size: 1rem; font-weight: 800; background: var(--n, var(--accent)); color: var(--ni, var(--accent-ink)); }
.next-btn[hidden] { display: none; }
.next-btn svg { flex: none; }
#game.is-arrival .guess, #game.is-arrival .feedback, #game.is-arrival .guess-log, #game.is-arrival .pip { display: none; }
@media (min-width: 900px) {
  .arrival { inset: 12px; }
  .arrival-band { height: 56px; padding: 0 28px; font-size: .875rem; }
  .arrival-body { padding: 0 40px; }
  .seal { width: 114px; height: 114px; margin-bottom: 26px; }
  .arrival-head { font-size: 1rem; }
  .arrival-state { font-size: 1.5rem; }
  .arrival-pts { font-size: 2rem; }
  .arrival-route { padding: 8px 40px 36px; }
  .arrival-route .node { width: 42px; height: 42px; font-size: 1.2rem; }
  .arrival-route li.now .node { width: 60px; height: 60px; margin-top: -9px; }
  .arrival-route .link { top: 20px; }
  .arrival-route .name { font-size: .8125rem; }
  .next-btn { height: 60px; font-size: 1.125rem; }
}

/* ---- map (svg) ---- */
.map { background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.map svg { display: block; width: 100%; height: auto; aspect-ratio: 540 / 600; user-select: none; -webkit-user-select: none; cursor: crosshair; }
.land { fill: var(--land); stroke: var(--land-line); stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.trail-line { fill: none; stroke: var(--visited); stroke-width: 2.2; stroke-dasharray: 7 5; vector-effect: non-scaling-stroke; }
.trail-line.cw-0 { stroke: var(--cw0); } .trail-line.cw-1 { stroke: var(--cw1); } .trail-line.cw-2 { stroke: var(--cw2); } .trail-line.cw-3 { stroke: var(--cw3); }
.dot { fill: var(--dot); stroke: var(--paper); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.dot.is-visited { fill: var(--visited); }
.dot.cw-0 { fill: var(--cw0); } .dot.cw-1 { fill: var(--cw1); } .dot.cw-2 { fill: var(--cw2); } .dot.cw-3 { fill: var(--cw3); }
.dot[class*="band-"] { fill: var(--b); stroke: var(--ink); stroke-width: 2; }
.dot.is-current { stroke: var(--paper); stroke-width: 3; }
.dot.is-selected { fill: var(--sel); stroke: var(--ink); stroke-width: 2.5; }
.mark { text-anchor: middle; pointer-events: none; }
.label {
  text-anchor: middle; pointer-events: none; fill: var(--ink); font-weight: 600;
  paint-order: stroke; stroke: var(--halo); stroke-width: 3px; stroke-linejoin: round;
}

/* ---- admire the puzzle: every clue of the finished puzzle ---- */
.admire-title { margin: 4px 0 12px; font: 800 1.15rem/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.admire-city { margin-top: 24px; padding-top: 16px; border-top: 3px solid var(--n, var(--border)); }
.admire-city h3 { margin: 0; font: 800 1rem/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--nt, var(--ink)); }
.admire-state { margin: 2px 0 12px; color: var(--muted); }
.admire-clues { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.admire-clue { padding-left: 12px; border-left: 3px solid var(--n, var(--border)); }
.admire-clue-no { display: block; margin-bottom: 4px; font: 700 .7rem/1.3 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.admire-text { margin: 0; font: 1.15rem/1.4 var(--serif); text-wrap: pretty; }
.admire-ask { margin: 6px 0 0; font: 700 .75rem/1.3 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--nt, var(--accent)); }
.admire-fig { margin: 10px 0 0; }
.admire-fig img { display: block; width: 100%; max-height: 320px; object-fit: contain; object-position: left center; border-radius: 6px; }
.admire-how { margin: 12px 0 6px; font-size: .9rem; color: var(--muted); }
.admire .letter { width: 30px; height: 40px; font-size: 20px; border-radius: 8px; }
.admire .letter.is-first { background: var(--n); border-color: var(--n); color: var(--ni); }
.admire .guess-log { flex-wrap: wrap; }
.admire .btn-row { margin: 8px 0; }
.admire .credit { margin: 6px 0 0; color: var(--muted); font-size: .8rem; }

/* ---- the "How to play" popup ---- */
.howto { width: min(420px, calc(100vw - 32px)); padding: 24px 22px 20px; border: 2px solid var(--c); border-radius: 18px; background: var(--paper); color: var(--ink); box-shadow: 0 24px 60px rgb(0 0 0 / .45); }
.howto::backdrop { background: rgb(28 11 38 / .6); }
.howto-title { margin: 0 0 16px; font: 800 1.15rem/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.howto-list { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.howto-list li { display: flex; align-items: center; gap: 14px; font-size: 1.125rem; line-height: 1.3; }
.howto-n { flex: none; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--n); color: var(--ni); font: 800 1rem/1 var(--mono); }
.howto-bye { margin: 0 0 18px; font: italic 600 1.25rem/1.3 var(--serif); }
.howto-btn { width: 100%; min-height: 52px; font-size: 1.05rem; }

/* ---- results ---- */
#result .card { margin-top: 4px; }
/* the results phrase, then a small line with the score and streak, then the percentile */
.phrase { margin: 4px 0 8px; font: 700 2rem/1.15 var(--serif); text-wrap: balance; color: var(--c-text); }
.score-line { margin: 0 0 6px; font: 700 1rem/1.3 var(--mono); letter-spacing: .02em; }
.percentile { margin: 0 0 16px; font-size: .9rem; font-weight: 600; color: var(--muted); min-height: 1.4em; }
/* the marks (per-city points and the scoring rules) are folded away */
.score-details { margin-top: 20px; border-top: 1px solid var(--border); }
.score-details > summary { font: 700 .72rem/1.3 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.score-details[open] > summary { margin-bottom: 4px; }
.rules-heading { margin: 16px 0 4px; font: 700 .72rem/1.3 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.breakdown { padding-left: 0; margin: 8px 0; list-style: none; }
.breakdown li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.breakdown li:first-child { border-top: 0; }
.breakdown .what { min-width: 0; }
.breakdown .route { display: block; font-weight: 700; }
.breakdown .calc { display: block; color: var(--muted); font-size: .875rem; }
.breakdown .pts { font: 800 1.2rem/1 var(--mono); white-space: nowrap; font-variant-numeric: tabular-nums; }
.formula-box { background: var(--hl); border-left: 3px solid var(--accent); border-radius: 0 6px 6px 0; padding: 10px 12px; margin: 8px 0; }
.formula-box .rules { margin: 0 0 8px; padding-left: 20px; }
.formula-box .rules li { padding: 2px 0; }
.share-pre { background: var(--bg); border: 1px dashed var(--muted); border-radius: 6px; padding: 12px; margin: 8px 0; font: 1rem/1.5 system-ui, "Apple Color Emoji", "Noto Color Emoji", sans-serif; white-space: pre-wrap; user-select: all; }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; min-height: 50px; }
.countdown { margin: 0; text-align: center; font: 700 1rem/1.3 var(--mono); letter-spacing: .04em; font-variant-numeric: tabular-nums; color: var(--muted); }
.share-status { min-height: 1.4em; margin: 6px 0 0; font-size: .9rem; color: var(--muted); }
.result-section { margin-top: 20px; }
.result-section h3 { margin: 0 0 4px; font: 700 .72rem/1.3 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.small { color: var(--muted); font-size: .85rem; }
details { margin-top: 12px; }
summary { min-height: var(--tap); display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; font-weight: 700; list-style: none; }
summary::-webkit-details-marker { display: none; }
/* a chevron on every folded section, so it is clear it can be opened; it turns over when open */
summary::after { content: ""; flex: none; width: 9px; height: 9px; margin: -4px 6px 0 0; border-right: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor; transform: rotate(45deg); transition: transform .2s ease; }
details[open] > summary::after { margin-top: 4px; transform: rotate(-135deg); }
summary:hover { color: var(--ink); }

.foot { padding-top: 20px; padding-bottom: 32px; color: var(--muted); font: .75rem/1.5 var(--mono); text-align: center; }
.foot p { margin: 0; }

@media (prefers-reduced-motion: reduce) { .confetti { display: none; } * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
@media (forced-colors: active) {
  .btn, #city-input, .card, .map, .clue-step, .pip, .guess-log li { border: 1px solid CanvasText; }
  .dot.is-selected { stroke: Highlight; }
}
