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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f5f7fa;
  color: #2d3748;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- header ---------- */
header {
  background: linear-gradient(135deg, #1a365d, #2b6cb0);
  color: #fff;
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

header .back-link {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
}

header .back-link:hover { color: #fff; }

header .title-group { flex: 1; }
header h1 { font-size: 1.3rem; font-weight: 700; }
header .subtitle { font-size: 0.9rem; opacity: 0.8; }

/* ---------- layout ---------- */
.layout {
  display: flex;
  flex: 1;
}

/* ---------- side nav ---------- */
.side-nav {
  width: 260px;
  min-width: 260px;
  background: #fff;
  border-right: 1px solid #e2e8f0;
  padding: 1.5rem 0;
  overflow-y: auto;
}

.side-nav .nav-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: #a0aec0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 1.25rem;
  margin-bottom: 0.5rem;
}

.side-nav a {
  display: block;
  padding: 0.5rem 1.25rem;
  font-size: 0.9rem;
  color: #4a5568;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}

.side-nav a:hover {
  background: #edf2f7;
}

.side-nav a.active {
  color: #2b6cb0;
  font-weight: 600;
  border-left-color: #2b6cb0;
  background: #ebf4ff;
}

.side-nav .nav-cn {
  display: block;
  font-size: 0.8rem;
  color: #a0aec0;
  font-weight: 400;
  margin-top: 0.1rem;
}

.side-nav a.active .nav-cn {
  color: #63b3ed;
}

.side-nav a.bonus {
  font-size: 0.85rem;
  padding-left: 2rem;
  color: #718096;
  border-left-color: transparent;
}

.side-nav a.bonus::before {
  content: '\2605 ';
  font-size: 0.75rem;
}

.side-nav a.bonus.active {
  color: #2b6cb0;
  border-left-color: #2b6cb0;
}

/* ---------- content area ---------- */
.content {
  flex: 1;
  padding: 2rem;
  max-width: 780px;
  overflow-y: auto;
}

.content h2 {
  font-size: 1.3rem;
  color: #1a365d;
  margin-bottom: 0.25rem;
}

.content .section-cn {
  font-size: 0.95rem;
  color: #718096;
  margin-bottom: 1.5rem;
}

/* ---------- demo cards ---------- */
.demo-card {
  background: #fff;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.demo-card h3 {
  font-size: 1rem;
  color: #2d3748;
  margin-bottom: 0.5rem;
}

.demo-card .desc {
  font-size: 0.9rem;
  color: #718096;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.placeholder {
  padding: 3rem 2rem;
  text-align: center;
  color: #a0aec0;
  border: 2px dashed #e2e8f0;
  border-radius: 6px;
  font-size: 0.95rem;
}

/* ---------- equation display ---------- */
.equation-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: #f7fafc;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  min-height: 2.5em;
}

.equation-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #4a5568;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

/* ---------- radio rows ---------- */
.radio-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.radio-row .radio-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #4a5568;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  min-width: 4.5em;
}

.radio-opt {
  font-size: 0.9rem;
  color: #4a5568;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.radio-opt input[type="radio"],
.radio-opt input[type="checkbox"] {
  accent-color: #2b6cb0;
}

/* ---------- controls ---------- */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
  align-items: flex-end;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.control-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #4a5568;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.control-group select,
.control-group input[type="range"] {
  font-size: 0.9rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
  background: #fff;
}

.control-group input[type="range"] {
  width: 140px;
  padding: 0;
}

.range-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.range-value {
  font-size: 0.8rem;
  color: #718096;
  min-width: 3em;
  text-align: right;
}

.plot-container {
  width: 100%;
  height: 300px;
}

/* ---------- footer ---------- */
footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.85rem;
  color: #a0aec0;
}

/* ---------- responsive ---------- */
@media (max-width: 768px) {
  .side-nav { display: none; }
  .content { max-width: 100%; }
}
