/* Geocade web: the app's palette and components. */
:root {
  --canvas: #FFF9F0; --ink: #211B33; --ink2: rgba(33,27,51,0.68); --ink3: rgba(33,27,51,0.15);
  --primary: #5B35D5; --soft: #E6DEFF; --lime: #D5F45B; --coral: #FF795C; --amber: #FFC94D;
  --card: #FFFFFF; --ocean: #E9F1FB; --lime-tint: #EAF9AD; --coral-tint: #FFD7CE;
  --radius: 22px; --control: 16px;
  --font: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 17px/1.45 var(--font); }
a { color: var(--primary); }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* Site chrome */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 64rem; margin: 0 auto; padding: 12px 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 900; font-size: 1.2rem; }
.brand img { width: 36px; height: 36px; border-radius: 10px; border: 2px solid var(--ink); }
.topbar nav { display: flex; gap: 16px; font-weight: 800; font-size: 0.95rem; }
.topbar nav a { color: var(--ink); text-decoration: none; }
.page { max-width: 64rem; margin: 0 auto; padding: 8px 16px 56px; }
.footer { border-top: 1.5px solid var(--ink3); margin-top: 48px; padding-top: 20px; display: flex; flex-wrap: wrap; gap: 8px 20px; color: var(--ink2); font-size: 0.95rem; font-weight: 600; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 20px;
       border-radius: var(--control); border: 2.5px solid var(--ink); font-weight: 800; font-size: 1.02rem; cursor: pointer;
       text-decoration: none; color: var(--ink); background: var(--card); position: relative; transition: transform .08s; -webkit-tap-highlight-color: transparent; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 5px 0 var(--ink); }
.btn-lime { background: var(--lime); box-shadow: 0 5px 0 var(--ink); }
.btn-amber { background: var(--amber); box-shadow: 0 5px 0 var(--ink); }
.btn-primary:active, .btn-lime:active, .btn-amber:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.btn-secondary { border: 1.5px solid var(--ink3); min-height: 44px; font-weight: 700; font-size: 0.95rem; padding: 0 14px; }
.btn-secondary:active { opacity: .7; }
.btn:disabled { opacity: .4; cursor: default; box-shadow: none; transform: none; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; color: var(--primary); font-weight: 800; font-size: 0.95rem; min-height: 40px; cursor: pointer; padding: 0 4px; }
.tag { font-size: 0.72rem; font-weight: 900; padding: 2px 7px; border-radius: 999px; background: var(--lime); border: 1px solid var(--ink); }

/* Cards and pills */
.card { background: var(--card); border: 1px solid rgba(33,27,51,0.12); border-radius: var(--radius); padding: 18px; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; border: 1.25px solid rgba(33,27,51,0.85);
        background: var(--canvas); font-weight: 800; font-size: 0.78rem; white-space: nowrap; }
.hint-card { background: rgba(255,201,77,0.4); border-radius: 12px; padding: 10px 12px; font-weight: 650; font-size: 0.95rem; }
.toast { position: fixed; left: 50%; top: 76px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px;
         border-radius: 999px; font-weight: 800; font-size: 0.92rem; z-index: 50; box-shadow: 0 6px 20px rgba(0,0,0,.2); }

/* Stamp, stat tiles, result */
.stamp { display: inline-flex; flex-direction: column; align-items: center; padding: 12px 22px; border-radius: 16px; border: 3px solid var(--ink);
         outline: 2px dashed var(--ink); outline-offset: -9px; transform: rotate(-3deg); background: var(--lime); }
.stamp b { font-size: 1.7rem; font-weight: 900; line-height: 1.1; }
.stamp small { font-size: 0.75rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.stats { display: flex; gap: 10px; width: 100%; }
.stat { flex: 1; background: var(--canvas); border: 1.5px solid rgba(33,27,51,0.15); border-radius: 16px; padding: 10px; text-align: center; }
.stat b { display: block; font-size: 1.4rem; font-weight: 900; }
.stat span { font-size: 0.78rem; font-weight: 800; color: var(--ink2); text-transform: uppercase; letter-spacing: .03em; }
.result { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.countdown { margin: 0; color: var(--ink2); font-weight: 800; font-size: 0.9rem; }
.emoji-row { font-size: 1.35rem; letter-spacing: 2px; }

/* Map */
.map { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--ink3); background: var(--ocean); min-height: 120px; }
.map canvas { display: block; width: 100%; height: 100%; cursor: grab; }
.map-tag { position: absolute; top: 10px; left: 10px; background: #fff; border: 1px solid rgba(33,27,51,.6); border-radius: 999px; padding: 4px 10px; font-weight: 800; font-size: .85rem; }
.map-recentre { position: absolute; right: 8px; bottom: 8px; width: 44px; height: 44px; border-radius: 14px; border: 1.5px solid var(--ink3); background: #fff; display: grid; place-items: center; cursor: pointer; }

/* Guess panel */
.guess-panel { display: flex; flex-direction: column; gap: 8px; position: relative; }
.guess-row { display: flex; gap: 8px; }
.field-wrap { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; min-height: 52px; padding: 0 12px; background: #fff; border: 2px solid rgba(33,27,51,.85); border-radius: var(--control); }
.field-icon { color: var(--ink2); font-size: 1.2rem; }
.field { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: 600 1.02rem var(--font); color: var(--ink); }
.field-clear { border: 0; background: none; font-size: 1.4rem; color: var(--ink2); cursor: pointer; width: 32px; height: 40px; }
.guess-submit { width: 96px; box-shadow: none; }
.guess-submit:active { transform: none; }
.suggestions { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); max-height: 220px; overflow-y: auto; background: #fff;
               border: 1px solid rgba(33,27,51,.2); border-radius: var(--control); box-shadow: 0 8px 24px rgba(33,27,51,.12); z-index: 5; }
.suggestion { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 14px; border: 0; border-bottom: 1px solid rgba(33,27,51,.08);
              background: none; text-align: left; font-weight: 650; cursor: pointer; }
.suggestion:hover, .suggestion:focus { background: var(--soft); outline: none; }
.panel-footer { display: flex; align-items: center; gap: 12px; min-height: 0; }
.panel-footer:empty { display: none; }

/* Game page */
.game-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 12px; }
.game-hero h1 { margin: 0; font-size: clamp(1.9rem, 6vw, 2.6rem); font-weight: 900; line-height: 1.05; letter-spacing: -0.01em; }
.game-hero p { margin: 4px 0 0; color: var(--ink2); font-weight: 700; }
.game-layout { display: grid; grid-template-columns: minmax(0, 30rem) minmax(0, 1fr); gap: 28px; align-items: start; }
.game-frame { background: var(--canvas); border: 2px solid var(--ink); border-radius: 28px; box-shadow: 0 6px 0 var(--ink); overflow: hidden;
              height: min(760px, calc(100svh - 200px)); min-height: 560px; display: flex; flex-direction: column; }
.game-root { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 14px; gap: 10px; overflow-y: auto; position: relative; }
.game-loading { margin: auto; color: var(--ink2); font-weight: 800; }
/* Only the map (or a .g-grow block) flexes; everything else keeps its natural height and the frame scrolls. */
.game-root > *:not(.g-grow):not(.map) { flex-shrink: 0; }
.game-side h2 { font-size: 1.3rem; font-weight: 900; margin: 0 0 10px; }
.game-side ol { padding-left: 1.2rem; margin: 0 0 22px; }
.game-side li { margin-bottom: 8px; font-weight: 550; }
.app-cta { background: var(--soft); border: 2px solid var(--ink); border-radius: var(--radius); padding: 18px; margin-bottom: 22px; }
.app-cta h3 { margin: 0 0 6px; font-size: 1.1rem; font-weight: 900; }
.app-cta p { margin: 0 0 12px; font-weight: 550; }
.more-games { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 12rem), 1fr)); gap: 10px; }
.mini-tile { display: block; text-decoration: none; color: var(--ink); background: #fff; border: 2px solid var(--ink); border-radius: 16px; padding: 12px; box-shadow: 0 3px 0 var(--ink); font-weight: 900; }
.mini-tile span { display: block; color: var(--ink2); font-weight: 600; font-size: .85rem; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--ink); margin-right: 8px; vertical-align: -1px; }

/* Shared in-game pieces */
.g-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.g-title { font-weight: 900; font-size: 1.25rem; line-height: 1.15; margin: 0; }
.g-sub { color: var(--ink2); font-weight: 650; font-size: 0.92rem; margin: 2px 0 0; }
.g-grow { flex: 1; min-height: 0; }
.g-row { display: flex; gap: 8px; }
.g-row > * { flex: 1; }
.g-center { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; flex: 1; }
.g-big { font-size: 3.2rem; font-weight: 900; line-height: 1; }
.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.pop { animation: pop .25s ease-out; }
@keyframes pop { from { transform: scale(.92); opacity: .4; } to { transform: none; opacity: 1; } }

@media (max-width: 860px) {
  .game-layout { grid-template-columns: 1fr; }
  .game-frame { height: calc(100svh - 96px); min-height: 520px; border-radius: 24px; }
}
@media (max-width: 520px) {
  .page { padding: 4px 10px 40px; }
  .game-frame { border-width: 0; box-shadow: none; border-radius: 0; margin: 0 -10px; height: calc(100svh - 64px); }
  .game-hero { display: none; }
  .topbar nav .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
