:root {
  color-scheme: dark;
  --bg: #111318;
  --panel: #1b2028;
  --panel-2: #222936;
  --ink: #f4f0e8;
  --muted: #aab1bd;
  --line: #343d4d;
  --gold: #f1b84b;
  --teal: #2ec4b6;
  --red: #ef6f6c;
  --blue: #6aa8ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 20% 10%, #263449 0, #111318 36rem);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--gold);
  color: #20180b;
  cursor: pointer;
  font-weight: 700;
  min-height: 42px;
  padding: 0 16px;
}

button:hover {
  filter: brightness(1.06);
}

button.secondary {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.arena {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.rank-panel,
.duel {
  background: rgba(27, 32, 40, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.rank-panel {
  min-height: calc(100vh - 56px);
  padding: 18px;
  position: sticky;
  top: 28px;
}

.arena-art {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #151a22;
}

.eyebrow {
  margin: 16px 0 4px;
  color: var(--teal);
  font-size: 13px;
  letter-spacing: 0;
}

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

h1 {
  margin-bottom: 16px;
  font-size: 34px;
  line-height: 1.1;
}

.rank-badge {
  display: grid;
  place-items: center;
  width: 128px;
  height: 128px;
  margin: 18px auto;
  border-radius: 50%;
  border: 3px solid var(--gold);
  background: linear-gradient(145deg, #50381a, #151a22 55%, #2b3547);
  color: var(--gold);
  font-size: 24px;
  font-weight: 800;
}

.stars {
  display: flex;
  justify-content: center;
  gap: 8px;
  min-height: 28px;
}

.star {
  width: 18px;
  height: 18px;
  clip-path: polygon(50% 0, 61% 34%, 98% 35%, 68% 56%, 79% 91%, 50% 70%, 21% 91%, 32% 56%, 2% 35%, 39% 34%);
  background: #4b5362;
}

.star.filled {
  background: var(--gold);
}

.meter {
  height: 10px;
  overflow: hidden;
  margin: 18px 0;
  border-radius: 999px;
  background: #10141b;
  border: 1px solid var(--line);
}

.meter span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--teal), var(--gold));
}

.stats {
  display: grid;
  gap: 10px;
  color: var(--muted);
}

.stats span {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.stats b {
  color: var(--ink);
}

.duel {
  min-height: calc(100vh - 56px);
  padding: 18px;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.tab {
  min-width: 82px;
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

.tab.active {
  background: var(--panel-2);
  color: var(--ink);
  border-color: var(--gold);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.question-head,
.list-head,
.bank-tools,
.actions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.question-head {
  color: var(--muted);
  margin-bottom: 12px;
}

#questionStem {
  font-size: 24px;
  line-height: 1.45;
  margin-bottom: 18px;
}

.options {
  display: grid;
  gap: 10px;
}

.option {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 54px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #161b23;
  color: var(--ink);
  text-align: left;
}

.option strong {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--gold);
}

.option.correct {
  border-color: var(--teal);
}

.option.wrong {
  border-color: var(--red);
}

.fill-row {
  display: none;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.fill-row.active {
  display: grid;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #11161e;
  color: var(--ink);
  padding: 0 12px;
}

.recite-actions {
  display: none;
  gap: 10px;
  flex-wrap: wrap;
}

.recite-actions.active {
  display: flex;
}

.result {
  min-height: 26px;
  margin: 16px 0 8px;
  color: var(--muted);
  font-weight: 700;
}

.result.good {
  color: var(--teal);
}

.result.bad {
  color: var(--red);
}

.answer-panel {
  display: none;
  margin: 12px 0 18px;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #131820;
}

.answer-panel.active {
  display: block;
}

.label {
  color: var(--gold);
  font-size: 13px;
  margin-bottom: 8px;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
  font-family: inherit;
  line-height: 1.6;
}

.knowledge {
  margin: 12px 0 0;
  color: var(--muted);
}

.question-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.q-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #151a22;
  padding: 12px;
}

.q-item header {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  color: var(--muted);
  margin-bottom: 8px;
}

.q-item p {
  margin-bottom: 8px;
  line-height: 1.5;
}

.q-item .answer {
  color: var(--teal);
}

.bank-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
}

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

  .rank-panel {
    position: static;
    min-height: auto;
  }

  .arena-art {
    max-height: 220px;
  }

  .duel {
    min-height: auto;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding: 10px 0;
  }

  .rank-panel,
  .duel {
    padding: 12px;
  }

  #questionStem {
    font-size: 20px;
  }

  .fill-row,
  .bank-tools {
    grid-template-columns: 1fr;
  }

  .actions,
  .list-head {
    align-items: stretch;
    flex-direction: column;
  }
}
