:root {
  --bg: #0b1118;
  --panel: rgba(16, 24, 33, 0.94);
  --panel-solid: #101821;
  --line: #243243;
  --text: #e6edf3;
  --muted: #8b9bab;
  --accent: #f0b429;
  --accent-ink: #1a1400;
  --good: #3fb97f;
  --war: #e5534b;
  --offer: #58a6ff;
  --radius: 10px;
  --font: 'Inter', system-ui, sans-serif;
  --display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--display); letter-spacing: .04em; margin: 0; }

button {
  background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px;
  padding: 8px 14px; font-weight: 600; cursor: pointer; transition: filter .15s, transform .05s;
}
button:hover { filter: brightness(1.08); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .4; cursor: not-allowed; filter: none; }
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
button.ghost:hover { border-color: var(--muted); }
button.war { background: var(--war); color: #fff; }
button.good { background: var(--good); color: #04140c; }
button.small { padding: 4px 10px; font-size: 12px; }
input {
  background: #0d151e; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; outline: none;
}
input:focus { border-color: var(--accent); }
.muted { color: var(--muted); }

/* ---------- lobby ---------- */
#lobby {
  min-height: 100%;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(240,180,41,.10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(88,166,255,.08), transparent 60%),
    var(--bg);
}
.lobby-inner { max-width: 940px; margin: 0 auto; padding: 48px 16px 64px; }
.brand h1 { font-size: clamp(40px, 9vw, 88px); line-height: .9; color: var(--accent); }
.brand p { color: var(--muted); max-width: 560px; margin: 10px 0 28px; }
.field { display: flex; flex-direction: column; gap: 6px; max-width: 320px; margin-bottom: 28px; }
.field span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
#lobby h2 { font-size: 22px; margin: 8px 0 12px; }
.map-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 28px; }
.map-card {
  background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px;
  cursor: pointer; text-align: left; color: var(--text); display: flex; flex-direction: column; gap: 6px;
}
.map-card canvas { width: 100%; aspect-ratio: 16 / 10; border-radius: 6px; background: #0e2233; display: block; }
.map-card b { font-family: var(--display); font-size: 20px; letter-spacing: .04em; }
.map-card small { color: var(--muted); }
.map-card.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.server-head { display: flex; align-items: center; justify-content: space-between; }
.room-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.room {
  display: grid; grid-template-columns: 1fr auto auto auto; gap: 14px; align-items: center;
  background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px;
}
.room .players { font-variant-numeric: tabular-nums; }
.private-row { display: flex; gap: 8px; flex-wrap: wrap; }
.private-row input { flex: 1; min-width: 200px; }

/* ---------- game ---------- */
#game { position: fixed; inset: 0; overflow: hidden; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#map.dragging { cursor: grabbing; }
#map.targeting { cursor: crosshair; }

#topbar {
  position: absolute; top: 10px; left: 10px; right: 10px; display: flex; gap: 6px; align-items: stretch; flex-wrap: wrap;
  pointer-events: none;
}
#topbar > * { pointer-events: auto; }
.tb-country, .tb-stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 12px;
  display: flex; align-items: center; gap: 8px; backdrop-filter: blur(6px);
}
.tb-country { font-family: var(--display); font-size: 20px; letter-spacing: .04em; cursor: pointer; }
.swatch { width: 14px; height: 14px; border-radius: 4px; background: var(--muted); display: inline-block; flex: none; }
.tb-stat { flex-direction: column; align-items: flex-start; gap: 0; min-width: 92px; }
.tb-stat small { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.tb-stat b { font-variant-numeric: tabular-nums; font-weight: 600; }
.tb-stat i { font-style: normal; font-size: 11px; color: var(--good); }
.tb-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.tb-actions button { padding: 8px 12px; }

#panel {
  position: absolute; top: 74px; right: 10px; width: 340px; max-height: calc(100% - 150px); overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
  backdrop-filter: blur(6px);
}
#panel .close { position: absolute; top: 8px; right: 8px; background: transparent; color: var(--muted); font-size: 22px; padding: 0 8px; }
#panel h3 { font-size: 24px; display: flex; align-items: center; gap: 8px; padding-right: 24px; }
#panel h4 { margin: 16px 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.sub { color: var(--muted); margin: 2px 0 10px; font-size: 13px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; font-size: 13px; }
.kv span:nth-child(odd) { color: var(--muted); }
.kv span:nth-child(even) { font-variant-numeric: tabular-nums; text-align: right; }
.row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.row > button { flex: 1; }
.tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.tag.war { color: var(--war); border-color: var(--war); }
.tag.ally { color: var(--good); border-color: var(--good); }
.tag.player { color: var(--offer); border-color: var(--offer); }
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { flex: 1; background: transparent; color: var(--muted); border-radius: 0; padding: 6px 4px; font-size: 12px; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
input[type=range] { width: 100%; padding: 0; accent-color: var(--accent); border: 0; background: none; }
.cost { font-size: 12px; color: var(--muted); }
.cost.bad { color: var(--war); }
.bar { height: 6px; background: #1b2633; border-radius: 3px; overflow: hidden; margin-top: 4px; }
.bar > div { height: 100%; background: var(--accent); }
.list { display: flex; flex-direction: column; gap: 4px; }
.list .item {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; border: 1px solid transparent;
}
.list .item:hover { background: #17222e; border-color: var(--line); }
.list .item .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .item small { color: var(--muted); font-variant-numeric: tabular-nums; }
.tech { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px; }
.tech .pips { display: flex; gap: 3px; margin: 6px 0; }
.tech .pips i { flex: 1; height: 5px; border-radius: 2px; background: #1f2b38; }
.tech .pips i.on { background: var(--accent); }

#selBar {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px;
}
#selInfo { padding: 0 6px; font-variant-numeric: tabular-nums; }

#chat { position: absolute; left: 10px; bottom: 10px; width: 330px; max-width: calc(100% - 20px); display: flex; flex-direction: column; gap: 6px; }
#chatLog {
  max-height: 180px; overflow: auto; display: flex; flex-direction: column; gap: 2px; font-size: 13px;
  background: linear-gradient(to top, rgba(11,17,24,.85), rgba(11,17,24,.35)); border-radius: var(--radius); padding: 8px 10px;
}
#chatLog:empty { display: none; }
#chatLog b { font-weight: 600; }
#chatInput { width: 100%; background: var(--panel); }

#hint {
  position: absolute; bottom: 70px; left: 50%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 14px; font-size: 13px; color: var(--muted); pointer-events: none; white-space: nowrap;
}
#hint:empty { display: none; }

#toasts { position: absolute; top: 74px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast {
  background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--muted); border-radius: 8px; padding: 8px 14px;
  max-width: min(520px, 90vw); animation: toastIn .2s ease-out;
}
.toast.good { border-left-color: var(--good); }
.toast.war, .toast.error { border-left-color: var(--war); }
.toast.offer { border-left-color: var(--offer); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-6px); } }

#offers { position: absolute; right: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 8px; width: 320px; }
.offer { background: var(--panel); border: 1px solid var(--offer); border-radius: var(--radius); padding: 10px 12px; }

#overlay {
  position: absolute; inset: 0; background: rgba(5,9,13,.6); display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal { background: var(--panel-solid); border: 1px solid var(--line); border-radius: 14px; padding: 20px; width: min(460px, 100%); max-height: 86vh; overflow: auto; }
.modal h3 { font-size: 28px; margin-bottom: 4px; }
.modal input { width: 100%; margin: 10px 0; }

@media (max-width: 720px) {
  #panel { left: 10px; right: 10px; width: auto; top: auto; bottom: 10px; max-height: 55%; }
  #chat { width: 240px; }
  #chatLog { max-height: 110px; }
  .tb-stat { min-width: 0; padding: 4px 8px; }
  .tb-actions button { padding: 6px 8px; font-size: 12px; }
  .room { grid-template-columns: 1fr auto; }
  #offers { width: auto; left: 10px; }
}

/* ---------- v2: flags, menu, players, tables, tech ---------- */
img.flag { width: 22px; height: 15px; object-fit: cover; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.4); flex: none; background: #1b2633; }
img.flag:not([src]), img.flag[src=""] { visibility: hidden; }
.lobby-row { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 28px; }
.lobby-row .field { margin-bottom: 0; }
.profile { color: var(--muted); font-size: 13px; padding-bottom: 8px; }
.profile b { color: var(--accent); }

#menu {
  position: absolute; top: 74px; left: 10px; display: flex; flex-direction: column; gap: 6px; z-index: 2;
}
#menu button { background: var(--panel); color: var(--text); border: 1px solid var(--line); text-align: left; min-width: 86px; }
#menu button.on { border-color: var(--accent); color: var(--accent); }

#leftcol { position: absolute; left: 10px; bottom: 10px; width: 330px; max-width: calc(100% - 20px); display: flex; flex-direction: column; gap: 8px; }
#chat { position: static; width: auto; }
#players { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; font-size: 12px; max-height: 190px; overflow: auto; }
#players:empty { display: none; }
#players .p { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
#players .p .rank { color: var(--accent); }
#players .p .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#selBar { flex-wrap: wrap; justify-content: center; max-width: calc(100% - 20px); }
.amount-row { gap: 4px; align-items: stretch; }
.amount-row input { flex: 1; min-width: 70px; text-align: center; font-variant-numeric: tabular-nums; padding: 6px 4px; }
.amount-row button { min-width: 34px; font-weight: 700; }
.amount-row input::-webkit-outer-spin-button, .amount-row input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.amount-row input[type=number] { -moz-appearance: textfield; }

.tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 500; padding: 4px 4px; border-bottom: 1px solid var(--line); cursor: pointer; white-space: nowrap; }
.tbl td { padding: 4px 4px; border-bottom: 1px solid #18222d; font-variant-numeric: tabular-nums; }
.tbl tr.click:hover td { background: #17222e; cursor: pointer; }
.tbl td.num, .tbl th.num { text-align: right; }

.card { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px; }
.card .head { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.status { font-size: 11px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.status.Fighting { color: var(--war); border-color: var(--war); }
.status.Moving { color: var(--offer); border-color: var(--offer); }
.status.Spawning { color: var(--accent); border-color: var(--accent); }

.branch h5 { margin: 12px 0 6px; font-size: 12px; color: var(--accent); text-transform: uppercase; letter-spacing: .08em; }
.node { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; }
.node.locked { opacity: .5; }
.node .pips { grid-column: 1 / -1; display: flex; gap: 3px; }
.node .pips i { flex: 1; height: 4px; border-radius: 2px; background: #1f2b38; }
.node .pips i.on { background: var(--accent); }
.node .pips i.run { background: var(--offer); }

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cols > div { border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.checklist { max-height: 160px; overflow: auto; display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.checklist label { display: flex; gap: 6px; align-items: center; }
#panel.wide { width: 440px; }

@media (max-width: 720px) {
  #menu { flex-direction: row; top: auto; bottom: 58%; left: 10px; right: 10px; overflow-x: auto; }
  #menu button { min-width: 0; padding: 6px 8px; font-size: 12px; }
  #leftcol { width: 240px; }
  #players { display: none; }
  #panel.wide { width: auto; }
  .cols { grid-template-columns: 1fr; }
}
.tb-country { border-color: rgba(255,210,74,.6); color: #ffd24a; }
.tb-country .flag { width: 30px; height: 20px; }

select { background: #0d151e; color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; }
.small-select { padding: 6px 8px; font-size: 12px; background: var(--panel); }

/* Discord Activity: name comes from Discord, games are per voice channel */
.in-discord .lobby-row .field:first-child, .in-discord .private-row { display: none; }
.in-discord .lobby-inner { padding-top: 24px; }

.lobby-error { color: #ff8a80; font-weight: 600; }

/* ---------- accounts ---------- */
#lobby { position: relative; }
.acc-btn {
  position: absolute; top: 16px; right: 16px; z-index: 5; display: flex; align-items: center; gap: 8px;
  font-family: var(--display); font-size: 17px; letter-spacing: .06em; text-transform: uppercase; padding: 8px 16px;
}
.acc-btn.in { background: var(--panel-solid); color: var(--text); border: 1px solid var(--line); text-transform: none; letter-spacing: .02em; padding: 5px 12px 5px 5px; }
.acc-btn.in:hover { border-color: var(--accent); }
.acc-btn small { color: var(--accent); font-family: var(--font); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.acc-btn .acc-avatar { width: 30px; height: 30px; font-size: 15px; }
.in-discord .acc-btn, .signed-in #nameField { display: none; }
@media (max-width: 640px) { #lobby .lobby-inner { padding-top: 72px; } }

.login-page { min-height: 100%; display: flex; justify-content: center; align-items: center; padding: 32px 16px;
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(240,180,41,.12), transparent 60%),
    radial-gradient(700px 400px at 50% 110%, rgba(88,166,255,.08), transparent 60%),
    var(--bg); }
.login-wrap { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 16px; }
.login-wrap > .ghost { align-self: flex-start; }
.login-brand { font-family: var(--display); font-weight: 700; font-size: clamp(30px, 9vw, 46px); letter-spacing: .1em; color: var(--accent); text-align: center; line-height: 1; }
.modal-card { position: relative; width: 100%; background: var(--panel-solid); border: 1px solid var(--line);
  border-top: 4px solid var(--accent); border-radius: 14px; padding: 28px 24px 20px; box-shadow: 0 24px 60px rgba(0,0,0,.5); }
.modal-card h2 { font-size: 30px; text-transform: uppercase; }
.modal-card > p { margin: 6px 0 18px; }
.modal-x { position: absolute; top: 12px; right: 12px; }
.field.wide { max-width: none; margin-bottom: 10px; }
.field.wide input, .code-input { width: 100%; }
.wide-btn { width: 100%; padding: 11px 14px; font-size: 15px; }
.code-input { font-family: var(--display); font-size: 30px; letter-spacing: .5em; text-align: center; margin-bottom: 10px; padding: 8px 0 8px .5em; }
.code-input::placeholder { font-family: var(--font); font-size: 15px; letter-spacing: normal; }
#accCodeForm .ghost { margin-top: 8px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; margin: 18px 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.discord-btn { background: #5865f2; color: #fff; }
.tiny { font-size: 12px; }
#authMsg { min-height: 18px; margin: 12px 0 0; text-align: center; }
#authMsg.err, #accNameMsg.err { color: #ff8a80; }
#accNameMsg.ok { color: var(--good); }

.guest-banner {
  position: relative; overflow: hidden; display: grid; grid-template-columns: 1fr 200px; gap: 24px; align-items: center;
  margin: -8px 0 32px; padding: 26px 28px; border-radius: 16px; border: 1px solid rgba(240,180,41,.35);
  background:
    radial-gradient(500px 260px at 100% 0%, rgba(240,180,41,.20), transparent 70%),
    linear-gradient(135deg, #142031, #0e1620);
  box-shadow: 0 18px 40px rgba(0,0,0,.35);
}
.guest-banner::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--accent); }
.gb-kicker { font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }
.guest-banner h3 { font-size: clamp(26px, 4.5vw, 36px); line-height: 1.05; text-transform: uppercase; margin: 6px 0 8px; }
.guest-banner p { color: var(--muted); margin: 0 0 14px; max-width: 460px; }
.gb-list { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 9px; }
.gb-list li { display: flex; align-items: center; gap: 10px; }
.gb-list svg { width: 18px; height: 18px; flex: none; fill: var(--accent); }
.gb-cta { font-family: var(--display); font-size: 19px; letter-spacing: .06em; text-transform: uppercase; padding: 11px 26px;
  box-shadow: 0 6px 20px rgba(240,180,41,.25); }
.gb-ladder { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.gb-ladder li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 10px; border-radius: 6px; font-size: 12px;
  border: 1px solid rgba(240,180,41,calc(.6 - var(--i) * .05)); background: rgba(240,180,41,calc(.16 - var(--i) * .015));
  color: var(--text); opacity: calc(1 - var(--i) * .06); }
.gb-ladder li:first-child { font-weight: 700; color: var(--accent); }
.gb-ladder small { color: var(--muted); }
@media (max-width: 640px) {
  .guest-banner { grid-template-columns: 1fr; padding: 22px 18px; }
  .gb-ladder { display: none; }
  .gb-cta { width: 100%; }
}
.in-discord .guest-banner { display: none; }

#accountPage { min-height: 100%; background: radial-gradient(1000px 500px at 80% -10%, rgba(240,180,41,.10), transparent 60%), var(--bg); }
.account-inner { max-width: 640px; padding-top: 24px; }
.acc-head { display: flex; align-items: center; gap: 18px; margin: 24px 0 22px; }
.acc-head h1 { font-size: clamp(34px, 7vw, 52px); line-height: 1; color: var(--text); word-break: break-word; }
.acc-avatar { width: 64px; height: 64px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font-family: var(--display); font-size: 32px; font-weight: 700; }
.acc-card { background: var(--panel-solid); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 14px; }
.acc-card h2 { font-size: 20px; text-transform: uppercase; margin-bottom: 8px; }
.acc-card.danger { border-color: rgba(229, 83, 75, .35); }
.acc-rank { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.acc-rank b { font-family: var(--display); font-size: 30px; color: var(--accent); letter-spacing: .04em; }
.acc-bar { height: 8px; background: #0d151e; border: 1px solid var(--line); border-radius: 99px; overflow: hidden; margin: 8px 0 6px; }
.acc-bar div { height: 100%; background: linear-gradient(90deg, #c98b0f, var(--accent)); border-radius: 99px; }
.acc-ranks { list-style: none; padding: 0; margin: 14px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; }
.acc-ranks li { border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.acc-ranks li.done { color: var(--text); border-color: rgba(240,180,41,.4); }
.acc-ranks li.now { background: rgba(240,180,41,.12); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.acc-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.acc-row input { flex: 1; min-width: 160px; }
.lobby-ok { color: var(--good); font-weight: 600; }

/* ---------- spectators, ranking, buildings, tasks ---------- */
#specBar {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; align-items: center;
  background: var(--panel); border: 1px solid var(--accent); border-radius: 999px; padding: 6px 8px 6px 16px; font-size: 13px;
}
.rank-tbl td.me { color: var(--accent); font-weight: 600; }
.rank-tbl .pos { color: var(--muted); width: 22px; }
.bld { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 2px; }
.bld .tag.on { border-color: var(--good); color: var(--good); }
.task { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.task:first-of-type { border-top: 0; }
.task .acc-bar { grid-column: 1 / -1; margin: 2px 0 0; height: 6px; }
.task.done b { color: var(--good); }
.task small { color: var(--accent); font-weight: 600; }
.tasks-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-top: 12px; }
.tasks-head h3 { font-size: 15px; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- legal pages and footer ---------- */
.legal-body { height: auto; min-height: 100%; background: radial-gradient(900px 500px at 50% -10%, rgba(240,180,41,.08), transparent 60%), var(--bg); }
.legal { max-width: 760px; margin: 0 auto; padding: 32px 16px 64px; line-height: 1.6; }
.legal h1 { font-size: clamp(38px, 7vw, 56px); color: var(--accent); margin: 18px 0 8px; }
.legal h2 { font-size: 22px; margin: 28px 0 8px; }
.legal p, .legal li { color: #c9d4de; }
.legal ul { padding-left: 20px; }
.legal li { margin-bottom: 12px; }
.legal em { color: var(--muted); font-style: normal; font-weight: 600; }
.legal a { color: var(--accent); }
.legal-back { display: inline-block; font-size: 13px; text-decoration: none; border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; color: var(--text) !important; }
.legal-date { margin-top: 32px; font-size: 12px; color: var(--muted) !important; }
.site-foot { margin-top: 40px; font-size: 12px; color: var(--muted); display: flex; gap: 14px; justify-content: center; }
.site-foot a { color: var(--muted); text-decoration: none; }
.site-foot a:hover { color: var(--text); text-decoration: underline; }

/* ---------- lobby top bar: rank and XP left, language and account right ---------- */
#lobby .lobby-inner { padding-top: 76px; }
.lobby-top {
  position: absolute; top: 16px; left: 16px; right: 16px; z-index: 5;
  display: flex; justify-content: space-between; align-items: center; gap: 10px; pointer-events: none;
}
.lobby-top > * { pointer-events: auto; }
.lobby-top-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.lobby-top .acc-btn { position: static; }
.lobby-top .lang { padding: 7px 8px; }
.lobby-top .profile {
  padding: 7px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  font-size: 13px; max-width: 55%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lobby-top .profile:empty { display: none; }
.lobby-top .profile.lobby-error, .lobby-top .profile.lobby-ok { white-space: normal; border-radius: 12px; }
@media (max-width: 640px) {
  .lobby-top { top: 10px; left: 10px; right: 10px; }
  .lobby-top .profile { font-size: 12px; padding: 6px 10px; max-width: 48%; }
  .lobby-top .acc-btn { padding: 6px 12px; font-size: 15px; }
  #lobby .lobby-inner { padding-top: 64px; }
}

/* legal pages: language switch and notes */
.legal-nav { display: flex; gap: 8px; flex-wrap: wrap; }
.legal-lang { display: inline-block; font-size: 13px; text-decoration: none; border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; color: var(--muted) !important; }
.legal-lang:hover { color: var(--text) !important; }
.legal-note { font-size: 13px; color: var(--muted) !important; margin-top: -4px; }
.login-agree { text-align: center; margin: 14px 0 0; line-height: 1.5; }
.login-agree a { color: var(--muted); }

/* ---------- moderation ---------- */
#adminPage { min-height: 100%; background: var(--bg); }
.admin-inner { max-width: 900px; }
.admin-title { font-size: 40px; color: var(--accent); margin: 18px 0 14px; }
.admin-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.admin-room { border-top: 1px solid var(--line); padding: 12px 0; }
.admin-room:first-child { border-top: 0; }
.admin-actions { text-align: right; white-space: nowrap; }
.admin-actions button { margin-left: 4px; }
.admin-chat { max-height: 220px; overflow: auto; font-size: 12px; padding: 6px 0; }
.acc-id { margin-top: 8px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.acc-id code { background: #0d151e; border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; font-size: 11px; color: var(--text); }
.err { color: #ff8a80; }
#adminMsg.ok { color: var(--good); }
.acc-head .acc-admin-btn { margin-left: auto; align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.acc-head .acc-admin-btn svg { width: 14px; height: 14px; fill: var(--accent); }
.acc-head .acc-admin-btn:hover { color: var(--text); border-color: var(--accent); }
