/* First Journey and the contextual journey card share the Roam presentation.
   Tutorial, activity and screen-layout owners still decide what is shown. */
#tutorialHintCard[hidden], #currentJourneyCard[hidden] { display: none !important; }
.tutorial-card, #currentJourneyCard, .tutorial-settings-card {
  box-sizing: border-box;
  border: 1px solid var(--wx-line-soft);
  border-radius: var(--wx-radius);
  background: var(--wx-panel-solid);
  color: var(--wx-text);
  font: 500 var(--wx-type-control)/1.5 var(--wx-font-ui);
  box-shadow: var(--wx-shadow-panel);
}
.tutorial-card, #currentJourneyCard {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(88px, calc(env(safe-area-inset-bottom) + 80px));
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100dvh - 112px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  border-left: 3px solid var(--wx-action);
  overflow: auto;
  overscroll-behavior: contain;
}
#currentJourneyCard {
  z-index: 138;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: var(--wx-space-3);
  padding: var(--wx-space-4) 52px var(--wx-space-4) var(--wx-space-4);
}
.space-flight-active #currentJourneyCard { right: 260px; bottom: 18px; z-index: 10002; }
.currentJourneyMark { display: none; }
.currentJourneyCopy { min-width: 0; }
.currentJourneyCopy :is(span, strong, small) { display: block; overflow-wrap: anywhere; }
.currentJourneyCopy span, .tutorial-eyebrow, .tutorial-settings-eyebrow {
  color: var(--wx-action);
  font: 700 var(--wx-type-meta)/1.4 var(--wx-font-ui);
}
.currentJourneyCopy strong { margin-top: 4px; font-size: var(--wx-type-control); line-height: 1.4; }
.currentJourneyCopy small { margin-top: 4px; color: var(--wx-muted); font-size: var(--wx-type-meta); }
#currentJourneyAction, .tutorial-card button, .tutorial-settings-actions button {
  box-sizing: border-box;
  min-height: var(--wx-control-height);
  min-width: var(--wx-control-height);
  border: 1px solid var(--wx-line);
  border-radius: var(--wx-radius);
  padding: 8px 12px;
  background: var(--wx-panel-soft);
  color: var(--wx-text);
  font: 600 var(--wx-type-meta)/1.35 var(--wx-font-ui);
  cursor: pointer;
  touch-action: manipulation;
}
#currentJourneyAction { justify-self: start; }
#currentJourneyAction, .tutorial-card .tutorial-primary {
  border-color: var(--wx-action);
  background: var(--wx-action);
  color: var(--wx-action-text);
}
#currentJourneyAction:hover, .tutorial-card .tutorial-primary:hover { background: var(--wx-action-hover); }
#currentJourneyDismiss {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--wx-radius);
  background: transparent;
  color: var(--wx-muted);
  font: 24px/1 var(--wx-font-ui);
  cursor: pointer;
}
.tutorial-card { z-index: 250; padding: var(--wx-space-3); pointer-events: auto; touch-action: pan-y; }
.tutorial-card.compact { pointer-events: none; }
.tutorial-card button { pointer-events: auto; }
.tutorial-card-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--wx-space-2); }
.tutorial-card-head > div:first-child { flex: 1 1 140px; min-width: 0; }
.tutorial-head-actions { display: flex; flex: 0 1 auto; gap: var(--wx-space-1); margin-left: auto; }
.tutorial-title { display: block; margin-top: 4px; color: var(--wx-text); font: 700 var(--wx-type-control)/1.4 var(--wx-font-ui); overflow-wrap: anywhere; }
.tutorial-card .tutorial-icon-btn { width: 44px; padding: 0; font-size: 24px; }
.tutorial-body { margin: var(--wx-space-3) 0; color: var(--wx-muted); white-space: pre-line; overflow-wrap: anywhere; }
.tutorial-progress-track { height: 4px; overflow: hidden; background: var(--wx-selected); }
.tutorial-progress-track span { display: block; width: 10%; height: 100%; background: var(--wx-action); transition: width var(--wx-motion-fast) ease; }
.tutorial-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--wx-space-2); margin-top: var(--wx-space-3); }
.tutorial-card .tutorial-text-btn { margin-left: auto; border-color: transparent; background: transparent; color: var(--wx-muted); }
.tutorial-card.compact :is(.tutorial-body, .tutorial-progress-track, .tutorial-actions) { display: none; }
.tutorial-settings-card { margin-top: 18px; padding: var(--wx-space-4); box-shadow: none; }
.tutorial-settings-card h3 { margin: 8px 0; font: 700 var(--wx-type-body)/1.4 var(--wx-font-ui); }
.tutorial-settings-card p { margin: 0 0 12px; color: var(--wx-muted); }
.tutorial-settings-card label { display: flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; }
.tutorial-settings-card input { flex: 0 0 24px; width: 24px; height: 24px; accent-color: var(--wx-action); }
.tutorial-settings-actions { margin-top: 12px; }
#tutorialSettingsStatus { min-height: 1.5em; margin-top: 8px; color: var(--wx-muted); font-size: var(--wx-type-meta); }
:is(.tutorial-card, .tutorial-settings-card, #currentJourneyCard) :focus-visible { outline: 2px solid var(--wx-focus); outline-offset: 2px; }
@media (max-width: 700px), (pointer: coarse) {
  .tutorial-card { right: max(8px, env(safe-area-inset-right)); bottom: max(330px, calc(env(safe-area-inset-bottom) + 322px)); width: min(420px, calc(100vw - 16px)); max-height: calc(100dvh - 350px - env(safe-area-inset-top)); }
  body:not(.space-flight-active) #currentJourneyCard { right: max(8px, env(safe-area-inset-right)); bottom: max(82px, calc(env(safe-area-inset-bottom) + 74px)); width: min(360px, calc(100vw - 16px)); grid-template-columns: minmax(0, 1fr); }
  body:not(.space-flight-active) #currentJourneyAction { justify-self: start; }
  .space-flight-active #currentJourneyCard { display: none !important; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .tutorial-card { top: max(8px, env(safe-area-inset-top)); bottom: auto; right: max(8px, env(safe-area-inset-right)); max-height: calc(100dvh - 160px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
  body:not(.space-flight-active) #currentJourneyCard { top: max(8px, env(safe-area-inset-top)); bottom: auto; max-height: calc(100dvh - 160px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
}

body:has(.floatMenu.open) #tutorialHintCard,
body:has(#discoveryPanel.show) #tutorialHintCard,
body:has(#urbanEquipment[aria-hidden="false"]) #tutorialHintCard{display:none!important}
body:has(#tutorialHintCard:not([hidden])) #currentJourneyCard,
body:has(.floatMenu.open) #currentJourneyCard,
body:has(#discoveryPanel.show) #currentJourneyCard,
body:has(#urbanEquipment[aria-hidden="false"]) #currentJourneyCard,
body:has(#controlsTab.bar-open) #currentJourneyCard,
body:has(#urbanVehiclePrompt.show) #currentJourneyCard,
body:has(#interiorPrompt.show) #currentJourneyCard,
body:has(#boatPrompt.show) #currentJourneyCard,
body:has(#discoveryContextPrompt.show) #currentJourneyCard,
body.game-panel-layer-open #currentJourneyCard,
body.game-activity-layer-open #currentJourneyCard,
body:has(#largeMap.show) #currentJourneyCard{display:none!important}
body:has(#universeNavigator:not([hidden])) #currentJourneyCard{display:none!important}
body:has(#urbanVehiclePrompt.show) #tutorialHintCard:not([data-tutorial-stage="move"]),
body:has(#interiorPrompt.show) #tutorialHintCard:not([data-tutorial-stage="move"]),
body:has(#boatPrompt.show) #tutorialHintCard:not([data-tutorial-stage="move"]),
body:has(#discoveryContextPrompt.show) #tutorialHintCard:not([data-tutorial-stage="move"]){display:none!important}
/* A new player must see how to move before nearby ambient actions take over.
   Dismissing guidance or advancing to interaction restores normal priority. */
body:not(.context-details-open):has(#tutorialHintCard[data-tutorial-stage="move"]:not([hidden])) #urbanVehiclePrompt,
body:not(.context-details-open):has(#tutorialHintCard[data-tutorial-stage="move"]:not([hidden])) #interiorPrompt,
body:not(.context-details-open):has(#tutorialHintCard[data-tutorial-stage="move"]:not([hidden])) #boatPrompt,
body:not(.context-details-open):has(#tutorialHintCard[data-tutorial-stage="move"]:not([hidden])) #discoveryContextPrompt{display:none!important}
body:has(#controlsTab.bar-open) #tutorialHintCard{display:none!important}
