/* ══════════════════ ΗΓΕΜΟΝΙΑ — Color Kingdom reimagined ══════════════════
   Kahoot's territory mode, set in the Greek world. Four colored shapes,
   a speed clock, and a KINGDOM OF BLOCKS you paint your colour. Rival
   hegemons march in as avatars from the four winds (N/S/E/W), sweeping
   across and painting tiles. On each correct answer you pick a block to
   seize — even one of theirs. Colour the majority to win the hegemony.
   Palette: imperial blood-red over dark Hearth, with the classic quad.
═══════════════════════════════════════════════════════════════════════════ */

#hg-overlay { --hg-ink:#0C0606; }
#hg-overlay .overlay-topbar { background:rgba(12,6,6,0.92); border-bottom:1px solid rgba(158,59,46,0.28); }
#hg-overlay .overlay-title { color:#E0867A; text-shadow:0 0 16px rgba(158,59,46,0.45); }

#hg-wrap {
  min-height:100%;
  background:
    radial-gradient(900px 520px at 50% -8%, rgba(158,59,46,0.18), transparent 62%),
    radial-gradient(740px 600px at 86% 110%, rgba(196,164,72,0.08), transparent 60%),
    linear-gradient(180deg, #140A08, #0C0606);
  color:var(--sym-cream); font-family:var(--sym-sans); position:relative; overflow:hidden;
}

.hg-screen { display:none; flex-direction:column; min-height:calc(100vh - 54px); padding:clamp(18px,3.4vw,36px); position:relative; z-index:1; }
.hg-screen.active { display:flex; animation:hg-fade .4s ease; }
@keyframes hg-fade { from{opacity:0; transform:translateY(8px);} to{opacity:1; transform:none;} }

/* ── Intro ── */
#hg-screen-intro { align-items:center; justify-content:center; text-align:center; gap:8px; }
.hg-crest { width:138px; height:138px; margin-bottom:4px; filter:drop-shadow(0 8px 30px rgba(158,59,46,0.45)); }
.hg-logo { font-family:var(--sym-display); font-weight:700; font-size:clamp(32px,5.4vw,56px); letter-spacing:0.09em; color:#E0867A; text-shadow:0 0 30px rgba(158,59,46,0.4); }
.hg-logo-en { font-family:var(--sym-serif); font-style:italic; font-size:21px; color:var(--sym-gold-lt); margin-bottom:6px; }
.hg-intro-txt { font-family:var(--sym-serif); font-size:19px; line-height:1.55; color:var(--sym-stone); max-width:580px; margin-bottom:18px; }
.hg-intro-txt b { color:var(--sym-cream); font-style:normal; }
.hg-quad-demo { display:flex; gap:12px; margin-bottom:20px; }
.hg-quad-demo span { width:40px; height:40px; border-radius:8px; display:grid; place-items:center; }
.hg-quad-demo svg { width:20px; height:20px; }
.hg-pcount { display:flex; align-items:center; gap:14px; margin-bottom:24px; }
.hg-pcount-lbl { font-family:var(--sym-mono); font-size:11px; letter-spacing:2px; color:var(--sym-stone); text-transform:uppercase; }
.hg-pcount-seg { display:inline-flex; border:1px solid rgba(240,235,224,0.18); border-radius:4px; overflow:hidden; }
.hg-pcount-seg button {
  background:transparent; border:none; color:var(--sym-stone);
  font-family:var(--sym-display); font-size:17px; font-weight:600;
  width:46px; height:40px; cursor:pointer; transition:background .15s, color .15s;
  border-left:1px solid rgba(240,235,224,0.12);
}
.hg-pcount-seg button:first-child { border-left:none; }
.hg-pcount-seg button:hover { background:rgba(240,235,224,0.06); color:var(--sym-cream); }
.hg-pcount-seg button.on { background:var(--sym-blood); color:#F4ECE0; }

/* ── Top HUD ── */
.hg-top { display:flex; align-items:center; justify-content:space-between; gap:18px; flex-wrap:wrap; margin-bottom:14px; }
.hg-score { display:flex; align-items:center; gap:12px; }
.hg-score-badge { width:44px; height:44px; border-radius:50%; display:grid; place-items:center; border:2px solid var(--sym-terra); background:rgba(217,123,92,0.14); font-family:var(--sym-display); font-weight:700; font-size:18px; color:var(--sym-terra-lt); }
.hg-score-txt { display:flex; flex-direction:column; }
.hg-score-lbl { font-family:var(--sym-mono); font-size:9px; letter-spacing:2px; color:var(--sym-stone); text-transform:uppercase; }
.hg-score-val { font-family:var(--sym-display); font-size:26px; color:var(--sym-cream); line-height:1; }
.hg-qcount { font-family:var(--sym-mono); font-size:11px; letter-spacing:2px; color:#E0867A; }

/* ── Arena: block-map + leaderboard ── */
.hg-arena { display:flex; gap:clamp(16px,3vw,34px); align-items:center; justify-content:center; flex-wrap:wrap; margin-bottom:14px; }
.hg-grid { position:relative; width:min(462px,82vw); }
.hg-tiles { display:grid; grid-template-columns:repeat(7,1fr); gap:0; border-radius:8px; overflow:hidden; box-shadow:0 16px 44px rgba(0,0,0,0.5); }
.hg-tile {
  aspect-ratio:1; background:rgba(240,235,224,0.045);
  box-shadow:inset 0 0 0 1px rgba(12,6,6,0.55);
  transition:background .45s ease; position:relative;
}
.hg-tile.sel { cursor:pointer; }
.hg-tile.sel::after {
  content:''; position:absolute; inset:3px; border-radius:3px;
  border:2px dashed rgba(240,235,224,0.85); animation:hg-selpulse 1s ease-in-out infinite;
}
.hg-tile.sel:hover::after { border-color:#fff; background:rgba(255,255,255,0.12); }
@keyframes hg-selpulse { 0%,100%{opacity:0.45;} 50%{opacity:1;} }
.hg-tile.flash { animation:hg-flash .55s ease; }
@keyframes hg-flash { 0%{ transform:scale(.6); } 60%{ transform:scale(1.08);} 100%{ transform:scale(1);} }

/* avatar tokens that march across the board */
/* capital flag + the contiguous-empire tiles */
.hg-cap { position:absolute; inset:0; display:grid; place-items:center; font-size:16px; pointer-events:none; line-height:1;
  text-shadow:0 1px 2px rgba(0,0,0,0.6); animation:hg-planted .4s ease; }
@keyframes hg-planted { from{ transform:scale(0) translateY(-6px); } to{ transform:scale(1); } }
.hg-tile.frontier-open::after { border-color:rgba(240,235,224,0.9); }
.hg-tile.frontier-foe::after { border-color:#F0C0A0; }

.hg-ladder { display:flex; flex-direction:column; gap:7px; min-width:212px; }
.hg-ladder-row { display:flex; align-items:center; gap:9px; padding:7px 11px; border-radius:6px; background:rgba(255,255,255,0.035); border:1px solid rgba(240,235,224,0.07); transition:background .3s, border-color .3s; }
.hg-ladder-row.me { border-color:var(--sym-terra); background:rgba(217,123,92,0.12); }
.hg-ladder-swatch { width:14px; height:14px; border-radius:4px; flex-shrink:0; box-shadow:0 0 0 1px rgba(0,0,0,0.3) inset; }
.hg-ladder-name { font-family:var(--sym-serif); font-size:14.5px; color:var(--sym-cream); flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.hg-ladder-terr { font-family:var(--sym-display); font-size:18px; color:var(--sym-cream); min-width:26px; text-align:right; }
.hg-ladder-pct { font-family:var(--sym-mono); font-size:10px; color:var(--sym-stone); min-width:40px; text-align:right; }

/* ── Select banner ── */
.hg-select-hint {
  text-align:center; min-height:26px; margin-bottom:10px;
  font-family:var(--sym-mono); font-size:12px; letter-spacing:2px; text-transform:uppercase;
  color:var(--sym-gold-lt); opacity:0; transition:opacity .3s;
}
.hg-select-hint.on { opacity:1; }

/* ── Question ── */
.hg-qbody { max-width:900px; margin:0 auto; width:100%; }
.hg-q-card {
  background:linear-gradient(180deg, rgba(255,255,255,0.025), rgba(0,0,0,0.22)), var(--sym-bg-panel);
  border:1px solid rgba(158,59,46,0.22); border-radius:5px;
  padding:18px 28px; margin-bottom:12px; text-align:center;
}
.hg-q-text { font-family:var(--sym-serif); font-size:clamp(20px,2.7vw,27px); line-height:1.38; color:var(--sym-cream); }

/* timer */
.hg-timer { height:8px; border-radius:5px; background:rgba(240,235,224,0.08); overflow:hidden; margin:0 auto 16px; max-width:900px; width:100%; }
.hg-timer-fill { height:100%; width:100%; border-radius:5px; background:linear-gradient(90deg, var(--sym-gold), var(--sym-terra)); transition:background .3s; }
.hg-timer-fill.warn { background:linear-gradient(90deg, var(--sym-terra), var(--sym-blood)); }

/* answer shapes */
.hg-answers { display:grid; grid-template-columns:1fr 1fr; gap:14px; max-width:900px; margin:0 auto; }
@media (max-width:600px){ .hg-answers{grid-template-columns:1fr;} }
.hg-ans {
  display:flex; align-items:center; gap:16px; text-align:left; cursor:pointer;
  border:none; border-radius:6px; padding:16px 20px; min-height:70px;
  font-family:var(--sym-sans); font-size:17px; font-weight:600; line-height:1.3;
  transition:transform .1s, filter .15s, opacity .3s; position:relative;
}
.hg-ans:hover:not(:disabled){ transform:translateY(-2px); filter:brightness(1.08); }
.hg-ans:active:not(:disabled){ transform:translateY(0); }
.hg-shape { width:34px; height:34px; flex-shrink:0; display:grid; place-items:center; }
.hg-shape svg { width:30px; height:30px; }
.hg-ans-txt { flex:1; }
.hg-sh-0 { background:var(--sym-terra);  color:#2A140C; }
.hg-sh-1 { background:var(--sym-aegean); color:#08171A; }
.hg-sh-2 { background:var(--sym-gold);   color:#2A2208; }
.hg-sh-3 { background:var(--sym-sage);   color:#0E1808; }
.hg-ans.dim { opacity:0.34; filter:grayscale(.5); }
.hg-ans.correct { box-shadow:0 0 0 3px var(--sym-cream), 0 0 26px rgba(240,235,224,0.4); }
.hg-ans.wrong   { box-shadow:0 0 0 3px var(--sym-blood) inset; }
.hg-ans .hg-mark { position:absolute; right:14px; font-size:22px; }

.hg-feedback { text-align:center; min-height:24px; margin-top:16px; font-family:var(--sym-mono); font-size:13px; letter-spacing:1.5px; }
.hg-fb-ok { color:var(--sym-gold-lt); }
.hg-fb-bad { color:#E0867A; }

/* ── End ── */
#hg-screen-end { align-items:center; justify-content:center; text-align:center; gap:12px; }
.hg-end-crest { width:124px; height:124px; }
.hg-end-title { font-family:var(--sym-display); font-size:clamp(28px,5vw,46px); letter-spacing:4px; }
.hg-end-title.win { color:var(--sym-gold); text-shadow:0 0 30px rgba(196,164,72,0.5); }
.hg-end-title.lose { color:#E0867A; }
.hg-end-sub { font-family:var(--sym-serif); font-style:italic; font-size:18px; color:var(--sym-stone); max-width:540px; line-height:1.5; }
.hg-final-board { background:var(--sym-bg-panel); border:1px solid rgba(158,59,46,0.2); border-radius:5px; padding:10px 14px; min-width:340px; margin:6px 0; }
.hg-final-row { display:flex; align-items:center; gap:12px; padding:9px 8px; border-bottom:1px solid rgba(240,235,224,0.06); }
.hg-final-row:last-child { border-bottom:none; }
.hg-final-row.me { background:rgba(217,123,92,0.09); border-radius:3px; }
.hg-final-pos { font-family:var(--sym-display); font-size:16px; color:var(--sym-stone); width:28px; text-align:center; }
.hg-final-swatch { width:13px; height:13px; border-radius:4px; flex-shrink:0; }
.hg-final-name { font-family:var(--sym-serif); font-size:17px; color:var(--sym-cream); flex:1; text-align:left; }
.hg-final-terr { font-family:var(--sym-display); font-size:18px; color:var(--sym-cream); min-width:30px; text-align:right; }
.hg-final-pct { font-family:var(--sym-mono); font-size:12px; color:var(--sym-stone); min-width:48px; text-align:right; }
.hg-end-btns { display:flex; gap:14px; flex-wrap:wrap; justify-content:center; margin-top:6px; }

/* ── Mode picker (SOLO / LIVE VS) ── */
.hg-mode-btns { display:flex; gap:20px; flex-wrap:wrap; justify-content:center; margin-top:8px; }
.hg-mode-btn {
  display:flex; flex-direction:column; align-items:center; gap:8px;
  width:200px; padding:26px 20px 22px; cursor:pointer;
  background:rgba(158,59,46,0.08); border:1px solid rgba(158,59,46,0.3); border-radius:8px;
  color:var(--sym-cream); transition:transform .2s, border-color .2s, background .2s, box-shadow .2s;
}
.hg-mode-btn:hover { transform:translateY(-5px); border-color:#E0867A; background:rgba(158,59,46,0.16); box-shadow:0 8px 24px rgba(158,59,46,0.2); }
.hg-mode-btn-vs { border-color:rgba(196,164,72,0.3); background:rgba(196,164,72,0.08); }
.hg-mode-btn-vs:hover { border-color:var(--sym-gold); background:rgba(196,164,72,0.16); box-shadow:0 8px 24px rgba(196,164,72,0.18); }
.hg-mode-icon { font-size:36px; line-height:1.1; }
.hg-mode-lbl { font-family:var(--sym-display); font-size:16px; letter-spacing:2.5px; }
.hg-mode-sub { font-family:var(--sym-serif); font-style:italic; font-size:13px; color:var(--sym-stone); text-align:center; line-height:1.4; max-width:160px; }
.hg-mode-back { padding:6px 14px; cursor:pointer; border-radius:3px; border:none; background:transparent; font-family:var(--sym-mono); font-size:11px; letter-spacing:1px; color:var(--sym-stone); opacity:0.6; transition:opacity .15s; }
.hg-mode-back:hover { opacity:1; color:var(--sym-cream); }

/* ── Leave confirmation ── */
.hg-leave-modal { position:absolute; inset:0; z-index:30; background:rgba(12,6,6,0.82); backdrop-filter:blur(4px); display:flex; align-items:center; justify-content:center; }
.hg-leave-box { background:var(--sym-bg-panel); border:1px solid rgba(158,59,46,0.3); border-radius:10px; padding:36px 44px; text-align:center; max-width:420px; animation:hg-fade .25s ease; }
.hg-leave-msg { font-family:var(--sym-serif); font-size:18px; color:var(--sym-cream); line-height:1.55; margin-bottom:28px; }
.hg-leave-btns { display:flex; gap:14px; justify-content:center; }
.hg-leave-yes { padding:11px 32px; cursor:pointer; border-radius:4px; background:rgba(158,59,46,0.2); border:1px solid rgba(158,59,46,0.55); font-family:var(--sym-mono); font-size:12px; letter-spacing:2px; color:#E08577; transition:background .15s; }
.hg-leave-yes:hover { background:rgba(158,59,46,0.34); }
.hg-leave-no { padding:11px 32px; cursor:pointer; border-radius:4px; background:rgba(196,164,72,0.1); border:1px solid rgba(196,164,72,0.35); font-family:var(--sym-mono); font-size:12px; letter-spacing:2px; color:var(--sym-gold-lt); transition:background .15s; }
.hg-leave-no:hover { background:rgba(196,164,72,0.2); }
