
:root {
  --bg: #0b1020;
  --card: rgba(24, 28, 36, 0.94);
  --soft: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.13);
  --text: #e5edf8;
  --muted: #a8b3c7;
  --accent: #7dd3fc;
  --accent2: #fbbf24;
  --danger: #fb7185;
  --success: #4ade80;
  --warning: #fbbf24;
  --code: #050816;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(14, 165, 233, 0.22), transparent 35%),
    radial-gradient(circle at bottom right, rgba(250, 204, 21, 0.12), transparent 30%),
    var(--bg);
}

a { color: var(--accent); }

.side-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  width: 58px;
  height: 96px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(24, 28, 36, 0.72);
  color: var(--text);
  box-shadow: 0 18px 60px rgba(0,0,0,.28);
  backdrop-filter: blur(10px);
  font-size: 3.2rem;
  line-height: 1;
  padding: 0 0 .25rem;
  display: grid;
  place-items: center;
}

.side-nav-left { left: max(1rem, calc((100vw - 1240px) / 2)); }
.side-nav-right { right: max(1rem, calc((100vw - 1240px) / 2)); }

.side-nav:hover {
  background: rgba(37, 99, 235, 0.55);
  border-color: rgba(125, 211, 252, 0.6);
}

.side-nav:disabled {
  opacity: .25;
  cursor: not-allowed;
}

@media (max-width: 1180px) {
  .side-nav {
    width: 46px;
    height: 76px;
    font-size: 2.5rem;
  }
}

@media (hover: none), (pointer: coarse), (max-width: 760px) {
  .side-nav {
    display: none;
  }
}


.shell {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0;
}

.shell.narrow { width: min(860px, calc(100% - 2rem)); }

.site-header {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 1rem;
}

.header-side {
  display: grid;
  gap: .55rem;
  justify-items: end;
}


.eyebrow {
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 800;
  margin: 0 0 .4rem;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.2rem);
  line-height: 1;
  letter-spacing: -0.05em;
}

.muted { color: var(--muted); }

.header-meta {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  justify-content: end;
}

.notice-bar {
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 1rem;
  padding: .8rem 1rem;
  margin: 1rem 0;
  color: #fffbeb;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .75rem;
  margin: 1rem 0;
}

.stat-card, .toolbar, .study-card, .empty {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1.2rem;
  box-shadow: 0 18px 60px rgba(0,0,0,.22);
}

.stat-card {
  padding: .9rem;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: .82rem;
}

.stat-card strong {
  display: block;
  font-size: 1.8rem;
  margin-top: .2rem;
}

.toolbar {
  display: grid;
  grid-template-columns: 2fr 1.2fr 1fr 1.2fr auto;
  gap: .8rem;
  padding: 1rem;
  margin-bottom: 1rem;
  align-items: end;
}

label span {
  display: block;
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: .3rem;
}

input, select {
  width: 100%;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.07);
  color: var(--text);
  border-radius: .8rem;
  padding: .75rem .8rem;
  min-height: 44px;
}

option { color: #111827; }

.topline {
  height: 5px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

.card-body {
  padding: clamp(1.1rem, 4vw, 2.5rem);
  touch-action: pan-y;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: 1rem;
}

.badge, .pill {
  display: inline-flex;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.08);
  color: var(--text);
  border-radius: 999px;
  padding: .3rem .65rem;
  font-size: .78rem;
  align-items: center;
}

.badge.info { background: rgba(125,211,252,.18); border-color: rgba(125,211,252,.35); }
.pill.subtle { color: var(--muted); }

.question-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: .85rem;
  align-items: start;
  margin-bottom: 1rem;
}

.question-copy {
  min-width: 0;
}

.question {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  line-height: 1.12;
  letter-spacing: -0.035em;
  margin: 0 0 .7rem;
}

.schedule-note {
  color: var(--muted);
  margin-bottom: 0;
}

.reveal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  justify-content: flex-end;
  width: 100%;
  padding-top: .2rem;
}

.reveal-actions button {
  white-space: nowrap;
}

.panel {
  background: var(--soft);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1rem;
  margin: 1rem 0;
}

.panel h3 {
  margin: 0 0 .7rem;
}

.lead {
  font-size: 1.08rem;
  line-height: 1.55;
}

.codebox {
  background: var(--code);
  border: 1px solid rgba(125, 211, 252, 0.22);
  border-radius: .85rem;
  color: #dbeafe;
  padding: 1rem;
  overflow-x: auto;
  margin: .75rem 0 0;
}

.codebox code { white-space: pre; }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: 1rem;
}

.tag-pill {
  border: 1px solid var(--border);
  color: #cbd5e1;
  border-radius: 999px;
  padding: .22rem .58rem;
  font-size: .78rem;
}

.card-footer {
  padding: 1rem;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.08);
}

.control-layout {
  display: grid;
  gap: .7rem;
}

.control-section {
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(260px, 1.5fr);
  gap: .8rem;
  align-items: center;
  padding: .85rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: rgba(255,255,255,.035);
}

.control-section h3 {
  margin: 0 0 .25rem;
  font-size: .96rem;
}

.control-section p,
.progress-tools p,
.keyboard-help {
  margin: 0;
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.35;
}

.review-section {
  border-color: rgba(74,222,128,.25);
}

.control-buttons {
  display: grid;
  gap: .55rem;
}

.control-buttons.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.control-buttons.four { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

.progress-tools {
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: .85rem;
  background: rgba(255,255,255,.03);
}

.progress-tools summary {
  cursor: pointer;
  font-weight: 800;
}

.tool-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .7rem;
}

.keyboard-help {
  text-align: center;
}

button, .button-link {
  border: 1px solid var(--border);
  background: rgba(255,255,255,.08);
  color: var(--text);
  border-radius: 999px;
  padding: .72rem 1rem;
  min-height: 42px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 700;
}

button:hover, .button-link:hover { filter: brightness(1.15); }

button.primary { background: #2563eb; border-color: #60a5fa; }
button.secondary { background: rgba(255,255,255,.07); }
button.warning { background: rgba(251,191,36,.18); border-color: rgba(251,191,36,.5); }
button.danger { background: rgba(251,113,133,.16); border-color: rgba(251,113,133,.55); }
button.success { background: rgba(74,222,128,.2); border-color: rgba(74,222,128,.55); }
button.outline { background: transparent; }
button.small { padding: .45rem .7rem; min-height: 34px; font-size: .83rem; }

.choice-list {
  display: grid;
  gap: .6rem;
}

.choice-option {
  text-align: left;
  border-radius: .9rem;
  width: 100%;
}

.choice-option.correct {
  border-color: rgba(74,222,128,.8);
  background: rgba(74,222,128,.16);
}

.choice-option.incorrect {
  border-color: rgba(251,113,133,.8);
  background: rgba(251,113,133,.14);
}

.choice-feedback {
  margin: .75rem 0 0;
  color: var(--muted);
}

.hidden { display: none !important; }

.empty {
  text-align: center;
  padding: 3rem 1rem;
}

.prose {
  line-height: 1.7;
}

.prose h2 {
  margin-top: 1.5rem;
}

.site-footer {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto 2rem;
  color: var(--muted);
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
  font-size: .9rem;
}

@media (max-width: 900px) {
  .site-header { display: block; }
  .header-meta { justify-content: start; margin-top: 1rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .toolbar { grid-template-columns: 1fr; }
  .control-section {
    grid-template-columns: 1fr;
  }
  .control-buttons.four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .reveal-actions {
    justify-content: flex-start;
  }
  .tool-buttons {
    align-items: stretch;
  }
}

@media (max-width: 520px) {


  .shell { width: min(100% - 1rem, 1120px); padding-top: 1rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .control-buttons.two,
  .control-buttons.four {
    grid-template-columns: 1fr;
  }
  .reveal-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}


.deep-dive p {
  margin: 0 0 .75rem;
  line-height: 1.55;
}

.reference-list {
  display: grid;
  gap: .55rem;
  padding-left: 1.2rem;
}

.reference-list a {
  font-weight: 800;
}

.explain h4 {
  margin: 1rem 0 .55rem;
  color: var(--text);
}

.explain h4:first-child {
  margin-top: 0;
}


.danger-soft {
  border-color: rgba(248, 113, 113, 0.45);
  color: #fecaca;
}

.danger-soft:hover {
  border-color: rgba(248, 113, 113, 0.75);
}




/* Page controls: visible hamburger/dropdown on every viewport */
.page-menu {
  position: relative;
  justify-self: end;
  display: inline-block;
  z-index: 60;
}

.hamburger-button {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  gap: .45rem;
  align-items: center;
  min-height: 2.15rem;
  padding: .4rem .7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,.045);
  color: var(--text);
  font-weight: 800;
  font-size: .86rem;
  user-select: none;
}

.hamburger-button::-webkit-details-marker {
  display: none;
}

.hamburger-button:hover {
  border-color: rgba(125, 211, 252, 0.55);
  background: rgba(125, 211, 252, 0.12);
}

.hamburger-icon {
  font-size: 1rem;
  line-height: 1;
}

.page-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + .45rem);
  z-index: 70;
  min-width: 230px;
  display: grid;
  gap: .35rem;
  padding: .55rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: rgba(17, 24, 39, 0.98);
  box-shadow: 0 18px 60px rgba(0,0,0,.36);
}

.page-menu-panel button,
.page-menu-panel a {
  width: 100%;
  min-height: 2.35rem;
  border-radius: .75rem;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  text-align: left;
  text-decoration: none;
  padding: .55rem .65rem;
  font-weight: 800;
  font: inherit;
  cursor: pointer;
}

.page-menu-panel button:hover,
.page-menu-panel a:hover {
  border-color: rgba(125, 211, 252, 0.45);
  background: rgba(125, 211, 252, 0.12);
}

@media (max-width: 760px) {
  .page-menu {
    justify-self: start;
  }

  .hamburger-button {
    display: inline-flex;
  }
}

@media (max-width: 520px) {
  .page-menu {
    justify-self: stretch;
    width: 100%;
  }

  .hamburger-button {
    justify-content: center;
    width: 100%;
  }

  .page-menu-panel {
    left: 0;
    right: 0;
    min-width: 0;
  }
}


.walk-player {
  display: grid;
  grid-template-columns: 1.1fr auto;
  gap: 1rem;
  align-items: center;
  background: rgba(125, 211, 252, 0.08);
  border: 1px solid rgba(125, 211, 252, 0.22);
  border-radius: 1.2rem;
  padding: 1rem;
  margin: 0 0 1rem;
  box-shadow: 0 18px 60px rgba(0,0,0,.16);
}

.walk-copy h2 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.walk-copy p {
  margin: .35rem 0 0;
  color: var(--muted);
}

.walk-controls {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  justify-content: flex-end;
}

.icon-button {
  min-width: 2.7rem;
  padding-inline: .75rem;
}

.walk-options {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: .7rem;
  align-items: end;
}

.check-row {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-height: 44px;
  padding: .55rem .7rem;
  border: 1px solid var(--border);
  border-radius: .8rem;
  background: rgba(255,255,255,.045);
}

.check-row input {
  width: auto;
  min-height: 0;
}

.check-row span {
  margin: 0;
  color: var(--text);
  font-weight: 700;
}

.walk-status {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: .9rem;
}

@media (max-width: 860px) {
  .walk-player {
    grid-template-columns: 1fr;
  }

  .walk-controls {
    justify-content: flex-start;
  }

  .walk-options {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .walk-controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .walk-controls .primary {
    grid-column: 1 / -1;
  }

  .walk-options {
    grid-template-columns: 1fr;
  }
}


.walk-options select {
  min-width: 0;
}

.walk-options input[type="range"] {
  accent-color: var(--accent);
}


/* Keep the review score controls on one line where the viewport allows it. */
.review-section .control-buttons.four {
  display: grid;
  grid-template-columns: repeat(4, minmax(7.5rem, 1fr));
  gap: .55rem;
  width: 100%;
}

.review-section .control-buttons.four button {
  white-space: nowrap;
  min-width: 0;
}

@media (max-width: 620px) {
  .review-section .control-buttons.four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 360px) {
  .review-section .control-buttons.four {
    grid-template-columns: 1fr;
  }
}


.mobile-swipe-cue {
  display: none;
}

@media (max-width: 760px) {
  .shell {
    display: flex;
    flex-direction: column;
    width: min(100% - 1rem, 1120px);
    padding-top: .65rem;
  }

  .site-header {
    order: 0;
    margin-bottom: .65rem;
  }

  .study-card {
    order: 2;
    margin-bottom: .85rem;
  }

  #emptyState {
    order: 2;
  }

  .notice-bar {
    order: 2;
    margin: .35rem 0 .75rem;
    font-size: .88rem;
  }

  .stats-grid {
    order: 3;
  }

  .toolbar {
    order: 4;
  }

  .walk-player {
    order: 5;
  }

  .site-header h1 {
    font-size: clamp(1.85rem, 9vw, 2.45rem);
  }

  .site-header .muted {
    margin-bottom: 0;
  }

  .card-body {
    padding-top: 1rem;
  }

  .badges {
    margin-bottom: .65rem;
  }

  .mobile-swipe-cue {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .45rem;
    margin: -.15rem 0 .75rem;
    padding: .45rem .6rem;
    border: 1px dashed rgba(125, 211, 252, 0.45);
    border-radius: 999px;
    color: var(--muted);
    background: rgba(125, 211, 252, 0.08);
    font-size: .78rem;
    text-align: center;
  }

  .mobile-swipe-cue strong {
    color: var(--text);
    font-size: .78rem;
    font-weight: 800;
  }

  .question-row {
    gap: .85rem;
  }

  .question {
    margin-top: 0;
  }

  .reveal-actions {
    margin-top: .1rem;
  }
}

@media (max-width: 520px) {
  .notice-bar {
    display: none;
  }

  .mobile-swipe-cue {
    border-radius: .85rem;
  }

  .mobile-swipe-cue span {
    white-space: nowrap;
  }
}


.mobile-walk-bar {
  display: none;
}

@media (max-width: 760px) {
  .mobile-walk-bar {
    order: 1;
    display: grid;
    grid-template-columns: repeat(5, minmax(2.35rem, 1fr)) auto;
    gap: .35rem;
    align-items: center;
    padding: .45rem;
    margin: 0 0 .65rem;
    border: 1px solid rgba(125, 211, 252, 0.24);
    border-radius: 999px;
    background: rgba(24, 28, 36, 0.94);
    box-shadow: 0 12px 36px rgba(0,0,0,.22);
    position: sticky;
    top: .35rem;
    z-index: 45;
  }

  .mobile-audio-btn {
    min-height: 2.2rem;
    border-radius: 999px;
    padding: .25rem .45rem;
    border: 1px solid var(--border);
    background: rgba(255,255,255,.06);
    color: var(--text);
    font-weight: 900;
    font-size: .95rem;
  }

  .mobile-audio-btn.primary-mini {
    border-color: rgba(125, 211, 252, 0.6);
    background: rgba(125, 211, 252, 0.18);
  }

  .mobile-audio-btn:disabled {
    opacity: .45;
  }

  .mobile-walk-mini-status {
    color: var(--muted);
    font-size: .74rem;
    white-space: nowrap;
    padding: 0 .35rem;
  }

  .study-card {
    order: 2;
  }

  #emptyState {
    order: 2;
  }

  .notice-bar {
    order: 3;
  }

  .stats-grid {
    order: 4;
  }

  .toolbar {
    order: 5;
  }

  .walk-player {
    order: 6;
  }
}

@media (max-width: 420px) {
  .mobile-walk-bar {
    grid-template-columns: repeat(5, 1fr);
    border-radius: 1rem;
  }

  .mobile-walk-mini-status {
    grid-column: 1 / -1;
    text-align: center;
    padding-top: .1rem;
  }
}


.tap-guard-panel {
  pointer-events: auto;
  -webkit-user-select: none;
  user-select: none;
  position: fixed;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 100;
  width: min(92vw, 520px);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .85rem;
  align-items: center;
  padding: .85rem;
  border: 1px solid rgba(251, 191, 36, 0.45);
  border-radius: 1rem;
  background: rgba(17, 24, 39, 0.98);
  box-shadow: 0 24px 80px rgba(0,0,0,.45);
}

.tap-guard-panel strong {
  display: block;
  color: #fef3c7;
  margin-bottom: .15rem;
}

.tap-guard-panel p {
  margin: 0;
  color: var(--muted);
  font-size: .88rem;
}

.tap-guard-actions {
  display: flex;
  gap: .45rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.tap-guard-actions button {
  pointer-events: auto;
  touch-action: manipulation;
  min-height: 2.35rem;
  white-space: nowrap;
}

@media (max-width: 520px) {
  .tap-guard-panel {
  pointer-events: auto;
  -webkit-user-select: none;
  user-select: none;
    grid-template-columns: 1fr;
  }

  .tap-guard-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}


/* Full Walk Mode panel: tidy mobile transport controls. */
.walk-controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
}

.walk-btn-label {
  font-weight: 900;
}

@media (max-width: 760px) {
  .walk-player {
    gap: .85rem;
  }

  .walk-controls {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: .35rem;
    justify-content: stretch;
  }

  .walk-controls button {
    width: 100%;
    min-width: 0;
    min-height: 2.65rem;
    padding: .45rem .35rem;
    border-radius: .85rem;
    white-space: nowrap;
    font-size: .86rem;
  }

  .walk-controls .primary {
    grid-column: auto;
  }

  .walk-options {
    gap: .55rem;
  }

  .walk-options label,
  .walk-options .check-row {
    min-height: 2.75rem;
  }
}

@media (max-width: 520px) {
  .walk-controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .walk-controls .primary {
    grid-column: auto;
  }

  .walk-controls button {
    min-height: 2.75rem;
  }

  .walk-options {
    gap: .5rem;
  }
}

@media (max-width: 380px) {
  .walk-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


.screen-helper-video {
  position: fixed;
  width: 1px;
  height: 1px;
  right: 0;
  bottom: 0;
  opacity: 0.01;
  pointer-events: none;
}
