:root {
  --bg-canvas: #0d1219;
  --bg-panel: #141c27;
  --bg-elevated: #1b2535;
  --bg-hover: #212e42;
  --border-line: #253349;
  --border-strong: #354968;

  --ct-steel: #5ba4e5;
  --ct-dim: rgba(91, 164, 229, 0.16);
  --t-brass: #e09f3e;
  --t-dim: rgba(224, 159, 62, 0.16);

  --pos-teal: #2dd4bf;
  --pos-bg: rgba(45, 212, 191, 0.14);
  --neg-coral: #fb7185;
  --neg-bg: rgba(251, 113, 133, 0.14);
  --warn-amber: #fbbf24;

  --ink-main: #edf2f8;
  --ink-sub: #9fb0c7;
  --ink-muted: #6e819c;

  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-display: "Chakra Petch", var(--font-sans);
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-canvas);
  background-image: radial-gradient(circle at 15% 0%, rgba(91, 164, 229, 0.08), transparent 42%),
                    radial-gradient(circle at 85% 0%, rgba(224, 159, 62, 0.07), transparent 40%);
  color: var(--ink-main);
  font-family: var(--font-sans);
  line-height: 1.5;
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: rgba(20, 28, 39, 0.92);
  border-bottom: 1px solid var(--border-line);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  padding: 6px 10px;
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(91, 164, 229, 0.22), rgba(224, 159, 62, 0.22));
  border: 1px solid var(--border-strong);
  color: var(--ink-main);
  white-space: nowrap;
}

.brand-title {
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand-sub {
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.telemetry-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--ink-sub);
  background: var(--bg-elevated);
  border: 1px solid var(--border-line);
  padding: 5px 12px;
  border-radius: 999px;
}

.pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-muted);
}

.pill.ok .dot {
  background: var(--pos-teal);
  box-shadow: 0 0 8px var(--pos-teal);
}

.pill.warn .dot {
  background: var(--warn-amber);
  box-shadow: 0 0 8px var(--warn-amber);
}

.pill.err .dot {
  background: var(--neg-coral);
}

/* Steam Guard Banner */
.guard-banner {
  margin: 14px 24px 0;
  padding: 14px 18px;
  background: rgba(224, 159, 62, 0.14);
  border: 1px solid var(--t-brass);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.guard-info strong {
  display: block;
  color: var(--t-brass);
  font-size: 0.92rem;
}

.guard-info span {
  font-size: 0.82rem;
  color: var(--ink-sub);
}

.guard-form {
  display: flex;
  gap: 8px;
}

.guard-form input {
  background: var(--bg-canvas);
  border: 1px solid var(--border-strong);
  color: var(--ink-main);
  padding: 8px 12px;
  border-radius: 6px;
  font-family: var(--font-mono);
  width: 160px;
}

/* Action Bar */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border-line);
  background: rgba(13, 18, 25, 0.65);
  flex-wrap: wrap;
}

.sharecode-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 290px;
}

.input-wrap {
  flex: 1;
}

.sharecode-form input[type="text"],
.pin-input {
  width: 100%;
  background: var(--bg-panel);
  border: 1px solid var(--border-line);
  color: var(--ink-main);
  padding: 9px 14px;
  border-radius: 7px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  transition: border-color 0.15s;
}

.pin-input {
  width: 120px;
  flex: 0 0 auto;
}

.sharecode-form input:focus,
.pin-input:focus {
  outline: none;
  border-color: var(--ct-steel);
}

.seed-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--ink-sub);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.upload-actions {
  display: flex;
  gap: 8px;
}

.btn {
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 9px 15px;
  font-size: 0.84rem;
  font-weight: 600;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--ct-steel);
  color: #08111d;
}

.btn-primary:hover:not(:disabled) {
  background: #77b6ee;
}

.btn-amber {
  background: var(--t-brass);
  color: #140e04;
}

.btn-ghost {
  background: var(--bg-panel);
  border-color: var(--border-strong);
  color: var(--ink-main);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-hover);
}

.link-btn {
  background: none;
  border: none;
  color: var(--ct-steel);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.link-btn:hover {
  text-decoration: underline;
}

.toast {
  margin: 12px 24px 0;
  padding: 10px 16px;
  border-radius: 7px;
  font-size: 0.85rem;
  background: var(--bg-elevated);
  border-left: 4px solid var(--ct-steel);
  color: var(--ink-main);
}

.toast.err {
  border-left-color: var(--neg-coral);
  background: rgba(251, 113, 133, 0.12);
}

/* Main Workspace Layout */
.workspace {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 20px;
  padding: 20px 24px 48px;
  max-width: 1560px;
  margin: 0 auto;
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-line);
  border-radius: 10px;
  overflow: hidden;
}

.queue-panel {
  margin-bottom: 16px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-line);
}

.panel-head h2 {
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-sub);
}

/* Queue & Match List */
.queue-list {
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.queue-item {
  font-size: 0.78rem;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-line);
}

.queue-item code {
  font-family: var(--font-mono);
  color: var(--ct-steel);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item .q-meta {
  color: var(--ink-muted);
  margin-top: 3px;
}

.match-list {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 240px);
  overflow-y: auto;
}

.match-card {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-line);
  cursor: pointer;
  transition: background 0.12s;
}

.match-card:hover {
  background: var(--bg-hover);
}

.match-card.active {
  background: rgba(91, 164, 229, 0.13);
  border-left: 3px solid var(--ct-steel);
}

.mc-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.mc-map {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
}

.mc-score {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.9rem;
}

.mc-sub {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.77rem;
  color: var(--ink-muted);
}

.demo-tag {
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--t-dim);
  color: var(--t-brass);
  border: 1px solid rgba(224, 159, 62, 0.4);
}

/* Empty Stage */
.empty-stage {
  background: var(--bg-panel);
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  padding: 56px 32px;
  text-align: center;
  max-width: 680px;
  margin: 32px auto;
}

.empty-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--ct-steel);
  background: var(--ct-dim);
  padding: 4px 10px;
  border-radius: 4px;
  margin-bottom: 14px;
}

.empty-stage h2 {
  font-size: 1.35rem;
  margin-bottom: 10px;
}

.empty-stage p {
  color: var(--ink-sub);
  font-size: 0.92rem;
  margin-bottom: 24px;
}

.empty-cta {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Report Hero & Callouts */
.report-hero {
  background: var(--bg-panel);
  border: 1px solid var(--border-line);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 18px;
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-line);
}

.hero-map-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.hero-title-row {
  display: flex;
  align-items: baseline;
  gap: 16px;
}

.hero-map {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.hero-score {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 700;
}

.score-a {
  color: var(--ct-steel);
}

.score-b {
  color: var(--t-brass);
}

.spotlight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.spot-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-line);
  border-radius: 8px;
  padding: 12px 14px;
}

.spot-label {
  font-size: 0.74rem;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

.spot-name {
  font-weight: 700;
  font-size: 0.96rem;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spot-nums {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Signature 1: Round Swing Pulse Strip */
.pulse-section {
  background: var(--bg-panel);
  border: 1px solid var(--border-line);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 18px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 10px;
  flex-wrap: wrap;
}

.section-header h3 {
  font-size: 0.92rem;
  font-weight: 700;
}

.section-hint {
  font-size: 0.76rem;
  color: var(--ink-muted);
}

.round-strip {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.r-pip {
  flex: 1 0 34px;
  min-width: 34px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-line);
  border-radius: 6px;
  padding: 6px 4px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s;
}

.r-pip:hover,
.r-pip.selected {
  transform: translateY(-2px);
  border-color: var(--ink-main);
}

.r-pip.win-CT {
  border-top: 3px solid var(--ct-steel);
  background: rgba(91, 164, 229, 0.1);
}

.r-pip.win-T {
  border-top: 3px solid var(--t-brass);
  background: rgba(224, 159, 62, 0.1);
}

.r-pip .r-num {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-sub);
  display: block;
}

.r-pip .r-side {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.75rem;
}

.r-pip.win-CT .r-side {
  color: var(--ct-steel);
}

.r-pip.win-T .r-side {
  color: var(--t-brass);
}

.half-divider {
  width: 2px;
  background: var(--border-strong);
  margin: 0 4px;
  flex-shrink: 0;
}

.round-detail {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-line);
  font-size: 0.83rem;
}

.rd-head {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--ink-sub);
  font-family: var(--font-mono);
  font-size: 0.79rem;
}

.moment-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.moment-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Signature 2: Dual Rating Scoreboard */
.board-section {
  background: var(--bg-panel);
  border: 1px solid var(--border-line);
  border-radius: 12px;
  overflow: hidden;
}

.board-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-line);
  flex-wrap: wrap;
  gap: 10px;
}

.view-tabs {
  display: flex;
  gap: 6px;
}

.tab-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border-line);
  color: var(--ink-sub);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 0.78rem;
  cursor: pointer;
}

.tab-btn.active {
  background: var(--ct-dim);
  border-color: var(--ct-steel);
  color: var(--ink-main);
  font-weight: 600;
}

.table-scroll {
  overflow-x: auto;
}

.score-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.score-table th {
  text-align: right;
  padding: 10px 12px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--ink-muted);
  border-bottom: 1px solid var(--border-line);
  white-space: nowrap;
}

.score-table th:first-child {
  text-align: left;
  padding-left: 20px;
}

.score-table td {
  text-align: right;
  padding: 12px;
  border-bottom: 1px solid rgba(37, 51, 73, 0.65);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.score-table td:first-child {
  text-align: left;
  padding-left: 20px;
  font-family: var(--font-sans);
}

.team-divider td {
  background: rgba(27, 37, 53, 0.85);
  font-family: var(--font-display) !important;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  padding: 8px 20px !important;
  color: var(--ink-sub);
}

.player-row {
  cursor: pointer;
  transition: background 0.12s;
}

.player-row:hover {
  background: var(--bg-hover);
}

.player-row.is-focus {
  background: rgba(91, 164, 229, 0.09);
}

.p-cell-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.p-name-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.9rem;
}

.me-badge {
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--ct-steel);
  color: #07111e;
  font-weight: 700;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.p-tag {
  font-size: 0.69rem;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 500;
}

.p-tag.pos {
  background: var(--pos-bg);
  color: var(--pos-teal);
}

.p-tag.neg {
  background: var(--neg-bg);
  color: var(--neg-coral);
}

.p-tag.neutral {
  background: var(--ct-dim);
  color: var(--ct-steel);
}

/* Rating Badges */
.r30-badge {
  display: inline-block;
  min-width: 54px;
  text-align: center;
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.94rem;
}

.r30-elite {
  background: rgba(45, 212, 191, 0.18);
  color: #5eead4;
  border: 1px solid rgba(45, 212, 191, 0.45);
}

.r30-good {
  background: rgba(91, 164, 229, 0.16);
  color: #93c5fd;
  border: 1px solid rgba(91, 164, 229, 0.35);
}

.r30-mid {
  background: rgba(159, 176, 199, 0.12);
  color: var(--ink-main);
}

.r30-low {
  background: rgba(251, 113, 133, 0.15);
  color: var(--neg-coral);
  border: 1px solid rgba(251, 113, 133, 0.35);
}

.delta-pill {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.delta-pos {
  background: var(--pos-bg);
  color: var(--pos-teal);
}

.delta-neg {
  background: var(--neg-bg);
  color: var(--neg-coral);
}

.delta-flat {
  color: var(--ink-muted);
}

/* Expandable 6-Pillar Drawer */
.drawer-row td {
  background: #101722;
  padding: 16px 24px !important;
  text-align: left !important;
  font-family: var(--font-sans) !important;
}

.pillar-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.pillar-box {
  background: var(--bg-panel);
  border: 1px solid var(--border-line);
  border-radius: 7px;
  padding: 10px 12px;
}

.pillar-title {
  font-size: 0.73rem;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

.pillar-val {
  font-family: var(--font-mono);
  font-size: 1.02rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.pillar-bar {
  height: 5px;
  background: var(--bg-elevated);
  border-radius: 999px;
  overflow: hidden;
}

.pillar-fill {
  height: 100%;
  background: var(--ct-steel);
  border-radius: 999px;
}

.drawer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  font-size: 0.8rem;
  color: var(--ink-sub);
}

.drawer-meta strong {
  font-family: var(--font-mono);
  color: var(--ink-main);
}

@media (max-width: 1060px) {
  .workspace {
    grid-template-columns: 1fr;
  }
  .match-list {
    max-height: 240px;
  }
  .spotlight-grid {
    grid-template-columns: 1fr;
  }
  .pillar-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .topbar,
  .action-bar,
  .workspace {
    padding-left: 14px;
    padding-right: 14px;
  }
  .hero-map,
  .hero-score {
    font-size: 1.4rem;
  }
}
