:root {
  --bg: #141d18;
  --panel: #1c2922;
  --panel-2: #22322a;
  --line: #2c3d33;
  --line-2: #3a4f42;
  --text: #e9e2cf;
  --muted: #a3a891;
  --faint: #6f7a68;
  --moss: #8fa36a;
  --blaze: #ff6b1a;
  --blaze-ink: #1a0f06;
  --danger: #e2584a;
  --ok: #8fc47a;
  --bronze: #c08552; --silver: #c3c9cc; --gold: #e3b448; --diamond: #7fd3e6; --great: #c99bf0;
  --radius: 10px;
  --display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --body: 'Barlow', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text); font: 16px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--moss); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.1; margin: 0 0 .5em; letter-spacing: .01em; }
h1 { font-size: 2.4rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; max-width: 68ch; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.num { font-family: var(--display); font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--blaze); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- forms ---------- */
label { display: block; font-size: .9rem; color: var(--muted); margin-bottom: .9rem; }
label > span { display: block; margin-bottom: .3rem; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line-2); border-radius: 8px; padding: .55rem .7rem;
}
input:focus, select:focus, textarea:focus { border-color: var(--moss); outline: none; box-shadow: 0 0 0 3px rgba(143,163,106,.2); }
textarea { resize: vertical; min-height: 4.5rem; }
input[type=color] { padding: 2px; height: 2.4rem; }
input[type=checkbox] { width: auto; accent-color: var(--blaze); }
.row { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.row > label { margin-bottom: 0; }
.stack > * + * { margin-top: .9rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  font: 600 1rem var(--display); letter-spacing: .02em; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
  padding: .5rem 1rem; border-radius: 8px; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--moss); text-decoration: none; }
.btn.primary { background: var(--blaze); border-color: var(--blaze); color: var(--blaze-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); background: transparent; }
.btn.small { font-size: .9rem; padding: .3rem .65rem; }
.btn[disabled] { opacity: .5; cursor: default; }
.error { color: var(--danger); font-size: .95rem; margin: .4rem 0; min-height: 1.2em; }
.notice { background: var(--panel-2); border-left: 3px solid var(--moss); padding: .7rem .9rem; border-radius: 6px; margin-bottom: 1rem; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { position: relative; overflow: hidden; background: #101814; display: flex; align-items: flex-end; padding: 3rem; }
.auth-art svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.auth-art .brand-big { position: relative; }
.brand-big h1 { font-size: clamp(3rem, 7vw, 5.5rem); margin: 0; line-height: .9; }
.brand-big p { color: var(--muted); font-size: 1.15rem; margin-top: 1rem; max-width: 30ch; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 2rem; }
.auth-form form { width: 100%; max-width: 380px; }
.auth-form h2 { font-size: 2rem; }
.auth-links { display: flex; justify-content: space-between; margin-top: 1.2rem; font-size: .95rem; }
@media (max-width: 820px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { min-height: 34vh; padding: 1.5rem; }
}

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  border-right: 1px solid var(--line); padding: 1.2rem .8rem; background: #111914;
}
.logo { display: flex; align-items: center; gap: .6rem; font: 700 1.6rem var(--display); color: var(--text); padding: 0 .5rem 1.2rem; }
.logo:hover { text-decoration: none; }
.logo svg { width: 30px; height: 30px; color: var(--blaze); }
.nav a {
  display: flex; align-items: center; gap: .7rem; padding: .55rem .6rem; border-radius: 8px;
  color: var(--muted); font-weight: 500;
}
.nav a svg { width: 20px; height: 20px; flex: none; }
.nav a:hover { color: var(--text); background: var(--panel); text-decoration: none; }
.nav a.active { color: var(--text); background: var(--panel-2); box-shadow: inset 3px 0 0 var(--blaze); }
.rail-foot { margin-top: auto; font-size: .9rem; }
.rail-foot .me { display: flex; align-items: center; gap: .6rem; padding: .5rem; color: var(--text); }

.main { min-width: 0; }
.hunting-bar {
  display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; padding: .6rem 1.6rem;
  border-bottom: 1px solid var(--line); background: linear-gradient(90deg, rgba(255,107,26,.13), transparent 40%);
  box-shadow: inset 4px 0 0 var(--blaze);
}
.hunting-bar .lbl { font-family: var(--display); font-size: 1.05rem; color: var(--blaze); }
.hunting-bar select { width: auto; min-width: 150px; padding: .3rem .5rem; background: var(--panel); }
.hunting-bar .live { margin-left: auto; font-size: .9rem; color: var(--muted); display: flex; align-items: center; gap: .4rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); display: inline-block; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(143,196,122,.2); }
.page { padding: 1.8rem 1.6rem 4rem; max-width: 1240px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.page-head h1 { margin: 0; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; z-index: 50;
    flex-direction: row; padding: .3rem; border-right: 0; border-top: 1px solid var(--line);
  }
  .logo, .rail-foot { display: none; }
  .nav { display: flex; width: 100%; justify-content: space-around; }
  .nav a { flex-direction: column; gap: .1rem; font-size: .7rem; padding: .35rem .3rem; }
  .nav a.active { box-shadow: inset 0 -3px 0 var(--blaze); }
  .nav a.admin-link { display: none; }
  .page { padding: 1.2rem 1rem 6rem; }
  .hunting-bar { padding: .6rem 1rem; }
  h1 { font-size: 2rem; }
}

/* ---------- surfaces ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; }
.panel h2:first-child, .panel h3:first-child { margin-top: 0; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.2rem; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }
@media (max-width: 1000px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.section { margin-bottom: 2rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; }
.section-head h2 { margin: 0; }

/* stat strip — one tally board, not a row of cards */
.tally { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.tally > div { padding: .9rem 1.1rem; border-right: 1px solid var(--line); }
.tally > div:last-child { border-right: 0; }
.tally b { display: block; font: 600 2.1rem/1 var(--display); font-variant-numeric: tabular-nums; }
.tally span { color: var(--muted); font-size: .9rem; }

/* lists & tables */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: .8rem; padding: .65rem 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.grow { flex: 1; min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th { text-align: left; font-weight: 500; color: var(--muted); padding: .5rem .6rem; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none; display: inline-grid; place-items: center;
  font: 700 1rem var(--display); color: #141d18;
}
.avatar.lg { width: 84px; height: 84px; font-size: 2.6rem; }

.medal { display: inline-flex; align-items: center; gap: .3rem; font-size: .85rem; padding: .05rem .5rem; border-radius: 99px; border: 1px solid currentColor; white-space: nowrap; }
.medal.bronze { color: var(--bronze); } .medal.silver { color: var(--silver); } .medal.gold { color: var(--gold); }
.medal.diamond { color: var(--diamond); } .medal.great_one, .medal.legendary { color: var(--great); }
.medal.none { color: var(--faint); }
.tag { font-size: .8rem; padding: .05rem .45rem; border-radius: 4px; background: var(--panel-2); color: var(--muted); white-space: nowrap; }
.tag.live { background: rgba(143,196,122,.16); color: var(--ok); }
.tag.upcoming { background: rgba(127,211,230,.12); color: var(--diamond); }
.tag.auto { background: rgba(255,107,26,.12); color: var(--blaze); }

.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); border: 1px dashed var(--line-2); border-radius: var(--radius); }
.empty .btn { margin-top: .8rem; }

/* ---------- competitions ---------- */
.comp-list { display: grid; gap: .8rem; }
.comp {
  display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: center;
  padding: 1rem 1.1rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--text);
}
.comp:hover { border-color: var(--line-2); text-decoration: none; }
.comp h3 { margin: .2rem 0 .3rem; }
.comp .meta { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; font-size: .9rem; color: var(--muted); }
.podium { display: flex; gap: .8rem; align-items: center; font-size: .9rem; }
.podium .first { color: var(--gold); font-family: var(--display); font-size: 1.1rem; }
.countdown { font-family: var(--display); font-size: 1.1rem; text-align: right; }
.board tr.me td { background: rgba(255,107,26,.08); }
.rank { font: 600 1.2rem var(--display); width: 2.5rem; }
.rank.r1 { color: var(--gold); } .rank.r2 { color: var(--silver); } .rank.r3 { color: var(--bronze); }

/* ---------- chat ---------- */
.chat { display: grid; grid-template-columns: 200px 1fr 180px; height: calc(100vh - 190px); min-height: 420px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.chat.embedded { grid-template-columns: 1fr; height: 460px; }
.chat-channels, .chat-online { padding: .8rem; border-right: 1px solid var(--line); overflow-y: auto; background: #18241e; }
.chat-online { border-right: 0; border-left: 1px solid var(--line); font-size: .9rem; }
.chat-channels button {
  display: flex; width: 100%; text-align: left; background: none; border: 0; color: var(--muted); font: inherit;
  padding: .45rem .6rem; border-radius: 6px; cursor: pointer; align-items: center; gap: .4rem;
}
.chat-channels button.active { background: var(--panel-2); color: var(--text); }
.chat-channels button .unread { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--blaze); }
.chat-main { display: flex; flex-direction: column; min-width: 0; }
.chat-log { flex: 1; overflow-y: auto; padding: 1rem; }
.msg { display: flex; gap: .7rem; padding: .3rem 0; }
.msg .body { min-width: 0; }
.msg .who { font-weight: 600; margin-right: .4rem; }
.msg .when { font-size: .8rem; color: var(--faint); }
.msg .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg .del { visibility: hidden; background: none; border: 0; color: var(--faint); cursor: pointer; font-size: .8rem; }
.msg:hover .del { visibility: visible; }
.msg.cont { padding-top: 0; }
.msg.cont .avatar { visibility: hidden; height: 0; }
.chat-form { display: flex; gap: .5rem; padding: .7rem; border-top: 1px solid var(--line); }
@media (max-width: 860px) {
  .chat { grid-template-columns: 1fr; height: calc(100vh - 200px); }
  .chat-channels { display: flex; gap: .3rem; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: .5rem; }
  .chat-channels h3 { display: none; }
  .chat-channels button { width: auto; white-space: nowrap; }
  .chat-online { display: none; }
}

/* ---------- map ---------- */
.map-layout { display: grid; grid-template-columns: 1fr 300px; gap: 1.2rem; align-items: start; }
@media (max-width: 1000px) { .map-layout { grid-template-columns: 1fr; } }
.map-frame { position: relative; border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; background: #172219; aspect-ratio: 1; touch-action: none; }
.map-frame svg { display: block; width: 100%; height: 100%; cursor: crosshair; user-select: none; }
.map-frame.panning svg { cursor: grabbing; }
.map-tools { position: absolute; top: .6rem; right: .6rem; display: flex; flex-direction: column; gap: .3rem; }
.map-tools .btn { width: 2.2rem; height: 2.2rem; padding: 0; font-size: 1.2rem; }
.map-hint { position: absolute; left: .6rem; bottom: .6rem; font-size: .85rem; background: rgba(20,29,24,.85); padding: .3rem .6rem; border-radius: 6px; color: var(--muted); pointer-events: none; }
.map-pop {
  position: absolute; z-index: 5; width: 250px; background: var(--panel); border: 1px solid var(--line-2);
  border-radius: var(--radius); padding: .9rem; box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
.map-pop h3 { margin-bottom: .6rem; }
.map-pop .actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.legend { display: grid; gap: .35rem; font-size: .92rem; }
.legend label { display: flex; align-items: center; gap: .5rem; margin: 0; color: var(--text); }
.legend .sw { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
@keyframes pulse { from { r: 10; opacity: .7; } to { r: 34; opacity: 0; } }
.pulse { animation: pulse 1.8s ease-out infinite; }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }

/* ---------- achievements ---------- */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .7rem; }
.badge { display: flex; gap: .8rem; align-items: center; padding: .7rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); }
.badge .ico { width: 46px; height: 46px; flex: none; border-radius: 50%; display: grid; place-items: center; border: 2px solid currentColor; }
.badge .ico svg { width: 24px; height: 24px; }
.badge.t1 .ico { color: var(--bronze); } .badge.t2 .ico { color: var(--silver); }
.badge.t3 .ico { color: var(--gold); } .badge.t4 .ico { color: var(--great); }
.badge.locked { opacity: .45; }
.badge.locked .ico { color: var(--faint); border-style: dashed; }
.badge b { display: block; font-family: var(--display); font-size: 1.08rem; font-weight: 600; }
.badge small { color: var(--muted); display: block; line-height: 1.3; }

/* ---------- profile ---------- */
.profile-head { display: flex; gap: 1.4rem; align-items: center; margin-bottom: 1.6rem; flex-wrap: wrap; }
.profile-head h1 { font-size: 3rem; margin: 0; }
.bars { display: grid; gap: .45rem; }
.bar { display: grid; grid-template-columns: 90px 1fr 40px; gap: .6rem; align-items: center; font-size: .9rem; }
.bar .track { height: 10px; background: var(--bg); border-radius: 5px; overflow: hidden; }
.bar .fill { height: 100%; border-radius: 5px; }
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 11px); grid-auto-columns: 11px; justify-content: start; gap: 3px; overflow-x: auto; padding-bottom: .3rem; }
.heat i { width: 11px; height: 11px; border-radius: 2px; background: var(--bg); display: block; }
.heat i.l1 { background: #3f5a33; } .heat i.l2 { background: #5f7f45; } .heat i.l3 { background: #8fa36a; } .heat i.l4 { background: var(--blaze); }
.trophies { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .7rem; }
.trophy { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--bg); }
.trophy img { width: 100%; aspect-ratio: 16/10; object-fit: cover; display: block; }
.trophy .noimg { aspect-ratio: 16/10; display: grid; place-items: center; color: var(--faint); background: repeating-linear-gradient(135deg, #18241e 0 10px, #1a2720 10px 20px); }
.trophy div.t { padding: .5rem .6rem; }

/* ---------- toasts & modal ---------- */
.toasts { position: fixed; right: 1rem; top: 1rem; z-index: 100; display: grid; gap: .5rem; max-width: 340px; }
.toast { background: var(--panel-2); border: 1px solid var(--line-2); border-left: 4px solid var(--moss); border-radius: 8px; padding: .7rem .9rem; box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: toastIn .25s ease-out; }
.toast.ach { border-left-color: var(--gold); }
.toast.err { border-left-color: var(--danger); }
.toast b { font-family: var(--display); font-size: 1.1rem; display: block; }
@keyframes toastIn { from { transform: translateY(-8px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line-2); border-radius: 12px; padding: 1.4rem; width: min(560px, 94vw); }
dialog::backdrop { background: rgba(8,12,10,.7); }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }
code, .code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .88rem; background: var(--bg); padding: .1rem .35rem; border-radius: 4px; }
pre.code { padding: .8rem; overflow-x: auto; white-space: pre; border: 1px solid var(--line); }
.thumb { width: 44px; height: 32px; object-fit: cover; border-radius: 4px; display: block; }
.rail-foot svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.rail-foot .me:hover { text-decoration: none; background: var(--panel); border-radius: 8px; }
