:root {
  --bg: #302e2b;
  --bg-2: #262522;
  --bg-3: #21201d;
  --panel: #262522;
  --panel-2: #3c3a37;
  --panel-3: #454341;
  --line: #3f3d3a;
  --text: #ffffff;
  --text-2: #c3c2c1;
  --text-3: #989795;
  --green: #81b64c;
  --green-hi: #95c264;
  --green-shadow: #45753c;
  --red: #e02828;
  --gold: #f7c631;
  --blue: #5d9bd5;
  --sq-light: #ebecd0;
  --sq-dark: #739552;
  --sq-hl: rgba(255, 255, 51, 0.5);
  --radius: 10px;
  --sidebar: 214px;
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --piece-font: 'Noto Sans Symbols 2', 'Segoe UI Symbol', 'DejaVu Sans', 'Apple Symbols', sans-serif;
}
body.theme-brown { --sq-light: #f0d9b5; --sq-dark: #b58863; }
body.theme-blue { --sq-light: #dee3e6; --sq-dark: #8ca2ad; }
body.theme-purple { --sq-light: #efeef5; --sq-dark: #8877b7; }
body.theme-gray { --sq-light: #d9d9d9; --sq-dark: #8b8b8b; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3, h4 { margin: 0; font-weight: 900; letter-spacing: -0.01em; }
p { margin: 0; }
input, select, textarea { font-family: inherit; }
[hidden] { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: 0; border-radius: var(--radius);
  font-weight: 800; font-size: 17px; color: #fff;
  padding: 14px 22px; min-height: 48px;
  transition: filter .12s, transform .06s;
  text-align: center; white-space: nowrap;
}
.btn:active { transform: translateY(2px); }
.btn-primary {
  background: var(--green);
  box-shadow: inset 0 -5px 0 var(--green-shadow), 0 2px 6px rgba(0,0,0,.25);
  text-shadow: 0 1px 0 rgba(0,0,0,.25);
}
.btn-primary:hover { background: var(--green-hi); }
.btn-secondary {
  background: var(--panel-2);
  box-shadow: inset 0 -4px 0 #2b2926;
  color: var(--text-2);
}
.btn-secondary:hover { background: var(--panel-3); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { color: #fff; background: rgba(255,255,255,.06); }
.btn-danger { background: #c33; box-shadow: inset 0 -4px 0 #8e1f1f; }
.btn-lg { font-size: 24px; padding: 20px 32px; min-height: 72px; border-radius: 12px; }
.btn-sm { font-size: 14px; padding: 8px 14px; min-height: 36px; box-shadow: inset 0 -3px 0 var(--green-shadow); }
.btn-sm.btn-secondary { box-shadow: inset 0 -3px 0 #2b2926; }
.btn-block { width: 100%; }
.icon-btn {
  background: transparent; border: 0; color: var(--text-2); font-size: 20px;
  width: 40px; height: 40px; border-radius: 8px;
}
.icon-btn:hover { background: rgba(255,255,255,.08); color: #fff; }

/* ---------- Sidebar (Spartan: dark stone, bronze frame, gold lettering; the user's home-page picture) ---------- */
:root {
  --sp-font: 'Cinzel', 'Trajan Pro', Georgia, serif;
  --sp-serif: 'EB Garamond', Georgia, serif;
  --sp-title: 'Cormorant Garamond', 'EB Garamond', Georgia, serif;   /* the mixed-case titles: ChessNest, Battle Chess, Your Move */
  --sp-gold: #e9c27a;
  --sp-gold-hi: #f7dfa6;
  --sp-gold-line: rgba(214, 166, 84, .55);
  --sp-red: #9c1418;
  /* rough stone: fractal noise over a dark brown gradient */
  --sp-stone: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .55 0 0 0 0 .42 0 0 0 0 .3 0 0 0 .22 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar);
  background: var(--sp-stone), radial-gradient(120% 60% at 50% 0%, #3a2a1d 0%, transparent 70%), linear-gradient(180deg, #221912, #15100c 60%, #1c140e);
  border-right: 3px solid transparent;
  border-image: linear-gradient(180deg, #8a5a26, #d9a656 30%, #7a4c1e 60%, #c99545 85%, #6b4219) 1;
  box-shadow: inset -6px 0 14px rgba(0, 0, 0, .6), 4px 0 18px rgba(0, 0, 0, .45);
  display: flex; flex-direction: column;
  z-index: 50; padding: 6px 0 10px; overflow-y: auto; overflow-x: visible;
}
.logo {
  display: flex; align-items: center; gap: 2px;
  font-weight: 900; font-size: 21px; letter-spacing: -0.03em;
  padding: 6px 14px 12px;
}
.logo b { color: var(--green); font-weight: 900; }
.logo-mark {
  font-family: var(--piece-font); color: var(--green); font-size: 28px; line-height: 1;
  margin-right: 2px; text-shadow: 0 2px 0 var(--green-shadow);
}
.sp-logo { flex-direction: column; justify-content: center; gap: 0; padding: 4px 10px 12px; letter-spacing: 0; }
.sp-logo img { width: 92px; height: auto; margin-bottom: -6px; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .7)); }
.sp-logo span, .sp-logo-small span {
  font-family: var(--sp-title); font-weight: 700; font-size: 32px; line-height: 1.05;
  background: linear-gradient(180deg, #fbe7b5 10%, #e3b366 55%, #a8722f 95%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 1px rgba(0, 0, 0, .85));
}
.sp-logo-small { gap: 6px; padding: 0; }
.sp-logo-small img { width: 34px; }
.sp-logo-small span { font-size: 24px; }
.nav { display: flex; flex-direction: column; gap: 7px; padding: 4px 0 10px; border-bottom: 1px solid var(--sp-gold-line); margin: 0 10px; }
.nav-item { position: relative; }
.nav-link {
  display: flex; align-items: center; gap: 12px; width: 100%;
  font-family: var(--sp-font); font-weight: 700; font-size: 16px; letter-spacing: .02em; color: #f3e6cc; text-align: left;
  padding: 7px 10px; min-height: 48px; border-radius: 4px;
  background: var(--sp-stone), linear-gradient(180deg, #2b211a, #18120e);
  border: 1px solid rgba(201, 150, 72, .38);
  box-shadow: inset 0 1px 0 rgba(255, 220, 160, .07), inset 0 -10px 18px rgba(0, 0, 0, .35), 0 2px 4px rgba(0, 0, 0, .45);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .9);
  transition: background .15s, border-color .15s, color .15s;
}
.nav-link.small { font-size: 14px; }
.nav-link:hover, .nav-item:hover > .nav-link { color: #fff; border-color: rgba(233, 194, 122, .75); background: var(--sp-stone), linear-gradient(180deg, #3a2c20, #1f1712); }
.nav-link.active, .nav-link.active:hover, .nav-item:hover > .nav-link.active {
  color: #fff6e0; border: 1px solid #e0b062;
  background: radial-gradient(120% 140% at 50% 0%, #c52a25 0%, #8f1215 55%, #5e0a0c 100%);
  box-shadow: inset 0 0 0 1px rgba(80, 10, 10, .9), inset 0 0 0 3px rgba(224, 176, 98, .35), 0 0 14px rgba(200, 40, 30, .35), 0 3px 6px rgba(0, 0, 0, .5);
}
.nav-ic { width: 38px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.nav-ic img { max-width: 36px; max-height: 32px; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .8)); }
.flyout {
  position: absolute; left: calc(100% + 6px); top: 0; min-width: 240px;
  background: var(--sp-stone), linear-gradient(180deg, #2a2019, #16110d);
  border: 1px solid var(--sp-gold-line); border-radius: 6px;
  padding: 8px 0; display: none; box-shadow: 8px 8px 24px rgba(0,0,0,.55);
}
.nav-item:hover .flyout { display: block; }
.flyout a {
  display: flex; gap: 12px; align-items: center; padding: 9px 18px;
  color: #eadbbd; font-weight: 700; font-size: 14px;
}
.flyout a:hover { background: rgba(156, 20, 24, .55); color: #fff; }
.flyout .fl-ic { width: 22px; text-align: center; }
.flyout-title { padding: 6px 18px 8px; font-family: var(--sp-font); font-weight: 800; font-size: 17px; color: var(--sp-gold); }
.sidebar-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 7px; padding: 12px 10px 0; }
#authArea { display: flex; flex-direction: column; gap: 8px; }
#authArea:empty, #logoutArea:empty { display: none; }
#authArea .btn { font-size: 14px; min-height: 38px; padding: 8px; }
.user-chip {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px 6px 4px; min-height: 70px;
  border-radius: 6px; font-family: var(--sp-font); font-weight: 800; font-size: 16px; color: #fff;
  background: var(--sp-stone), linear-gradient(180deg, #2b211a, #17110d);
  border: 1px solid rgba(214, 166, 84, .6);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .55), 0 2px 5px rgba(0, 0, 0, .5);
}
.user-chip .avatar { width: 58px; height: 58px; font-size: 32px; border-radius: 50%; flex: none;
  border: 3px solid #d8a85a; box-shadow: 0 0 0 2px #4a2e12, 0 3px 8px rgba(0, 0, 0, .7), inset 0 0 10px rgba(0, 0, 0, .6); }
.user-chip .uc-name { font-family: var(--sp-serif); font-weight: 700; font-size: 19px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 1px 2px #000; }
.user-chip .uc-go { color: var(--sp-gold); font-size: 26px; line-height: 1; font-family: var(--font); }
.user-chip:hover { border-color: #f0c97a; }
/* the bots' warrior portraits */
.avatar-portrait { background: #120d0a !important; overflow: hidden; padding: 0; }
.avatar-portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.sm { width: 34px; height: 34px; font-size: 20px; border-radius: 6px; }
.side-head .avatar { flex: none; border: 1px solid #d8a85a; }
.tabs .tab-ic { width: 22px; height: 22px; object-fit: contain; vertical-align: -5px; margin-right: 6px; filter: drop-shadow(0 1px 1px #000); }
.tabs .tab-duo { display: inline-flex; margin-right: 6px; vertical-align: -5px; }
.tabs .tab-duo img { width: 18px; height: 22px; object-fit: contain; filter: drop-shadow(0 1px 1px #000); }
.tabs .tab-duo img + img { margin-left: -5px; }
/* Spartan helmet avatars */
.avatar-helmet { background: radial-gradient(circle at 50% 40%, #4a3524, #1a120c 75%) !important; overflow: hidden; }
.av-img { width: 82%; height: 82%; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .7)); }
.tc-btn .av-img { width: 30px; height: 30px; vertical-align: middle; }

.topbar { display: none; }
.scrim { display: none; }

main { margin-left: var(--sidebar); min-height: 100vh; outline: none; }
.page { max-width: 1200px; margin: 0 auto; padding: 24px 24px 64px; }
.page-narrow { max-width: 960px; }

/* ---------- Landing ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px;
  align-items: center; max-width: 1050px; margin: 0 auto; padding: 16px 24px 72px;
}
.hero-board { max-width: 520px; width: 100%; justify-self: end; }
.hero-copy { text-align: center; max-width: 440px; }
.hero-copy h1 { font-size: 52px; line-height: 1.12; margin-bottom: 18px; }
.hero-copy .sub { color: var(--text-2); font-size: 18px; font-weight: 700; margin-bottom: 30px; }
.hero-stats { display: flex; gap: 28px; justify-content: center; margin-bottom: 28px; color: var(--text-2); font-weight: 700; }
.hero-stats b { color: #fff; font-size: 20px; display: block; }
.hero-copy .btn-lg { width: 100%; max-width: 380px; }
.hero-copy .alt { margin-top: 14px; }

.feature {
  display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: center;
  max-width: 1050px; margin: 0 auto; padding: 64px 24px;
}
.feature.reverse .feature-art { order: -1; }
.feature h2 { font-size: 40px; line-height: 1.12; margin-bottom: 14px; }
.feature p { color: var(--text-2); font-size: 17px; font-weight: 600; margin-bottom: 26px; max-width: 420px; }
.feature .btn { min-width: 240px; }
.feature-art { display: flex; justify-content: center; }

.bot-collage { display: grid; grid-template-columns: repeat(3, 96px); gap: 12px; transform: rotate(-4deg); }
.bot-collage .avatar { width: 96px; height: 96px; font-size: 52px; border-radius: 14px; }
.bot-collage .avatar:nth-child(3n+2) { transform: translateY(-24px); }

.art-card {
  width: 100%; max-width: 420px; background: var(--bg-2); border-radius: 16px; padding: 18px;
  box-shadow: 0 20px 40px rgba(0,0,0,.35); position: relative;
}
.art-tag {
  position: absolute; top: -12px; left: 18px; background: var(--red); color: #fff;
  font-weight: 900; font-size: 12px; padding: 4px 10px; border-radius: 6px; letter-spacing: .06em;
}
.art-tag.green { background: var(--green); }
.art-players { display: flex; justify-content: space-between; margin: 10px 2px 0; font-weight: 800; font-size: 14px; }

.section-title { text-align: center; font-size: 36px; margin-bottom: 28px; }
.news-wrap { max-width: 1050px; margin: 0 auto; padding: 48px 24px; }
.news-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.news-card { display: block; text-align: center; }
.news-card .thumb {
  aspect-ratio: 16/9; border-radius: 10px; margin-bottom: 14px; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--piece-font); font-size: 72px; color: rgba(255,255,255,.9);
  text-shadow: 0 6px 16px rgba(0,0,0,.35);
}
.news-card .thumb .badge {
  position: absolute; left: 10px; top: 10px; font-family: var(--font); font-size: 11px;
  background: rgba(0,0,0,.55); padding: 3px 8px; border-radius: 5px; font-weight: 900; text-shadow: none;
}
.news-card h3 { font-size: 18px; line-height: 1.3; margin-bottom: 6px; }
.news-card:hover h3 { color: var(--green-hi); }
.news-card .by { color: var(--text-3); font-size: 14px; font-weight: 700; }

.app-promo {
  max-width: 1050px; margin: 40px auto; background: var(--bg-2); border-radius: 18px;
  display: grid; grid-template-columns: 1.2fr 1fr; align-items: center; overflow: hidden;
}
.app-promo .copy { padding: 48px; text-align: center; }
.app-promo h2 { font-size: 36px; line-height: 1.15; margin-bottom: 22px; }
.store-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.store-btn {
  display: flex; align-items: center; gap: 10px; background: #3c3a37; border-radius: 10px;
  padding: 8px 16px; font-weight: 800; font-size: 14px; line-height: 1.1; text-align: left;
}
.store-btn small { display: block; font-size: 10px; color: var(--text-2); font-weight: 700; }
.store-btn span.ic { font-size: 24px; }
.phone {
  width: 250px; margin: 36px auto -60px; background: #111; border-radius: 34px; padding: 12px;
  box-shadow: 0 0 0 3px #444, 0 30px 60px rgba(0,0,0,.5);
}
.phone-screen { background: var(--bg); border-radius: 24px; overflow: hidden; padding: 12px 8px 60px; }
.phone-head { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 12px; margin: 6px 4px 8px; }
.phone-head .clock { margin-left: auto; background: #fff; color: #222; padding: 2px 8px; border-radius: 4px; }

.final-cta { text-align: center; padding: 72px 24px; }
.final-cta h2 { font-size: 40px; margin-bottom: 24px; }

.footer {
  border-top: 1px solid var(--line); padding: 28px 24px 40px; color: var(--text-3);
  font-size: 13px; font-weight: 700; text-align: center;
}
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; margin-bottom: 12px; }
.footer-links a:hover { color: #fff; }

/* ---------- Avatars ---------- */
.avatar {
  width: 40px; height: 40px; border-radius: 6px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px; background: linear-gradient(135deg, #6a6865, #3c3a37);
  font-weight: 900; color: #fff; overflow: hidden;
}
.avatar.lg { width: 72px; height: 72px; font-size: 40px; border-radius: 10px; }
.avatar.xl { width: 110px; height: 110px; font-size: 60px; border-radius: 12px; }

/* ---------- Cards / panels ---------- */
.card { background: var(--panel); border-radius: var(--radius); padding: 18px; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h3 { font-size: 17px; display: flex; align-items: center; gap: 8px; }
.card-head a { color: var(--text-3); font-weight: 800; font-size: 13px; }
.card-head a:hover { color: #fff; }
.muted { color: var(--text-3); }
.text-2 { color: var(--text-2); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  background: var(--panel-2); font-size: 12px; font-weight: 800; color: var(--text-2);
}
.pill.live { background: var(--red); color: #fff; }
.pill.green { background: var(--green); color: #fff; }

/* ---------- Home dashboard ---------- */
.home-head { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.home-head h1 { font-size: 26px; }
.home-head .flag { font-size: 18px; }
.home-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; }
.play-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.play-tiles .main-play { grid-column: span 4; }
.tile {
  background: var(--panel); border-radius: var(--radius); padding: 16px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-weight: 800; color: var(--text-2); text-align: center; border: 0; font-size: 15px;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.25);
}
.tile:hover { background: var(--panel-2); color: #fff; }
.tile .ti { font-size: 32px; }
.tc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tc-btn {
  background: var(--panel-2); border: 2px solid transparent; color: #fff; border-radius: 8px;
  padding: 10px 6px; font-weight: 800; font-size: 14px;
}
.tc-btn:hover { background: var(--panel-3); }
.tc-btn.sel { border-color: var(--green); background: var(--panel-3); }
.tc-label { font-weight: 800; color: var(--text-2); font-size: 13px; margin: 12px 0 6px; display: flex; align-items: center; gap: 6px; }

.games-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.games-table th { text-align: left; color: var(--text-3); font-weight: 800; padding: 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.games-table td { padding: 10px 8px; border-top: 1px solid var(--line); font-weight: 700; }
.games-table tr.clickable { cursor: pointer; }
.games-table tr.clickable:hover td { background: var(--panel-2); }
.res { display: inline-flex; width: 22px; height: 22px; border-radius: 4px; align-items: center; justify-content: center; font-weight: 900; font-size: 13px; color: #fff; }
.res.win { background: var(--green); } .res.loss { background: #c33; } .res.draw { background: #777; }

.rating-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-top: 1px solid var(--line); font-weight: 800; }
.rating-row:first-of-type { border-top: 0; }
.rating-row .ri { width: 28px; text-align: center; font-size: 20px; }
.rating-row .rv { margin-left: auto; font-size: 18px; }

.progress { height: 8px; background: var(--panel-2); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--green); border-radius: 99px; }

.home-top { display: grid; grid-template-columns: 240px repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.play-card { display: flex; flex-direction: column; }
.home-links { display: flex; flex-direction: column; gap: 8px; }
.home-links .btn { font-size: 15px; min-height: 42px; padding: 8px 12px; justify-content: center; }
.mini-card { display: flex; flex-direction: column; gap: 10px; padding: 10px; transition: background .12s; }
.mini-card:hover { background: var(--panel-2); }
.mini-card + .mini-card, .play-card + .mini-card { margin-top: 0; }
.mini-title { font-weight: 800; font-size: 14px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-card .btn { margin-top: auto; }
.bot-hero { aspect-ratio: 1; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 84px; }
.banner {
  display: flex; align-items: center; gap: 18px; justify-content: space-between; flex-wrap: wrap;
  background: linear-gradient(110deg, #2f4a24 0%, #262522 70%); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 16px;
}
.banner h3 { font-size: 22px; margin-bottom: 4px; }
.banner p { font-weight: 600; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; font-weight: 800; font-size: 12px; color: var(--text-3); }
.week > div { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.week span { width: 30px; height: 30px; border-radius: 50%; background: var(--panel-2); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 14px; }
.week .on span { background: #ff8a2b; }
.week .today { color: #fff; }
.week .today span { box-shadow: 0 0 0 2px #fff; }
.friend-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-weight: 800; }
.friend-row .avatar { width: 32px; height: 32px; font-size: 18px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #666; margin-left: auto; }
.dot.on { background: var(--green); }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; margin-bottom: 8px; color: var(--text-3); font-weight: 800; font-size: 12px; }
.stat-row b { display: block; color: #fff; font-size: 22px; }
.empty { text-align: center; padding: 28px 10px; }
.news-feature { display: grid; grid-template-columns: 1.3fr 1fr; gap: 28px; align-items: center; background: var(--panel); border-radius: 14px; overflow: hidden; }
.news-feature .thumb { aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center; font-size: 120px; font-family: var(--piece-font); }
.news-feature > div:last-child { padding: 24px 24px 24px 0; }
.news-feature h2 { font-size: 30px; line-height: 1.15; margin: 12px 0 10px; }
.news-feature:hover h2 { color: var(--green-hi); }
.faq summary { cursor: pointer; font-weight: 900; font-size: 16px; }
.swatch i { display: block; }
.piece-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.piece-opt { background: var(--panel-2); border: 3px solid transparent; border-radius: 10px; padding: 10px; color: #fff; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.piece-opt.sel { border-color: var(--green); }
.piece-opt b { margin-top: 6px; font-size: 13px; }
.po-row { display: flex; }
.po-sq { width: 34px; height: 34px; position: relative; display: flex; align-items: center; justify-content: center; container-type: inline-size; background: var(--sq-light); }
.po-row .po-sq:nth-child(even) { background: var(--sq-dark); }
.po-row + .po-row .po-sq { background: var(--sq-dark); }
.po-row + .po-row .po-sq:nth-child(even) { background: var(--sq-light); }
.po-sq .piece { font-size: 78cqi; }
.po-sq .piece.fig { font-size: 0; }
.po-sq .piece.fig.tall, .inline-piece .piece.fig.tall, .seg .piece.fig.tall, .promo-picker .piece.fig.tall { inset: 0; height: auto; }
@media (max-width: 1250px) { .home-top { grid-template-columns: 1fr 1fr; } }
@media (max-width: 860px) { .news-feature { grid-template-columns: 1fr; } .news-feature > div:last-child { padding: 0 18px 20px; } }

/* ---------- Board ---------- */
.board-wrap { position: relative; width: 100%; aspect-ratio: 1; user-select: none; -webkit-user-select: none; touch-action: none; }
.board {
  position: absolute; inset: 0; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr);
  border-radius: 4px; overflow: hidden; container-type: inline-size;
}
.sq { position: relative; display: flex; align-items: center; justify-content: center; }
.sq.light { background: var(--sq-light); }
.sq.dark { background: var(--sq-dark); }
.sq.last::before, .sq.sel::before { content: ''; position: absolute; inset: 0; background: var(--sq-hl); }
.sq.check::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle, rgba(255,0,0,.9) 0%, rgba(231,0,0,.6) 30%, rgba(169,0,0,0) 70%);
}
.sq.hint::after {
  content: ''; position: absolute; width: 33%; height: 33%; border-radius: 50%; background: rgba(0,0,0,.14); z-index: 3; pointer-events: none;
}
.sq.hint.cap::after { width: 100%; height: 100%; background: transparent; border: 0.6cqi solid rgba(0,0,0,.14); box-sizing: border-box; border-width: 5px; }
.sq.premove::before { content: ''; position: absolute; inset: 0; background: rgba(214, 79, 64, .55); }
.sq.hover { box-shadow: inset 0 0 0 4px rgba(255,255,255,.65); }
.sq.wrong::before { content: ''; position: absolute; inset: 0; background: rgba(224,40,40,.55); }
.sq.right::before { content: ''; position: absolute; inset: 0; background: rgba(129,182,76,.7); }
.coord { position: absolute; font-size: 2.1cqi; font-weight: 800; pointer-events: none; z-index: 2; }
.coord.rank { top: 3%; left: 4%; }
.coord.file { bottom: 2%; right: 5%; }
.sq.light .coord { color: var(--sq-dark); }
.sq.dark .coord { color: var(--sq-light); }
.piece {
  position: relative; z-index: 4; font-family: var(--piece-font);
  font-size: 9.6cqi; line-height: 1; cursor: grab; pointer-events: none;
  transition: transform .12s;
}
.piece.w { color: #fafafa; text-shadow: 0 0 1px #000, 0 0 1px #000, 0 0 1px #000, 0 0.35cqi 0 rgba(0,0,0,.55), 0 0 0.25cqi #000; -webkit-text-stroke: 0.15cqi #222; }
.piece.b { color: #2f2c2a; text-shadow: 0 0 1px #000, 0 0.35cqi 0 rgba(0,0,0,.35); -webkit-text-stroke: 0.1cqi #111; }
/* Illustrated "warriors" pieces */
.piece.fig { position: absolute; inset: 0; display: block; font-size: 0; -webkit-text-stroke: 0; text-shadow: none; transition: none; }
.piece.fig img { width: 100%; height: 100%; display: block; filter: drop-shadow(0 1px 1.5px rgba(0,0,0,.45)); user-select: none; -webkit-user-drag: none; }
.inline-piece .piece.fig, .seg .piece.fig { position: relative; display: inline-block; width: 32px; height: 32px; vertical-align: middle; }
.promo-picker button { position: relative; }
.promo-picker .piece.fig { inset: 6%; }
.drag-ghost.fig { transform: translate(-50%, -62%) scale(1.12); }
.drag-ghost.fig .piece.fig { position: relative; width: 100%; height: 100%; }
.fallen-piece { position: absolute; width: 12.5%; height: 12.5%; z-index: 20; pointer-events: none; display: flex; align-items: center; justify-content: center; container-type: inline-size; transform-origin: 50% 90%; }
.fallen-piece .piece { font-size: 77cqi; }
.fallen-piece .piece.fig { font-size: 0; }

/* Realistic set: tall standing figures that rise above their square */
.piece.fig.tall img { object-fit: contain; object-position: 50% 100%; filter: drop-shadow(0 3px 3px rgba(0,0,0,.55)); }
.sq .piece.fig.tall, .fallen-piece .piece.fig.tall { inset: auto; left: -22%; right: -22%; bottom: 2%; height: 216%; }
.board.live .piece.fig.tall img { pointer-events: auto; cursor: grab; } /* clicking a figure's body selects it */
.board.live.plane-hit .piece.fig.tall img { pointer-events: none; }
.drag-ghost.tall { transform: translate(-50%, -88%); }
.drag-ghost.tall .piece.fig { position: relative; width: 100%; height: 100%; }
body.pieces-tall:not(.board-3d) .board-col .board-wrap { margin-top: 15%; }
body.pieces-tall .board:not(.live) { overflow: visible; }
/* Animated warriors: sprite strips rendered from the 3D puppet rigs (tools/sprite-maker.html). Each frame is the
   picture plus 30/360 of its height below the feet, so the strip hangs that much below the piece box. The <img>
   stays (invisible) for layout, clicking and dragging. Idle loops 32 frames over 4 s; walking loops one stride of
   20 frames. Frame counts must match FRAMES in tools/sprite-maker.html. */
.piece.fig.tall .spr { display: none; }
body.sprites .sq .piece.fig.tall .spr, body.sprites .fallen-piece .piece.fig.tall .spr, body.sprites .drag-ghost .piece.fig.tall .spr {
  display: block; position: absolute; left: 0; top: 0; width: 100%; height: calc(100% * 390 / 360); pointer-events: none;
  background: var(--spr-idle) 0 0 / 3200% 100% no-repeat;
  filter: drop-shadow(0 3px 3px rgba(0,0,0,.55));
  transform: rotateX(var(--stand, 0deg)) scaleX(var(--flip, 1)); transform-origin: 50% calc(100% * 360 / 390);
  transition: transform .32s ease-in-out; /* turning round reads as a half turn, not a snap */
  animation: spr-play 4s steps(32, jump-none) var(--spr-delay, 0s) infinite;
}
body.sprites .sq .piece.fig.tall img, body.sprites .fallen-piece .piece.fig.tall img, body.sprites .drag-ghost .piece.fig.tall img { opacity: 0; }
body.sprites .piece.fig.tall.walking .spr {
  background-image: var(--spr-walk); background-size: 2000% 100%;
  animation: spr-play var(--stride, .76s) steps(20, jump-none) infinite;
}
body.sprites .piece.fig.tall.flip { --flip: -1; }
@keyframes spr-play { from { background-position: 0 0; } to { background-position: 100% 0; } }
@media (prefers-reduced-motion: reduce) { body.sprites .piece.fig.tall .spr { animation: none !important; } }
.promo-picker.promo-center { left: 50% !important; top: 30%; bottom: auto; width: 50% !important; transform: translateX(-50%); flex-direction: row; }
.promo-picker.promo-center button { flex: 1; }

/* 3D view: the board tilts back and the figures stand upright on it */
body.board-3d.pieces-fig .board-wrap:has(> .board.live) { perspective: 1500px; perspective-origin: 50% -20%; isolation: isolate; }
body.board-3d.pieces-fig .board.live {
  transform: rotateX(30deg); transform-origin: 50% 100%; transform-style: preserve-3d;
  overflow: visible; border-radius: 0; container-type: normal;
}
body.board-3d.pieces-fig .board.live .sq,
body.board-3d.pieces-fig .board.live .piece,
body.board-3d.pieces-fig .board.live .fallen-piece { transform-style: preserve-3d; }
body.board-3d.pieces-fig .board.live .piece.fig img { transform: rotateX(-30deg); transform-origin: 50% 100%; }
body.board-3d.pieces-fig .board.live .piece.fig .spr { --stand: -30deg; }
body.board-3d.pieces-fig .board.live .piece.fig:not(.tall) { inset: auto; left: -4%; right: -4%; bottom: 0; height: 120%; }
body.board-3d.pieces-fig .board.live .coord { font-size: 15px; }
body.board-3d.pieces-fig .board.live .sq.hint::after { width: 30%; height: 30%; }
body.board-3d.pieces-fig .board.live .sq.hint.cap::after { width: 100%; height: 100%; }
/* Battlefield backdrop behind the tilted board on game pages */
body.board-3d.pieces-fig .board-col .board-wrap:has(> .board.live)::before {
  content: ''; position: absolute; z-index: -1; left: -3%; right: -3%; top: -16%; height: 62%; border-radius: 12px 12px 0 0;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 100' preserveAspectRatio='none'%3E%3Cpath d='M0 100V72h10v-8h6v8h14V60h4l3-6 3 6h4v40zM40 100V78h30v-6h4v-14h3v-6h2v6h3v14h4v6h22v28zM120 100V80l8-4 8 4v-12h3v-7h3v7h3v12l10-6 10 6v20zM180 100V84h40V70h6v-6h3v6h6v14h30v16zM270 100V76h12v-10h4v-8h3v8h4v10h20l6-5 6 5v24zM330 100V80h20v-14h4v-10h3v10h4v14h12v-6h6v6h21v20z' fill='%23140d08' opacity='.85'/%3E%3Cpath d='M30 70l2-40 2 40M95 74l2-46 2 46M160 76l2-44 2 44M240 72l2-48 2 48M300 74l2-44 2 44M372 72l2-42 2 42' stroke='%23140d08' stroke-width='1.6' fill='none'/%3E%3Cpath d='M97 30h16l-4 5 4 5H97zM242 26h16l-4 5 4 5h-16zM32 32h13l-3 4 3 4H32z' fill='%237a1414'/%3E%3C/svg%3E") bottom / 100% 42% no-repeat,
    radial-gradient(ellipse at 18% 78%, rgba(255, 140, 50, .55), transparent 38%),
    radial-gradient(ellipse at 82% 82%, rgba(255, 110, 40, .45), transparent 34%),
    radial-gradient(ellipse at 50% 20%, rgba(90, 80, 72, .9), transparent 60%),
    radial-gradient(ellipse at 20% 30%, rgba(60, 52, 46, .9), transparent 45%),
    linear-gradient(180deg, #1e1a17 0%, #3a2f27 45%, #7a4a26 78%, #a8622c 100%);
  box-shadow: inset 0 -40px 60px rgba(0,0,0,.35);
}
body.board-3d.pieces-fig .board-col .board-wrap:has(> .board.live)::after {
  content: ''; position: absolute; z-index: -1; left: -3%; right: -3%; top: 46%; bottom: -2%;
  background: linear-gradient(180deg, #2a2119, #1a1410); border-radius: 0 0 12px 12px;
}
body.board-3d.pieces-fig .board-col { margin-top: 1%; max-width: min(100%, calc(100vh - 215px)); }
body.board-3d.pieces-fig .board-col .board-row { margin-top: 8%; }

/* Green marble board (matches the warriors set) */
body.theme-marble { --sq-light: #e8e0cc; --sq-dark: #3e6e57; }
body.theme-marble .sq.light {
  background:
    linear-gradient(118deg, transparent 0 38%, rgba(140, 118, 84, .16) 39%, transparent 41% 66%, rgba(140, 118, 84, .1) 67%, transparent 69%),
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, .55), transparent 55%),
    linear-gradient(160deg, #efe8d6, #ddd2b8);
}
body.theme-marble .sq.dark {
  background:
    linear-gradient(64deg, transparent 0 30%, rgba(255, 255, 255, .1) 31%, transparent 33% 70%, rgba(255, 255, 255, .07) 71%, transparent 73%),
    radial-gradient(circle at 70% 30%, rgba(255, 255, 255, .14), transparent 60%),
    linear-gradient(160deg, #4a7d63, #2f5945);
}
body.theme-marble .board { box-shadow: 0 0 0 6px #2b2620, 0 0 0 8px #8a6a3a, 0 14px 40px rgba(0,0,0,.5); }

.board.interactive .sq.mine { cursor: grab; }
.piece.dragging-src { opacity: .35; }
.drag-ghost {
  position: fixed; z-index: 1000; pointer-events: none; transform: translate(-50%, -50%) scale(1.08);
  font-family: var(--piece-font); line-height: 1;
}
.drag-ghost.w { color: #fafafa; text-shadow: 0 0 1px #000, 0 0 1px #000, 0 3px 6px rgba(0,0,0,.5); -webkit-text-stroke: 1px #222; }
.drag-ghost.b { color: #2f2c2a; text-shadow: 0 0 1px #000, 0 3px 6px rgba(0,0,0,.4); -webkit-text-stroke: 1px #111; }
.promo-picker {
  position: absolute; z-index: 20; display: flex; flex-direction: column; background: #fff;
  box-shadow: 0 6px 20px rgba(0,0,0,.5); border-radius: 4px; overflow: hidden;
}
.promo-picker button { border: 0; background: #f2f2f2; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; }
.promo-picker button:hover { background: #d8e8c4; }
.promo-picker .piece { pointer-events: none; }
.board-arrows { position: absolute; inset: 0; pointer-events: none; z-index: 6; }

.eval-bar { width: 22px; border-radius: 4px; background: #403d39; overflow: hidden; position: relative; flex: none; }
.eval-bar .white { position: absolute; left: 0; right: 0; bottom: 0; background: #fff; transition: height .4s; }
.eval-bar .num { position: absolute; left: 0; right: 0; font-size: 10px; font-weight: 900; text-align: center; z-index: 2; }

/* ---------- Game page ---------- */
.game-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; padding: 16px 24px;
  max-width: 1280px; margin: 0 auto; align-items: start;
}
.board-col { display: flex; flex-direction: column; gap: 8px; max-width: min(100%, calc(100vh - 140px)); width: 100%; margin: 0 auto; }
.board-row { display: flex; gap: 8px; }
.board-row .board-wrap { flex: 1; }
/* the 3D battlefield as the board of the Play and Analysis pages */
/* (beats the tilted 2D board's sizing rules) */
body .board-col:has(.board3d-host) { max-width: none !important; margin-top: 0 !important; }
body .board-row:has(.board3d-host) { margin-top: 0 !important; }
.board3d-host { position: relative; height: calc(100vh - 190px); min-height: 380px; border-radius: 12px; overflow: hidden; background: #120e0b; }
.board3d-host .bt-wrap.bt-embed { display: block; height: 100%; }
.board3d-host .bt-embed .bt-stage { height: 100%; min-height: 0; }
.board3d-host .bt-cam { left: 10px; bottom: 10px; }
.board3d-host .bt-cam button { padding: 6px 9px; font-size: 12px; }
.b3d-error { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center; color: #f0dcb0; }
.b3d-error p { font-weight: 700; opacity: .85; max-width: 460px; }
@media (max-width: 860px) { .board3d-host { height: 62vh; } }
.player-bar { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.player-bar .pname { font-weight: 800; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.player-bar .prating { color: var(--text-3); font-weight: 700; }
.player-bar .captured { font-family: var(--piece-font); font-size: 15px; color: var(--text-2); letter-spacing: -2px; min-height: 18px; }
.player-bar .captured .adv { font-family: var(--font); letter-spacing: 0; font-size: 12px; margin-left: 6px; font-weight: 800; color: var(--text-3); }
.clock {
  margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 900; font-size: 24px;
  background: #989795; color: #2b2926; padding: 4px 12px; border-radius: 6px; min-width: 120px; text-align: right;
  opacity: .75;
}
.clock.active { background: #fff; opacity: 1; }
.clock.low { background: #e85656; color: #fff; }
.clock.hidden { visibility: hidden; }
.bubble {
  background: #fff; color: #222; font-weight: 700; font-size: 13px; padding: 6px 10px; border-radius: 10px;
  position: relative; max-width: 260px;
}
.side-panel { background: var(--panel); border-radius: var(--radius); display: flex; flex-direction: column; height: min(calc(100vh - 32px), 860px); min-height: 520px; overflow: hidden; }
.side-head { padding: 14px 16px; font-weight: 900; font-size: 18px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.side-body { padding: 16px; overflow: auto; flex: 1; }
.side-foot { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; background: transparent; border: 0; color: var(--text-3); font-weight: 800; padding: 12px 6px; border-bottom: 3px solid transparent; font-size: 14px; }
.tabs button.active { color: #fff; border-bottom-color: var(--green); }
.bot-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.bot-pick { background: var(--panel-2); border: 2px solid transparent; border-radius: 8px; padding: 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; color: #fff; font-weight: 800; font-size: 12px; }
.bot-pick .avatar { width: 48px; height: 48px; font-size: 28px; }
.bot-pick.sel { border-color: var(--green); }
.bot-pick:hover { background: var(--panel-3); }
.bot-detail { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.bot-detail h3 { font-size: 20px; }
.bot-detail p { color: var(--text-2); font-size: 13px; font-weight: 600; margin-top: 4px; }
.seg { display: flex; background: var(--panel-2); border-radius: 8px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: transparent; color: var(--text-2); font-weight: 800; padding: 8px; border-radius: 6px; font-size: 18px; }
.seg .piece { font-size: 28px; -webkit-text-stroke-width: 1px; text-shadow: 0 1px 0 rgba(0,0,0,.4); }
.seg .piece.b { color: #1d1c1a; text-shadow: 0 0 2px rgba(255,255,255,.5); }
.seg button.sel { background: var(--panel-3); color: #fff; box-shadow: inset 0 0 0 2px var(--green); }
.moves-list { display: grid; grid-template-columns: 42px 1fr 1fr; font-size: 14px; font-weight: 700; }
.moves-list > div { padding: 5px 8px; }
.moves-list .num { color: var(--text-3); background: rgba(0,0,0,.08); }
.moves-list .mv { cursor: pointer; border-radius: 4px; }
.moves-list .mv:hover { background: var(--panel-2); }
.moves-list .mv.cur { background: var(--panel-3); color: #fff; box-shadow: inset 0 -2px 0 var(--green); }
.moves-list .row-odd { background: rgba(255,255,255,.025); }
.nav-ctrls { display: flex; gap: 6px; }
.nav-ctrls button { flex: 1; background: var(--panel-2); border: 0; color: #fff; border-radius: 6px; font-size: 18px; padding: 8px; box-shadow: inset 0 -3px 0 #2b2926; }
.nav-ctrls button:hover { background: var(--panel-3); }
.status-line { font-weight: 800; padding: 10px 12px; border-radius: 8px; background: var(--panel-2); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.status-line.ok { background: rgba(129,182,76,.18); color: var(--green-hi); }
.status-line.bad { background: rgba(224,40,40,.18); color: #ff8585; }
.searching { text-align: center; padding: 30px 10px; }

/* ---------- The side panel of the game pages, in the battle panel's Spartan style ---------- */
.side-panel {
  background: var(--sp-stone), radial-gradient(140% 40% at 50% 0%, #34261b, transparent 70%), linear-gradient(180deg, #211811, #140f0b);
  border: 3px solid transparent; border-image: linear-gradient(180deg, #8a5a26, #d9a656 30%, #7a4c1e 60%, #c99545 85%, #6b4219) 1;
  border-radius: 0; box-shadow: inset 0 0 16px rgba(0, 0, 0, .65), 0 6px 18px rgba(0, 0, 0, .45);
  font-family: var(--sp-serif); color: #efe2c6;
}
.side-panel .side-head {
  margin: 12px 12px 0; padding: 10px 14px; border: 1px solid #b98a45; border-radius: 6px;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .65), inset 0 0 0 3px rgba(214, 166, 84, .28), 0 3px 8px rgba(0, 0, 0, .55);
  background: var(--sp-stone), linear-gradient(180deg, #2d221a, #17110d);
  font-family: var(--sp-title); font-weight: 700; font-size: 25px; color: #f3d59a; text-shadow: 0 2px 2px #000;
}
.side-panel .side-body { padding: 14px 14px; }
.side-panel .side-foot { border-top: 1px solid rgba(214, 166, 84, .35); padding: 12px 14px 14px; }
.side-panel .tabs { margin: 12px 12px 0; gap: 8px; border-bottom: 0; }
.side-panel .tabs button, .side-panel .tc-btn, .side-panel .bot-pick, .side-panel .seg button, .side-panel .nav-ctrls button, .side-panel .btn-secondary, .side-panel .btn-ghost {
  border: 1px solid rgba(201, 150, 72, .55); border-radius: 6px; color: #f3e6cc; text-shadow: 0 1px 2px #000;
  background: var(--sp-stone), linear-gradient(180deg, #2f241b, #17110d);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .55), 0 2px 5px rgba(0, 0, 0, .5);
}
.side-panel .tabs button { font-family: var(--sp-font); font-weight: 700; font-size: 15px; padding: 10px 4px; white-space: nowrap; display: flex; align-items: center; justify-content: center; gap: 6px; }
.side-panel .tabs .tab-ic, .side-panel .tabs .tab-duo { margin-right: 0; vertical-align: 0; }
.side-panel .tabs button:hover, .side-panel .tc-btn:hover, .side-panel .bot-pick:hover, .side-panel .seg button:hover,
.side-panel .nav-ctrls button:hover, .side-panel .btn-secondary:hover, .side-panel .btn-ghost:hover { border-color: #f0c97a; color: #fff; filter: brightness(1.12); }
.side-panel .tabs button.active, .side-panel .tc-btn.sel, .side-panel .bot-pick.sel, .side-panel .seg button.sel {
  color: #fff6e0; border-color: #e3b064;
  background: var(--sp-stone), radial-gradient(120% 150% at 50% 0%, #c42a24 0%, #8c1215 55%, #520809 100%);
  box-shadow: inset 0 0 0 2px rgba(60, 6, 6, .8), inset 0 0 0 3px rgba(227, 176, 100, .35), 0 0 12px rgba(200, 40, 30, .3), 0 2px 5px rgba(0, 0, 0, .5);
}
.side-panel .tc-btn { font-family: var(--sp-serif); font-weight: 700; font-size: 17px; padding: 10px 6px; }
.side-panel .tc-label { font-family: var(--sp-font); font-weight: 700; font-size: 15px; color: #e9c27a; text-shadow: 0 1px 2px #000; margin: 16px 0 8px; }
.side-panel .bot-detail { padding: 10px; border: 1px solid #b98a45; border-radius: 6px;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .65), inset 0 0 0 3px rgba(214, 166, 84, .28);
  background: linear-gradient(90deg, rgba(20, 14, 9, .88) 0%, rgba(40, 28, 18, .6) 50%, rgba(0, 0, 0, .15) 100%), var(--sp-stone), radial-gradient(90% 120% at 85% 30%, #b98d5a, #6b4a2c 70%, #3a2717); }
.side-panel .bot-detail .avatar { border: 2px solid #d8a85a; box-shadow: 0 3px 8px rgba(0, 0, 0, .7); }
.side-panel .bot-detail h3 { font-family: var(--sp-title); font-weight: 700; font-size: 27px; color: #fff6e3; text-shadow: 0 2px 3px #000; }
.side-panel .bot-detail h3 .muted { font-family: var(--sp-serif); color: #e9c27a; }
.side-panel .bot-detail p { font-family: var(--sp-serif); font-size: 16px; font-weight: 500; color: #efe2c6; text-shadow: 0 1px 2px #000; }
.side-panel .bot-pick { padding: 7px 4px; font-family: var(--sp-serif); font-size: 16px; font-weight: 700; }
.side-panel .bot-pick .avatar { border: 1px solid rgba(233, 194, 122, .6); box-shadow: 0 2px 4px rgba(0, 0, 0, .6); }
.side-panel .seg { background: transparent; padding: 0; gap: 8px; }
.side-panel .seg button { padding: 8px; font-family: var(--sp-serif); font-weight: 700; }
.side-panel .btn-primary {
  border: 1px solid #e3b064; border-radius: 6px; font-family: var(--sp-font); font-weight: 800; color: #fbeccd; text-shadow: 0 2px 2px #000;
  background: var(--sp-stone), radial-gradient(120% 150% at 50% 0%, #c42a24 0%, #8c1215 55%, #520809 100%);
  box-shadow: inset 0 0 0 2px rgba(60, 6, 6, .85), inset 0 0 0 3px rgba(227, 176, 100, .35), 0 3px 8px rgba(0, 0, 0, .55);
}
.side-panel .btn-primary:hover { background: var(--sp-stone), radial-gradient(120% 150% at 50% 0%, #d6332c 0%, #9c171a 55%, #5e0a0c 100%); }
.side-panel .btn .btn-ic { width: 46px; filter: drop-shadow(0 2px 2px #000); }
.side-panel .btn-secondary, .side-panel .btn-ghost { font-family: var(--sp-font); font-weight: 700; }
.side-panel .status-line { background: rgba(0, 0, 0, .35); border: 1px solid rgba(214, 166, 84, .35); border-radius: 6px; font-family: var(--sp-serif); font-size: 16px; }
.side-panel .status-line.ok { background: rgba(70, 110, 40, .35); color: #cfe9a6; }
.side-panel .status-line.bad { background: rgba(140, 20, 20, .4); color: #ffb3a3; }
.side-panel .moves-list { font-family: var(--sp-serif); font-size: 17px; font-weight: 600; color: #f1e4c8; }
.side-panel .moves-list .num { color: #c9a465; background: rgba(0, 0, 0, .2); }
.side-panel .moves-list .row-odd { background: rgba(214, 166, 84, .05); }
.side-panel .moves-list .mv:hover { background: rgba(214, 166, 84, .15); }
.side-panel .moves-list .mv.cur { background: rgba(156, 20, 24, .7); color: #fff; box-shadow: inset 0 -2px 0 #e3b064; }
.side-panel .muted, .side-panel .text-2 { color: #cbb894; }
.side-panel h3 { font-family: var(--sp-title); font-weight: 700; color: #f6e7c8; }
/* Play and Analysis on a wide screen: like the home screen, the battlefield fills the page and the panel is a full-height
   column on the right; the player names and clocks float over the top and bottom of the battlefield */
.side-panel .side-banner { margin: 12px 12px 0; flex: none; }
@media (min-width: 1101px) {
  .game-layout:has(.board3d-host) { grid-template-columns: minmax(0, 1fr) 350px; gap: 0; padding: 0; max-width: none; height: 100vh; align-items: stretch; }
  .game-layout:has(.board3d-host) > .board-col { position: relative; height: 100vh; margin: 0; display: block; }
  .game-layout:has(.board3d-host) .board-row { height: 100%; gap: 0; }
  .game-layout:has(.board3d-host) .board3d-host { height: 100%; min-height: 0; border-radius: 0; }
  .game-layout:has(.board3d-host) .eval-bar { height: 100%; border-radius: 0; width: 20px; background: #1a120c; border-right: 2px solid #b8843f; }
  .game-layout:has(.board3d-host) .eval-bar .white { background: linear-gradient(90deg, #f6e3b8, #d9b878); }
  .game-layout:has(.board3d-host) > .side-panel { height: 100vh; max-height: none; min-height: 0; border-width: 0 0 0 3px; box-shadow: inset 6px 0 14px rgba(0, 0, 0, .6); }
  .game-layout:has(.board3d-host) .player-bar {
    position: absolute; left: 14px; right: 14px; z-index: 4; pointer-events: none; min-height: 0;
  }
  .game-layout:has(.board3d-host) .player-bar > div:nth-child(2) {
    background: rgba(14, 10, 7, .74); border: 1px solid rgba(214, 166, 84, .45); border-radius: 8px; padding: 3px 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .5); backdrop-filter: blur(3px);
  }
  .game-layout:has(.board3d-host) .player-bar .clock { min-width: 104px; font-size: 22px; padding: 2px 12px; box-shadow: 0 2px 8px rgba(0, 0, 0, .5); }
  .game-layout:has(.board3d-host) .player-bar > * { pointer-events: auto; }
  .game-layout:has(.board3d-host) .board-col > .player-bar:first-child { top: 12px; }
  /* the bottom bar sits at the bottom right with its clock, clear of the camera buttons at the bottom left */
  .game-layout:has(.board3d-host) .board-col > .player-bar:last-child { bottom: 9px; left: auto; }
  .game-layout:has(.eval-bar) .player-bar { left: 40px; }
}
/* the game pages sit on the same dark stone as the battlefield page */
main:has(.game-layout) { background: var(--sp-stone), radial-gradient(90% 60% at 40% 0%, #2c2118, transparent 70%), linear-gradient(180deg, #1a130e, #120d0a); }
/* the player bars around the board */
.player-bar .pname { font-family: var(--sp-serif); font-weight: 700; font-size: 19px; color: #f6e7c8; text-shadow: 0 1px 2px #000; }
.player-bar .prating { font-family: var(--sp-serif); color: #c9a465; }
.player-bar .avatar { border: 2px solid #d8a85a; box-shadow: 0 2px 6px rgba(0, 0, 0, .6); }
.clock { font-family: var(--sp-serif); background: #1d1610; color: #c9a465; border: 1px solid rgba(214, 166, 84, .5); }
.clock.active { background: linear-gradient(180deg, #f6e3b8, #d9b878); color: #2a1a0c; border-color: #e3b064; }
.clock.low { background: linear-gradient(180deg, #d0262a, #8a1013); color: #fff; border-color: #e3b064; }
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 4px solid var(--panel-2); border-top-color: var(--green); animation: spin 1s linear infinite; margin: 0 auto 14px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Puzzles ---------- */
.puzzle-rating { font-size: 34px; font-weight: 900; }
.delta-up { color: var(--green-hi); font-weight: 900; }
.delta-down { color: #ff7070; font-weight: 900; }
.dots { display: flex; gap: 6px; flex-wrap: wrap; }
.dots span { width: 26px; height: 26px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-weight: 900; font-size: 13px; }
.dots .ok { background: var(--green); } .dots .no { background: #c33; }
.rush-timer { font-size: 40px; font-weight: 900; text-align: center; font-variant-numeric: tabular-nums; }

/* ---------- Lessons / content ---------- */
.page-title { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.page-title h1 { font-size: 32px; }
.page-title .pt-ic { font-size: 36px; }
.lesson-card { background: var(--panel); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: transform .12s; }
.lesson-card:hover { transform: translateY(-3px); background: var(--panel-2); }
.lesson-card .lc-art { height: 120px; display: flex; align-items: center; justify-content: center; font-family: var(--piece-font); font-size: 64px; color: #fff; text-shadow: 0 4px 10px rgba(0,0,0,.35); }
.lesson-card .lc-body { padding: 14px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.lesson-card h3 { font-size: 16px; }
.lesson-card .meta { color: var(--text-3); font-size: 13px; font-weight: 700; margin-top: auto; display: flex; justify-content: space-between; align-items: center; }
.level-tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.level-tabs button { background: var(--panel-2); border: 0; color: var(--text-2); padding: 8px 16px; border-radius: 999px; font-weight: 800; }
.level-tabs button.active { background: var(--green); color: #fff; }
.article { max-width: 760px; margin: 0 auto; }
.article h1 { font-size: 38px; line-height: 1.15; margin: 14px 0; }
.article .lead { font-size: 19px; color: var(--text-2); font-weight: 600; margin-bottom: 20px; }
.article p { margin-bottom: 16px; font-size: 17px; line-height: 1.65; color: #e3e2e0; }
.forum-row { display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-top: 1px solid var(--line); }
.forum-row:first-child { border-top: 0; }
.forum-row .fr-main { flex: 1; min-width: 0; }
.forum-row h4 { font-size: 15px; }
.forum-row .fr-meta { color: var(--text-3); font-size: 13px; font-weight: 700; }
.forum-row .fr-count { text-align: right; color: var(--text-2); font-weight: 800; font-size: 13px; min-width: 70px; }
.stream-card { background: var(--panel); border-radius: var(--radius); overflow: hidden; }
.stream-card .sc-thumb { aspect-ratio: 16/9; position: relative; display: flex; align-items: center; justify-content: center; font-family: var(--piece-font); font-size: 60px; }
.stream-card .sc-thumb .pill { position: absolute; top: 8px; left: 8px; }
.stream-card .sc-thumb .viewers { position: absolute; bottom: 8px; left: 8px; background: rgba(0,0,0,.6); font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 4px; font-family: var(--font); }
.stream-card .sc-body { padding: 12px; display: flex; gap: 10px; align-items: center; }
.stream-card .sc-body h4 { font-size: 14px; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-weight: 800; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.input {
  width: 100%; background: var(--bg-3); border: 1px solid var(--line); color: #fff; border-radius: 8px;
  padding: 12px 14px; font-size: 15px; font-weight: 700;
}
.input:focus { outline: 2px solid var(--green); border-color: transparent; }
.check-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--line); font-weight: 800; }
.theme-swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 64px; height: 64px; border-radius: 8px; border: 3px solid transparent; display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; padding: 0; }
.swatch.sel { border-color: var(--green); }
.toggle { width: 46px; height: 26px; border-radius: 99px; background: var(--panel-3); position: relative; border: 0; transition: background .15s; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left .15s; }
.toggle.on { background: var(--green); }
.toggle.on::after { left: 23px; }

/* ---------- 3D Battle Chess ---------- */
.battle-root { height: 100vh; position: relative; background: #120e0b; }
.bt-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 350px; height: 100%; }
.bt-stage { position: relative; min-height: 0; overflow: hidden; background: #1a140f; }
.bt-canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: pointer; }
.bt-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 22px; color: #e9c98a; letter-spacing: .02em; background: radial-gradient(circle at 50% 60%, #3a2a1c, #120e0b 70%); }
.bt-cam { position: absolute; left: 14px; bottom: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.bt-cam button { background: rgba(20, 14, 10, .78); color: #f0dcb0; border: 1px solid rgba(214, 168, 78, .45); border-radius: 8px; padding: 8px 12px; font-weight: 800; font-size: 13px; backdrop-filter: blur(4px); }
.bt-cam button:hover { background: rgba(60, 40, 20, .9); color: #fff; }
.bt-toast { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); background: rgba(20, 14, 10, .85); color: #ffe2a0; border: 1px solid rgba(214, 168, 78, .6); padding: 8px 18px; border-radius: 10px; font-weight: 900; pointer-events: none; }
.bt-modal { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 5; }
.bt-modal-card { position: relative; background: linear-gradient(180deg, #2c2118, #1b140f); border: 1px solid #8a6a3a; border-radius: 14px; padding: 24px; max-width: 420px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.6); text-align: center; }
.bt-modal-card h2 { font-size: 30px; color: #f3d48c; margin-bottom: 8px; font-family: Georgia, serif; }
.bt-modal-card p { color: #e3d3b6; font-weight: 600; margin-bottom: 16px; }
.bt-modal-x { position: absolute; top: 8px; right: 8px; background: transparent; border: 0; color: #c9b38a; font-size: 18px; width: 32px; height: 32px; border-radius: 8px; }
.bt-modal-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.bt-promo { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.bt-promo button { background: #3a2c20; border: 1px solid #8a6a3a; color: #f3e3c0; border-radius: 10px; padding: 10px 4px; font-weight: 800; font-size: 12px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bt-promo button span { font-size: 30px; font-family: var(--piece-font); }
.bt-promo button:hover { background: #5a4330; }
.bt-form { display: flex; flex-direction: column; gap: 10px; text-align: left; margin: 12px 0 18px; }
.bt-form label, .bt-field { display: flex; flex-direction: column; gap: 5px; font-weight: 800; font-size: 13px; color: #d9c7a3; }
.bt-form select, .bt-field select { background: #120e0b; color: #fff; border: 1px solid #5a4632; border-radius: 8px; padding: 8px; font-weight: 700; }
/* the battle panel: dark stone in a bronze frame, gold-edged cards (the user's home-page picture) */
.bt-panel {
  background: var(--sp-stone), radial-gradient(140% 50% at 50% 0%, #34261b, transparent 70%), linear-gradient(180deg, #211811, #140f0b);
  border-left: 3px solid transparent; border-image: linear-gradient(180deg, #8a5a26, #d9a656 30%, #7a4c1e 60%, #c99545 85%, #6b4219) 1;
  box-shadow: inset 6px 0 14px rgba(0, 0, 0, .6);
  padding: 14px 14px 16px; display: flex; flex-direction: column; gap: 11px; overflow: auto;
  font-family: var(--sp-serif); color: #efe2c6;
}
.bt-panel > * { flex: none; }
.bt-title, .bt-turn, .bt-card, .bt-btn, .bt-new {
  border: 1px solid #b98a45; border-radius: 6px;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .65), inset 0 0 0 3px rgba(214, 166, 84, .28), 0 3px 8px rgba(0, 0, 0, .55);
}
.bt-title { display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: var(--sp-stone), linear-gradient(180deg, #2d221a, #17110d); }
.bt-title img { width: 44px; filter: drop-shadow(0 2px 2px #000); }
.bt-title-t { font-family: var(--sp-title); font-weight: 700; font-size: 33px; line-height: 1; white-space: nowrap;
  background: linear-gradient(180deg, #fbe7b5 10%, #e3b366 55%, #a8722f 95%); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 2px 1px #000); }
.bt-badge { margin-left: auto; font-family: var(--sp-font); font-weight: 900; font-size: 15px; color: #fff; padding: 2px 7px; border-radius: 5px;
  background: linear-gradient(180deg, #d0262a, #8a1013); border: 1px solid #e7b36a; box-shadow: 0 2px 4px rgba(0, 0, 0, .6); }
.bt-turn { display: flex; align-items: center; gap: 12px; padding: 9px 12px;
  background: linear-gradient(90deg, rgba(20, 14, 9, .85) 0%, rgba(40, 28, 18, .55) 45%, rgba(0, 0, 0, .1) 100%),
    var(--sp-stone), radial-gradient(90% 120% at 85% 30%, #b98d5a, #6b4a2c 70%, #3a2717); }
.bt-turn > .bt-chip { display: none; }
.bt-turn-helm { width: 66px; height: 74px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: 6px;
  background: radial-gradient(circle at 50% 40%, #2a1e15, #0d0907 80%); border: 1px solid rgba(214, 166, 84, .35); }
.bt-turn-helm img { width: 54px; filter: drop-shadow(0 3px 3px #000); }
.bt-turn-body { min-width: 0; text-shadow: 0 1px 3px #000, 0 0 8px rgba(0, 0, 0, .8); }
.bt-turn-text { display: block; font-family: var(--sp-title); font-size: 25px; font-weight: 700; color: #fff6e3; line-height: 1.15; }
.bt-status { font-weight: 700; font-size: 16px; color: #f4e8cf; margin-top: 2px; }
.bt-status.warn { color: #ff9a7a; }
.bt-sub { font-size: 14px; font-weight: 500; color: #eadbbf; }
.bt-new { display: flex; align-items: center; justify-content: center; gap: 16px; min-height: 62px; cursor: pointer;
  font-family: var(--sp-font); font-weight: 800; font-size: 21px; color: #fbeccd; text-shadow: 0 2px 2px #000;
  border-color: #e3b064; background: var(--sp-stone), radial-gradient(120% 150% at 50% 0%, #c42a24 0%, #8c1215 55%, #520809 100%); }
.bt-new img { width: 48px; filter: drop-shadow(0 2px 2px #000); }
.bt-new:hover { filter: brightness(1.12); }
.bt-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bt-btn { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; cursor: pointer;
  font-family: var(--sp-font); font-weight: 700; font-size: 16px; color: #f3e6cc; text-shadow: 0 1px 2px #000;
  background: var(--sp-stone), linear-gradient(180deg, #2f241b, #17110d); }
.bt-btn img { width: 24px; filter: drop-shadow(0 1px 1px #000); }
.bt-btn:hover:not(:disabled) { border-color: #f0c97a; color: #fff; }
.bt-btn:disabled { opacity: .5; cursor: default; }
.bt-card { background: var(--sp-stone), linear-gradient(180deg, #241b14, #120d0a); padding: 0; overflow: hidden; }
.bt-card-h { display: flex; align-items: center; gap: 12px; padding: 8px 14px; font-family: var(--sp-font); font-weight: 700; font-size: 18px; color: #f6e7c8;
  text-shadow: 0 1px 2px #000; border-bottom: 1px solid rgba(214, 166, 84, .35); }
.bt-card-h img { width: 42px; max-height: 34px; object-fit: contain; filter: drop-shadow(0 2px 2px #000); }
.bt-fallen { background: linear-gradient(90deg, #17110c 30%, rgba(23, 17, 12, .55) 62%, rgba(23, 17, 12, .2)), url(../assets/ui/army-fallen.jpg) right bottom / auto 72% no-repeat, linear-gradient(180deg, #241b14, #120d0a); }
.bt-captured { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 14px; font-family: var(--piece-font); font-size: 21px; color: #f0d79e; }
.bt-captured + .bt-captured { border-top: 1px solid rgba(214, 166, 84, .25); }
.bt-cap-helm { width: 40px; height: 40px; object-fit: contain; flex: none; padding: 3px; border-radius: 6px; background: rgba(0, 0, 0, .45); filter: drop-shadow(0 2px 2px #000); }
.bt-cap-list { display: flex; flex-wrap: wrap; gap: 2px; align-items: center; text-shadow: 0 1px 2px #000; }
.bt-captured em { font-family: var(--sp-serif); font-size: 16px; color: #d6c7a8; }
.bt-panel > .bt-log { flex: 1 0 auto; }
.bt-log { min-height: 190px; display: flex; flex-direction: column;
  background: linear-gradient(180deg, #19120d 0%, rgba(25, 18, 13, .92) 40%, rgba(25, 18, 13, .35) 75%, rgba(0, 0, 0, .1)), url(../assets/ui/army-log.jpg) center bottom / cover no-repeat, #1a130e; }
.bt-moves { overflow: auto; flex: 1; padding: 8px 14px 60px; font-size: 16px; font-weight: 600; color: #f1e4c8; max-height: 300px; text-shadow: 0 1px 2px #000; }
.bt-moves div { display: grid; grid-template-columns: 34px 1fr 1fr; padding: 3px 2px; border-bottom: 1px solid rgba(214, 166, 84, .16); }
.bt-moves b { color: #c9a465; }
.bt-moves em { color: #efe2c6; font-size: 17px; }
.bt-settings summary { display: flex; align-items: center; gap: 14px; padding: 8px 14px; cursor: pointer; list-style: none;
  font-family: var(--sp-font); font-weight: 700; font-size: 15px; color: #f3e6cc; text-shadow: 0 1px 2px #000; }
.bt-settings summary::-webkit-details-marker { display: none; }
.bt-settings summary img { width: 40px; filter: drop-shadow(0 2px 2px #000); }
.bt-chev { margin-left: auto; font-style: normal; font-family: var(--font); font-size: 26px; color: var(--sp-gold); transition: transform .2s; }
.bt-settings[open] .bt-chev { transform: rotate(90deg); }
.bt-settings-body { padding: 4px 14px 12px; border-top: 1px solid rgba(214, 166, 84, .3); font-family: var(--font); }
.bt-settings .bt-field { margin: 10px 0; }
.bt-check { display: flex; gap: 8px; align-items: center; font-weight: 700; font-size: 13px; color: #d9c7a3; margin-bottom: 8px; }
.bt-assets { font-size: 11px; color: #8d7a5c; font-weight: 700; line-height: 1.4; }
.bt-help { font-size: 12px; color: #b6a07a; font-weight: 700; line-height: 1.45; margin: 6px 0; }
@media (max-height: 820px) and (min-width: 861px) {
  .sp-logo img { width: 70px; }
  .sp-logo span { font-size: 27px; }
  .nav { gap: 5px; }
  .nav-link { min-height: 40px; padding: 4px 10px; font-size: 15px; }
  .nav-ic img { max-height: 26px; max-width: 30px; }
  .sidebar-bottom { gap: 5px; padding-top: 8px; }
  .user-chip { min-height: 58px; }
  .user-chip .avatar { width: 48px; height: 48px; font-size: 26px; }
  .bt-panel { gap: 8px; padding: 10px 12px; }
  .bt-title img { width: 36px; } .bt-title-t { font-size: 29px; }
  .bt-turn-helm { width: 54px; height: 60px; } .bt-turn-helm img { width: 44px; }
  .bt-new { min-height: 50px; font-size: 19px; } .bt-new img { width: 40px; }
  .bt-btn { min-height: 42px; }
  .bt-captured { min-height: 44px; }
  .bt-cap-helm { width: 34px; height: 34px; }
  .bt-log { min-height: 150px; }
}
@media (max-width: 1100px) {
  .battle-root { height: auto; }
  .bt-wrap { grid-template-columns: 1fr; }
  .bt-stage { height: 64vh; min-height: 380px; }
  .bt-panel { border-left: 0; border-top: 3px solid #b8843f; }
  .bt-moves { max-height: 180px; }
}

/* ---------- Rules of chess ---------- */
.rules-lead { font-size: 17px; font-weight: 700; margin: -10px 0 22px; }
.rules-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 24px; align-items: start; }
.rules-toc { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 2px; background: var(--panel); border-radius: var(--radius); padding: 8px; }
.rules-toc button { display: flex; gap: 10px; align-items: center; text-align: left; background: transparent; border: 0; color: var(--text-2); font-weight: 800; font-size: 14px; padding: 9px 10px; border-radius: 8px; }
.rules-toc button:hover { background: var(--panel-2); color: #fff; }
.rules-toc button span { width: 22px; text-align: center; }
.rule-section { scroll-margin-top: 16px; }
.rule-section + .rule-section { margin-top: 16px; }
.rule-section h2 { font-size: 26px; margin-bottom: 14px; }
.rule-section h3 { font-size: 18px; margin: 4px 0 8px; display: flex; align-items: center; gap: 6px; }
.rule-section p, .rule-section li { color: #e3e2e0; font-size: 15.5px; line-height: 1.6; font-weight: 600; }
.rule-section p + p { margin-top: 10px; }
.rule-section ul, .rule-section ol { margin: 8px 0 10px; padding-left: 22px; }
.rule-section li + li { margin-top: 4px; }
.rule-section .muted { color: var(--text-3); font-size: 13px; }
.rule-row { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 22px; align-items: start; }
.rule-row + .rule-row { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); }
.diagram { margin: 0; }
.diagram figcaption { color: var(--text-3); font-size: 12px; font-weight: 800; text-align: center; margin-top: 6px; }
.piece-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.piece-card { background: var(--panel-2); border-radius: var(--radius); padding: 12px; }
.piece-card h3 { margin-top: 10px; }
.piece-card p { font-size: 14px; }
.inline-piece .piece { font-size: 26px; pointer-events: none; }
.draw-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.draw-grid .card { background: var(--panel-2); margin: 0; }
.draw-grid .card + .card { margin-top: 0; }
.draw-grid h3 { font-size: 16px; }
.draw-grid p { font-size: 14px; }
.tips li { margin-bottom: 6px; }
.rules-cta { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 16px; }
.rules-cta h3 { font-size: 20px; }
@media (max-width: 1100px) { .piece-grid, .draw-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .rules-layout { grid-template-columns: 1fr; }
  .rules-toc { position: static; flex-direction: row; overflow-x: auto; }
  .rules-toc button { white-space: nowrap; }
  .rule-row { grid-template-columns: 1fr; }
  .rule-row .diagram { max-width: 320px; }
  .piece-grid, .draw-grid { grid-template-columns: 1fr; }
}

/* ---------- Modal / toast ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--panel); border-radius: 14px; width: 100%; max-width: 420px; position: relative; padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.5); max-height: 90vh; overflow: auto; }
.modal-close { position: absolute; top: 10px; right: 10px; background: transparent; border: 0; color: var(--text-3); font-size: 18px; width: 34px; height: 34px; border-radius: 8px; }
.modal-close:hover { background: var(--panel-2); color: #fff; }
.modal h2 { font-size: 26px; text-align: center; margin-bottom: 6px; }
.modal .sub { text-align: center; color: var(--text-2); font-weight: 700; margin-bottom: 18px; }
.result-head { text-align: center; margin: -28px -28px 18px; padding: 24px; border-radius: 14px 14px 0 0; background: var(--panel-2); }
.result-head.win { background: linear-gradient(180deg, #5d8a35, #3f6a22); }
.result-head .trophy { font-size: 40px; }
.result-players { display: flex; align-items: center; justify-content: center; gap: 18px; margin-bottom: 18px; font-weight: 800; }
.result-players .vs { color: var(--text-3); }
.result-players > div { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #fff; color: #222;
  font-weight: 800; padding: 10px 18px; border-radius: 10px; z-index: 300; box-shadow: 0 10px 30px rgba(0,0,0,.4);
}
.search-results a { display: flex; gap: 10px; padding: 10px; border-radius: 8px; font-weight: 800; align-items: center; }
.search-results a:hover { background: var(--panel-2); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .home-layout { grid-template-columns: 1fr; }
  .game-layout { grid-template-columns: 1fr; }
  .side-panel { height: auto; max-height: none; min-height: 0; }
  .board-col { max-width: 640px; }
}
@media (max-width: 860px) {
  :root { --sidebar: 0px; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    position: sticky; top: 0; z-index: 40; background: var(--sp-stone), linear-gradient(180deg, #241a13, #15100c); border-bottom: 2px solid #b8843f; padding: 6px 12px;
  }
  .topbar .logo { padding: 0; }
  .sidebar { width: 240px; transform: translateX(-100%); transition: transform .2s; }
  body.menu-open .sidebar { transform: none; }
  body.menu-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 45; }
  .sidebar > .logo { display: none; }
  .flyout { position: static; display: none !important; }
  .hero, .feature, .app-promo { grid-template-columns: 1fr; }
  .hero { padding: 16px 16px 48px; gap: 28px; }
  .hero-board { justify-self: center; }
  .hero-copy { justify-self: center; }
  .hero-copy h1 { font-size: 36px; }
  .feature { padding: 40px 16px; gap: 28px; text-align: center; }
  .feature p { margin-left: auto; margin-right: auto; }
  .feature.reverse .feature-art { order: 0; }
  .feature h2, .section-title, .final-cta h2 { font-size: 30px; }
  .news-grid, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .page { padding: 16px 16px 48px; }
  .game-layout { padding: 12px 16px; }
  .play-tiles { grid-template-columns: repeat(2, 1fr); }
  .play-tiles .main-play { grid-column: span 2; }
  .app-promo .copy { padding: 32px 16px; }
  .clock { font-size: 20px; min-width: 96px; }
  .bot-list { grid-template-columns: repeat(4, 1fr); }
  .games-table .hide-sm { display: none; }
}
@media (min-width: 861px) and (max-width: 1100px) {
  .news-grid, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Full screen battlefield: the menu and the panel slide away (battlefield pages, wide screens) ---------- */
.edge-toggle { display: none; }
.sidebar { transition: transform .35s ease; }
main { transition: margin-left .35s ease; }
.bt-wrap, .game-layout { transition: grid-template-columns .35s ease; }
@media (min-width: 861px) {
  body.battle-page .edge-toggle.edge-left {
    display: flex; align-items: center; justify-content: center; position: fixed; top: 50%; z-index: 60;
    width: 22px; height: 66px; margin-top: -33px; padding: 0 0 3px; cursor: pointer;
    font-family: var(--font); font-size: 24px; font-weight: 900; line-height: 1; color: var(--sp-gold);
    background: var(--sp-stone), linear-gradient(180deg, #2f241b, #17110d); border: 1px solid #b98a45;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .6); transition: left .35s ease, right .35s ease, color .15s;
  }
  body.battle-page .edge-toggle:hover { color: #fff; border-color: #f0c97a; }
  .edge-toggle.edge-left { left: var(--sidebar); border-left: 0; border-radius: 0 8px 8px 0; }
  body.battle-page.nav-hidden { --sidebar: 0px; }
  body.battle-page.nav-hidden .sidebar { transform: translateX(-100%); box-shadow: none; }
}
@media (min-width: 1101px) {
  body.battle-page .edge-toggle.edge-right {
    display: flex; align-items: center; justify-content: center; position: fixed; top: 50%; z-index: 60;
    width: 22px; height: 66px; margin-top: -33px; padding: 0 0 3px; cursor: pointer;
    font-family: var(--font); font-size: 24px; font-weight: 900; line-height: 1; color: var(--sp-gold);
    background: var(--sp-stone), linear-gradient(180deg, #2f241b, #17110d); border: 1px solid #b98a45;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .6); transition: right .35s ease, color .15s;
  }
  .edge-toggle.edge-right { right: 350px; border-right: 0; border-radius: 8px 0 0 8px; }
  body.panel-hidden .edge-toggle.edge-right { right: 0; }
  body.battle-page.panel-hidden .bt-wrap { grid-template-columns: minmax(0, 1fr) 0; }
  body.battle-page.panel-hidden .game-layout:has(.board3d-host) { grid-template-columns: minmax(0, 1fr) 0; }
  /* the panel keeps its width and slides off the right edge (its column shrinks to nothing) */
  .bt-wrap, .game-layout:has(.board3d-host) { overflow: hidden; overflow: clip; }   /* clip: never scrolled, not even by script */
  .bt-panel, .game-layout:has(.board3d-host) > .side-panel { width: 350px; transition: visibility 0s linear .35s; }
  body.battle-page.panel-hidden .bt-panel, body.battle-page.panel-hidden .game-layout:has(.board3d-host) > .side-panel { visibility: hidden; }
  body.battle-page:not(.panel-hidden) .bt-panel, body.battle-page:not(.panel-hidden) .game-layout:has(.board3d-host) > .side-panel { transition: visibility 0s; }
}

/* ---------- Sign up / log in, account settings ---------- */
.form-error { background: rgba(224, 40, 40, .16); color: #ff9a8a; border: 1px solid rgba(224, 40, 40, .4); border-radius: 8px; padding: 8px 12px; font-weight: 700; font-size: 14px; margin: 4px 0 12px; }
.g-btn { display: flex; justify-content: center; min-height: 44px; margin: 6px 0 4px; }
.g-btn[hidden] { display: none; }
.auth-or { display: flex; align-items: center; gap: 12px; margin: 12px 0; color: var(--text-3); font-weight: 800; font-size: 13px; }
.auth-or::before, .auth-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.account-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.account-form .input { flex: 1; min-width: 180px; }
.danger-zone { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.danger-zone summary { cursor: pointer; font-weight: 800; color: #ff8a7a; }

/* ---------- Landing page (visitors not signed in): the user's landing picture ---------- */
main:has(.landing) { background: #120c08; }
.landing {
  background: radial-gradient(70% 50% at 85% 20%, rgba(150, 70, 20, .28), transparent 70%),
    radial-gradient(60% 40% at 15% 100%, rgba(120, 50, 15, .22), transparent 70%), var(--sp-stone), #140d08;
  color: #f2e8d6; overflow: hidden;
}
.lp-hero { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(420px, 36%); align-items: center; min-height: min(70vh, 720px); background: #140d08; }
.lp-hero-art { position: absolute; inset: 0 26% 0 0; background: url(../assets/ui/landing-hero.jpg) center 40% / cover no-repeat; }
.lp-hero-art::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 62%, #140d08 99%), linear-gradient(0deg, #140d08 0%, rgba(20, 13, 8, 0) 22%);
}
.lp-hero-copy { grid-column: 2; position: relative; z-index: 1; padding: 40px 44px 110px 8px; }
.lp-hero-copy h1 { text-align: right; margin: 0; line-height: .98; }
.lp-gold {
  display: block; font-family: var(--sp-title); font-weight: 700; font-size: clamp(46px, 5.4vw, 92px); letter-spacing: -.01em;
  background: linear-gradient(180deg, #fde7ad 8%, #e8b25c 55%, #b9792c 95%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 2px rgba(0, 0, 0, .8));
}
.lp-white { display: block; margin-top: 10px; white-space: nowrap; font-family: var(--sp-title); font-weight: 700; font-size: clamp(32px, 3.4vw, 64px); color: #fff; text-shadow: 0 3px 4px rgba(0, 0, 0, .8); }
.lp-hero-copy p { text-align: center; margin: 18px 0 28px; font-size: clamp(16px, 1.3vw, 20px); font-weight: 600; color: #e9dfcd; line-height: 1.55; text-shadow: 0 1px 3px #000; }
.lp-btn-gold {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 16px; min-height: 76px; border-radius: 8px;
  background: linear-gradient(180deg, #f8d88b 0%, #e2ab52 52%, #b77d2d 100%); border: 1px solid #f6d58f;
  color: #2a1606; font-family: var(--sp-title); font-weight: 700; font-size: clamp(26px, 2.2vw, 36px);
  box-shadow: 0 0 28px rgba(240, 168, 60, .35), inset 0 1px 0 rgba(255, 255, 255, .55), inset 0 -4px 0 rgba(120, 70, 20, .35), 0 6px 14px rgba(0, 0, 0, .55);
  transition: filter .15s, transform .1s;
}
.lp-btn-gold:hover { filter: brightness(1.07); }
.lp-btn-gold:active { transform: translateY(1px); }
.lp-btn-gold img { width: 50px; filter: brightness(.22) sepia(.8); }
.lp-chev { position: absolute; right: 26px; font-family: var(--font); font-size: 30px; font-weight: 700; letter-spacing: 6px; opacity: .8; }
.lp-btn-dark {
  margin-top: 18px; display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 62px; border-radius: 8px;
  background: rgba(12, 8, 5, .78); border: 1px solid #d9a656; color: #fff; font-weight: 800; font-size: clamp(17px, 1.4vw, 21px);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .6), 0 4px 12px rgba(0, 0, 0, .5);
}
.lp-btn-dark:hover { border-color: #f6d58f; background: rgba(40, 26, 14, .85); }
.lp-btn-dark img { width: 28px; height: 28px; object-fit: contain; }
.lp-strip {
  position: relative; z-index: 2; display: grid; grid-template-columns: repeat(4, 1fr);
  width: calc(100% - 48px); max-width: 1400px; margin: -78px auto 0;
  background: rgba(18, 12, 8, .93); border: 1px solid rgba(214, 166, 84, .32); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .6); backdrop-filter: blur(4px);
}
.lp-strip a { display: flex; align-items: center; gap: 14px; padding: 18px 20px; color: #fff; }
.lp-strip a + a { border-left: 1px solid rgba(214, 166, 84, .35); }
.lp-strip a:hover b { color: #f6d58f; }
.lp-strip img { width: 52px; height: 50px; object-fit: contain; flex: none; filter: drop-shadow(0 2px 2px #000); }
.lp-strip b { display: block; font-size: 19px; font-weight: 800; }
.lp-strip small { display: block; font-size: 13.5px; font-weight: 600; color: #cdbfa6; }
.lp-bots { max-width: 1760px; margin: 0 auto; padding: 38px 28px 44px; }
.lp-bots-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.lp-bots-head h2 { font-family: var(--sp-title); font-weight: 700; font-size: clamp(36px, 3.4vw, 54px); color: #f8ecd2; line-height: 1; text-shadow: 0 2px 3px #000; }
.lp-bots-head p { margin-top: 8px; font-size: 18px; font-weight: 600; color: #ddd0b8; }
.lp-bots-head > a { font-weight: 800; font-size: 18px; color: #f2e3c0; white-space: nowrap; }
.lp-bots-head > a:hover { color: #f6d58f; }
.lp-bot-row { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 12px; }
.lp-bot {
  position: relative; display: block; aspect-ratio: 1 / 1; border-radius: 8px; overflow: hidden;
  border: 1px solid rgba(214, 166, 84, .45); box-shadow: 0 6px 16px rgba(0, 0, 0, .55);
}
.lp-bot img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s ease; }
.lp-bot::after { content: ''; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(8, 5, 3, .95) 0%, rgba(8, 5, 3, .55) 28%, transparent 52%); }
.lp-bot:hover { border-color: #f6d58f; }
.lp-bot:hover img { transform: scale(1.06); }
.lp-bot-name { position: absolute; left: 10px; right: 6px; bottom: 30px; z-index: 1; font-weight: 800; font-size: clamp(14px, 1.05vw, 17px); color: #fff; text-shadow: 0 1px 3px #000; line-height: 1.15; }
.lp-bot-lvl { position: absolute; left: 10px; right: 4px; bottom: 9px; z-index: 1; display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; font-size: clamp(11.5px, .85vw, 14px); font-weight: 700; color: #ebdfc6; }
.lp-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.lp-bars i { width: 4px; background: rgba(233, 194, 122, .3); border-radius: 1px; }
.lp-bars i:nth-child(1) { height: 5px; } .lp-bars i:nth-child(2) { height: 8px; } .lp-bars i:nth-child(3) { height: 11px; } .lp-bars i:nth-child(4) { height: 14px; }
.lp-bars i.on { background: #f0c063; }
@media (max-width: 1100px) {
  .lp-bot-row { grid-template-columns: repeat(8, 165px); overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; }
  .lp-bot { scroll-snap-align: start; }
}
@media (max-width: 1100px) {
  .lp-hero { grid-template-columns: 1fr; min-height: 0; }
  .lp-hero-art { position: relative; inset: auto; aspect-ratio: 16 / 9; }
  .lp-hero-art::after { background: linear-gradient(0deg, #140d08 0%, rgba(20, 13, 8, 0) 35%); }
  .lp-hero-copy { grid-column: 1; padding: 0 24px 100px; margin-top: -40px; }
  .lp-hero-copy h1 { text-align: center; }
  .lp-strip { grid-template-columns: repeat(2, 1fr); }
  .lp-strip a:nth-child(3) { border-left: 0; }
  .lp-strip a:nth-child(n+3) { border-top: 1px solid rgba(214, 166, 84, .35); }
}
@media (max-width: 600px) {
  .lp-strip { grid-template-columns: 1fr; width: calc(100% - 32px); }
  .lp-strip a + a { border-left: 0; border-top: 1px solid rgba(214, 166, 84, .35); }
  .lp-bots { padding: 28px 16px 36px; }
  .lp-bots-head { flex-direction: column; align-items: flex-start; }
  .lp-bot-row { grid-template-columns: repeat(8, 150px); }
}

/* ---------- Sidebar for visitors: Sign Up and Log In ---------- */
.auth-signup {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 50px; padding: 6px 14px; border-radius: 6px; cursor: pointer;
  background: linear-gradient(180deg, #82c95e 0%, #5ba63c 55%, #3f7e28 100%); border: 1px solid #a8de86;
  color: #fff; font-family: var(--sp-font); font-weight: 800; font-size: 17px; text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 3px 8px rgba(0, 0, 0, .5);
}
.auth-signup:hover { filter: brightness(1.08); }
.auth-signup svg { width: 26px; height: 26px; fill: #fff; flex: none; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .5)); }
.auth-signup span { flex: 1; text-align: center; }
.auth-signup b, .auth-login b { font-family: var(--font); font-size: 20px; }
.auth-login .uc-go { margin-left: auto; color: var(--sp-gold); opacity: .6; }

/* invite link box */
.invite-link { display: flex; gap: 8px; }
.invite-link .input { flex: 1; min-width: 0; font-size: 13px; font-weight: 700; padding: 8px 10px; }
.side-panel .invite-link .input { background: rgba(0, 0, 0, .4); color: #f6e7c8; border: 1px solid rgba(214, 166, 84, .5); }

/* ---------- Pop-ups in the Spartan frame (the user's sign-up design) ---------- */
.modal-backdrop { background: rgba(8, 5, 3, .74); backdrop-filter: blur(3px); padding: 96px 16px 64px; overflow-y: auto; align-items: flex-start; }
.modal {
  margin: auto 0; overflow: visible; max-height: none; max-width: 470px; padding: 0; border-radius: 3px; color: #f1e5cc;
  background: var(--sp-stone), radial-gradient(120% 55% at 50% 0%, #2c2118, transparent 70%), linear-gradient(180deg, #1e1712, #0f0b08);
  border: 3px solid transparent; border-image: linear-gradient(135deg, #6b4219, #e8b768 22%, #8a5a26 48%, #e0ad60 76%, #5e3a16) 1;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .7), inset 0 0 0 4px rgba(214, 166, 84, .35), inset 0 0 40px rgba(0, 0, 0, .6), 0 28px 80px rgba(0, 0, 0, .8);
}
.modal.modal-auth { max-width: 600px; }
#modalBody { position: relative; z-index: 1; padding: 64px 34px 72px; }
.modal-auth #modalBody { padding: 72px 88px 78px; }
.modal-deco img { position: absolute; pointer-events: none; z-index: 2; user-select: none; }
.md-crest { top: -76px; left: 50%; transform: translateX(-50%); width: 176px; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .7)); }
.md-bottom { bottom: -58px; left: -26px; width: calc(100% + 52px); filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .6)); }
.md-banner, .md-warrior, .md-spear { display: none; }
.modal-auth .md-banner { display: block; top: 4px; left: 4px; width: 84px; z-index: 0; opacity: .95; }
.modal-auth .md-warrior { display: block; left: -54px; top: 21%; height: 64%; max-height: 640px; filter: drop-shadow(6px 6px 10px rgba(0, 0, 0, .7)); }
.modal-auth .md-spear { display: block; right: -50px; top: 28%; height: 62%; max-height: 640px; filter: drop-shadow(-6px 6px 10px rgba(0, 0, 0, .7)); }
.modal-close {
  top: 14px; right: 14px; z-index: 3; width: 40px; height: 40px; border-radius: 3px; font-size: 20px; line-height: 1;
  background: rgba(0, 0, 0, .45); color: #f3e3c0; border: 1px solid #c99545; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .6);
}
.modal-close:hover { background: rgba(156, 20, 24, .7); color: #fff; }
.modal h2 {
  font-family: var(--sp-title); font-weight: 700; font-size: clamp(34px, 6vw, 48px); line-height: 1.05; margin-bottom: 8px;
  background: linear-gradient(180deg, #fde7ad 10%, #e6b05c 55%, #b8792c 95%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .8));
}
.modal .sub { font-family: var(--sp-serif); font-weight: 500; font-size: 18px; line-height: 1.35; color: #e9dfcb; margin-bottom: 20px; }
.modal .form-row label { font-family: var(--sp-serif); font-weight: 700; font-size: 18px; color: #f3e7cf; margin-bottom: 6px; }
.modal .input {
  background: rgba(0, 0, 0, .5); color: #f6ead2; border: 1px solid rgba(214, 166, 84, .6); border-radius: 6px;
  font-size: 15px; font-weight: 700; padding: 13px 14px; box-shadow: inset 0 2px 6px rgba(0, 0, 0, .5);
}
.modal .input::placeholder { color: #8f826d; font-weight: 600; }
.modal .input:focus { outline: 2px solid #6cc04a; outline-offset: 0; border-color: #6cc04a; }
.modal select.input { appearance: none; -webkit-appearance: none; padding-right: 40px; font-size: 17px;
  background: rgba(0, 0, 0, .5) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='10' viewBox='0 0 16 10'%3E%3Cpath d='M1 1l7 7 7-7' fill='none' stroke='%23f3e3c0' stroke-width='2'/%3E%3C/svg%3E") right 16px center / 14px no-repeat; }
.inp-ic { position: relative; }
.inp-ic svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; fill: #a8987c; color: #a8987c; pointer-events: none; }
.inp-ic svg[fill="none"] { fill: none; stroke: #a8987c; }
.inp-ic .input { padding-left: 48px; }
.modal .g-btn { padding: 6px; border: 1px solid #c99545; border-radius: 6px; background: rgba(0, 0, 0, .45); box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .6), 0 3px 8px rgba(0, 0, 0, .5); }
.modal .auth-or { color: #d9b56d; font-family: var(--sp-serif); font-size: 18px; font-weight: 600; margin: 16px 0; }
.modal .auth-or::before, .modal .auth-or::after { background: linear-gradient(90deg, transparent, rgba(214, 166, 84, .7)); }
.modal .auth-or::after { background: linear-gradient(90deg, rgba(214, 166, 84, .7), transparent); }
.modal .auth-or span::before, .modal .auth-or span::after { content: '◆'; font-size: 9px; margin: 0 8px; vertical-align: 3px; color: #d9b56d; }
.modal .dots { gap: 10px; }
.modal .tc-btn {
  background: rgba(0, 0, 0, .45); border: 1px solid rgba(214, 166, 84, .55); border-radius: 6px; color: #fff;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .55);
}
.modal .tc-btn:hover { border-color: #f0c97a; }
.modal .tc-btn.sel { border: 2px solid #6cc04a; background: rgba(60, 100, 30, .25); }
.modal .tc-btn .av-img { width: 34px; height: 34px; }
.modal .btn-primary {
  border: 1px solid #f6d58f; border-radius: 6px; color: #2a1606; font-family: var(--sp-title); font-weight: 700; font-size: 24px; text-shadow: none;
  background: linear-gradient(180deg, #f8d88b 0%, #e2ab52 52%, #b77d2d 100%);
  box-shadow: 0 0 22px rgba(240, 168, 60, .25), inset 0 1px 0 rgba(255, 255, 255, .5), 0 4px 10px rgba(0, 0, 0, .55);
}
.modal .btn-primary:hover { filter: brightness(1.07); background: linear-gradient(180deg, #f8d88b 0%, #e2ab52 52%, #b77d2d 100%); }
.modal .btn-secondary { background: rgba(0, 0, 0, .45); border: 1px solid rgba(214, 166, 84, .55); color: #f3e6cc; box-shadow: none; }
.modal .muted, .modal .text-2 { color: #c9b996; }
.modal a { color: #f0c97a; }
.modal .form-error { font-family: var(--font); }
.modal .result-head { margin: 0 0 18px; padding: 0; background: none; }
.modal .result-head.win { background: none; }
.modal .result-head .trophy { font-size: 46px; }
.modal .result-players { font-family: var(--sp-serif); font-size: 17px; }
.modal-actions .btn { font-size: 18px; }
@media (max-width: 640px) {
  .modal-auth #modalBody { padding: 66px 22px 70px; }
  .modal-auth .md-warrior, .modal-auth .md-spear, .modal-auth .md-banner { display: none; }
  .md-crest { width: 140px; top: -60px; }
  .modal-backdrop { padding-top: 76px; }
}
.modal-auth .md-warrior, .modal-auth .md-spear { -webkit-mask-image: linear-gradient(180deg, #000 78%, transparent 100%); mask-image: linear-gradient(180deg, #000 78%, transparent 100%); }

/* pop-ups at their original size (420 px, as before the Spartan frame); the decorations scaled to match */
.modal, .modal.modal-auth { max-width: 420px; }
#modalBody, .modal-auth #modalBody { padding: 46px 28px 50px; }
.modal-backdrop { padding: 70px 16px 48px; }
.md-crest { width: 116px; top: -52px; }
.md-bottom { bottom: -40px; left: -18px; width: calc(100% + 36px); }
.modal-auth .md-banner { width: 46px; top: -4px; left: -12px; z-index: 2; }
.modal-auth .md-warrior { left: -42px; top: 24%; height: 50%; max-height: 420px; }
.modal-auth .md-spear { right: -40px; top: 28%; height: 50%; max-height: 420px; }
.modal-close { top: 10px; right: 10px; width: 32px; height: 32px; font-size: 16px; }
.modal h2 { font-size: 32px; margin-bottom: 6px; }
.modal .sub { font-size: 15px; margin-bottom: 16px; }
.modal .form-row { margin-bottom: 12px; }
.modal .form-row label { font-size: 15px; margin-bottom: 5px; }
.modal .input { font-size: 14px; padding: 10px 12px; }
.modal select.input { font-size: 14px; background-position: right 12px center; background-size: 12px; padding-right: 32px; }
.inp-ic svg { left: 12px; width: 17px; height: 17px; }
.inp-ic .input { padding-left: 40px; }
.modal .g-btn { padding: 3px; min-height: 0; }
.modal .auth-or { font-size: 14px; margin: 10px 0; }
.modal .dots { gap: 6px; }
.modal .tc-btn .av-img { width: 28px; height: 28px; }
.modal .btn-primary { font-size: 20px; min-height: 44px; padding: 10px 18px; }
.modal-actions .btn { font-size: 16px; }
@media (max-width: 640px) { .md-crest { width: 104px; top: -46px; } }

/* soldier avatars: warrior portraits fill the avatar; in the pickers, square tiles of one size */
.av-photo { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-portrait .av-photo { border-radius: inherit; }
#suAv .tc-btn, #profAv .tc-btn { width: 48px; height: 48px; padding: 3px !important; display: inline-flex; align-items: center; justify-content: center; overflow: hidden; }
#suAv .tc-btn .av-photo, #profAv .tc-btn .av-photo { border-radius: 4px; }
#suAv .tc-btn .av-img, #profAv .tc-btn .av-img { width: 34px; height: 34px; }

/* ---------- Site Stats (admin) ---------- */
.admin-page .page-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.adm-h { font-family: var(--sp-title); font-weight: 700; font-size: 26px; color: #f3d59a; margin: 22px 0 10px; }
.adm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.adm-card { padding: 16px 18px; border: 1px solid rgba(214, 166, 84, .45); border-radius: 8px;
  background: var(--sp-stone), linear-gradient(180deg, #241b14, #120d0a); box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .55), 0 3px 8px rgba(0, 0, 0, .45); }
.adm-num { font-family: var(--sp-font); font-weight: 800; font-size: 34px; font-variant-numeric: lining-nums; line-height: 1; color: #fbe7b5; }
.adm-label { margin-top: 6px; font-weight: 800; color: #f1e5cc; }
.adm-sub { margin-top: 2px; font-size: 13px; font-weight: 700; color: #b9a684; }
.adm-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; margin-top: 16px; }
.adm-chart { padding: 12px 14px; border: 1px solid rgba(214, 166, 84, .35); border-radius: 8px; background: rgba(0, 0, 0, .3); }
.adm-chart-h { display: flex; justify-content: space-between; gap: 10px; font-weight: 800; color: #f1e5cc; margin-bottom: 6px; }
.adm-chart-h span { font-size: 12px; color: #b9a684; display: flex; gap: 10px; align-items: center; }
.adm-chart-h i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; }
.adm-chart svg { width: 100%; height: auto; display: block; }
.adm-chart svg text { fill: #9d8c70; font-size: 10px; font-family: var(--font); font-weight: 700; }
.adm-chart svg line { stroke: rgba(214, 166, 84, .35); }

/* ---------- message pages (not found, no access) ---------- */
main:has(.notice-page) { background: var(--sp-stone), radial-gradient(70% 50% at 50% 30%, rgba(150, 70, 20, .22), transparent 70%), #140d08; }
.notice-page { display: flex; justify-content: center; padding-top: 110px; }
.notice-card {
  position: relative; width: 100%; max-width: 460px; text-align: center; padding: 64px 32px 34px; border-radius: 3px;
  background: var(--sp-stone), radial-gradient(120% 55% at 50% 0%, #2c2118, transparent 70%), linear-gradient(180deg, #1e1712, #0f0b08);
  border: 3px solid transparent; border-image: linear-gradient(135deg, #6b4219, #e8b768 22%, #8a5a26 48%, #e0ad60 76%, #5e3a16) 1;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .7), inset 0 0 0 4px rgba(214, 166, 84, .35), 0 20px 60px rgba(0, 0, 0, .7);
}
.notice-crest { position: absolute; top: -56px; left: 50%; transform: translateX(-50%); width: 120px; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .7)); }
.notice-ic { font-size: 40px; margin-bottom: 4px; }
.notice-card h1 { font-family: var(--sp-title); font-weight: 700; font-size: 40px; line-height: 1.05; margin-bottom: 10px;
  background: linear-gradient(180deg, #fde7ad 10%, #e6b05c 55%, #b8792c 95%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.notice-card p { font-family: var(--sp-serif); font-size: 17px; color: #e9dfcb; margin-bottom: 20px; }
.notice-card .btn-primary { border: 1px solid #f6d58f; color: #2a1606; font-family: var(--sp-title); font-weight: 700; font-size: 20px; text-shadow: none;
  background: linear-gradient(180deg, #f8d88b 0%, #e2ab52 52%, #b77d2d 100%); box-shadow: 0 0 22px rgba(240, 168, 60, .25), 0 4px 10px rgba(0, 0, 0, .55); }
.notice-card .btn-secondary { background: rgba(0, 0, 0, .45); border: 1px solid rgba(214, 166, 84, .55); color: #f3e6cc; box-shadow: none; }
.notice-card b { color: #f6e7c8; }
.notice-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.side-panel .status-line a { color: #f0c97a; text-decoration: underline; }

/* Play page bot picker: the landing page's bot cards (portrait, name, strength bars, level) */
.side-panel .bot-list { grid-template-columns: 1fr 1fr; gap: 9px; }
.side-panel .bot-pick {
  position: relative; display: block; padding: 0; aspect-ratio: 16 / 10; overflow: hidden; text-align: left;
  border: 1px solid rgba(214, 166, 84, .5); border-radius: 8px; background: #120d0a; box-shadow: 0 4px 10px rgba(0, 0, 0, .5);
}
.side-panel .bot-pick img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 30%; transition: transform .3s ease; }
.side-panel .bot-pick::after { content: ''; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(8, 5, 3, .95) 0%, rgba(8, 5, 3, .55) 34%, transparent 62%); }
.side-panel .bot-pick:hover { border-color: #f6d58f; filter: none; }
.side-panel .bot-pick:hover img { transform: scale(1.06); }
.side-panel .bot-pick.sel {
  border: 2px solid #f0c063; background: #120d0a;
  box-shadow: 0 0 0 2px rgba(196, 42, 36, .85), 0 0 18px rgba(230, 160, 60, .45), 0 4px 10px rgba(0, 0, 0, .5);
}
.bp-name { position: absolute; left: 9px; right: 6px; bottom: 23px; z-index: 1; font-family: var(--font); font-weight: 800; font-size: 14px; line-height: 1.1; color: #fff; text-shadow: 0 1px 3px #000; }
.bp-lvl { position: absolute; left: 9px; right: 4px; bottom: 6px; z-index: 1; display: flex; align-items: center; gap: 5px; white-space: nowrap; overflow: hidden; font-family: var(--font); font-size: 11.5px; font-weight: 700; color: #ebdfc6; }
.bp-lvl .lp-bars { height: 11px; }
.bp-lvl .lp-bars i { width: 3px; }
.bp-lvl .lp-bars i:nth-child(1) { height: 4px; } .bp-lvl .lp-bars i:nth-child(2) { height: 6px; } .bp-lvl .lp-bars i:nth-child(3) { height: 8px; } .bp-lvl .lp-bars i:nth-child(4) { height: 11px; }

/* Online time controls as cards (like the bot cards): the category's scene, split across its three cards */
.side-panel .tc-cards { gap: 8px; }
.tc-card {
  position: relative; display: block; padding: 0; aspect-ratio: 4 / 3; overflow: hidden; text-align: left; cursor: pointer;
  border: 1px solid rgba(214, 166, 84, .5); border-radius: 8px; background: #120d0a; box-shadow: 0 4px 10px rgba(0, 0, 0, .5);
}
.tc-card img { position: absolute; top: 0; height: 100%; width: calc(300% + 16px); left: calc(-100% * var(--i) - 8px * var(--i)); max-width: none; object-fit: cover; transition: transform .3s ease; }
.tc-card::after { content: ''; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(8, 5, 3, .95) 0%, rgba(8, 5, 3, .5) 40%, rgba(8, 5, 3, .05) 70%); }
.tc-card:hover { border-color: #f6d58f; }
.tc-card:hover img { transform: scale(1.04); }
.tc-card.sel { border: 2px solid #f0c063; box-shadow: 0 0 0 2px rgba(196, 42, 36, .85), 0 0 18px rgba(230, 160, 60, .45), 0 4px 10px rgba(0, 0, 0, .5); }
.tcc-name { position: absolute; left: 8px; right: 4px; bottom: 19px; z-index: 1; font-family: var(--sp-font); font-weight: 800; font-size: 17px; line-height: 1; color: #fff; text-shadow: 0 1px 3px #000; white-space: nowrap; }
.tcc-sub { position: absolute; left: 8px; right: 4px; bottom: 5px; z-index: 1; font-family: var(--font); font-size: 10.5px; font-weight: 700; color: #e6d7b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* battlefield loading screen: message and progress bar */
.bt-load-box { display: flex; flex-direction: column; align-items: center; gap: 14px; width: min(360px, 80%); }
.bt-load-text { font-family: var(--sp-title); font-weight: 700; font-size: 24px; color: #f3d59a; text-shadow: 0 2px 3px #000; text-align: center; }
.bt-load-bar { width: 100%; height: 8px; border-radius: 4px; background: rgba(0, 0, 0, .5); border: 1px solid rgba(214, 166, 84, .5); overflow: hidden; }
.bt-load-bar i { display: block; height: 100%; background: linear-gradient(90deg, #b77d2d, #f8d88b); transition: width .25s ease; }
