:root {
  --node-image-thumb-width: 161px;
  --node-image-thumb-height: 84px;
  --node-image-expanded-width: 437px;
  --node-image-expanded-height: 600px;
  --active-node-scale: 1.5;

  /* Theme variables — mapped to MD3 tokens from /css/shared.css */
  --main-text-color: var(--md-on-surface);
  --main-bg-color: var(--md-surface);
  --body-bg-gradient: var(--md-surface);
  --h1-color: var(--md-on-surface);
  --slider-track-bg: color-mix(in srgb, var(--md-on-surface) 8%, transparent);
  --slider-track-border: var(--md-outline-variant);
  --slider-thumb-border: var(--md-surface);
  --slider-thumb-bg: var(--md-primary);
  --counter-color: var(--md-on-surface-variant);
  --card-bg-glass: color-mix(in srgb, var(--md-surface-container-high) 30%, transparent);
  --card-border-glass: var(--md-outline-variant);
  --letter-grid-color: var(--md-on-surface-variant);

  --toggle-bg: color-mix(in srgb, var(--md-surface-container-high) 38%, transparent);
  --toggle-border: var(--md-outline-variant);
  --toggle-text: var(--md-on-surface);
  --presentation-bg: var(--md-surface-container-low);
  --node-content-bg: var(--md-surface-container);
  --node-content-border: var(--md-outline-variant);
  --node-subtitle-color: var(--md-on-surface-variant);
  --node-image-bg: color-mix(in srgb, var(--md-surface-container-high) 70%, transparent);
  --node-image-border: var(--md-outline-variant);
  --viewer-bg: color-mix(in srgb, var(--md-scrim) 68%, transparent);
  --viewer-frame-bg: var(--md-surface-container-high);
  --viewer-frame-border: var(--md-outline-variant);
  --path-node-bg: var(--md-surface-container-low);
  --path-node-border: var(--md-outline);
  --complete-node-bg: var(--md-success-container);
  --complete-node-border: var(--md-success);
  --link-stroke: color-mix(in srgb, var(--md-on-surface) 30%, transparent);

  color: var(--main-text-color);
  background: var(--main-bg-color);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

/* Dark scheme — MD3 tokens already flip, but keep explicit overrides for
   present-specific values that diverge from the standard surface scale. */
.dark {
  --presentation-bg: var(--md-surface-container-lowest);
  --viewer-bg: color-mix(in srgb, var(--md-scrim) 85%, transparent);
  --link-stroke: color-mix(in srgb, var(--md-on-surface) 20%, transparent);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--body-bg-gradient);
}

button {
  font: inherit;
}

body.image-viewer-open {
  overflow: hidden;
}

.app-shell {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  margin: 0;
}

h1 {
  margin: 0;
  color: var(--h1-color);
  font-size: clamp(1.6rem, 2.4vw, 2.7rem);
  line-height: 1.04;
  white-space: pre-line;
}

#nodeSlider {
  --slider-progress: 0%;
  appearance: none;
  width: 100%;
  height: 28px;
  margin: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}

#nodeSlider::-webkit-slider-runnable-track {
  height: 8px;
  border: 1px solid var(--slider-track-border);
  border-radius: 999px;
  background:
    linear-gradient(90deg, #183a4a 0 var(--slider-progress), var(--slider-track-bg) var(--slider-progress) 100%);
  box-shadow: inset 0 1px 2px rgba(24, 36, 42, 0.1);
}

#nodeSlider::-moz-range-track {
  height: 8px;
  border: 1px solid var(--slider-track-border);
  border-radius: 999px;
  background:
    linear-gradient(90deg, #183a4a 0 var(--slider-progress), var(--slider-track-bg) var(--slider-progress) 100%);
  box-shadow: inset 0 1px 2px rgba(24, 36, 42, 0.1);
}

#nodeSlider::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -7px;
  border: 3px solid var(--slider-thumb-border);
  border-radius: 999px;
  background: var(--slider-thumb-bg);
  box-shadow:
    0 4px 12px rgba(24, 36, 42, 0.2),
    0 0 0 1px rgba(161, 86, 43, 0.26);
}

#nodeSlider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 3px solid var(--slider-thumb-border);
  border-radius: 999px;
  background: var(--slider-thumb-bg);
  box-shadow:
    0 4px 12px rgba(24, 36, 42, 0.2),
    0 0 0 1px rgba(161, 86, 43, 0.26);
}

#nodeSlider:focus-visible {
  outline: none;
}

#nodeSlider:focus-visible::-webkit-slider-thumb {
  box-shadow:
    0 4px 12px rgba(24, 36, 42, 0.2),
    0 0 0 1px rgba(161, 86, 43, 0.26),
    0 0 0 4px rgba(216, 137, 79, 0.2);
}

#nodeSlider:focus-visible::-moz-range-thumb {
  box-shadow:
    0 4px 12px rgba(24, 36, 42, 0.2),
    0 0 0 1px rgba(161, 86, 43, 0.26),
    0 0 0 4px rgba(216, 137, 79, 0.2);
}

.counter {
  min-width: 48px;
  color: var(--counter-color);
  font-size: 0.94rem;
  font-weight: 800;
  text-align: right;
}

.readout-card {
  min-width: 0;
  border: 1px solid var(--card-border-glass);
  border-radius: 8px;
  background: var(--card-bg-glass);
}

/* ── Error state when no content is available ── */
.mindmap-error-message {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  font-size: 16px;
  color: #b91c1c;
  text-align: center;
  line-height: 1.6;
}

.readout-card {
  display: flex;
  align-items: stretch;
  min-height: 68px;
  padding: 0;
  gap: 0;
  overflow: hidden;
}

.readout-icon {
  display: grid;
  flex: 0 0 56px;
  place-items: center;
  padding: 10px 0;
  border-right: 1px solid rgba(24, 58, 74, 0.08);
}

.letter-grid {
  --letter-grid-size: 34px;
  --letter-grid-gap: 5px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: 1fr;
  place-items: center;
  width: var(--letter-grid-size);
  height: var(--letter-grid-size);
  gap: var(--letter-grid-gap);
  color: var(--letter-grid-color);
}

.letter-grid span {
  font-size: 0.7rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
}

.readout-card .node-content {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 100%;
  padding: 11px 18px 13px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  text-align: left;
  white-space: normal;
  place-items: start;
  align-content: center;
  transform: none;
}

.readout-card .node-subtitle,
.readout-card .node-title {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.readout-card .node-title {
  font-size: 1rem;
  line-height: 1.28;
}

/* ── Range input shared styles (used in bottom bar) ── */
.bottom-bar input[type="range"] {
  appearance: none;
  height: 22px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

.bottom-bar input[type="range"]::-webkit-slider-runnable-track {
  height: 7px;
  border: 1px solid var(--slider-track-border);
  border-radius: 999px;
  background: var(--slider-track-bg);
}

.bottom-bar input[type="range"]::-moz-range-track {
  height: 7px;
  border: 1px solid var(--slider-track-border);
  border-radius: 999px;
  background: var(--slider-track-bg);
}

.bottom-bar input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 17px;
  height: 17px;
  margin-top: -6px;
  border: 3px solid var(--slider-thumb-border);
  border-radius: 999px;
  background: #183a4a;
  box-shadow: 0 3px 10px rgba(24, 36, 42, 0.18);
}

.bottom-bar input[type="range"]::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border: 3px solid var(--slider-thumb-border);
  border-radius: 999px;
  background: #183a4a;
  box-shadow: 0 3px 10px rgba(24, 36, 42, 0.18);
}

.presentation-frame {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: 100%;
  height: 100%;
  min-height: 100vh;
  background: var(--presentation-bg);
}

.presentation-frame::before,
.presentation-frame::after,
#mindmap::before,
#mindmap::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
  z-index: 0;
  filter: blur(26px);
  opacity: 0.9;
  will-change: transform;
}

.presentation-frame::before {
  top: -12vh;
  left: -8vw;
  width: min(48vw, 760px);
  height: min(48vw, 760px);
  background:
    radial-gradient(circle, rgba(219, 233, 241, 0.6) 0%, rgba(219, 233, 241, 0.34) 24%, rgba(219, 233, 241, 0.12) 40%, rgba(255, 255, 255, 0) 64%);
  animation: background-orbit-a 18s linear infinite;
}

.presentation-frame::after {
  top: -12vh;
  right: -8vw;
  width: min(44vw, 700px);
  height: min(44vw, 700px);
  background:
    radial-gradient(circle, rgba(247, 228, 206, 0.58) 0%, rgba(247, 228, 206, 0.3) 24%, rgba(247, 228, 206, 0.12) 40%, rgba(255, 255, 255, 0) 64%);
  animation: background-orbit-b 21s linear infinite;
}

#mindmap::before,
#mindmap::after {
  z-index: -1;
}

#mindmap::before {
  bottom: -14vh;
  left: -6vw;
  width: min(28vw, 420px);
  height: min(28vw, 420px);
  background:
    radial-gradient(circle, rgba(224, 239, 233, 0.56) 0%, rgba(224, 239, 233, 0.3) 24%, rgba(224, 239, 233, 0.12) 40%, rgba(255, 255, 255, 0) 64%);
  animation: background-orbit-c 14s linear infinite;
}

#mindmap::after {
  right: -8vw;
  bottom: -16vh;
  width: min(24vw, 360px);
  height: min(24vw, 360px);
  background:
    radial-gradient(circle, rgba(241, 234, 215, 0.52) 0%, rgba(241, 234, 215, 0.28) 24%, rgba(241, 234, 215, 0.12) 40%, rgba(255, 255, 255, 0) 64%);
  animation: background-orbit-d 12s linear infinite;
}

.floating-ui {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 16px;
  pointer-events: none;
}

.floating-ui .readout-card {
  pointer-events: auto;
  max-width: 380px;
}

/* ── Bottom control bar ── */
.bottom-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  background: var(--card-bg-glass);
  border-top: 1px solid var(--card-border-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow: hidden;
  max-width: 100%;
  box-sizing: border-box;
}

.bottom-bar .node-scrubber {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 420px;
  height: auto;
  padding-right: 0;
  margin: 0;
}

.bottom-bar .node-scrubber input {
  flex: 1 1 auto;
  min-width: 80px;
}

.bottom-bar .counter {
  min-width: 48px;
  text-align: right;
  flex-shrink: 0;
}

.zoom-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 1;
  min-width: 0;
}

.zoom-group .zoom-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.zoom-group .zoom-row input {
  width: 64px;
  min-width: 40px;
}

.zoom-group .zoom-row strong {
  min-width: 38px;
  font-size: 0.85rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.zoom-label-icon {
  font-size: 18px;
  color: var(--counter-color);
  flex-shrink: 0;
}

/* ── Page flip arrows ── */
.page-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--toggle-border);
  border-radius: 8px;
  color: var(--toggle-text);
  background: var(--toggle-bg);
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 180ms var(--md-easing-standard), border-color 180ms var(--md-easing-standard);
}

.page-arrow:hover,
.page-arrow:focus-visible {
  border-color: rgba(216, 137, 79, 0.42);
  background: rgba(255, 255, 255, 0.62);
}

.page-arrow:focus-visible {
  outline: 3px solid rgba(216, 137, 79, 0.2);
  outline-offset: 2px;
}

.page-arrow .material-symbols-outlined {
  font-size: 20px;
}

#mindmap {
  display: block;
  position: relative;
  z-index: 1;
  overflow: hidden;
  width: 100%;
  height: 100%;
  overscroll-behavior: contain;
  touch-action: none;
  cursor: grab;
  user-select: none;
}

.map-layer,
.node-layer,
.link-layer {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
}

.map-layer {
  transition: transform 400ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.node-layer,
.link-layer {
  width: 100%;
  height: 100%;
}

.link-layer {
  overflow: visible;
  pointer-events: none;
}

@keyframes background-orbit-a {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }

  25% {
    transform: translate3d(28vw, -4vh, 0) scale(1.08);
  }

  50% {
    transform: translate3d(42vw, 20vh, 0) scale(0.96);
  }

  75% {
    transform: translate3d(10vw, 42vh, 0) scale(1.04);
  }

  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes background-orbit-b {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }

  25% {
    transform: translate3d(-28vw, -4vh, 0) scale(1.06);
  }

  50% {
    transform: translate3d(-42vw, 19vh, 0) scale(0.93);
  }

  75% {
    transform: translate3d(-10vw, 41vh, 0) scale(1.02);
  }

  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes background-orbit-c {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }

  25% {
    transform: translate3d(22vw, -34vh, 0) scale(1.08);
  }

  50% {
    transform: translate3d(40vw, -46vh, 0) scale(0.95);
  }

  75% {
    transform: translate3d(12vw, -8vh, 0) scale(1.04);
  }

  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes background-orbit-d {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }

  25% {
    transform: translate3d(-22vw, -34vh, 0) scale(1.06);
  }

  50% {
    transform: translate3d(-40vw, -44vh, 0) scale(0.95);
  }

  75% {
    transform: translate3d(-12vw, -8vh, 0) scale(1.03);
  }

  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
}

.node-measurer {
  position: fixed;
  top: -10000px;
  left: -10000px;
  visibility: hidden;
  pointer-events: none;
}

.node-measurer .node-content {
  width: max-content;
}

.mind-node {
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  place-items: center;
  opacity: 1;
  transform-origin: center;
  cursor: pointer;
  filter: drop-shadow(0 10px 18px rgb(24 38 44 / 0.1));
  transition:
    transform 400ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 400ms var(--md-easing-standard);
}

.mind-node:focus-visible {
  outline: none;
}

.mind-node:focus-visible .node-content,
.mind-node:hover .node-content {
  box-shadow:
    0 0 0 3px rgba(216, 137, 79, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.94);
}

.mind-node.camera-target .node-content {
  box-shadow:
    0 0 0 3px rgba(24, 58, 74, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.94);
}

.mind-node.entering {
  opacity: 1;
}

.mind-node.leaving {
  opacity: 0;
}

.node-content {
  display: grid;
  grid-auto-rows: max-content;
  place-items: center;
  gap: 3px;
  width: 100%;
  min-width: 146px;
  min-height: 57px;
  padding: 10px 23px 13px;
  border: 2px solid var(--node-content-border);
  border-radius: 8px;
  color: var(--main-text-color);
  background: var(--node-content-bg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  line-height: 1.25;
  text-align: center;
  white-space: nowrap;
  transform-origin: center;
  transform: scale(1);
  opacity: 1;
  transition:
    transform 400ms cubic-bezier(0.18, 1.08, 0.32, 1),
    opacity 400ms var(--md-easing-standard),
    background-color 200ms var(--md-easing-standard),
    border-color 200ms var(--md-easing-standard),
    border-width 200ms var(--md-easing-standard),
    color 200ms var(--md-easing-standard),
    box-shadow 200ms var(--md-easing-standard);
}

.node-subtitle {
  color: var(--node-subtitle-color);
  font-size: 14px;
  font-weight: 850;
  line-height: 1.1;
}

.node-content:not(.has-subtitle) .node-subtitle {
  display: none;
}

.node-title {
  color: inherit;
  font-size: 21px;
  font-weight: 800;
  line-height: 1.25;
}

.node-image {
  --node-image-width: var(--node-image-thumb-width);
  --node-image-max-height: var(--node-image-thumb-height);
  appearance: none;
  display: block;
  width: fit-content;
  height: auto;
  min-width: 42px;
  min-height: 0;
  max-width: var(--node-image-width);
  max-height: var(--node-image-max-height);
  margin-top: 4px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--node-image-border);
  border-radius: 7px;
  background: var(--node-image-bg);
  cursor: zoom-in;
  transform: scale(0.98);
  transform-origin: center;
  transition:
    opacity 400ms var(--md-easing-standard),
    transform 400ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 240ms var(--md-easing-standard),
    background-color 240ms var(--md-easing-standard);
}

.node-image:hover,
.node-image:focus-visible {
  border-color: rgba(216, 137, 79, 0.58);
  background: rgba(255, 255, 255, 0.86);
}

.node-image:focus-visible {
  outline: 3px solid rgba(216, 137, 79, 0.2);
  outline-offset: 2px;
}

.node-content:not(.has-node-image) .node-image {
  display: none;
}

.node-content.image-expanded .node-image {
  --node-image-width: min(70vw, var(--node-image-expanded-width));
  --node-image-max-height: var(--node-image-expanded-height);
  margin-top: 8px;
  transform: scale(1);
}

.node-content:not(.image-expanded) .node-image {
  width: var(--node-image-thumb-width);
  height: var(--node-image-thumb-height);
  max-width: var(--node-image-thumb-width);
  max-height: var(--node-image-thumb-height);
  transform: scale(0.98);
}

.node-image img {
  display: block;
  width: var(--node-image-width);
  height: auto;
  max-width: var(--node-image-width);
  max-height: var(--node-image-max-height);
  object-fit: contain;
  transform: scale(1);
  transition:
    transform 400ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 400ms var(--md-easing-standard);
}

.node-content:not(.image-expanded) .node-image img {
  height: var(--node-image-thumb-height);
  object-fit: cover;
  transform: scale(0.96);
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: clamp(18px, 4vw, 54px);
  background: var(--viewer-bg);
  opacity: 0;
  pointer-events: none;
  cursor: zoom-out;
  backdrop-filter: blur(6px);
  transition: opacity 240ms var(--md-easing-standard);
}

.image-viewer.open {
  opacity: 1;
  pointer-events: auto;
}

.image-viewer-frame {
  position: relative;
  display: grid;
  place-items: center;
  width: fit-content;
  height: fit-content;
  max-width: min(92vw, 1280px);
  max-height: min(84vh, 900px);
  padding: clamp(12px, 2vw, 22px);
  border: 1px solid var(--viewer-frame-border);
  border-radius: 8px;
  background: var(--viewer-frame-bg);
  box-shadow: 0 28px 80px rgba(5, 12, 16, 0.36);
  transform: scale(0.965);
  transition: transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
}

.image-viewer.open .image-viewer-frame {
  transform: scale(1);
}

.image-viewer-img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(88vw, 1220px);
  max-height: min(80vh, 840px);
  object-fit: contain;
  cursor: zoom-in;
  transition: transform 120ms var(--md-easing-standard);
  user-select: none;
  -webkit-user-drag: none;
  /* Claim touch gestures so pinch/pan zooms the image instead of the browser
     interpreting the pinch as a page zoom. */
  touch-action: none;
}

.mind-node.active .node-content {
  transform: scale(var(--active-node-scale));
}

.mind-node.entering .node-content {
  opacity: 0;
  transform: scale(0.58);
}

.mind-node.path-node .node-content {
  border-color: var(--path-node-border);
  background: var(--path-node-bg);
}

.mind-node.complete-node .node-content {
  border-color: var(--complete-node-border);
  background: var(--complete-node-bg);
}

.mind-node.active .node-content {
  border-color: #d8894f;
  border-width: 3px;
  color: #ffffff;
  background: #183a4a;
  box-shadow:
    0 0 14px rgba(216, 137, 79, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.mind-node.active .node-subtitle {
  color: rgba(255, 255, 255, 0.72);
}

.mind-link {
  fill: none;
  stroke: var(--link-stroke);
  stroke-width: 3;
  stroke-linecap: round;
  opacity: 1;
  transition:
    opacity 240ms var(--md-easing-standard),
    stroke 240ms var(--md-easing-standard),
    stroke-width 240ms var(--md-easing-standard);
}

.mind-link.leaving {
  opacity: 0;
}

.mind-link.entering {
  animation: link-draw 400ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.mind-link.path-link {
  stroke: rgba(24, 58, 74, 0.74);
  stroke-width: 4;
}

@keyframes link-draw {
  0% {
    opacity: 0;
    stroke-dasharray: 0 1;
    stroke-dashoffset: 1;
  }

  20% {
    opacity: 1;
  }

  100% {
    opacity: 1;
    stroke-dasharray: 1 1;
    stroke-dashoffset: 0;
  }
}

/* Mid-range: tighten up spacing */
@media (max-width: 1100px) {
  .floating-ui {
    padding: 10px;
  }

  .floating-ui .readout-card {
    max-width: 300px;
  }

  .bottom-bar {
    padding: 8px 12px;
    gap: 8px;
  }

  .bottom-bar .node-scrubber {
    max-width: 280px;
  }

  .zoom-group {
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .zoom-group .zoom-row input {
    width: 52px;
  }
}

@media (max-width: 720px) {
  .floating-ui {
    padding: 8px;
  }

  .floating-ui .readout-card {
    max-width: 240px;
  }

  .bottom-bar {
    flex-direction: column;
    padding: 8px 12px;
    gap: 6px;
  }

  .bottom-bar .node-scrubber {
    max-width: 100%;
  }

  .zoom-group {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
  }

  .zoom-group .zoom-row input {
    width: 48px;
    min-width: 36px;
  }

  .zoom-group .zoom-row strong {
    min-width: 32px;
    font-size: 0.78rem;
  }

  .readout-card {
    min-height: 54px;
  }

  .readout-card .node-content {
    padding: 8px 12px 10px;
  }

  .readout-card .node-title {
    font-size: 0.88rem;
  }

  .readout-icon {
    flex-basis: 44px;
  }

  h1 {
    font-size: 1.55rem;
  }

  .counter {
    min-width: 54px;
    font-size: 0.78rem;
  }

  /* Reduce decorative background blobs on mobile (performance + less visual noise) */
  .presentation-frame::before,
  .presentation-frame::after,
  #mindmap::before,
  #mindmap::after {
    opacity: 0.45;
  }

  /* Compact top bar for view page */
  .app-shell {
    padding-top: 40px !important;
  }

  /* Node image sizing on mobile */
  .node-content.image-expanded .node-image {
    --node-image-width: min(55vw, var(--node-image-expanded-width));
    --node-image-max-height: calc(var(--node-image-expanded-height) * 0.6);
  }
}

@media (prefers-reduced-motion: reduce) {
  .presentation-frame::before,
  .presentation-frame::after,
  #mindmap::before,
  #mindmap::after {
    animation: none;
  }
}

/* ── Navigation hint (auto-dismiss toast) ── */
.nav-hint {
  position: absolute;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  z-index: 20;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--card-bg-glass);
  border: 1px solid var(--card-border-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--counter-color);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 320ms var(--md-easing-standard), transform 320ms var(--md-easing-standard);
}

.nav-hint.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Preview toggle button ── */
.preview-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-right: 8px;
  border: 1px solid var(--toggle-border);
  border-radius: 8px;
  color: var(--toggle-text);
  background: var(--toggle-bg);
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 180ms var(--md-easing-standard), border-color 180ms var(--md-easing-standard);
}

.preview-toggle-btn:hover,
.preview-toggle-btn:focus-visible {
  border-color: rgba(216, 137, 79, 0.42);
  background: rgba(255, 255, 255, 0.62);
}

.preview-toggle-btn .material-symbols-outlined {
  font-size: 18px;
}
