:root {
  --ink: #171717;
  --muted: #5f6672;
  --pale: #f7f4ef;
  --blue: #2364aa;
  --blue2: #dceBff;
  --red: #b8333a;
  --red2: #f4d7da;
  --green: #2f8f5b;
  --green2: #dbf1e3;
  --gold: #c58a2a;
  --gold2: #f7e5c9;
  --purple: #6d4aa2;
  --purple2: #e8dcf6;
  --rule: #d5d0c6;
  --white: #ffffff;
  --sidebar-w: 240px;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(23, 23, 23, 0.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: "PingFang SC", "Songti SC", "Times New Roman", Georgia, serif;
  background: var(--pale);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
}

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

.sidebar {
  width: var(--sidebar-w);
  background: var(--white);
  border-right: 1px solid var(--rule);
  padding: 24px 16px;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.3s;
}

.sidebar-brand {
  padding: 0 8px 20px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 16px;
}

.sidebar-brand h1 { font-size: 18px; font-weight: 700; color: var(--red); line-height: 1.3; }
.sidebar-brand p { font-size: 12px; color: var(--muted); margin-top: 4px; }

.nav-list { list-style: none; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  cursor: pointer; font-size: 14px; color: var(--muted);
  transition: all 0.15s; margin-bottom: 2px;
}

.nav-item:hover { background: var(--pale); color: var(--ink); }
.nav-item.active { background: var(--blue2); color: var(--blue); font-weight: 600; }
.nav-icon { width: 20px; text-align: center; font-size: 16px; }

.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 32px 40px 60px;
  max-width: 1100px;
}

.mobile-toggle {
  display: none;
  position: fixed; top: 16px; left: 16px; z-index: 200;
  background: var(--white); border: 1px solid var(--rule);
  border-radius: 8px; padding: 8px 12px; cursor: pointer; font-size: 18px;
}

.section { display: none; animation: fadeIn 0.3s ease; }
.section.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-header { margin-bottom: 28px; }
.section-header h2 { font-size: 28px; font-weight: 700; margin-bottom: 6px; }
.section-header p { color: var(--muted); font-size: 15px; }

.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  border: 1px solid var(--rule);
}

.card-title { font-size: 16px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }

.pillar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.pillar-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  border: 2px solid var(--rule);
  cursor: pointer;
  transition: all 0.2s;
}

.pillar-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.pillar-card.blue { border-color: var(--blue); }
.pillar-card.gold { border-color: var(--gold); }
.pillar-card.green { border-color: var(--green); }
.pillar-card.red { border-color: var(--red); }

.pillar-badge { display: inline-block; font-size: 28px; font-weight: 800; margin-bottom: 4px; }
.pillar-card.blue .pillar-badge { color: var(--blue); }
.pillar-card.gold .pillar-badge { color: var(--gold); }
.pillar-card.green .pillar-badge { color: var(--green); }
.pillar-card.red .pillar-badge { color: var(--red); }

.pillar-en { font-size: 13px; color: var(--muted); font-style: italic; }
.pillar-score { font-size: 12px; color: var(--muted); margin: 8px 0; }
.pillar-desc { font-size: 13px; line-height: 1.5; }

.ladder { display: flex; flex-direction: column; gap: 8px; max-width: 600px; }

.ladder-step {
  padding: 12px 20px; border-radius: 8px;
  font-size: 14px; font-weight: 600;
}

.ladder-step:nth-child(1) { background: var(--green2); color: var(--green); width: 100%; }
.ladder-step:nth-child(2) { background: var(--purple2); color: var(--purple); width: 92%; }
.ladder-step:nth-child(3) { background: var(--blue2); color: var(--blue); width: 84%; }
.ladder-step:nth-child(4) { background: var(--gold2); color: var(--gold); width: 76%; }
.ladder-step:nth-child(5) { background: var(--red2); color: var(--red); width: 68%; }

.score-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.score-table th, .score-table td { padding: 10px 16px; text-align: center; border-bottom: 1px solid var(--rule); }
.score-table th { background: var(--blue2); color: var(--blue); font-weight: 600; }
.score-table tr:hover td { background: var(--pale); }
.score-table tr.highlight td { background: var(--gold2); font-weight: 700; }

.calc-box { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.calc-box input {
  width: 80px; padding: 10px 14px;
  border: 2px solid var(--rule); border-radius: 8px;
  font-size: 18px; text-align: center; font-family: inherit;
}
.calc-box input:focus { outline: none; border-color: var(--blue); }
.calc-result { font-size: 24px; font-weight: 800; color: var(--blue); }

.band-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.band-tab {
  padding: 8px 16px; border-radius: 20px;
  border: 2px solid var(--rule); background: var(--white);
  cursor: pointer; font-size: 13px; font-weight: 600; transition: all 0.15s;
}
.band-tab:hover { border-color: var(--blue); }
.band-tab.active { background: var(--blue); color: var(--white); border-color: var(--blue); }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 768px) { .detail-grid { grid-template-columns: 1fr; } }

.detail-block h4 {
  font-size: 13px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px;
}

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-block; padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.tag.blue { background: var(--blue2); color: var(--blue); }
.tag.green { background: var(--green2); color: var(--green); }
.tag.gold { background: var(--gold2); color: var(--gold); }
.tag.red { background: var(--red2); color: var(--red); }

.drill-nav { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }

.drill-dot {
  width: 36px; height: 36px; border-radius: 50%;
  border: 2px solid var(--rule); background: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; cursor: pointer; transition: all 0.15s;
}
.drill-dot:hover { border-color: var(--blue); }
.drill-dot.active { background: var(--blue); color: var(--white); border-color: var(--blue); }
.drill-dot.done { background: var(--green2); color: var(--green); border-color: var(--green); }

.drill-sentence {
  font-family: "Times New Roman", Georgia, serif;
  font-size: 18px; line-height: 1.7;
  padding: 20px; background: var(--pale);
  border-radius: var(--radius); border-left: 4px solid var(--blue);
  margin-bottom: 16px;
}

.drill-hint {
  background: var(--gold2); border-left: 4px solid var(--gold);
  padding: 12px 16px; border-radius: 0 8px 8px 0;
  font-size: 14px; margin-bottom: 16px;
}

.drill-task { font-size: 15px; font-weight: 600; margin-bottom: 16px; }

textarea.drill-input, input.drill-input {
  width: 100%; padding: 12px 16px;
  border: 2px solid var(--rule); border-radius: 8px;
  font-family: inherit; font-size: 15px; resize: vertical; min-height: 60px;
}
textarea.drill-input:focus, input.drill-input:focus { outline: none; border-color: var(--blue); }

.answer-panel {
  display: none; margin-top: 20px; padding: 20px;
  background: var(--green2); border-radius: var(--radius); border: 1px solid var(--green);
}
.answer-panel.show { display: block; animation: fadeIn 0.3s; }
.answer-panel h4 { color: var(--green); font-size: 14px; margin-bottom: 12px; }

.chunk-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chunk {
  padding: 8px 14px; border-radius: 8px;
  font-size: 14px; font-family: "Times New Roman", Georgia, serif; font-weight: 600;
}
.chunk.red { background: var(--red2); color: var(--red); border: 1px solid var(--red); }
.chunk.blue { background: var(--blue2); color: var(--blue); border: 1px solid var(--blue); }
.chunk.green { background: var(--green2); color: var(--green); border: 1px solid var(--green); }
.chunk.gold { background: var(--gold2); color: var(--gold); border: 1px solid var(--gold); }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px; border-radius: 8px; border: none;
  font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: all 0.15s;
}
.btn-primary { background: var(--blue); color: var(--white); }
.btn-primary:hover { background: #1a5090; }
.btn-secondary { background: var(--white); color: var(--ink); border: 2px solid var(--rule); }
.btn-secondary:hover { border-color: var(--blue); color: var(--blue); }
.btn-success { background: var(--green); color: var(--white); }
.btn-success:hover { background: #247a4a; }
.btn-row { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

.progress-bar { height: 8px; background: var(--rule); border-radius: 4px; overflow: hidden; margin: 12px 0; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--blue), var(--green)); border-radius: 4px; transition: width 0.4s; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--white); border-radius: var(--radius); padding: 16px; text-align: center; border: 1px solid var(--rule); }
.stat-num { font-size: 28px; font-weight: 800; color: var(--blue); }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; }

.qtype-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.qtype-card { background: var(--white); border-radius: var(--radius); padding: 20px; border: 1px solid var(--rule); }
.qtype-card h4 { font-size: 16px; margin-bottom: 8px; color: var(--blue); }
.qtype-card .focus { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.qtype-card .example { font-size: 13px; font-style: italic; padding: 10px; background: var(--pale); border-radius: 6px; }

.diag-question { margin-bottom: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--rule); }
.diag-question:last-child { border-bottom: none; }
.diag-options { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.diag-option {
  padding: 12px 16px; border: 2px solid var(--rule); border-radius: 8px;
  cursor: pointer; font-size: 14px; transition: all 0.15s;
}
.diag-option:hover { border-color: var(--blue); }
.diag-option.selected { border-color: var(--blue); background: var(--blue2); }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; padding: 60px 20px 40px; }
  .mobile-toggle { display: block; }
}

.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 99; }
.overlay.show { display: block; }
