:root {
  --bg: #0b1519;
  --panel: #0f1d22;
  --panel-2: #132429;
  --line: #1d3037;
  --line-2: #16272d;
  --text: #e6eeed;
  --muted: #8a9a9b;
  --dim: #5f7072;
  --accent: #3ecfb9;
  --eikos: #f2ab43;
  --jev: #7aa5ff;
  --draw: #52666a;
  --sq-l: #f0d9b5;
  --sq-d: #b58863;
  --hl-l: #cdd26a;
  --hl-d: #aaa23a;
  --font: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 13px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
b { font-weight: 600; }
button { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.big, .stats dd, .round-score, .mnav span, .moves .p, .count .big { font-variant-numeric: tabular-nums; }

/* nav */
.nav { height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 5; }
.nav-l { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { width: 22px; height: 22px; flex: none; }
.logo rect:first-child { fill: var(--eikos); }
.logo rect:last-child { fill: var(--jev); }
.brand { font-size: 16px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.tag { font-size: 11px; font-weight: 600; color: var(--accent); border: 1px solid rgba(62, 207, 185, .45); border-radius: 4px; padding: 2px 6px; white-space: nowrap; }
.nav-m { display: flex; gap: 22px; }
.nav-m a { color: var(--muted); font-weight: 500; }
.nav-m a:hover { color: var(--text); text-decoration: none; }
.live { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); flex: none; }
.live.on i { background: #2bb58b; box-shadow: 0 0 0 3px rgba(43, 181, 139, .18); }
.live.off i { background: #ef6a7f; }
.intro { margin: 0; padding: 10px 16px; color: var(--muted); border-bottom: 1px solid var(--line); }
.intro b { color: var(--text); }

/* layout */
.wrap { max-width: 1480px; margin: 0 auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; min-width: 0; scroll-margin-top: 60px; }
.ph { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ph h2 { font-size: 14px; font-weight: 600; margin: 0; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 8px; }

/* ranking */
.versus { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; padding: 18px 18px 10px; align-items: end; }
.side { display: flex; flex-direction: column; gap: 2px; }
.side.d { align-items: center; }
.side.j { align-items: flex-end; text-align: right; }
.side .nm { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.side .nm i { width: 9px; height: 9px; border-radius: 2px; }
.side.e .nm i { background: var(--eikos); }
.side.j .nm i { background: var(--jev); }
.side .big { font-size: 40px; font-weight: 600; letter-spacing: -.03em; line-height: 1.1; }
.side.e .big { color: var(--eikos); }
.side.j .big { color: var(--jev); }
.side.d .big { color: var(--muted); font-size: 28px; }
.side .lbl { color: var(--dim); font-size: 12px; }
.sbar { display: flex; height: 8px; margin: 4px 18px 0; border-radius: 4px; overflow: hidden; background: var(--line-2); }
.sbar i { display: block; height: 100%; width: 0; transition: width .6s; }
.sbar .e { background: var(--eikos); }
.sbar .d { background: var(--draw); }
.sbar .j { background: var(--jev); }
.verdict { margin: 14px 18px 0; font-size: 14px; }
.verdict .sub { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 18px; margin: 16px 18px 18px; }
.stats div { min-width: 0; }
.stats dt { color: var(--dim); font-size: 11.5px; }
.stats dd { margin: 2px 0 0; font-weight: 500; }
.last { margin: 0 18px 18px; }
.last .lbl { color: var(--dim); font-size: 11.5px; }
.strip { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; min-height: 14px; }
.strip i { width: 14px; height: 14px; border-radius: 3px; background: var(--draw); }
.strip i.e { background: var(--eikos); }
.strip i.j { background: var(--jev); }

/* play */
.play { display: flex; flex-direction: column; }
.count { display: flex; align-items: baseline; gap: 8px; padding: 16px 16px 4px; }
.count .big { font-size: 40px; font-weight: 600; letter-spacing: -.03em; }
.count .lbl { color: var(--muted); }
input[type=range] { margin: 6px 16px 0; accent-color: var(--accent); }
.quick { display: flex; gap: 6px; padding: 10px 16px 0; }
.quick button { flex: 1; background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; padding: 6px 0; color: var(--muted); font-weight: 500; cursor: pointer; }
.quick button:hover { color: var(--text); }
.quick button.on { color: var(--text); border-color: var(--accent); }
.quick button:disabled { opacity: .35; cursor: default; }
.quick button:disabled:hover { color: var(--muted); }
.hint { color: var(--muted); margin: 10px 16px 0; font-size: 12.5px; }
.notice { margin: 10px 16px 0; padding: 8px 10px; border: 1px solid rgba(62, 207, 185, .35); border-radius: 5px; background: rgba(62, 207, 185, .07); font-size: 12.5px; }
.notice[hidden] { display: none; }
.ts { margin: 14px 16px 0; min-height: 65px; }
.go { margin: 12px 16px 0; background: var(--accent); color: #062420; border: 0; border-radius: 5px; padding: 11px 0; font-weight: 700; font-size: 14px; cursor: pointer; }
.go:disabled { background: var(--panel-2); color: var(--dim); cursor: default; }
.status { margin: 10px 16px 16px; min-height: 19px; color: var(--muted); }
.status.err { color: #ef8a9a; }

/* round */
.rt { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.round-score { display: flex; gap: 14px; flex-wrap: wrap; font-weight: 500; }
.round-score .e { color: var(--eikos); }
.round-score .j { color: var(--jev); }
.round-score .d, .round-score .p { color: var(--muted); }
.ghost { background: none; border: 1px solid var(--line); border-radius: 4px; padding: 5px 10px; color: var(--muted); cursor: pointer; }
.ghost:hover { color: var(--text); }
.bar { height: 3px; background: var(--line-2); }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .6s; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 12px; }
.tile { display: flex; flex-direction: column; gap: 6px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 5px; padding: 6px; cursor: pointer; text-align: left; min-width: 0; }
.tile:hover { border-color: var(--line); }
.tile.won-e { border-color: rgba(242, 171, 67, .55); }
.tile.won-j { border-color: rgba(122, 165, 255, .55); }
.tile .row { display: flex; justify-content: space-between; gap: 6px; font-size: 11.5px; }
.tile .pl { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.tile .pl i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.tile .pl i.w { background: #f4f1ea; }
.tile .pl i.b { background: #1b1b1b; border: 1px solid #8a8a8a; }
.tile .pl.e { color: var(--eikos); }
.tile .pl.j { color: var(--jev); }
.tile .op { color: var(--dim); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .st { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .st.e { color: var(--eikos); }
.tile .st.j { color: var(--jev); }
.grid > .empty { grid-column: 1 / -1; }

/* live now */
.lv-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); gap: 10px; padding: 12px; }
.lv-list > .empty { grid-column: 1 / -1; }
.lv-card { display: flex; flex-direction: column; gap: 8px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 5px; padding: 8px; cursor: pointer; text-align: left; min-width: 0; }
.lv-card:hover { border-color: var(--line); }
.lv-head { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); min-height: 18px; }
.lv-head > span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lv-head b { font-size: 11px; font-weight: 600; border-radius: 3px; padding: 1px 6px; }
.lv-head .tagm { color: #062420; background: var(--accent); }
.lv-head .tagw { color: var(--accent); border: 1px solid rgba(62, 207, 185, .45); }
.lv-boards { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }

/* boards */
.board { display: grid; grid-template-columns: repeat(8, 1fr); aspect-ratio: 1; width: 100%; border-radius: 2px; overflow: hidden; }
.board div { position: relative; }
.board .l { background: var(--sq-l); }
.board .d { background: var(--sq-d); }
.board .l.hl { background: var(--hl-l); }
.board .d.hl { background: var(--hl-d); }
.pc { position: absolute; inset: 0; background-size: 100% 100%; background-repeat: no-repeat; }

/* recent */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 7px 12px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
tbody tr { cursor: pointer; }
tbody tr:hover td { background: var(--panel-2); }
td.op { max-width: 360px; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.who-e { color: var(--eikos); font-weight: 600; }
.who-j { color: var(--jev); font-weight: 600; }
.empty { padding: 26px 12px; color: var(--muted); text-align: center; }

/* how */
.how { padding: 14px 16px; }
.how h2 { font-size: 15px; font-weight: 600; margin: 0 0 10px; }
.how-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.how-grid p { margin: 0; color: var(--muted); line-height: 1.55; }
.how-grid b { color: var(--text); }
.caveat { color: var(--muted); border-top: 1px solid var(--line); margin: 12px 0 0; padding-top: 10px; }
.links { display: flex; flex-wrap: wrap; gap: 18px; margin: 10px 0 0; align-items: baseline; }
.hash { color: var(--dim); font-size: 11px; word-break: break-all; }
.foot { color: var(--dim); font-size: 11.5px; padding: 12px 16px 28px; text-align: center; }
.foot a { color: var(--muted); }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(4, 10, 12, .78); z-index: 20; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal[hidden] { display: none; }
.sheet { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; display: grid; grid-template-columns: minmax(0, 520px) minmax(0, 340px); gap: 18px; padding: 18px; max-height: calc(100vh - 32px); width: 920px; max-width: 100%; }
.x { position: absolute; top: 6px; right: 10px; background: none; border: 0; color: var(--muted); font-size: 24px; cursor: pointer; line-height: 1; }
.x:hover { color: var(--text); }
.mleft { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.mplayer { display: flex; justify-content: space-between; font-weight: 600; }
.mplayer .e { color: var(--eikos); }
.mplayer .j { color: var(--jev); }
.mnav { display: flex; align-items: center; justify-content: center; gap: 6px; }
.mnav button { background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; width: 40px; height: 32px; cursor: pointer; font-size: 16px; }
.mnav button:hover { border-color: var(--muted); }
.mnav span { min-width: 90px; text-align: center; color: var(--muted); }
.mright { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.mright h3 { margin: 0 24px 2px 0; font-size: 15px; }
.mright > .muted { margin: 0 0 10px; }
.dec { background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 6px; padding: 10px 12px; min-height: 108px; }
.dec .who { font-size: 12px; font-weight: 600; }
.dec .who.e { color: var(--eikos); }
.dec .who.j { color: var(--jev); }
.dec .mv { font-size: 22px; font-weight: 600; margin: 2px 0; }
.dec .mv small { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 6px; }
.dec .note { margin-top: 6px; }
.alt { display: grid; grid-template-columns: 52px 1fr 44px; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); margin-top: 4px; }
.alt .track { height: 5px; background: var(--line-2); border-radius: 3px; overflow: hidden; }
.alt .track i { display: block; height: 100%; background: var(--dim); }
.alt.best .track i { background: var(--accent); }
.alt.best { color: var(--text); }
.moves { list-style: none; margin: 10px 0 0; padding: 0; overflow-y: auto; display: grid; grid-template-columns: 34px 1fr 1fr; align-content: start; font-size: 12.5px; min-height: 0; flex: 1; border-top: 1px solid var(--line); padding-top: 6px; }
.moves .n { color: var(--dim); padding: 3px 0; }
.moves .m { padding: 3px 6px; border-radius: 3px; cursor: pointer; display: flex; justify-content: space-between; gap: 4px; }
.moves .m:hover { background: var(--panel-2); }
.moves .m.on { background: rgba(62, 207, 185, .16); }
.moves .m.open { color: var(--dim); }
.moves .m.e .s { color: var(--eikos); }
.moves .m.j .s { color: var(--jev); }
.moves .p { color: var(--dim); font-size: 11px; }

@media (max-width: 1100px) {
  .nav-m { display: none; }
  .how-grid { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hide-s { display: none; }
  .wrap { padding: 6px; gap: 6px; }
  .tag { display: none; }
  .intro { padding: 8px 10px; }
  .nav { padding: 0 10px; }
  .versus { padding: 14px 14px 8px; }
  .side .big { font-size: 32px; }
  .sbar { margin: 4px 14px 0; }
  .verdict { margin: 12px 14px 0; }
  .stats { margin: 14px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; padding: 8px; }
  .tile { padding: 4px; gap: 4px; }
  .tile .op { display: none; }
  .lv-list { grid-template-columns: 1fr; padding: 8px; gap: 6px; }
  .lv-boards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .how-grid { grid-template-columns: 1fr; gap: 10px; }
  .modal { padding: 0; align-items: stretch; }
  .sheet { grid-template-columns: 1fr; border-radius: 0; max-height: 100vh; overflow-y: auto; padding: 44px 12px 16px; gap: 12px; }
  .moves { max-height: 260px; }
}
