/* FAF Tourney — command console theme */
:root {
  --bg: #0C1219;
  --panel: #141D28;
  --panel2: #18232F;
  --line: #24344663;
  --line-solid: #243446;
  --text: #D7E1EA;
  --muted: #7C8FA3;
  --blue: #5C9EE8;
  --blue-dim: #5c9ee81f;
  --amber: #FFB447;
  --amber-dim: #ffb44718;
  --green: #6FCF8E;
  --red: #E2564A;
  --radius: 6px;
  --display: 'Chakra Petch', sans-serif;
  --body: 'IBM Plex Sans', sans-serif;
  --mono: 'IBM Plex Mono', monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  background-attachment: fixed;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line-solid);
  background: rgba(12,18,25,.92);
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(6px);
}
.wordmark { font-family: var(--display); font-size: 20px; letter-spacing: 2px; color: var(--text); }
.wordmark:hover { text-decoration: none; }
.wm-faf { color: var(--amber); font-weight: 700; }
.wm-t { font-weight: 500; margin-left: 6px; color: var(--text); }
.topbar-right { font-family: var(--mono); font-size: 12px; color: var(--muted); }

main { max-width: 1180px; margin: 0 auto; padding: 28px 24px 80px; }

h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: .5px; }
h1 { font-size: 30px; margin: 0 0 4px; }
h2 { font-size: 17px; text-transform: uppercase; letter-spacing: 2px; color: var(--muted); margin: 0 0 14px; }
h2 .h2-strong { color: var(--text); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line-solid);
  border-radius: var(--radius);
  padding: 20px;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } }

/* forms */
label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 14px 0 5px; font-family: var(--display); }
input[type=text], input[type=number], select, textarea {
  width: 100%; padding: 9px 11px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line-solid); border-radius: 4px;
  font-family: var(--body); font-size: 14px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: -1px; border-color: transparent; }
textarea { resize: vertical; min-height: 64px; }

.btn {
  display: inline-block; cursor: pointer;
  font-family: var(--display); font-weight: 600; font-size: 13px;
  letter-spacing: 1px; text-transform: uppercase;
  padding: 9px 18px; border-radius: 4px;
  border: 1px solid var(--blue); background: var(--blue-dim); color: var(--blue);
  transition: background .12s, transform .05s;
}
.btn:hover { background: #5c9ee836; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--blue); color: #0A1420; }
.btn.primary:hover { background: #7cb4f0; }
.btn.amber { border-color: var(--amber); color: var(--amber); background: var(--amber-dim); }
.btn.amber:hover { background: #ffb44730; }
.btn.danger { border-color: var(--red); color: var(--red); background: transparent; }
.btn.ghost { border-color: var(--line-solid); color: var(--muted); background: transparent; }
.btn.small { padding: 4px 10px; font-size: 11px; }
.btn[disabled] { opacity: .4; cursor: not-allowed; }

/* status pill */
.pill {
  display: inline-block; font-family: var(--mono); font-size: 11px;
  letter-spacing: 1px; text-transform: uppercase;
  padding: 3px 10px; border-radius: 3px;
  border: 1px solid var(--line-solid); color: var(--muted);
}
.pill.signup   { color: var(--green); border-color: #6fcf8e55; }
.pill.draft    { color: var(--amber); border-color: #ffb44755; }
.pill.drafted  { color: var(--amber); border-color: #ffb44755; }
.pill.running  { color: var(--blue); border-color: #5c9ee855; }
.pill.finished { color: var(--text); border-color: var(--line-solid); }

/* phase stepper */
.stepper { display: flex; gap: 0; margin: 18px 0 26px; font-family: var(--display); font-size: 12px; letter-spacing: 1px; text-transform: uppercase; }
.step { flex: 1; text-align: center; padding: 8px 4px; border-bottom: 2px solid var(--line-solid); color: var(--muted); }
.step.done { color: var(--blue); border-color: var(--blue); }
.step.now { color: var(--amber); border-color: var(--amber); }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-solid); margin: 22px 0 22px; flex-wrap: wrap; }
.tab {
  font-family: var(--display); font-size: 13px; letter-spacing: 1px; text-transform: uppercase;
  padding: 9px 16px; cursor: pointer; color: var(--muted);
  border: none; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--amber); border-bottom-color: var(--amber); }

/* launch queue (signature) */
.queue { display: flex; flex-direction: column; gap: 10px; }
.qitem {
  display: flex; align-items: center; gap: 16px;
  background: var(--panel2); border: 1px solid var(--line-solid);
  border-left: 3px solid var(--amber);
  border-radius: 4px; padding: 12px 16px;
}
.qitem.done { border-left-color: var(--line-solid); opacity: .75; }
.qround { font-family: var(--mono); font-size: 11px; color: var(--amber); letter-spacing: 1px; white-space: nowrap; }
.qitem.done .qround { color: var(--muted); }
.qteams { flex: 1; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-family: var(--display); font-size: 15px; font-weight: 600; }
.qvs { color: var(--muted); font-size: 11px; font-family: var(--mono); }
.qscore { font-family: var(--mono); font-size: 16px; font-weight: 600; color: var(--text); white-space: nowrap; }
.qwin { color: var(--green); }

/* bracket */
.bracket { display: flex; gap: 34px; overflow-x: auto; padding: 8px 2px 18px; }
.bcol { display: flex; flex-direction: column; justify-content: space-around; gap: 14px; min-width: 210px; }
.bcol-title { font-family: var(--display); font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); text-align: center; margin-bottom: 2px; }
.bmatch { background: var(--panel2); border: 1px solid var(--line-solid); border-radius: 4px; overflow: hidden; }
.bmatch.ready { border-color: #ffb44766; }
.brow { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; font-size: 14px; gap: 8px; }
.brow + .brow { border-top: 1px solid var(--line-solid); }
.brow .bname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brow.winner { background: #6fcf8e12; }
.brow.winner .bname { color: var(--green); font-weight: 600; }
.brow .bscore { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.brow.winner .bscore { color: var(--green); }
.bname.tbd { color: var(--muted); font-style: italic; }
.bfoot { padding: 5px 10px; border-top: 1px solid var(--line-solid); text-align: right; }
.seedtag { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-right: 6px; }

/* lists / tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { font-family: var(--display); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line-solid); }
td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: none; }
.mono { font-family: var(--mono); font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* team cards */
.teamgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.teamcard { background: var(--panel2); border: 1px solid var(--line-solid); border-radius: 4px; padding: 14px 16px; }
.teamcard.elim { opacity: .55; }
.teamcard h3 { margin: 0 0 8px; font-size: 15px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.teamcard ul { margin: 0; padding: 0; list-style: none; }
.teamcard li { padding: 3px 0; font-size: 14px; }
.captag { font-family: var(--mono); font-size: 10px; color: var(--amber); letter-spacing: 1px; margin-left: 6px; }

/* draft */
.draft-turn {
  background: var(--amber-dim); border: 1px solid #ffb44755; border-radius: 4px;
  padding: 14px 18px; margin-bottom: 18px;
  font-family: var(--display); font-size: 16px;
}
.draft-turn strong { color: var(--amber); }
.pool { display: flex; flex-wrap: wrap; gap: 8px; }
.poolchip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--panel2); border: 1px solid var(--line-solid); border-radius: 4px;
  padding: 6px 6px 6px 12px; font-size: 14px;
}
.poolchip .rating { font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* champion */
.champ {
  text-align: center; padding: 34px 20px; margin-bottom: 22px;
  border: 1px solid #ffb44755; border-radius: var(--radius);
  background: linear-gradient(180deg, var(--amber-dim), transparent);
}
.champ .champ-label { font-family: var(--mono); font-size: 12px; letter-spacing: 3px; color: var(--amber); text-transform: uppercase; }
.champ h1 { font-size: 40px; margin: 8px 0 0; color: var(--text); }

/* toast + modal */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--panel2); border: 1px solid var(--line-solid); border-left: 3px solid var(--blue);
  color: var(--text); padding: 12px 20px; border-radius: 4px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 100;
  max-width: 90vw;
}
#toast.show { opacity: 1; }
#toast.err { border-left-color: var(--red); }
.modal-bg { position: fixed; inset: 0; background: rgba(5,9,14,.7); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal { background: var(--panel); border: 1px solid var(--line-solid); border-radius: var(--radius); padding: 24px; width: 100%; max-width: 440px; }
.modal h3 { margin: 0 0 6px; font-size: 18px; }
.modal .row { display: flex; gap: 12px; align-items: center; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.copybox { display: flex; gap: 8px; margin: 6px 0 14px; }
.copybox input { font-family: var(--mono); font-size: 12px; }

.section { margin-bottom: 26px; }
.headrow { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.empty { color: var(--muted); font-style: italic; padding: 14px 0; }

.tlist-item {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 13px 16px; background: var(--panel2);
  border: 1px solid var(--line-solid); border-radius: 4px; margin-bottom: 8px;
}
.tlist-item .tname { font-family: var(--display); font-size: 16px; font-weight: 600; }
.tlist-meta { font-family: var(--mono); font-size: 12px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
