:root {
  --ink: #0e1517;
  --ink-soft: #152023;
  --surface: #1a292c;
  --line: #2d4041;
  --paper: #edf3ed;
  --muted: #9baba7;
  --acid: #cef05c;
  --sun: #f2bc62;
  --danger: #e66e62;
  --teal: #66d1c1;
  --shadow: rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html { background: var(--ink); }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--paper);
  background: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--acid); outline-offset: 3px; }
button:disabled { cursor: not-allowed; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 64px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(14, 21, 23, 0.96);
  backdrop-filter: blur(16px);
}
.brand { color: var(--paper); display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 850; font-size: 16px; }
.brand-mark { width: 27px; height: 27px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; transform: skewX(-15deg); }
.brand-mark i { display: block; background: var(--acid); }
.brand-mark i:nth-child(2) { opacity: .75; }
.brand-mark i:nth-child(3) { opacity: .45; }
.brand-slash { color: var(--acid); margin: 0 2px; }
.topbar-status { color: var(--muted); font-size: 11px; font-weight: 750; margin-right: auto; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--acid); box-shadow: 0 0 0 3px rgba(206,240,92,.13); }
.account { display: flex; align-items: center; gap: 8px; min-width: 0; }
.steam-id { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; max-width: 185px; white-space: nowrap; }

.button, .icon-button, .map-card { border: 0; color: var(--ink); background: var(--acid); }
.button { min-height: 38px; padding: 0 13px; border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-size: 13px; font-weight: 780; }
.button:hover { filter: brightness(1.06); }
.button.secondary { color: var(--paper); background: transparent; border: 1px solid var(--line); }
.button.danger { color: #fff; background: rgba(230,110,98,.17); border: 1px solid rgba(230,110,98,.55); }
.icon-button { width: 34px; height: 34px; padding: 0; border-radius: 5px; display: inline-grid; place-items: center; color: var(--paper); background: transparent; border: 1px solid var(--line); }
.icon-button svg { width: 16px; height: 16px; }
.icon-button:hover { border-color: var(--muted); }

.workspace { width: min(1540px, 100%); min-height: calc(100vh - 64px); margin: 0 auto; display: grid; grid-template-columns: 274px minmax(0, 1fr); }
.lobby-sidebar { min-height: calc(100vh - 64px); padding: 24px 15px; border-right: 1px solid var(--line); background: #111a1c; }
.sidebar-head, .admin-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 0 8px 16px; }
.eyebrow { margin: 0 0 5px; color: var(--teal); font-size: 10px; font-weight: 800; line-height: 1; }
h1, h2, h3, p { margin-top: 0; }
h2 { margin-bottom: 0; font-size: 18px; line-height: 1.1; }
.lobby-list { display: grid; gap: 7px; }
.lobby-item { width: 100%; min-height: 83px; padding: 13px; border: 1px solid transparent; border-radius: 6px; color: var(--paper); text-align: left; background: transparent; }
.lobby-item:hover { background: rgba(237,243,237,.035); }
.lobby-item.is-active { border-color: rgba(206,240,92,.55); background: rgba(206,240,92,.08); }
.lobby-code, .lobby-meta { color: var(--muted); font-size: 11px; }
.lobby-title { display: block; margin: 3px 0 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 760; }
.lobby-meta { display: flex; align-items: center; justify-content: space-between; gap: 5px; }
.badge { display: inline-flex; align-items: center; width: fit-content; min-height: 20px; padding: 2px 6px; border: 1px solid var(--line); border-radius: 3px; font-size: 10px; font-weight: 800; }
.badge.live { color: var(--acid); border-color: rgba(206,240,92,.35); }
.badge.done { color: var(--teal); border-color: rgba(102,209,193,.35); }
.sidebar-note { margin: 22px 8px 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

.match-area { min-width: 0; padding: 32px clamp(18px, 3vw, 46px) 58px; }
.match-empty { min-height: 55vh; display: grid; place-items: center; text-align: center; color: var(--muted); }
.match-empty > div { max-width: 430px; }
.match-empty h1 { color: var(--paper); font-size: 29px; }
.match-empty p { line-height: 1.55; }
.match-empty .button { margin-top: 9px; }

.match-hero { position: relative; min-height: 155px; padding: 26px 28px; overflow: hidden; border-bottom: 1px solid var(--line); background: #172224; }
.match-hero::after { content: ""; position: absolute; z-index: 0; inset: 0; background: linear-gradient(90deg, rgba(23,34,36,.98) 19%, rgba(23,34,36,.7) 54%, rgba(23,34,36,.92)), url("https://cdn.akamai.steamstatic.com/steam/apps/730/header.jpg") right center / cover no-repeat; opacity: .58; }
.hero-content { position: relative; z-index: 1; }
.match-label { margin-bottom: 8px; color: var(--muted); font-size: 11px; font-weight: 750; }
.match-title { margin-bottom: 18px; max-width: 760px; font-size: clamp(24px, 3vw, 36px); line-height: 1; font-weight: 850; overflow-wrap: anywhere; }
.versus-row { display: flex; align-items: center; gap: 13px; font-weight: 790; }
.versus-row .player-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vs { padding: 3px 5px; color: var(--sun); border: 1px solid rgba(242,188,98,.38); font-size: 10px; }

.veto-stage { margin: 26px 0 19px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 18px; }
.turn-copy { display: flex; align-items: center; gap: 13px; }
.turn-count { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; color: var(--ink); background: var(--acid); font-size: 16px; font-weight: 850; }
.turn-heading { margin: 0 0 3px; font-size: 16px; font-weight: 780; }
.turn-sub { margin: 0; color: var(--muted); font-size: 12px; }
.turn-yours { color: var(--acid); }
.progress { display: flex; align-items: center; justify-content: end; min-width: 260px; }
.progress-step { position: relative; width: 38px; height: 38px; margin-left: 5px; display: grid; place-items: center; color: var(--muted); border: 1px solid var(--line); background: var(--ink-soft); font-size: 11px; font-weight: 800; }
.progress-step::after { content: ""; position: absolute; left: calc(100% + 1px); top: 18px; width: 4px; height: 1px; background: var(--line); }
.progress-step:last-child::after { display: none; }
.progress-step.is-done { color: var(--ink); background: var(--teal); border-color: var(--teal); }
.progress-step.is-current { color: var(--ink); background: var(--acid); border-color: var(--acid); }

.draft-layout { display: grid; grid-template-columns: minmax(0, 1fr) 285px; align-items: start; gap: 24px; }
.map-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.map-card { position: relative; min-height: 188px; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; text-align: left; isolation: isolate; background: #213236; }
.map-card::before { content: ""; position: absolute; z-index: -2; inset: 0; opacity: .94; background-color: #314e4c; background-image: linear-gradient(127deg, transparent 24%, rgba(216,234,196,.42) 24% 29%, transparent 29% 67%, rgba(13,26,27,.67) 67% 72%, transparent 72%), linear-gradient(35deg, transparent 17%, rgba(13,26,27,.54) 17% 22%, transparent 22% 76%, rgba(220,177,98,.36) 76% 80%, transparent 80%), radial-gradient(ellipse at 69% 34%, rgba(221,194,115,.5) 0 9%, transparent 10%), radial-gradient(ellipse at 35% 71%, rgba(28,61,55,.9) 0 17%, transparent 18%); transform: scale(1.11); transition: transform .28s ease; }
.map-card::after { content: ""; position: absolute; z-index: -1; inset: 0; background: linear-gradient(180deg, rgba(9,16,17,.06), rgba(9,16,17,.82)); }
.map-card:hover:not(:disabled)::before { transform: scale(1.18); }
.map-card:hover:not(:disabled) { border-color: var(--acid); }
.map-card:disabled { color: var(--paper); opacity: 1; }
.map-card.map--anubis::before { background-color: #7b6744; filter: hue-rotate(14deg); }
.map-card.map--dust-ii::before { background-color: #977353; filter: sepia(.26); }
.map-card.map--inferno::before { background-color: #81564d; filter: hue-rotate(340deg); }
.map-card.map--mirage::before { background-color: #a8834c; filter: saturate(.82); }
.map-card.map--nuke::before { background-color: #4a6c75; filter: hue-rotate(8deg); }
.map-card.map--train::before { background-color: #5c6950; filter: hue-rotate(326deg); }
.map-meta { position: absolute; inset: auto 0 0; padding: 14px; }
.map-name { display: block; color: #fff; font-size: 20px; font-weight: 850; line-height: 1; }
.map-state { display: block; margin-top: 7px; color: #d5ded9; font-size: 11px; font-weight: 700; }
.map-state svg { width: 12px; height: 12px; margin: 0 4px -2px 0; }
.map-card.is-pick { border-color: var(--acid); }
.map-card.is-pick::after { background: linear-gradient(180deg, rgba(16,34,27,.2), rgba(12,28,20,.84)); }
.map-card.is-ban { filter: grayscale(.82); border-color: #374142; }
.map-card.is-ban::before { transform: scale(1.08); }
.map-card.is-ban::after { background: linear-gradient(180deg, rgba(29,23,23,.25), rgba(37,19,18,.89)); }
.map-card.is-decider { border-color: var(--sun); }
.map-card.is-decider::after { background: linear-gradient(180deg, rgba(58,42,18,.14), rgba(42,30,11,.87)); }

.history { border-top: 1px solid var(--line); }
.history-head { padding: 12px 0; display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; font-weight: 760; }
.history-row { min-height: 48px; display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 9px; border-top: 1px solid rgba(45,64,65,.72); font-size: 12px; }
.history-index { color: var(--muted); font-weight: 750; }
.history-action { font-weight: 760; }
.history-map { color: var(--teal); font-weight: 760; }
.history-empty { padding: 17px 0; color: var(--muted); font-size: 12px; line-height: 1.45; border-top: 1px solid rgba(45,64,65,.72); }

.result-strip { margin-top: 24px; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.result-cell { min-height: 92px; padding: 16px; border-right: 1px solid var(--line); }
.result-cell:last-child { border-right: 0; }
.result-label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 10px; font-weight: 800; }
.result-map { color: var(--paper); font-size: 18px; font-weight: 840; }
.result-map.is-empty { color: #60706e; }

.admin-drawer { position: fixed; z-index: 50; top: 64px; right: 0; bottom: 0; width: min(500px, 100vw); overflow-y: auto; border-left: 1px solid var(--line); background: #121e20; box-shadow: -16px 0 40px var(--shadow); }
.admin-header { position: sticky; top: 0; z-index: 1; padding: 22px 24px 16px; border-bottom: 1px solid var(--line); background: #121e20; }
.admin-tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.admin-tab { height: 44px; padding: 0 8px; color: var(--muted); border: 0; border-bottom: 2px solid transparent; background: transparent; font-size: 12px; font-weight: 750; }
.admin-tab.is-active { color: var(--paper); border-bottom-color: var(--acid); }
.admin-panel { padding: 22px 24px 35px; }
.admin-panel h3 { margin-bottom: 7px; font-size: 16px; }
.admin-panel > p { color: var(--muted); font-size: 12px; line-height: 1.45; }
.form-stack { display: grid; gap: 14px; margin-top: 20px; }
.field { display: grid; gap: 6px; }
.field label { color: var(--muted); font-size: 11px; font-weight: 720; }
.field input, .field select { width: 100%; height: 42px; padding: 0 11px; color: var(--paper); border: 1px solid var(--line); border-radius: 5px; outline: 0; background: #0e1719; }
.field select option { background: #0e1719; }
.admin-list { margin-top: 25px; border-top: 1px solid var(--line); }
.admin-list-row { min-height: 57px; padding: 10px 0; display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; border-bottom: 1px solid var(--line); }
.admin-list-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 740; }
.admin-list-id { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.small-delete { width: 30px; height: 30px; padding: 0; display: grid; place-items: center; color: var(--danger); border: 1px solid rgba(230,110,98,.35); border-radius: 4px; background: transparent; }
.small-delete svg { width: 14px; height: 14px; }
.empty-list { padding: 18px 0; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--line); }

.toast { position: fixed; z-index: 90; right: 20px; bottom: 20px; max-width: min(400px, calc(100vw - 40px)); padding: 12px 14px; color: var(--paper); border: 1px solid var(--line); border-left: 3px solid var(--acid); border-radius: 5px; background: #1b292b; box-shadow: 0 12px 28px var(--shadow); font-size: 13px; }
.toast.is-error { border-left-color: var(--danger); }

@media (max-width: 1000px) {
  .draft-layout { grid-template-columns: 1fr; }
  .history { max-width: none; }
}
@media (max-width: 780px) {
  .topbar { height: 58px; padding: 0 15px; gap: 13px; }
  .topbar-status { display: none; }
  .workspace { display: block; }
  .lobby-sidebar { min-height: 0; padding: 14px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-head { padding: 0 4px 11px; }
  .lobby-list { display: flex; overflow-x: auto; padding: 0 3px 4px; }
  .lobby-item { width: 185px; min-width: 185px; }
  .sidebar-note { display: none; }
  .match-area { padding: 20px 14px 40px; }
  .match-hero { min-height: 140px; padding: 20px; }
  .match-title { font-size: 25px; }
  .veto-stage { grid-template-columns: 1fr; }
  .progress { justify-content: start; min-width: 0; }
  .map-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .map-card { min-height: 153px; }
  .map-name { font-size: 17px; }
  .result-cell { min-height: 82px; padding: 11px; }
  .result-map { font-size: 14px; overflow-wrap: anywhere; }
  .admin-drawer { top: 58px; }
}
@media (max-width: 430px) {
  .brand { font-size: 14px; }
  .brand-mark { width: 23px; height: 23px; }
  .steam-id { max-width: 95px; }
  .account .button { padding: 0 9px; font-size: 11px; }
  .map-grid { grid-template-columns: 1fr; }
  .map-card { min-height: 166px; }
  .progress-step { width: 33px; height: 33px; }
  .progress-step::after { top: 15px; }
  .admin-panel { padding: 20px 16px 32px; }
}
