:root {
  color-scheme: dark;
  --bg: #0d1015; --panel: #151920; --panel-strong: #1b2029; --line: #2b313c;
  --text: #eef1f5; --muted: #a5adb8; --accent: #d9ad64; --accent-strong: #f0c77f;
  --radiant: #56c2a6; --dire: #e0716b; --danger: #f08b86;
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.boot, .empty, .error { padding: 40px 24px; color: var(--muted); text-align: center; line-height: 1.7; }
.error { color: var(--danger); }
.error .text-button { display: block; margin: 8px auto 0; }
.primary { min-height: 48px; border: 1px solid #b28645; border-radius: 6px; background: var(--accent); color: #171109; padding: 0 22px; font-weight: 650; }
.primary:not(:disabled):hover { background: var(--accent-strong); }
.secondary { white-space: nowrap; background: var(--panel-strong); color: var(--text); border: 1px solid var(--line); padding: 8px 10px; border-radius: 6px; font-size: 13px; }
.secondary:not(:disabled):hover { border-color: var(--muted); }
.text-button { border: 0; background: none; color: var(--muted); padding: 8px 4px; font-size: 13px; }
.text-button:hover { color: var(--text); text-decoration: underline; }
.search-page { width: min(900px, calc(100% - 48px)); margin: 0 auto; padding: 48px 0 56px; }
.search-header { display: flex; align-items: center; gap: 16px; padding-bottom: 28px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.brand { color: var(--text); font-size: 18px; font-weight: 650; }
.search-page h1 { font-size: 26px; margin: 40px 0 28px; font-weight: 600; }
.search-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.search-form label { grid-column: 1 / -1; font-size: 14px; }
.search-form input { min-width: 0; height: 48px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); padding: 0 14px; }
.search-form input::placeholder { color: var(--muted); }
.search-help { margin: 10px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.list-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 40px 0 16px; }
.list-heading h2 { font-size: 16px; margin: 0; font-weight: 600; }
.match-list { overflow: hidden; border: 1px solid var(--line); border-radius: 6px; }
.match-row { display: grid; grid-template-columns: minmax(180px, 1.4fr) 80px minmax(160px, 1fr) auto; align-items: center; gap: 16px; min-height: 88px; padding: 16px 20px; background: var(--panel); text-decoration: none; border-bottom: 1px solid var(--line); transition: background 160ms ease; }
.match-row:last-child { border-bottom: 0; }
.match-row:hover { background: var(--panel-strong); }
.match-id { font-variant-numeric: tabular-nums; font-weight: 600; }
.match-meta, .ward-count { color: var(--muted); font-size: 13px; }
.match-meta { margin-top: 6px; }
.match-result { font-size: 13px; }
.match-action { display: grid; gap: 6px; text-align: right; font-size: 14px; color: var(--accent); }
.state { color: var(--muted); font-size: 12px; }
.state.ready { color: var(--radiant); }
.state.incompatible { color: var(--danger); }
.detail-page { width: min(1600px, calc(100% - 32px)); margin: 0 auto; padding: 16px 0; }
.match-header { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 24px; min-height: 68px; }
.back-link, .external-link { color: var(--muted); font-size: 13px; text-decoration: none; }
.back-link:hover, .external-link:hover { color: var(--text); }
.match-heading { min-width: 0; }
.match-heading h1 { overflow: hidden; margin: 0; font-size: 19px; text-overflow: ellipsis; white-space: nowrap; }
.match-heading p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.versus { margin: 0 8px; color: var(--muted); font-size: 14px; font-weight: 400; }
.match-winner { margin-left: 16px; font-size: 13px; color: var(--muted); font-weight: 400; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 320px; height: max(640px, calc(100vh - 104px)); overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.map-column { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; min-height: 0; border-right: 1px solid var(--line); }
.map-toolbar { display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.map-toolbar select { height: 36px; border: 1px solid var(--line); border-radius: 6px; background: #11151b; color: var(--text); padding: 0 24px 0 9px; font-size: 14px; }
.map-live-count { margin-left: auto; font-size: 13px; color: var(--muted); }
.map-shell { position: relative; min-height: 0; overflow: hidden; background: #07090c; touch-action: none; }
#map-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; cursor: grab; }
#map-canvas.dragging { cursor: grabbing; }
.map-controls { position: absolute; right: 12px; top: 12px; display: grid; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.map-controls button { min-width: 42px; height: 38px; border: 0; border-bottom: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 20px; }
.map-controls button:last-child { border-bottom: 0; font-size: 13px; }
.map-controls button:hover { background: var(--panel-strong); }
.map-legend { position: absolute; left: 12px; top: 12px; display: flex; flex-wrap: wrap; gap: 12px; padding: 8px 10px; background: #0d1015; border-radius: 4px; font-size: 12px; color: var(--muted); pointer-events: none; }
.radiant { color: var(--radiant); }
.dire { color: var(--dire); }
.quality { position: absolute; right: 12px; bottom: 12px; padding: 5px 8px; background: #0d1015; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.map-notice { position: absolute; inset: auto auto 12px 12px; max-width: calc(100% - 190px); border-radius: 4px; background: #0d1015; color: var(--muted); padding: 8px 10px; font-size: 12px; line-height: 1.6; pointer-events: none; }
.timeline { padding: 14px 16px 10px; border-top: 1px solid var(--line); }
.timeline-heading { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 8px; }
.timeline-heading label { font-size: 14px; }
.timeline-heading > span, .map-help { font-size: 12px; color: var(--muted); }
.timeline-heading output { margin-left: 8px; font-weight: 650; font-variant-numeric: tabular-nums; }
.timeline-controls { display: flex; gap: 16px; align-items: center; }
.timeline input { min-width: 0; width: 100%; accent-color: var(--accent); }
.map-help { margin-top: 10px; text-align: center; }
.ward-sidebar { min-height: 0; display: flex; flex-direction: column; background: #12161c; }
.ward-panel { flex: 0 1 auto; max-height: 58%; overflow: auto; min-width: 0; padding: 20px; border-bottom: 1px solid var(--line); }
.panel-empty { padding: 8px 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.ward-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ward-title h2 { font-size: 17px; margin: 0; }
.ward-owner { color: var(--muted); font-size: 13px; margin: 8px 0 18px; }
.coverage-message { font-size: 14px; line-height: 1.6; margin: 0 0 8px; }
.coverage-caption { font-size: 12px; color: var(--muted); line-height: 1.7; margin: 0 0 20px; }
.facts { display: grid; gap: 10px; margin: 0; }
.fact { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.fact dt { color: var(--muted); font-size: 13px; }
.fact dd { margin: 0; font-size: 14px; font-variant-numeric: tabular-nums; }
.data-notes { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.data-notes summary { cursor: pointer; }
.data-notes dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; overflow-wrap: anywhere; }
.data-notes dd { margin: 0; }
.ward-list-heading { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 12px; }
.ward-list-heading h2 { font-size: 15px; margin: 0; }
.ward-list-heading > span { color: var(--muted); font-size: 13px; }
.ward-list { overflow: auto; min-height: 0; flex: 1; padding-bottom: 8px; }
.ward-list > .panel-empty { padding: 16px 20px; }
.ward-row { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: 8px; align-items: center; width: 100%; padding: 12px 20px; border: 0; border-left: 3px solid transparent; text-align: left; background: transparent; color: var(--text); font-size: 14px; }
.ward-row:hover { background: var(--panel-strong); }
.ward-row[aria-pressed="true"] { background: #25231e; border-left-color: var(--accent); }
.ward-row-main { display: grid; gap: 5px; overflow: hidden; }
.ward-row-main > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ward-player, .ward-row-status, .ward-row time { color: var(--muted); font-size: 12px; }
.ward-player { margin-left: 6px; }
.ward-row time { font-variant-numeric: tabular-nums; }
.status-block { margin: 20vh auto 0; width: min(520px, calc(100% - 32px)); border: 1px solid var(--line); border-radius: 6px; background: var(--panel); padding: 24px; text-align: center; }
.status-block h1 { margin: 0 0 8px; font-size: 18px; }
.status-block .back-link { display: inline-block; margin-bottom: 16px; }
.status-block .primary { margin-top: 16px; min-height: 40px; }
.status-block p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
@media (max-width: 1000px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 290px; }
  .map-live-count { font-size: 12px; }
  .timeline-heading > span { display: none; }
}
@media (max-width: 820px) {
  .search-page { padding-top: 24px; }
  .match-row { grid-template-columns: 1fr auto; gap: 8px 12px; }
  .match-result, .ward-count { display: none; }
  .match-header { grid-template-columns: auto 1fr; gap: 16px; }
  .external-link, .match-winner { display: none; }
  .workspace { display: block; height: auto; min-height: 0; overflow: visible; }
  .map-column { grid-template-rows: auto minmax(55vh, 1fr) auto; border-right: 0; }
  .ward-sidebar { border-top: 1px solid var(--line); }
  .ward-panel { max-height: none; }
  .ward-list { max-height: 400px; }
}
@media (max-width: 560px) {
  .search-page { width: calc(100% - 32px); }
  .search-page h1 { font-size: 22px; }
  .search-form { grid-template-columns: 1fr; }
  .detail-page { width: 100%; padding-top: 6px; }
  .match-header { padding: 0 12px; }
  .match-heading h1 { font-size: 16px; }
  .workspace { border-right: 0; border-left: 0; border-radius: 0; }
  .map-toolbar { flex-wrap: wrap; padding: 8px; }
  .map-notice { max-width: calc(100% - 120px); }
  .map-legend { gap: 8px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
