:root {
  --bg: #1b1d1f;
  --bg-2: #232629;
  --panel: #2c3034;
  --panel-2: #353a3f;
  --line: #454b52;
  --text: #eceff1;
  --muted: #9aa3ab;
  --grass: #5d9c3a;
  --grass-hi: #72b84a;
  --grass-lo: #3f6e26;
  --dirt: #866043;
  --gold: #f2c14e;
  --red: #d9534f;
  --red-lo: #9e3431;
  --blue: #4a90d9;
  --radius: 6px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  background:
    linear-gradient(rgba(0,0,0,.25), rgba(0,0,0,.25)),
    repeating-conic-gradient(var(--bg) 0 25%, var(--bg-2) 0 50%) 0 0 / 48px 48px;
  color: var(--text);
  font: 15px/1.5 Inter, system-ui, -apple-system, Segoe UI, sans-serif;
}

h1, h2, h3, .brand, .pixel { font-family: Silkscreen, Inter, monospace; font-weight: 400; letter-spacing: .02em; }
h1 { font-size: 1.7rem; margin: 0 0 .25rem; line-height: 1.2; }
h2 { font-size: 1.25rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
p { margin: 0 0 .75rem; }
a { color: var(--grass-hi); }

.muted { color: var(--muted); }
.center { text-align: center; }
.small { font-size: .85rem; }

/* ---- Top bar ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px;
  background: rgba(20,22,24,.92);
  border-bottom: 3px solid #000;
  box-shadow: inset 0 -3px 0 var(--grass-lo);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-size: 1.1rem; }
.block {
  width: 22px; height: 22px; flex: none;
  background: linear-gradient(var(--grass) 0 35%, var(--dirt) 35%);
  box-shadow: inset -3px -3px 0 rgba(0,0,0,.3), inset 3px 3px 0 rgba(255,255,255,.12);
}
#nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.who { color: var(--muted); font-size: .9rem; }
.who b { color: var(--text); }

main { max-width: 820px; margin: 0 auto; padding: 28px 16px 64px; }

/* ---- Panels ---- */
.panel {
  background: var(--panel);
  border: 3px solid #000;
  box-shadow: inset 3px 3px 0 rgba(255,255,255,.07), inset -3px -3px 0 rgba(0,0,0,.35);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
}
.panel.narrow { max-width: 440px; margin: 40px auto; }
.panel.live { box-shadow: inset 0 4px 0 var(--grass), inset 3px 3px 0 rgba(255,255,255,.07), inset -3px -3px 0 rgba(0,0,0,.35); }

/* ---- Buttons ---- */
button, .btn {
  font: inherit; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; min-height: 40px;
  color: var(--text); text-decoration: none;
  background: var(--panel-2);
  border: 2px solid #000; border-radius: 4px;
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.15), inset -2px -3px 0 rgba(0,0,0,.35);
}
button:hover:not(:disabled), .btn:hover { filter: brightness(1.12); }
button:active:not(:disabled) { box-shadow: inset 2px 2px 0 rgba(0,0,0,.35); }
button:disabled { opacity: .5; cursor: not-allowed; }
button:focus-visible, input:focus-visible, textarea:focus-visible, .option:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.primary { background: var(--grass); }
.danger { background: var(--red-lo); }
.ghost { background: transparent; box-shadow: none; border-color: var(--line); }
.sm { padding: 5px 10px; min-height: 32px; font-size: .85rem; }
.full { width: 100%; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.spread { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }

/* ---- Forms ---- */
label { display: block; font-weight: 600; margin: 0 0 6px; font-size: .9rem; }
input[type=text], textarea {
  width: 100%; font: inherit; color: var(--text);
  background: #16181a; border: 2px solid #000; border-radius: 4px;
  box-shadow: inset 2px 2px 0 rgba(0,0,0,.4);
  padding: 10px 12px;
}
textarea { min-height: 70px; resize: vertical; }
.field { margin-bottom: 14px; }
.opt-row { display: flex; gap: 6px; margin-bottom: 6px; }
.opt-row input { flex: 1; }

.notice { padding: 10px 12px; border-radius: 4px; border: 2px solid #000; margin-bottom: 14px; font-size: .92rem; }
.notice.warn { background: rgba(242,193,78,.12); border-color: rgba(242,193,78,.5); }
.notice.error { background: rgba(217,83,79,.15); border-color: rgba(217,83,79,.6); }
.notice.ok { background: rgba(93,156,58,.15); border-color: rgba(93,156,58,.6); }

/* ---- Voting ---- */
.options { display: grid; gap: 10px; margin: 18px 0; }
.option {
  display: flex; align-items: center; justify-content: flex-start; gap: 12px; width: 100%; text-align: left;
  padding: 14px 16px; min-height: 52px; font-weight: 500;
  background: var(--panel-2);
}
.option .dot { width: 18px; height: 18px; flex: none; border: 2px solid #000; background: #16181a; }
.option.selected { background: var(--grass-lo); }
.option.selected .dot { background: var(--gold); }
.option.mine { background: var(--grass-lo); cursor: default; }
.option.mine .dot { background: var(--gold); }
.voted-badge { display: inline-block; padding: 2px 8px; font-size: .75rem; background: var(--gold); color: #000; border: 2px solid #000; margin-left: auto; font-family: Silkscreen, monospace; }
.empty { text-align: center; padding: 48px 22px; }
.empty .big { font-size: 2.2rem; margin-bottom: 8px; }

/* ---- Admin ---- */
.tabs { display: flex; gap: 6px; margin-bottom: 18px; }
.tabs button[aria-selected=true] { background: var(--grass); }
.tag { display: inline-block; padding: 1px 8px; font-size: .72rem; border: 2px solid #000; border-radius: 3px; font-family: Silkscreen, monospace; vertical-align: middle; }
.tag.live { background: var(--grass); }
.tag.draft { background: var(--blue); }
.tag.closed { background: var(--panel-2); color: var(--muted); }
.poll-item { border-top: 2px solid var(--line); padding: 14px 0; }
.poll-item:first-of-type { border-top: 0; padding-top: 4px; }
.poll-item h3 { margin: 4px 0; font-family: Inter, sans-serif; font-weight: 700; font-size: 1.05rem; }
.section-title { margin: 26px 0 10px; color: var(--muted); font-size: .95rem; }

.bar { margin-bottom: 12px; }
.bar .label { display: flex; justify-content: space-between; gap: 8px; font-size: .92rem; margin-bottom: 4px; }
.bar .track { height: 18px; background: #16181a; border: 2px solid #000; }
.bar .fill { height: 100%; background: var(--grass); box-shadow: inset 0 -4px 0 var(--grass-lo); transition: width .3s; }
.bar.winner .fill { background: var(--gold); box-shadow: inset 0 -4px 0 #b68a26; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 2px 8px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 3px; font-size: .85rem; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 6px; border-top: 2px solid var(--line); vertical-align: middle; font-size: .92rem; }
th { color: var(--muted); font-weight: 600; border-top: 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.table-wrap { overflow-x: auto; }

/* ---- Toast ---- */
#toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(120px);
  background: #111; border: 2px solid #000; box-shadow: inset 0 -3px 0 var(--grass);
  padding: 10px 16px; border-radius: 4px; max-width: calc(100% - 32px);
  transition: transform .2s; z-index: 50;
}
#toast.show { transform: translateX(-50%) translateY(0); }
#toast.error { box-shadow: inset 0 -3px 0 var(--red); }

@media (max-width: 560px) {
  h1 { font-size: 1.35rem; }
  .panel { padding: 16px; }
  .brand { font-size: .95rem; }
  .who { display: none; }
  .hide-sm { display: none; }
}
