:root {
  --bg: #f4f6f2;
  --surface: #ffffff;
  --surface-soft: #f8faf7;
  --ink: #18211d;
  --muted: #66726c;
  --line: #dfe5dc;
  --line-strong: #cbd6cf;
  --rail: #12211c;
  --rail-active: #253e35;
  --green: #2f7c59;
  --teal: #0f6f78;
  --gold: #b88624;
  --danger-bg: #fff8e8;
  --chip: #eef4ef;
  --shadow: 0 14px 32px rgba(24, 33, 29, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--ink);
  background:
    radial-gradient(circle at 72% 12%, rgba(15, 111, 120, 0.08), transparent 34%),
    var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(184, 134, 36, 0.45);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  background: var(--rail);
  color: #fff;
  padding: 24px 18px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 26px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e8f2e7;
  color: var(--rail);
  font-size: 23px;
  font-weight: 800;
}

.brand h1 {
  margin: 0 0 3px;
  font-size: 19px;
  line-height: 1.15;
}

.brand p {
  margin: 0;
  color: #b6c5bf;
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 12px 14px;
  text-align: left;
  color: #e0e9e4;
  background: transparent;
  cursor: pointer;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.07);
}

.nav-item.active {
  background: var(--rail-active);
  border-color: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.content {
  min-width: 0;
  padding: 28px 32px 40px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 5px;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}

h2,
h3 {
  margin: 0;
  line-height: 1.2;
}

h2 {
  font-size: 30px;
}

h3 {
  font-size: 19px;
}

#app {
  min-width: 0;
}

.loading-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 22px;
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.loading-panel strong {
  color: var(--ink);
  font-size: 18px;
}

.external-note {
  margin: 16px 2px 0;
  color: var(--muted);
  font-size: 13px;
}

.external-note.inline-note {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.external-note a {
  color: var(--teal);
  text-decoration: none;
}

.external-note a:hover {
  text-decoration: underline;
}

.search {
  width: min(420px, 44vw);
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.search input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
}

.search input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(15, 111, 120, 0.12);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
}

.metric strong {
  display: block;
  margin-bottom: 8px;
  font-size: 31px;
  line-height: 1;
}

.metric span {
  display: block;
  color: var(--ink);
}

.metric small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.panel {
  padding: 18px;
}

.overview-grid,
.champion-grid,
.data-grid,
.search-grid {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.overview-grid {
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.9fr);
}

.champion-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.search-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  align-items: start;
}

.search-grid .compact-panel {
  grid-column: 1 / -1;
}

.data-grid {
  grid-template-columns: minmax(320px, 0.8fr) minmax(0, 1.2fr);
}

.split-view {
  display: grid;
  grid-template-columns: minmax(300px, 0.78fr) minmax(520px, 1.35fr);
  gap: 16px;
  align-items: start;
}

.detail-only {
  max-width: 1040px;
}

.scroll-panel {
  max-height: calc(100vh - 132px);
  overflow: auto;
}

.detail-only.scroll-panel {
  max-height: none;
  overflow: visible;
}

.feature-panel {
  min-height: 238px;
}

.feature-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  margin-top: 6px;
}

.feature-head p,
.detail-header p,
.compact-text {
  color: var(--muted);
}

.feature-head p {
  margin: 7px 0 0;
}

.compact-text {
  max-width: 820px;
  margin: 16px 0 0;
  line-height: 1.65;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 15px;
}

.detail-header h3 {
  font-size: 24px;
}

.detail-header p {
  margin: 7px 0 0;
}

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

.section-title:not(:first-child),
.result-heading {
  margin-top: 20px;
}

.section-title span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.summary-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 0;
}

.search-summary {
  margin: 0 0 16px;
}

.summary-pill,
.chip {
  border: 1px solid var(--line);
  background: var(--chip);
  color: var(--ink);
}

.summary-pill {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 7px 11px;
}

.summary-pill small {
  color: var(--muted);
  font-size: 12px;
}

.summary-pill strong {
  font-size: 14px;
}

.summary-pill .link-button {
  font-weight: 800;
}

.primary-button,
.back-button {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  cursor: pointer;
}

.primary-button {
  flex: 0 0 auto;
  background: var(--green);
  color: #fff;
  padding: 10px 14px;
  font-weight: 700;
}

.primary-button:hover {
  background: #266a4c;
}

.back-button {
  width: fit-content;
  margin: 0 0 16px;
  background: #fff;
  color: var(--teal);
  padding: 8px 12px;
}

.back-button:hover {
  border-color: var(--teal);
}

.segmented {
  display: inline-flex;
  gap: 4px;
  max-width: 100%;
  margin-top: 16px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
}

.segmented.sub-tabs {
  display: flex;
  overflow-x: auto;
  margin-top: 14px;
}

.segmented button {
  flex: 0 0 auto;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  padding: 8px 13px;
  cursor: pointer;
}

.segmented button.active {
  background: var(--green);
  color: #fff;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.toolbar.mini-links {
  margin-top: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  white-space: nowrap;
}

.chip-button {
  color: var(--teal);
  cursor: pointer;
}

.chip-button:hover {
  border-color: var(--teal);
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--teal);
  padding: 0;
  cursor: pointer;
  text-align: left;
  font-weight: 700;
}

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

.list,
.record-list,
.rank-list {
  display: grid;
  gap: 10px;
}

.list.relaxed {
  gap: 12px;
}

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

.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.member-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

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

.item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 13px;
}

.item-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.item-button:hover,
.item-button.active {
  border-color: var(--teal);
}

.item-button.active {
  box-shadow: inset 4px 0 0 var(--teal);
}

.item-main {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.item-main strong,
.item-title strong {
  font-size: 16px;
}

.item-main span,
.muted {
  color: var(--muted);
}

.small {
  font-size: 13px;
}

.item-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.record {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 11px 12px;
}

.record > div {
  min-width: 0;
  flex: 1 1 auto;
}

.record strong {
  font-size: 15px;
}

.record > span:not(.rank) {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.champion-record {
  align-items: flex-start;
}

.rank {
  flex: 0 0 auto;
  min-width: 46px;
  text-align: center;
  border-radius: 7px;
  padding: 6px 8px;
  background: #f4efe1;
  color: var(--gold);
  font-weight: 800;
  font-size: 13px;
}

.rank.top {
  background: #e8f3ed;
  color: var(--green);
}

.rank-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}

.rank-row:last-child {
  border-bottom: 0;
}

.rank-row span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.context-box {
  border: 1px solid #cfe1d4;
  border-radius: 8px;
  background: #f8fbf8;
  padding: 14px;
  margin: 16px 0 20px;
}

.notice {
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  background: var(--danger-bg);
  padding: 12px 14px;
  line-height: 1.55;
}

.quiet-note {
  margin-top: 10px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 12px 14px;
  line-height: 1.65;
}

.quiet-note .link-button {
  font-weight: 700;
}

.empty {
  padding: 22px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 1100px) {
  .overview-grid,
  .champion-grid,
  .data-grid,
  .search-grid,
  .split-view {
    grid-template-columns: 1fr;
  }

  .scroll-panel {
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 980px) {
  body {
    background: var(--bg);
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: sticky;
    z-index: 10;
    height: auto;
    padding: 12px;
  }

  .brand {
    margin-bottom: 10px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    font-size: 20px;
  }

  .brand h1 {
    font-size: 17px;
  }

  .brand p {
    display: none;
  }

  .nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav-item {
    flex: 0 0 auto;
    width: auto;
    padding: 9px 13px;
    text-align: center;
  }

  .content {
    padding: 14px;
  }

  .topbar {
    display: grid;
    gap: 12px;
    margin-bottom: 14px;
  }

  .search {
    width: 100%;
  }

  h2 {
    font-size: 26px;
  }

  .detail-header {
    display: block;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .panel,
  .metric {
    padding: 14px;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .feature-head {
    display: grid;
  }
}

@media (max-width: 520px) {
  .content {
    padding: 12px;
  }

  .metric strong {
    font-size: 26px;
  }

  .item-button,
  .record,
  .item-title {
    align-items: stretch;
  }

  .item-button,
  .record {
    display: grid;
  }

  .record > span:not(.rank) {
    text-align: left;
  }

  .item-button > .chip {
    width: fit-content;
    justify-self: start;
  }

  .rank-row {
    align-items: start;
  }

  .chip {
    white-space: normal;
  }
}
