/* ===== Gravity common-pool experience ===== */
.grav-app {
  --g-bg: #050814;
  --g-panel: rgba(15, 23, 42, .92);
  --g-accent: #38bdf8;
  --g-warm: #fbbf24;
  --g-pink: #f472b6;
  --g-ok: #34d399;
  max-width: 1100px;
  margin: 0 auto 2rem;
  color: #e2e8f0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
.grav-top {
  display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: flex-end;
  margin-bottom: .85rem;
}
.grav-kicker {
  font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: #7dd3fc;
}
.grav-title {
  font-size: clamp(1.35rem, 3vw, 1.85rem); font-weight: 900; margin: .15rem 0;
  background: linear-gradient(90deg, #e0f2fe, #a5b4fc, #f9a8d4);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.grav-sub { margin: 0; color: #94a3b8; font-size: .92rem; max-width: 36rem; }
.grav-progress-wrap { min-width: 140px; text-align: right; }
.grav-progress-label { font-weight: 900; color: #fbbf24; margin-bottom: .25rem; }
.grav-progress-bar {
  height: 8px; border-radius: 999px; background: #1e293b; overflow: hidden; width: 160px; margin-left: auto;
}
.grav-progress-bar span {
  display: block; height: 100%; width: 7%; border-radius: 999px;
  background: linear-gradient(90deg, #38bdf8, #a78bfa, #f472b6);
  transition: width .35s ease;
}

.grav-stage-wrap {
  position: relative; border-radius: 1.15rem; overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 50% 40%, rgba(56,189,248,.14), transparent 60%),
    radial-gradient(circle at 18% 18%, rgba(167,139,250,.18), transparent 38%),
    radial-gradient(circle at 85% 70%, rgba(244,114,182,.1), transparent 40%),
    linear-gradient(180deg, #0b1020, #050814 70%);
  border: 1px solid rgba(148,163,184,.28);
  box-shadow:
    0 24px 60px rgba(0,0,0,.55),
    0 0 0 1px rgba(56,189,248,.08),
    inset 0 0 100px rgba(56,189,248,.06);
}
#gravCanvas {
  display: block; width: 100%; height: auto; max-height: min(64vh, 580px);
  cursor: crosshair;
  image-rendering: auto;
  background: #03050c;
}
.grav-overlay {
  position: absolute; left: 0; right: 0; bottom: 0; padding: .65rem 1rem;
  pointer-events: none;
  background: linear-gradient(transparent, rgba(5,8,20,.85));
  font-size: .78rem; font-weight: 700; color: #cbd5e1;
}
.grav-badge-model, .grav-badge-thought {
  position: absolute; top: .75rem; right: .75rem;
  font-size: .68rem; font-weight: 900; letter-spacing: .06em;
  padding: .3rem .55rem; border-radius: 999px;
  background: rgba(251,191,36,.2); color: #fde68a; border: 1px solid rgba(251,191,36,.45);
}
.grav-badge-thought {
  background: rgba(244,114,182,.18); color: #fbcfe8; border-color: rgba(244,114,182,.4);
}

.grav-narrate {
  margin-top: .85rem; padding: 1rem 1.15rem; border-radius: 1rem;
  background: var(--g-panel); border: 1px solid rgba(148,163,184,.18);
  min-height: 5.5rem;
}
.grav-speak { margin: 0; font-size: 1.05rem; line-height: 1.55; color: #f1f5f9; font-weight: 600; }
.grav-takeaway {
  margin: .65rem 0 0; padding: .5rem .75rem; border-radius: .65rem;
  background: rgba(52,211,153,.12); border-left: 3px solid #34d399;
  color: #a7f3d0; font-weight: 700; font-size: .9rem;
}

.grav-panel {
  margin-top: .75rem; padding: .85rem 1rem; border-radius: 1rem;
  background: rgba(15,23,42,.75); border: 1px solid rgba(148,163,184,.15);
  min-height: 3.5rem;
}
.grav-choices { display: flex; flex-wrap: wrap; gap: .5rem; }
.grav-choice {
  flex: 1 1 140px; text-align: left; border: 2px solid #334155; background: #0f172a;
  color: #e2e8f0; border-radius: .85rem; padding: .65rem .85rem; font-weight: 700;
  cursor: pointer; transition: all .2s;
}
.grav-choice:hover { border-color: #38bdf8; transform: translateY(-2px); }
.grav-choice.ok { border-color: #34d399; background: rgba(52,211,153,.15); }
.grav-choice.bad { border-color: #f87171; background: rgba(248,113,113,.12); }
.grav-choice:disabled { opacity: .85; cursor: default; }

.grav-sliders { display: grid; gap: .65rem; }
.grav-slider-row label {
  display: flex; justify-content: space-between; font-size: .8rem; font-weight: 800; color: #94a3b8; margin-bottom: .2rem;
}
.grav-slider-row input[type=range] { width: 100%; accent-color: #38bdf8; }
.grav-planet-btns { display: flex; flex-wrap: wrap; gap: .4rem; }
.grav-planet-btns button {
  border: 0; border-radius: 999px; padding: .35rem .75rem; font-weight: 800; cursor: pointer;
  background: #1e293b; color: #e2e8f0; border: 1px solid #334155;
}
.grav-planet-btns button.on { background: linear-gradient(135deg,#38bdf8,#818cf8); color: #0f172a; border-color: transparent; }

.grav-quiz-q { font-weight: 800; margin-bottom: .5rem; }
.grav-score {
  font-weight: 900; color: #fbbf24; font-size: 1.1rem;
}

.grav-controls {
  display: flex; flex-wrap: wrap; gap: .45rem; justify-content: center;
  margin-top: .9rem; padding: .65rem; border-radius: 1rem;
  background: rgba(15,23,42,.9); border: 1px solid rgba(148,163,184,.15);
  position: sticky; bottom: .5rem; z-index: 20;
  box-shadow: 0 8px 30px rgba(0,0,0,.35);
}
.grav-btn {
  border: 1px solid #334155; background: #1e293b; color: #e2e8f0;
  border-radius: 999px; padding: .45rem .85rem; font-weight: 800; font-size: .82rem;
  cursor: pointer; transition: all .15s;
}
.grav-btn:hover { border-color: #64748b; background: #334155; }
.grav-btn.primary {
  background: linear-gradient(135deg, #0ea5e9, #6366f1); border-color: transparent; color: #fff;
}
.grav-btn.soft { background: transparent; color: #94a3b8; }
.grav-btn:disabled { opacity: .4; cursor: not-allowed; }

.grav-chapters {
  display: flex; flex-wrap: wrap; gap: .35rem; justify-content: center;
  margin-top: 1rem;
}
.grav-ch-dot {
  width: 2rem; height: 2rem; border-radius: 50%; border: 2px solid #334155;
  background: #0f172a; color: #94a3b8; font-size: .72rem; font-weight: 900;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.grav-ch-dot.on { border-color: #38bdf8; background: #0c4a6e; color: #e0f2fe; box-shadow: 0 0 0 3px rgba(56,189,248,.25); }
.grav-ch-dot.done { border-color: #34d399; color: #6ee7b7; }

.grav-end-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.grav-end-actions button {
  flex: 1 1 140px; border: 0; border-radius: .85rem; padding: .75rem; font-weight: 900;
  cursor: pointer; background: linear-gradient(135deg,#6366f1,#a855f7); color: #fff;
}

@media (max-width: 576px) {
  .grav-controls { gap: .3rem; }
  .grav-btn { padding: .4rem .6rem; font-size: .75rem; }
  .grav-speak { font-size: .95rem; }
}

/* Light theme when parent layout is light */
[data-bs-theme="light"] .grav-app { color: #0f172a; }
[data-bs-theme="light"] .grav-narrate,
[data-bs-theme="light"] .grav-panel,
[data-bs-theme="light"] .grav-controls {
  background: #fff; color: #0f172a; border-color: #e2e8f0;
}
[data-bs-theme="light"] .grav-speak { color: #0f172a; }
[data-bs-theme="light"] .grav-sub { color: #64748b; }
[data-bs-theme="light"] .grav-choice {
  background: #f8fafc; color: #0f172a; border-color: #cbd5e1;
}
[data-bs-theme="light"] .grav-btn {
  background: #f1f5f9; color: #0f172a; border-color: #cbd5e1;
}
[data-bs-theme="light"] .grav-btn.primary { color: #fff; }
