/* Refreshed, minimalist responsive UI for character chat */
:root {
  --bg: #f7fafc;
  --card: #ffffff;
  --muted: #94a3b8;
  --accent: #2563eb;
  --accent-2: #7c3aed;
  --success: #16a34a;
  --shadow: 0 8px 24px rgba(2, 6, 23, 0.08);
}

* {
  box-sizing: border-box
}

.hidden {
  display: none !important;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
  color: #0f172a;
  display: flex;
  justify-content: center;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

}

/* Restrict game to a mobile-like viewport */

.mobile-wrapper {
  width: 100%;
  max-width: 480px;
  /* ← target mobile width */
  min-height: 100vh;
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
  overflow-x: hidden;
  position: relative;
}

.app-shell {
  max-width: 600px;
  width: 100%;
  margin: 18px auto;
  padding: 16px;
  /* constrain overall shell to viewport so inner areas can scroll cleanly */
  min-height: calc(100vh - 36px);
  max-height: calc(100vh - 36px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* keep scroll inside messages area */
}

.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  margin-bottom: 16px;
}

.title-wrap {
  flex: 1;
  align-items: center;
  text-align: center;
}

.char-name {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700
}

#status-bar {
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-weight: bold;
}

#status-bar.success {
  background-color: #d1fae5;
  color: #065f46;
  border-color: #10b981;
}


.level-nav {
  position: absolute;
  top: 16px;
  right: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid #e6edf3;
  box-shadow: var(--shadow);
  text-decoration: none;
  font-size: 18px
}

.level-nav:hover {
  transform: translateY(-1px)
}

/* image inside level-nav */
.level-nav .level-icon {
  display: block;
  max-width: 70%;
  max-height: 70%;
  width: auto;
  height: auto;
}

.mission-progress-widget {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}

.mission-progress-toggle {
  min-width: 92px;
  max-width: 92px;
  padding: 10px 12px;
  border: 1px solid #e6edf3;
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: left;
  color: #0f172a;
}

.mission-progress-toggle:hover {
  transform: translateY(-1px);
}

.mission-progress-kicker {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 4px;
}

.mission-progress-label {
  display: block;
  font-size: 0.96rem;
  font-weight: 700;
}

.mission-progress-panel {
  width: min(320px, calc(100vw - 32px));
  max-height: 60vh;
  overflow: auto;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid #e6edf3;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
}

.mission-progress-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.mission-progress-title {
  margin: 0;
  font-size: 1rem;
}

.mission-progress-summary {
  margin: 4px 0 0;
  color: #475569;
  font-size: 0.9rem;
}

.mission-progress-close {
  width: 32px;
  height: 32px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  cursor: pointer;
  flex-shrink: 0;
}

.mission-progress-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 14px;
}

.mission-progress-column h5 {
  margin: 0 0 8px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #475569;
}

.mission-progress-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mission-progress-list li {
  color: #0f172a;
}

.mission-progress-list li.empty {
  color: var(--muted);
}

/* visual success state */

.level-nav.attention {
  background: #22c55e;
  border-color: #16a34a;
  color: #ffffff;
  transform: scale(1.08);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, .35), 0 8px 24px rgba(2, 6, 23, .25);
}

@keyframes blinkGreen {

  0%,
  100% {
    filter: brightness(1);
    box-shadow: 0 0 0 4px rgba(34, 197, 94, .35), 0 8px 24px rgba(2, 6, 23, .25);
  }

  50% {
    filter: brightness(1.15);
    box-shadow: 0 0 0 6px rgba(34, 197, 94, .55), 0 10px 28px rgba(2, 6, 23, .35);
  }
}

.card {
  background: var(--card);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  /* allow children to shrink */
  max-height: 100%;
  overflow: hidden;
  /* ensure inner messages area handles scrolling */
}

.character-top {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding-bottom: 8px
}

.character-image img {
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.06)
}

.character-image img.hidden {
  display: none
}

/* ---------------------------------------------------------------------------
   Level roster strip (character.html)
   --------------------------------------------------------------------------- */

.character-roster {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 8px 0 4px;
}

.roster-avatar {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform .12s ease, border-color .15s ease, box-shadow .15s ease;
}

.roster-avatar:not(.unavailable):hover {
  transform: translateY(-3px) scale(1.06);
}

.roster-avatar.active {
  border-color: var(--accent);
  transform: scale(1.1);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.roster-avatar.unavailable {
  opacity: 0.4;
  filter: grayscale(100%);
  cursor: default;
}

.chat-area {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  /* prevent double scrollbars */
}

.chat-controls {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 6px
}

.icon-btn {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer
}

.icon-btn:hover {
  background: #eef2ff
}

.messages {
  flex: 1;
  overflow: auto;
  border-radius: 10px;
  padding: 12px;
  background: linear-gradient(180deg, #fbfdff, #ffffff);
  border: 1px solid #eef2f6;
  min-height: 0;
  /* allow to shrink within the card */
  /* scroll only here */
}

/* Reuse bubble styles but tweak sizes */
.speech-row {
  display: flex;
  margin: 8px 0
}

.speech-row.left {
  justify-content: flex-start
}

.speech-row.right {
  justify-content: flex-end
}

.tts-button-row {
  display: flex;
  justify-content: flex-end;
  width: 82%;
  margin: -2px 0 8px 6px;
  gap: 8px
}

.tts-button {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: #dbe4f0;
  color: #0f172a;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer
}

.tts-button:hover {
  background: #cdd8e7
}

.tts-button:disabled {
  opacity: 0.7;
  cursor: wait
}

.bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 14px;
  line-height: 1.35;
  box-shadow: 0 4px 10px rgba(2, 6, 23, 0.04);
  word-wrap: break-word
}

.bubble.agent {
  background: #e8e8e8;
  color: #0f172a;
  margin-left: 6px;
  border-radius: 14px
}

.bubble.agent::after {
  content: "";
  position: absolute
}

.bubble.user {
  background: linear-gradient(180deg, var(--accent), #034bbd);
  color: #fff;
  margin-right: 6px;
  border-radius: 14px
}

.bubble.agent.thinking {
  animation: pulse 1.1s ease-in-out infinite;
  background: linear-gradient(180deg, #f1f6ff, #fbfdff)
}

@keyframes pulse {
  0% {
    transform: translateY(0)
  }

  50% {
    transform: translateY(-3px)
  }

  100% {
    transform: translateY(0)
  }
}

/* Mission CTA — replaces composer when mission intro succeeds */
.mission-cta {
  display: flex;
  justify-content: center;
  padding: 16px 10px 10px;
  margin-top: 10px;
  border-top: 1px solid #eef2f6;
}

.mission-start-btn {
  width: 100%;
  padding: 18px 24px;
  font-size: 1.15rem;
  font-weight: 700;
  border: none;
  border-radius: 14px;
  background: #16a34a;
  color: #ffffff;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: background 0.15s ease, transform 0.1s ease,
    box-shadow 0.15s ease;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.25),
    0 8px 24px rgba(2, 6, 23, 0.12);
  animation: blinkGreen 1.2s ease-in-out infinite;
}

.mission-start-btn:hover {
  background: #15803d;
  transform: translateY(-2px);
  box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.35),
    0 12px 28px rgba(2, 6, 23, 0.18);
}

.mission-start-btn:active {
  transform: translateY(0);
}

/* Composer */
.composer {
  display: flex;
  gap: 8px;
  padding: 10px;
  margin-top: 10px;
  border-top: 1px solid #eef2f6;
}

.composer-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.msg-input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #e6eef7;
  background: #fbfdff;
  font-size: 1rem;
  line-height: 1.4
}

.msg-input:focus {
  outline: none;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.08);
  border-color: var(--accent)
}

textarea.msg-input {
  min-height: 96px;
  resize: vertical
}

.send-btn {
  background: linear-gradient(180deg, var(--accent), #0b5ed7);
  color: #fff;
  border: none;
  padding: 0 18px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  flex: 1
}

.send-btn:active {
  transform: translateY(1px)
}

.mic-btn {
  width: 44px;
  height: 44px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f1f5f9;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s
}

.mic-btn:hover:not(:disabled) {
  background: #eef2ff;
  border-color: var(--accent)
}

.mic-btn.recording {
  background: #fee2e2;
  border-color: #ef4444;
  animation: micPulse 1s ease-in-out infinite
}

.mic-btn:disabled {
  opacity: 0.6;
  cursor: wait
}

@keyframes micPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4)
  }
  50% {
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0)
  }
}

/* keep old ID selector compatibility */
#log {
  padding: 12px
}

#log::-webkit-scrollbar {
  height: 8px;
  width: 8px
}

#log::-webkit-scrollbar-thumb {
  background: rgba(2, 6, 23, 0.12);
  border-radius: 6px
}

/* World map hub on index.html */
.world-map {
  position: fixed;
  inset: 0;
  background: #f8fafc;
  border: 2px dashed #e2e8f0;
  overflow: hidden;
}

/* Map background image that fills the map area without stretching */
.map-background {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  height: 100%;
  transform: translate(-50%, -50%);
  object-fit: contain;
  /* maintain aspect ratio and cover entire area */
  object-position: center center;
  pointer-events: none;
  z-index: 0;
}

.char-marker {
  position: absolute;
  width: 192px;
  height: 192px;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .15s ease;
  z-index: 10;
}

.char-marker:hover {
  transform: translate(-50%, -50%) scale(1.20);
}

/* circular ring around the GIF for clickable indication */
.char-marker::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% + 16px);
  height: calc(100% + 16px);
  border-radius: 50%;
  border: 4px solid rgba(37, 99, 235, 0.9);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.06);
  transition: transform .15s ease, border-color .15s ease, opacity .15s ease;
  pointer-events: none;
  z-index: 11;
}

.char-gif {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: 0 10px 18px rgba(2, 6, 23, .16);
  z-index: 12;
}

.char-marker.unavailable {
  pointer-events: none;
  opacity: .8;
}

.char-marker.unavailable .char-gif {
  opacity: .45;
  filter: grayscale(1) drop-shadow(0 4px 10px rgba(2, 6, 23, .12));
}

.char-marker.unavailable::before {
  border-color: rgba(2, 6, 23, 0.06);
  opacity: .6;
}

/* Root level overview: full-viewport title background + logo + level cards */
body.level-overview-page {
  background: transparent;
}

.mobile-wrapper.level-overview {
  max-width: none;
  width: 100%;
  min-height: 100vh;
  background: transparent;
}

.level-overview-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.level-overview-bg-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.level-overview-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: min(720px, calc(100vw - 24px));
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: clamp(28px, 6vw, 48px) clamp(16px, 5vw, 36px) clamp(36px, 8vw, 56px);
  box-sizing: border-box;
}

.level-overview-logo {
  display: block;
  width: min(94%, 440px);
  height: auto;
  margin: 0 auto clamp(24px, 5vw, 36px);
  flex-shrink: 0;
  filter: drop-shadow(0 4px 16px rgba(2, 6, 23, 0.35));
}

.level-hub {
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 2.5vw, 20px);
  padding: 0;
  flex: 1;
}

/* Level card — clickable row per level */
.level-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: #1e293b;
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.15s ease;
  color: #f1f5f9;
}

.level-card:not(.locked):hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(2, 6, 23, 0.18);
}

.level-card.locked {
  background: #64748b;
  color: #f8fafc;
  cursor: default;
}

.level-card.locked .level-card-subtitle {
  color: #cbd5e1;
}

.level-card.locked .level-card-lock {
  opacity: 0.85;
}

.level-card.finished {
  border: 2px solid var(--success);
}

.level-card-image img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 12px;
}

.level-card-info {
  flex: 1;
  min-width: 0;
}

.level-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
}

.level-card-subtitle {
  font-size: 0.82rem;
  color: #94a3b8;
  margin-top: 2px;
}

.level-card-lock {
  font-size: 1.2rem;
  opacity: 0.6;
}

.level-card-check {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  flex-shrink: 0;
}

.title-image {
  width: 100%;
  height: auto;
  max-height: 50vh;
  object-fit: cover;
  display: block;
}

@media (min-width: 420px) {
  .mission-progress-columns {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 420px) {
  .mission-progress-widget {
    top: 12px;
    left: 12px;
    gap: 8px;
  }

  .mission-progress-toggle {
    min-width: 96px;
    max-width: 96px;
    padding: 8px 10px;
    border-radius: 10px;
  }

  .mission-progress-kicker {
    font-size: 0.6rem;
    margin-bottom: 2px;
  }

  .mission-progress-label {
    font-size: 0.78rem;
    line-height: 1.15;
  }

  .mission-progress-panel {
    width: min(260px, calc(100vw - 24px));
    padding: 12px;
    border-radius: 14px;
  }

  .mission-progress-title {
    font-size: 0.92rem;
  }

  .mission-progress-summary {
    font-size: 0.82rem;
  }

  .mission-progress-column h5 {
    font-size: 0.76rem;
  }

  .mission-progress-list {
    gap: 4px;
    font-size: 0.9rem;
  }
}

/* ---------------------------------------------------------------------------
   Loading overlay
   --------------------------------------------------------------------------- */

#loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  transition: opacity 0.35s ease;
}

#loading-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

#loading-overlay.hidden {
  display: none;
}

#overlay-label {
  color: #f1f5f9;
  font-size: 1.1rem;
  margin: 0;
  letter-spacing: 0.02em;
  position: relative;
  z-index: 2;
}

#overlay-media-container {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.overlay-media {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#loading-overlay.has-intro-media {
  justify-content: center;
  align-items: center;
  padding: 24px;
  background: #000;
  backdrop-filter: none;
}

#loading-overlay.has-intro-media #overlay-label {
  display: none;
}

#overlay-play {
  position: relative;
  z-index: 2;
  padding: 14px 36px;
  font-size: 1.1rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

/* Intro overlay: centred, high-impact Start button over full-bleed media */
#loading-overlay.has-intro-media #overlay-play:not(:disabled) {
  width: auto;
  min-width: 240px;
  max-width: min(92vw, 400px);
  padding: 22px 48px;
  font-size: 1.28rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-radius: 16px;
  background: linear-gradient(
    160deg,
    #4ade80 0%,
    #22c55e 32%,
    #16a34a 68%,
    #15803d 100%
  );
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
  box-shadow:
    0 0 0 4px rgba(74, 222, 128, 0.35),
    0 0 32px rgba(34, 197, 94, 0.55),
    0 14px 40px rgba(0, 0, 0, 0.35);
  animation: introOverlayPlayGlow 1.8s ease-in-out infinite;
  transition: filter 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

#loading-overlay.has-intro-media #overlay-play:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-3px) scale(1.03);
  box-shadow:
    0 0 0 6px rgba(74, 222, 128, 0.4),
    0 0 44px rgba(250, 204, 21, 0.38),
    0 18px 48px rgba(0, 0, 0, 0.4);
}

#loading-overlay.has-intro-media #overlay-play:active:not(:disabled) {
  transform: translateY(-1px) scale(1.01);
}

@keyframes introOverlayPlayGlow {
  0%,
  100% {
    box-shadow:
      0 0 0 4px rgba(74, 222, 128, 0.35),
      0 0 32px rgba(34, 197, 94, 0.45),
      0 14px 40px rgba(0, 0, 0, 0.35);
    transform: scale(1);
  }

  50% {
    box-shadow:
      0 0 0 8px rgba(74, 222, 128, 0.25),
      0 0 48px rgba(250, 204, 21, 0.35),
      0 18px 48px rgba(0, 0, 0, 0.38);
    transform: scale(1.035);
  }
}

#loading-overlay:not(.has-intro-media) #overlay-play:hover:not(:disabled) {
  background: #1d4ed8;
  transform: translateY(-1px);
}

#overlay-play:disabled {
  background: #475569;
  cursor: not-allowed;
  opacity: 0.7;
}

/* Mission-complete scene image comes from CTAButton.mission_complete_background_src (inline style). */
#loading-overlay.has-mission-complete {
  justify-content: center;
  padding: 24px 16px;
  background-color: #0f172a;
  background-image: linear-gradient(
    160deg,
    rgba(15, 23, 42, 0.55) 0%,
    rgba(30, 27, 75, 0.5) 45%,
    rgba(15, 23, 42, 0.75) 100%
  );
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  backdrop-filter: none;
}

.mission-complete-panel {
  position: relative;
  z-index: 2;
  max-width: 32rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: center;
}

.mission-complete-panel.hidden {
  display: none;
}

.mission-complete-panel-inner {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1rem;
  padding: 1.75rem 1.5rem 1.5rem;
  border-radius: 20px;
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.14) 0%,
    rgba(255, 255, 255, 0.06) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 25px 50px -12px rgba(0, 0, 0, 0.45),
    0 0 40px rgba(251, 191, 36, 0.12);
  backdrop-filter: blur(12px);
  animation: mission-panel-in 0.65s cubic-bezier(0.34, 1.2, 0.64, 1) both;
}

.mission-complete-kicker {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.35em;
  color: #fde68a;
  text-shadow: 0 0 20px rgba(251, 191, 36, 0.7);
  animation: mission-stars-pulse 2s ease-in-out infinite;
}

.mission-complete-headline {
  margin: 0;
  font-size: clamp(1.45rem, 4.5vw, 2.05rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, #fef9c3 0%, #fde047 35%, #fbbf24 70%, #f59e0b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: #fef3c7;
  filter: drop-shadow(0 3px 12px rgba(0, 0, 0, 0.35));
  animation: mission-headline-in 0.75s cubic-bezier(0.34, 1.35, 0.64, 1) 0.08s both;
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .mission-complete-headline {
    color: transparent;
  }
}

.mission-complete-subline {
  margin: -0.25rem 0 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: #e0e7ff;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
  animation: mission-subline-in 0.6s ease 0.2s both;
}

.mission-complete-list {
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.mission-complete-milestone {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.65rem 0.85rem;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  animation: mission-milestone-in 0.55s cubic-bezier(0.34, 1.2, 0.64, 1) both;
  animation-delay: calc(0.12s + (var(--stagger, 0) * 0.1s));
}

.mission-complete-check {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  background: linear-gradient(145deg, #4ade80 0%, #22c55e 45%, #16a34a 100%);
  box-shadow:
    0 4px 14px rgba(34, 197, 94, 0.45),
    0 0 0 2px rgba(255, 255, 255, 0.2) inset;
}

.mission-complete-milestone-label {
  flex: 1;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
  color: #f8fafc;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.mission-complete-dismiss {
  align-self: center;
  margin-top: 0.35rem;
  padding: 14px 36px;
  font-size: 1.1rem;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(37, 99, 235, 0.45);
  transition: transform 0.12s ease, filter 0.12s ease;
}

.mission-complete-dismiss:hover {
  filter: brightness(1.08);
  transform: translateY(-2px) scale(1.02);
}

@keyframes mission-panel-in {
  from {
    opacity: 0;
    transform: scale(0.94) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes mission-headline-in {
  from {
    opacity: 0;
    transform: scale(0.88) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes mission-subline-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes mission-milestone-in {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes mission-stars-pulse {
  0%,
  100% {
    opacity: 0.85;
    filter: brightness(1);
  }
  50% {
    opacity: 1;
    filter: brightness(1.15);
  }
}

@media (prefers-reduced-motion: reduce) {
  #loading-overlay.has-intro-media #overlay-play:not(:disabled) {
    animation: none;
  }

  .mission-complete-panel-inner,
  .mission-complete-headline,
  .mission-complete-subline,
  .mission-complete-milestone,
  .mission-complete-kicker {
    animation: none;
  }
}
