:root {
  color-scheme: light;
  --ink: #101418;
  --muted: #63707a;
  --paper: #f7f8f5;
  --line: #d9ded9;
  --panel: #ffffff;
  --accent: #c83f31;
  --accent-soft: #ffe8e3;
  --teal: #0d7f78;
  --teal-soft: #e0f4f1;
  --gold: #a36b00;
  --gold-soft: #fff0ca;
  --shadow: 0 12px 30px rgba(16, 20, 24, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    "Noto Sans CJK SC",
    system-ui,
    sans-serif;
}

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(16px, 4vw, 40px);
  background: #101418;
  color: white;
  border-bottom: 4px solid var(--accent);
}

.eyebrow {
  margin: 0 0 4px;
  color: inherit;
  opacity: 0.66;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(24px, 4vw, 38px);
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(25px, 4vw, 44px);
  letter-spacing: 0;
}

h3 {
  margin-bottom: 10px;
  font-size: 16px;
  letter-spacing: 0;
}

.top-actions {
  display: flex;
  gap: 10px;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: white;
  cursor: pointer;
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  min-height: calc(100vh - 86px);
  min-width: 0;
}

.match-panel {
  border-right: 1px solid var(--line);
  background: #eef1ec;
  padding: 16px;
  min-width: 0;
  overflow: hidden;
}

.search-row input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: white;
  color: var(--ink);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 12px 0;
}

.tab {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  cursor: pointer;
}

.tab.active {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.match-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 196px);
  overflow: auto;
  padding-right: 2px;
  width: 100%;
}

.match-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 12px;
  cursor: pointer;
}

.match-item.active {
  border-color: var(--accent);
  box-shadow: inset 4px 0 0 var(--accent);
}

.match-item strong {
  display: block;
  margin-bottom: 6px;
  font-size: 15px;
}

.match-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.analysis-panel {
  padding: clamp(18px, 4vw, 42px);
  min-width: 0;
  overflow: hidden;
}

.match-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.confidence {
  flex: 0 0 auto;
  min-width: 92px;
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--teal-soft);
  color: var(--teal);
  font-weight: 800;
  text-align: center;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.score-card {
  min-height: 132px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
  box-shadow: var(--shadow);
}

.score-card.primary {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.score-card b {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.score-card strong {
  display: block;
  font-size: clamp(23px, 3vw, 34px);
  margin-bottom: 8px;
  white-space: nowrap;
}

.score-card span {
  color: var(--muted);
  font-size: 13px;
}

.section-band {
  margin: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
}

.band-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.band-title span {
  border-radius: 8px;
  padding: 7px 10px;
  background: var(--gold-soft);
  color: var(--gold);
  font-weight: 800;
}

#verdictText {
  max-width: 980px;
  margin-bottom: 0;
  color: #2f373d;
  line-height: 1.7;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.detail-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
}

dl {
  margin: 0;
}

dt {
  color: var(--muted);
  font-size: 12px;
}

dd {
  margin: 0 0 10px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.review-strip {
  margin-top: 18px;
  border-radius: 8px;
  background: #101418;
  color: white;
  padding: 16px;
}

.review-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.stat {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 12px;
}

.stat strong {
  display: block;
  font-size: 24px;
}

.stat span {
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
}

#shareCanvas {
  width: min(100%, 360px);
  height: auto;
  margin-top: 18px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: white;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(80px);
  border-radius: 8px;
  background: var(--ink);
  color: white;
  padding: 10px 14px;
  opacity: 0;
  transition: 0.2s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .match-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .match-list {
    display: flex;
    overflow-x: auto;
    max-height: none;
    padding-bottom: 4px;
  }

  .match-item {
    flex: 0 0 min(270px, 78vw);
  }

  .score-grid,
  .detail-grid,
  .review-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .topbar,
  .match-head,
  .band-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .score-grid,
  .detail-grid,
  .review-stats {
    grid-template-columns: 1fr;
  }

  .tabs {
    grid-template-columns: repeat(2, 1fr);
  }
}
