/* ── TOKENS ──────────────────────────────────────────────────── */
:root {
  --bg:          #0d1421;
  --surface:     #152035;
  --raised:      #1c2c44;
  --border:      #243550;
  --gridline:    rgba(36, 53, 80, 0.42);

  --text:        #bfcde0;
  --muted:       #5e7490;
  --dim:         #334860;
  --heading:     #e8eeff;

  --gold:        #c29020;
  --gold-hi:     #ddb040;
  --gold-tint:   rgba(194, 144, 32, 0.10);
  --gold-border: rgba(194, 144, 32, 0.35);

  --blue:        #4a82c8;
  --blue-hi:     #7aaae0;
  --green:       #2ea86a;
  --red:         #c84040;

  --nav-bg:      #090f1c;
  --nav-text:    #7a9ec0;
  --nav-border:  #18283e;

  --radius:      3px;
}

@media (prefers-color-scheme: light) { :root {
  --bg:          #e6ecf6;
  --surface:     #f6f9ff;
  --raised:      #ecf1fb;
  --border:      #bfcce0;
  --gridline:    rgba(175, 198, 230, 0.55);
  --text:        #1a2848;
  --muted:       #5878a0;
  --dim:         #a0b4cc;
  --heading:     #0e1c38;
  --gold:        #7a5c00;
  --gold-hi:     #9a7810;
  --gold-tint:   rgba(122, 92, 0, 0.07);
  --gold-border: rgba(122, 92, 0, 0.30);
  --blue:        #2050a0;
  --blue-hi:     #3868c8;
  --green:       #187048;
  --red:         #a82020;
  --nav-bg:      #d6e0f0;
  --nav-text:    #1e3560;
  --nav-border:  #b8c8de;
}}

:root[data-theme="dark"] {
  --bg:          #0d1421; --surface:  #152035; --raised:    #1c2c44;
  --border:      #243550; --gridline: rgba(36,53,80,.42);
  --text:        #bfcde0; --muted:    #5e7490; --dim:       #334860; --heading: #e8eeff;
  --gold:        #c29020; --gold-hi:  #ddb040; --gold-tint: rgba(194,144,32,.10); --gold-border: rgba(194,144,32,.35);
  --blue:        #4a82c8; --blue-hi:  #7aaae0; --green:     #2ea86a; --red:      #c84040;
  --nav-bg:      #090f1c; --nav-text: #7a9ec0; --nav-border:#18283e;
}

:root[data-theme="light"] {
  --bg:          #e6ecf6; --surface:  #f6f9ff; --raised:    #ecf1fb;
  --border:      #bfcce0; --gridline: rgba(175,198,230,.55);
  --text:        #1a2848; --muted:    #5878a0; --dim:       #a0b4cc; --heading:  #0e1c38;
  --gold:        #7a5c00; --gold-hi:  #9a7810; --gold-tint: rgba(122,92,0,.07); --gold-border: rgba(122,92,0,.30);
  --blue:        #2050a0; --blue-hi:  #3868c8; --green:     #187048; --red:      #a82020;
  --nav-bg:      #d6e0f0; --nav-text: #1e3560; --nav-border:#b8c8de;
}

/* ── RESET ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── BASE ────────────────────────────────────────────────────── */
body {
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.65;
  min-height: 100vh;
}

/* ── LAYOUT GRID ─────────────────────────────────────────────── */
.shell {
  display: grid;
  grid-template-columns: 160px 1fr 152px;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
}

/* ── HEADER ──────────────────────────────────────────────────── */
.hdr {
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex;
  align-items: stretch;
  background: var(--nav-bg);
  border-bottom: 2px solid var(--gold);
}

.hdr-logo {
  width: 160px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 8px;
  border-right: 1px solid var(--nav-border);
}
.hdr-logo a { color: var(--nav-text); text-decoration: none; }

.hdr-banner {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 8px 0;
}

.hdr-banner img { max-height: 60px; width: auto; }

/* ── MAIN CONTENT ────────────────────────────────────────────── */
.main-col {
  grid-column: 2;
  grid-row: 2;
  padding: 18px 22px;
  min-width: 0;
}

/* ── RIGHT AD ────────────────────────────────────────────────── */
.ad-col {
  grid-column: 3;
  grid-row: 2;
  padding: 16px 8px;
  border-left: 1px solid var(--border);
}

/* ── WATCH / PRIVATE BADGES ──────────────────────────────────── */
.watch-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid var(--gold-border);
  border-radius: var(--radius);
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.watch-btn:hover, .watch-btn:visited:hover {
  background: var(--gold);
  color: var(--nav-bg);
  border-color: var(--gold);
}
.watch-btn:visited { color: var(--gold); }

.private-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* ── FOOTER ──────────────────────────────────────────────────── */
.ftr {
  grid-column: 1 / -1;
  grid-row: 3;
  background: var(--nav-bg);
  border-top: 1px solid var(--nav-border);
  text-align: center;
  padding: 14px 20px;
  color: var(--muted);
  font-size: 11.5px;
}

.ftr-social { margin-bottom: 6px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.ftr-social a { color: var(--muted); transition: color 0.12s; }
.ftr-social a:hover { color: var(--gold-hi); }

/* ── TYPOGRAPHY ──────────────────────────────────────────────── */
h1, h2, h3 {
  font-family: 'Trebuchet MS', 'Arial Narrow', Arial, sans-serif;
  color: var(--heading);
  font-weight: 700;
  text-wrap: balance;
  letter-spacing: 0.03em;
}
h1 { font-size: 1.6rem; margin-bottom: 12px; }
h2 { font-size: 1.2rem; margin-bottom: 8px; }
h3 { font-size: 1rem;  margin-bottom: 6px; }

a                 { color: var(--blue); text-decoration: none; }
a:visited         { color: var(--blue); }
a:hover           { color: var(--gold-hi); }

/* ── LEGACY CLASS SHIM (keeps existing JSP markup working) ───── */
A.type1-stratego,A.type1-stratego:link,A.type1-stratego:visited
  { color:var(--blue); font-weight:bold; font-size:13pt; text-decoration:none; }
A.type1-stratego:hover,A.type1-stratego:active { color:var(--gold-hi); }

A.type1-stratego-sm,A.type1-stratego-sm:link,A.type1-stratego-sm:visited
  { color:var(--blue); font-size:9pt; text-decoration:none; }
A.type1-stratego-sm:hover { color:var(--gold-hi); }

A.type1-stratego-lg,A.type1-stratego-lg:link,A.type1-stratego-lg:visited
  { color:var(--blue); font-weight:bold; font-size:16pt; text-decoration:none; }
A.type1-stratego-lg:hover { color:var(--gold-hi); }

A.type1-stratego-xsm,A.type1-stratego-xsm:link,A.type1-stratego-xsm:visited
  { color:var(--blue); font-size:8pt; text-decoration:none; }
A.type1-stratego-xsm:hover { color:var(--gold-hi); }

kbd.reg     { color:var(--blue);    font-weight:bold; font-size:0.85rem; font-family:inherit; }
kbd.regb    { color:var(--heading); font-weight:bold; font-size:0.85rem; font-family:inherit; }
kbd.regem   { color:var(--muted);   font-style:italic; font-size:0.85rem; font-family:inherit; }
kbd.smallem { color:var(--muted);   font-style:italic; font-size:0.8rem; font-family:inherit; }
kbd.error   { color:var(--red);     font-style:italic; font-weight:bold; font-family:inherit; }
kbd.success { color:var(--green);   font-style:italic; font-weight:bold; font-family:inherit; }
kbd.small   { color:var(--blue);    font-size:0.8rem; font-family:inherit; }
kbd.smallb  { color:var(--text);    font-size:0.8rem; font-family:inherit; }
kbd.smallbold { color:var(--text);  font-size:0.8rem; font-weight:bold; font-family:inherit; }
kbd.lg      { color:var(--blue);    font-weight:bold; font-size:1.1rem; font-family:inherit; }
kbd.lgb     { color:var(--heading); font-weight:bold; font-size:1.1rem; font-family:inherit; }
kbd.midem   { color:var(--blue);    font-style:italic; font-size:1rem; font-family:inherit; }
kbd.xsmallb { color:var(--muted);   font-size:7.5pt; font-family:inherit; }

/* ── CONTENT COMPONENTS ──────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 14px;
}

.card-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gold-border);
  font-family: 'Trebuchet MS', 'Arial Narrow', Arial, sans-serif;
}

/* Live stat strip */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  text-align: center;
}

.stat-num {
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  font-family: 'Trebuchet MS', Arial, sans-serif;
}

.stat-lbl {
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 5px;
}

.live-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  margin-right: 4px;
  animation: blink 2.2s ease-in-out infinite;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.35} }

@media (prefers-reduced-motion: reduce) {
  .live-dot { animation: none; }
}

/* Game table */
.tbl {
  width: 100%;
  border-collapse: collapse;
}

.tbl-wrap { overflow-x: auto; }

.tbl th {
  background: var(--raised);
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-family: inherit;
}

.tbl td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}

.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: var(--gold-tint); }

.rank {
  display: inline-block;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 4px;
  border-radius: 2px;
  background: var(--raised);
  color: var(--muted);
  border: 1px solid var(--border);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}

/* Action buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 15px;
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  font-family: 'Trebuchet MS', Arial, sans-serif;
  transition: background 0.12s, color 0.12s;
  cursor: pointer;
  background: transparent;
}

.btn:hover, .btn:visited:hover { background: var(--gold); color: var(--nav-bg); }
.btn:visited { color: var(--gold); }

.btn-ghost {
  border-color: var(--border);
  color: var(--muted);
}
.btn-ghost:hover, .btn-ghost:visited:hover {
  background: var(--raised);
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:visited { color: var(--muted); }

/* Download inline row */
.dl-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.dl-inline-lbl {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  flex-shrink: 0;
}

/* Result badges */
.result-win  { color: var(--green); font-weight: 700; }
.result-loss { color: var(--red);   font-weight: 700; }
.result-tie  { color: var(--muted); font-weight: 600; }

.replay-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--blue);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
}
.replay-btn:hover, .replay-btn:visited:hover {
  background: var(--raised);
  border-color: var(--blue);
  color: var(--blue-hi);
}
.replay-btn:visited { color: var(--blue); }

/* Ad placeholder */
.ad-slot {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ad-slot-lbl {
  color: var(--dim);
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  writing-mode: vertical-rl;
}

/* ── THEME TOGGLE ────────────────────────────────────────────── */
.toggle {
  position: fixed;
  top: 10px;
  right: 12px;
  z-index: 999;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 13px;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.05em;
  transition: border-color 0.12s, color 0.12s;
}
.toggle:hover { border-color: var(--gold); color: var(--gold-hi); }
.toggle:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
