/* Full-screen game stage and the one Finn speech bubble. */

.game-stage {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
}
.game-stage[hidden] { display: none !important; }
.stage-wipe {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  clip-path: circle(0% at 50% 50%);
}
.stage-wipe.is-in { animation: stage-iris-in 300ms ease forwards; }
.stage-wipe.is-out { animation: stage-iris-out 300ms ease forwards; }
@keyframes stage-iris-in {
  from { clip-path: circle(140% at 50% 50%); }
  to { clip-path: circle(0% at 50% 50%); }
}
@keyframes stage-iris-out {
  from { clip-path: circle(0% at 50% 50%); }
  to { clip-path: circle(140% at 50% 50%); }
}
.stage-hud {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.stage-back {
  min-width: 44px;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--raised);
  color: var(--ink);
  box-shadow: 0 5px 0 var(--outline);
  font-family: var(--font-ui);
  font-weight: 700;
  cursor: pointer;
}
.stage-back:active {
  transform: translateY(5px);
  box-shadow: none;
}
.stage-world {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-family: var(--font-ui);
  font-weight: 700;
}
.stage-xp {
  margin-left: auto;
  color: var(--coin-ink);
  font-family: var(--font-ui); font-variant-numeric: tabular-nums;
}
.stage-play {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 16px;
}
.stage-play-body { min-height: 100%; max-width: 640px; margin-inline: auto; }
.stage-actions {
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--panel);
}
.stage-actions[hidden] { display: none !important; }
.stage-primary {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--action);
  color: var(--on-action);
  box-shadow: 0 5px 0 var(--action-shadow);
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.stage-primary:active {
  transform: translateY(5px);
  box-shadow: none;
}
.stage-primary:disabled {
  background: var(--raised);
  color: var(--muted);
  box-shadow: 0 5px 0 var(--outline);
  cursor: default;
}
.game-stage .stage-play .sheet-primary,
.game-stage .stage-play .puzzle-lock,
.game-stage .stage-play .chat-city-load,
.game-stage .stage-play .chat-scene-start,
.game-stage .stage-play .chat-call-start,
.game-stage .stage-play .chat-quest-save,
.game-stage .stage-play .chat-fee-form button[type="submit"],
.game-stage .stage-play .chat-inflation-form button[type="submit"],
.game-stage .stage-play [data-weekly-lock],
.game-stage .stage-play [data-boss-next] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.practice-tag {
  display: inline-block;
  margin: 0 0 8px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--raised);
  color: var(--coin-ink);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
}
.speech-bubble,
.aurin-speech,
.finn-say-bubble,
.chat-game .aurin-speech,
.chat-game .speech-bubble {
  position: relative;
  margin: 0;
  padding: 8px 12px;
  background: var(--panel);
  color: var(--ink);
  border: 2px solid var(--line);
  border-radius: 4px 14px 14px 14px;
  box-shadow: none;
  box-sizing: border-box;
  overflow: visible;
}
.finn-say-slot { display: grid; }
.finn-say-text,
.finn-say-reserve {
  grid-area: 1 / 1;
  overflow-wrap: normal;
  word-break: normal;
}
.finn-say-reserve { visibility: hidden; }
.speech-bubble::before,
.aurin-speech::before,
.finn-say-bubble::before,
.chat-game .aurin-speech::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 14px;
  border-width: 6px 10px 6px 0;
  border-style: solid;
  border-color: transparent var(--line) transparent transparent;
}
.speech-bubble::after,
.aurin-speech::after,
.finn-say-bubble::after,
.chat-game .aurin-speech::after {
  content: "";
  position: absolute;
  left: -6px;
  top: 16px;
  border-width: 4px 8px 4px 0;
  border-style: solid;
  border-color: transparent var(--panel) transparent transparent;
}
.speech-bubble-name,
.aurin-speech .aurin-name,
.chat-game .aurin-name {
  display: block;
  margin: 0 0 2px;
  color: var(--coin-ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.chat-game {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
}
.chat-game-title,
.chat-game .chat-game-title {
  color: var(--ink);
}
.chat-game .chat-game-why,
.chat-game .chat-game-note,
.chat-game .chat-game-line,
.chat-game label,
.chat-game .aurin-keep,
.chat-game .aurin-question {
  color: var(--muted);
}
.glossary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.chat-jargon {
  min-height: 44px;
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--raised);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

body.stage-open { overflow: hidden; }
@media (prefers-reduced-motion: reduce) {
  .stage-back:active,
  .stage-primary:active { transform: none; }
  .stage-wipe { animation: none; }
}

@media (min-width: 1024px) {
  .stage-hud,
  .stage-actions { padding-inline: max(16px, calc((100% - 640px) / 2)); }
}
@media (min-width: 1024px) {
  /* Desktop: the stage card fills the centred 640px game column. */
  .stage-play-body > .map-sheet-card { width: 100%; margin-inline: auto; }
}
