/* Uzspēlēsim.lv front page.
   A full-width "living map" hero (site/public/world-map.js draws it) with the header and the two
   game buttons laid over it; below, the two games, a short legend and the footer.
   Palette: petrol + gold + cream, as in the games. */

:root {
  --bg: #f2f5f7; --surface: #fff; --fg: #17232b; --muted-fg: #56656f; --line: #d5dee4;
  --felt-dark: #143a4d; --felt: #235d7a; --felt-light: #2a6a88;
  --gold: #c9a24b; --gold-bright: #e2c374; --cream: #faf6ec;
  --muted: #a9c6d4; --room-fg: #eef4f7;
  --font-display: Georgia, 'Times New Roman', serif;
  --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #0e1a21; --surface: #16242d; --fg: #e6eef2; --muted-fg: #9fb2bd; --line: #26404d; color-scheme: dark; }
}
:root[data-theme="dark"] { --bg: #0e1a21; --surface: #16242d; --fg: #e6eef2; --muted-fg: #9fb2bd; --line: #26404d; color-scheme: dark; }

* { box-sizing: border-box; }
[hidden], .hidden { display: none !important; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--fg); font-family: var(--font-ui); font-size: 16px; line-height: 1.5; overflow-x: hidden; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; line-height: 1.12; text-wrap: balance; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--gold-bright); outline-offset: 2px; }
.gut { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* ---------- Buttons (Duraks .btn) ---------- */
.btn {
  display: inline-block;
  width: 100%;
  padding: 12px 16px;
  border-radius: 8px;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font-ui);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(0.98); }
.btn-primary { background: linear-gradient(180deg, var(--gold-bright), var(--gold)); color: #2a2005; }
.btn-secondary { background: transparent; border: 1px solid var(--gold); color: var(--gold-bright); }
.btn-sm { width: auto; min-height: 44px; padding: 10px 18px; }


/* ---------- Hero map ---------- */
.hero { position: relative; height: min(94vh, 940px); min-height: 720px; overflow: hidden; background: #7fa35a; --cards-h: 150px; }
/* the game cards on the map: everything else at the bottom edge sits above them */
.hero-cards { position: absolute; left: 0; right: 0; bottom: 16px; z-index: 3; max-width: 1132px; margin: 0 auto; }
.hero-cards .gcard { box-shadow: 0 10px 28px rgba(0,0,0,.35); border: 1px solid rgba(226,195,116,.45); }
.hero::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--cards-h) + 40px); background: linear-gradient(0deg, rgba(14,40,54,.45), rgba(14,40,54,0)); pointer-events: none; z-index: 2; }
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#cv { will-change: transform; }
#fx { cursor: grab; touch-action: pan-y; }
#fx.grabbing { cursor: grabbing; }
.scrim { position: absolute; inset: 0 0 auto; height: 42%; background: linear-gradient(180deg, rgba(14,40,54,.88) 0%, rgba(14,40,54,.55) 45%, rgba(14,40,54,0) 100%); pointer-events: none; }
.top { position: absolute; inset: 0 0 auto; display: flex; align-items: center; gap: 12px; padding-block: 14px; z-index: 3; }
.logo { font-family: var(--font-display); font-weight: 700; font-size: 24px; color: var(--gold-bright); letter-spacing: .01em; text-decoration: none; }
.logo span { color: var(--cream); }
.logo.small { font-size: 19px; }
.sp { flex: 1; }
.auth-row { display: flex; align-items: center; gap: 8px; }
.tbtn { font: inherit; font-size: 14px; font-weight: 700; border-radius: 9px; padding: 8px 13px; min-height: 40px; border: 1px solid rgba(226,195,116,.6); background: rgba(255,255,255,.08); color: var(--room-fg); cursor: pointer; }
.tbtn:hover { background: rgba(255,255,255,.16); }
.tbtn.gold { background: linear-gradient(180deg, #e2c374, #c9a24b); color: #2a2005; border-color: #c9a24b; }
.tbtn.gold:hover { filter: brightness(1.06); }
.who { display: inline-flex; align-items: center; gap: 8px; color: var(--room-fg); font-weight: 700; }
.who .av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--cream); border: 2px solid var(--gold); color: #2a2005; font-family: var(--font-display); font-size: 16px; }
.center { position: absolute; left: 0; right: 0; top: 92px; z-index: 3; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; pointer-events: none; }
.center > * { pointer-events: auto; }
.gbtns { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.gbtn { font-weight: 800; font-size: 18px; border-radius: 14px; padding: 14px 26px; border: 2px solid var(--gold); display: inline-flex; align-items: center; gap: 10px; box-shadow: 0 8px 20px rgba(0,0,0,.3); color: #fff; text-decoration: none; transition: transform .08s ease, filter .15s ease; }
.gbtn:hover { filter: brightness(1.08); }
.gbtn:active { transform: scale(.98); }
.gbtn.d { background: linear-gradient(180deg, #2f7391, #1d5873); }
.gbtn.m { background: linear-gradient(180deg, #a8323e, #7d2430); }
.gbtn .suit { font-family: var(--font-display); font-size: 22px; color: var(--gold-bright); }
.gbtn:focus-visible, .tbtn:focus-visible, .cardpop button:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.live { display: inline-flex; align-items: center; gap: 8px; background: rgba(14,40,54,.7); border: 1px solid rgba(255,255,255,.18); color: var(--room-fg); border-radius: 99px; padding: 5px 12px; font-size: 14px; }
.live b { font-variant-numeric: tabular-nums; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #4cc38a; animation: ping 1.8s infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(76,195,138,.6); } 70% { box-shadow: 0 0 0 8px rgba(76,195,138,0); } 100% { box-shadow: 0 0 0 0 rgba(76,195,138,0); } }
.feed { position: absolute; left: max(16px, env(safe-area-inset-left, 0px)); bottom: calc(var(--cards-h) + 28px); z-index: 3; display: flex; flex-direction: column; gap: 6px; max-width: min(520px, calc(100% - 32px)); }
.ev { background: rgba(14,40,54,.82); color: var(--room-fg); border-radius: 10px; padding: 6px 10px; font-size: 13px; border: 1px solid rgba(255,255,255,.12); display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.ev.new { animation: evIn .4s ease-out; }
.ev time { flex: none; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
/* one line: event · 🏆 winner · 🏠 host and place; a line too long for the bubble ends in "…" */
.ev .evt { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev .evw, .ev .evh { white-space: nowrap; }
.ev .evw { margin-left: 4px; color: #f2e3b8; font-weight: 600; }
.ev .evh { margin-left: 4px; color: #c9dbe4; font-size: 12px; }
.feed { align-items: flex-start; }
.feed[hidden] { display: none; }
.feed .evlist { display: flex; flex-direction: column; gap: 6px; width: 100%; }
/* the newest is at the bottom; older ones fainter */
.ev.age1 { opacity: .88; } .ev.age2 { opacity: .74; } .ev.age3 { opacity: .6; } .ev.age4 { opacity: .46; }
/* the phone's "Parādīt / Paslēpt notikumus" button (computers always show the news) */
.evtoggle { display: none; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--gold-bright); background: rgba(14,40,54,.88); border: 1px solid rgba(226,195,116,.55); border-radius: 99px; padding: 7px 14px; min-height: 36px; cursor: pointer; }
.evtoggle:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.ev b { color: var(--gold-bright); }
.ev.gone { opacity: 0; transform: translateY(4px); transition: opacity .5s ease, transform .5s ease; }
@keyframes evIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.cardpop { position: absolute; z-index: 4; width: 250px; transform: translate(-50%, calc(-100% - 14px)); background: linear-gradient(180deg, #1f5874, #122f3f); color: var(--room-fg); border: 1px solid rgba(226,195,116,.6); border-radius: 12px; padding: 12px; box-shadow: 0 10px 24px rgba(0,0,0,.35); }
.cardpop h3 { font-size: 18px; display: flex; align-items: center; gap: 8px; overflow-wrap: anywhere; }
.cardpop .lv { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--gold-bright); color: #2a2005; font-size: 14px; }
.cardpop p { font-size: 13px; color: var(--muted); margin-top: 4px; }
.cardpop .row { display: flex; gap: 6px; margin-top: 10px; }
.cardpop button, .cardpop a.b { font: inherit; font-size: 13px; font-weight: 700; border-radius: 8px; padding: 7px 10px; border: 1px solid rgba(226,195,116,.6); background: rgba(255,255,255,.08); color: var(--room-fg); cursor: pointer; flex: 1; text-align: center; text-decoration: none; }
.cardpop button.gold, .cardpop a.b.gold { background: linear-gradient(180deg, #e2c374, #c9a24b); color: #2a2005; }
.hint { position: absolute; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(var(--cards-h) + 28px); z-index: 3; background: rgba(14,40,54,.7); color: var(--muted); border-radius: 99px; padding: 5px 12px; font-size: 12px; }
.cardpop.below { transform: translate(-50%, 0); }
/* the page section below the map is also called .below: keep its layout off the card */
.cardpop.below { max-width: none; margin: 0; padding: 12px; display: block; gap: 0; }
/* level progress in the village card */
.cardpop .lvprog { margin: 8px 0 2px; padding: 8px 10px; border-radius: 10px; background: rgba(226,195,116,.1); border: 1px solid rgba(226,195,116,.3); }
.cardpop .lvtxt { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; margin-bottom: 6px; }
.cardpop .lvtxt span, .cardpop .lvtxt b { white-space: nowrap; }
.cardpop .lvtxt b { color: var(--gold-bright); }
.cardpop .lvbar { height: 8px; border-radius: 5px; background: rgba(255,255,255,.14); overflow: hidden; }
.cardpop .lvbar i { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, #c9a24b, #e2c374); }
.cardpop .loading { font-style: italic; }
.pstats { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 10px 0 0; font-size: 13px; }
.pstats dt { color: var(--muted); }
.pstats dd { margin: 0; color: var(--room-fg); font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.mapctl { position: absolute; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(var(--cards-h) + 64px); z-index: 3; display: flex; align-items: flex-end; gap: 8px; }
.mapctl .zoom { display: flex; flex-direction: column; border-radius: 10px; overflow: hidden; border: 1px solid rgba(226,195,116,.6); box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.mbtn { font: inherit; font-weight: 700; color: var(--room-fg); background: rgba(14,40,54,.85); border: 0; cursor: pointer; min-width: 40px; min-height: 40px; font-size: 20px; line-height: 1; }
.mbtn:hover { background: rgba(31,88,116,.95); }
.mbtn:focus-visible { outline: 3px solid #fff; outline-offset: -3px; }
.zoom .mbtn + .mbtn { border-top: 1px solid rgba(226,195,116,.35); }
.mbtn.home { font-size: 14px; padding: 0 14px; border-radius: 10px; border: 1px solid rgba(226,195,116,.6); background: linear-gradient(180deg, #e2c374, #c9a24b); color: #2a2005; box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.maptip { position: absolute; left: 50%; top: 58%; transform: translate(-50%, -50%); z-index: 5; background: rgba(14,40,54,.9); color: var(--room-fg); border: 1px solid rgba(226,195,116,.6); border-radius: 12px; padding: 10px 14px; font-size: 14px; font-weight: 600; pointer-events: none; text-align: center; max-width: calc(100% - 48px); }
@media (max-width: 640px) {
  .mapctl { bottom: calc(var(--cards-h) + 24px); }
  .feed { max-width: calc(100% - 120px); }
  .tbtn.alt { display: none; }
  .tbtn { padding: 7px 10px; }
  .evtoggle { display: inline-block; }
  .feed:not(.open) .evlist { display: none; }
  .feed.open { z-index: 20; max-width: calc(100% - 32px); }
  .feed.open .evlist { order: -1; }
  .feed .ev .evt { white-space: normal; }
  body.feed-open .zoom, body.feed-open #mapHome { visibility: hidden; }
  .hero { min-height: 580px; height: 100vh; height: 100svh; } /* the cards stay on the first screen */
  /* phones: the two cards side by side, short */
  .hero .hero-cards { grid-template-columns: 1fr 1fr; gap: 10px; bottom: 12px; }
  .hero-cards .gcard { padding: 12px; gap: 4px; }
  .hero-cards .gcard h2 { font-size: 19px; }
  .hero-cards .gcard p { display: none; }
  .hero-cards .gcard .stat { font-size: 12px; }
  .center { top: 70px; }
  .gbtn { font-size: 16px; padding: 12px 18px; }
  .hint { display: none; }
  .feed { bottom: calc(var(--cards-h) + 24px); }
  .who #userName { max-width: 9ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ---------- Below the map ---------- */
.below { max-width: 1100px; margin: 0 auto; padding-block: 34px 56px; display: flex; flex-direction: column; gap: 34px; }
.gcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 16px; }
.gcard { border-radius: 14px; padding: 18px; color: #fff; display: flex; flex-direction: column; gap: 8px; text-decoration: none; transition: transform .12s ease, box-shadow .12s ease; }
.gcard:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0,0,0,.18); }
.gcard.d { background: linear-gradient(160deg, #2f7391, #143a4d); }
.gcard.m { background: linear-gradient(160deg, #a8323e, #4a1820); }
.gcard h2 { font-size: 24px; }
.gcard p { color: rgba(255,255,255,.82); font-size: 15px; }
.gcard .stat { font-size: 13px; color: var(--gold-bright); font-weight: 700; }
.legend h2 { font-size: 22px; }
.legend .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 12px; margin-top: 12px; }
.note { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.note h3 { font-size: 16px; }
.note p { color: var(--muted-fg); font-size: 14px; margin-top: 4px; }
.guest-note { color: var(--muted-fg); font-size: 14px; margin-top: 14px; }


/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--felt-dark); }
.footer-inner { max-width: 1100px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding-top: 20px; padding-bottom: 20px; }
.footer-inner nav { display: flex; flex-wrap: wrap; gap: 4px 20px; font-size: .9rem; }
.footer-inner a { color: var(--muted); text-decoration: none; padding: 8px 0; }
.footer-inner a:hover { color: var(--gold-bright); }

/* ---------- Pop-up ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(4, 15, 22, 0.75);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 72px 16px 24px;
  overflow-y: auto;
}
.modal {
  color: var(--cream);
  position: relative;
  width: 100%;
  max-width: 400px;
  padding: 32px 28px 24px;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--felt-light), var(--felt-dark));
  border: 1px solid rgba(201, 162, 75, 0.6);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}
.modal h2 { margin: 0 0 18px; padding-right: 40px; font-family: var(--font-display); font-size: 1.6rem; color: var(--gold-bright); }
.modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--gold-bright);
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
}
.field { display: block; text-align: left; margin-bottom: 14px; }
.field span {
  display: block;
  margin-bottom: 4px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.field input {
  width: 100%;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(201, 162, 75, 0.3);
  border-radius: 8px;
  color: var(--cream);
  font-size: 1rem;
  font-family: var(--font-ui);
}
.field input:focus { outline: none; border-color: var(--gold); }
.oauth-btn { display: block; margin-bottom: 10px; }
.divider { display: flex; align-items: center; color: var(--muted); font-size: 0.75rem; margin: 16px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: rgba(201, 162, 75, 0.25); }
.divider span { padding: 0 10px; }
.error { color: #e9a090; font-size: 0.88rem; margin: 12px 0 0; }
.am-status { color: var(--gold-bright); font-size: 0.9rem; margin: 12px 0 0; }
.am-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; margin-top: 12px; }
.am-guest { display: block; width: 100%; text-align: center; margin-top: 4px; }
.link-btn {
  border: 0;
  background: none;
  padding: 10px 0;
  min-height: 44px;
  color: var(--gold-bright);
  font: 0.88rem var(--font-ui);
  text-decoration: underline;
  cursor: pointer;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 200;
  max-width: min(92vw, 420px);
  padding: 10px 18px;
  border-radius: 999px;
  background: #1d130a;
  border: 1px solid var(--gold);
  color: #fff;
  text-align: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
}


.cardpop .more { margin-top: 10px; }

@media (prefers-reduced-motion: reduce) {
  .dot, .ev { animation: none; }
  .btn, .gbtn, .gcard { transition: none; }
}

/* challenge mark on a game button, and the hint under the buttons */
.gbtn { position: relative; }
.gmark {
  position: absolute; right: -11px; top: -11px; width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(180deg, #f1d58a, #c9a24b); border: 2px solid #2a2005; color: #2a2005;
  display: flex; align-items: center; justify-content: center; font: 900 17px/1 system-ui, sans-serif;
}
.gmark::before {
  content: ''; position: absolute; inset: -2px; border-radius: 50%; background: #e2c374; z-index: -1;
  animation: gmarkPulse 1.6s ease-out infinite;
}
@keyframes gmarkPulse { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(2.1); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .gmark::before { animation: none; } }
.gmark.hidden, .chhint.hidden { display: none; }
.chhint {
  display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding: 7px 14px; border-radius: 10px;
  background: rgba(14,40,54,.9); border: 1px solid rgba(226,195,116,.6); color: #cfe0e8; font-size: 13.5px; text-decoration: none;
}
.chhint b { color: var(--gold-bright); }
.chhint:hover { border-color: var(--gold-bright); }
