:root {
  --bg: #eef1f5;
  --panel: rgba(250, 251, 248, 0.92);
  --panel-border: rgba(40, 58, 76, 0.12);
  --text: #22303c;
  --muted: #62707a;
  --accent: #cb6f39;
  --accent-soft: rgba(203, 111, 57, 0.14);
  --blue: #2b7590;
  --blue-soft: rgba(43, 117, 144, 0.14);
  --green: #3e8763;
  --shadow: 0 18px 46px rgba(34, 48, 60, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans SC", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(203, 111, 57, 0.14), transparent 30%),
    radial-gradient(circle at bottom right, rgba(43, 117, 144, 0.14), transparent 28%),
    linear-gradient(145deg, #eef2f6 0%, #f7f5ef 58%, #edf4ee 100%);
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1480px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 24px 0 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  margin-bottom: 18px;
}

.brand-block {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--blue);
  font-family: "Outfit", sans-serif;
}

.topbar h1 {
  margin: 0;
  font-size: 42px;
  line-height: 1.04;
}

.intro-copy {
  margin: 14px 0 0;
  line-height: 1.7;
  color: var(--muted);
}

.credit-line {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--blue);
  font-weight: 700;
}

.topbar-metrics {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.metric-card {
  min-width: 156px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow);
}

.metric-card span {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--muted);
}

.workspace {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr) 350px;
  gap: 18px;
}

.workspace.detail-hidden {
  grid-template-columns: 290px minmax(0, 1fr);
}

.panel {
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.sidebar,
.detail-panel {
  padding: 18px;
}

.sidebar {
  display: grid;
  gap: 18px;
  align-content: start;
}

.section-heading h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.section-heading p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.lesson-nav {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.lesson-btn {
  width: 100%;
  padding: 13px 15px;
  border: 1px solid rgba(43, 117, 144, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  text-align: left;
  color: var(--text);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.lesson-btn:hover,
.lesson-btn.active {
  transform: translateY(-1px);
  border-color: rgba(203, 111, 57, 0.34);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 242, 234, 0.92));
}

.lesson-btn strong,
.lesson-btn span {
  display: block;
}

.lesson-btn strong {
  margin-bottom: 6px;
  font-size: 15px;
}

.lesson-btn span {
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
}

.sidebar-note {
  padding: 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.tip-list {
  margin: 16px 0 0;
  padding-left: 20px;
  display: grid;
  gap: 10px;
}

.canvas-panel {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.canvas-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.chapter-badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.canvas-header h2 {
  margin: 10px 0 6px;
  font-size: 28px;
}

.canvas-header p {
  margin: 0;
  color: var(--muted);
}

.status-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 9px 11px;
  border-radius: 999px;
  background: rgba(34, 48, 60, 0.08);
  font-size: 13px;
  font-weight: 700;
}

.status-pill.alt {
  background: var(--accent-soft);
  color: var(--accent);
}

.canvas-stage {
  position: relative;
  min-height: 560px;
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(rgba(64, 90, 112, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(64, 90, 112, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 252, 0.98), rgba(245, 248, 243, 0.98));
  background-size: 34px 34px, 34px 34px, auto;
}

#geometryCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.floating-card {
  position: absolute;
  right: 16px;
  top: 16px;
  width: min(320px, calc(100% - 32px));
  padding: 14px 15px;
  border-radius: 8px;
  background: rgba(28, 40, 52, 0.84);
  color: #f7fbff;
  pointer-events: none;
}

.floating-label {
  display: block;
  margin-bottom: 7px;
  font-size: 12px;
  color: rgba(247, 251, 255, 0.72);
}

.floating-card p {
  margin: 10px 0 0;
  line-height: 1.6;
  color: rgba(247, 251, 255, 0.8);
}

.control-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.primary-btn,
.ghost-btn {
  border-radius: 8px;
  padding: 11px 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 180ms ease, opacity 180ms ease, background 180ms ease, border-color 180ms ease;
}

.primary-btn {
  border: none;
  background: var(--accent);
  color: #fffdf8;
}

.ghost-btn {
  border: 1px solid rgba(34, 48, 60, 0.12);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
}

.primary-btn:hover,
.ghost-btn:hover,
.lesson-btn:hover {
  transform: translateY(-1px);
  opacity: 0.94;
}

.inline-toggle,
.speed-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(34, 48, 60, 0.1);
  background: rgba(255, 255, 255, 0.76);
}

.detail-panel {
  display: grid;
  gap: 16px;
  align-content: start;
}

.detail-panel.hidden {
  display: none;
}

.detail-block {
  padding: 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.step-list {
  margin: 16px 0 0;
  padding-left: 20px;
  display: grid;
  gap: 10px;
}

.step-list li {
  padding: 11px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(34, 48, 60, 0.08);
  line-height: 1.65;
}

.step-list li.active {
  background: rgba(43, 117, 144, 0.1);
  border-color: rgba(43, 117, 144, 0.26);
}

.reason-text,
.result-text {
  margin: 16px 0 0;
  line-height: 1.72;
}

.fact-list {
  margin: 14px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

@media (max-width: 1280px) {
  .workspace {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .detail-panel {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  .app-shell {
    width: min(100vw - 20px, 100%);
    padding-top: 16px;
  }

  .topbar,
  .canvas-header {
    flex-direction: column;
    align-items: stretch;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    grid-template-columns: 1fr;
  }

  .status-group {
    justify-content: flex-start;
  }

  .canvas-stage {
    min-height: 430px;
  }
}
