/* GeoBlitz menu v2: styles for the topic → way → region → difficulty menu,
   the in-game countdown bar and the end-screen learning actions.
   Built on the variables game.html already defines (--surface, --border, --accent…). */
:root {
  --gbm-easy: #2f9e62; --gbm-normal: #d9a514; --gbm-hard: #d9534f; --gbm-blitz: #7c5cd6;
  --gbm-on-normal: #2b2100; --gbm-discord: #5865f2;
}
@media (prefers-color-scheme: dark) {
  :root { --gbm-easy: #3ecf7c; --gbm-normal: #f2c230; --gbm-hard: #f2706b; --gbm-blitz: #a58bff; --gbm-discord: #97a3ff; }
}

body.gbm #menu-screen [hidden], #gbm-end-extra [hidden], .gbm-timebar[hidden] { display: none !important; }

/* ---------- Daily / Unlimited / Discord cards ---------- */
.gbm-feature { width: 100%; max-width: 860px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.gbm-fcard { display: flex; align-items: center; gap: 14px; min-width: 0; padding: 14px 16px; border-radius: var(--r); border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text); text-decoration: none; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.gbm-fcard:hover { transform: translateY(-2px); }
.gbm-fico { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 1.3rem; }
.gbm-fico svg { width: 24px; height: 24px; }
.gbm-ftext { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.gbm-fname { font-weight: 700; font-size: .98rem; }
.gbm-fdesc { font-size: .8rem; color: var(--text-muted); line-height: 1.35; }
.gbm-fcard.daily { border-color: var(--green); background: color-mix(in srgb, var(--green) 9%, var(--surface)); }
.gbm-fcard.daily .gbm-fname { color: var(--green); }
.gbm-fcard.daily .gbm-fico { background: color-mix(in srgb, var(--green) 22%, var(--surface)); }
.gbm-fcard.unlimited { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--surface)); }
.gbm-fcard.unlimited .gbm-fname { color: var(--accent); }
.gbm-fcard.unlimited .gbm-fico { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); }
.gbm-fcard.discord { border-color: var(--gbm-discord); background: color-mix(in srgb, var(--gbm-discord) 10%, var(--surface)); }
.gbm-fcard.discord .gbm-fname, .gbm-fcard.discord .gbm-fico { color: var(--gbm-discord); }
.gbm-fcard.discord .gbm-fico { background: color-mix(in srgb, var(--gbm-discord) 22%, var(--surface)); }

/* ---------- Start card ---------- */
.gbm-hero { width: 100%; max-width: 860px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px;
  padding: 18px 20px; border-radius: var(--r); border: 1.5px solid var(--accent); background: var(--surface); box-shadow: var(--shadow); margin-bottom: 22px; }
.gbm-hero-text { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.gbm-eyebrow { font-size: .68rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted); }
.gbm-eyebrow:empty { display: none; }
.gbm-pick { font-size: 1.25rem; font-weight: 700; color: var(--text); }
.gbm-explain { font-size: .92rem; color: var(--text); line-height: 1.45; max-width: 60ch; }
.gbm-meta { font-size: .82rem; color: var(--text-muted); }
.gbm-hero-actions { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.gbm-hero-actions .start-btn { margin-top: 0; }
.gbm-link { background: none; border: 0; padding: 2px 0; font: inherit; font-size: .84rem; color: var(--accent); text-decoration: underline; cursor: pointer; align-self: flex-start; }
.gbm-hero-actions .gbm-link { align-self: center; }
.gbm-link:empty { display: none; }
.start-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------- Steps ---------- */
.gbm-change { width: 100%; max-width: 860px; font-size: .68rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted);
  border-top: 1px solid var(--border); padding-top: 16px; margin-bottom: 14px; }
.gbm-change:empty { padding-top: 0; }
.gbm-steps { width: 100%; max-width: 860px; display: flex; flex-direction: column; gap: 20px; margin-bottom: 20px; counter-reset: gbm-step; }
.gbm-step { display: flex; flex-direction: column; gap: 10px; counter-increment: gbm-step; }
.gbm-step-title { display: flex; align-items: center; gap: 10px; font-size: 1rem; font-weight: 600; color: var(--text); }
.gbm-num { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-light); color: var(--accent); font-size: .82rem; font-weight: 700; }
.gbm-num::before { content: counter(gbm-step); }
.gbm-step-title .menu-section-label { font-size: 1rem; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--text); margin: 0; }

.gbm-subjects { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.gbm-subject { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; padding: 14px 10px 12px; text-align: center; border-radius: var(--r);
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; box-shadow: var(--shadow); transition: border-color .15s; }
.gbm-subject:hover { border-color: var(--accent); }
.gbm-subject { text-decoration: none; }
.gbm-subject[aria-current="page"] { border-color: var(--accent); background: var(--accent-light); }
/* The maps or lists inside the chosen subject: a panel hanging off that subject's tile, with a pointer up to it */
.gbm-subjects { grid-auto-flow: row dense; }
.gbm-packs { position: relative; grid-column: 1 / -1; display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; margin-top: 2px;
  border: 1.5px solid var(--accent); border-radius: var(--r); background: var(--accent-light); }
.gbm-packs::before { content: ''; position: absolute; top: -7.5px; left: var(--gbm-caret, 50%); width: 12px; height: 12px; margin-left: -6px; transform: rotate(45deg);
  background: var(--accent-light); border: solid var(--accent); border-width: 1.5px 0 0 1.5px; }
.gbm-pack-row { display: grid; grid-template-columns: 8.5em minmax(0, 1fr); align-items: start; gap: 6px; }
.gbm-pack-row .gbm-optlabel { margin: 0; padding-top: .62em; }
.gbm-pack-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.gbm-packs .pill { text-decoration: none; }
/* One short list (Mountains: all / best known): no label, a compact panel centred under that subject's own tile */
.gbm-packs.single { grid-column: var(--gbm-from, 1) / var(--gbm-to, -1); justify-self: center; max-width: 100%; padding: 8px; }
.gbm-packs.single .gbm-pack-row { display: block; }
.gbm-packs.single .gbm-optlabel { display: none; }
.gbm-packs.single .gbm-pack-pills { gap: 8px; justify-content: center; }
.gbm-packs.single .pill { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 18px; font-size: .88rem; white-space: nowrap; }
.gbm-count { font-size: .78em; font-weight: 600; padding: 1px 7px; border-radius: 100px; background: rgba(127, 150, 180, .22); }
.pill.selected .gbm-count { background: rgba(255, 255, 255, .24); }
@media (max-width: 760px) {
  .gbm-packs { padding: 12px; }
  .gbm-packs.single { grid-column: 1 / -1; justify-self: stretch; }
  .gbm-packs.single .pill { flex: 1 1 0; white-space: normal; text-align: center; }
  .gbm-pack-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .gbm-pack-row .gbm-optlabel { padding-top: 0; }
}
.gbm-sico { font-size: 1.6rem; line-height: 1.1; }
.gbm-sname { font-weight: 600; font-size: .92rem; }
.gbm-sdesc { font-size: .76rem; color: var(--text-muted); line-height: 1.3; }
.gbm-topics { display: flex; flex-wrap: wrap; gap: 10px; }
.gbm-topic { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: var(--r); border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer; box-shadow: var(--shadow); transition: border-color .15s; }
.gbm-topic:hover, .gbm-way:hover { border-color: var(--accent); }
.gbm-topic[aria-pressed="true"], .gbm-way[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-light); }
.gbm-badge { position: absolute; top: -8px; right: 8px; background: var(--accent); color: #fff; font-size: .58rem; font-weight: 700; letter-spacing: .08em; padding: 2px 7px; border-radius: 100px; }

.gbm-ways { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.gbm-way { display: flex; align-items: flex-start; gap: 12px; min-width: 0; padding: 12px 14px; text-align: left; border-radius: var(--r); border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; cursor: pointer; box-shadow: var(--shadow); transition: border-color .15s; }
.gbm-wico { flex: none; font-size: 1.35rem; line-height: 1.2; }
.gbm-wtext { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.gbm-wname { font-weight: 600; font-size: .92rem; }
.gbm-wdesc { font-size: .8rem; color: var(--text-muted); line-height: 1.4; }
.gbm-both { display: inline-flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--text); cursor: pointer; }
.gbm-both input { width: 18px; height: 18px; accent-color: var(--accent); }
.gbm-hint { font-size: .82rem; color: var(--text-muted); max-width: 66ch; line-height: 1.45; }
.pill[aria-disabled="true"] { opacity: .4; cursor: not-allowed; }
.gbm-step #region-warning { text-align: left !important; max-width: none !important; font-size: .84rem; }
.gbm-step #region-warning:empty { display: none; }

/* Difficulty: one colour per level, filled when chosen */
#gbm-step-difficulty .toggle-group { align-self: flex-start; }
#gbm-step-difficulty .toggle-btn { padding: 9px 20px; font-size: .88rem; font-weight: 600; }
#diff-toggle .toggle-btn[data-val="easy"] { color: var(--gbm-easy); }
#diff-toggle .toggle-btn[data-val="normal"] { color: var(--gbm-normal); }
#diff-toggle .toggle-btn[data-val="hard"] { color: var(--gbm-hard); }
#diff-toggle .toggle-btn[data-val="blitz"] { color: var(--gbm-blitz); }
#diff-toggle .toggle-btn[data-val="easy"].active { background: var(--gbm-easy); color: #fff; }
#diff-toggle .toggle-btn[data-val="normal"].active { background: var(--gbm-normal); color: var(--gbm-on-normal); }
#diff-toggle .toggle-btn[data-val="hard"].active { background: var(--gbm-hard); color: #fff; }
#diff-toggle .toggle-btn[data-val="blitz"].active { background: var(--gbm-blitz); color: #fff; }

/* ---------- Options ---------- */
.gbm-options { width: 100%; max-width: 860px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); padding: 0 16px; margin-bottom: 14px; }
.gbm-options > summary { cursor: pointer; padding: 12px 0; display: flex; align-items: baseline; gap: 10px; list-style-position: inside; }
.gbm-options > summary .menu-section-label { display: inline; margin: 0; }
.gbm-opt-summary { font-size: .82rem; color: var(--text-muted); }
.gbm-options > .options-row { padding-bottom: 14px; gap: 12px 18px; }
.gbm-options > .menu-section { margin: 0; padding: 12px 0 14px; border-top: 1px solid var(--border); max-width: none; }
.gbm-optlabel { font-size: .76rem; color: var(--text-muted); margin-bottom: 5px; }

/* ---------- In-game countdown bar ---------- */
.gbm-timebar { position: absolute; top: 0; left: 0; right: 0; height: 4px; z-index: 5; background: color-mix(in srgb, var(--border) 60%, transparent); pointer-events: none; }
.gbm-timebar i { display: block; height: 100%; width: 100%; background: var(--accent); transition: width 1s linear, background-color .3s; }
.gbm-timebar.inline { position: relative; flex: none; width: 100%; }
.gbm-timebar.warn i { background: var(--orange); }
.gbm-timebar.danger i { background: var(--red); }

/* Rounded joins soften the corners where border segments meet when zoomed in. */
.country-path { stroke-linejoin: round; stroke-linecap: round; }

/* ---------- End screen ---------- */
.gbm-end-extra { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 14px 0 6px; }
.gbm-end-extra:empty { display: none; }
.gbm-end-note { font-size: .82rem; color: var(--text-muted); max-width: 44ch; text-align: center; line-height: 1.45; }
.gbm-end-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.gbm-practise { padding: 11px 22px; border-radius: 100px; border: 1.5px solid var(--green); background: color-mix(in srgb, var(--green) 14%, var(--surface)); color: var(--green);
  font: inherit; font-weight: 700; font-size: .92rem; cursor: pointer; }
.gbm-practise:hover { background: var(--green); color: #fff; }
.gbm-missed { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.gbm-missed-title { font-size: .68rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted); }
.gbm-missed-title:empty { display: none; }
.gbm-missed-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; }
.gbm-missed-chip { font-size: .78rem; padding: 3px 10px; border-radius: 100px; border: 1px solid color-mix(in srgb, var(--red) 55%, var(--border)); color: var(--text); }
.gbm-missed-more { font-size: .78rem; padding: 3px 4px; color: var(--text-muted); }
.gbm-end-extra .gbm-link { align-self: center; }

/* ---------- Phones ---------- */
@media (max-width: 760px) {
  .gbm-subjects { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gbm-subject:first-child { grid-column: 1 / -1; }
  .gbm-subject { padding: 10px 8px; }
  .gbm-sdesc { display: none; }
  .gbm-feature { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .gbm-fcard { padding: 9px 14px; }
  .gbm-fdesc { display: none; }
  .gbm-fico { width: 34px; height: 34px; font-size: 1.05rem; }
  .gbm-fico svg { width: 19px; height: 19px; }
  .gbm-hero { padding: 14px 16px; }
  .gbm-hero-actions { align-items: flex-start; width: 100%; }
  .gbm-hero-actions .start-btn { width: 100%; }
  .gbm-hero-actions .gbm-link { align-self: flex-start; }
  #gbm-step-difficulty .toggle-group { align-self: stretch; }
  #gbm-step-difficulty .toggle-btn { flex: 1; padding: 10px 6px; }
}

/* ---------- Subject packs on the main map ---------- */
:root { --gbm-water: #a9cfee; --gbm-river: #2f7fc4; }
@media (prefers-color-scheme: dark) { :root { --gbm-water: #17456e; --gbm-river: #58a6e8; } }
/* Seas and oceans are water-coloured until answered. */
#world-map .country-path[data-kind="water"] { fill: var(--gbm-water); }
#world-map .country-path[data-kind="water"].hovered { fill: var(--c-hover); }
#world-map .country-path[data-kind="water"].highlighted { fill: var(--c-highlight); }
#world-map .country-path[data-kind="water"].wrong { fill: var(--c-wrong); }
#world-map .country-path[data-kind="water"].dimmed { fill: var(--c-dimmed); }
#world-map .country-path[data-kind="land"] { pointer-events: none; }
/* Short seas map: waters that are not part of the quiz look like water and do nothing. */
#world-map .country-path[data-kind="still"] { fill: var(--gbm-water) !important; stroke: none !important; pointer-events: none; }
/* Rivers are lines: colour the stroke, never the fill. */
#world-map .country-path[data-kind="line"] { fill: none !important; stroke: var(--gbm-river); stroke-width: var(--gbm-line, 2.6px) !important; stroke-linecap: round; stroke-linejoin: round; }
/* Which country: the river itself stays off the map until its countries are found (the shared rule only clears the fill). */
#world-map .country-path[data-kind="line"].chain-hidden { display: none; }
#world-map .country-path[data-kind="line"].clickable { stroke-width: calc(var(--gbm-line, 2.6px) * 1.55) !important; }
#world-map .country-path[data-kind="line"].hovered { stroke: var(--c-hover); }
#world-map .country-path[data-kind="line"].highlighted { stroke: var(--c-highlight); stroke-width: calc(var(--gbm-line, 2.6px) * 1.55) !important; }
#world-map .country-path[data-kind="line"].correct { stroke: var(--c-correct); }
#world-map .country-path[data-kind="line"].wrong { stroke: var(--c-wrong); }
#world-map .country-path[data-kind="line"].dimmed { stroke: var(--c-dimmed); }
/* Backdrop countries react when they are the click targets (Which country). */
#world-map .country-path.nonplayable-world.clickable { cursor: pointer; }
#world-map .country-path.nonplayable-world.clickable.hovered { fill: var(--c-hover); }
#world-map .country-path.nonplayable-world.wrong { fill: var(--c-wrong); }
#world-map .country-path.nonplayable-world.highlighted { fill: var(--c-highlight); }
/* Waters the map file leaves unnamed read as open sea, not as holes. */
#world-map[data-pack-kind="water"] > rect { fill: color-mix(in srgb, var(--gbm-water) 60%, var(--ocean)); }

/* Until menu-v2.js has rebuilt the menu, hide it: otherwise the old card grid shows for a moment on slow loads. */
.gbm-pending #menu-screen > * { visibility: hidden; }

/* One-time welcome-back message for returning players: covers the page until its button is pressed */
.gbm-welcome { position: fixed; inset: 0; z-index: 9000; display: grid; place-items: center; padding: 16px; background: rgba(6, 10, 16, .82); overflow: auto; }
.gbm-welcome-box { width: min(480px, 100%); padding: 26px 26px 22px; border-radius: 16px; border: 1.5px solid var(--accent); background: var(--surface); color: var(--text); box-shadow: 0 18px 60px rgba(0, 0, 0, .5); text-align: start; }
.gbm-welcome-box h2 { margin: 0 0 8px; font-size: 1.45rem; line-height: 1.2; }
.gbm-welcome-lead { margin: 0 0 16px; font-size: 1rem; line-height: 1.5; }
.gbm-welcome-label { margin: 0 0 6px; font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.gbm-welcome-box ul { margin: 0 0 14px; padding-inline-start: 1.2em; display: grid; gap: 6px; font-size: .93rem; line-height: 1.45; }
.gbm-welcome-bye { margin: 0 0 16px; font-size: .95rem; }
.gbm-welcome-ok { width: 100%; }
html.gbm-welcome-open, html.gbm-welcome-open body { overflow: hidden; }

/* Start-of-game cue for typing modes: a line on the map and a pulsing answer box, both gone at the first keystroke */
#map-area { position: relative; }
.gbm-starthint { position: absolute; top: 16px; left: 0; right: 0; margin: 0 auto; width: fit-content; z-index: 6; max-width: min(calc(100% - 136px), 560px); padding: 10px 20px; border-radius: 22px;
  background: var(--accent); color: #fff; font-weight: 600; font-size: .98rem; line-height: 1.35; text-align: center; box-shadow: 0 8px 28px rgba(0, 0, 0, .35); pointer-events: none;
  animation: gbm-hint-in .35s ease-out; }
@keyframes gbm-hint-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@media (max-width: 760px) { .gbm-starthint { top: 12px; padding: 8px 14px; font-size: .88rem; border-radius: 16px; } }
.hud-input.gbm-nudge { animation: gbm-nudge 1.3s ease-in-out infinite; }
@keyframes gbm-nudge { 0%, 100% { box-shadow: 0 0 0 0 rgba(77, 148, 221, .0); } 50% { box-shadow: 0 0 0 5px rgba(77, 148, 221, .55); } }
@media (prefers-reduced-motion: reduce) { .gbm-starthint, .hud-input.gbm-nudge { animation: none; } .hud-input.gbm-nudge { box-shadow: 0 0 0 3px rgba(77, 148, 221, .6); } }
/* A wider answer box where there is room, so the placeholder is not cut off */
@media (min-width: 900px) { body.gbm #answer-input { width: 320px; max-width: 34vw; } }

/* What an option does: a bubble over the button it belongs to */
.gbm-tip { position: fixed; z-index: 9500; max-width: min(270px, calc(100vw - 16px)); padding: 8px 12px; border-radius: 10px; background: var(--text); color: var(--surface);
  font-size: .82rem; font-weight: 500; line-height: 1.4; text-align: start; box-shadow: 0 8px 24px rgba(0, 0, 0, .35); pointer-events: none; animation: gbm-tip-in .12s ease-out; }
.gbm-tip[hidden] { display: none; }
.gbm-tip::after { content: ''; position: absolute; left: var(--gbm-tip-x, 50%); bottom: -5px; width: 10px; height: 10px; margin-left: -5px; background: inherit; transform: rotate(45deg); }
.gbm-tip.below::after { bottom: auto; top: -5px; }
@keyframes gbm-tip-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .gbm-tip { animation: none; } }

/* End screen: "See the ones I missed on the map" is a real button, not a small underlined link */
body.gbm .see-missed-btn { margin: 14px auto 0; padding: 12px 24px; border-radius: 100px; border: 1.5px solid var(--accent); background: var(--accent-light); color: var(--accent);
  font: inherit; font-weight: 700; font-size: .95rem; line-height: 1.3; text-decoration: none; opacity: 1; cursor: pointer; max-width: 100%;
  box-shadow: var(--shadow); transition: background .15s, color .15s; }
body.gbm .see-missed-btn:hover, body.gbm .see-missed-btn:focus-visible { background: var(--accent); color: #fff; }
