/* GeoKing: deep violet night sky, golden crown, a green guess button.
   The framework's tokens first, then the panorama, the map and the
   result screen. */
:root {
  --bg: #120a33;
  --bg-image:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(124, 92, 255, .35), transparent 70%),
    radial-gradient(ellipse 60% 40% at 90% 100%, rgba(254, 205, 25, .12), transparent 70%),
    linear-gradient(180deg, #1d1250, var(--bg) 60%, #08041c);
  --hero-ink: #f3eeff;
  --link: #5b3fd6;
  --accent: #fecd19;
  --accent-2: #ffe066;
  --accent-ink: #2a1f00;
  --accent-dk: #b38600;
  --bar: rgba(16, 9, 46, .88);
  --bar-line: rgba(254, 205, 25, .28);
  --turn-glow: rgba(254, 205, 25, .45);
  --table: #0b0624;
  --go: #6cb928;
  --go-dk: #3f7d10;
}

/* ---------------------------------------------------------------- logo */
.gk-logo { gap: .18em; }
.gk-logo-pin { display: inline-flex; width: .82em; height: 1.02em; filter: drop-shadow(0 .04em 0 rgba(0,0,0,.45)); }
.gk-logo-pin svg { width: 100%; height: 100%; }
.gk-logo-text { color: #fff; letter-spacing: .01em; text-shadow: 0 .05em 0 rgba(0,0,0,.5); }
.gk-logo-text b { color: var(--accent); font-weight: inherit; }

.gk-hero { position: relative; width: 180px; height: 180px; margin: 6px auto 18px; }
.gk-hero-globe svg { width: 180px; height: 180px; filter: drop-shadow(0 10px 30px rgba(36, 104, 201, .55)); }
.hero-land { animation: spin 18s linear infinite; }
@keyframes spin { to { transform: translateX(-200px); } }
.gk-hero-pin { position: absolute; left: 50%; top: -10px; width: 64px; height: 80px; transform: translateX(-50%); animation: drop 1.6s cubic-bezier(.3,.7,.4,1.4) both, bob 2.8s 1.6s ease-in-out infinite alternate; }
.gk-hero-pin svg { width: 100%; height: 100%; filter: drop-shadow(0 8px 6px rgba(0,0,0,.45)); }
@keyframes drop { from { transform: translate(-50%, -90px); opacity: 0; } }
@keyframes bob { to { transform: translate(-50%, -8px); } }

.gk-warn { margin: 0; padding: 8px 10px; border-radius: 10px; background: #fff4cc; color: #6b4b00; font-size: .85rem; font-weight: 600; grid-column: 1 / -1; }
.gk-modetext { grid-column: 1 / -1; margin: 0; }

/* ---------------------------------------------------------------- frame */
body.in-game .slot-dock { display: none; } /* everybody guesses at once: no dock */
.gk-info { display: inline-flex; align-items: center; gap: 12px; min-width: 0; overflow: hidden; }
.gk-info > span { white-space: nowrap; }
.gk-i-map { color: var(--accent); }
.gk-i-pts { font-family: var(--display); font-size: 1.05rem; font-weight: 400; }
.gk-time { font-family: var(--display); font-size: 1.15rem; font-weight: 400; min-width: 3ch; }
.gk-time.low { color: #ff8c6b; animation: hurry .5s ease-in-out infinite alternate; }
.gk-chip-done { font-size: .85rem; }
.gk-chip-wait { opacity: .5; }
.gk-chip-gain { color: var(--accent); font-weight: 800; font-size: .8rem; }

/* ---------------------------------------------------------------- the panorama */
.gk { position: absolute; inset: 0; overflow: hidden; }
.gk-pano { position: absolute; inset: 0; background: #000; }
.gk-shield { display: none; position: absolute; inset: 0; z-index: 2; cursor: not-allowed; }
.gk.nmpz .gk-shield { display: block; }
.gk-compass { position: absolute; z-index: 3; top: 12px; left: 12px; width: 54px; height: 54px; border-radius: 50%;
  background: rgba(16, 9, 46, .75); border: 2px solid rgba(255,255,255,.35); box-shadow: 0 2px 10px rgba(0,0,0,.4);
  transform: rotate(var(--hd, 0deg)); transition: transform .08s linear; pointer-events: none; }
.gk-compass .gk-n { position: absolute; top: 1px; left: 50%; transform: translateX(-50%); font-weight: 800; font-size: .7rem; color: var(--accent); }
.gk-needle { position: absolute; left: 50%; top: 50%; width: 8px; height: 36px; transform: translate(-50%, -50%);
  background: linear-gradient(180deg, #e2231a 50%, #fff 50%); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.gk-back { position: absolute; z-index: 3; top: 76px; left: 12px; padding: 6px 12px; font-size: .85rem; background: rgba(16, 9, 46, .8);
  color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.gk.nomove .gk-back, .gk.stage-result .gk-back, .gk.stage-result .gk-compass { display: none; }
.fake-pano { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; padding: 24px; color: #fff;
  background: radial-gradient(ellipse at center, #2a5d93, #0b1d3a); }
.fake-globe { font-size: 4rem; }
.gk-note { position: absolute; z-index: 4; top: 12px; left: 50%; transform: translateX(-50%); }
.gk-note p { margin: 0; padding: 8px 14px; border-radius: 10px; background: #fff4cc; color: #6b4b00; font-weight: 700; }

/* ---------------------------------------------------------------- the guessing map */
.gk-mapbox { position: absolute; z-index: 4; right: 14px; bottom: 14px; width: 340px; height: 270px; display: flex; flex-direction: column;
  gap: 8px; opacity: .78; transition: width .25s ease, height .25s ease, opacity .2s, inset .3s; }
.gk-mapbox:hover, .gk-mapbox:focus-within { width: min(680px, 60vw); height: min(520px, 68%); opacity: 1; }
.gk-mapcanvas { flex: 1; min-height: 0; border-radius: 12px; overflow: hidden; border: 3px solid rgba(255,255,255,.85); box-shadow: 0 6px 24px rgba(0,0,0,.5); background: #a9d3f5; }
.gk-go { flex: none; width: 100%; padding: 12px; font-size: 1.05rem; text-transform: uppercase; letter-spacing: .06em; border-radius: 999px;
  background: var(--go); color: #fff; box-shadow: 0 4px 0 var(--go-dk); }
.gk-go:disabled { background: #3a335a; color: rgba(255,255,255,.75); box-shadow: 0 4px 0 #1d1838; text-transform: none; letter-spacing: 0; font-size: .9rem; opacity: 1; }
.gk-go.ready { animation: pulse 1.2s ease-in-out infinite alternate; }
@keyframes pulse { to { filter: brightness(1.15); box-shadow: 0 4px 0 var(--go-dk), 0 0 18px rgba(108, 185, 40, .7); } }
.gk-mapclose, .gk-maptoggle { display: none; }
.gk.watching .gk-go { display: none; }

/* ---------------------------------------------------------------- results */
.gk.stage-result .gk-mapbox { inset: 0; width: auto; height: auto; opacity: 1; gap: 0; }
.gk.stage-result .gk-mapcanvas { border: 0; border-radius: 0; box-shadow: none; }
.gk.stage-result .gk-go, .gk.stage-result .gk-mapclose, .gk.stage-result .gk-maptoggle { display: none; }
.gk-panel { position: absolute; z-index: 6; left: 50%; bottom: 14px; transform: translateX(-50%); width: min(720px, calc(100% - 24px)); pointer-events: none; }
.gk-res { pointer-events: auto; background: var(--surface); color: var(--ink); border-radius: 16px; padding: 14px 16px; box-shadow: 0 10px 40px rgba(0,0,0,.45);
  animation: rise .35s cubic-bezier(.2,.8,.3,1.2) both; max-height: 52vh; overflow: auto; user-select: text; }
@keyframes rise { from { transform: translateY(30px); opacity: 0; } }
.gk-res-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.gk-res-round { font-family: var(--display); font-size: 1.3rem; color: #3b2a8f; }
.gk-res-place { font-weight: 800; font-size: 1.05rem; }
.gk-res-mine { margin: 8px 0 10px; }
.gk-res-text { font-weight: 600; }
.gk-bar { height: 12px; border-radius: 99px; background: #ece8f8; overflow: hidden; margin: 6px 0 2px; }
.gk-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #fecd19, #6cb928); animation: grow .9s .2s cubic-bezier(.2,.8,.3,1) both; }
@keyframes grow { from { width: 0 !important; } }
.gk-res-pts { font-family: var(--display); font-size: 1.6rem; color: #3f7d10; }
.gk-res-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; counter-reset: r; }
.gk-res-list li { display: grid; grid-template-columns: 1.6em 14px 1fr auto 4.2em; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 8px; counter-increment: r; }
.gk-res-list li::before { content: counter(r) "."; font-weight: 800; color: var(--muted); }
.gk-res-list li.me { background: #f6f1ff; }
.gk-res-list .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gk-res-list .km { color: var(--muted); font-size: .88rem; white-space: nowrap; }
.gk-res-list .pt { text-align: right; font-variant-numeric: tabular-nums; }
.gk-res-next { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.gk-countdown { color: var(--muted); font-size: .85rem; }

.gk-over { overflow-x: auto; margin: 4px 0 10px; }
.gk-over-table { border-collapse: collapse; width: 100%; font-size: .85rem; }
.gk-over-table th, .gk-over-table td { padding: 4px 8px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
.gk-over-table th:first-child, .gk-over-table td:first-child { text-align: left; }
.gk-over-table .dot { width: 9px; height: 9px; }

/* ---------------------------------------------------------------- plain map */
.flat-map { width: 100%; height: 100%; display: block; cursor: crosshair; touch-action: none; }
.fm-sea { fill: #a9d3f5; }
.fm-land path { fill: #f4f0e4; stroke: #b6ad97; stroke-width: 1px; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.fm-line { stroke-width: 3px; stroke-dasharray: 2 8; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.fm-s { transform: scale(var(--ps, 1)) translate(-17px, -43px); }
.fm-pin.flag .fm-s { transform: scale(var(--ps, 1)) translate(-8px, -42px); }

/* ---------------------------------------------------------------- phones */
@media (max-width: 700px), (max-height: 480px) {
  .gk-mapbox { display: none; }
  .gk-maptoggle { display: inline-flex; align-items: center; gap: 6px; position: absolute; z-index: 4; right: 12px; bottom: max(14px, env(safe-area-inset-bottom));
    padding: 12px 18px; border-radius: 999px; background: var(--go); color: #fff; box-shadow: 0 4px 0 var(--go-dk); font-size: 1rem; }
  .gk-maptoggle.has-pin { background: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 0 var(--accent-dk); }
  .gk.map-open .gk-mapbox { display: flex; inset: 8px 8px max(8px, env(safe-area-inset-bottom)); width: auto; height: auto; opacity: 1; }
  .gk.map-open .gk-maptoggle { display: none; }
  .gk.map-open .gk-mapclose { display: grid; place-items: center; position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; padding: 0; border-radius: 50%;
    background: rgba(16, 9, 46, .85); color: #fff; font-size: 1.1rem; box-shadow: none; }
  .gk.stage-result .gk-mapbox { display: flex; }
  .gk-panel { bottom: 8px; }
  .gk-res { max-height: 46vh; padding: 12px; }
  .gk-compass { width: 44px; height: 44px; top: 8px; left: 8px; }
  .gk-needle { height: 28px; }
  .gk-back { top: 60px; left: 8px; }
  .gk-back span { display: none; }
  .gk-i-map { display: none; }
}

/* ---------------------------------------------------------------- admin */
.gk-admin .gk-steps { margin: 0; padding-left: 1.3em; color: var(--muted); }
.gk-admin .gk-keyfield p { margin: 0; }
.gk-admin .gk-keyfield .btn-small { align-self: flex-start; }
.gk-pools { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.gk-pools li { display: grid; grid-template-columns: minmax(8em, 14em) 1fr 6em; gap: 10px; align-items: center; font-weight: 600; }
.gk-pbar { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.gk-pbar i { display: block; height: 100%; background: linear-gradient(90deg, #fecd19, #6cb928); }
