:root {
  --bg: #f3f5f1;
  --paper: #ffffff;
  --ink: #131815;
  --muted: #657067;
  --line: #d5dbd3;
  --green: #0f7c68;
  --red: #b84a43;
  --gold: #c79734;
  --blue: #2f5f93;
  --shade: #e5ebe3;
  --panel: #17201b;
  --panel-2: #202a24;
  --panel-line: #344139;
  --cyan: #4da6b3;
  --violet: #6c5f8d;
  --cream: #f8f6ef;
  --shadow: 0 18px 55px rgba(30, 40, 34, 0.12);
  --shadow-soft: 0 8px 28px rgba(30, 40, 34, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", Arial, sans-serif;
  line-height: 1.6;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(rgba(19, 24, 21, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(19, 24, 21, 0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.78), transparent 72%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(circle at 74% 12%, rgba(77, 166, 179, 0.16), transparent 28%),
    linear-gradient(135deg, rgba(247, 244, 235, 0.96), rgba(232, 239, 236, 0.96) 48%, rgba(239, 241, 232, 0.96));
}

button,
input {
  font: inherit;
}

code {
  padding: 2px 6px;
  color: #224c43;
  background: #e7f1ed;
  border: 1px solid #c9ddd6;
  border-radius: 6px;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 0.92em;
}

.topbar {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 10;
  display: flex;
  width: 292px;
  height: calc(100vh - 28px);
  flex-direction: column;
  align-items: stretch;
  gap: 22px;
  padding: 22px;
  color: #eef5ef;
  background:
    linear-gradient(180deg, rgba(23, 32, 27, 0.98) 0%, rgba(32, 42, 36, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(18, 24, 20, 0.24);
  backdrop-filter: blur(16px);
}

.brand-block {
  display: grid;
  gap: 8px;
}

.logo-badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  color: #f2c96d;
  background: rgba(199, 151, 52, 0.12);
  border: 1px solid rgba(199, 151, 52, 0.32);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
}

.logo-badge span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: #161b18;
  background: #f2c96d;
  border-radius: 6px;
}

.logo-badge small {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.sidebar-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.sidebar-stats span {
  padding: 4px 8px;
  color: #c9d8d2;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.sidebar-footer-note {
  margin-top: auto;
  padding-top: 14px;
  color: #d8e4dc;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-footer-note span {
  display: block;
  margin-bottom: 4px;
  color: #f2c96d;
  font-size: 12px;
  font-weight: 900;
}

.sidebar-footer-note small {
  display: block;
  color: #94a29b;
  font-size: 11px;
  line-height: 1.5;
}

.progress-rail {
  position: fixed;
  top: 0;
  left: 322px;
  right: 0;
  z-index: 20;
  height: 3px;
  background: rgba(19, 24, 21, 0.09);
}

.progress-rail span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #c79734, #0f7c68, #4da6b3);
  transition: width 0.12s linear;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(23px, 3vw, 34px);
  line-height: 1.1;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(32px, 5vw, 58px);
  line-height: 1.12;
}

h3 {
  margin-bottom: 8px;
  font-size: 20px;
  line-height: 1.25;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.topbar .eyebrow {
  color: #91dccb;
}

.nav-tabs {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 8px;
  overflow: auto;
}

.tab-btn {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: flex-start;
  padding: 10px 12px;
  color: #dfe9e1;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.tab-btn::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 8px;
  background: currentColor;
  border-radius: 50%;
  opacity: 0.42;
}

.tab-btn.active,
.tab-btn:hover {
  color: #ffffff;
  background: rgba(15, 124, 104, 0.92);
  border-color: rgba(145, 220, 203, 0.45);
  box-shadow: inset 4px 0 0 #f1c76a;
}

.tab-btn.active::before {
  opacity: 1;
}

.tab-btn:hover {
  transform: translateX(2px);
}

.manual-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 26px;
  padding: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.manual-btn {
  min-height: 40px;
  padding: 8px 18px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.manual-btn.active,
.manual-btn:hover {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.manual-status {
  margin: -10px 0 24px;
  padding: 12px 16px;
  color: #264c43;
  background: #dff2ed;
  border: 1px solid #b9ded5;
  border-radius: 8px;
  font-weight: 800;
}

.atlas {
  margin: 24px 0 34px;
  padding: 24px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.atlas-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin-bottom: 18px;
}

.atlas-head h3 {
  font-size: clamp(24px, 3vw, 34px);
}

.atlas-head p:not(.eyebrow) {
  color: var(--muted);
}

.atlas-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.atlas-btn {
  min-height: 38px;
  padding: 8px 14px;
  color: var(--ink);
  background: #f8faf6;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.atlas-btn.active,
.atlas-btn:hover {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.atlas-stage {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.setup-panel {
  display: none;
  grid-template-columns: minmax(420px, 1.1fr) minmax(360px, 0.9fr);
  gap: 0;
}

.setup-panel.active {
  display: grid;
}

.setup-visual {
  min-height: 420px;
  padding: 28px;
  background: #f7f9f4;
  border-right: 1px solid var(--line);
}

.pattern-svg {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
}

.pattern-svg .axis {
  stroke: #d8ddd4;
  stroke-width: 2;
}

.pattern-svg .guide {
  stroke: #c79734;
  stroke-width: 3;
  stroke-dasharray: 7 8;
}

.pattern-svg .danger {
  stroke: #b84a43;
  stroke-width: 3;
  stroke-dasharray: 7 8;
}

.pattern-svg .zone-blue {
  fill: #8fb7e6;
  opacity: 0.35;
}

.pattern-svg .zone-gold {
  fill: #f1c76a;
  opacity: 0.38;
}

.pattern-svg .zone-green {
  fill: #72c7a8;
  opacity: 0.28;
}

.pattern-svg .note-box {
  fill: #ffffff;
  stroke: #d5dbd3;
  stroke-width: 2;
}

.pattern-svg text {
  font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", Arial, sans-serif;
}

.setup-reading {
  padding: 28px;
  background: #fff;
}

.setup-reading h4 {
  margin: 0 0 12px;
  font-size: 24px;
}

.blue-note {
  margin-bottom: 18px;
  padding: 14px 16px;
  color: #2c5b91;
  background: #d9e8fa;
  border-radius: 8px;
}

.setup-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.setup-table th,
.setup-table td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.setup-table th {
  width: 104px;
  color: #374139;
  background: #f2f0e8;
  font-weight: 800;
}

.setup-table tr:last-child th,
.setup-table tr:last-child td {
  border-bottom: 0;
}

.reversal-book {
  margin: 28px 0;
  padding: 24px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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

.reversal-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  background: #f7f9f4;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.reversal-card h4 {
  margin: 0;
  font-size: 19px;
}

.setup-table.compact th,
.setup-table.compact td {
  padding: 10px 12px;
  font-size: 14px;
}

.setup-table.compact th {
  width: 72px;
}

.mini-chart-card {
  display: grid;
  align-content: center;
  gap: 16px;
}

.mini-chart-card h4 {
  margin: 0;
  font-size: 28px;
}

.mini-chart-card p {
  max-width: 620px;
  color: var(--muted);
}

.pattern-plain {
  padding: 22px;
  color: #eaf4ee;
  background: #17201b;
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  font-size: 22px;
  font-weight: 800;
}

main {
  width: min(1500px, calc(100% - 346px));
  margin: 0 24px 0 322px;
}

.tab-panel {
  display: none;
  padding: 38px 0 72px;
}

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

.section-head {
  max-width: 940px;
  margin-bottom: 30px;
  padding: 30px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(213, 219, 211, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
}

.dashboard-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: -8px 0 30px;
}

.dashboard-strip article {
  min-height: 146px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(213, 219, 211, 0.96);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.dashboard-strip span,
.metric-grid span,
.ea-card h3 + .callout-text {
  color: var(--muted);
}

.dashboard-strip span,
.metric-grid span {
  display: block;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.dashboard-strip strong {
  display: block;
  margin-bottom: 8px;
  font-size: 22px;
  line-height: 1.15;
}

.dashboard-strip p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.section-head p:not(.eyebrow) {
  color: var(--muted);
  font-size: 18px;
}

.manual-panel {
  display: none;
}

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

.manual-hero {
  display: grid;
  grid-template-columns: minmax(320px, 0.72fr) minmax(420px, 1.28fr);
  gap: 24px;
  align-items: center;
  margin-bottom: 22px;
  padding: 26px;
  color: #eef5ef;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.manual-hero h3 {
  font-size: clamp(24px, 3vw, 34px);
}

.manual-hero p:not(.eyebrow) {
  color: #bfcbc2;
  font-size: 17px;
}

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

.manual-card,
.usage-card,
.candle-card {
  padding: 22px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.manual-card {
  border-top: 4px solid var(--gold);
}

.manual-card h4,
.usage-card h4,
.candle-card h4 {
  margin: 0 0 8px;
  font-size: 18px;
}

.manual-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.candle-compare {
  display: grid;
  grid-template-columns: minmax(420px, 1.2fr) minmax(320px, 0.8fr);
  gap: 18px;
  align-items: stretch;
  margin: 22px 0 30px;
}

.setup-detail {
  display: grid;
  grid-template-columns: minmax(460px, 1.25fr) minmax(340px, 0.75fr);
  gap: 22px;
  align-items: start;
  margin: 24px 0;
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.setup-copy {
  padding: 22px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: none;
}

.setup-copy h4 {
  margin: 0 0 10px;
  font-size: 22px;
}

.setup-copy p {
  color: var(--muted);
}

.entry-map {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 12px;
  margin: 16px 0;
  padding: 14px;
  background: #f4f7f2;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.entry-map span {
  align-self: start;
  padding: 3px 8px;
  color: #fff;
  background: var(--green);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.entry-map p {
  margin-bottom: 0;
}

.law-stack {
  margin: 0;
  padding-left: 20px;
}

.law-stack li {
  margin: 8px 0;
  color: var(--muted);
}

.candle-svg {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.candles line {
  stroke: #2e3630;
  stroke-width: 3;
}

.candles rect {
  stroke: #2e3630;
  stroke-width: 1;
}

.candles .up {
  fill: #25a887;
}

.candles .down {
  fill: #d4554e;
}

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

.flow-step {
  min-height: 188px;
  padding: 20px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.flow-step span {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  margin-bottom: 18px;
  color: #fff;
  background: var(--green);
  border-radius: 50%;
  font-weight: 800;
}

.flow-step p,
.case-card p,
.lesson-text p,
.rule-board p {
  color: var(--muted);
}

.split-band,
.lesson-layout,
.practice-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(360px, 1.1fr);
  gap: 28px;
  align-items: center;
  margin: 28px 0;
  padding: 28px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.lesson-layout {
  grid-template-columns: minmax(420px, 1.25fr) minmax(320px, 0.75fr);
  background: transparent;
  padding: 0;
  border: 0;
}

.lesson-layout.reverse {
  grid-template-columns: minmax(320px, 0.75fr) minmax(420px, 1.25fr);
}

.lesson-layout.reverse .image-frame {
  order: 2;
}

.lesson-text {
  padding: 28px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.image-frame {
  margin: 0;
  overflow: hidden;
  background: #101612;
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.image-frame img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #101612;
  cursor: zoom-in;
}

.image-frame.large img {
  aspect-ratio: 16 / 8.6;
}

.image-frame figcaption {
  padding: 12px 14px;
  color: #c8d2ca;
  font-size: 14px;
  background: #17201b;
  border-top: 1px solid var(--panel-line);
}

.rule-board {
  margin: 34px 0;
  padding: 28px;
  color: #fff;
  background: linear-gradient(135deg, #17201b 0%, #253128 100%);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.rule-board p {
  margin-bottom: 0;
  color: #e8eee7;
  font-size: 19px;
}

.clean-list,
.steps {
  padding-left: 22px;
  margin: 0;
}

.clean-list li,
.steps li {
  margin: 10px 0;
}

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

.performance-hero {
  display: grid;
  grid-template-columns: minmax(360px, 0.82fr) minmax(520px, 1.18fr);
  gap: 18px;
  align-items: stretch;
  margin: 0 0 22px;
}

.performance-copy,
.ea-card,
.result-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.performance-copy {
  padding: 28px;
  color: #eef5ef;
  background: linear-gradient(135deg, #17201b 0%, #263128 72%, #30403b 100%);
  border-color: var(--panel-line);
}

.performance-copy h3 {
  font-size: clamp(26px, 3vw, 40px);
}

.performance-copy p:not(.eyebrow) {
  color: #c9d5cd;
}

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

.metric-grid article {
  padding: 22px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.metric-grid strong {
  display: block;
  margin-bottom: 6px;
  color: var(--green);
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1;
}

.metric-grid small {
  color: var(--muted);
}

.ea-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 22px 0;
}

.ea-card {
  padding: 22px;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
}

.data-table th,
.data-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.data-table th {
  color: #344139;
  background: var(--cream);
  font-weight: 900;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.positive {
  color: var(--green);
  font-weight: 900;
}

.callout-text {
  margin-bottom: 18px;
  padding: 14px 16px;
  background: #f5f7f1;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.direction-bars {
  display: grid;
  gap: 14px;
}

.direction-bars div {
  display: grid;
  grid-template-columns: 90px 82px 1fr;
  gap: 12px;
  align-items: center;
}

.direction-bars span {
  color: var(--muted);
  font-weight: 800;
}

.direction-bars strong {
  color: var(--ink);
}

.direction-bars i {
  display: block;
  width: var(--w);
  height: 12px;
  background: linear-gradient(90deg, var(--green), var(--cyan));
  border-radius: 999px;
}

.direction-bars .negative-bar {
  background: linear-gradient(90deg, var(--red), #d78b72);
}

.compact-steps {
  margin: 0;
  padding-left: 20px;
}

.compact-steps li {
  margin: 10px 0;
  color: var(--muted);
}

.result-panel {
  display: grid;
  grid-template-columns: minmax(520px, 1.25fr) minmax(320px, 0.75fr);
  gap: 20px;
  align-items: center;
  padding: 22px;
}

.case-viewer {
  display: grid;
  grid-template-columns: minmax(520px, 1.2fr) minmax(320px, 0.8fr);
  gap: 22px;
  align-items: stretch;
  margin-top: 28px;
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.case-stage .image-frame img {
  aspect-ratio: 16 / 9;
}

.case-notes {
  padding: 22px;
  color: #edf6ef;
  background: var(--panel-2);
  border: 1px solid var(--panel-line);
  border-radius: 8px;
}

.case-notes h4 {
  margin: 0 0 12px;
  font-size: 24px;
}

.case-notes p:not(.eyebrow) {
  color: #c8d2ca;
}

.case-controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
}

.case-controls button {
  min-height: 42px;
  color: #fff;
  background: var(--green);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  cursor: pointer;
}

.case-controls button:hover {
  background: #11957d;
}

.case-counter {
  color: #f1c76a;
  font-weight: 800;
  white-space: nowrap;
}

.case-card {
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.case-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #101612;
  cursor: zoom-in;
}

.case-card div {
  padding: 16px;
}

.case-card p {
  margin-bottom: 0;
}

.practice-layout {
  grid-template-columns: minmax(420px, 1fr) minmax(280px, 0.55fr);
}

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

.checklist label {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.checklist input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.score-panel {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.score-ring {
  display: grid;
  width: 150px;
  height: 150px;
  place-items: center;
  background: conic-gradient(var(--green) var(--progress, 0%), #e2e6df 0);
  border-radius: 50%;
}

.score-ring span {
  display: grid;
  width: 104px;
  height: 104px;
  place-items: center;
  background: #fff;
  border-radius: 50%;
  font-size: 28px;
  font-weight: 800;
}

#scoreText {
  margin-bottom: 0;
  color: var(--muted);
}

#imageDialog {
  width: min(1180px, calc(100vw - 28px));
  padding: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.3);
}

#imageDialog::backdrop {
  background: rgba(18, 23, 20, 0.75);
}

#imageDialog img {
  display: block;
  width: 100%;
  max-height: 78vh;
  object-fit: contain;
  background: #f8f9f6;
}

#imageDialog p {
  margin: 0;
  padding: 14px 18px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.close-dialog {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: #fff;
  background: rgba(24, 32, 27, 0.82);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

@media (max-width: 1120px) {
  .topbar {
    position: sticky;
    top: 0;
    left: auto;
    width: 100%;
    height: auto;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    border-radius: 0;
  }

  .progress-rail {
    left: 0;
  }

  main {
    width: min(1380px, calc(100% - 32px));
    margin: 0 auto;
  }

  .topbar,
  .flow-grid,
  .split-band,
  .lesson-layout,
  .lesson-layout.reverse,
  .practice-layout,
  .performance-hero,
  .result-panel,
  .manual-hero,
  .manual-grid,
  .candle-compare,
  .setup-detail,
  .setup-panel,
  .reversal-grid {
    grid-template-columns: 1fr;
  }

  .setup-visual {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-tabs {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .tab-btn {
    justify-content: center;
  }

  .lesson-layout.reverse .image-frame {
    order: 0;
  }

  .case-grid,
  .gallery,
  .case-viewer,
  .dashboard-strip,
  .ea-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  main {
    width: min(100% - 20px, 1380px);
    margin: 0 auto;
  }

  .topbar {
    padding: 14px 12px;
  }

  .sidebar-footer-note {
    display: none;
  }

  .nav-tabs {
    gap: 6px;
  }

  .tab-btn {
    flex: 1 1 30%;
    min-width: 92px;
    padding: 8px 10px;
  }

  .flow-step,
  .split-band,
  .lesson-text,
  .rule-board,
  .practice-layout {
    padding: 18px;
  }

  .case-grid,
  .gallery,
  .case-viewer,
  .checklist,
  .dashboard-strip,
  .metric-grid,
  .ea-grid,
  .performance-hero,
  .result-panel {
    grid-template-columns: 1fr;
  }

  .dashboard-strip article {
    min-height: auto;
  }

  .direction-bars div {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .direction-bars i {
    width: min(var(--w), 100%);
  }

  .data-table {
    font-size: 14px;
  }

  .data-table th,
  .data-table td {
    padding: 10px;
  }
}
