/* ---------- Original-text playback mode ---------- */

.story-dock {
  display: none;
  flex: 0 0 auto;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 14px;
  padding: 11px 16px 10px;
  color: #2b3b32;
  border-bottom: 1px solid rgba(89, 74, 48, 0.28);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.24), transparent 34%),
    repeating-linear-gradient(0deg, rgba(90, 73, 45, 0.025) 0 1px, transparent 1px 5px),
    #e9ddc6;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.16);
}

.is-presenting .story-dock {
  display: grid;
}

.story-document {
  position: relative;
  min-width: 0;
  padding-left: 17px;
  border-left: 2px solid #9d372b;
}

.story-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.story-seal {
  display: grid;
  width: 35px;
  height: 35px;
  flex: 0 0 35px;
  place-items: center;
  color: #f4e5c8;
  border: 1px solid rgba(248, 233, 205, 0.7);
  background: #a2372b;
  font-family: var(--font-display);
  font-size: 15px;
  line-height: 1;
  letter-spacing: 1px;
  box-shadow: inset 0 0 0 3px #a2372b, inset 0 0 0 4px rgba(248, 233, 205, 0.48);
}

.story-head-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 3px;
}

.story-overline {
  color: #857252;
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.story-head-copy strong {
  color: #3c4b3d;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1.1px;
  line-height: 1.25;
}

.story-progress {
  flex: 0 0 auto;
  color: #8b6c45;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.5px;
}

.story-body {
  position: relative;
  height: clamp(74px, 16vh, 126px);
  margin-top: 6px;
  padding: 2px 20px 1px 19px;
  overflow-y: auto;
  color: #263a31;
  font-family: var(--font-map);
  font-size: 15.5px;
  line-height: 1.72;
  letter-spacing: 0.3px;
  scrollbar-width: thin;
  scrollbar-color: rgba(120, 98, 63, 0.3) transparent;
  cursor: pointer;
}

.story-body:focus-visible {
  outline: 1px dashed rgba(157, 55, 43, 0.6);
  outline-offset: 3px;
}

.story-quote-mark {
  position: absolute;
  top: -12px;
  left: -3px;
  color: rgba(134, 102, 61, 0.32);
  font-family: Georgia, serif;
  font-size: 42px;
  line-height: 1;
}

.story-text {
  margin: 0;
  min-height: 1.7em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.story-text.is-typing::after {
  display: inline-block;
  width: 1px;
  height: 1.1em;
  margin-left: 3px;
  content: "";
  vertical-align: -0.16em;
  background: #9d372b;
  animation: storyCaret 0.8s steps(1) infinite;
}

.story-caret {
  display: none;
}

.story-analysis {
  margin-top: 5px;
  padding: 0 20px;
  color: #536052;
  font-size: 10.5px;
  line-height: 1.65;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 240ms ease, transform 240ms ease;
}

.story-analysis.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.story-analysis[hidden] {
  display: none;
}

.story-analysis > span {
  display: inline-block;
  margin-right: 6px;
  color: #916b40;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.6px;
}

.story-analysis p {
  display: inline;
  margin: 0;
}

.story-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 5px;
  padding: 0 20px;
  color: #8b7a60;
  font-size: 8.5px;
  letter-spacing: 0.3px;
}

.story-hint {
  color: #9b896b;
  white-space: nowrap;
}

.story-actions {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  min-width: 86px;
}

.story-btn {
  min-height: 33px;
  padding: 0 12px;
  color: #4b5145;
  border: 1px solid rgba(70, 80, 63, 0.28);
  background: rgba(249, 241, 224, 0.54);
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.7px;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.story-btn:hover:not(:disabled) {
  color: #26362d;
  border-color: rgba(157, 55, 43, 0.4);
  background: rgba(255, 249, 237, 0.88);
}

.story-btn:disabled {
  opacity: 0.32;
  cursor: default;
}

.story-btn--primary {
  color: #fff3dc;
  border-color: #8e2e24;
  background: #9d372b;
}

.story-btn--primary:hover:not(:disabled) {
  border-color: #742319;
  background: #aa4335;
}

.story-btn--ghost {
  background: transparent;
}

.is-presenting .timeline,
.is-presenting .present-exit,
.is-presenting .projection-caption {
  display: none !important;
}

/* Holding marks while the current paragraph is being typed. */
.map-stage.is-story-hold #enemyLayer .unit,
.map-stage.is-story-hold #plaLayer .unit,
.map-stage.is-story-hold #routeLayer .route-group {
  opacity: 0 !important;
  pointer-events: none !important;
}

.map-stage.is-story-hold .map3d-anchor.unit-label-wrap,
.map-stage.is-story-hold .map3d-anchor.route-label-wrap {
  display: none !important;
}

/* Markers gently illuminate when they land. */
.map-stage.is-story-landing .unit.is-focus,
.map-stage.is-story-landing .map3d-anchor.is-focus .unit3d {
  animation: storyMarkerLand 620ms ease both;
}

@keyframes storyCaret {
  0%,
  48% {
    opacity: 1;
  }
  49%,
  100% {
    opacity: 0;
  }
}

@keyframes storyMarkerLand {
  0% {
    opacity: 0.12;
    filter: brightness(1.6) saturate(0.6);
  }
  55% {
    opacity: 1;
    filter: brightness(1.15) saturate(1.08);
  }
  100% {
    opacity: 1;
    filter: none;
  }
}

@media (max-width: 900px) {
  .story-dock {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
    padding: 8px 10px;
  }

  .story-document {
    padding-left: 11px;
  }

  .story-body {
    height: 17vh;
    padding-right: 10px;
    padding-left: 13px;
    font-size: 13px;
    line-height: 1.65;
  }

  .story-actions {
    flex-direction: row;
  }

  .story-btn {
    flex: 1;
    min-height: 35px;
    font-size: 10px;
  }

  .story-foot {
    padding: 0 11px;
    font-size: 7.5px;
  }

  .story-hint {
    display: none;
  }

  .story-head-copy strong {
    font-size: 14px;
  }

  .story-overline {
    font-size: 6.5px;
  }
}

@media (max-width: 520px) {
  .story-seal {
    display: none;
  }

  .story-document {
    padding-left: 8px;
  }

  .story-progress {
    font-size: 8px;
  }

  .story-analysis {
    padding: 0 10px;
    font-size: 9.5px;
  }

  .story-body {
    height: 19vh;
    font-size: 12px;
  }
}

/* Presentation layout must override the responsive page rows. */
.is-presenting.app,
.is-presenting .app {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.is-presenting .workspace {
  flex: 1;
  height: auto;
  min-height: 0;
  overflow: hidden;
  grid-template-rows: minmax(0, 1fr) !important;
}

.is-presenting .map-shell {
  height: 100%;
  min-height: 0;
}

.story-btn {
  min-height: 38px;
}

@media (max-width: 760px) {
  .is-presenting .story-dock {
    max-height: 42dvh;
    overflow-y: auto;
  }

  .story-btn {
    min-height: 40px;
  }
}

body.is-presenting {
  overflow: hidden;
}

/* ---------- Readable, guided classroom playback ---------- */
.story-dock {
  grid-template-columns: minmax(0, 1fr) 154px;
  gap: 18px;
  padding: 16px 20px 14px;
  color: #1b2b23;
  border-bottom: 1px solid #8d7a5d;
  background: #eee3cf;
  box-shadow: none;
}

.story-document {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.75fr);
  grid-template-areas:
    "story-head story-head"
    "story-body story-analysis"
    "story-foot story-foot";
  min-height: 0;
  padding-left: 16px;
  border-left: 4px solid #a83e30;
}

.story-head {
  grid-area: story-head;
  gap: 12px;
}

.story-seal {
  width: 42px;
  height: 42px;
  flex-basis: 42px;
  border: 0;
  background: #a83e30;
  box-shadow: none;
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 700;
}

.story-overline {
  display: none;
}

.story-head-copy strong {
  color: #1d3026;
  font-family: var(--font-ui);
  font-size: 21px;
  letter-spacing: 0.2px;
}

.story-progress {
  color: #634f34;
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0;
}

.story-body {
  grid-area: story-body;
  height: clamp(200px, 34vh, 280px);
  margin-top: 10px;
  padding: 13px 17px;
  overflow-y: auto;
  color: #17291f;
  border: 1px solid rgba(85, 67, 42, 0.24);
  background: #f8f1e3;
  font-family: var(--font-ui);
  font-size: 25px;
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: 0;
}

.story-quote-mark {
  display: none;
}

.story-body:focus-visible {
  outline: 3px solid #a83e30;
  outline-offset: 2px;
}

.story-analysis {
  grid-area: story-analysis;
  margin: 10px 0 0 14px;
  padding: 13px 16px;
  color: #2f4035;
  border: 1px solid rgba(85, 67, 42, 0.2);
  background: #e3d7bf;
  font-size: 17px;
  line-height: 1.7;
  overflow-y: auto;
}

.story-analysis:not(.is-visible) {
  visibility: hidden;
}

.story-analysis > span {
  display: block;
  margin: 0 0 7px;
  color: #783e2d;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
}

.story-analysis p {
  display: block;
}

.story-foot {
  grid-area: story-foot;
  margin-top: 9px;
  padding: 0;
  color: #514c3f;
  font-size: 13px;
  letter-spacing: 0;
}

.story-flow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.story-flow b {
  color: #786f5f;
  font-size: 13px;
  font-weight: 600;
}

.story-flow b.is-active {
  color: #9b3328;
}

.story-flow b.is-past {
  color: #3f5c49;
}

.story-flow i {
  color: #9a8e78;
  font-style: normal;
}

.story-actions {
  gap: 8px;
  min-width: 0;
}

.story-btn {
  min-height: 46px;
  padding: 0 14px;
  color: #293b30;
  border-color: rgba(55, 67, 51, 0.4);
  border-radius: 5px;
  background: #f8f1e3;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
}

.story-btn--primary {
  color: #fff;
  border-color: #913226;
  background: #a83e30;
  font-size: 17px;
  font-weight: 700;
}

.story-btn--primary:hover:not(:disabled) {
  border-color: #7e281f;
  background: #b94a3a;
}

.story-btn--ghost {
  color: #5f6157;
  background: transparent;
}

.is-presenting.is-map-focus .story-dock {
  padding-top: 12px;
  padding-bottom: 11px;
}

.is-presenting.is-map-focus .story-body {
  height: 82px;
  padding-top: 7px;
  padding-bottom: 7px;
  font-size: 20px;
  line-height: 1.55;
  transition: height 220ms ease;
}

.is-presenting.is-map-focus .story-analysis {
  max-height: 82px;
  padding: 10px 14px;
  font-size: 15px;
  line-height: 1.5;
}

.is-presenting.is-map-focus .story-head-copy strong {
  font-size: 19px;
}

.is-presenting.is-map-focus .story-seal {
  width: 36px;
  height: 36px;
  flex-basis: 36px;
  font-size: 14px;
}

.is-presenting .timeline {
  display: flex !important;
  flex-basis: 96px;
}

.is-presenting .stage-nav-actions {
  display: none !important;
}

.is-presenting .timeline-intro {
  display: flex;
}

.is-presenting .map3d-hint,
.is-presenting .map3d-scalebar,
.is-presenting .map3d-elevation {
  display: none;
}

@media (max-width: 1100px) {
  .story-dock {
    grid-template-columns: minmax(0, 1fr) 136px;
    gap: 12px;
    padding: 13px 14px 12px;
  }

  .story-document {
    grid-template-columns: minmax(0, 1.5fr) minmax(240px, 0.8fr);
  }

  .story-head-copy strong {
    font-size: 19px;
  }

  .story-body {
    font-size: 21px;
  }

  .story-analysis {
    font-size: 14px;
  }

  .story-flow {
    display: none;
  }

  .is-presenting .timeline-intro {
    display: none;
  }
}

@media (max-width: 900px) {
  .story-dock {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .story-document {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "story-head"
      "story-body"
      "story-analysis"
      "story-foot";
  }

  .story-body {
    height: 140px;
    font-size: 20px;
  }

  .story-analysis {
    max-height: 108px;
    margin: 8px 0 0;
  }

  .story-actions {
    flex-direction: row;
  }

  .story-btn {
    min-height: 44px;
    font-size: 14px;
  }

  .story-btn--primary {
    font-size: 16px;
  }
}

@media (max-height: 850px) and (min-width: 761px) {
  .is-presenting.is-map-focus .story-dock {
    padding-top: 10px;
    padding-bottom: 8px;
  }

  .is-presenting.is-map-focus .story-body {
    height: clamp(180px, 28vh, 230px);
    font-size: 21px;
  }

  .is-presenting.is-map-focus .story-analysis {
    max-height: 72px;
    font-size: 14px;
  }

  .is-presenting.is-map-focus .story-btn {
    min-height: 40px;
    font-size: 14px;
  }

  .is-presenting.is-map-focus .story-btn--primary {
    font-size: 15px;
  }
}

@media (max-width: 760px) {
  .is-presenting .story-dock {
    max-height: 50dvh;
  }

  .is-presenting .timeline {
    flex-basis: 82px;
  }

  .story-seal {
    display: none;
  }

  .story-document {
    padding-left: 10px;
  }

  .story-head-copy strong {
    font-size: 17px;
  }

  .story-progress {
    font-size: 13px;
  }

  .story-body {
    height: 130px;
    font-size: 18px;
  }

  .story-analysis {
    font-size: 13px;
  }

  .story-analysis:not(.is-visible) {
    display: none;
  }

  .story-foot {
    font-size: 12px;
  }
}

/* ---------- Floating original-text window ---------- */
.map-shell {
  position: relative;
}

.is-presenting .stage-brief,
.is-presenting .map3d-views {
  display: none !important;
}

.is-presenting .story-dock {
  position: absolute;
  z-index: 120;
  top: 74px;
  left: 50%;
  display: grid;
  width: min(1180px, calc(100% - 40px));
  max-height: calc(100% - 160px);
  grid-template-columns: minmax(0, 1fr) 160px;
  gap: 18px;
  padding: 16px 18px 14px;
  overflow: auto;
  color: #2b3b32;
  border: 1px solid #927d5c;
  border-radius: 10px;
  background: #eee3cf;
  box-shadow:
    0 22px 60px rgba(0, 0, 0, 0.38),
    0 1px 0 rgba(255, 255, 255, 0.36) inset;
  transform: translateX(-50%);
  transition:
    width 260ms ease,
    padding 220ms ease,
    border-radius 220ms ease,
    opacity 180ms ease,
    transform 220ms ease;
}

.is-presenting .story-dock.is-collapsed {
  width: min(960px, calc(100% - 32px));
  max-height: none;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 9px 12px;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.34);
}

.is-presenting .story-dock.is-collapsed .story-document {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-left: 11px;
  border-left-width: 3px;
}

.is-presenting .story-dock.is-collapsed .story-head {
  flex: 1;
  gap: 9px;
}

.is-presenting .story-dock.is-collapsed .story-seal {
  width: 32px;
  height: 32px;
  flex-basis: 32px;
  font-size: 13px;
}

.is-presenting .story-dock.is-collapsed .story-head-copy strong {
  overflow: hidden;
  font-size: 18px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.is-presenting .story-dock.is-collapsed .story-progress {
  font-size: 14px;
}

.is-presenting .story-dock.is-collapsed .story-body,
.is-presenting .story-dock.is-collapsed .story-analysis,
.is-presenting .story-dock.is-collapsed .story-foot {
  display: none;
}

.is-presenting .story-dock.is-collapsed .story-actions {
  flex-direction: row;
  gap: 7px;
  min-width: 0;
}

.is-presenting .story-dock.is-collapsed .story-btn {
  min-height: 38px;
  padding: 0 11px;
  font-size: 13px;
  white-space: nowrap;
}

.is-presenting .story-dock.is-collapsed .story-btn--primary {
  font-size: 14px;
}

.story-toggle-btn {
  color: var(--gold-soft);
  border-color: rgba(214, 181, 119, 0.42);
  background: rgba(214, 181, 119, 0.1);
  font-weight: 700;
}

.story-toggle-btn:hover {
  color: #fff;
  border-color: var(--gold-soft);
  background: rgba(214, 181, 119, 0.2);
}

/* The floating window does not take layout height, so full reading size is kept. */
.is-presenting.is-map-focus .story-dock {
  padding: 16px 18px 14px;
}

.is-presenting.is-map-focus .story-body {
  height: clamp(200px, 34vh, 280px);
  padding: 13px 17px;
  font-size: 25px;
  line-height: 1.6;
}

.is-presenting.is-map-focus .story-analysis {
  max-height: none;
  padding: 13px 16px;
  font-size: 17px;
  line-height: 1.7;
}

.is-presenting.is-map-focus .story-head-copy strong {
  font-size: 21px;
}

.is-presenting.is-map-focus .story-seal {
  width: 42px;
  height: 42px;
  flex-basis: 42px;
  font-size: 16px;
}

.is-presenting .story-dock .story-btn {
  min-height: 46px;
  font-size: 15px;
}

.is-presenting .story-dock .story-btn--primary {
  font-size: 17px;
}

.is-presenting.is-map-focus .story-dock.is-collapsed {
  padding: 9px 12px;
}

.is-presenting .story-dock.is-collapsed .story-btn {
  min-height: 38px;
  font-size: 13px;
}

.is-presenting .story-dock.is-collapsed .story-btn--primary {
  font-size: 14px;
}

@media (max-width: 1100px) {
  .is-presenting .story-dock {
    top: 66px;
    width: calc(100% - 28px);
    grid-template-columns: minmax(0, 1fr) 142px;
    gap: 12px;
    padding: 13px 14px 12px;
  }

  .is-presenting .story-dock.is-collapsed {
    width: calc(100% - 26px);
    padding: 8px 10px;
  }

  .is-presenting .story-dock.is-collapsed .story-head-copy strong {
    font-size: 16px;
  }

  .is-presenting .story-dock.is-collapsed .story-progress {
    font-size: 13px;
  }

  .is-presenting .story-dock.is-collapsed .story-btn {
    min-height: 36px;
    padding: 0 9px;
    font-size: 12px;
  }

  .is-presenting .story-dock.is-collapsed .story-btn--primary {
    font-size: 13px;
  }
}

.is-presenting .story-dock.is-collapsed {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -12px) scale(0.985);
  transition:
    opacity 180ms ease,
    transform 220ms ease,
    visibility 0s linear 220ms;
}

.is-presenting.is-story-collapsed .stage-nav-actions {
  display: flex !important;
}

@media (max-width: 760px) {
  .is-presenting .story-dock {
    top: 66px;
    width: calc(100% - 16px);
    max-height: calc(100% - 130px);
    grid-template-columns: minmax(0, 1fr);
    padding: 10px 11px;
  }

  .story-toggle-btn {
    padding: 0 8px;
    font-size: 12px;
  }
}

/* ---------- Presentation dock ---------- */
.dock-group {
  display: contents;
}

.dock-stage-group,
.dock-divider,
.dock-exit-btn {
  display: none;
}

.is-presenting .map-toolbar {
  flex-basis: 74px;
  justify-content: center;
  padding: 8px 16px;
  border-bottom: 0;
  background: transparent;
}

.is-presenting .map-toolbar::after,
.is-presenting .toolbar-title,
.is-presenting .toolbar-legend {
  display: none;
}

.is-presenting .toolbar-actions {
  display: flex;
  align-items: center;
  max-width: calc(100vw - 24px);
  height: 58px;
  gap: 3px;
  padding: 7px 9px;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid rgba(238, 230, 210, 0.24);
  border-radius: 999px;
  background: rgba(13, 24, 19, 0.93);
  box-shadow:
    0 14px 38px rgba(0, 0, 0, 0.38),
    0 1px 0 rgba(255, 255, 255, 0.08) inset;
  scrollbar-width: none;
}

.is-presenting .toolbar-actions::-webkit-scrollbar {
  display: none;
}

.is-presenting .toolbar-actions > * {
  flex: 0 0 auto;
}

.is-presenting .dock-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.is-presenting .dock-stage-group {
  gap: 4px;
  padding: 0 2px;
}

.dock-arrow {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: var(--ui-text-soft);
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-family: var(--font-ui);
  font-size: 23px;
  line-height: 1;
  transition:
    color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.dock-arrow:hover:not(:disabled) {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.dock-arrow:disabled {
  opacity: 0.28;
  cursor: default;
}

.is-presenting:not(.is-story-collapsed) .dock-arrow {
  visibility: hidden;
  pointer-events: none;
}

.is-presenting.is-story-collapsed .dock-arrow {
  visibility: visible;
  pointer-events: auto;
}

.is-presenting:not(.is-story-collapsed) .dock-exit-btn {
  display: none;
}

.dock-stage-copy {
  display: flex;
  min-width: 68px;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  line-height: 1.1;
  white-space: nowrap;
}

.dock-stage-copy b {
  color: var(--gold-soft);
  font-family: var(--font-ui);
  font-size: 13px;
  letter-spacing: 0.3px;
}

.dock-stage-copy small {
  color: #fff;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
}

.is-presenting .dock-divider {
  display: block;
  width: 1px;
  height: 24px;
  margin: 0 4px;
  background: rgba(238, 230, 210, 0.18);
}

.is-presenting .toolbar-actions .tool-btn {
  height: 40px;
  padding: 0 12px;
  color: var(--ui-text-soft);
  border-color: transparent;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition:
    color 160ms ease,
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.is-presenting .toolbar-actions .tool-btn:hover {
  color: #fff;
  border-color: rgba(238, 230, 210, 0.18);
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

.is-presenting .toolbar-actions .tool-btn--icon {
  width: 34px;
  padding: 0;
  font-size: 20px;
}

.is-presenting .toolbar-actions .zoom-value {
  min-width: 40px;
  color: var(--ui-text-soft);
  font-size: 12px;
}

.is-presenting .toolbar-actions .tool-btn--mode {
  color: var(--gold-soft);
}

.is-presenting .toolbar-actions .story-toggle-btn {
  padding-right: 13px;
  padding-left: 8px;
  color: var(--gold-soft);
  border-color: rgba(214, 181, 119, 0.35);
  background: rgba(214, 181, 119, 0.1);
}

.is-presenting .toolbar-actions .story-toggle-btn:disabled {
  opacity: 0.52;
  cursor: default;
  transform: none;
}

.story-toggle-btn::before {
  display: grid;
  width: 22px;
  height: 22px;
  margin-right: 6px;
  place-items: center;
  content: "文";
  color: #f8e8cb;
  border-radius: 50%;
  background: #9d372b;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
}

.is-presenting #viewModeBtn::before {
  margin-right: 4px;
  content: "◇";
  color: var(--gold-soft);
}

.is-presenting #resetView::before {
  margin-right: 3px;
  content: "↺";
}

.is-presenting #layersBtn::before {
  margin-right: 4px;
  content: "▤";
  color: var(--gold-soft);
}

.is-presenting .dock-exit-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.is-presenting .dock-exit-btn::before {
  content: "×";
  font-size: 16px;
  line-height: 1;
}

.is-presenting .stage-nav-actions {
  display: none !important;
}

.is-presenting .story-dock {
  top: 82px;
}

@media (max-width: 1100px) {
  .is-presenting .map-toolbar {
    flex-basis: 68px;
    padding: 7px 10px;
  }

  .is-presenting .toolbar-actions {
    height: 54px;
    padding: 6px 8px;
  }

  .is-presenting .story-dock {
    top: 76px;
  }

  .dock-stage-copy {
    min-width: 58px;
  }

  .dock-stage-copy small {
    max-width: 70px;
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
  }

  .is-presenting .toolbar-actions .tool-btn {
    height: 36px;
    padding: 0 9px;
    font-size: 12px;
  }

  .is-presenting .toolbar-actions .tool-btn--icon {
    width: 30px;
  }

  .dock-arrow {
    width: 28px;
    height: 28px;
    font-size: 20px;
  }
}

@media (max-width: 760px) {
  .is-presenting .map-toolbar {
    flex-basis: 62px;
    padding: 6px 8px;
  }

  .is-presenting .toolbar-actions {
    height: 50px;
    max-width: calc(100vw - 16px);
    gap: 2px;
    padding: 5px 6px;
  }

  .is-presenting .story-dock {
    top: 66px;
  }

  .is-presenting .toolbar-actions .tool-btn {
    height: 34px;
    padding: 0 7px;
    font-size: 11px;
  }

  .is-presenting .toolbar-actions .tool-btn--icon {
    width: 27px;
    font-size: 17px;
  }

  .dock-stage-copy {
    min-width: 46px;
  }

  .dock-stage-copy b {
    font-size: 10px;
  }

  .dock-stage-copy small {
    max-width: 48px;
    font-size: 10px;
  }

  .dock-arrow {
    width: 24px;
    height: 24px;
    font-size: 18px;
  }

  .is-presenting .dock-divider {
    margin: 0 2px;
  }

  .story-toggle-btn::before {
    width: 18px;
    height: 18px;
    margin-right: 4px;
    font-size: 9px;
  }

  .is-presenting .toolbar-actions #zoomOut,
  .is-presenting .toolbar-actions #zoomIn,
  .is-presenting .toolbar-actions .zoom-value,
  .is-presenting .toolbar-actions #resetView,
  .is-presenting .dock-divider {
    display: none;
  }

  .is-presenting .dock-arrow {
    width: 44px;
    height: 44px;
  }
}

body.is-presenting.is-story-collapsed .stage-nav-actions {
  display: none !important;
}

/* ---------- Touch and low-power refinements ---------- */
button,
.timeline-step,
.layer-row {
  -webkit-tap-highlight-color: transparent;
}

button {
  touch-action: manipulation;
}

.story-body,
.story-analysis,
.dossier,
.layer-popover {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

@media (pointer: coarse), (any-pointer: coarse) {
  .tool-btn,
  .ghost-btn,
  .solid-btn,
  .story-btn,
  .stage-nav-btn,
  .map3d-views button,
  .dossier-close,
  .modal-close,
  .layer-head button {
    min-height: 44px;
  }

  .tool-btn--icon,
  .dossier-close,
  .modal-close,
  .layer-head button {
    min-width: 44px;
  }

  .dock-arrow {
    width: 40px;
    height: 40px;
  }

  .unit3d {
    min-height: 40px;
  }

  .layer-row {
    min-height: 48px;
  }

  .timeline-track {
    touch-action: pan-x;
    -webkit-overflow-scrolling: touch;
  }

  .map3d-anchor {
    will-change: auto;
  }

  .map-stage.mode-2d .unit-plate,
  .map-stage.mode-2d .route,
  .map-stage.mode-2d .checkpoint-box {
    filter: none;
  }

  .tooltip,
  .dossier,
  .layer-popover,
  .modal-backdrop,
  .map-zoom-badge,
  .mobile-map-hint {
    backdrop-filter: none !important;
  }

  .live-dot::after,
  .route-group.is-active .route--enemy,
  .route-group.is-active .route--ghost,
  .route-group.is-active .route--retreat,
  .checkpoint-pulse {
    animation: none !important;
  }

  .tool-btn:active,
  .dock-arrow:active,
  .story-btn:active,
  .stage-nav-btn:active,
  .ghost-btn:active,
  .solid-btn:active {
    transform: scale(0.97);
  }
}

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
    padding: 8px 10px;
  }

  .brand {
    gap: 8px;
  }

  .brand h1 {
    gap: 4px;
    font-size: 20px;
    letter-spacing: 0;
  }

  .brand h1 span {
    display: none;
  }

  .top-actions {
    gap: 6px;
  }

  .ghost-btn {
    display: inline-flex;
    width: 44px;
    height: 44px;
    min-height: 44px;
    flex: 0 0 44px;
    padding: 0;
    font-size: 0;
  }

  .ghost-btn::before {
    content: "?";
    font-family: var(--font-ui);
    font-size: 18px;
    font-weight: 700;
  }

  .solid-btn {
    height: 44px;
    min-height: 44px;
    padding: 0 12px;
    font-size: 14px;
    white-space: nowrap;
  }

  .solid-btn kbd {
    display: none;
  }

  .map-toolbar {
    flex-basis: 54px;
    gap: 5px;
    padding: 0 8px;
  }

  .toolbar-title {
    min-width: 0;
    flex: 0 1 auto;
    gap: 5px;
    font-size: 13px;
    white-space: nowrap;
  }

  .toolbar-code {
    display: none;
  }

  .toolbar-actions {
    min-width: 0;
    gap: 2px;
  }

  .tool-btn {
    height: 38px;
    min-width: 38px;
    padding: 0 6px;
    font-size: 12px;
  }

  .tool-btn--icon {
    width: 44px;
    min-width: 44px;
    padding: 0;
    font-size: 18px;
  }

  .zoom-value {
    min-width: 30px;
    font-size: 11px;
  }

  #resetView,
  #layersBtn {
    width: 44px;
    min-width: 44px;
    padding: 0;
    font-size: 0;
  }

  #resetView::before {
    margin: 0;
    content: "↺";
    font-size: 18px;
  }

  #layersBtn::before {
    margin: 0;
    content: "▤";
    font-size: 18px;
  }

  .stage-brief {
    display: block;
    padding: 11px 13px;
  }

  .stage-brief-meta {
    gap: 8px;
    font-size: 11px;
  }

  .stage-brief h2 {
    font-size: 20px;
  }

  .timeline-track {
    scroll-behavior: smooth;
    scrollbar-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .timeline-track {
    scroll-behavior: auto;
  }
}

/* ---------- Ant Design dark operating chrome ---------- */
:root {
  color-scheme: dark;
  --ant-primary: #1677ff;
  --ant-primary-hover: #4096ff;
  --ant-primary-active: #0958d9;
  --ant-primary-text: #7ab8ff;
  --ant-primary-soft: rgba(22, 119, 255, 0.16);
  --ant-primary-border: rgba(22, 119, 255, 0.42);
  --ant-danger: #ff7875;
  --ant-success: #73d13d;
  --ant-text: #ededed;
  --ant-text-secondary: #b6b6b6;
  --ant-text-tertiary: #9e9e9e;
  --ant-border: #3c3c3c;
  --ant-split: #2b2b2b;
  --ant-layout: #0d0d0d;
  --ant-container: #1a1a1a;
  --ant-elevated: #202020;
  --ant-fill: #242424;
  --ant-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

body {
  color: var(--ant-text);
  background: var(--ant-layout);
  font-family: var(--ant-font);
}

button,
input,
select,
textarea {
  font-family: var(--ant-font);
}

::selection {
  color: #fff;
  background: var(--ant-primary);
}

button:focus-visible,
summary:focus-visible,
input:focus-visible + .switch {
  outline: 2px solid rgba(64, 150, 255, 0.7);
  outline-offset: 2px;
}

.topbar {
  border-bottom-color: var(--ant-split);
  background: var(--ant-container);
  box-shadow: none;
}

.topbar::after {
  display: none;
}

.brand-seal {
  color: #fff;
  border: 0;
  border-radius: 8px;
  background: var(--ant-primary);
  box-shadow: none;
  font-family: var(--ant-font);
  font-size: 21px;
  font-weight: 600;
  transform: none;
}

.brand h1 {
  color: var(--ant-text);
  font-family: var(--ant-font);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.brand h1 span {
  color: var(--ant-text-tertiary);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
}

.command-meta {
  color: var(--ant-text-tertiary);
  font-size: 13px;
}

.meta-date {
  padding: 5px 9px;
  color: var(--ant-primary-text);
  border: 0;
  border-radius: 4px;
  background: var(--ant-primary-soft);
  font-family: var(--ant-font);
  font-size: 12px;
  font-weight: 500;
}

.meta-rule {
  background: var(--ant-split);
}

.ghost-btn,
.solid-btn {
  height: 40px;
  padding: 0 16px;
  border-radius: 6px;
  font-family: var(--ant-font);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  box-shadow: none;
}

.ghost-btn {
  color: var(--ant-text);
  border-color: var(--ant-border);
  background: var(--ant-container);
}

.ghost-btn:hover {
  color: var(--ant-primary-text);
  border-color: var(--ant-primary);
  background: var(--ant-container);
}

.solid-btn {
  color: #fff;
  border-color: var(--ant-primary);
  background: var(--ant-primary);
  box-shadow: 0 2px 0 rgba(5, 145, 255, 0.1);
}

.solid-btn:hover {
  color: #fff;
  border-color: var(--ant-primary-hover);
  background: var(--ant-primary-hover);
}

.solid-btn:active {
  border-color: var(--ant-primary-active);
  background: var(--ant-primary-active);
}

.solid-btn kbd {
  color: rgba(255, 255, 255, 0.85);
  border-color: rgba(255, 255, 255, 0.45);
  border-radius: 3px;
}

.workspace {
  background: var(--ant-layout);
}

.map-shell {
  border-color: var(--ant-split);
  border-radius: 8px;
  background: var(--ant-container);
  box-shadow: none;
}

.map-toolbar {
  border-bottom-color: var(--ant-split);
  background: var(--ant-container);
}

.toolbar-title {
  color: var(--ant-text);
  font-family: var(--ant-font);
  font-size: 15px;
  font-weight: 600;
}

.live-dot {
  background: var(--ant-primary);
}

.toolbar-code {
  color: var(--ant-text-tertiary);
  border-left-color: var(--ant-split);
  font-family: var(--ant-font);
  font-size: 12px;
}

.toolbar-legend {
  color: var(--ant-text-secondary);
  font-family: var(--ant-font);
  font-size: 14px;
}

.legend-dot--red {
  background: #d4380d;
  box-shadow: none;
}

.legend-dot--blue {
  background: #475e6b;
  box-shadow: none;
}

.tool-btn {
  color: var(--ant-text-secondary);
  border-color: transparent;
  border-radius: 6px;
  font-family: var(--ant-font);
  font-size: 14px;
}

.tool-btn:hover,
.tool-btn[aria-expanded="true"] {
  color: var(--ant-primary-text);
  border-color: transparent;
  background: var(--ant-primary-soft);
}

.tool-btn--mode {
  color: var(--ant-primary-text);
  border-color: var(--ant-primary-border);
  background: var(--ant-primary-soft);
}

.tool-btn--mode:hover {
  color: var(--ant-primary-text);
  border-color: var(--ant-primary);
  background: var(--ant-primary-soft);
}

.zoom-value {
  color: var(--ant-text-tertiary);
  font-family: var(--ant-font);
}

.map-stage {
  background: #101a17;
}

.stage-brief {
  color: var(--ant-text);
  border: 1px solid var(--ant-split);
  border-left: 3px solid var(--ant-primary);
  border-radius: 8px;
  background: rgba(26, 26, 26, 0.97);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.stage-brief-meta {
  font-family: var(--ant-font);
}

.stage-brief-meta span:first-child {
  color: var(--ant-primary-text);
}

.stage-brief-meta span:last-child {
  color: var(--ant-text-tertiary);
}

.stage-brief h2 {
  color: var(--ant-text);
  font-family: var(--ant-font);
  font-weight: 600;
  letter-spacing: 0;
}

.stage-brief p {
  color: var(--ant-text-secondary);
}

.map-zoom-badge {
  color: var(--ant-text-secondary);
  border-color: var(--ant-split);
  border-radius: 6px;
  background: rgba(26, 26, 26, 0.94);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.zoom-crosshair {
  border-color: var(--ant-primary);
}

.zoom-crosshair::before,
.zoom-crosshair::after {
  background: var(--ant-primary);
}

.map3d-views {
  border-color: var(--ant-split);
  border-radius: 8px;
  background: rgba(26, 26, 26, 0.96);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.map3d-views > span {
  color: var(--ant-text-tertiary);
  font-family: var(--ant-font);
}

.map3d-views button {
  color: var(--ant-text-secondary);
  border-radius: 4px;
  font-family: var(--ant-font);
}

.map3d-views button:hover {
  color: var(--ant-primary-text);
  background: var(--ant-primary-soft);
}

.map3d-views button.is-active {
  color: var(--ant-primary-text);
  border-color: var(--ant-primary-border);
  background: var(--ant-primary-soft);
}

.map3d-loading {
  color: var(--ant-primary-text);
  border-color: var(--ant-primary-border);
  border-radius: 6px;
  background: var(--ant-elevated);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
  font-family: var(--ant-font);
}

.timeline {
  border-top-color: var(--ant-split);
  background: var(--ant-container);
}

.timeline-intro span {
  color: var(--ant-primary-text);
  font-family: var(--ant-font);
}

.timeline-intro strong {
  color: var(--ant-text);
  font-family: var(--ant-font);
  font-weight: 600;
}

.timeline-intro small {
  color: var(--ant-text-tertiary);
  font-family: var(--ant-font);
}

.timeline-line {
  background: var(--ant-split);
}

.timeline-line > span {
  background: var(--ant-primary);
}

.timeline-step {
  color: var(--ant-text-secondary);
  border-radius: 6px;
}

.timeline-step:hover {
  color: var(--ant-primary-text);
  background: var(--ant-fill);
}

.timeline-dot {
  color: var(--ant-text-tertiary);
  border-color: var(--ant-border);
  background: var(--ant-container);
  font-family: var(--ant-font);
}

.timeline-date {
  color: var(--ant-text-tertiary);
  font-family: var(--ant-font);
}

.timeline-step.is-active {
  color: var(--ant-primary-text);
  background: var(--ant-primary-soft);
  box-shadow: inset 0 0 0 1px var(--ant-primary-border);
}

.timeline-step.is-active .timeline-dot {
  color: #fff;
  border-color: var(--ant-primary);
  background: var(--ant-primary);
  box-shadow: none;
}

.timeline-step.is-active .timeline-date {
  color: var(--ant-primary-text);
}

.timeline-step.is-past .timeline-dot {
  color: var(--ant-primary-text);
  border-color: var(--ant-primary-border);
}

.stage-nav-btn {
  color: var(--ant-text);
  border-color: var(--ant-border);
  border-radius: 6px;
  background: var(--ant-container);
  font-family: var(--ant-font);
}

.stage-nav-btn:hover:not(:disabled) {
  color: var(--ant-primary-text);
  border-color: var(--ant-primary);
  background: var(--ant-container);
}

.stage-nav-btn--primary {
  color: #fff;
  border-color: var(--ant-primary);
  background: var(--ant-primary);
}

.stage-nav-btn--primary:hover:not(:disabled) {
  color: #fff;
  border-color: var(--ant-primary-hover);
  background: var(--ant-primary-hover);
}

/* Original-text floating window */
.story-dock,
.is-presenting .story-dock {
  color: var(--ant-text);
  border-color: var(--ant-split);
  background: var(--ant-container);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.story-document {
  border-left-color: var(--ant-primary);
}

.story-seal {
  color: #fff;
  border: 0;
  border-radius: 6px;
  background: var(--ant-primary);
  box-shadow: none;
  font-family: var(--ant-font);
  font-weight: 600;
}

.story-head-copy strong {
  color: var(--ant-text);
  font-family: var(--ant-font);
  font-weight: 600;
}

.story-progress {
  color: var(--ant-text-tertiary);
  font-family: var(--ant-font);
}

.story-body {
  color: var(--ant-text);
  border-color: var(--ant-split);
  border-radius: 6px;
  background: var(--ant-fill);
  font-family: var(--ant-font);
  font-weight: 400;
}

.story-text.is-typing::after {
  background: var(--ant-primary);
}

.story-body::-webkit-scrollbar {
  width: 8px;
}

.story-body::-webkit-scrollbar-thumb {
  border-radius: 4px;
  background: #3f3f3f;
}

.story-analysis {
  color: var(--ant-text-secondary);
  border-color: rgba(22, 119, 255, 0.28);
  border-radius: 6px;
  background: rgba(22, 119, 255, 0.1);
  font-family: var(--ant-font);
}

.story-analysis > span {
  color: var(--ant-primary-text);
  font-family: var(--ant-font);
  font-weight: 600;
}

.story-foot {
  color: var(--ant-text-tertiary);
  font-family: var(--ant-font);
}

.story-flow b {
  color: var(--ant-text-tertiary);
}

.story-flow b.is-active {
  color: var(--ant-primary-text);
}

.story-flow b.is-past {
  color: var(--ant-success);
}

.story-flow i {
  color: var(--ant-border);
}

.story-btn {
  color: var(--ant-text);
  border-color: var(--ant-border);
  border-radius: 6px;
  background: var(--ant-container);
  font-family: var(--ant-font);
}

.story-btn:hover:not(:disabled) {
  color: var(--ant-primary-text);
  border-color: var(--ant-primary);
  background: var(--ant-container);
}

.story-btn--primary {
  color: #fff;
  border-color: var(--ant-primary);
  background: var(--ant-primary);
}

.story-btn--primary:hover:not(:disabled) {
  color: #fff;
  border-color: var(--ant-primary-hover);
  background: var(--ant-primary-hover);
}

.story-btn--ghost {
  color: var(--ant-text-secondary);
  background: transparent;
}

/* Presentation dock */
.is-presenting .map-toolbar {
  border-bottom: 1px solid var(--ant-split);
  background: var(--ant-layout);
}

.is-presenting .toolbar-actions {
  border-color: var(--ant-split);
  background: rgba(26, 26, 26, 0.96);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
}

.dock-arrow {
  color: var(--ant-text-secondary);
}

.dock-arrow:hover:not(:disabled) {
  color: var(--ant-primary-text);
  background: var(--ant-primary-soft);
  transform: none;
}

.dock-stage-copy b {
  color: var(--ant-primary-text);
  font-family: var(--ant-font);
}

.dock-stage-copy small {
  color: var(--ant-text);
  font-family: var(--ant-font);
  font-weight: 600;
}

.is-presenting .dock-divider {
  background: var(--ant-split);
}

.is-presenting .toolbar-actions .tool-btn {
  color: var(--ant-text-secondary);
  border-color: transparent;
  font-family: var(--ant-font);
}

.is-presenting .toolbar-actions .tool-btn:hover {
  color: var(--ant-primary-text);
  border-color: transparent;
  background: var(--ant-primary-soft);
  transform: none;
}

.is-presenting .toolbar-actions .zoom-value {
  color: var(--ant-text-tertiary);
  font-family: var(--ant-font);
}

.is-presenting .toolbar-actions .tool-btn--mode {
  color: var(--ant-primary-text);
  border-color: var(--ant-primary-border);
  background: var(--ant-primary-soft);
}

.is-presenting .toolbar-actions .story-toggle-btn {
  color: var(--ant-primary-text);
  border-color: var(--ant-primary-border);
  background: var(--ant-primary-soft);
}

.is-presenting .toolbar-actions .story-toggle-btn:hover {
  color: var(--ant-primary-text);
  border-color: var(--ant-primary);
  background: var(--ant-primary-soft);
}

.story-toggle-btn::before {
  color: #fff;
  background: var(--ant-primary);
}

.is-presenting #viewModeBtn::before,
.is-presenting #layersBtn::before {
  color: currentColor;
}

.is-presenting .dock-exit-btn:hover {
  color: var(--ant-danger);
  background: rgba(255, 120, 117, 0.14);
}

/* Popovers, modal and dossier */
.layer-popover {
  color: var(--ant-text);
  border-color: var(--ant-split);
  border-radius: 8px;
  background: var(--ant-container);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.layer-head {
  border-bottom-color: var(--ant-split);
}

.layer-head strong {
  color: var(--ant-text);
  font-family: var(--ant-font);
  font-weight: 600;
}

.layer-head button,
.modal-close,
.dossier-close {
  color: var(--ant-text-tertiary);
}

.layer-head button:hover,
.modal-close:hover,
.dossier-close:hover {
  color: var(--ant-text);
  background: var(--ant-fill);
}

.layer-row {
  color: var(--ant-text-secondary);
  font-family: var(--ant-font);
}

.switch {
  border-color: var(--ant-border);
  background: var(--ant-fill);
}

.switch::after {
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.layer-row input:checked + .switch {
  border-color: var(--ant-primary);
  background: var(--ant-primary);
}

.layer-row input:checked + .switch::after {
  background: #fff;
}

.layer-tip {
  color: var(--ant-text-tertiary);
  border-top-color: var(--ant-split);
  font-family: var(--ant-font);
}

.modal-backdrop {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: none;
}

.help-modal {
  color: var(--ant-text);
  border: 1px solid var(--ant-split);
  border-radius: 8px;
  background: var(--ant-container);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
}

.eyebrow {
  color: var(--ant-primary-text);
  font-family: var(--ant-font);
  font-size: 12px;
  font-weight: 500;
}

.help-modal h2 {
  color: var(--ant-text);
  font-family: var(--ant-font);
  font-size: 28px;
  font-weight: 600;
}

.help-lead {
  color: var(--ant-text-secondary);
  font-family: var(--ant-font);
}

.help-grid--steps > div {
  border-color: var(--ant-split);
  border-radius: 6px;
  background: var(--ant-fill);
}

.help-key {
  color: var(--ant-primary-text);
  font-family: var(--ant-font);
}

.help-grid p {
  color: var(--ant-text-secondary);
  font-family: var(--ant-font);
}

.advanced-controls {
  border-color: var(--ant-split);
}

.advanced-controls summary {
  color: var(--ant-text);
  font-family: var(--ant-font);
}

.advanced-grid p {
  color: var(--ant-text-secondary);
  font-family: var(--ant-font);
}

.advanced-grid b {
  color: var(--ant-text);
}

.help-tip {
  border-left: 3px solid var(--ant-primary);
  border-radius: 4px;
  background: var(--ant-primary-soft);
}

.help-tip span {
  color: var(--ant-primary-text);
  font-family: var(--ant-font);
}

.help-tip p {
  color: var(--ant-text-secondary);
  font-family: var(--ant-font);
}

.dossier {
  color: var(--ant-text);
  border-color: var(--ant-split);
  border-radius: 8px;
  background: var(--ant-container);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.dossier-rail {
  background: var(--ant-primary);
}

.dossier-eyebrow {
  color: var(--ant-primary-text);
  font-family: var(--ant-font);
}

.dossier h3 {
  color: var(--ant-text);
  font-family: var(--ant-font);
  font-weight: 600;
}

.dossier-location,
.dossier-note {
  color: var(--ant-text-secondary);
  font-family: var(--ant-font);
}

.dossier blockquote {
  color: var(--ant-text);
  border-left: 3px solid var(--ant-primary);
  border-radius: 4px;
  background: var(--ant-fill);
  font-family: var(--ant-font);
}

.tooltip {
  color: #fff;
  border: 1px solid #3d3d3d;
  border-radius: 6px;
  background: #2b2b2b;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.55);
}

.tooltip strong {
  color: #fff;
  font-family: var(--ant-font);
}

.tooltip span {
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--ant-font);
}

.toast {
  color: var(--ant-text);
  border-color: var(--ant-split);
  border-radius: 6px;
  background: var(--ant-container);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
  font-family: var(--ant-font);
}

.mobile-map-hint {
  color: var(--ant-text-secondary);
  border-color: var(--ant-split);
  background: rgba(26, 26, 26, 0.94);
  font-family: var(--ant-font);
}

@media (max-width: 760px) {
  .brand h1 {
    font-size: 22px;
    letter-spacing: 0;
  }

  .ghost-btn {
    width: 44px;
    height: 44px;
    min-height: 44px;
    flex: 0 0 44px;
    padding: 0;
    border-radius: 6px;
    font-size: 0;
  }

  .ghost-btn::before {
    content: "?";
    font-family: var(--ant-font);
    font-size: 18px;
    font-weight: 600;
  }

  .solid-btn {
    height: 44px;
    min-height: 44px;
    padding: 0 12px;
    font-size: 14px;
  }

  .tool-btn--icon {
    font-size: 18px;
  }
}

/* ---------- Immersive presentation stage ---------- */
body.is-presenting .topbar {
  display: none !important;
}

.is-presenting .app {
  background: #050505;
}

.is-presenting .workspace {
  position: relative;
  padding: 0;
  background: #050505;
}

.is-presenting .map-shell {
  position: relative;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: #0b1210;
}

/* Cinematic edge falloff: keeps the eye on the centre of the map. */
.is-presenting .map-shell::before {
  position: absolute;
  z-index: 2;
  inset: 0;
  content: "";
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.52), rgba(0, 0, 0, 0) 20%),
    linear-gradient(0deg, rgba(0, 0, 0, 0.46), rgba(0, 0, 0, 0) 24%),
    radial-gradient(125% 95% at 50% 46%, rgba(0, 0, 0, 0) 46%, rgba(0, 0, 0, 0.4) 100%);
}

/* Dock floats above the map so the map gets the whole viewport. */
.is-presenting .map-toolbar {
  position: absolute;
  z-index: 96;
  top: 0;
  right: 0;
  left: 0;
  flex: 0 0 auto;
  padding: 14px 16px 0;
  background: transparent;
  pointer-events: none;
}

.is-presenting .map-toolbar .toolbar-actions {
  pointer-events: auto;
}

.is-presenting .toolbar-actions {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(12, 14, 18, 0.58);
  backdrop-filter: blur(12px) saturate(125%);
  -webkit-backdrop-filter: blur(12px) saturate(125%);
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Translucent reading window: the map stays visible underneath. */
.is-presenting .story-dock,
.is-presenting.is-map-focus .story-dock {
  top: 86px;
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(12, 14, 18, 0.58);
  backdrop-filter: blur(12px) saturate(125%);
  -webkit-backdrop-filter: blur(12px) saturate(125%);
  box-shadow:
    0 26px 64px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.is-presenting .story-body {
  border-color: rgba(255, 255, 255, 0.09);
  background: rgba(0, 0, 0, 0.24);
}

.is-presenting .story-analysis {
  border-color: rgba(122, 184, 255, 0.24);
  background: rgba(22, 119, 255, 0.14);
}

.is-presenting .story-seal {
  box-shadow: 0 6px 18px rgba(22, 119, 255, 0.34);
}

.is-presenting .story-dock .story-btn:not(.story-btn--primary) {
  color: var(--ant-text);
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.07);
}

.is-presenting .story-dock .story-btn:not(.story-btn--primary):hover:not(:disabled) {
  color: #fff;
  border-color: rgba(122, 184, 255, 0.62);
  background: rgba(122, 184, 255, 0.14);
}

.is-presenting .story-dock .story-btn--primary {
  box-shadow: 0 8px 22px rgba(22, 119, 255, 0.36);
}

/* Bottom progress becomes a floating glass bar. */
.is-presenting .timeline {
  position: absolute;
  z-index: 92;
  bottom: 14px;
  left: 50%;
  width: min(1600px, calc(100% - 32px));
  height: 84px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(12, 14, 18, 0.58);
  backdrop-filter: blur(12px) saturate(125%);
  -webkit-backdrop-filter: blur(12px) saturate(125%);
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transform: translateX(-50%);
}

.is-presenting .timeline-line {
  border-radius: 1px;
}

.is-presenting .map-zoom-badge,
.is-presenting .mobile-map-hint {
  display: none !important;
}

/* Glass surfaces need brighter secondary text than the solid panels. */
.is-presenting .toolbar-actions,
.is-presenting .story-dock,
.is-presenting .timeline {
  --ant-text-secondary: #dadada;
  --ant-text-tertiary: #c0c0c0;
  --ant-split: rgba(255, 255, 255, 0.14);
}

.is-presenting .toolbar-actions .dock-exit-btn {
  color: #ffb3b0;
}

.is-presenting .toolbar-actions .dock-exit-btn:hover {
  color: #ffd0ce;
  background: rgba(255, 120, 117, 0.16);
}

.is-presenting .timeline-intro small {
  display: none;
}

/* ---------- Full-width script sheet anchored to the bottom ---------- */
.is-presenting .story-dock,
.is-presenting.is-map-focus .story-dock {
  top: auto;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  max-height: min(56vh, 560px);
  padding: 20px 26px 18px;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px 18px 0 0;
  grid-template-columns: minmax(0, 1fr) 208px;
  gap: 24px;
  transform: none;
}

.is-presenting .story-dock.is-collapsed {
  transform: translateY(18px) scale(0.992);
}

.is-presenting .story-actions {
  align-self: center;
}

/* While the sheet is open it owns the bottom edge, so the progress bar steps aside. */
.is-presenting .timeline {
  transition:
    opacity 220ms ease,
    visibility 0s linear 0s;
}

body.is-presenting:not(.is-story-collapsed) .timeline {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 180ms ease,
    visibility 0s linear 180ms;
}

body.is-presenting.is-story-collapsed .timeline {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

@media (max-width: 1100px) {
  .is-presenting .story-dock,
  .is-presenting.is-map-focus .story-dock {
    max-height: min(62vh, 520px);
    padding: 16px 16px 14px;
    grid-template-columns: minmax(0, 1fr) 168px;
    gap: 16px;
  }
}

@media (max-width: 760px) {
  .is-presenting .story-dock,
  .is-presenting.is-map-focus .story-dock {
    right: 0;
    left: 0;
    width: 100%;
    max-height: 66dvh;
    padding: 12px 12px 10px;
    border-radius: 16px 16px 0 0;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }
}

/* Centred content inside the full-bleed sheet keeps the reading measure sane. */
.is-presenting .story-dock,
.is-presenting.is-map-focus .story-dock {
  grid-template-columns: minmax(0, 1120px) 190px;
  justify-content: center;
  column-gap: 26px;
}

/* Before the deployment lands there is no analysis yet: let the quote use the width. */
.is-presenting .story-document:has(.story-analysis:not(.is-visible)) {
  grid-template-columns: minmax(0, 1fr) 0;
  column-gap: 0;
}

/* Keep the not-yet-revealed analysis from inflating the sheet height. */
.is-presenting .story-document:has(.story-analysis:not(.is-visible)) .story-analysis {
  height: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
}

.is-presenting .story-body,
.is-presenting.is-map-focus .story-body {
  height: clamp(200px, 30vh, 260px);
}

@media (max-width: 1100px) {
  .is-presenting .story-dock,
  .is-presenting.is-map-focus .story-dock {
    grid-template-columns: minmax(0, 1fr) 168px;
    column-gap: 16px;
  }
}

@media (max-width: 760px) {
  .is-presenting .story-dock,
  .is-presenting.is-map-focus .story-dock {
    grid-template-columns: minmax(0, 1fr);
    column-gap: 0;
  }
}

/* Reading phase keeps the sheet compact; it grows only when the analysis lands. */
.is-presenting .story-document:has(.story-analysis:not(.is-visible)) .story-body {
  height: clamp(170px, 22vh, 210px);
}
