:root {
  --bg: #02153B;
  --ink: #0f172a;
  --muted: #475569;
  --brand: #0b5cab;
  --brand-2: #1f9d8f;
  --card: #ffffff;
  --line: #dbe5ef;
  --ok: #166534;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Manrope', sans-serif; background: var(--bg); color: var(--ink); min-height: 100vh; }
main { max-width: 1200px; margin: 0 auto; padding: 28px 16px 40px; position: relative; z-index: 2; }
.bg-shape { position: fixed; border-radius: 999px; filter: blur(6px); opacity: 0.22; z-index: 1; }
.bg-shape-1 { width: 280px; height: 280px; background: #5ca8e8; top: -80px; right: -40px; }
.bg-shape-2 { width: 320px; height: 320px; background: #53cdbf; bottom: -110px; left: -70px; }
.bg-shape { display: none; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 14px 40px rgba(15, 23, 42, 0.08); }
h1, h2, h3 { margin: 0 0 10px; }
.subtitle { color: var(--muted); line-height: 1.5; margin: 0; }
.login-card { max-width: 560px; margin: 10vh auto 0; padding: 28px; display: none; }
.login-card.active { display: block; animation: show .4s ease; }
label { font-weight: 700; margin-top: 14px; display: block; }
input, textarea { width: 100%; padding: 12px; border-radius: 12px; border: 1px solid #b6c7d9; font-size: 15px; font-family: inherit; }
button { border: none; border-radius: 12px; padding: 11px 16px; font-weight: 700; cursor: pointer; margin-top: 14px; background: linear-gradient(120deg, var(--brand), var(--brand-2)); color: #fff; }
button.secondary { background: #e9f0f7; color: #0e2c4e; }
.error { min-height: 20px; color: #b91c1c; font-weight: 600; margin-top: 10px; }
.app-shell { display: none; }
.app-shell.active { display: block; animation: show .35s ease; }
.hero { padding: 24px; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.layout { margin-top: 16px; display: grid; grid-template-columns: 300px 1fr; gap: 16px; }
.sidebar { padding: 18px; }
.sidebar button { width: 100%; text-align: left; margin: 6px 0; padding: 10px 12px; background: #f2f7fc; color: #16314e; }
.sidebar button.active { background: #0f5ba8; color: white; }
.content { padding: 20px; }
.topic-title { font-size: 1.4rem; margin: 0; }
.theory-box { margin: 12px 0; padding: 14px; border: 1px solid #cae2f9; border-radius: 12px; background: #f7fbff; }
.refs-list { margin: 8px 0 0; padding-left: 20px; color: #1e3a5f; }
.exercise-list { display: grid; gap: 12px; margin-top: 16px; }
.exercise { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: #fcfdff; }
.exercise h4 { margin: 0 0 8px; color: #0b355f; }
.exercise-image-wrap {
  position: relative;
  width: 100%;
  margin: 6px 0 12px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #cfdceb;
  background: linear-gradient(180deg, #fbfdff 0%, #f4f8fc 100%);
}
.exercise-image {
  width: 100%;
  display: block;
  aspect-ratio: 16 / 5;
  object-fit: cover;
  object-position: center;
  background: #eaf1f8;
}
.scenario-canvas {
  width: 100%;
  height: 220px;
  min-height: 220px;
  padding: 0;
  background: #f8fbff;
  overflow: hidden;
  display: flex;
  align-items: stretch;
}
.exercise-math-banner {
  width: 100%;
  background: linear-gradient(180deg, #f8fbff 0%, #eef5fd 100%);
  border: 1px solid #d3e1ef;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.math-label {
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #0b355f;
  margin-bottom: 4px;
}
.math-display {
  color: #0f172a;
  overflow-x: auto;
}
.block-title { font-weight: 700; color: #0e2e51; }
.context-box {
  margin: 8px 0 10px;
  padding: 12px 14px;
  border: 1px solid #d3e2f2;
  border-left: 4px solid #0b5cab;
  border-radius: 10px;
  background: #f8fbff;
  line-height: 1.65;
  color: #16324f;
}
.context-box p { margin: 0; }
.solution-box {
  margin: 10px 0 12px;
  padding: 12px 14px;
  border: 1px solid #dbe6f2;
  border-radius: 10px;
  background: #f8fbff;
}
.steps-list {
  margin: 8px 0 0;
  padding-left: 20px;
  color: #16324f;
  line-height: 1.6;
}
.result { color: var(--ok); font-weight: 700; }
.simulation-box { margin: 14px 0; padding: 14px; border: 1px solid #cbe9e3; border-radius: 12px; background: #f5fffc; }
.simulation-box h4 { margin: 0 0 4px; color: #0f4d46; }
.ex-sim-box { border-color: #c8dff7; background: #f7fbff; }
.sim-output { margin: 10px 0; font-weight: 700; color: #0b355f; }
.sim-img { width: 100%; max-width: 460px; border: 1px solid #d8e4f1; border-radius: 10px; background: #fff; }
.reflection-box { margin-top: 12px; padding-top: 10px; border-top: 1px dashed #c7d8e8; }
.save-reflection { margin-top: 8px; background: #0e5da8; }
.reflection-msg { min-height: 18px; margin: 8px 0 0; font-weight: 700; }
.ok-msg { color: #166534; }
.error-msg { color: #b91c1c; }
.reflection-popup {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 9999;
  background: #16a34a;
  color: #ffffff;
  border: 1px solid #15803d;
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  opacity: 0;
  transform: translate(-50%, calc(-50% + 12px));
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.reflection-popup::before {
  content: "✓";
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 900;
}
.reflection-popup.show {
  opacity: 1;
  transform: translate(-50%, -50%);
}
.mj { overflow-x: auto; }
@keyframes show { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 950px) { .layout { grid-template-columns: 1fr; } .hero { flex-direction: column; align-items: flex-start; } }

.plotly-sim { width: 100%; min-height: 240px; border: 1px solid #d8e4f1; border-radius: 10px; background: #fff; }
.sim-aid-wrap {
  margin-top: 10px;
}
.sim-meta {
  margin-top: 10px;
  border: 1px solid #d8e4f1;
  border-radius: 10px;
  background: #ffffff;
  color: #0f2f4f;
  padding: 10px 12px;
  line-height: 1.55;
}
.sim-aid-card {
  border: 1px solid #c8dff7;
  border-radius: 10px;
  background: #eef6ff;
  color: #12385a;
  padding: 10px 12px;
  line-height: 1.55;
}
.sim-insight {
  margin-top: 10px;
  border: 1px solid #b7efd7;
  border-radius: 10px;
  background: #f0fdf4;
  color: #14532d;
  padding: 10px 12px;
  line-height: 1.55;
}
