/* GeoGTI — Amiga Workbench 1.3 skin: blue/white/black/orange, bevelled gadgets,
   copper bars, scanlines, pixel fonts. */
:root {
  --wb-blue: #0055aa;
  --wb-white: #ffffff;
  --wb-black: #000022;
  --wb-orange: #ff8800;
  --wb-grey: #8899bb;
  --wb-dark: #003377;
  --t1: #22dd66; --t2: #33bbff; --t3: #ff8800; --t4: #ff3355;
  --px: 'Press Start 2P', monospace;
  --vt: 'VT323', monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--wb-blue); color: var(--wb-white); }
body { font-family: var(--vt); font-size: 22px; line-height: 1.15; overflow-x: hidden; -webkit-font-smoothing: none; }
/* CRT scanlines over everything */
body::after { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 5000;
  background: repeating-linear-gradient(to bottom, transparent 0 2px, rgba(0, 0, 20, .16) 2px 3px); mix-blend-mode: multiply; }
b { color: var(--wb-orange); font-weight: normal; }
.muted { color: #aac4ee; }

/* Workbench screen bar */
.wb-bar { height: 26px; background: var(--wb-white); color: var(--wb-blue); display: flex; align-items: center; gap: 24px; padding: 0 12px;
  font-family: var(--px); font-size: 10px; position: relative; z-index: 10; }
.wb-bar .wb-mem { margin-left: auto; }
@media (max-width: 600px) { .wb-bar .wb-mem { display: none; } }

/* Bevelled buttons (gadgets) */
.btn { font-family: var(--px); font-size: 12px; color: var(--wb-white); background: var(--wb-blue); cursor: pointer;
  border: 3px solid; border-color: var(--wb-white) var(--wb-black) var(--wb-black) var(--wb-white); padding: 10px 16px; border-radius: 0; }
.btn:hover:not(:disabled) { background: var(--wb-orange); color: var(--wb-black); }
.btn:active:not(:disabled) { border-color: var(--wb-black) var(--wb-white) var(--wb-white) var(--wb-black); }
.btn:disabled { color: var(--wb-grey); cursor: default; }
.btn:focus-visible { outline: 3px dashed var(--wb-orange); outline-offset: 2px; }
.btn.big { font-size: 16px; padding: 16px 28px; }
.btn.small { font-size: 10px; padding: 6px 10px; }
.btn.tiny { font-size: 8px; padding: 3px 6px; border-width: 2px; }

/* Windows */
.win { background: var(--wb-blue); border: 3px solid var(--wb-white); box-shadow: 6px 6px 0 var(--wb-black); display: flex; flex-direction: column; min-width: 0; }
.win-title { display: flex; align-items: center; gap: 8px; height: 26px; padding: 0 4px; flex: none;
  background: repeating-linear-gradient(to bottom, var(--wb-white) 0 2px, var(--wb-blue) 2px 4px); border-bottom: 3px solid var(--wb-white); }
.win-title b { background: var(--wb-white); color: var(--wb-blue); font-family: var(--px); font-size: 10px; padding: 3px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win-title .gadget { width: 18px; height: 18px; flex: none; background: var(--wb-white); border: 3px solid var(--wb-blue); box-shadow: inset 0 0 0 3px var(--wb-white), inset 0 0 0 6px var(--wb-black); cursor: pointer; }
.win-title .tools, .win-title .count { margin-left: auto; display: flex; gap: 4px; }
.win-title .count { background: var(--wb-white); color: var(--wb-blue); font-family: var(--px); font-size: 10px; padding: 3px 6px; }
.win-body { padding: 14px 16px; }

.screen { display: none; }
.screen.active { display: block; }

/* HOME */
#home { max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; position: relative; }
.copper { position: absolute; left: -50vw; right: -50vw; top: 18px; height: 180px; z-index: -1; overflow: hidden; }
.copper i { position: absolute; left: 0; right: 0; height: 18px; animation: copper 3.2s ease-in-out infinite alternate;
  background: linear-gradient(to bottom, #330000, #ff2200, #ffcc00, #ff2200, #330000); }
.copper i:nth-child(2) { animation-delay: -.8s; background: linear-gradient(to bottom, #001133, #0088ff, #aaffff, #0088ff, #001133); }
.copper i:nth-child(3) { animation-delay: -1.6s; background: linear-gradient(to bottom, #002200, #22cc22, #ccffaa, #22cc22, #002200); }
.copper i:nth-child(4) { animation-delay: -2.4s; background: linear-gradient(to bottom, #220033, #cc22ff, #ffccff, #cc22ff, #220033); }
@keyframes copper { from { top: 0; } to { top: 162px; } }
@media (prefers-reduced-motion: reduce) { .copper i { animation: none; } .copper i:nth-child(2) { top: 50px; } .copper i:nth-child(3) { top: 100px; } .copper i:nth-child(4) { top: 150px; } }
#home { isolation: isolate; overflow-x: clip; }
.hero { text-align: center; padding: 24px 0 28px; position: relative; }
#boing { position: absolute; left: 50%; top: 0; margin-left: 250px; image-rendering: pixelated; width: 96px; height: 96px; }
@media (max-width: 700px) { #boing { left: auto; right: 0; top: -14px; margin-left: 0; width: 56px; height: 56px; } }
.logo { font-family: var(--px); font-size: clamp(36px, 9vw, 84px); margin: 0; letter-spacing: 4px;
  color: var(--wb-white); text-shadow: 6px 6px 0 var(--wb-black), -3px -3px 0 var(--wb-orange); }
.logo span { color: var(--wb-orange); text-shadow: 6px 6px 0 var(--wb-black), -3px -3px 0 var(--wb-white); }
.tag { max-width: 640px; margin: 22px auto 0; background: var(--wb-black); padding: 10px 14px; display: inline-block; }
.namebox { max-width: 420px; margin: 0 auto 28px; }
.namebox .win-body { display: flex; align-items: center; gap: 10px; }
.namebox label { font-family: var(--px); font-size: 10px; white-space: nowrap; }
.namebox input { flex: 1; min-width: 0; background: var(--wb-black); color: var(--wb-orange); border: 0; font: inherit; font-size: 28px; padding: 4px 8px; outline: none; caret-color: var(--wb-orange); }
.namebox input:focus { box-shadow: 0 0 0 3px var(--wb-orange); }
.lobbies { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
@media (max-width: 1040px) { .lobbies { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .lobbies { grid-template-columns: 1fr; } }
.lobby .win-body { display: flex; flex-direction: column; gap: 12px; }
.lobby .status { font-family: var(--px); font-size: 9px; }
.lobby .status.live { color: var(--t4); animation: blink 1s steps(2) infinite; }
.lobby .status.open { color: var(--t1); }
@keyframes blink { 50% { opacity: 0; } }
.seats { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.seat { height: 14px; background: var(--wb-dark); border: 2px solid var(--wb-black); }
.seat.on { background: var(--wb-orange); }
.lobby .names { min-height: 1.2em; color: #aac4ee; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.howto { max-width: 720px; margin: 32px auto 0; }
.howto p { margin: 0 0 6px; }

/* WAITING */
#waiting.active { display: grid; place-items: center; padding: 32px 16px; }
.wait-card { width: min(560px, 100%); }
.wait-players { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 6px; }
.wait-players li { display: flex; align-items: center; gap: 10px; background: var(--wb-dark); padding: 6px 10px; animation: popIn .3s steps(4); }
.wait-players li.empty { background: transparent; border: 2px dashed #3a6fb0; color: #3a6fb0; animation: none; }
@keyframes popIn { from { transform: scale(.6); } to { transform: none; } }
.dot { width: 16px; height: 16px; flex: none; box-shadow: 2px 2px 0 var(--wb-black); }
.crown { margin-left: auto; font-family: var(--px); font-size: 9px; color: var(--wb-orange); }
.wait-foot { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }

/* GAME */
#game.active { display: flex; flex-direction: column; height: calc(100vh - 26px); }
.topbar { display: flex; align-items: center; gap: 14px; padding: 8px 12px; background: var(--wb-black); border-bottom: 3px solid var(--wb-white); }
.round-info { font-family: var(--px); font-size: 11px; white-space: nowrap; }
.tier { padding: 3px 6px; color: var(--wb-black); margin-left: 4px; }
.tier.t1 { background: var(--t1); } .tier.t2 { background: var(--t2); } .tier.t3 { background: var(--t3); } .tier.t4 { background: var(--t4); }
.timer { flex: 1; height: 16px; background: var(--wb-dark); border: 2px solid var(--wb-white); }
#timer-bar { height: 100%; width: 100%; transform-origin: left;
  background: repeating-linear-gradient(90deg, var(--t1) 0 10px, #11aa44 10px 12px); }
#timer-bar.low { background: repeating-linear-gradient(90deg, var(--t4) 0 10px, #aa0022 10px 12px); animation: blink .5s steps(2) infinite; }
.timer-text { font-family: var(--px); font-size: 12px; min-width: 64px; text-align: right; }
.stage { flex: 1; display: grid; grid-template-columns: 1fr 290px; gap: 16px; padding: 14px 20px 20px 14px; min-height: 0; position: relative; }
.pano-win { min-height: 0; }
.pano-body { flex: 1; position: relative; background: var(--wb-black); min-height: 0; }
#pano { position: absolute; inset: 0; }
#pano.pixel canvas { image-rendering: pixelated; }
.pnlm-container { background: var(--wb-black) !important; font-family: var(--vt) !important; }
.pnlm-load-box, .pnlm-about-msg { display: none !important; }
.pnlm-compass { width: 56px !important; height: 56px !important; image-rendering: pixelated; bottom: 12px !important; right: 12px !important; }
.walk-arrow { width: 54px; height: 54px; cursor: pointer; image-rendering: pixelated;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 9' shape-rendering='crispEdges'%3E%3Cpath fill='%23000022' d='M4 0h1v1h1v1h1v1h1v1h1v2H6v3H3V6H0V4h1V3h1V2h1V1h1z'/%3E%3Cpath fill='%23ff8800' d='M4 1h1v1h1v1h1v1h1v1H5v3H4V5H1V4h1V3h1V2h1z'/%3E%3Cpath fill='%23ffffff' d='M4 2h1v1H4zM3 3h1v1H3z'/%3E%3C/svg%3E") center/contain no-repeat;
  filter: drop-shadow(3px 3px 0 #000a); }
.walk-arrow:hover { filter: drop-shadow(3px 3px 0 #000a) brightness(1.3); }
.walk-arrow span { display: none; }
.pano-loading { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 12px; font-family: var(--px); font-size: 12px; background: var(--wb-black); z-index: 3; }
.pano-loading.show { display: flex; }
.boing-small { image-rendering: pixelated; width: 64px; height: 64px; }
.walk-hint { position: absolute; left: 12px; top: 12px; z-index: 4; background: var(--wb-black); padding: 3px 8px; font-size: 18px; pointer-events: none; }
.walk-hint:empty { display: none; }
.credit { position: absolute; left: 10px; bottom: 8px; font-size: 15px; color: #fffb; text-shadow: 1px 1px 0 #000; z-index: 4; pointer-events: none; }
.countdown { position: absolute; inset: 0; display: none; place-items: center; z-index: 6; overflow: hidden;
  background: repeating-linear-gradient(to bottom, #001133 0 8px, #002266 8px 16px); text-align: center; }
.countdown.show { display: grid; }
.countdown .tierline { font-family: var(--px); font-size: 12px; line-height: 2; padding: 0 16px; }
.countdown .num { font-family: var(--px); font-size: 96px; display: block; color: var(--wb-orange); text-shadow: 8px 8px 0 var(--wb-black); animation: zoomNum 1s steps(6) infinite; }
@keyframes zoomNum { from { transform: scale(2); } to { transform: scale(1); } }

.map-wrap { position: absolute; right: 330px; bottom: 30px; width: 340px; height: 260px; z-index: 500; transition: width .2s steps(4), height .2s steps(4); }
.map-wrap:hover, .map-wrap.pinned, .map-wrap.big { width: min(58vw, 720px); height: min(62vh, 520px); }
.map-wrap.full { right: 330px; left: 14px; top: 14px; bottom: 20px; width: auto; height: auto; }
#map { flex: 1; background: #5588cc; min-height: 0; }
#map .leaflet-tile-pane { filter: saturate(1.25) contrast(1.08); }
.leaflet-container { font-family: var(--vt); font-size: 18px; }
.leaflet-bar a { border-radius: 0 !important; background: var(--wb-blue); color: var(--wb-white); font-family: var(--px); border-bottom-color: var(--wb-white); }
.leaflet-bar a:hover { background: var(--wb-orange); color: var(--wb-black); }
.leaflet-bar { border: 3px solid var(--wb-white) !important; border-radius: 0 !important; }
.leaflet-control-attribution { background: #000a !important; color: #ccc !important; font-size: 13px; }
.leaflet-control-attribution a { color: var(--wb-orange) !important; }
.btn.lock { border-width: 0; border-top: 3px solid var(--wb-white); padding: 12px; font-size: 11px; }
.btn.lock:not(:disabled) { background: var(--wb-orange); color: var(--wb-black); }
.btn.lock:not(:disabled):hover { background: var(--wb-white); }
.map-wrap.full .btn.lock { display: none; }

.board { min-height: 0; }
#scoreboard { list-style: none; margin: 0; padding: 16px 8px 8px; overflow: auto; flex: 1; }
#scoreboard li { display: grid; grid-template-columns: 28px 16px 1fr auto; align-items: center; gap: 8px; padding: 6px 8px; margin-bottom: 8px;
  background: var(--wb-dark); position: relative; border: 2px solid transparent; }
#scoreboard li.me { border-color: var(--wb-orange); }
#scoreboard li.offline { opacity: .45; }
#scoreboard li.locked { background: #114488; }
#scoreboard li.locked::after { content: 'OK!'; position: absolute; right: 6px; top: -9px; font-family: var(--px); font-size: 8px; background: var(--t1); color: var(--wb-black); padding: 2px 4px; animation: popIn .3s steps(3); }
.rank { font-family: var(--px); font-size: 11px; color: #aac4ee; }
#scoreboard li:nth-child(1) .rank { color: var(--wb-orange); }
.pname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pscore { font-family: var(--px); font-size: 11px; font-variant-numeric: tabular-nums; }
.delta { position: absolute; right: 6px; top: 50%; z-index: 3; font-family: var(--px); font-size: 11px; color: var(--wb-black); background: var(--wb-orange); padding: 3px 5px; pointer-events: none; animation: floatUp 1.8s steps(12) forwards; }
@keyframes floatUp { 0% { transform: translate(0, -50%) scale(.5); opacity: 0; } 15% { transform: translate(0, -130%) scale(1.15); opacity: 1; } 75% { opacity: 1; } 100% { transform: translate(0, -230%); opacity: 0; } }
.move { font-family: var(--px); font-size: 8px; margin-left: 6px; }
.move.up { color: var(--t1); } .move.down { color: var(--t4); }
#scoreboard li.flash { animation: flash .6s steps(3) 2; }
@keyframes flash { 50% { background: var(--wb-orange); } }

.reveal-card { position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 160%); z-index: 900; min-width: min(500px, 92vw);
  transition: transform .45s steps(6), opacity .2s; margin-left: -160px; opacity: 0; pointer-events: none; text-align: center; }
.reveal-card.show { transform: translate(-50%, 0); opacity: 1; }
.reveal-card h2 { font-family: var(--px); font-size: 15px; line-height: 1.5; margin: 4px 0 10px; color: var(--wb-orange); }
.reveal-card .stats { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; }
.reveal-card .stats b { display: block; font-family: var(--px); font-size: 14px; color: var(--wb-white); }
.reveal-card .stats span { color: #aac4ee; font-size: 16px; }
.reveal-card .next { color: #aac4ee; margin-top: 8px; font-size: 18px; }

.final { position: fixed; inset: 0; z-index: 1000; display: none; place-items: center; background: repeating-linear-gradient(to bottom, #001133ee 0 6px, #002255ee 6px 12px); }
.final.show { display: grid; }
.final .inner { text-align: center; padding: 16px; width: min(760px, 100%); }
.final h1 { font-family: var(--px); font-size: clamp(16px, 3vw, 26px); line-height: 1.6; text-shadow: 4px 4px 0 var(--wb-black); }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 10px; margin: 24px 0; }
.podium .step { width: 30%; max-width: 180px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; border: 3px solid var(--wb-white); box-shadow: 6px 6px 0 var(--wb-black); animation: rise .9s steps(9) both; transform-origin: bottom; }
.podium .step .place { font-family: var(--px); font-size: 26px; color: var(--wb-black); }
.podium .step .who { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--wb-black); font-size: 24px; }
.podium .step .pts { font-family: var(--px); font-size: 11px; color: var(--wb-black); }
@keyframes rise { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.final ol { text-align: left; max-width: 360px; margin: 0 auto 20px; }
.final .actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Guru Meditation error box */
.guru { position: fixed; top: 26px; left: 0; right: 0; z-index: 6000; background: #000; color: #ff2222; font-family: var(--px); font-size: 11px; line-height: 2;
  text-align: center; padding: 14px 16px; border: 6px solid #ff2222; display: none; animation: guru 1s steps(2) infinite; cursor: pointer; }
.guru.show { display: block; }
@keyframes guru { 50% { border-color: #000; } }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 1500; image-rendering: pixelated; }

.target-pin { animation: drop .6s steps(6); image-rendering: pixelated; }
@keyframes drop { from { transform: translateY(-60px); } to { transform: none; } }
.leaflet-tooltip.gl { background: var(--wb-black); color: var(--wb-white); border: 2px solid var(--wb-white); border-radius: 0; font-family: var(--vt); font-size: 18px; box-shadow: 3px 3px 0 #000; }
.leaflet-tooltip.gl::before { display: none; }

@media (max-width: 860px) {
  #game.active { height: auto; min-height: calc(100vh - 26px); }
  .stage { grid-template-columns: 1fr; padding: 10px 16px 16px; }
  .pano-win { height: 52vh; }
  .map-wrap, .map-wrap:hover, .map-wrap.pinned, .map-wrap.big { position: relative; right: auto; bottom: auto; width: 100%; height: 44vh; }
  .map-wrap.full { position: relative; inset: auto; height: 60vh; }
  .stage:has(.map-wrap.full) .pano-win { display: none; }
  .reveal-card { margin-left: 0; }
  .topbar { flex-wrap: wrap; }
}
