:root {
  --bg: #0e1117;
  --panel: #161b24;
  --panel-2: #1d2430;
  --line: #262f3d;
  --text: #e6edf3;
  --muted: #8b97a8;
  --accent: #f2a83b;
  --accent-2: #3ba55d;
  --danger: #e5534b;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .22);
}

* { box-sizing: border-box; }

/* The `hidden` attribute is only `display: none` in the UA stylesheet, so any
   author rule setting `display` silently beats it -- which is how the
   default-password banner stayed visible after the password was changed. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 20px; }
h2 { font-size: 15px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #141a23, #0e1117);
}

.brand { display: flex; align-items: center; gap: 14px; }
.team { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .09em; }

.ball {
  width: 30px; height: 30px; border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #ffd98a, var(--accent) 62%, #b9791f);
  box-shadow: 0 0 18px rgba(242, 168, 59, .35);
  flex: none;
}

.totals { display: flex; gap: 22px; color: var(--muted); font-size: 12.5px; }
.totals b { display: block; color: var(--text); font-size: 18px; font-variant-numeric: tabular-nums; }

/* ---------- layout ---------- */

/* Scoped to a class, not the bare `main` element: the login page is a <main>
   too, and this grid's fixed 340px sidebar column squeezed its content column
   to nothing. */
.app-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  padding: 18px 24px 40px;
  align-items: start;
  max-width: 1280px;
  margin: 0 auto;
}

.side { display: grid; gap: 18px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.hint { color: var(--muted); font-size: 12px; }
.empty { color: var(--muted); font-size: 13.5px; margin: 14px 2px 4px; }

/* ---------- standings table ---------- */

.table-scroll { overflow-x: auto; margin-top: 12px; }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }

th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  font-weight: 600;
  padding: 0 10px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td { padding: 11px 10px; border-bottom: 1px solid rgba(38, 47, 61, .6); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255, 255, 255, .022); }
.num { text-align: right; }
th.num:last-child, td:last-child { width: 1%; }

.rank { color: var(--muted); font-variant-numeric: tabular-nums; }
tr.top .rank { color: var(--accent); font-weight: 700; }
.pname { font-weight: 550; }
.rating { font-weight: 650; }
.pos { color: var(--accent-2); }
.neg { color: var(--danger); }
.dim { color: var(--muted); }

.streak {
  display: inline-block;
  min-width: 34px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  text-align: center;
}
.streak.w { background: rgba(59, 165, 93, .16); color: #62c98a; }
.streak.l { background: rgba(229, 83, 75, .14); color: #ef7a73; }

/* ---------- forms ---------- */

label { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 5px; }

input, select, button { font: inherit; }

input[type="text"], input[type="number"], input[type="password"], select {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 10px;
}

input:focus, select:focus, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}

input::placeholder { color: #5d6878; }

form { margin-top: 12px; }

.matchup { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: end; }
.side-pick { min-width: 0; display: grid; gap: 8px; }
.side-pick select, .side-pick input { min-width: 0; }
.side-pick input[type="number"] { text-align: center; font-weight: 650; font-size: 17px; }
.vs { color: var(--muted); font-size: 12px; padding-bottom: 11px; text-transform: uppercase; }

.h2h { margin: 12px 0 0; color: var(--muted); font-size: 12.5px; text-align: center; }

button {
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 9px 14px;
  font-weight: 600;
  transition: filter .12s ease, background .12s ease;
}
button:hover { filter: brightness(1.08); }
button:active { transform: translateY(1px); }

.primary { background: var(--accent); color: #17130a; width: 100%; margin-top: 14px; }

.inline-form { display: flex; gap: 8px; }
.inline-form .primary { width: auto; margin-top: 0; flex: none; }

.icon-btn {
  background: none;
  border: 0;
  color: #55606f;
  padding: 2px 6px;
  font-size: 16px;
  line-height: 1;
  border-radius: 6px;
}
.icon-btn:hover { color: var(--danger); background: rgba(229, 83, 75, .1); }

/* ---------- match list ---------- */

.matches { list-style: none; margin: 12px 0 0; padding: 0; max-height: 420px; overflow-y: auto; }

.matches li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 9px 4px;
  border-bottom: 1px solid rgba(38, 47, 61, .6);
}
.matches li:last-child { border-bottom: 0; }

.result { min-width: 0; }
.result .line { display: flex; align-items: baseline; gap: 6px; font-size: 13.5px; }
.winner { font-weight: 650; }
.loser { color: var(--muted); }
.score { font-variant-numeric: tabular-nums; font-weight: 650; color: var(--accent); }
.when { color: #5d6878; font-size: 11.5px; margin-top: 2px; }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent-2);
  border-radius: 10px;
  padding: 11px 16px;
  box-shadow: var(--shadow);
  font-size: 14px;
  z-index: 20;
  max-width: min(92vw, 420px);
}
.toast.error { border-left-color: var(--danger); }

/* ---------- login ---------- */

/* Flex centering: a grid with `place-items: center` doesn't stretch the card,
   which leaves its percentage width resolving against a min-content track. */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}
.login-wrap { width: 100%; max-width: 380px; }
.login-card { padding: 26px 24px 24px; }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.login-brand h1 { font-size: 21px; line-height: 1.2; }
.login-card label.spaced { margin-top: 14px; }

/* Chrome paints autofilled fields white unless the background is faked with an
   inset shadow, which `background` alone can't override. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 100px var(--panel-2) inset;
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
}

.check {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 16px 0 0;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.check input { width: 15px; height: 15px; accent-color: var(--accent); flex: none; }

.form-error {
  margin: 14px 0 0;
  padding: 9px 11px;
  border-radius: 8px;
  background: rgba(229, 83, 75, .12);
  border: 1px solid rgba(229, 83, 75, .3);
  color: #ef7a73;
  font-size: 13px;
}

button:disabled { opacity: .6; cursor: default; }

/* ---------- account ---------- */

.topbar-right { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.account { display: flex; align-items: center; gap: 10px; }
.who { color: var(--muted); font-size: 12.5px; }

.ghost { background: var(--panel-2); border-color: var(--line); color: var(--text); font-size: 13px; padding: 7px 12px; }
.ghost:hover { background: #26303f; }

.banner {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 9px 16px;
  background: rgba(242, 168, 59, .1);
  border-bottom: 1px solid rgba(242, 168, 59, .25);
  color: #f0bd6d;
  font-size: 13px;
}

.linklike {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  text-decoration: underline;
  font-size: 13px;
  font-weight: 600;
}

#account-panel summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#account-panel summary::-webkit-details-marker { display: none; }
#account-panel summary::after { content: "＋"; color: var(--muted); font-size: 15px; }
#account-panel[open] summary::after { content: "－"; }
#account-panel label.spaced, #account-panel .hint.spaced { margin-top: 12px; }
#account-panel .hint { display: block; }

@media (max-width: 900px) {
  .app-layout { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .topbar { padding: 16px; }
}
