:root {
  --bg: #0e0c09;
  --bg-2: #17130e;
  --panel: #1d1811;
  --panel-2: #262017;
  --border: #4a3d28;
  --border-hi: #7a6338;
  --text: #ece2cb;
  --muted: #a39477;
  --gold: #e0b354;
  --gold-hi: #f5cf78;
  --red: #e0533f;
  --green: #6fc25a;
  --radius: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(1200px 600px at 50% -10%, #2a2114 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 Inter, system-ui, sans-serif;
  overflow-x: hidden;
}
a { color: var(--gold); }
h1, h2, h3 { font-family: Cinzel, serif; margin: 0 0 .5em; letter-spacing: .02em; }
h3 { font-size: 15px; color: var(--gold); }
kbd {
  font: 600 12px Inter, sans-serif; padding: 1px 6px; border-radius: 4px;
  border: 1px solid var(--border-hi); background: var(--panel-2);
}
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; justify-content: center; }
.row { display: flex; align-items: center; }
.gap { gap: 10px; }
.grow { flex: 1; }
[hidden] { display: none !important; }

/* ---------- Buttons & inputs ---------- */
.btn {
  appearance: none; border: 1px solid var(--border-hi); background: var(--panel-2);
  color: var(--text); font: 600 15px Inter, sans-serif; padding: 11px 18px;
  border-radius: 8px; cursor: pointer; transition: background .15s, border-color .15s, transform .05s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover:not(:disabled) { border-color: var(--gold); background: #2f271b; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn small { font-weight: 500; color: var(--muted); font-size: 12px; }
.btn.primary {
  background: linear-gradient(#e7bb5c, #b98a2e); border-color: #f2d083; color: #1c1408;
}
.btn.primary small { color: #4a3612; }
.btn.primary:hover:not(:disabled) { background: linear-gradient(#f3c968, #c79634); }
.btn.ghost { background: transparent; }
.btn-stack { display: flex; flex-direction: column; gap: 10px; }

input, select {
  background: #0f0d0a; border: 1px solid var(--border); color: var(--text);
  font: 500 15px Inter, sans-serif; padding: 10px 12px; border-radius: 8px; outline: none;
}
input:focus, select:focus { border-color: var(--gold); }

.screen { display: none; }
.screen.active { display: block; }

/* ---------- Home ---------- */
#home { max-width: 1040px; margin: 0 auto; padding: 48px 16px 32px; }
.hero { text-align: center; margin-bottom: 28px; }
.logo {
  font-size: clamp(40px, 8vw, 68px); font-weight: 800; margin: 0;
  color: var(--text); text-shadow: 0 3px 0 #000, 0 0 30px rgba(224, 179, 84, .25);
}
.logo span { color: var(--gold); }
.tagline { color: var(--muted); font-size: 17px; margin: 6px 0 14px; }
.stats { display: inline-flex; gap: 18px; font-size: 13px; color: var(--muted); }
.stats b { color: var(--green); }
.stats > span::before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--green); margin-right: 6px; vertical-align: 1px; box-shadow: 0 0 8px var(--green);
}

.name-row { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 26px; flex-wrap: wrap; }
.name-row label { color: var(--muted); font-size: 13px; }
.name-row input { width: 240px; text-align: center; font-weight: 600; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.card, .panel {
  background: linear-gradient(var(--panel), var(--bg-2)); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.card { display: flex; flex-direction: column; gap: 12px; }
.card h2 { font-size: 20px; margin: 0; }
.card p { margin: 0; color: var(--muted); font-size: 14px; flex: 1; }
.card.featured { border-color: var(--border-hi); box-shadow: var(--shadow), inset 0 0 0 1px rgba(224, 179, 84, .08); }
.join-row { display: flex; gap: 8px; }
.join-row input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: .2em; font-weight: 700; text-align: center; }

.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.settings label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.settings select { width: 100%; padding: 8px 10px; font-size: 14px; }
.settings select:disabled { opacity: .75; }

.howto { margin-top: 28px; padding: 18px 22px; border: 1px dashed var(--border); border-radius: var(--radius); }
.howto ol { margin: 0; padding-left: 20px; color: var(--muted); }
.howto li { margin: 4px 0; }
.foot { margin-top: 24px; text-align: center; font-size: 12px; color: #7a6d55; }

/* ---------- Lobby ---------- */
#lobby { padding: 48px 16px; }
.lobby-wrap { max-width: 900px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.lobby-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.code { font: 800 40px Cinzel, serif; letter-spacing: .18em; color: var(--gold); line-height: 1; }
.player-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.player-list li {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px;
  background: var(--panel-2); border: 1px solid var(--border);
}
.player-list .tag { margin-left: auto; font-size: 11px; color: var(--gold); text-transform: uppercase; letter-spacing: .08em; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px rgba(0,0,0,.5); }
#lobby .settings { margin-bottom: 14px; }

/* ---------- Game ---------- */
#game.active { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 10px 16px;
  background: var(--bg-2); border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.round-info { font-size: 16px; }
.round-info b { color: var(--gold); font-size: 20px; }
.timer {
  font: 700 22px Inter, sans-serif; font-variant-numeric: tabular-nums;
  padding: 2px 14px; border-radius: 6px; background: #0b0907; border: 1px solid var(--border); min-width: 92px; text-align: center;
}
.timer.low { color: var(--red); border-color: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 12px rgba(224, 83, 63, .6); } }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.chip {
  display: flex; align-items: center; gap: 7px; padding: 4px 10px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--border); font-size: 13px;
}
.chip b { color: var(--gold); font-variant-numeric: tabular-nums; }
.chip.guessed { border-color: var(--green); }
.chip.guessed::after { content: "✓"; color: var(--green); font-weight: 700; }
.chip.gone { opacity: .45; text-decoration: line-through; }

.play-area { flex: 1; display: grid; grid-template-columns: minmax(280px, 38%) 1fr; min-height: 0; }
.clue-panel {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 20px; gap: 12px; border-right: 1px solid var(--border); background: #0b0907; min-height: 0;
}
.clue-frame {
  position: relative; width: 100%; max-width: 560px;
  border: 3px solid #5d4b2c; border-radius: 4px;
  box-shadow: 0 0 0 1px #000, 0 0 0 4px #2a2114, var(--shadow);
  background: #000; line-height: 0;
}
.clue-frame img { width: 100%; height: auto; image-rendering: pixelated; image-rendering: crisp-edges; display: block; }
/* Wheel zoom on the minimap: the picture grows around its centre and the frame crops it. */
.clue-frame { overflow: hidden; }
.clue-zoom { position: relative; transform-origin: 50% 50%; transition: transform .08s ease-out; }
.crosshair { position: absolute; pointer-events: none; }
.crosshair::before, .crosshair::after { content: ""; position: absolute; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.6); }
.crosshair::before { left: -25%; right: -25%; top: 42%; height: 16%; }
.crosshair::after { top: -25%; bottom: -25%; left: 42%; width: 16%; }
.clue-caption { margin: 0; color: var(--muted); font-size: 14px; text-align: center; }

.map-panel { position: relative; min-height: 0; }
#map { position: absolute; inset: 0; background: #000; }
.leaflet-container { font: 13px Inter, sans-serif; }
.leaflet-image-layer { image-rendering: pixelated; image-rendering: crisp-edges; }
.leaflet-control-attribution { background: rgba(0,0,0,.6) !important; color: var(--muted) !important; }
.leaflet-control-attribution a { color: var(--gold) !important; }
.leaflet-bar a { background: var(--panel-2) !important; color: var(--text) !important; border-color: var(--border) !important; }

.floor-ctl {
  position: absolute; top: 12px; right: 12px; z-index: 500; display: flex; flex-direction: column;
  background: rgba(23, 19, 14, .92); border: 1px solid var(--border-hi); border-radius: 8px; overflow: hidden;
}
.floor-ctl button {
  appearance: none; border: 0; background: transparent; color: var(--gold); font-size: 14px; padding: 7px 0; cursor: pointer;
}
.floor-ctl button:hover:not(:disabled) { background: #2f271b; }
.floor-ctl button:disabled { opacity: .3; cursor: default; }
.floor-label { display: flex; flex-direction: column; align-items: center; padding: 2px 12px; border-block: 1px solid var(--border); }
.floor-label b { font: 800 20px Cinzel, serif; line-height: 1.2; }
.floor-label small { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
.coords {
  position: absolute; left: 12px; top: 12px; z-index: 500; padding: 4px 10px; border-radius: 6px;
  background: rgba(0,0,0,.7); font: 600 12px Inter, monospace; color: var(--muted); font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.coords:empty { display: none; }
.guess-btn {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 500;
  min-width: 260px; box-shadow: var(--shadow);
}
.guess-btn:active:not(:disabled) { transform: translateX(-50%) translateY(1px); }

.pin { width: 18px; height: 18px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.7); }
.pin.me { animation: drop .25s ease-out; }
@keyframes drop { from { transform: translateY(-10px) scale(1.3); opacity: 0; } }
.pin-label {
  position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); margin-bottom: 4px; white-space: nowrap;
  font: 600 11px Inter, sans-serif; background: rgba(0,0,0,.8); color: #fff; padding: 1px 6px; border-radius: 4px;
}
.goal {
  width: 30px; height: 30px; display: grid; place-items: center; font-size: 18px;
  background: var(--gold); border: 3px solid #fff; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  box-shadow: 0 0 0 2px #000, 0 0 18px rgba(245, 207, 120, .9);
}
.goal span { transform: rotate(45deg); }

.results {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 600;
  width: min(560px, calc(100% - 24px)); max-height: 60%; overflow: auto;
  background: rgba(23, 19, 14, .96); border: 1px solid var(--border-hi); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px;
  animation: rise .25s ease-out;
}
@keyframes rise { from { transform: translate(-50%, 20px); opacity: 0; } }
.results-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.res-title { font: 800 22px Cinzel, serif; color: var(--gold); }
.res-loc { text-align: right; font-size: 13px; color: var(--muted); }
.res-loc b { color: var(--text); display: block; font-size: 15px; }
.res-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.res-list li { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px; padding: 6px 10px; background: var(--panel-2); border-radius: 6px; }
.res-list .dist { color: var(--muted); font-size: 13px; }
.res-list .pts { font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; min-width: 64px; text-align: right; }
.bar { grid-column: 1 / -1; height: 4px; background: #0b0907; border-radius: 2px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #b98a2e, var(--gold-hi)); }

/* ---------- Final ---------- */
#final { padding: 48px 16px; }
.final-wrap { max-width: 760px; margin: 0 auto; }
.final-title { text-align: center; font-size: 32px; color: var(--gold); }
.podium { list-style: none; margin: 0 0 20px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.podium li {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 8px;
  background: var(--panel-2); border: 1px solid var(--border);
}
.podium li:first-child { border-color: var(--gold); background: linear-gradient(90deg, rgba(224,179,84,.15), var(--panel-2)); }
.podium .rank { font: 800 20px Inter, sans-serif; width: 28px; color: var(--muted); }
.podium li:first-child .rank { color: var(--gold); }
.podium .score { margin-left: auto; font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; margin-bottom: 16px; }
.breakdown { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.breakdown th, .breakdown td { padding: 7px 10px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
.breakdown th:first-child, .breakdown td:first-child { text-align: left; }
.breakdown th { color: var(--muted); font-weight: 600; }
.breakdown td.best { color: var(--gold); font-weight: 700; }

/* ---------- Overlays ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center;
  background: rgba(5, 4, 3, .78); backdrop-filter: blur(3px); padding: 16px;
}
.overlay-box {
  background: linear-gradient(var(--panel), var(--bg-2)); border: 1px solid var(--border-hi);
  border-radius: var(--radius); padding: 30px 36px; text-align: center; box-shadow: var(--shadow); min-width: min(340px, 100%);
}
.overlay-box h2 { font-size: 22px; }
.spinner {
  width: 46px; height: 46px; margin: 0 auto 16px; border-radius: 50%;
  border: 4px solid var(--border); border-top-color: var(--gold); animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.big-count { font: 800 72px Cinzel, serif; color: var(--gold); line-height: 1.1; }

.toasts { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 3000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: var(--panel); border: 1px solid var(--border-hi); padding: 9px 16px; border-radius: 8px;
  box-shadow: var(--shadow); font-weight: 500; animation: rise2 .2s ease-out;
}
.toast.error { border-color: var(--red); }
@keyframes rise2 { from { transform: translateY(-8px); opacity: 0; } }

/* ---------- Responsive ---------- */
@media (max-width: 800px) {
  .lobby-wrap { grid-template-columns: 1fr; }
  .play-area { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .clue-panel { border-right: 0; border-bottom: 1px solid var(--border); padding: 10px 16px; }
  .clue-frame { max-width: 340px; }
  .clue-caption { display: none; }
  .map-panel { min-height: 320px; }
  .chips { margin-left: 0; width: 100%; }
  .guess-btn { min-width: 0; width: calc(100% - 32px); }
  .settings { grid-template-columns: 1fr 1fr; }
}

/* The guess button sits on top of a busy map, so keep it readable while disabled. */
.guess-btn:disabled { opacity: 1; background: rgba(23, 19, 14, .92); border-color: var(--border-hi); color: var(--muted); }

/* Scrollable minimap clue */
.clue-frame.movable { cursor: grab; touch-action: none; user-select: none; }
.clue-frame.movable.dragging { cursor: grabbing; }
.clue-frame img { -webkit-user-drag: none; pointer-events: none; }
.crosshair.other-floor { opacity: .35; }
.clue-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.clue-offset { min-width: 110px; text-align: center; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 800px) { .clue-tools { gap: 6px; } .clue-offset { min-width: 0; } }

/* Shown when the page is opened without the game server */
.server-missing {
  max-width: 720px; margin: 24px auto 0; padding: 14px 18px; border-radius: var(--radius);
  border: 1px solid var(--red); background: rgba(224, 83, 63, .12); line-height: 1.6;
}
.server-missing b { display: block; color: var(--red); }
.server-missing code { background: #0b0907; padding: 1px 6px; border-radius: 4px; }

/* ---------- Accounts, leaderboard, daily, profiles ---------- */
.win { color: var(--green); font-weight: 700; }
.loss { color: var(--red); font-weight: 700; }
.tick { color: var(--green); font-size: 12px; }
.plink { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--border-hi); }
.plink:hover { color: var(--gold-hi); border-color: var(--gold); }

.account {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 16px;
  margin: 0 auto 22px; padding: 14px 18px;
}
.avatar {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; flex: none;
  background: linear-gradient(135deg, #3a2e1c, #1a140c); border: 2px solid var(--border-hi);
  font: 800 20px Cinzel, serif; color: var(--gold);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
/* The default avatar is the outfit sprite on its own: no circle, frame or background. */
.avatar:has(img.outfit) { border: 0; border-radius: 0; background: none; overflow: visible; }
.avatar img.outfit { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.avatar.big { width: 64px; height: 64px; font-size: 28px; }
.acc-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.acc-main input { width: 100%; max-width: 280px; font-weight: 600; }
.acc-rating { text-align: center; padding: 0 8px; }
.acc-rating .rating { font: 800 26px Inter, sans-serif; color: var(--gold); line-height: 1.1; font-variant-numeric: tabular-nums; }
.acc-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.signin, .signed-in { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }


.card.daily { border-color: #3d5a2a; }
.mini-board { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; counter-reset: mb; font-size: 13px; }
.mini-board li { display: flex; gap: 8px; align-items: center; padding: 3px 8px; border-radius: 5px; background: var(--panel-2); }
.mini-board li:not(.muted)::before { counter-increment: mb; content: counter(mb); color: var(--muted); width: 16px; }
.mini-board li b { margin-left: auto; color: var(--gold); font-variant-numeric: tabular-nums; }
.mini-board li.me, .lb-table tr.me td { background: rgba(224, 179, 84, .12); }
.mini-board li.muted { background: none; padding-left: 0; }

.leaderboard { margin-top: 22px; }
.lb-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.lb-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.lb-table th, .lb-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.lb-table th { color: var(--muted); font-weight: 600; font-size: 12px; }
.lb-table td:first-child { color: var(--muted); width: 36px; }
.lb-table tr:nth-child(2) td:first-child { color: var(--gold); font-weight: 800; }

.profile-box { position: relative; text-align: left; width: min(560px, 100%); max-height: 88vh; overflow: auto; }
.close-x {
  position: absolute; top: 10px; right: 12px; background: none; border: 0; color: var(--muted);
  font-size: 26px; line-height: 1; cursor: pointer;
}
.close-x:hover { color: var(--text); }
.profile-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.profile-head h2 { margin: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 18px; }
.stat { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px; text-align: center; }
.stat b { display: block; font-size: 20px; color: var(--gold); font-variant-numeric: tabular-nums; }
.stat span { font-size: 11px; color: var(--muted); }
.match-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.match-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px; background: var(--panel-2); border-radius: 6px; }
.match-list .mres { display: flex; gap: 8px; align-items: center; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* HP duels */
.hpbar { width: 54px; height: 6px; border-radius: 3px; background: #3a1712; overflow: hidden; display: inline-block; }
.hpbar i { display: block; height: 100%; background: linear-gradient(90deg, #c0392b, #6fc25a); transition: width .6s ease; }
.chip.out { opacity: .5; }
.chip.out::after { content: "KO"; color: var(--red); font-weight: 800; font-size: 11px; }
.mult { font-weight: 800; color: var(--red); border: 1px solid var(--red); padding: 2px 8px; border-radius: 999px; font-size: 13px; }
.res-list .dmg { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.res-list .dmg.hit { color: #ff8a75; }

.final-sub { text-align: center; margin: -6px 0 16px; color: var(--muted); }
.final-sub b { color: var(--text); }
.daily-final { margin: 0 0 18px; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.daily-final h3 { margin: 8px 0 0; }
.daily-final .mini-board { width: 100%; max-width: 380px; }
.share {
  margin: 0; padding: 10px 16px; background: #0b0907; border: 1px solid var(--border); border-radius: 8px;
  font: 600 14px Inter, sans-serif; text-align: center; white-space: pre-wrap;
}

@media (max-width: 800px) {
  .account { grid-template-columns: auto 1fr; }
  .acc-rating { text-align: left; padding: 0; }
  .acc-actions { grid-column: 1 / -1; align-items: stretch; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Language picker, exit button, confirm dialog */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.lang-row { display: flex; flex-wrap: wrap; justify-content: flex-end; margin: -28px 0 8px; }
/* Sign-in: a small label and two matching round buttons, or a "signed in" chip once linked. */
.lang-row .signin, .lang-row .signed-in {
  flex-wrap: nowrap; gap: 6px; padding: 3px 4px 3px 12px; border-radius: 999px;
  background: rgba(0, 0, 0, .28); border: 1px solid rgba(224, 179, 84, .28);
}
.signin-label { font: 600 12px Inter, sans-serif; color: var(--muted, #a99a7c); letter-spacing: .02em; }
.auth-btn {
  width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; overflow: hidden;
  padding: 0; border: 1px solid transparent; cursor: pointer; transition: transform .12s, box-shadow .12s, filter .12s;
}
.auth-btn:hover { transform: translateY(-1px); box-shadow: 0 2px 10px rgba(0, 0, 0, .45), 0 0 0 2px rgba(224, 179, 84, .35); }
.auth-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.auth-btn.discord { background: #5865f2; color: #fff; border-color: #7983f5; }
.auth-btn.discord:hover { filter: brightness(1.1); }
.auth-btn.google { background: #fff; border-color: #dadce0; position: relative; }
/* Google's real button sits on top, invisible, so the click still goes through Google; our circle is what shows. */
.auth-btn.google .g-real { position: absolute; inset: 0; opacity: .01; display: grid; place-items: center; overflow: hidden; border-radius: 50%; }
.verified-badge { font: 600 12px Inter, sans-serif; color: var(--green); white-space: nowrap; }
.signout-btn {
  font: 600 12px Inter, sans-serif; color: var(--text); background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .12); border-radius: 999px; padding: 6px 12px; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.signout-btn:hover { background: rgba(224, 179, 84, .14); border-color: rgba(224, 179, 84, .45); }
.lang-pick { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.lang-pick select { padding: 6px 10px; font-size: 13px; }
.exit-btn { flex: none; }
.btn.danger { background: linear-gradient(#d9573f, #a83a26); border-color: #f08a73; color: #fff; }
.btn.danger:hover:not(:disabled) { background: linear-gradient(#e6664e, #b8432d); }
.confirm-box { max-width: 440px; }
.confirm-box p { color: var(--muted); margin: 0 0 20px; line-height: 1.55; }

/* ---------- Game switcher ---------- */
.game-tabs {
  display: flex; gap: 6px; margin: 0 auto 18px; padding: 5px; width: fit-content; max-width: 100%;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px;
}
.game-tabs button {
  appearance: none; border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font: 600 15px Inter, sans-serif; padding: 9px 18px; border-radius: 8px; white-space: nowrap;
}
.game-tabs button:hover { color: var(--text); }
.game-tabs button.active { background: linear-gradient(#e7bb5c, #b98a2e); color: #1c1408; }
.cards.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/* ---------- Guess the Item ---------- */
#itemGame.active { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.attempts { display: flex; gap: 6px; margin-left: auto; }
.att { width: 22px; height: 22px; border-radius: 5px; border: 1px solid var(--border-hi); background: #0b0907; }
.att.current { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(224, 179, 84, .25); }
.att.wrong { background: #b8432d; border-color: #e0533f; }
.att.close { background: #c9a227; border-color: #f2d24b; }
.att.skip { background: #3a3326; }
.att.right { background: #4c9a3b; border-color: var(--green); }

.item-wrap {
  flex: 1; display: grid; grid-template-columns: minmax(260px, 420px) minmax(0, 560px); gap: 28px;
  justify-content: center; align-items: start; padding: 28px 16px;
}
.item-left { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.item-frame {
  width: min(100%, 360px); aspect-ratio: 1; display: grid; place-items: center; border-radius: 12px;
  border: 3px solid #5d4b2c; box-shadow: 0 0 0 1px #000, 0 0 0 4px #2a2114, var(--shadow);
  background-color: #2b261d;
  background-image: linear-gradient(45deg, #332d22 25%, transparent 25%, transparent 75%, #332d22 75%),
                    linear-gradient(45deg, #332d22 25%, transparent 25%, transparent 75%, #332d22 75%);
  background-size: 24px 24px; background-position: 0 0, 12px 12px;
}
.item-frame img { width: 78%; height: 78%; object-fit: contain; image-rendering: pixelated; image-rendering: crisp-edges; }
.item-right { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.clues { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.clues li {
  padding: 9px 12px; border-radius: 8px; background: var(--panel); border: 1px solid var(--border);
  font-size: 14px; line-height: 1.5; overflow-wrap: anywhere;
}
.clues li b { color: var(--gold); font-weight: 600; }
.clues li.new { animation: clueIn .5s ease-out; border-color: var(--gold); }
@keyframes clueIn { from { opacity: 0; transform: translateY(-4px); background: #3a2e18; } }
.pattern { font: 700 16px ui-monospace, Consolas, monospace; letter-spacing: .12em; color: var(--text); white-space: pre-wrap; }

.item-form { display: flex; flex-direction: column; gap: 10px; }
.ac-wrap { position: relative; }
.ac-wrap input { width: 100%; font-size: 16px; padding: 12px 14px; }
.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 50; list-style: none; margin: 0; padding: 4px;
  background: var(--panel); border: 1px solid var(--border-hi); border-radius: 8px; box-shadow: var(--shadow); max-height: 320px; overflow: auto;
}
.suggest li { padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.suggest li.active, .suggest li:hover { background: #2f271b; }
.suggest mark { background: none; color: var(--gold-hi); font-weight: 700; }

.guess-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.guess-list li { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 8px; border: 1px solid; font-weight: 600; }
.guess-list li.wrong { border-color: #8f3524; background: rgba(184, 67, 45, .15); }
.guess-list li.close { border-color: #a8871f; background: rgba(201, 162, 39, .15); }
.guess-list li.skip { border-color: var(--border); color: var(--muted); font-weight: 400; }
.guess-list li.right { border-color: var(--green); background: rgba(111, 194, 90, .15); }
.guess-list .tag { margin-left: auto; font-size: 11px; color: #f2d24b; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }

.item-end {
  padding: 16px 18px; border-radius: var(--radius); background: linear-gradient(var(--panel), var(--bg-2));
  border: 1px solid var(--border-hi); display: flex; flex-direction: column; gap: 10px;
}
.item-end-title { font: 800 24px Cinzel, serif; }
.item-end-title.win { color: var(--green); }
.item-end-title.loss { color: var(--red); }
.item-answer { font-size: 20px; font-weight: 700; }
.item-answer a { font-size: 13px; font-weight: 500; margin-left: 6px; }

@media (max-width: 800px) {
  .item-wrap { grid-template-columns: 1fr; padding: 16px; gap: 16px; }
  .item-frame { width: min(100%, 240px); }
  .game-tabs button { padding: 8px 12px; font-size: 14px; }
}

/* Item icons in the search list */
.suggest li { display: flex; align-items: center; gap: 10px; padding: 4px 10px; }
.suggest .ico { width: 32px; height: 32px; flex: none; image-rendering: pixelated; image-rendering: crisp-edges; object-fit: contain; }

/* ---------- Item of the Day history ---------- */
.items-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.history { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.history h3 { margin: 0; }
.hist-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.hist-stats div { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 4px; text-align: center; }
.hist-stats b { display: block; font-size: 18px; color: var(--gold); font-variant-numeric: tabular-nums; }
.hist-stats span { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.hist-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 520px; overflow: auto; }
.hist-row {
  display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "date emoji res" "item item item";
  gap: 4px 10px; align-items: center; padding: 8px 10px; border-radius: 8px; background: var(--panel-2);
  border: 1px solid var(--border); border-left-width: 4px;
}
.hist-row.solved { border-left-color: var(--green); }
.hist-row.failed { border-left-color: var(--red); }
.hist-row.progress { border-left-color: var(--gold); }
.hist-date { grid-area: date; font-size: 12px; color: var(--muted); white-space: nowrap; }
.hist-emoji { grid-area: emoji; font-size: 14px; letter-spacing: 1px; white-space: nowrap; }
.hist-res { grid-area: res; font-variant-numeric: tabular-nums; }
.hist-row.solved .hist-res { color: var(--green); }
.hist-row.failed .hist-res { color: var(--red); }
.hist-item { grid-area: item; display: flex; align-items: center; gap: 8px; font-size: 13px; min-width: 0; }
.hist-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-item .ico { width: 24px; height: 24px; image-rendering: pixelated; flex: none; }
.hist-empty { font-size: 13px; line-height: 1.5; }
.history.compact { width: min(100%, 360px); }
.history.compact .hist-list { max-height: none; }
@media (max-width: 960px) { .items-layout { grid-template-columns: 1fr; } }

/* ---------- Donations ---------- */
.lang-row { gap: 12px; align-items: center; }
.donate-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px;
  font: 600 13px Inter, sans-serif; text-decoration: none; color: #ffd6de;
  background: linear-gradient(#7a2a3a, #5a1d2a); border: 1px solid #b0475d; transition: filter .15s, transform .05s;
}
.donate-btn:hover { filter: brightness(1.15); }
.donate-btn:active { transform: translateY(1px); }
.donate-btn { padding: 3px 14px 3px 6px; }
.donate-ico { width: 32px; height: 32px; image-rendering: pixelated; image-rendering: crisp-edges; margin: -4px 0; }
.donate-btn[hidden], .donate-line[hidden] { display: none; }
.donate-line { margin: 4px 0 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 12px; font-size: 13px; color: var(--muted); text-align: center; }
.item-end .donate-line { justify-content: flex-start; text-align: left; }

/* ---------- Switching between the two games ---------- */
/* The old game slides out and fades, then the new one slides in from the other side. */
@keyframes slideOutLeft { to { opacity: 0; transform: translateX(-80px); } }
@keyframes slideOutRight { to { opacity: 0; transform: translateX(80px); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(80px); } }
@keyframes slideInLeft { from { opacity: 0; transform: translateX(-80px); } }
.slide-out-left { animation: slideOutLeft .22s ease-in forwards; pointer-events: none; }
.slide-out-right { animation: slideOutRight .22s ease-in forwards; pointer-events: none; }
.slide-in-right { animation: slideInRight .3s ease-out; }
.slide-in-left { animation: slideInLeft .3s ease-out; }
.tagline { transition: opacity .2s; }
#home { overflow-x: clip; }
@media (prefers-reduced-motion: reduce) {
  .slide-out-left, .slide-out-right, .slide-in-right, .slide-in-left { animation: none; }
}

/* ---------- Roles, admin panel, bans ---------- */
.role-badge {
  display: inline-block; vertical-align: 2px; margin-left: 4px; padding: 1px 6px; border-radius: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; border: 1px solid;
}
.role-badge.tester { color: #7cc4f0; border-color: #3d6f8f; background: rgba(79, 195, 247, .1); }
.role-badge.admin { color: var(--gold-hi); border-color: var(--border-hi); background: rgba(224, 179, 84, .12); }
.status-tag { font-size: 11px; font-weight: 600; margin-left: 4px; }
.status-tag.online { color: var(--green); }
.status-tag.banned { color: var(--red); }
.link-btn { background: none; border: 0; padding: 0; color: var(--gold); font: inherit; cursor: pointer; text-decoration: underline; }
.link-btn:hover { color: var(--gold-hi); }
code { font: 12px ui-monospace, Consolas, monospace; color: var(--text); word-break: break-all; }
.row.wrap { flex-wrap: wrap; }

.admin-box { width: min(1000px, 100%); }
.admin-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; padding-right: 28px; }
.admin-head h2 { margin: 0; }
.admin-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; margin-bottom: 8px; }
.admin-list form input { flex: 1; min-width: 0; }
.admin-list h3 { margin: 14px 0 6px; font-size: 15px; }
.admin-list .table-wrap { max-height: 360px; overflow-y: auto; margin-top: 10px; }
.admin-table td:first-child { color: var(--text); width: auto; }
.admin-table tr:nth-child(2) td:first-child { color: var(--text); font-weight: 400; }
.admin-row { cursor: pointer; }
.admin-row:hover td { background: rgba(224, 179, 84, .06); }
.admin-row.me td { background: rgba(224, 179, 84, .12); }
.admin-detail {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 14px;
  display: flex; flex-direction: column; gap: 6px; align-self: start;
}
.admin-detail h3 { margin: 0; }
.admin-detail h4 { margin: 10px 0 2px; font-size: 13px; color: var(--muted); }
.admin-detail .match-list li { background: var(--panel); }
.admin-act { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.admin-act input, .admin-act select { padding: 6px 10px; font-size: 14px; }
.admin-act input { flex: 1; min-width: 120px; }
.admin-ban-note { color: var(--red); font-size: 13px; border-left: 3px solid var(--red); padding-left: 8px; margin: 4px 0; }
#adminLog { max-height: 240px; overflow-y: auto; }
@media (max-width: 800px) {
  .admin-layout { grid-template-columns: minmax(0, 1fr); }
  .admin-box { padding: 24px 16px; }
}

/* Covers everything, including other overlays; there is no way to close it. */
.banned-overlay { z-index: 4000; }
.banned-overlay .overlay-box { max-width: 440px; }

/* ---------- Three game tabs: short labels on phones ---------- */
.game-tabs .tab-short { display: none; }
@media (max-width: 560px) {
  .game-tabs { gap: 4px; }
  .game-tabs button { padding: 8px 10px; font-size: 14px; }
  .game-tabs .tab-long { display: none; }
  .game-tabs .tab-short { display: inline; }
}

/* ---------- Puzzle points and leaderboards ---------- */
.board-tabs { display: flex; gap: 4px; padding: 3px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; width: fit-content; max-width: 100%; }
.board-tabs button {
  appearance: none; border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font: 600 12px Inter, sans-serif; padding: 5px 10px; border-radius: 6px; white-space: nowrap;
}
.board-tabs button:hover { color: var(--text); }
.board-tabs button.active { background: var(--panel-2); color: var(--gold); box-shadow: inset 0 0 0 1px var(--border-hi); }
.mini-board li .small { font-size: 11px; }
.board-mine { margin: 0; }
.hist-stats { grid-template-columns: repeat(5, 1fr); }
.hist-stats b { font-size: 16px; }
.hist-pts { margin-left: auto; color: var(--gold); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hist-pts small { color: var(--muted); font-weight: 500; }
.hist-item .ico { object-fit: contain; }
.item-points { font-size: 16px; }
.item-points b { color: var(--gold); }
.challenge-results h3 { margin: 4px 0 6px; font-size: 15px; }

/* ---------- Challenge a friend ---------- */
.challenge-invite { text-align: center; width: min(460px, 100%); }
.challenge-invite h2 { margin: 6px 0 4px; }
.challenge-invite .mini-board { text-align: left; margin: 12px 0; }
.challenge-kind { text-transform: uppercase; letter-spacing: .08em; }
.challenge-beat { font-size: 16px; margin: 4px 0; }
.challenge-beat b { color: var(--gold); }

/* ---------- Character page (laid out like a Tibia character page, in the site's colours) ---------- */
.tibia-page {
  position: relative; width: min(860px, 100%); max-height: 90vh; overflow: auto; padding: 0; text-align: left;
  background: linear-gradient(var(--panel), var(--bg-2)); font-size: 14px;
}
.tp-head {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: var(--bg-2); border-bottom: 1px solid var(--border-hi);
}
.tp-head h2 { margin: 0; font: 700 22px Cinzel, Georgia, serif; color: var(--gold); }
.tp-close { background: none; border: 0; color: var(--muted); font-size: 26px; line-height: 1; cursor: pointer; padding: 0 4px; }
.tp-close:hover { color: var(--text); }
.tp-body { padding: 16px; display: flex; flex-direction: column; gap: 18px; }
#charSections { display: flex; flex-direction: column; gap: 18px; }
.tp-box { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--panel); }
.tp-box h3 {
  margin: 0; padding: 8px 12px; background: var(--panel-2); color: var(--gold); font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.tp-rows { margin: 0; }
.tp-row { display: grid; grid-template-columns: 200px minmax(0, 1fr); background: var(--panel); }
.tp-row:nth-child(even) { background: var(--bg-2); }
.tp-row > span { padding: 6px 12px; overflow-wrap: anywhere; }
.tp-label { font-weight: 600; color: var(--muted); border-right: 1px solid var(--border); }
.tp-single { display: block; padding: 6px 12px; color: var(--muted); }
.tp-muted { color: var(--muted); font-size: 13px; }
.tp-date { font-weight: 400; white-space: nowrap; }
.tibia-page a, .tibia-page .link-btn { color: var(--gold); font-weight: 600; text-decoration: none; }
.tibia-page a:hover, .tibia-page .link-btn:hover { color: var(--gold-hi); text-decoration: underline; }
.tp-online { color: var(--green); font-weight: 600; font-size: 12px; }
.tp-win { color: var(--green); }
.tp-loss { color: var(--red); }
/* Achievement grade: one gold star per grade. */
.ach-stars { display: inline-flex; gap: 3px; vertical-align: middle; }
.ach-star {
  display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #4a3d28, #1d1811 75%); border: 1px solid var(--gold);
  color: var(--gold-hi); font-size: 12px; line-height: 1;
}
.tp-search { display: flex; align-items: center; gap: 10px; padding: 10px 12px; flex-wrap: wrap; }
.tp-search label { font-weight: 600; color: var(--muted); }
.tp-search input { flex: 1; min-width: 140px; padding: 7px 10px; font-size: 14px; }
@media (max-width: 600px) {
  .tp-row { grid-template-columns: 1fr; }
  .tp-label { border-right: 0; padding-bottom: 0 !important; }
  .tp-body { padding: 10px; }
}

/* ---------- Achievements page ---------- */
.ach-row:not(.done) .ach-stars { opacity: .45; filter: grayscale(.6); }
.ach-row.done { box-shadow: inset 3px 0 0 var(--gold); }
.ach-type { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 1px 6px; border-radius: 4px; border: 1px solid; }
.ach-type.g1 { color: #9fcf8a; border-color: #4f7a3f; }
.ach-type.g2 { color: #7cc4f0; border-color: #3d6f8f; }
.ach-type.g3 { color: #c79bf2; border-color: #6d4a8f; }
.ach-type.g4 { color: var(--gold-hi); border-color: var(--gold); background: rgba(224, 179, 84, .12); }
.ach-done { display: block; margin-top: 4px; color: var(--green); font-weight: 600; font-size: 13px; }
.ach-progress { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ach-bar { flex: 0 1 180px; height: 6px; border-radius: 3px; background: var(--bg); border: 1px solid var(--border); overflow: hidden; }
.ach-bar span { display: block; height: 100%; background: linear-gradient(90deg, #b98a2e, var(--gold)); }

/* ---------- Leaderboard medals and "Show more" ---------- */
/* Trophy sprites for places 1-3, and the item icons of the three games (tabs, character page). */
.medal { width: 22px; height: 22px; vertical-align: -6px; image-rendering: pixelated; }
.rank-pos .medal { width: 30px; height: 30px; vertical-align: -5px; }
.game-ico { width: 24px; height: 24px; vertical-align: -6px; image-rendering: pixelated; }
.rank-game .game-ico { width: 20px; height: 20px; vertical-align: -5px; }
.lb-more { display: block; margin: 0 auto 4px; }

/* ---------- Character page: place on each game's leaderboard ---------- */
.rank-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 12px; }
.rank-card {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px 10px; text-align: center;
  display: flex; flex-direction: column; gap: 4px;
}
.rank-card.top1 { border-color: var(--gold); box-shadow: inset 0 0 0 1px rgba(224, 179, 84, .35); }
.rank-card.top2 { border-color: #b8b8c8; }
.rank-card.top3 { border-color: #c08454; }
.rank-game { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.rank-pos { font: 700 26px Cinzel, Georgia, serif; color: var(--gold); font-variant-numeric: tabular-nums; }
.rank-sub { font-size: 12px; color: var(--muted); }

/* ---------- Higher or Lower ---------- */
#hlGame.active { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.hl-streak { margin-left: auto; color: var(--muted); font-weight: 600; }
.hl-streak b { color: var(--gold); font-size: 20px; margin-left: 4px; font-variant-numeric: tabular-nums; }
.hl-wrap { width: min(820px, 100%); margin: 0 auto; padding: 24px 16px; display: flex; flex-direction: column; gap: 18px; align-items: center; overflow-x: clip; }
.hl-question { margin: 0; text-align: center; font-size: 22px; }
.hl-arena { display: grid; grid-template-columns: 1fr auto 1fr; gap: 18px; align-items: center; width: 100%; }
.hl-vs { font: 800 26px Cinzel, serif; color: var(--muted); }
.hl-card {
  background: linear-gradient(var(--panel), var(--bg-2)); border: 1px solid var(--border-hi); border-radius: var(--radius);
  padding: 18px 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; min-height: 250px;
  transition: border-color .2s, box-shadow .2s;
}
.hl-card.right { border-color: var(--green); box-shadow: 0 0 0 2px rgba(111, 194, 90, .35); }
.hl-card.wrong { border-color: var(--red); box-shadow: 0 0 0 2px rgba(224, 83, 63, .35); }
.hl-sprite { width: 128px; height: 128px; object-fit: contain; image-rendering: pixelated; }
.hl-name { font-weight: 700; font-size: 18px; }
.hl-value { font: 800 34px Cinzel, serif; color: var(--gold); font-variant-numeric: tabular-nums; }
.hl-card.right .hl-value { color: var(--green); }
.hl-card.wrong .hl-value { color: var(--red); }
.hl-stat { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.hl-buttons { display: flex; gap: 12px; }
.hl-btn { min-width: 150px; font-size: 17px; padding: 12px 20px; }
.hl-end { width: min(420px, 100%); align-items: center; text-align: center; }
.hl-bests { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 12px; }
.hl-bests div { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 4px; text-align: center; }
.hl-bests b { display: block; font-size: 22px; color: var(--gold); font-variant-numeric: tabular-nums; }
.hl-bests span { font-size: 11px; color: var(--muted); }
.hl-bests small { display: block; font-size: 11px; color: var(--muted); }
.hl-howto { margin: 0; }
@media (max-width: 600px) {
  .hl-arena { gap: 8px; }
  .hl-card { min-height: 0; padding: 12px 6px; }
  .hl-sprite { width: 80px; height: 80px; }
  .hl-value { font-size: 24px; }
  .hl-name { font-size: 15px; }
  .hl-vs { font-size: 16px; }
  .hl-btn { min-width: 0; flex: 1; }
  .hl-buttons { width: 100%; }
}

/* Four squares on the character page now (2 × 2 on narrow screens). */
.rank-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 760px) { .rank-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Four tabs on a phone: smaller icons and padding so they fit in one row. */
@media (max-width: 560px) {
  .game-tabs { gap: 2px; padding: 4px; }
  .game-tabs button { padding: 7px 7px; font-size: 13px; }
  .game-tabs .game-ico { width: 20px; height: 20px; vertical-align: -5px; }
}

/* ---------- Terms / Privacy ---------- */
.legal-links { display: flex; justify-content: center; gap: 10px; margin: 4px 0 24px; font-size: 12px; color: var(--muted); }
.legal-links a { color: var(--muted); text-decoration: none; }
.legal-links a:hover { color: var(--gold); text-decoration: underline; }
.legal { max-width: 760px; margin: 0 auto; padding: 32px 16px 64px; line-height: 1.6; font-size: 15px; }
.legal h1 { font-family: Cinzel, serif; color: var(--gold); font-size: 32px; margin: 8px 0 4px; }
.legal h2 { font-family: Cinzel, serif; color: var(--gold-hi); font-size: 20px; margin: 28px 0 8px; }
.legal h3 { font-size: 15px; margin: 16px 0 4px; }
.legal ul { padding-left: 22px; }
.legal li { margin: 4px 0; }
.legal code { font-size: 13px; background: rgba(255, 255, 255, .06); padding: 1px 5px; border-radius: 4px; }
