:root {
  --bg-ink: #14141d;
  --bg-soft: #f6f3ee;
  --bg-paper: #fffdf9;
  --text-strong: #24201b;
  --text-soft: #766f67;
  --line: #ddd6ce;
  --line-dark: #bbb0a5;
  --accent: #8a3ffc;
  --accent-soft: #f0e7ff;
  --sky: #d8eef7;
  --sky-strong: #5cb8e5;
  --orange-soft: #fff0df;
  --orange-strong: #ff8c3a;
  --shadow-soft: 0 16px 40px rgba(28, 20, 10, 0.08);
  --shadow-card: 0 22px 48px rgba(27, 20, 12, 0.12);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(103, 150, 210, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(255, 143, 38, 0.14), transparent 24%),
    linear-gradient(180deg, #121418 0%, #201c19 100%);
  color: #ece3d8;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.view-home,
.view-select {
  width: min(1360px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.view-home {
  width: min(1460px, calc(100% - 32px));
  padding-top: 16px;
}

.home-hero,
.feature-panel,
.builder-panel {
  background: rgba(255, 253, 249, 0.82);
  border: 1px solid rgba(196, 186, 173, 0.5);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.home-hero {
  position: relative;
  z-index: 2;
  max-width: 620px;
  padding: 30px 34px;
  border-radius: 26px;
  background: rgba(18, 19, 21, 0.6);
  border: 1px solid rgba(255, 187, 109, 0.24);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.hero-badge,
.section-kicker,
.player-counter,
.player-meta {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.view-home .hero-badge,
.view-home .section-kicker {
  color: #f0b168;
}

.home-hero h1,
.select-header h1,
.feature-panel h2 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
}

.home-hero h1 {
  max-width: 820px;
  margin-top: 18px;
  font-size: clamp(3rem, 6vw, 5.5rem);
  line-height: 0.95;
  color: #fff4e7;
}

.hero-copy {
  max-width: 760px;
  margin: 18px 0 0;
  color: var(--text-soft);
  font-size: 1.12rem;
  line-height: 1.7;
}

.view-home .hero-copy {
  color: rgba(239, 230, 219, 0.84);
}

.hero-actions,
.builder-actions,
.toggle-row,
.question-stage-actions,
.player-footer-actions,
.timer-actions,
.player-tools,
.section-heading {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.hero-actions {
  margin-top: 28px;
}

.button,
.tool-button,
.pill-button,
.session-chip,
.circle-button {
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

.button:hover,
.tool-button:hover,
.pill-button:hover,
.session-chip:hover,
.circle-button:hover {
  transform: translateY(-1px);
}

.button {
  padding: 13px 22px;
  font-weight: 700;
}

.button-primary {
  background: linear-gradient(135deg, var(--accent), #5e24ff);
  color: white;
}

.button-secondary {
  background: linear-gradient(180deg, rgba(68, 70, 76, 0.96), rgba(48, 49, 55, 0.96));
  border-color: rgba(255, 179, 98, 0.18);
  color: #f0e8df;
}

.button-ghost {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 179, 98, 0.18);
  color: #f0e8df;
}

.button-light {
  background: linear-gradient(180deg, rgba(77, 79, 84, 0.96), rgba(57, 58, 63, 0.96));
  border-color: rgba(255, 179, 98, 0.16);
  color: rgba(244, 235, 225, 0.88);
}

.button-purple {
  background: linear-gradient(135deg, #8a3ffc, #b185ff);
  color: white;
}

.home-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

.home-grid-bottom {
  margin-top: 22px;
  align-items: start;
}

.mode-section {
  margin-bottom: 24px;
}

.mode-grid,
.preset-grid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.mode-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.preset-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mode-card,
.preset-card,
.session-goal-card,
.confidence-panel,
.explanation-tools {
  border: 1px solid rgba(255, 181, 99, 0.12);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 18px;
}

.mode-card,
.preset-card {
  padding: 16px;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.mode-card:hover,
.preset-card:hover {
  transform: translateY(-1px);
}

.mode-card.active,
.preset-card.active {
  border-color: rgba(138, 211, 255, 0.46);
  background: rgba(43, 91, 121, 0.18);
  box-shadow: 0 0 0 3px rgba(72, 148, 197, 0.12);
}

.mode-card strong,
.preset-card strong {
  display: block;
  color: #fff0dc;
  margin-bottom: 6px;
}

.mode-card p,
.preset-card p,
.session-goal-card p,
.confidence-panel p,
.explanation-tools p {
  margin: 0;
  color: rgba(232, 222, 210, 0.72);
  line-height: 1.55;
}

.session-goal-card {
  margin-top: 22px;
  padding: 16px 18px;
}

.session-goal-card strong {
  color: #fff1de;
}

.feature-panel {
  padding: 28px;
  border-radius: var(--radius-xl);
}

.feature-panel-dark {
  background:
    linear-gradient(180deg, rgba(29, 30, 34, 0.94), rgba(17, 18, 22, 0.92)),
    rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 176, 92, 0.18);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

.feature-panel-dark h2 {
  color: #fff1df;
}

.feature-panel-dark p,
.feature-panel-dark .unit-card-home p,
.feature-panel-dark .flow-step p,
.feature-panel-dark .stat-row span:first-child {
  color: rgba(233, 224, 214, 0.74);
}

.home-stage {
  position: relative;
}

.home-scene {
  position: relative;
  min-height: 700px;
  overflow: hidden;
  border-radius: 36px;
  border: 1px solid rgba(255, 176, 92, 0.15);
  background:
    radial-gradient(circle at 65% 18%, rgba(255, 148, 46, 0.36), transparent 12%),
    radial-gradient(circle at 30% 24%, rgba(214, 229, 255, 0.18), transparent 14%),
    linear-gradient(180deg, rgba(13, 14, 17, 0.92), rgba(29, 28, 25, 0.95)),
    linear-gradient(135deg, #14161a, #27221c);
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.38);
}

.scene-glow,
.scene-grid,
.scene-rings,
.scene-wave,
.scene-pendulum,
.scene-tower,
.scene-coil,
.scene-platform,
.scene-formula {
  position: absolute;
}

.scene-glow {
  filter: blur(28px);
  opacity: 0.72;
}

.scene-glow-left {
  left: 7%;
  top: 18%;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(209, 228, 255, 0.42), transparent 68%);
}

.scene-glow-center {
  left: 36%;
  top: 26%;
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.15), transparent 72%);
}

.scene-glow-right {
  right: 11%;
  top: 10%;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(255, 130, 31, 0.5), transparent 70%);
}

.scene-grid {
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 80px 80px;
  opacity: 0.18;
}

.scene-rings {
  left: 12%;
  top: 16%;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  border: 1px solid rgba(120, 192, 255, 0.25);
  box-shadow:
    0 0 0 54px rgba(120, 192, 255, 0.06),
    0 0 0 108px rgba(120, 192, 255, 0.04);
}

.scene-rings::before,
.scene-rings::after {
  content: "";
  position: absolute;
  inset: 36px;
  border-radius: 50%;
  border: 1px solid rgba(120, 192, 255, 0.2);
  transform: rotate(28deg);
}

.scene-rings::after {
  inset: 88px;
  transform: rotate(-35deg);
}

.scene-wave {
  left: 18%;
  right: 18%;
  bottom: 122px;
  height: 120px;
  opacity: 0.48;
  background:
    radial-gradient(circle at 0 60px, transparent 56px, rgba(255, 183, 102, 0.3) 57px, rgba(255, 183, 102, 0.3) 60px, transparent 61px) 0 0/120px 120px repeat-x;
}

.scene-pendulum {
  width: 2px;
  height: 190px;
  background: linear-gradient(180deg, rgba(255, 226, 190, 0.92), rgba(255, 226, 190, 0.1));
  transform-origin: top center;
}

.scene-pendulum::after {
  content: "";
  position: absolute;
  left: -19px;
  bottom: -24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffca86, #8d5123 72%);
  box-shadow: 0 0 28px rgba(255, 165, 74, 0.32);
}

.scene-pendulum-a {
  left: 23%;
  top: 58px;
  transform: rotate(19deg);
}

.scene-pendulum-b {
  left: 28%;
  top: 46px;
  transform: rotate(-14deg);
}

.scene-tower {
  bottom: 160px;
  border-radius: 18px 18px 6px 6px;
  background:
    linear-gradient(180deg, rgba(109, 101, 91, 0.9), rgba(45, 41, 36, 0.95)),
    #3a3530;
  border: 1px solid rgba(255, 191, 122, 0.2);
}

.scene-tower::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -22px;
  width: 26px;
  height: 28px;
  margin-left: -13px;
  border-radius: 10px 10px 0 0;
  background: linear-gradient(180deg, #4b443c, #211d1a);
}

.scene-tower::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -74px;
  width: 46px;
  height: 74px;
  margin-left: -23px;
  background: radial-gradient(circle at 50% 16%, rgba(255, 198, 106, 0.92), rgba(255, 111, 35, 0.78) 45%, transparent 72%);
  filter: blur(4px);
}

.scene-tower-main {
  left: 53%;
  width: 86px;
  height: 260px;
}

.scene-tower-side {
  left: 47%;
  width: 50px;
  height: 180px;
}

.scene-coil {
  left: 38%;
  bottom: 196px;
  width: 150px;
  height: 76px;
  border-radius: 100px;
  border: 7px solid rgba(194, 126, 72, 0.78);
  box-shadow:
    24px 0 0 -2px rgba(194, 126, 72, 0.68),
    48px 0 0 -2px rgba(194, 126, 72, 0.58),
    72px 0 0 -2px rgba(194, 126, 72, 0.48);
  opacity: 0.82;
}

.scene-platform {
  bottom: 72px;
  height: 54px;
  background: linear-gradient(180deg, rgba(70, 73, 77, 0.86), rgba(30, 31, 34, 0.94));
  border-top: 1px solid rgba(255, 183, 102, 0.25);
}

.scene-platform-a {
  left: 0;
  width: 58%;
  clip-path: polygon(0 38%, 100% 0, 100% 100%, 0 100%);
}

.scene-platform-b {
  right: 0;
  width: 44%;
  clip-path: polygon(0 0, 100% 26%, 100% 100%, 0 100%);
}

.scene-formula {
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  letter-spacing: 0.08em;
  color: rgba(220, 232, 255, 0.26);
  text-shadow: 0 0 22px rgba(175, 208, 255, 0.16);
}

.formula-one {
  left: 14%;
  top: 72%;
  font-size: 1.9rem;
}

.formula-two {
  left: 44%;
  top: 14%;
  font-size: 1.35rem;
}

.formula-three {
  right: 30%;
  top: 62%;
  font-size: 1.5rem;
}

.home-menu-panel {
  position: absolute;
  top: 56px;
  right: 48px;
  z-index: 2;
  width: 360px;
  padding: 18px 18px 20px;
  border-radius: 10px;
  background: rgba(49, 50, 55, 0.86);
  border: 1px solid rgba(137, 131, 124, 0.44);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
}

.menu-panel-header h2 {
  color: #fff1df;
}

.menu-panel-actions {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.menu-button {
  padding: 14px 16px;
  border: 1px solid rgba(131, 127, 124, 0.56);
  background: linear-gradient(180deg, rgba(76, 76, 82, 0.96), rgba(59, 58, 63, 0.96));
  color: #efe8de;
  font-weight: 700;
  text-align: center;
  border-radius: 4px;
  cursor: pointer;
  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease;
}

.menu-button:hover {
  transform: translateY(-1px);
  background: linear-gradient(180deg, rgba(91, 92, 98, 0.98), rgba(66, 66, 72, 0.98));
}

.menu-button-primary {
  border-color: rgba(255, 172, 86, 0.55);
  background: linear-gradient(180deg, rgba(113, 82, 49, 0.96), rgba(89, 60, 34, 0.98));
}

.home-stats-menu {
  margin-top: 16px;
}

.home-stats-menu .stat-row {
  background: rgba(26, 27, 31, 0.74);
  border-color: rgba(255, 174, 90, 0.14);
}

.home-stats-menu .stat-row strong {
  color: #fff4e4;
}

.home-stats-menu .stat-row span {
  color: rgba(232, 221, 208, 0.72);
}

.home-stats,
.summary-stats {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.stat-row,
.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 15px 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(212, 203, 192, 0.6);
}

.stat-row span:first-child,
.summary-row span:first-child {
  color: var(--text-soft);
}

.stat-row strong,
.summary-row strong {
  font-size: 1.05rem;
}

.flow-steps {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.flow-step {
  padding: 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(212, 203, 192, 0.6);
}

.feature-panel-dark .flow-step,
.feature-panel-dark .unit-card-home {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 181, 99, 0.12);
}

.flow-step span {
  display: inline-flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
}

.flow-step strong {
  display: block;
  margin-top: 12px;
  font-size: 1.08rem;
}

.flow-step p,
.unit-card-home p,
.practice-card p,
.question-explanation,
.player-meta,
.choice-button,
.directions-panel {
  color: var(--text-soft);
}

.unit-preview-panel {
  margin-top: 20px;
}

.section-heading {
  justify-content: space-between;
  margin-bottom: 18px;
}

.home-unit-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.unit-card-home {
  padding: 18px;
  border-radius: var(--radius-md);
  background: white;
  border: 1px solid rgba(212, 203, 192, 0.85);
}

.unit-card-home strong {
  display: block;
  margin-bottom: 8px;
}

.feature-panel-dark .unit-card-home strong {
  color: #fff0dc;
}

.select-header {
  display: grid;
  gap: 16px;
  margin-bottom: 20px;
  padding: 26px 28px;
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(29, 30, 34, 0.94), rgba(17, 18, 22, 0.92)),
    rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 176, 92, 0.18);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

.select-header h1 {
  color: #fff2e1;
}

.select-header .hero-copy {
  color: rgba(232, 222, 210, 0.74);
}

.link-button,
.icon-link,
.inline-action,
.directions-button {
  border: 0;
  background: transparent;
  color: rgba(240, 225, 206, 0.74);
  cursor: pointer;
  padding: 0;
  font-weight: 600;
}

.inline-action-active {
  color: var(--accent);
}

.view-select .feature-panel {
  background:
    linear-gradient(180deg, rgba(29, 30, 34, 0.94), rgba(17, 18, 22, 0.92)),
    rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 176, 92, 0.18);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

.view-select .feature-panel h2,
.view-select .practice-card h3 {
  color: #fff0dc;
}

.view-select .feature-panel p,
.view-select .summary-row span:first-child {
  color: rgba(232, 222, 210, 0.72);
}

.view-select .summary-row,
.view-select .stat-row {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 181, 99, 0.12);
}

.view-select .summary-row strong,
.view-select .stat-row strong {
  color: #fff2df;
}

.select-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) 360px;
  gap: 20px;
}

.builder-panel {
  padding: 28px;
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, rgba(29, 30, 34, 0.94), rgba(17, 18, 22, 0.92)),
    rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 176, 92, 0.18);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

.builder-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  color: rgba(234, 224, 212, 0.72);
  font-size: 0.9rem;
  font-weight: 600;
}

.field input,
.field select {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 175, 92, 0.16);
  background: rgba(9, 10, 12, 0.44);
  color: #f5ebde;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.field input::placeholder {
  color: rgba(208, 196, 182, 0.46);
}

.field select option {
  background: #1d1f24;
  color: #f4eadf;
}

.toggle-row {
  margin-top: 18px;
}

.checkbox {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: rgba(235, 225, 215, 0.74);
}

.checkbox input {
  width: 16px;
  height: 16px;
}

.builder-actions {
  margin-top: 22px;
}

.select-sidebar {
  display: grid;
  gap: 20px;
}

.practice-cards {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.practice-card {
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 181, 99, 0.12);
}

.practice-card h3 {
  color: #fff0dc;
}

.practice-card p {
  color: rgba(230, 220, 209, 0.72);
}

.recommendation-card {
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 181, 99, 0.12);
}

.recommendation-card strong {
  display: block;
  color: #fff0dc;
  margin-bottom: 6px;
}

.recommendation-card p {
  margin: 0;
  color: rgba(232, 222, 210, 0.72);
}

.view-player {
  min-height: 100vh;
  background:
    radial-gradient(circle at 14% 20%, rgba(99, 156, 215, 0.12), transparent 18%),
    radial-gradient(circle at 80% 8%, rgba(255, 142, 34, 0.14), transparent 18%),
    linear-gradient(180deg, #0f1216 0%, #1a1715 100%);
}

.player-topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 18px;
  align-items: center;
  padding: 20px 28px 14px;
  background: rgba(18, 19, 23, 0.92);
  border-bottom: 1px solid rgba(255, 176, 92, 0.16);
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

.player-nav-left,
.player-tools {
  display: flex;
  gap: 18px;
  align-items: center;
}

.player-nav-left {
  justify-self: start;
}

.player-tools {
  justify-self: end;
}

.player-counter,
.player-meta {
  color: rgba(238, 226, 213, 0.68);
}

.player-timer-wrap {
  justify-self: center;
  display: grid;
  gap: 8px;
  justify-items: center;
}

.timer-display {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #fff1df;
}

.circle-button {
  width: 42px;
  height: 42px;
  border-color: rgba(255, 181, 99, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #f4eadf;
}

.pill-button,
.tool-button,
.session-chip {
  padding: 11px 16px;
  background: linear-gradient(180deg, rgba(68, 70, 76, 0.96), rgba(48, 49, 55, 0.96));
  border-color: rgba(255, 181, 99, 0.16);
  color: #f3e9de;
}

.tool-button-active {
  background: linear-gradient(180deg, rgba(110, 82, 50, 0.98), rgba(80, 56, 33, 0.98));
  color: #fff3e1;
  border-color: rgba(255, 180, 99, 0.24);
}

.score-pills {
  display: inline-flex;
  overflow: hidden;
  border-radius: 999px;
  border: 1px solid rgba(255, 181, 99, 0.14);
  background: rgba(11, 12, 14, 0.46);
}

.score-pill {
  min-width: 66px;
  padding: 11px 14px;
  text-align: center;
  font-weight: 800;
}

.score-pill-warm {
  color: #ffb163;
  background: rgba(107, 62, 22, 0.54);
}

.score-pill-cool {
  color: #8ad3ff;
  background: rgba(24, 67, 98, 0.52);
}

.directions-panel {
  margin: 16px auto 0;
  width: min(1100px, calc(100% - 40px));
  padding: 16px 20px;
  border-radius: var(--radius-md);
  background: rgba(18, 19, 23, 0.82);
  border: 1px solid rgba(255, 176, 92, 0.12);
  color: rgba(235, 224, 212, 0.78);
}

.hidden {
  display: none !important;
}

.player-main {
  width: min(1100px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 120px;
}

.question-stage {
  background:
    linear-gradient(180deg, rgba(29, 30, 34, 0.96), rgba(18, 18, 22, 0.95)),
    rgba(0, 0, 0, 0.42);
  border: 1px solid rgba(255, 176, 92, 0.16);
  border-radius: 28px;
  padding: 38px 42px 32px;
  box-shadow: 0 24px 54px rgba(0, 0, 0, 0.34);
}

.question-stage-top {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
}

.question-prompt {
  margin-top: 22px;
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  font-size: clamp(1.45rem, 2vw, 2.15rem);
  line-height: 1.55;
  color: #fff2e2;
}

.question-prompt p {
  margin: 0 0 18px;
}

.question-prompt table {
  width: 100%;
  margin-top: 14px;
  border-collapse: collapse;
}

.question-prompt th,
.question-prompt td {
  padding: 12px 14px;
  border: 1px solid rgba(255, 179, 99, 0.12);
  font-size: 0.98rem;
  text-align: left;
  color: rgba(244, 234, 223, 0.88);
  background: rgba(255, 255, 255, 0.03);
}

.choice-list-player {
  margin-top: 28px;
}

.choice-list {
  display: grid;
  gap: 16px;
}

.choice-button {
  width: 100%;
  padding: 19px 22px;
  border-radius: 20px;
  border: 2px solid rgba(255, 178, 98, 0.18);
  background: linear-gradient(180deg, rgba(45, 47, 52, 0.96), rgba(26, 27, 31, 0.96));
  text-align: left;
  font-size: 1.08rem;
  line-height: 1.6;
  cursor: pointer;
  color: rgba(245, 235, 225, 0.9);
}

.choice-button strong {
  display: inline-flex;
  width: 42px;
  height: 42px;
  margin-right: 16px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid rgba(255, 186, 111, 0.24);
  color: #fff1de;
  background: rgba(255, 255, 255, 0.03);
}

.choice-button.selected {
  border-color: rgba(138, 211, 255, 0.6);
  box-shadow: 0 0 0 4px rgba(72, 148, 197, 0.16);
}

.choice-button.correct {
  border-color: rgba(79, 188, 137, 0.72);
  background: linear-gradient(180deg, rgba(27, 73, 55, 0.92), rgba(20, 45, 36, 0.96));
}

.choice-button.incorrect {
  border-color: rgba(222, 108, 108, 0.72);
  background: linear-gradient(180deg, rgba(91, 39, 39, 0.92), rgba(57, 25, 25, 0.96));
}

.player-feedback {
  margin-top: 24px;
  padding: 18px 20px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 181, 99, 0.12);
}

.confidence-panel,
.explanation-tools {
  margin-top: 20px;
  padding: 16px 18px;
}

.confidence-options,
.explanation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.confidence-button,
.review-button {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 181, 99, 0.14);
  background: linear-gradient(180deg, rgba(67, 69, 74, 0.96), rgba(48, 49, 54, 0.96));
  color: #f4eadf;
  cursor: pointer;
  font-weight: 700;
}

.confidence-button.active,
.review-button.active {
  border-color: rgba(138, 211, 255, 0.46);
  background: rgba(43, 91, 121, 0.24);
}

.study-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.player-feedback strong {
  color: #fff0dc;
}

.player-feedback p {
  margin: 0 0 12px;
  line-height: 1.7;
  color: rgba(233, 223, 212, 0.78);
}

.player-feedback p:last-child {
  margin-bottom: 0;
}

.question-explanation {
  display: grid;
  gap: 12px;
}

.question-explanation p {
  margin: 0;
}

.question-explanation strong {
  color: #fff0dc;
}

.player-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 18px 24px;
  background: rgba(18, 19, 23, 0.94);
  border-top: 1px solid rgba(255, 176, 92, 0.14);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.session-chip {
  background: #161616;
  color: white;
  border-color: transparent;
}

.session-chip.tool-button-active {
  background: linear-gradient(135deg, #24212c, #3a3151);
  color: white;
}

.session-menu {
  position: fixed;
  left: 24px;
  bottom: 92px;
  width: min(420px, calc(100vw - 48px));
  max-height: 60vh;
  overflow: hidden;
  border-radius: 22px;
  background: rgba(18, 19, 23, 0.98);
  border: 1px solid rgba(255, 176, 92, 0.16);
  box-shadow: 0 24px 54px rgba(0, 0, 0, 0.34);
  z-index: 35;
}

.session-menu-header,
.overlay-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.session-menu-header {
  padding: 18px 18px 12px;
}

.session-menu-list {
  display: grid;
  gap: 8px;
  max-height: calc(60vh - 64px);
  overflow: auto;
  padding: 0 18px 18px;
}

.session-jump-button {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(255, 181, 99, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  text-align: left;
  cursor: pointer;
  color: #fff0dc;
}

.session-jump-button.active {
  border-color: rgba(138, 211, 255, 0.48);
  box-shadow: 0 0 0 3px rgba(72, 148, 197, 0.14);
}

.session-jump-button strong {
  display: block;
  margin-bottom: 4px;
}

.session-jump-meta {
  font-size: 0.88rem;
  color: rgba(231, 221, 210, 0.66);
}

.session-jump-status {
  display: inline-flex;
  margin-top: 8px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(235, 225, 214, 0.7);
  font-size: 0.78rem;
  font-weight: 700;
}

.session-jump-status.done {
  background: rgba(39, 103, 74, 0.56);
  color: #8ff0bc;
}

.overlay-panel {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 42;
}

.overlay-card {
  position: absolute;
  width: min(920px, calc(100vw - 48px));
  background:
    linear-gradient(180deg, rgba(29, 30, 34, 0.97), rgba(17, 18, 22, 0.95)),
    rgba(0, 0, 0, 0.4);
  border-radius: 28px;
  border: 1px solid rgba(255, 176, 92, 0.16);
  box-shadow: 0 24px 54px rgba(0, 0, 0, 0.34);
  padding: 24px;
  pointer-events: auto;
  resize: both;
  overflow: auto;
  min-width: 340px;
  min-height: 220px;
}

.calculator-card {
  width: min(460px, calc(100vw - 48px));
  min-height: 520px;
}

.formula-card {
  width: min(760px, calc(100vw - 48px));
  height: min(72vh, 760px);
  min-height: 420px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 18px;
}

.overlay-drag-handle {
  cursor: move;
  user-select: none;
}

.overlay-drag-handle .button {
  cursor: pointer;
}

.calculator-status {
  margin-top: 10px;
  color: rgba(233, 223, 212, 0.7);
  font-size: 0.92rem;
}

.calculator-display {
  width: 100%;
  margin-top: 16px;
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid rgba(255, 176, 92, 0.14);
  background: rgba(8, 10, 12, 0.52);
  font-size: 1.7rem;
  text-align: right;
  color: #fff3e1;
}

.calculator-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.calc-key {
  min-height: 56px;
  border-radius: 16px;
  border: 1px solid rgba(255, 179, 99, 0.12);
  background: linear-gradient(180deg, rgba(67, 69, 74, 0.96), rgba(48, 49, 54, 0.96));
  color: #f4eadf;
  cursor: pointer;
  font-weight: 700;
}

.calc-key-wide {
  grid-column: span 2;
}

.calc-key-equals {
  background: linear-gradient(135deg, var(--accent), #5e24ff);
  color: white;
  border-color: transparent;
}

.formula-frame {
  width: 100%;
  height: 100%;
  border: 1px solid rgba(255, 176, 92, 0.12);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.03);
}

.question-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.chip {
  display: inline-flex;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(232, 221, 208, 0.72);
  font-size: 0.8rem;
  font-weight: 700;
}

.difficulty-easy {
  background: #effcf3;
  color: #2b8f65;
}

.difficulty-medium {
  background: #eef8fd;
  color: #4b8fb0;
}

.difficulty-hard {
  background: #fff2e9;
  color: #cf7534;
}

.difficulty-extra-hard {
  background: #fcecf6;
  color: #b8427e;
}

.empty-message {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(255, 181, 99, 0.18);
  color: rgba(232, 222, 209, 0.72);
}

mxj-container,
mjx-container {
  font-size: 1em;
}

.question-prompt mjx-container,
.choice-button mjx-container,
.player-feedback mjx-container {
  white-space: normal;
}

@media (max-width: 1180px) {
  .home-grid,
  .select-layout {
    grid-template-columns: 1fr;
  }

  .home-scene {
    min-height: 860px;
  }

  .home-menu-panel {
    top: auto;
    right: 30px;
    bottom: 28px;
  }

  .home-unit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .player-topbar {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .player-nav-left,
  .player-tools {
    justify-self: center;
  }
}

@media (max-width: 820px) {
  .view-home,
  .view-select,
  .player-main,
  .directions-panel {
    width: min(100%, calc(100% - 20px));
  }

  .home-hero,
  .feature-panel,
  .builder-panel,
  .question-stage {
    padding: 22px;
  }

  .home-scene {
    min-height: auto;
    padding: 22px;
  }

  .home-hero {
    max-width: none;
    padding: 24px;
  }

  .home-menu-panel {
    position: relative;
    right: auto;
    bottom: auto;
    top: auto;
    width: 100%;
    margin-top: 24px;
  }

  .scene-rings,
  .scene-wave,
  .scene-pendulum,
  .scene-tower,
  .scene-coil,
  .scene-platform,
  .scene-formula {
    opacity: 0.45;
  }

  .home-unit-grid,
  .builder-grid {
    grid-template-columns: 1fr;
  }

  .question-stage-top,
  .player-footer,
  .section-heading {
    flex-direction: column;
    align-items: start;
  }

  .player-footer {
    position: static;
    margin-top: 18px;
  }

  .player-main {
    padding-bottom: 36px;
  }

  .choice-button {
    font-size: 1rem;
  }

  .overlay-card {
    left: 10px !important;
    top: 90px !important;
    width: calc(100vw - 20px) !important;
    max-width: none;
  }
}
