:root {
  color-scheme: dark;
  --base: #0a111b;
  --panel: #101925;
  --border: #3b4e61;
  --text: #eaf0f8;
  --muted: #a4b3c5;
  --up: #ff8290;
  --down: #58d7af;
  --blue: #176be4;
  font-family: "Segoe UI", "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--base); color: var(--text); }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 2px solid #9ecbff; outline-offset: 3px; }
button:disabled { cursor: default; opacity: .55; }
h1, h2, p, dl, dd { margin: 0; }
dd, strong, .round h2 { font-variant-numeric: tabular-nums; }

.masthead { border-bottom: 1px solid var(--border); }
.head-content, main { width: min(100% - 72px, 1540px); margin-inline: auto; }
.head-content { min-height: 69px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-inline: 12px; }
h1 { display: flex; align-items: center; gap: 18px; font-size: 28px; font-weight: 700; letter-spacing: .035em; white-space: nowrap; }
.mark { display: inline-flex; align-items: flex-end; justify-content: center; gap: 3px; width: 42px; height: 42px; padding-bottom: 11px; border-radius: 10px; background: #175dd5; }
.mark i { width: 6px; height: 10px; border-radius: 1px 1px 0 0; background: #f4f8ff; }
.mark i:nth-child(2) { height: 15px; }
.mark i:nth-child(3) { height: 22px; }
.stats { display: flex; white-space: nowrap; color: var(--muted); font-size: 20px; }
.stats > div { display: flex; align-items: baseline; justify-content: center; gap: 8px; padding-inline: 30px; border-left: 1px solid var(--border); }
.stats > div:first-child { border-left: 0; }
.stats > div:last-child { padding-right: 0; min-width: 124px; justify-content: flex-end; }
.stats dd { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }

main { padding-block: 28px 35px; }
.round { display: flex; align-items: center; gap: 26px; min-height: 57px; margin: 0 12px 16px; }
.round h2 { font-size: clamp(26px, 3vw, 38px); white-space: nowrap; }
.round p { padding: 5px 0 5px 26px; border-left: 1px solid var(--border); color: var(--muted); font-size: clamp(16px, 2vw, 24px); }
.workspace { display: grid; grid-template-columns: minmax(0, 2.72fr) minmax(280px, 1fr); gap: 20px; }
.chart-panel, .answer-panel { min-width: 0; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); }
.chart-panel { overflow: hidden; }
.toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px 16px; padding: 15px 16px 15px 24px; min-height: 69px; border-bottom: 1px solid var(--border); }
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tools-label { margin-right: 12px; font-size: 19px; }
.toggle { padding: 7px 15px; min-height: 36px; border: 1px solid var(--border); border-radius: 6px; background: #182330; color: #e1eaf6; font-size: 16px; line-height: 1.1; }
.toggle:hover { background: #223448; }
.toggle[aria-pressed="true"] { background: var(--blue); border-color: #5293f5; color: white; }
.toggle[data-ma][aria-pressed="true"] { box-shadow: inset 0 -2px 0 var(--ma); }
[data-ma="5"] { --ma: #f5c65f; }
[data-ma="10"] { --ma: #4bcfff; }
[data-ma="20"] { --ma: #c689f8; }
[data-ma="30"] { --ma: #ed9f71; }
[data-ma="60"] { --ma: #91dabb; }
.chart-area { position: relative; height: clamp(470px, 67vh, 700px); }
#chart { display: block; width: 100%; height: 100%; touch-action: pan-y; }
.chart-message { position: absolute; inset: 0; display: grid; place-content: center; margin: 0; color: var(--muted); pointer-events: none; }

.answer-panel { padding: 19px 22px 24px; }
.answer-panel h2 { font-size: clamp(22px, 2vw, 29px); line-height: 1.27; }
.sub, .scoring, .swipe-tip { color: var(--muted); line-height: 1.55; }
.answer-panel .sub { margin-top: 12px; font-size: 19px; }
.choices { display: grid; gap: 22px; margin-top: 26px; }
.choice { position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 76px; padding: 12px 54px 12px 40px; border: 1px solid; border-radius: 8px; font-size: clamp(24px, 2.15vw, 32px); line-height: 1.2; font-weight: 700; color: #fff; transition: background-color 120ms, border-color 120ms; }
.choice.up { background: #853b43; border-color: #d15d68; }
.choice.down { background: #126353; border-color: #258e77; }
.choice.up:not(:disabled):hover { background: #9a454f; }
.choice.down:not(:disabled):hover { background: #177461; }
.choice kbd { position: absolute; right: 0; width: 60px; text-align: center; padding-block: 8px; border-left: 1px solid #ffffff70; font-weight: 600; font-family: inherit; font-size: .68em; }
.scoring { margin-top: 23px; font-size: 19px; }
.swipe-tip { display: none; margin-top: 4px; font-size: 14px; }
.history { margin-top: 31px; padding-top: 20px; border-top: 1px solid var(--border); }
.history h2 { font-size: 22px; }
.history ol { list-style: none; padding: 0; margin: 12px 0 0; }
.history li { display: grid; grid-template-columns: minmax(0, 1fr) max-content max-content; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid #2a3a4b; }
.history li > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history .change { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.positive { color: var(--up); }
.negative { color: var(--down); }
.verdict { margin: 0 0 12px; font-size: 16px; font-weight: 650; }
.stock-code { font-variant-numeric: tabular-nums; }
.outcome { margin-top: 18px; padding: 14px 0; display: grid; gap: 5px; border-block: 1px solid var(--border); color: var(--muted); font-size: 15px; }
.outcome strong { font-size: 36px; line-height: 1.2; }
.answer-panel .dates { font-size: 14px; font-variant-numeric: tabular-nums; }
.error { margin-top: 16px; color: #ffbdc5; }
.error p { margin-bottom: 10px; line-height: 1.5; }

@media (pointer: coarse) { .swipe-tip { display: block; } }

@media (max-width: 1200px) {
  .toolbar { padding-inline: 13px; }
  .toggle { padding-inline: 11px; }
  .tools { gap: 6px; }
  .tools-label { margin-right: 5px; }
  .stats > div { padding-inline: 15px; }
  .workspace { gap: 14px; }
  .answer-panel { padding-inline: 17px; }
}

@media (max-width: 825px) {
  .head-content, main { width: calc(100% - 28px); }
  .head-content { padding-inline: 0; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .chart-area { height: clamp(390px, 59vh, 530px); }
  main { padding-top: 17px; }
  .round { margin-inline: 0; }
  .answer-panel { padding: 14px; }
  .choices { grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
  .choice { min-height: 50px; font-size: 22px; }
  .scoring, .answer-panel .sub { margin-top: 8px; font-size: 15px; }
  .history { margin-top: 16px; padding-top: 14px; }
  .history h2 { font-size: 18px; }
}

@media (max-width: 480px) {
  .head-content { flex-wrap: wrap; gap: 10px; padding-block: 10px; }
  h1 { width: 100%; font-size: 21px; gap: 10px; }
  .mark { width: 30px; height: 30px; padding-bottom: 5px; border-radius: 6px; }
  .mark i { width: 4px; }
  .mark i:nth-child(3) { height: 18px; }
  .stats { font-size: 14px; }
  .stats > div { padding-inline: 12px; }
  .stats > div:first-child { padding-left: 0; }
  .stats > div:last-child { min-width: auto; }
  .round { min-height: auto; gap: 10px; margin-bottom: 12px; }
  .round h2 { font-size: 23px; }
  .round p { padding-left: 10px; font-size: 14px; }
  .tools-label, .toggle { font-size: 14px; }
  .toolbar { padding: 8px 10px; min-height: 0; gap: 7px; }
  .tools { gap: 5px; }
  .toggle { min-height: 31px; padding-inline: 8px; }
  .chart-area { height: clamp(300px, 39vh, 350px); }
  .choice { padding-inline: 10px; }
  .choice kbd { display: none; }
}

@media (prefers-reduced-motion: reduce) { .choice { transition: none; } }

.training-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 20px; margin: 0 12px 12px; }
.training-modes { display: flex; flex-wrap: wrap; gap: 7px; }
.training-horizons { display: inline-flex; align-items: center; gap: 6px; }
.main-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.main-switch input { width: 18px; height: 18px; accent-color: var(--blue); }
#bank-size { font-size: 14px; }
.choices { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 21px; }
.choice { min-height: 65px; padding: 6px 4px; display: grid; grid-template-columns: 1fr; place-items: center; gap: 2px; font-size: 20px; }
.choice > span { display: none; }
.choice kbd { display: block; position: static; padding: 0; width: auto; border: 0; }
.choice.skip { background: #233244; border-color: #51637a; }
.choice.skip:not(:disabled):hover { background: #31465d; }
.advance { margin-top: 11px; width: 100%; }
.wrong-panel { margin-top: 18px; padding-top: 15px; border-top: 1px solid var(--border); }
.wrong-panel summary { cursor: pointer; font-size: 17px; }
.wrong-panel ul { list-style: none; margin: 10px 0; padding: 0; }
.wrong-panel li + li { margin-top: 6px; }
.wrong-panel li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.wrong-link { min-width: 0; overflow-wrap: anywhere; text-align: left; font-size: 14px; }
#review, #pair-review { width: min(1090px,96vw); max-height: 94vh; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); color: var(--text); padding: 14px; }
#review::backdrop, #pair-review::backdrop { background: #060b13ba; }
.review-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 9px; }
.review-head h2 { font-size: 22px; }
#review-chart { display: block; width: 100%; height: min(66vh,570px); }
#practice-done button { margin-top: 10px; }
.practice-tip { display: flex; align-items: center; justify-content: space-between; gap: 6px 10px; flex-wrap: wrap; margin: 10px 0; }
.pair-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.pair-charts section { min-width: 0; }
.pair-charts canvas { display: block; width: 100%; height: min(57vh,470px); }
@media (max-width: 660px) {
  .pair-charts { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 825px) {
  .training-controls { margin-inline: 0; gap: 7px 12px; }
  .choices { margin-top: 12px; }
  .choice { min-height: 52px; }
}
@media (max-width: 480px) {
  .training-modes { width: 100%; }
  .chart-panel .tools { gap: 4px; }
  .chart-panel .toggle { font-size: 12px; padding-inline: 6px; }
  .chart-panel .tools-label { font-size: 12px; margin-right: 3px; }
  .training-modes .toggle { font-size: 13px; padding-inline: 7px; }
  .main-switch { font-size: 14px; }
  .choice { font-size: 17px; }
  .advance { min-height: 36px; }
}

#score-scope { display: inline-block; margin-left: 12px; font-size: .58em; color: #95b9e6; }
.score-breakdown { margin: 0 12px 15px; color: var(--muted); }
.score-breakdown summary { width: fit-content; cursor: pointer; color: #bfd5f4; font-size: 15px; }
.score-table-wrap { margin-top: 9px; overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
.score-table { width: 100%; min-width: 985px; border-collapse: collapse; background: var(--panel); color: var(--text); font-size: 14px; }
.score-table caption { caption-side: bottom; text-align: left; padding: 8px 12px; color: var(--muted); }
.score-table th, .score-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #2a3a4b; }
.score-table td { white-space: nowrap; }
.score-table td span { display: block; line-height: 1.45; }
.score-table td span + span { font-size: 12px; color: var(--muted); }
.score-breakdown > p { margin: 8px 0; font-size: 14px; }
#advanced-note { font-size: 14px; }
@media (max-width: 825px) {
  .score-breakdown { margin-inline: 0; }
}
@media (max-width: 480px) {
  #score-scope { display: block; font-size: .8em; margin: 2px 0 0; }
  .stats > div { padding-inline: 8px; }
}


.history ol { max-height: 350px; overflow: auto; padding-right: 5px; }
.history .history-detail { grid-column: 1 / -1; font-size: 12px; }
.live-feedback { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: 6px 10px; margin-top: 14px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 7px; background: #122237; }
.live-feedback p { color: var(--muted); font-size: 13px; }
.live-feedback strong { font-size: 26px; }
.live-feedback + .scoring { margin-top: 12px; }

.simulation-notice { margin: 0 12px 12px; color: #ffd478; font-size: 14px; font-weight: 600; }
