/* Modern medical UI: teal/blue gradient, clean typography */
:root {
  --bg: #0f172a;
  --bg-2: #111827;
  --fg: #e5e7eb;
  --ink: #e5e7eb;
  --ink-2: #93c5fd;
  --brand-1: #0ea5e9;
  --brand-2: #14b8a6;
  --card-bg: #0b1220;
  --shadow: rgba(0,0,0,0.3);
}
html[data-theme="light"] {
  --bg: #f7fbff;
  --bg-2: #eef6ff;
  --fg: #0b1220;
  --ink: #1f2937;
  --ink-2: #0ea5e9;
  --card-bg: #ffffff;
  --shadow: rgba(0,0,0,0.1);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Noto Sans", "Source Sans Pro", sans-serif;
  line-height: 1.55;
  color: var(--fg);
  background: radial-gradient(1200px 600px at 20% -10%, rgba(14,165,233,0.15), transparent),
              radial-gradient(1000px 500px at 120% -20%, rgba(20,184,166,0.15), transparent),
              var(--bg);
}

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: .6rem 1rem; background: linear-gradient(90deg, var(--bg-2), transparent);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  backdrop-filter: blur(6px);
}
.brand { display:flex; align-items:center; gap:.6rem; font-weight:700; }
.tooth { font-size: 1.4rem; }
.title { letter-spacing:.2px; }
.controls { display:flex; gap:.5rem; }
.chip {
  border: 1px solid rgba(255,255,255,0.15);
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(0,0,0,0.06));
  color: var(--fg); padding: .4rem .6rem; border-radius: 999px; cursor: pointer;
}
#progressWrap { height:4px; background: rgba(255,255,255,0.08); }
#progressBar { height:4px; width:0; background: linear-gradient(90deg, var(--brand-1), var(--brand-2)); }

main { max-width: 1100px; margin: 0 auto; padding: 1rem; }
.slide { padding: 1rem; margin: 1rem 0; background: var(--card-bg); border-radius: 14px; box-shadow: 0 6px 20px var(--shadow); }
.slide h1, .slide h2 { margin-top: 0; }
.grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 900px) { .grid.two { grid-template-columns: 1fr; } }

.card { background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); padding: 1rem; border-radius: 12px; }
.tick li { margin:.4rem 0; }
.tick li::marker { content: "• "; color: var(--ink-2); }

.svg-wrap { background: rgba(255,255,255,0.03); border:1px dashed rgba(255,255,255,0.12); border-radius: 12px; padding:.5rem; }
.anatomy-svg { width: 100%; height: auto; display:block; }

.tooltip {
  position: fixed; inset: auto auto 20px 20px; max-width: 420px; padding: .8rem 1rem;
  background: var(--bg-2); color: var(--fg); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px; box-shadow: 0 10px 30px var(--shadow); display: none;
}
.tooltip.show { display:block; }

.nav { position: sticky; bottom: 0; z-index: 10; display:flex; align-items:center; justify-content:center; gap:1rem; padding: .6rem; }
.nav-btn {
  font-size: 1.2rem; padding: .4rem .8rem; border-radius: 10px; border: 1px solid rgba(255,255,255,0.15);
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(0,0,0,0.06)); color: var(--fg); cursor: pointer;
}
.pos { opacity:.8; }

.xr-stage {
  position: relative; overflow: hidden; border-radius: 12px; border:1px solid rgba(255,255,255,0.1);
  height: 60vh; background: #000; touch-action: none;
}
.xr-stage img {
  position: absolute; top:0; left:0; transform-origin: 0 0; user-select: none; -webkit-user-drag: none;
  filter: contrast(var(--xr-contrast, 1)) invert(var(--xr-invert, 0));
}

.viewer-controls { display:flex; flex-wrap: wrap; gap:.6rem; align-items:center; margin-bottom:.6rem; }
.viewer-controls label { display:flex; align-items:center; gap:.4rem; }

.glb-wrap { height: 60vh; background: #0a0a0a; border-radius: 12px; border:1px solid rgba(255,255,255,0.1); }
#threeCanvas { width: 100%; height: 100%; display:block; }

.hint { opacity:.8; font-size: .95rem; }

.foot { text-align: center; padding: 1rem 0 2rem; opacity: .7; }

/* RTL support */
html[dir="rtl"] body { direction: rtl; }
html[dir="rtl"] .tick { padding-right: 1rem; }
html[dir="rtl"] .nav .pos { order: -1; }

/* Floating info */
.glossary { display:flex; flex-wrap:wrap; gap:.5rem; }
.term { border:1px solid rgba(255,255,255,0.15); background:rgba(255,255,255,0.04); padding:.4rem .6rem; border-radius:999px; cursor:pointer; }
