/* liveGames style v20261005b */
:root {
  --bg: #0f1419;
  --bg2: #1a222c;
  --bg3: #243040;
  --border: #2f3d4d;
  --text: #e7eef6;
  --muted: #9aabbc;
  --accent: #81b64c;
  --accent2: #4ea1d3;
  --live: #e74c3c;
  --soon: #f0ad4e;
  --finished: #7a8896;
  --radius: 12px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: baseline; gap: 0.75rem; }
.brand a { color: var(--text); font-weight: 700; font-size: 1.15rem; text-decoration: none; }
.tag { color: var(--muted); font-size: 0.85rem; }

main { padding: 1rem 1.25rem 2.5rem; max-width: 1400px; margin: 0 auto; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}
.toolbar h1, .toolbar h2 { font-size: 1.25rem; margin: 0; flex: 1 1 auto; }
.round-meta { flex: 1 1 220px; }
.round-controls { display: flex; align-items: center; gap: 0.5rem; }

.hint { color: var(--muted); font-size: 0.9rem; margin: 0.25rem 0 1rem; }
.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text);
  border-radius: 8px;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  font: inherit;
}
.btn:hover { border-color: var(--accent2); }
.btn.ghost { background: transparent; }

.status-pill {
  font-size: 0.8rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--muted);
}
.status-pill.live { color: #fff; background: #8b1e1e; border-color: var(--live); }
.status-pill.connecting { color: var(--soon); }
.status-pill.error { color: #ff8a80; border-color: #ff8a80; }

.badge {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  white-space: nowrap;
}
.badge.live { background: rgba(231, 76, 60, 0.2); color: #ff8a80; }
.badge.soon { background: rgba(240, 173, 78, 0.18); color: var(--soon); }
.badge.finished { background: rgba(122, 136, 150, 0.2); color: var(--finished); }
.badge.unknown { background: var(--bg3); color: var(--muted); }

.board-wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.85rem;
}
.game-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.55rem;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.game-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.game-card .players {
  font-size: 0.78rem;
  line-height: 1.25;
  margin-bottom: 0.35rem;
  min-height: 2.4em;
}
.game-card .players .side { color: var(--muted); }
.game-card .board-wrap {
  width: 100%;
  aspect-ratio: 1;
  min-height: 140px;
  position: relative;
}
.game-card .board-wrap .chessboard-63f37 {
  width: 100% !important;
}
.game-card .foot .moves { color: var(--soon); }
.game-card .foot {
  display: flex;
  justify-content: space-between;
  gap: 0.35rem;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  color: var(--muted);
}
.game-card .foot .res { color: var(--text); font-weight: 600; }

/* chessboard.js dark tweak */
.board-wrap .board-b72b1 { border: none; box-shadow: none; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}
.modal-panel {
  position: relative;
  width: min(960px, 100%);
  max-height: min(92vh, 900px);
  overflow: auto;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem 1.25rem;
}
.modal-close {
  position: absolute;
  top: 0.4rem;
  right: 0.6rem;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  padding-right: 1.5rem;
  margin-bottom: 0.75rem;
}
.modal-players { font-size: 1.05rem; font-weight: 600; }
.result-badge { font-weight: 700; color: var(--accent); }
.modal-body {
  display: grid;
  grid-template-columns: minmax(240px, 420px) 1fr;
  gap: 1rem;
}
.modal-board-col {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
}
.modal-board { width: 100%; max-width: 420px; }

.replay-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  max-width: 420px;
}
.replay-btn {
  padding: 0.35rem 0.55rem;
  min-width: 2.2rem;
  font-size: 0.85rem;
  font-weight: 600;
}
.replay-btn.active {
  border-color: var(--accent);
  background: rgba(129, 182, 76, 0.18);
  color: var(--accent);
}
.ply-label {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.move-list {
  margin: 0;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border-radius: 10px;
  border: 1px solid var(--border);
  max-height: 480px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  columns: 2;
  column-gap: 1rem;
  list-style: none !important;
}
.move-list li {
  break-inside: avoid;
  padding: 0.15rem 0;
  color: var(--muted);
  list-style: none !important;
}
.move-list li::marker {
  content: none;
  display: none;
}
.move-list li strong { color: var(--text); font-weight: 600; }
.move-san {
  cursor: pointer;
  padding: 0.05rem 0.2rem;
  border-radius: 4px;
  color: var(--muted);
}
.move-san:hover { background: var(--bg3); color: var(--text); }
.move-san.current {
  background: rgba(129, 182, 76, 0.25);
  color: var(--text);
  font-weight: 700;
}

@media (max-width: 720px) {
  .modal-body { grid-template-columns: 1fr; }
  .move-list { columns: 1; max-height: 240px; }
  .board-wall { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .ply-label { margin-left: 0; width: 100%; text-align: right; }
}

/* ================= Home: tournament index ================= */
.home-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
}
.home-title h1 { font-size: 1.45rem; margin: 0; }
.home-title .hint { margin: 0.2rem 0 0; }
.hint.error { color: #ff8a80; }
.home-tools { display: flex; gap: 0.5rem; align-items: center; flex: 0 1 460px; }
.search {
  flex: 1 1 auto;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font: inherit;
}
.search:focus { outline: none; border-color: var(--accent2); }

.home-sec { margin: 1.25rem 0 1.75rem; }
.sec-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  margin: 0 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}
.sec-title .count {
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--bg3);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
}
.sec-title .sec-sub { font-size: 0.8rem; font-weight: 400; color: var(--muted); }
.sec-live .sec-title { color: #ff8a80; border-bottom-color: rgba(231, 76, 60, 0.45); }
.sec-live .sec-title .count { background: rgba(231, 76, 60, 0.2); color: #ff8a80; }

.dot {
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  border-radius: 50%;
  background: var(--live);
  margin-right: 0.35em;
  vertical-align: 0.05em;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.tgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1rem;
}
.tgrid.live { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.tgrid.compact { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 0.65rem; }

.tcard {
  display: flex;
  flex-direction: column;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, transform 0.15s;
  min-width: 0;
}
.tcard:hover, .tcard:focus-visible { border-color: var(--accent2); transform: translateY(-2px); outline: none; }
.tcard.live { border-color: rgba(231, 76, 60, 0.55); }
.tcard.live:hover { border-color: var(--live); }

.tcard-img {
  position: relative;
  aspect-ratio: 2 / 1;
  background: var(--bg3);
  overflow: hidden;
  flex: 0 0 auto;
}
.tcard-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tcard-img .ph {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 2rem;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.9);
  background: linear-gradient(135deg, hsl(var(--h), 45%, 30%), hsl(calc(var(--h) + 40), 50%, 18%));
}
.img-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  color: #fff;
  background: rgba(0, 0, 0, 0.6);
}
.img-badge.live { background: var(--live); }
.img-badge.live .dot { background: #fff; }

.tcard-body {
  padding: 0.7rem 0.85rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}
.tcard h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tier {
  display: inline-block;
  margin-left: 0.4rem;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  vertical-align: 0.15em;
  white-space: nowrap;
}
.tier.t5 { background: rgba(240, 173, 78, 0.2); color: var(--soon); }
.tier.t4 { background: rgba(78, 161, 211, 0.18); color: var(--accent2); }

.tcard-status { font-size: 0.85rem; color: var(--text); }
.tcard-status .when { color: var(--muted); }
.st { font-weight: 700; font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; }
.st.live { color: #ff8a80; }
.st.ongoing { color: var(--accent); }
.st.upcoming { color: var(--soon); }
.st.finished { color: var(--finished); }
.tcard-meta, .tcard-info, .tcard-players {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tcard-players { font-style: italic; }
.tc {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.05rem 0.4rem;
  border-radius: 4px;
  background: var(--bg3);
  color: var(--text);
  margin-right: 0.3rem;
}
.tc-standard { color: var(--accent); }
.tc-rapid { color: var(--accent2); }
.tc-blitz { color: var(--soon); }

.chips { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.25rem; }
.chip {
  appearance: none;
  font: inherit;
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.chip:hover { border-color: var(--accent2); }
.chip.rep { border-color: var(--accent); }
.chip.live { border-color: rgba(231, 76, 60, 0.6); }
.chip.active { background: var(--accent2); border-color: var(--accent2); color: #0b1016; font-weight: 700; }

/* Compact (finished) cards: thumbnail on the left */
.tcard.compact { flex-direction: row; box-shadow: none; }
.tcard.compact .tcard-img { aspect-ratio: 2 / 1; width: 120px; flex: 0 0 120px; align-self: flex-start; margin: 0.55rem 0 0.55rem 0.55rem; border-radius: 8px; }
.tcard.compact .tcard-img .ph { font-size: 1.3rem; }
.tcard.compact .tcard-body { padding: 0.5rem 0.7rem; gap: 0.2rem; flex: 1 1 auto; }
.tcard.compact h3 { font-size: 0.92rem; }

.load-more-wrap { display: flex; justify-content: center; margin: 0.5rem 0 1.5rem; }
.load-more-wrap .btn { padding: 0.6rem 1.4rem; }

/* ================= Tournament page ================= */
.tour-top { margin-bottom: 0.75rem; }
.tour-header {
  display: flex;
  gap: 1rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 0.85rem;
}
.tour-header .tcard-img { width: 300px; flex: 0 0 300px; aspect-ratio: 2 / 1; align-self: flex-start; }
.th-body { padding: 0.85rem 1rem 0.85rem 0; display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.tour-header > .th-body:first-child { padding-left: 1rem; }
.th-body h1 { margin: 0; font-size: 1.35rem; line-height: 1.25; }
.th-section { font-weight: 700; color: var(--accent2); }
.th-meta, .th-players { font-size: 0.85rem; color: var(--muted); }
.th-players span { color: var(--text); }
.th-links { display: flex; flex-wrap: wrap; gap: 1rem; font-size: 0.85rem; margin-top: 0.15rem; }

.section-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin-bottom: 0.75rem; }
.tabs-label, .rounds-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-right: 0.25rem; }
.section-tabs .chip { font-size: 0.82rem; padding: 0.3rem 0.7rem; }

.round-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}
.rchip {
  appearance: none;
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  min-width: 5.6rem;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.rchip:hover { border-color: var(--accent2); }
.rchip .rname { font-weight: 700; font-size: 0.85rem; white-space: nowrap; }
.rchip .rsub { font-size: 0.7rem; color: var(--muted); white-space: nowrap; }
.rchip.finished .rsub { color: var(--finished); }
.rchip.soon .rsub { color: var(--soon); }
.rchip.live { border-color: rgba(231, 76, 60, 0.6); }
.rchip.live .rsub { color: #ff8a80; font-weight: 700; }
.rchip.active { border-color: var(--accent); background: rgba(129, 182, 76, 0.16); box-shadow: inset 0 0 0 1px var(--accent); }
.round-bar { border-top: 1px solid var(--border); padding-top: 0.75rem; }
.round-bar .hint { margin: 0.15rem 0 0; }

@media (max-width: 720px) {
  main { padding: 0.75rem 0.7rem 2rem; }
  .topbar { padding: 0.6rem 0.8rem; }
  .home-tools { flex: 1 1 100%; }
  .tgrid, .tgrid.live, .tgrid.compact { grid-template-columns: 1fr; gap: 0.6rem; }
  /* On phones only live cards keep the big image; the rest are compact rows */
  .tcard:not(.live) { flex-direction: row; box-shadow: none; }
  .tcard:not(.live) .tcard-img { aspect-ratio: 2 / 1; width: 108px; flex: 0 0 108px; align-self: flex-start; margin: 0.55rem 0 0.55rem 0.55rem; border-radius: 8px; }
  .tcard:not(.live) .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .tcard:not(.live) .chips::-webkit-scrollbar { display: none; }
  .tcard:not(.live) .tcard-img .ph { font-size: 1.2rem; }
  .tcard:not(.live) .tcard-body { padding: 0.5rem 0.65rem; gap: 0.2rem; }
  .tcard:not(.live) h3 { font-size: 0.92rem; }
  .tcard:not(.live) .tcard-players { display: none; }
  .tour-header { flex-direction: column; gap: 0; }
  .tour-header .tcard-img { width: 100%; flex: 0 0 auto; max-height: 170px; }
  .th-body { padding: 0.7rem 0.8rem; }
  .th-body h1 { font-size: 1.15rem; }
  .section-tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 0.25rem; -webkit-overflow-scrolling: touch; }
  .round-strip { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 0.35rem; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
  .rchip { flex: 0 0 auto; }
}

/* ================= v20260925b: live-ness + live games strip ================= */
.st.idle { color: var(--soon); }
.tcard-status .lg { color: #ff8a80; }
.img-badge.live.pulse { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7); animation: badgePulse 1.8s ease-out infinite; }
@keyframes badgePulse {
  0% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.75); }
  70% { box-shadow: 0 0 0 9px rgba(231, 76, 60, 0); }
  100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}
.img-badge.idle { background: rgba(20, 26, 34, 0.82); color: var(--soon); border: 1px solid rgba(240, 173, 78, 0.45); font-weight: 700; letter-spacing: 0.02em; }
.img-badge.eng { left: auto; right: 0.5rem; background: rgba(78, 161, 211, 0.9); color: #0b1016; }
.eng-tag {
  display: inline-block;
  margin-left: 0.4rem;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  vertical-align: 0.15em;
  background: rgba(78, 161, 211, 0.18);
  color: var(--accent2);
  border: 1px solid rgba(78, 161, 211, 0.5);
  white-space: nowrap;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.tcard.idle { border-color: rgba(240, 173, 78, 0.35); }
.sec-idle .sec-title { color: var(--soon); border-bottom-color: rgba(240, 173, 78, 0.35); }
.sec-title .sec-games {
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  background: var(--live);
  border-radius: 999px;
  padding: 0.12rem 0.6rem;
}
.sec-title .sec-games .dot { background: #fff; }
.chip.idle { border-color: rgba(240, 173, 78, 0.5); }
.chip-n { font-weight: 800; color: #ff8a80; }
.rchip.idle { border-color: rgba(240, 173, 78, 0.5); }
.rchip.idle .rsub { color: var(--soon); font-weight: 600; }
.rchip.due .rsub { color: var(--soon); }

.live-strip {
  background: linear-gradient(180deg, rgba(231, 76, 60, 0.09), rgba(26, 34, 44, 0.6));
  border: 1px solid rgba(231, 76, 60, 0.35);
  border-radius: var(--radius);
  padding: 0.8rem 0.9rem 0.6rem;
  margin: 0 0 1.25rem;
  min-width: 0;
}
.ls-head h2 { margin: 0; font-size: 1.2rem; display: flex; align-items: center; gap: 0.4rem; color: #ff8a80; }
.ls-head h2 .count { font-size: 0.75rem; font-weight: 700; background: rgba(231, 76, 60, 0.2); color: #ff8a80; border-radius: 999px; padding: 0.1rem 0.5rem; }
.ls-head .hint { margin: 0.2rem 0 0.6rem; }
.ls-group { margin-bottom: 0.6rem; min-width: 0; }
.ls-sub { margin: 0.2rem 0 0.45rem; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text); }
.ls-note { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--muted); font-size: 0.78rem; margin-left: 0.35rem; }
.ls-empty { margin: 0.2rem 0 0.4rem; }
.ls-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.6rem;
  min-width: 0;
}
.mini {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.4rem 0.45rem 0.45rem;
  cursor: pointer;
  min-width: 0;
  transition: border-color 0.15s, transform 0.15s;
}
.mini:hover, .mini:focus-visible { border-color: var(--live); transform: translateY(-1px); outline: none; }
.mini.moved { animation: miniMoved 1.2s ease-out; }
@keyframes miniMoved { 0% { border-color: var(--accent); } 100% { border-color: var(--border); } }
.mini-board { width: 100%; }
.mini-board .board-b72b1 { border: none; box-shadow: none; }
.mp {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.74rem;
  line-height: 1.3;
  min-width: 0;
  padding: 0.12rem 0;
}
.mp-name { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp .ttl { color: var(--soon); font-weight: 800; font-size: 0.68rem; }
.mp-r { color: var(--muted); font-variant-numeric: tabular-nums; }
.fed { font-size: 0.62rem; font-weight: 700; color: var(--muted); border: 1px solid var(--border); border-radius: 3px; padding: 0 0.2rem; }
.mp-clk { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.7rem; }
.mp-clk:empty { display: none; }
.mp-clk.on { color: #fff; background: rgba(231, 76, 60, 0.35); border-radius: 3px; padding: 0 0.25rem; }
.mini-ev { font-size: 0.68rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 0.1rem; }

@media (max-width: 720px) {
  .live-strip { padding: 0.65rem 0.6rem 0.5rem; }
  .ls-row {
    display: flex;
    overflow-x: auto;
    gap: 0.5rem;
    padding-bottom: 0.35rem;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
  }
  .mini { flex: 0 0 158px; width: 158px; scroll-snap-align: start; }
  .ls-note { display: block; margin: 0.1rem 0 0; }
  .sec-title { flex-wrap: wrap; }
}

/* ================= v20260925c: split live games into over-the-board (primary) + online (secondary) ================= */
.otb-section {
  background: linear-gradient(180deg, rgba(231, 76, 60, 0.1), rgba(26, 34, 44, 0.65));
  border: 1px solid rgba(231, 76, 60, 0.45);
  border-radius: var(--radius);
  padding: 0.85rem 0.95rem 0.75rem;
  margin: 0 0 0.85rem;
  min-width: 0;
}
.otb-section .ls-head h2 { font-size: 1.3rem; }
.otb-section .count { font-size: 0.8rem; background: var(--live); color: #fff; }
.otb-section .count.zero { background: var(--bg3); color: var(--muted); }
.otb-section:not(.has-games) .ls-head h2 .dot { background: var(--finished); animation: none; }
.otb-row { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.75rem; }
.otb-row .mini { padding: 0.5rem 0.55rem 0.55rem; border-color: rgba(231, 76, 60, 0.3); }
.otb-row .mp { font-size: 0.82rem; }
.otb-row .mp-clk { font-size: 0.76rem; }
.otb-row .mini-ev { font-size: 0.74rem; white-space: normal; display: flex; flex-direction: column; gap: 0.05rem; }
.ev-tour { color: var(--text); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-round { color: var(--muted); }
.otb-empty { padding: 0.15rem 0 0.2rem; }
.otb-msg { margin: 0 0 0.45rem; font-weight: 700; font-size: 0.98rem; color: var(--text); }
.otb-next { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.next-btn {
  appearance: none;
  font: inherit;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.55rem;
  text-align: left;
  cursor: pointer;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.65rem;
}
.next-btn:hover, .next-btn:focus-visible { border-color: var(--soon); outline: none; }
.next-lbl { font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--soon); }
.next-name { font-weight: 600; font-size: 0.88rem; min-width: 0; }
.next-when { font-size: 0.82rem; color: var(--muted); margin-left: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }

.online-section {
  border: 1px solid rgba(78, 161, 211, 0.28);
  background: rgba(26, 34, 44, 0.45);
  border-radius: var(--radius);
  padding: 0.55rem 0.8rem 0.55rem;
  margin: 0 0 1.25rem;
  min-width: 0;
}
.on-head { display: flex; align-items: center; flex-wrap: wrap; gap: 0.25rem 0.6rem; margin-bottom: 0.45rem; }
.on-head h2 { margin: 0; font-size: 0.95rem; font-weight: 700; color: var(--accent2); display: flex; align-items: center; gap: 0.4rem; }
.on-head .count { font-size: 0.7rem; font-weight: 700; background: rgba(78, 161, 211, 0.16); color: var(--accent2); border-radius: 999px; padding: 0.05rem 0.45rem; }
.on-sub { font-size: 0.78rem; color: var(--muted); }
.on-toggle { margin-left: auto; padding: 0.15rem 0.6rem; font-size: 0.75rem; }
.online-section.collapsed .on-head { margin-bottom: 0; }
.on-empty { margin: 0 0 0.2rem; font-size: 0.8rem; }
.online-row { grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); gap: 0.45rem; }
.online-row .mini { padding: 0.3rem 0.35rem 0.35rem; background: rgba(26, 34, 44, 0.8); }
.online-row .mini:hover, .online-row .mini:focus-visible { border-color: var(--accent2); }
.online-row .mp { font-size: 0.68rem; padding: 0.08rem 0; }
.online-row .mp-clk { font-size: 0.64rem; }
.online-row .mp-clk.on { background: rgba(78, 161, 211, 0.35); }
.online-row .mini-ev { display: flex; gap: 0.3rem; align-items: center; }
.tc-tag {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.02rem 0.35rem;
  border-radius: 4px;
  background: var(--bg3);
  color: var(--text);
}
.tc-tag.bullet { color: #ffb74d; background: rgba(255, 183, 77, 0.14); }
.tc-tag.blitz { color: #f0d44e; background: rgba(240, 212, 78, 0.13); }
.tc-tag.rapid { color: var(--accent); background: rgba(129, 182, 76, 0.15); }
.tc-tag.classical { color: var(--accent2); background: rgba(78, 161, 211, 0.15); }
.tc-tag.ultraBullet { color: #ff8a80; background: rgba(231, 76, 60, 0.15); }
.rt-tag { font-size: 0.6rem; color: var(--accent2); white-space: nowrap; }

@media (max-width: 720px) {
  .otb-section { padding: 0.65rem 0.6rem 0.55rem; }
  .otb-section .ls-head h2 { font-size: 1.12rem; flex-wrap: wrap; }
  .otb-row .mini { flex: 0 0 196px; width: 196px; }
  .online-section { padding: 0.45rem 0.55rem 0.4rem; }
  .on-sub { font-size: 0.72rem; }
  .online-row .mini { flex: 0 0 122px; width: 122px; }
  .next-when { margin-left: 0; }
}
.online-row .mini-ev { overflow: hidden; white-space: nowrap; }
@media (max-width: 720px) {
  .otb-section .hint { font-size: 0.8rem; margin-bottom: 0.45rem; }
  .otb-msg { font-size: 0.92rem; margin-bottom: 0.35rem; }
  .otb-next li:nth-child(n + 3) { display: none; }
  .otb-next { gap: 0.3rem; }
  .next-btn { padding: 0.35rem 0.55rem; gap: 0.1rem 0.5rem; }
  .next-name { order: 3; flex: 1 1 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.84rem; }
  .next-when { margin-left: auto; font-size: 0.76rem; }
  .on-head { margin-bottom: 0.35rem; }
  .on-sub { order: 3; flex: 1 1 100%; }
}

/* ================= v20260925d: status bar on top of every tournament card / header ================= */
.tcard { flex-direction: column; }
.tcard-main { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.tcard.compact { flex-direction: column; }
.tcard.compact .tcard-main { flex-direction: row; }
.tbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0 0.1rem;
  width: 100%;
  padding: 0.38rem 0.8rem;
  font-size: 0.84rem;
  line-height: 1.3;
  color: var(--text);
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
.tbar strong { font-weight: 800; }
.tbar-sep { color: inherit; opacity: 0.75; white-space: pre; }
.tbar .dot { margin-right: 0.45em; }
.tbar.live { background: #c0392b; color: #fff; border-bottom-color: #e74c3c; }
.tbar.live .dot { background: #fff; animation: pulse 1.2s ease-in-out infinite; width: 0.65em; height: 0.65em; }
.tbar.live.checking { background: #8e2b22; }
.tbar.idle { background: rgba(240, 173, 78, 0.16); color: #f5c67a; border-bottom-color: rgba(240, 173, 78, 0.4); }
.tbar.between { background: #2a3441; color: #c3cfdb; }
.tbar.upcoming { background: #183a5a; color: #cfe6f7; border-bottom-color: #22527d; }
.tbar.finished { background: #1c232c; color: var(--finished); }
.tbar.finished strong { font-weight: 700; }
.tcard.live { border-color: #e74c3c; }
/* Tournament page header with bar */
.tour-header.with-bar { flex-direction: column; gap: 0; }
.th-main { display: flex; gap: 1rem; min-width: 0; }
.tour-header .tbar { font-size: 0.95rem; padding: 0.5rem 1rem; }

@media (max-width: 720px) {
  .tcard:not(.live) { flex-direction: column; }
  .tcard:not(.live) .tcard-main { flex-direction: row; }
  .tbar { font-size: 0.8rem; padding: 0.32rem 0.65rem; }
  .th-main { flex-direction: column; gap: 0; }
  .tour-header .tbar { font-size: 0.86rem; padding: 0.42rem 0.8rem; }
}

/* ================= v20260925i: move numbers + analysis tree in the game modal ================= */
.game-card .mvlabel { font-size: 0.7rem; color: var(--muted); margin-top: 0.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-card .mvlabel.live { color: var(--soon); }
.game-card .mvlabel.fin { color: var(--finished); }
.game-card .foot .moves { font-variant-numeric: tabular-nums; white-space: nowrap; }
.mini-mv { margin-left: auto; font-size: 0.66rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; padding-left: 0.3rem; }
.otb-row .ev-round { display: flex; align-items: baseline; min-width: 0; }
.otb-row .mini-mv { font-size: 0.7rem; color: var(--soon); }
.rt-dot { color: var(--accent2); font-size: 0.6rem; }

.modal-state { font-size: 0.82rem; color: var(--soon); margin: -0.35rem 0 0.6rem; }
#modalBoard { touch-action: none; user-select: none; -webkit-user-select: none; }
#modalBoard .sq-lm { box-shadow: inset 0 0 0 999px rgba(155, 199, 0, 0.38); }
#modalBoard .sq-sel { box-shadow: inset 0 0 0 999px rgba(78, 161, 211, 0.55); }
#modalBoard .sq-dest { position: relative; }
#modalBoard .sq-dest::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 28%;
  height: 28%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(20, 30, 40, 0.45);
  pointer-events: none;
  z-index: 3;
}
.tree-bar { display: flex; flex-wrap: wrap; gap: 0.4rem; max-width: 420px; }
.tree-bar:empty { display: none; }
.btn.small { padding: 0.25rem 0.6rem; font-size: 0.8rem; }
.btn.live-jump { border-color: rgba(231, 76, 60, 0.7); color: #ffb3ab; background: rgba(231, 76, 60, 0.14); }
.btn.live-jump:hover { border-color: var(--live); }
.tree-hint { margin: 0; font-size: 0.74rem; color: var(--muted); max-width: 420px; line-height: 1.35; }
.ply-label { margin-left: auto; }

.move-list.tree {
  columns: auto;
  column-count: 1;
  position: relative;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.55;
}
.tree .mrow { display: grid; grid-template-columns: 3.1em 1fr 1fr; align-items: baseline; padding: 0.05rem 0; }
.tree .mnum { color: var(--muted); font-weight: 600; }
.tree .mcell { min-width: 0; }
.tree .mcell.dots { color: var(--muted); }
.tree .move-san.main { color: var(--text); font-weight: 600; }
.tree .move-san.side { color: #9fb6cc; font-weight: 400; }
.tree .move-san.current { background: rgba(129, 182, 76, 0.32); color: #fff; font-weight: 800; }
.tree .mv-num { color: #7f93a8; font-size: 0.92em; }
.tree .var-block {
  margin: 0.15rem 0 0.25rem 1.1em;
  padding: 0.15rem 0.45rem;
  border-left: 2px solid rgba(78, 161, 211, 0.45);
  color: #9fb6cc;
  font-size: 0.93em;
  background: rgba(78, 161, 211, 0.05);
  border-radius: 0 6px 6px 0;
}
.tree .var-inline { color: #8aa0b5; }
.tree .var-inline.d2 { color: #7e93a7; }
.tree .var-inline.d3, .tree .var-inline.d4 { color: #72869a; }
.tree .var-del {
  appearance: none;
  border: none;
  background: transparent;
  color: #6f8295;
  cursor: pointer;
  font-size: 0.75em;
  padding: 0 0.2em;
  margin-right: 0.1em;
  line-height: 1;
}
.tree .var-del:hover { color: #ff8a80; }
.tree-empty { margin: 0.2rem 0; }

@media (max-width: 720px) {
  .tree-hint { font-size: 0.7rem; }
  .modal-state { font-size: 0.78rem; }
  .move-list.tree { max-height: 220px; }
  .replay-btn { min-width: 2.6rem; padding: 0.45rem 0.55rem; }
}

/* ---------- v20260925i: per-game status strip (board wall) + modal pill ---------- */
.game-card .gstat {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.4rem -0.55rem -0.55rem;
  padding: 0.3rem 0.55rem;
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  font-size: 0.72rem;
  min-width: 0;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
}
.game-card .gstat .mvlabel { margin: 0; flex: 1 1 auto; min-width: 0; text-align: right; color: inherit; font-size: 0.7rem; }
.gs-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  flex: 0 0 auto;
  font-weight: 700;
  font-size: 0.7rem;
  line-height: 1;
  padding: 0.22rem 0.45rem;
  border-radius: 999px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.gs-dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: #fff; animation: pulse 1.2s ease-in-out infinite; }
/* live */
.game-card .gstat.live { background: rgba(231, 76, 60, 0.16); border-top-color: rgba(231, 76, 60, 0.55); color: #ffd5cf; }
.gstat.live .gs-pill, .gs-pill.live { background: var(--live); color: #fff; letter-spacing: 0.06em; box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.6); animation: gsGlow 1.8s ease-out infinite; }
@keyframes gsGlow { 0% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.55); } 70% { box-shadow: 0 0 0 6px rgba(231, 76, 60, 0); } 100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); } }
.game-card.gs-live { border-color: rgba(231, 76, 60, 0.7); box-shadow: 0 0 0 1px rgba(231, 76, 60, 0.25), 0 0 12px rgba(231, 76, 60, 0.18); }
.game-card.gs-live:hover { border-color: var(--live); }
/* stalled */
.game-card .gstat.stalled { background: rgba(240, 173, 78, 0.1); color: #e8c48a; }
.gstat.stalled .gs-pill, .gs-pill.stalled { background: rgba(240, 173, 78, 0.18); color: var(--soon); border: 1px solid rgba(240, 173, 78, 0.5); }
/* finished */
.gstat.done .gs-pill, .gs-pill.done { background: rgba(122, 136, 150, 0.22); color: #c3ccd5; border: 1px solid rgba(122, 136, 150, 0.45); }
.game-card.gs-done { opacity: 0.92; }
/* not started */
.gstat.wait .gs-pill, .gs-pill.wait { background: transparent; color: var(--muted); border: 1px dashed rgba(122, 136, 150, 0.5); font-weight: 600; }
.game-card .gstat.wait { opacity: 0.8; }
/* modal header */
.modal-state { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.modal-state .gs-pill { font-size: 0.74rem; }
.modal-state .gs-detail { color: var(--text); opacity: 0.85; }
@media (prefers-reduced-motion: reduce) {
  .gs-dot, .gstat.live .gs-pill, .gs-pill.live { animation: none; }
}
@media (max-width: 480px) {
  .game-card .gstat { gap: 0.3rem; padding: 0.28rem 0.45rem; }
  .game-card .gstat .mvlabel { font-size: 0.64rem; }
  .gs-pill { font-size: 0.66rem; padding: 0.2rem 0.38rem; }
}

/* ---------- v20260925i: English description line at the bottom of home cards ---------- */
.tcard-desc {
  margin-top: auto;
  padding: 0.45rem 0.85rem 0.55rem;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.025);
  font-size: 0.76rem;
  line-height: 1.35;
  color: var(--muted);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
  min-width: 0;
}
.tcard.compact .tcard-desc { padding: 0.35rem 0.7rem 0.45rem; font-size: 0.72rem; -webkit-line-clamp: 1; line-clamp: 1; }
@media (max-width: 640px) {
  .tcard-desc { padding: 0.35rem 0.65rem 0.45rem; font-size: 0.72rem; }
}

/* v20260925i: side-to-move wording on the board wall ("Move 24 · Black to play"; number dropped on narrow cards) */
.game-card .gstat { container-type: inline-size; }
.game-card .gstat .mvlabel { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@container (max-width: 215px) {
  .game-card .gstat .mvn { display: none; }
}

/* v20261005b: site hamburger navigation */
.top-actions { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.brand { min-width: 0; }
.brand .tag { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 430px) {
  .brand .tag { display: none; }
}

.site-menu-btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 36px; padding: 0; border-radius: 8px; cursor: pointer; flex-shrink: 0;
  border: 1px solid var(--border); background: var(--bg3); color: var(--text);
  touch-action: manipulation; transition: border-color 0.15s ease, background 0.15s ease;
}
.site-menu-btn:hover { border-color: var(--accent2); }
.site-menu-btn:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }
.site-menu-btn[aria-expanded="true"] { border-color: var(--accent); background: rgba(129, 182, 76, 0.15); color: var(--accent); }

.site-menu {
  position: fixed; inset: 0; z-index: 80;
  pointer-events: none;
}
.site-menu.is-open { pointer-events: auto; }
.site-menu[hidden] { display: none !important; }
.site-menu-backdrop {
  position: absolute; inset: 0;
  background: rgba(5, 8, 12, 0.55);
  opacity: 0; transition: opacity 0.18s ease;
}
.site-menu.is-open .site-menu-backdrop { opacity: 1; }
.site-menu-panel {
  position: absolute; top: 0; right: 0;
  width: min(300px, 88vw); height: 100%; max-height: 100dvh;
  overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 0.2rem;
  padding: 1rem 0.75rem 1.5rem;
  background: var(--bg2); border-left: 1px solid var(--border);
  box-shadow: -12px 0 32px rgba(0, 0, 0, 0.45);
  transform: translateX(100%); transition: transform 0.2s ease;
}
.site-menu.is-open .site-menu-panel { transform: none; }
.site-menu-section {
  margin: 0.85rem 0.55rem 0.35rem; padding-top: 0.55rem;
  border-top: 1px solid var(--border);
  color: var(--muted); font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.site-menu-link {
  display: block; padding: 0.7rem 0.85rem; border-radius: 10px;
  color: var(--text); font-weight: 600; font-size: 0.98rem;
  text-decoration: none; line-height: 1.25;
}
.site-menu-link:hover { background: var(--bg3); text-decoration: none; }
.site-menu-link.is-current,
.site-menu-link[aria-current="page"] {
  background: rgba(129, 182, 76, 0.16); color: #b7f28a;
  box-shadow: inset 3px 0 0 var(--accent);
}
html.site-menu-open { overflow: hidden; }
@media (max-width: 520px) {
  .topbar { gap: 0.5rem; }
  .site-menu-btn { width: 36px; height: 34px; }
  .site-menu-btn svg { width: 20px; height: 20px; }
}
