:root {
  --bg: #0b1016;
  --panel: #131b24;
  --panel2: #1a2531;
  --line: #2a3846;
  --text: #e6edf3;
  --muted: #8b9bab;
  --accent: #3fd0ff;
  --home: #3fa9ff;
  --away: #ff5a4f;
  --ban: #ff5a4f;
  --ok: #4fe08a;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(ellipse at top, #13202d, var(--bg) 60%) fixed;
  color: var(--text);
}
header { padding: 16px 24px; border-bottom: 1px solid var(--line); }
.brand { color: var(--text); text-decoration: none; font-weight: 800; letter-spacing: .12em; }
.brand span { color: var(--accent); }
main { max-width: 1100px; margin: 0 auto; padding: 24px; }
h1, h2, h3 { margin: 0 0 12px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }

.hero { text-align: center; padding: 80px 0; }
.hero h1 { font-size: 36px; }
.hero p { color: var(--muted); }
.hero-buttons { display: flex; gap: 16px; justify-content: center; margin-top: 32px; flex-wrap: wrap; }

.btn {
  background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  padding: 10px 18px; border-radius: 6px; font-size: 15px; font-weight: 600; cursor: pointer;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: #04121b; border-color: var(--accent); }
.btn.big { padding: 16px 36px; font-size: 18px; min-width: 200px; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.ok { background: var(--ok); color: #04121b; border-color: var(--ok); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
.card.narrow { max-width: 420px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
input, select {
  background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; padding: 9px 10px; font-size: 15px;
}
.code-input { text-transform: uppercase; letter-spacing: .3em; font-size: 22px; font-weight: 700; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.actions { display: flex; gap: 12px; justify-content: flex-end; }
.error { color: var(--ban); min-height: 1.2em; }

.pool-head { display: flex; align-items: baseline; gap: 12px; margin-top: 8px; }
.pool { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 12px; }
.pool fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 0; }
.pool legend { font-weight: 700; padding: 0 4px; }
.pool label { flex-direction: row; align-items: center; gap: 8px; margin: 4px 0; color: var(--text); font-size: 14px; }
.pool .toggle-all { font-size: 12px; color: var(--accent); cursor: pointer; background: none; border: 0; padding: 0; margin-left: 6px; }

.room-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.room-code { font-size: 44px; font-weight: 800; letter-spacing: .25em; color: var(--accent); margin-bottom: 6px; }

.teams { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: stretch; }
.team { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; border-top: 4px solid; }
.team.home { border-top-color: var(--home); }
.team.away { border-top-color: var(--away); text-align: right; }
.team.active { box-shadow: 0 0 0 2px var(--accent), 0 0 24px rgba(63, 208, 255, .25); }
.team .side { font-size: 12px; font-weight: 700; letter-spacing: .15em; color: var(--muted); }
.team .name { font-size: 22px; font-weight: 700; margin: 4px 0; }
.team .tag { font-size: 13px; }
.tag.ready { color: var(--ok); }
.tag.waiting { color: var(--muted); }
.vs { align-self: center; font-weight: 800; color: var(--muted); }

.status { text-align: center; font-size: 20px; font-weight: 700; margin: 24px 0 8px; }
.status .home { color: var(--home); }
.status .away { color: var(--away); }

.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 16px 0 28px; }
.mode-col { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.mode-col h4 { margin: 0 0 8px; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
/* Map tiles: the artwork is a slanted banner with transparent corners. */
.combo {
  position: relative; display: block; width: 100%; padding: 0; margin: 6px 0;
  border: 0; background: none; color: var(--text); cursor: pointer;
  transition: transform .12s, filter .12s;
}
.combo:disabled { cursor: default; }
.map-img, .map-fallback { display: block; width: 100%; aspect-ratio: 535 / 157; }
.map-img { user-select: none; }
.map-fallback {
  clip-path: polygon(9% 0, 100% 0, 91% 100%, 0 100%);
  background: linear-gradient(135deg, #2a3a4a, #121a22);
  position: relative; container-type: inline-size;
}
.map-fallback span {
  position: absolute; right: 9%; bottom: 0; left: 40%; padding: 1cqw 3cqw;
  background: rgba(0,0,0,.6); text-align: right; font-size: 7.5cqw; font-weight: 300; letter-spacing: .04em; line-height: 1.1;
}
.combo.actionable:hover { transform: translateY(-2px) scale(1.02); filter: drop-shadow(0 0 8px rgba(63, 208, 255, .8)); }
.combo.banned .map-img, .combo.banned .map-fallback { filter: grayscale(1) brightness(.4); }
.combo.unavailable .map-img, .combo.unavailable .map-fallback { filter: grayscale(.8) brightness(.45); }
.combo.picked { filter: drop-shadow(0 0 6px rgba(63, 208, 255, .9)); }
.combo:disabled:not(.banned):not(.picked):not(.unavailable) { opacity: .85; }
.badge {
  position: absolute; top: 8%; left: 12%; padding: 2px 8px; border-radius: 3px;
  font-size: 11px; font-weight: 800; letter-spacing: .08em; color: #fff;
}
.combo.banned .badge { background: var(--ban); }
.combo.picked .badge { background: var(--accent); color: #04121b; }
.combo.banned::after {
  content: ""; position: absolute; left: 6%; right: 6%; top: 50%; height: 3px;
  background: var(--ban); transform: rotate(-6deg); opacity: .85;
}
.who { font-weight: 700; }
.who.home { color: var(--home); }
.who.away { color: var(--away); }

.mode-col h4 { display: flex; align-items: center; gap: 8px; }
.mode-icon { width: 26px; height: 26px; }
.pool legend { display: flex; align-items: center; gap: 6px; }
.pool label.pool-item { gap: 6px; margin: 6px 0; cursor: pointer; }
.pool-item .tile { flex: 1; min-width: 0; max-width: 240px; }
.pool-item .map-img, .pool-item .map-fallback { width: 100%; }
.pool-item input:not(:checked) + * { filter: grayscale(1) brightness(.8); opacity: .45; }

.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.log { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 12px 12px 36px; min-height: 60px; margin: 0; }
.log li { padding: 5px 0; }
.log-icon { width: 18px; height: 18px; vertical-align: -4px; margin-right: 6px; }
.log.picks { list-style: none; padding: 12px; }
.log li.game { display: grid; grid-template-columns: 36px minmax(120px, 220px) 1fr; align-items: center; gap: 12px; padding: 6px 0; }
.game-no { font-weight: 800; color: var(--accent); font-size: 18px; }
.game-info { display: flex; flex-direction: column; gap: 2px; }
.game-mode { font-weight: 700; }
.log .mode { color: var(--muted); }
.picks li { font-size: 17px; }
.random { font-size: 11px; color: var(--accent); margin-left: 6px; }

@media (max-width: 640px) {
  .teams { grid-template-columns: 1fr; }
  .vs { display: none; }
  .team.away { text-align: left; }
  .columns { grid-template-columns: 1fr; }
  .room-code { font-size: 34px; }
}

/* Variant tag (e.g. Origin CTF: 5 Flag / 3 Flag) */
.combo, .tile { position: relative; display: block; }
.variant-tag {
  position: absolute; right: 6%; top: 8%; padding: 1px 6px; border-radius: 3px;
  background: rgba(4, 18, 27, .85); border: 1px solid var(--accent); color: var(--accent);
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
}

dialog#choice {
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 20px 24px; min-width: 320px;
}
dialog#choice::backdrop { background: rgba(0, 0, 0, .6); }
#choice-title { font-size: 17px; font-weight: 700; margin: 0 0 16px; }
.choice-buttons { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* Reconnection */
.connection { text-align: center; border-radius: 6px; margin-top: 16px; padding: 8px 12px; font-weight: 600; }
.connection.ok { display: none; }
.connection.reconnecting { background: rgba(255, 196, 0, .12); border: 1px solid #ffc400; color: #ffd84d; }
.connection.gone { background: rgba(255, 90, 79, .12); border: 1px solid var(--ban); color: var(--ban); }
.tag.offline { color: #ffc400; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #55616d; margin-right: 6px; vertical-align: 1px; }
.dot.on { background: var(--ok); box-shadow: 0 0 6px var(--ok); }

/* Modes stacked vertically, maps side by side within each mode. */
.board { display: flex; flex-direction: column; gap: 10px; }
.mode-col { display: grid; grid-template-columns: 180px 1fr; align-items: center; gap: 14px; padding: 10px 14px; }
.mode-col h4 { margin: 0; }
.mode-maps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.mode-maps .combo { margin: 0; }

.pool { display: flex; flex-direction: column; gap: 12px; }
.pool fieldset .mode-maps { margin-top: 4px; }
.pool label.pool-item { position: relative; display: block; margin: 0; }
.pool-item .tile { max-width: none; }
.pool-item input { position: absolute; top: 6px; left: 13%; z-index: 1; width: 16px; height: 16px; margin: 0; }

.series-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }

@media (max-width: 760px) {
  .mode-col { grid-template-columns: 1fr; gap: 8px; }
  .mode-maps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.combo.picked .variant-tag { top: auto; right: auto; bottom: 8%; left: 10%; }
