:root {
  /* surfaces — neutral dark grey */
  --bg: #131417;
  --bg2: #181a1e;
  --panel: #202329;
  --panel2: #282c33;
  --panel3: #333841;
  --line: #353941;
  --line2: #474d57;
  /* text */
  --text: #edeef1;
  --muted: #9aa0aa;
  --faint: #6c727c;
  /* accents — gold + red (Luxury Ball) */
  --accent: #d4af37;       /* gold (primary) */
  --accent-d: #a9821c;     /* deep gold */
  --accent2: #d24b3e;      /* red (secondary) */
  --good: #d4af37;         /* gold = strong win rate */
  --bad: #d24b3e;          /* red = poor win rate */
  --warn: #ffcf5c;         /* prize gold */
  --gold: #d9b24a;
  --on-gold: #17181c;      /* text on gold surfaces */
  /* shape */
  --r: 14px;
  --r-sm: 9px;
  --shadow: 0 6px 22px rgba(0,0,0,.45);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.32);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }  /* the attribute must win over flex/grid display rules */
html { scrollbar-color: var(--line2) transparent; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 560px at 84% -12%, rgba(217,178,74,.07), transparent 60%),
    radial-gradient(900px 520px at -8% 6%, rgba(255,255,255,.025), transparent 55%),
    var(--bg);
  color: var(--text);
  font: 14px/1.55 "Segoe UI", system-ui, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
/* faded luxury-ball watermark behind everything */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: url("/luxuryball.svg") no-repeat center 54% / min(820px, 88vmin);
  opacity: 0.10;
}
header, main { position: relative; z-index: 1; }

/* header / nav */
header {
  padding: 14px 24px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 26px; flex-wrap: wrap;
  position: sticky; top: 0; z-index: 20;
  background: rgba(17,18,21,.80); backdrop-filter: blur(10px);
}
h1 { font-size: 17px; margin: 0; font-weight: 700; letter-spacing: .2px; display: flex; align-items: center; gap: 9px; }
.brand-logo { width: 24px; height: 24px; display: block; flex: none; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 650; }
h3 { font-size: 11px; margin: 12px 0 6px; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
nav#tabs { display: flex; gap: 4px; }
nav#tabs button {
  background: transparent; border: 1px solid transparent; color: var(--muted);
  padding: 7px 14px; border-radius: 10px; cursor: pointer; font-size: 14px; font-weight: 550;
  transition: background .15s, color .15s, border-color .15s;
}
nav#tabs button:hover { color: var(--text); background: var(--panel); }
nav#tabs button.active {
  color: var(--text); background: linear-gradient(180deg, var(--panel3), var(--panel2));
  border-color: var(--accent); box-shadow: var(--shadow-sm);
}

/* nav dropdown (Log Match Results) */
.nav-dropdown { position: relative; display: inline-block; }
.nav-drop-btn .caret { font-size: 10px; opacity: .8; margin-left: 2px; }
.nav-menu {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 190px;
  background: linear-gradient(180deg, var(--panel3), var(--panel2));
  border: 1px solid var(--line2); border-radius: 11px; box-shadow: var(--shadow);
  padding: 5px; display: none; flex-direction: column; gap: 2px; z-index: 30;
}
.nav-dropdown.open .nav-menu { display: flex; }
.nav-menu button { text-align: left; width: 100%; }

main { padding: 22px; max-width: 1240px; margin: 0 auto; }
.tab { display: none; animation: fade .2s ease; }
.tab.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }
.card {
  background: linear-gradient(180deg, rgba(32,35,41,.70), rgba(24,26,30,.70));
  backdrop-filter: blur(3px);
  border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin-bottom: 18px; box-shadow: var(--shadow-sm);
}

/* forms */
textarea {
  width: 100%; height: 240px; resize: vertical; margin: 10px 0;
  background: var(--bg2); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 12px; font-family: ui-monospace, "Cascadia Code", monospace; font-size: 12px;
}
textarea:focus, input[type=text]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(212,175,55,.20); }
input[type=text] { width: 100%; background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px 11px; margin: 4px 0; }
input[type=file] { color: var(--muted); font-size: 13px; }
label { display: block; margin: 12px 0; font-size: 13px; }
button {
  background: var(--panel2); color: var(--text); border: 1px solid var(--line2);
  padding: 9px 15px; border-radius: var(--r-sm); cursor: pointer; font-size: 14px; font-weight: 550;
  transition: transform .08s, border-color .15s, background .15s;
}
button:hover { border-color: var(--accent); }
button:active { transform: translateY(1px); }
button.primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-d)); border-color: var(--accent-d);
  color: var(--on-gold); font-weight: 700; box-shadow: 0 4px 14px rgba(169,130,28,.40);
}
.row { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.error { color: var(--bad); min-height: 1em; }
.ok { color: var(--good); min-height: 1em; }
small { display: block; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip { background: var(--panel2); border: 1px solid var(--line2); border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 550; }
.chip.win { border-color: var(--good); color: var(--good); box-shadow: 0 0 0 1px rgba(212,175,55,.30) inset; }

/* ---------- REPLAY ---------- */
.replay-head { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
#replay-title { font-size: 15px; }
#replay-title .muted { font-size: 12.5px; margin-top: 4px; }
.controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.controls button { padding: 7px 11px; }
.controls input[type=range] { flex: 1; min-width: 180px; accent-color: var(--accent); }
#rp-pos { font-size: 12.5px; }
.img-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.img-toggle input { accent-color: var(--accent); }

.board { gap: 16px; }
.side {
  min-height: 250px;
  background:
    radial-gradient(420px 200px at 50% 0%, rgba(212,175,55,.07), transparent 70%),
    linear-gradient(180deg, rgba(32,35,41,.70), rgba(24,26,30,.70));
}
.side.is-turn { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(91,140,255,.25), var(--shadow-sm); }
.side-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.side-name { font-size: 14.5px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.turn-badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  background: var(--accent); color: #fff; padding: 2px 7px; border-radius: 999px;
}

/* prize pips */
.prize-pips { display: inline-flex; align-items: center; gap: 5px; }
.pip { width: 11px; height: 14px; border-radius: 2.5px; border: 1px solid var(--line2); background: transparent; opacity: .55; }
.pip.filled { background: linear-gradient(180deg, var(--warn), #d9a233); border-color: #d9a233; opacity: 1; box-shadow: 0 0 6px rgba(255,207,92,.4); }

.bench-label { font-size: 10.5px; color: var(--faint); margin: 12px 0 6px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }

/* a pokemon card */
.mon {
  position: relative; display: flex; gap: 10px; align-items: flex-start;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 9px 11px; margin: 6px 0; background: var(--panel2);
}
.mon.active { background: linear-gradient(180deg, var(--panel3), var(--panel2)); border-color: var(--accent); box-shadow: 0 0 0 1px rgba(91,140,255,.22), var(--shadow-sm); }
.mon.empty { display: block; color: var(--faint); font-style: italic; text-align: center; border-style: dashed; }
.mon-info { flex: 1; min-width: 0; }

/* card image thumbnail (TCGdex) */
.card-img {
  width: 50px; aspect-ratio: 5 / 7; object-fit: cover; flex-shrink: 0;
  border-radius: 5px; border: 1px solid var(--line2); background: var(--bg2); box-shadow: var(--shadow-sm);
}
.mon.active .card-img { width: 66px; }
.card-img.ph {
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: 8.5px; line-height: 1.15; padding: 3px; color: var(--faint); border-style: dashed; overflow: hidden; word-break: break-word;
}
img.card-img { cursor: zoom-in; transition: transform .1s, box-shadow .1s; }
img.card-img:hover { transform: scale(1.04); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }

/* hover-to-enlarge popover */
#card-pop {
  position: fixed; z-index: 100; pointer-events: none; display: none;
  filter: drop-shadow(0 12px 28px rgba(0,0,0,.65));
}
#card-pop img { width: 260px; border-radius: 12px; display: block; }

.mon-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.mon-name { font-weight: 650; font-size: 13.5px; }
.mon-line { font-size: 11px; color: var(--faint); margin-top: 2px; }
.mon-row { display: flex; align-items: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

/* energy badges (background color set inline by JS per type) */
.nrg {
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; border-radius: 50%; font-size: 10px; font-weight: 800; color: #fff;
  border: 1.5px solid rgba(255,255,255,.28); box-shadow: var(--shadow-sm); text-shadow: 0 1px 1px rgba(0,0,0,.4);
}
.tool-chip { font-size: 11px; background: var(--panel); border: 1px solid var(--line2); border-radius: 999px; padding: 1px 8px; color: var(--muted); }

/* damage badge */
.dmg-badge {
  font-size: 12px; font-weight: 750; color: #fff;
  background: linear-gradient(180deg, #ff7a7a, #e23d3d);
  border-radius: 999px; padding: 1px 8px; box-shadow: 0 2px 8px rgba(226,61,61,.4); white-space: nowrap;
}

/* bench grid */
.bench-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 8px; }
.bench-grid .mon { margin: 0; }

/* timeline */
.timeline ol { list-style: none; margin: 0; padding: 0; max-height: 340px; overflow-y: auto; }
.timeline li {
  padding: 3px 10px; border-left: 2px solid transparent; font-size: 13px; cursor: pointer;
  white-space: pre-wrap; border-radius: 0 6px 6px 0; transition: background .1s;
}
.timeline li:hover { background: var(--panel2); }
.timeline li.indent1 { padding-left: 28px; color: var(--muted); }
.timeline li.indent2 { padding-left: 46px; color: var(--faint); font-size: 12px; }
.timeline li.turnhead { color: var(--accent); font-weight: 700; margin-top: 8px; border-left-color: var(--accent-d); }
.timeline li.current { background: linear-gradient(90deg, rgba(91,140,255,.22), transparent); border-left-color: var(--accent); }
.timeline li.attack { color: var(--warn); }
.timeline li.ko { color: var(--bad); font-weight: 650; }

/* ---------- META ---------- */
.my-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.my-id { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.my-id label { margin: 0; color: var(--muted); }
.my-id input[type=text] { width: 230px; margin: 0; }
/* ---- My record hero ---- */
.hero-card { background:
  linear-gradient(180deg, rgba(212,175,55,.07), rgba(24,26,30,0) 58%),
  linear-gradient(180deg, var(--panel), var(--bg2)); border-color: var(--line2); }
.hero-eyebrow { color: var(--faint); text-transform: uppercase; letter-spacing: .08em; font-size: 11px; font-weight: 800; }
.hero { display: flex; align-items: center; justify-content: space-between; gap: 26px; flex-wrap: wrap; margin-top: 14px; }
.hero-main { display: flex; align-items: center; gap: 22px; flex: 1 1 320px; min-width: 260px; }
.hero-record {
  font-size: 54px; font-weight: 850; letter-spacing: .5px; line-height: .95; white-space: nowrap;
  background: linear-gradient(180deg, #f3d985, #c79b2e); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-meta { flex: 1; min-width: 150px; }
.hero-wr { font-size: 17px; font-weight: 750; }
.hero-bar { position: relative; height: 8px; border-radius: 6px; background: var(--bg2); overflow: hidden; margin: 8px 0 7px; max-width: 320px; }
.hero-bar-fill { position: absolute; inset: 0 auto 0 0; border-radius: 6px; background: linear-gradient(90deg, var(--accent-d), var(--accent)); }
.hero-sub { font-size: 12.5px; }
.hero-wld { opacity: .65; }
.hero-splits { display: flex; gap: 12px; }
.hero-split { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 18px; min-width: 98px; text-align: center; }
.hsplit-label { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); font-weight: 700; }
.hsplit-val { display: block; font-size: 22px; font-weight: 800; color: var(--accent); margin: 4px 0 2px; }
.hsplit-games { display: block; font-size: 11px; }
@media (max-width: 600px) {
  .hero-record { font-size: 44px; }
  .hero-splits { width: 100%; }
  .hero-split { flex: 1; }
}

/* ---- My decks (expandable per-deck detail) ---- */
.decks-table td.mono { font-variant-numeric: tabular-nums; font-weight: 650; }
.decks-table .deck-row { cursor: pointer; }
.decks-table .deck-row.open { background: var(--panel2); }
.decks-table .deck-row.open td { border-bottom-color: transparent; }
.decks-table .chev-cell, .decks-table .chev-head { width: 34px; text-align: center; }
.decks-table .chev { color: var(--accent); font-size: 11px; }
.decks-table .deck-detail td { padding: 0; background: var(--bg2); }
.deck-detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 1px; background: var(--line); }
.deck-detail-grid .dstat { background: var(--bg2); padding: 11px 14px; }
.dstat-val { display: block; font-size: 17px; font-weight: 750; font-variant-numeric: tabular-nums; }
.dstat-label { display: block; font-size: 10.5px; color: var(--muted); margin-top: 2px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat {
  background: linear-gradient(180deg, rgba(32,35,41,.70), rgba(24,26,30,.70)); border: 1px solid var(--line);
  backdrop-filter: blur(3px);
  border-radius: var(--r); padding: 15px 17px; position: relative; overflow: hidden; box-shadow: var(--shadow-sm);
}
.stat::after { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: linear-gradient(90deg, var(--accent), transparent); opacity: .7; }
.stat .value { font-size: 25px; font-weight: 750; letter-spacing: .3px; }
.stat .label { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.scroll-x { overflow-x: auto; }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 11px; border-bottom: 1px solid var(--line); }
th { color: var(--faint); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--panel2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* win-rate / popularity bar (JS: .bar > .bar-fill[width,bg] + .bar-label) */
.bar { position: relative; min-width: 84px; height: 20px; border-radius: 6px; background: var(--bg2); overflow: hidden; }
.bar-fill { position: absolute; inset: 0 auto 0 0; border-radius: 6px; opacity: .9; }
.bar-label { position: relative; z-index: 1; font-size: 11.5px; font-weight: 650; line-height: 20px; padding: 0 8px; display: block; text-align: right; }
.wr-good { color: var(--good); }
.wr-bad { color: var(--bad); }

/* cycle selector bar */
.cycle-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.cycle-bar label { margin: 0; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; font-size: 11px; font-weight: 700; }
.cycle-bar select {
  background: linear-gradient(180deg, var(--panel3), var(--panel2)); color: var(--text);
  border: 1px solid var(--line2); border-radius: 9px; padding: 8px 12px; font-size: 14px; font-weight: 600;
}
.cycle-bar #cycle-hint { font-size: 12px; }

/* deck sprites next to archetype names */
.sprites { display: inline-flex; align-items: center; gap: 8px; vertical-align: middle; margin-right: 18px; }
.sprites img { width: 42px; height: 42px; image-rendering: pixelated; object-fit: contain; filter: drop-shadow(0 1px 1px rgba(0,0,0,.4)); }
.arch { display: inline-flex; align-items: center; }

/* sortable table headers */
table.sortable th[data-key] { cursor: pointer; user-select: none; white-space: nowrap; }
table.sortable th[data-key]:hover { color: var(--text); }
th .sort-ind { color: var(--accent); margin-left: 3px; }

/* matrix controls */
.matrix-controls { display: flex; align-items: center; gap: 16px; margin-bottom: 6px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--bg2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.seg button { background: transparent; border: none; color: var(--muted); padding: 6px 14px; border-radius: 7px; font-weight: 600; }
.seg button.active { background: linear-gradient(180deg, var(--accent), var(--accent-d)); color: var(--on-gold); }
.tie-label { color: var(--muted); display: inline-flex; align-items: center; gap: 7px; margin: 0; }
.tie-label select { background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px; }

/* matchup heatmap (JS: td.cell.heat[bg] > .rate + .wlt) */
.matrix { border-collapse: separate; border-spacing: 3px; }
.matrix th { text-align: center; color: var(--muted); }
.matrix th:first-child { background: transparent; }
.matrix td.cell {
  text-align: center; font-variant-numeric: tabular-nums; border-radius: 6px;
  background: var(--bg2); padding: 8px 9px; min-width: 64px;
}
.matrix tbody th { text-align: left; color: var(--text); text-transform: none; letter-spacing: 0; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.matrix th.colhead { padding: 2px 4px; vertical-align: bottom; }
.matrix th.colhead .sprites { margin: 0; }
.matrix .rowhead-inner { display: inline-flex; align-items: center; }
.matrix td.diag { color: var(--faint); background: var(--panel); }
.matrix td.empty { color: var(--faint); background: var(--bg2); }
.matrix td.heat { color: #fff; }
.matrix td.heat .rate { font-weight: 750; font-size: 13px; }
.matrix td.heat .wlt { font-size: 10px; opacity: .9; }

/* format meta (LimitlessTCG) */
.fm-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.fm-deck { display: inline-flex; align-items: center; gap: 20px; }
.fm-icons { display: inline-flex; align-items: center; gap: 8px; }
.fm-icons img { width: 38px; height: 38px; image-rendering: pixelated; object-fit: contain; filter: drop-shadow(0 1px 1px rgba(0,0,0,.4)); }
#fm-table td { vertical-align: middle; }
.fm-rank { color: var(--faint); }
.fm-score { color: var(--muted); font-variant-numeric: tabular-nums; }
.fm-link { color: var(--text); text-decoration: none; }
.fm-link:hover { color: var(--accent); text-decoration: underline; }

/* saved matches — grouped by day */
.log-day { margin-bottom: 18px; }
.log-day-head { display: flex; align-items: center; gap: 12px; padding: 4px 2px 8px; border-bottom: 1px solid var(--line); }
.log-date { font-weight: 650; font-size: 14px; }
.log-decks { display: inline-flex; align-items: center; }
.log-rec { margin-left: auto; font-weight: 800; letter-spacing: .3px; color: var(--gold); font-variant-numeric: tabular-nums; }
.log-matches { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.log-match {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 9px;
  background: var(--panel2); border-left: 3px solid var(--line2); cursor: pointer; transition: transform .08s, background .12s;
}
.log-match:hover { transform: translateX(2px); }
.log-match.win  { background: rgba(46,158,107,.14); border-left-color: #2e9e6b; }
.log-match.loss { background: rgba(192,57,43,.14); border-left-color: #c0392b; }
.log-match.tie  { background: rgba(138,143,153,.12); border-left-color: #8a8f99; }
.log-match .vs { color: var(--faint); font-size: 12px; }
.log-match .opp-name { color: var(--muted); font-size: 12px; }
.log-match .res { margin-left: auto; }
.log-match[data-replay="0"] { cursor: default; }
.log-replay { color: var(--faint); font-size: 12px; }
.log-manual { color: var(--faint); font-size: 11px; border: 1px solid var(--line2); border-radius: 999px; padding: 1px 7px; white-space: nowrap; }
.log-mdate { font-size: 12px; min-width: 84px; }
.edit-log, .del-log { background: none; border: none; cursor: pointer; color: var(--muted); line-height: 1; padding: 4px 6px; border-radius: 6px; }
.edit-log { font-size: 13px; }
.del-log { font-size: 16px; }
.edit-log:hover { color: var(--accent); background: rgba(255,255,255,.06); }
.del-log:hover { color: #e74c3c; background: rgba(255,255,255,.06); }
.edit-field { display: block; font-size: 12px; color: var(--muted); margin: 0 0 12px; }
.edit-field input { margin-top: 5px; }

/* tournaments */
.t-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.t-form label { margin: 0; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.t-form input[type=text] { width: 200px; margin: 0; }
.t-form input[type=date], .t-form select { background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; }
.t-card { padding: 14px 16px; }
.t-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.t-title { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.t-title .small2 { font-size: 11px; }
.t-meta { display: flex; align-items: center; gap: 10px; }
.t-rec { font-size: 18px; font-weight: 800; letter-spacing: .3px; color: var(--gold); }
ol.rounds { list-style: none; margin: 12px 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
ol.rounds li { display: flex; align-items: center; gap: 10px; padding: 5px 8px; border-radius: 8px; background: var(--panel2); }
ol.rounds .rnum { font-size: 11px; color: var(--faint); width: 24px; }
ol.rounds .vs { color: var(--faint); font-size: 12px; }
ol.rounds .first { font-size: 11px; }
.res { font-weight: 800; width: 20px; height: 20px; border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; color: #fff; }
.res-w { background: #2e9e6b; }
.res-l { background: #c0392b; }
.res-t { background: #8a8f99; }
.round-actions { margin-left: auto; display: inline-flex; gap: 4px; align-items: center; }
.del-round, .edit-round { padding: 2px 8px; border-color: transparent; background: transparent; }
.del-round { color: var(--bad); }
.edit-round { color: var(--muted); }
.edit-round:hover { color: var(--accent); }
ol.rounds li.editing { flex-wrap: wrap; }
ol.rounds li.editing input[type=text] { width: 180px; margin: 0; }
ol.rounds li.editing select { background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 6px 8px; }
.er-save, .er-cancel { padding: 6px 12px; }
.placement-edit { cursor: pointer; }
.add-place { color: var(--faint); font-size: 12px; border: 1px dashed var(--line2); border-radius: 999px; padding: 3px 10px; }
.add-place:hover { color: var(--text); border-color: var(--accent); }
.place-input { width: 140px; background: var(--bg2); color: var(--text); border: 1px solid var(--accent); border-radius: 999px; padding: 4px 10px; font-size: 12px; }
.round-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 8px; border-top: 1px solid var(--line); }
.round-form input[type=text] { width: 200px; margin: 0; }
.round-form select { background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; }
.round-form .r-add { padding: 8px 14px; }

/* links / saved */
.link { color: var(--accent); cursor: pointer; background: none; border: none; padding: 0; font: inherit; }
.link:hover { text-decoration: underline; }
.del { color: var(--bad); border-color: rgba(255,107,107,.3); }
.del:hover { border-color: var(--bad); }

/* ---------- auth gate ---------- */
body.not-authed > header, body.not-authed > main, body.not-authed > footer { display: none; }
#auth-screen { position: fixed; inset: 0; z-index: 100; display: none; flex-direction: column; overflow-y: auto; padding: 0; }
body.not-authed #auth-screen { display: flex; }

/* pre-login splash: public header + About / How-it-works pages */
#splash-header { display: flex; align-items: center; gap: 16px; padding: 14px 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 2; }
.splash-brand { background: none; border: none; cursor: pointer; color: var(--text); font-weight: 800; font-size: 18px; display: inline-flex; align-items: center; gap: 8px; }
.splash-brand .brand-logo { height: 22px; width: auto; }
.splash-nav { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.splash-nav button { background: none; border: none; cursor: pointer; color: var(--muted); font: inherit; font-weight: 600; padding: 8px 13px; border-radius: 8px; }
.splash-nav button:hover { color: var(--text); background: var(--panel); }
.splash-nav button.active { color: var(--text); }
.splash-nav .splash-login-link { color: #1a1a1a; background: var(--accent); }
.splash-nav .splash-login-link:hover { background: var(--accent); filter: brightness(1.06); color: #1a1a1a; }
.splash-body { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
#auth-screen[data-view="about"] .splash-body, #auth-screen[data-view="howto"] .splash-body { align-items: flex-start; }
.splash-view { width: 100%; display: flex; justify-content: center; }
.splash-view[hidden] { display: none; }
.auth-card.splash-page { max-width: 760px; text-align: left; }
.auth-card.splash-page h2 { margin: 0 0 14px; }
.auth-card.splash-page > .muted { margin: 0 0 16px; line-height: 1.7; }
.splash-cta { margin-top: 24px; }
.splash-cta .primary { width: auto; padding: 11px 20px; }
.auth-card {
  width: 100%; max-width: 380px; padding: 26px;
  background: linear-gradient(180deg, var(--panel), var(--bg2));
  border: 1px solid var(--line2); border-radius: var(--r); box-shadow: var(--shadow);
}
.auth-title { font-size: 18px; margin: 0 0 18px; justify-content: center; }
.auth-toggle { width: 100%; margin-bottom: 16px; }
.auth-toggle button { flex: 1; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form label { margin: 0; display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.auth-form input[type=text], .auth-form input[type=email], .auth-form input[type=password] {
  width: 100%; background: var(--bg2); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 9px 11px; margin: 0;
}
.auth-form button.primary { margin-top: 6px; }
.auth-note { text-align: center; font-size: 12px; margin-top: 16px; }
.auth-or { display: flex; align-items: center; gap: 10px; margin: 16px 0 12px; color: var(--faint); font-size: 12px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.google-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 10px 14px; background: #fff; color: #1f1f1f;
  border: 1px solid #dadce0; border-radius: var(--r-sm); font-weight: 600; font-size: 14px;
  text-decoration: none; cursor: pointer; transition: background .15s, box-shadow .15s;
}
.google-btn:hover { background: #f5f6f7; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.google-btn .g-logo { width: 18px; height: 18px; display: block; }

/* universal support footer */
.site-footer { margin-top: 26px; padding: 20px 14px 30px; border-top: 1px solid var(--line); text-align: center; }
.footer-thanks { color: var(--muted); font-size: 11px; margin: 0 0 12px; }
.footer-thanks strong { color: var(--text); font-weight: 700; }
.footer-thanks .heart { color: var(--accent); }
.footer-buttons { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.support-btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px; color: #fff; font-weight: 700; font-size: 11px; text-decoration: none; transition: transform .12s ease, filter .12s ease; }
.support-btn:hover { filter: brightness(1.07); transform: translateY(-1px); }
.support-btn .brand-ico { width: 14px; height: 14px; }
.support-btn.patreon { background: #f96854; }
.support-btn.kofi { background: #29abe0; }
.footer-meta { color: var(--faint); font-size: 10px; margin: 14px 0 0; letter-spacing: .02em; }
.footer-link { display: inline-block; margin-top: 12px; padding: 6px 14px; background: transparent; border: 1px solid var(--line2); color: var(--muted); border-radius: 999px; font-size: 11px; font-weight: 600; cursor: pointer; transition: color .12s ease, border-color .12s ease; }
.footer-link:hover { color: var(--text); border-color: var(--accent); }

/* feedback modal */
.modal-overlay { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(0, 0, 0, .62); }
.modal-card { width: 100%; max-width: 440px; padding: 22px; background: linear-gradient(180deg, var(--panel), var(--bg2)); border: 1px solid var(--line2); border-radius: var(--r); box-shadow: var(--shadow); }
.modal-card h3 { margin: 0 0 6px; font-size: 17px; }
.modal-sub { font-size: 12px; margin: 0 0 12px; }
.modal-card textarea { width: 100%; background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; font-family: inherit; font-size: 13px; resize: vertical; min-height: 96px; box-sizing: border-box; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.modal-actions button { padding: 8px 16px; border-radius: var(--r-sm); font-weight: 600; font-size: 13px; cursor: pointer; }
.modal-card .ghost { background: transparent; border: 1px solid var(--line2); color: var(--muted); }
.modal-card .ghost:hover { color: var(--text); }
.modal-msg { font-size: 12px; margin: 10px 0 0; min-height: 1.1em; }

/* feedback viewer (owner) */
.fb-item { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg2); margin-bottom: 10px; }
.fb-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.fb-who { font-weight: 600; color: var(--text); }
.fb-when { white-space: nowrap; }
.fb-msg { font-size: 13px; white-space: pre-wrap; word-break: break-word; }

/* collapsible card (manual entries) */
.collapse-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; background: transparent; border: none; color: var(--text); cursor: pointer; padding: 0; text-align: left; }
.collapse-title { font-size: 15px; font-weight: 650; }
.collapse-count { color: var(--muted); font-weight: 500; font-size: 13px; margin-left: 4px; }
.collapse-head .caret { color: var(--muted); transition: transform .15s ease; }
.collapse-head.open .caret { transform: rotate(180deg); }
.collapse-body { margin-top: 14px; }

/* match type (log save) + tournament badge */
.match-type { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 16px 0 4px; }
.mt-label { font-size: 12px; color: var(--muted); }
.match-type .seg { width: auto; }
.event-name { background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 7px 11px; font-size: 13px; min-width: 220px; flex: 1; }
.log-tourney { font-size: 11px; color: var(--accent); background: rgba(212,175,55,.12); border: 1px solid rgba(212,175,55,.32); border-radius: 999px; padding: 2px 9px; white-space: nowrap; }

/* About page */
.about { max-width: 760px; }
.about h2 { margin-bottom: 14px; }
.about-body p { color: var(--text); line-height: 1.7; margin: 0 0 14px; }
.about-body p:last-child { margin-bottom: 0; }
.about-video { margin-top: 26px; }
.about-video h3 { margin: 0 0 12px; }
.video-embed { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); background: var(--bg2); }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-size: 15px; }
.vp-play { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 999px; border: 1px solid var(--line2); color: var(--accent); }
.about-sign { color: var(--muted); font-style: italic; margin-top: 22px; }

.user-chip { margin-left: auto; display: inline-flex; align-items: center; gap: 10px; font-size: 13px; }
#user-name { color: var(--muted); }
#logout-btn { padding: 5px 12px; }
