/* Charlie's Geography: styles that are new here (app.css is forked from Charlie's History). */

@font-face { font-family: "Chakra Petch"; font-weight: 500; font-display: swap; src: url(chakra-petch-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Chakra Petch"; font-weight: 600; font-display: swap; src: url(chakra-petch-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Chakra Petch"; font-weight: 700; font-display: swap; src: url(chakra-petch-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Lexend"; font-weight: 100 900; font-display: swap; src: url(lexend-latin-wght-normal.woff2) format("woff2"); }
@font-face { font-family: "Noto Sans SC"; font-weight: 400 900; font-display: swap; src: local("Noto Sans SC"), local("PingFang SC"), local("Microsoft YaHei"), url(noto-sc-sub.woff2) format("woff2"); }

html { -webkit-text-size-adjust: 100%; }
body { overscroll-behavior: none; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
input { -webkit-user-select: text; user-select: text; }
.badge-n { position: absolute; right: -4px; bottom: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 99px; background: var(--pink); color: #fff; font: 700 11px/18px var(--hud); text-align: center; }
.iconbtn { position: relative; }
.iconbtn.modal-x { position: absolute; }
.iconbtn.hot { background: rgba(255, 140, 60, .25); border-color: #ff8c3c; }

/* ---------- map pins for places ---------- */
.kind-peak .gm-dot { --c: #ffd2a0; border-radius: 3px; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.kind-water .gm-dot { --c: #7fd8ff; }
.kind-star .gm-dot { --c: var(--good); }

/* ---------- home hub: reuse the History tile grid; emoji icons ---------- */
.era-icon.emoji { font-size: clamp(30px, 5.4vh, 52px); line-height: 1; }
.era .era-meta { margin-top: 3px; font: 600 12.5px var(--hud); color: var(--era); letter-spacing: .5px; }
.era .soon { position: absolute; top: 10px; right: 10px; font: 700 10px var(--hud); letter-spacing: 1px; text-transform: uppercase; padding: 3px 7px; border-radius: 6px; background: rgba(255,255,255,.1); color: var(--muted); }
.hub-sub { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

/* ---------- explorer bar ---------- */
#explore-bar { position: absolute; top: 64px; left: 16px; right: 16px; display: flex; gap: 8px; align-items: center; z-index: 12; }
#explore-bar .tool { flex: none; }
.searchbox { position: relative; flex: 1; min-width: 0; max-width: 420px; }
.searchbox input { width: 100%; height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(10,22,46,.82); backdrop-filter: blur(8px);
  color: #fff; font: 500 16px var(--body); outline: none; -webkit-appearance: none; }
.searchbox input:focus { border-color: var(--cyan); }
.results { position: absolute; top: 48px; left: 0; right: 0; background: rgba(8,18,40,.97); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: none; box-shadow: 0 16px 40px rgba(0,0,0,.5); }
.results.on { display: block; }
.results button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 11px 14px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; font: 500 15.5px var(--body); min-height: 46px; }
.results button:hover, .results button:focus { background: rgba(110,231,255,.14); outline: none; }
.results button:last-child { border-bottom: 0; }
.results .rflag { width: 28px; height: 21px; flex: none; border-radius: 3px; overflow: hidden; background: rgba(255,255,255,.08); }
.results .rflag svg { width: 100%; height: 100%; display: block; }
#ex-view button { white-space: nowrap; }
#ex-chips { position: absolute; top: 116px; left: 16px; right: calc(min(430px, 40vw) + 32px); z-index: 11; }
#ex-chips .gtab { min-height: 36px; padding: 6px 12px; font-size: 13.5px; }

/* ---------- info card (right panel / bottom sheet) ---------- */
#info-card { position: absolute; top: 74px; right: 16px; bottom: 16px; width: min(430px, 40vw); display: flex; flex-direction: column; --cut: 18px; overflow: hidden; }
#info-card .card-top { padding: 12px 14px 8px; display: flex; align-items: center; gap: 8px; }
#info-card .grow { flex: 1; }
#info-card .iconbtn.sm { width: 36px; height: 34px; font-size: 16px; border-radius: 9px; }
.info-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0 16px 14px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.flagban { position: relative; margin: 0 14px; border-radius: 12px; overflow: hidden; aspect-ratio: 2.4 / 1; flex: none; border: 1px solid var(--line);
  background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--era) 28%, #0b1a33), #050b1a); display: grid; place-items: center; }
.flagban .flag { height: 78%; aspect-ratio: 4 / 3; border-radius: 6px; overflow: hidden; box-shadow: 0 8px 26px rgba(0,0,0,.55), 0 0 0 2px rgba(255,255,255,.12); animation: artIn .6s cubic-bezier(.2,.9,.2,1) both; }
.flagban .flag svg { width: 100%; height: 100%; display: block; }
.flagban .emojiart { font-size: 64px; filter: drop-shadow(0 6px 14px rgba(0,0,0,.5)); }
.flagban .nameplate { position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 14px 8px; background: linear-gradient(transparent, rgba(3,8,20,.9) 60%); display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.flagban h2 { margin: 0; font: 700 clamp(20px, 2.4vw, 26px)/1.1 var(--body); text-shadow: 0 2px 8px #000; }
.flagban .nick { font: 600 13px var(--hud); letter-spacing: .5px; color: var(--era); text-transform: uppercase; }
.zhline { display: flex; align-items: center; gap: 10px; margin: 12px 0 0; flex-wrap: wrap; }
.zhline .zh { flex-direction: row; align-items: baseline; gap: 8px; padding: 5px 10px; min-width: 0; cursor: pointer; }
.zhline .zh .hz { order: -1; font-size: 22px; }
.zhline .zh .py { font-size: 14px; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.sg { padding: 9px 11px; border-radius: 11px; background: rgba(255,255,255,.05); border: 1px solid var(--line); min-width: 0; }
.sg.wide { grid-column: 1 / -1; }
.sg small { display: block; font: 700 10.5px var(--hud); letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); }
.sg b { display: block; margin-top: 2px; font: 700 17px/1.2 var(--body); color: #fff; overflow-wrap: anywhere; }
.sg b em { display: block; font: 500 12.5px var(--body); font-style: normal; color: var(--muted); }
.sg .rk { display: inline-block; margin-top: 4px; font: 700 11px var(--hud); letter-spacing: .5px; padding: 2px 7px; border-radius: 6px; background: color-mix(in srgb, var(--gold) 22%, transparent); color: var(--gold); }
.sg button.inline { display: inline; padding: 0; margin: 0; border: 0; background: none; color: var(--cyan); text-decoration: underline dotted; font: inherit; }
.nbrs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.nbr { padding: 6px 10px; border-radius: 99px; border: 1px solid var(--line); background: rgba(255,255,255,.06); font: 600 13.5px var(--body); min-height: 34px; }
.nbr:hover { background: rgba(110,231,255,.18); border-color: var(--cyan); }
.sec-h { margin: 16px 0 6px; font: 700 12px var(--hud); letter-spacing: 1.8px; text-transform: uppercase; color: var(--cyan); display: flex; align-items: center; gap: 8px; }
.factbox { margin-top: 6px; padding: 12px 14px; border-radius: 12px; background: rgba(255,213,74,.10); border: 1px solid rgba(255,213,74,.35); font-size: 17px; line-height: 1.5; min-height: 84px; animation: beatIn .35s ease both; }
.factbox b { color: #fff; }
.factnav { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.factnav .btn { flex: 1; font-size: 13px; padding: 9px 12px; min-height: 42px; }
.tagpill { font: 700 10.5px var(--hud); letter-spacing: 1.2px; text-transform: uppercase; padding: 2px 7px; border-radius: 6px; background: rgba(255,255,255,.08); color: var(--muted); margin-left: auto; }
.card-actions { display: flex; gap: 8px; padding: 10px 14px 14px; border-top: 1px solid var(--line); }
.card-actions .btn { flex: 1; font-size: 13.5px; padding: 10px 12px; }
.stampbadge { display: inline-flex; align-items: center; gap: 6px; font: 700 11px var(--hud); letter-spacing: 1px; text-transform: uppercase; color: var(--good); padding: 3px 8px; border: 1px solid var(--good); border-radius: 6px; }
.emptycard { padding: 22px 18px; color: var(--muted); font-size: 16px; line-height: 1.5; }
.emptycard h3 { margin: 0 0 6px; color: #fff; font: 700 20px var(--body); }

/* ---------- game card ---------- */
#game-card { position: absolute; top: 74px; right: 16px; width: min(460px, 42vw); max-height: calc(100% - 92px); overflow-y: auto; padding: 22px; --cut: 18px; }
.flaglg { width: 100%; max-width: 280px; aspect-ratio: 4 / 3; margin: 6px auto 14px; border-radius: 10px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,.5), 0 0 0 2px rgba(255,255,255,.12); }
.flaglg svg { width: 100%; height: 100%; display: block; }
.flaggrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.flagchoice { padding: 8px; border-radius: 12px; background: rgba(255,255,255,.06); border: 1px solid var(--line); aspect-ratio: 4 / 3; display: grid; place-items: center; }
.flagchoice svg { width: 100%; height: 100%; display: block; border-radius: 6px; }
.flagchoice:hover { border-color: var(--cyan); background: rgba(110,231,255,.14); }
.flagchoice.ok { border-color: var(--good); background: rgba(92,242,160,.2); }
.flagchoice.no { border-color: var(--bad); background: rgba(255,107,129,.18); animation: shake .35s; }
.hl { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hlcard { padding: 14px 10px; border-radius: 14px; background: rgba(255,255,255,.06); border: 1px solid var(--line); text-align: center; min-height: 160px; display: grid; align-content: center; gap: 8px; }
.hlcard:hover { border-color: var(--cyan); background: rgba(110,231,255,.14); }
.hlcard .flag { width: 70%; margin: 0 auto; aspect-ratio: 4 / 3; border-radius: 6px; overflow: hidden; }
.hlcard .flag svg { width: 100%; height: 100%; display: block; }
.hlcard b { font: 700 18px/1.2 var(--body); }
.hlcard .val { font: 700 20px var(--hud); color: var(--gold); min-height: 26px; }
.hlcard.ok { border-color: var(--good); background: rgba(92,242,160,.18); }
.hlcard.no { border-color: var(--bad); background: rgba(255,107,129,.16); }
.streakline { text-align: center; margin: 10px 0 0; color: var(--muted); font: 600 14px var(--hud); letter-spacing: .5px; }
.setup-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 14px; }
.setup-chips .gtab { min-height: 38px; }
.mini { color: var(--muted); font-size: 14px; }

/* ---------- passport ---------- */
.pp-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.pp-bar { height: 8px; border-radius: 99px; background: rgba(255,255,255,.1); overflow: hidden; flex: 1; min-width: 120px; }
.pp-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--good)); }
.pp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; }
.stamp { position: relative; padding: 8px 6px 7px; border-radius: 10px; border: 2px dashed rgba(255,255,255,.18); text-align: center; background: rgba(255,255,255,.03); min-height: 94px; display: grid; justify-items: center; align-content: center; gap: 4px; cursor: pointer; }
.stamp .flag { width: 46px; aspect-ratio: 4 / 3; border-radius: 4px; overflow: hidden; filter: grayscale(1) brightness(.5); opacity: .7; }
.stamp .flag svg { width: 100%; height: 100%; display: block; }
.stamp .nm { font: 600 11.5px/1.15 var(--body); color: var(--muted); }
.stamp .sk { font-size: 10px; letter-spacing: 3px; color: rgba(255,255,255,.25); }
.stamp.won { border: 2px solid var(--era, var(--cyan)); background: color-mix(in srgb, var(--era, var(--cyan)) 12%, transparent); transform: rotate(-1.5deg); }
.stamp.won:nth-child(2n) { transform: rotate(1.5deg); }
.stamp.won .flag { filter: none; opacity: 1; }
.stamp.won .nm { color: #fff; }
.stamp.won .sk { color: var(--gold); }
.stamp.part .flag { filter: grayscale(.4) brightness(.8); opacity: .9; }
.cont-h { margin: 14px 0 6px; font: 700 13px var(--hud); letter-spacing: 2px; text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.cont-h span { color: var(--muted); font-size: 12px; letter-spacing: .5px; }

/* ---------- records + compare ---------- */
.rec-list { display: grid; gap: 6px; margin-top: 10px; }
.rec { display: grid; grid-template-columns: 28px 30px 1fr auto; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 10px; background: rgba(255,255,255,.05); border: 1px solid var(--line); text-align: left; min-height: 44px; }
.rec:hover { border-color: var(--cyan); }
.rec .n { font: 700 14px var(--hud); color: var(--gold); }
.rec .flag { width: 30px; aspect-ratio: 4 / 3; border-radius: 3px; overflow: hidden; }
.rec .flag svg { width: 100%; height: 100%; display: block; }
.rec .v { font: 700 14px var(--hud); color: #fff; text-align: right; }
.rec .v small { display: block; font: 500 11.5px var(--body); color: var(--muted); }
.cmp { display: grid; gap: 14px; }
.cmp-row { display: grid; gap: 4px; }
.cmp-row h4 { margin: 0; font: 700 12px var(--hud); letter-spacing: 1.5px; text-transform: uppercase; color: var(--cyan); }
.cmp-bar { display: grid; grid-template-columns: 110px 1fr; gap: 8px; align-items: center; }
.cmp-bar span { font: 600 13px var(--body); }
.cmp-bar i { display: block; height: 22px; border-radius: 6px; min-width: 4px; transition: width .6s cubic-bezier(.2,.9,.2,1); position: relative; }
.cmp-bar i em { position: absolute; left: 8px; top: 0; line-height: 22px; font: 700 12px var(--hud); font-style: normal; color: #04101f; white-space: nowrap; }
.cmp-pick { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; }
.cmp-pick select { width: 100%; height: 46px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: #0b1a33; color: #fff; font: 500 16px var(--body); }

@media (max-width: 820px) {
  #explore-bar { top: 56px; left: 8px; right: 8px; }
  #explore-bar .tool .tl { display: none; }
  #ex-chips { top: 106px; left: 8px; right: 8px; }
  #info-card { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; height: 52%; }
  #game-card { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 56%; padding: 16px; }
  .flagban { aspect-ratio: 3.2 / 1; margin: 0 10px; }
  .flagban .emojiart { font-size: 46px; }
  .info-scroll { padding: 0 12px 10px; }
  .card-actions { padding: 8px 10px 10px; }
  .factbox { font-size: 16px; min-height: 0; }
  .flaglg { max-width: 200px; margin-bottom: 8px; }
  .hlcard { min-height: 120px; }
}
@media (max-width: 600px) { .cmp-pick { grid-template-columns: 1fr; } .cmp-bar { grid-template-columns: 84px 1fr; } }

/* the hub reuses History's campaign layout */
#scr-hub { padding: 72px 16px 16px; }
@media (max-width: 600px) { #scr-hub { padding: 64px 8px 8px; } }
#explore-bar { right: calc(min(430px, 40vw) + 32px); }
@media (max-width: 820px) { #explore-bar { right: 8px; } }

/* ---------- compact card (nothing selected yet) + state shape banner ---------- */
#info-card { transition: height .3s ease; }
#info-card.compact { bottom: auto; height: auto; max-height: 300px; }
#info-card.compact .emptycard { padding: 16px 16px 18px; }
@media (max-width: 820px) { #info-card.compact { top: auto; height: auto; max-height: 220px; } }
.flagban .shapeart { width: 100%; height: 100%; padding: 10px 8px 24px; display: grid; place-items: center; }
.flagban .shapeart svg { width: 100%; height: 100%; filter: drop-shadow(0 6px 14px rgba(0,0,0,.5)); animation: artIn .6s cubic-bezier(.2,.9,.2,1) both; }

/* game card header: title, spacer, buttons, then the progress dots on their own line */
#game-card .q-top { flex-wrap: wrap; gap: 6px 8px; }
#game-card .q-top .grow { flex: 1; }
#game-card .q-dots.wide { order: 5; flex: 1 0 100%; justify-content: center; }
#game-card .q-dots i { width: 11px; height: 11px; }
.qrow { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.qrow .linkbtn { flex: none; margin-left: 0; }


/* ---------- 3D controls ---------- */
#t3d-panel { display: none; position: absolute; left: 16px; bottom: 16px; width: min(340px, calc(100vw - min(430px, 40vw) - 64px)); padding: 12px 14px 10px; z-index: 12; --cut: 12px; }
#t3d-panel.on { display: block; }
.t3d-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: center; margin-bottom: 8px; }
.t3d-row .t3d-l { font: 700 12px var(--hud); letter-spacing: 1px; text-transform: uppercase; color: var(--cyan); }
.t3d-row output { font: 600 13px var(--body); color: #fff; text-align: right; }
.t3d-row input[type=range] { grid-column: 1 / -1; width: 100%; height: 30px; accent-color: var(--cyan); }
.t3d-hint { font-size: 12.5px; color: var(--muted); }
canvas.gm-3d { z-index: 0; }
@media (max-width: 820px) { #t3d-panel { left: 8px; right: auto; top: 150px; bottom: auto; width: 210px; padding: 8px 10px 4px; } .t3d-hint { display: none; } .t3d-row { margin-bottom: 2px; } .t3d-row input[type=range] { height: 24px; } }


/* ---------- missions (reuse History's mission card, quiz card and scrubber; add the section panel) ---------- */
#scr-missions { padding: 72px 16px 16px; }
@media (max-width: 600px) { #scr-missions { padding: 64px 8px 8px; } }
#sec-panel { position: absolute; top: 72px; left: 16px; bottom: 16px; width: min(440px, 45vw); display: flex; flex-direction: column; gap: 12px; padding: 18px; --cut: 18px; overflow-y: auto; }
#sec-panel .back { align-self: flex-start; background: none; border: 0; padding: 4px 0; color: var(--muted); font: 700 13px var(--hud); letter-spacing: 1px; text-transform: uppercase; }
#sec-panel .back:hover { color: #fff; }
#sec-panel .ep-head { display: flex; gap: 14px; align-items: center; }
#sec-panel .ep-head h1 { margin: 0; font: 700 26px/1.1 var(--hud); letter-spacing: 1px; text-transform: uppercase; }
@media (max-width: 820px) {
  #sec-panel { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 58%; }
  #sec-panel .ep-head h1 { font-size: 21px; }
}
