/* =====================================================================
   Title Screen, Start Menu, Save/Load Manager & In-Game Menu (v6)
   ===================================================================== */

/* ---------------- Title Screen ---------------- */
#title-screen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  box-sizing: border-box;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px calc(env(safe-area-inset-bottom, 0px) + 18px);
  background: #0f172a url('../assets/title_stage_portrait.jpg?v=50') center center / cover no-repeat;
  color: #fff;
  font-family: inherit;
  overflow: hidden;
  -webkit-overflow-scrolling: touch;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

#title-anim-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  pointer-events: none;
}

#title-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

@media (orientation: landscape) and (min-width: 600px) {
  #title-screen {
    background-image: url('../assets/title_stage_wide.jpg?v=50');
    background-position: center center;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 16px 5vw 22px;
  }
}

/* Atmospheric Scrim for Maximum Contrast & Depth without hiding live animation */
.title-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.28) 0%, rgba(15, 23, 42, 0.0) 32%, rgba(15, 23, 42, 0.04) 68%, rgba(15, 23, 42, 0.58) 100%);
  pointer-events: none;
  z-index: 1;
}

@media (orientation: landscape) and (min-width: 600px) {
  .title-scrim {
    background: radial-gradient(circle at 52% 55%, rgba(15, 23, 42, 0.0) 0%, rgba(15, 23, 42, 0.38) 100%);
  }
}

/* Header & AI-Styled Wooden Outback Crest Logo */
.title-header {
  position: relative;
  z-index: 2;
  text-align: center;
  margin-top: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

@media (orientation: landscape) and (min-width: 600px) {
  .title-header {
    max-width: 470px;
    margin-top: 0;
  }
}

.title-h1 {
  margin: 0;
  padding: 0;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.title-logo-img {
  width: clamp(240px, 80vw, 390px);
  max-height: min(30dvh, 250px);
  height: auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.78)) drop-shadow(0 0 22px rgba(251, 146, 60, 0.42));
  animation: titleCrestFloat 4.2s ease-in-out infinite;
}

@media (orientation: landscape) and (min-width: 600px) {
  .title-logo-img {
    width: clamp(270px, 38vw, 450px);
    max-height: 56dvh;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  #title-screen {
    padding: 10px 3.5vw 14px;
  }
  .title-logo-img {
    width: clamp(220px, 34vw, 330px);
    max-height: 64dvh;
  }
  .title-menu-card {
    max-width: 285px;
    padding: 10px 12px;
    gap: 6px;
  }
  .title-btn {
    padding: 8px 13px;
    font-size: 13px;
    border-radius: 12px;
  }
}

/* =====================================================================
   New Game Story Prologue / Intro Cutscene (#story-prologue-overlay)
   ===================================================================== */
#story-prologue-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  box-sizing: border-box;
  z-index: 260;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(8px, calc(env(safe-area-inset-top, 0px) + 6px)) 10px max(8px, calc(env(safe-area-inset-bottom, 0px) + 6px));
  background: radial-gradient(circle at 50% 35%, rgba(15, 23, 42, 0.84) 0%, rgba(2, 6, 23, 0.96) 100%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 1;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

#story-prologue-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.sp-card {
  width: 100%;
  max-width: 600px;
  max-height: 100%;
  box-sizing: border-box;
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.96) 0%, rgba(15, 23, 42, 0.98) 100%);
  border: 2px solid rgba(251, 191, 36, 0.42);
  border-radius: 22px;
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.85), 0 0 32px rgba(245, 158, 11, 0.22);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  color: #f8fafc;
}

.sp-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  background: rgba(15, 23, 42, 0.78);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
}

.sp-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid rgba(251, 191, 36, 0.45);
  color: #fde047;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}

.sp-skip-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #cbd5e1;
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.sp-skip-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.sp-stage {
  position: relative;
  width: 100%;
  height: clamp(110px, 21dvh, 210px);
  background: #0f172a;
  overflow: hidden;
  flex-shrink: 0;
  transition: opacity 0.22s cubic-bezier(0.22, 1, 0.36, 1), transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.sp-stage.sp-slide-fading {
  opacity: 0;
  transform: scale(0.985);
}

.sp-stage-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.04);
  animation: spKenBurns 12s ease-in-out infinite alternate;
}

@keyframes spKenBurns {
  0% { transform: scale(1.02) translate(0, 0); }
  100% { transform: scale(1.10) translate(-1.5%, -1.5%); }
}

.sp-stage-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.15) 0%, rgba(15, 23, 42, 0.22) 55%, rgba(15, 23, 42, 0.94) 100%);
  pointer-events: none;
}

.sp-stage-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  padding: 8px;
}

.sp-body {
  padding: 11px 16px 10px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: opacity 0.22s cubic-bezier(0.22, 1, 0.36, 1), transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.sp-body.sp-slide-fading {
  opacity: 0;
  transform: translateY(6px);
}

.sp-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.sp-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid #fbbf24;
  background: #1e293b;
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}

.sp-title {
  margin: 0;
  font-size: clamp(1rem, 0.85rem + 1.1vw, 1.35rem);
  font-weight: 900;
  color: #fef08a;
  line-height: 1.18;
}

.sp-speaker {
  font-size: 11px;
  font-weight: 800;
  color: #fb923c;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 1px;
}

.sp-text {
  margin: 0;
  font-size: clamp(0.78rem, 0.72rem + 0.45vw, 0.94rem);
  line-height: 1.42;
  color: #e2e8f0;
}

.sp-text strong {
  color: #fde047;
}

.sp-highlights {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 1px;
}

@media (max-width: 350px) {
  .sp-highlights {
    grid-template-columns: 1fr;
  }
}

.sp-hl-card {
  background: rgba(15, 23, 42, 0.68);
  border: 1px solid rgba(251, 191, 36, 0.28);
  border-radius: 11px;
  padding: 7px 9px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.sp-hl-icon {
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 1px;
}

.sp-hl-info strong {
  display: block;
  font-size: 11.5px;
  color: #fef08a;
  margin-bottom: 1px;
}

.sp-hl-info span {
  display: block;
  font-size: 10.8px;
  color: #cbd5e1;
  line-height: 1.28;
}

.sp-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 15px 11px;
  background: rgba(15, 23, 42, 0.88);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
}

@media (max-height: 680px) {
  .sp-stage {
    height: clamp(92px, 17dvh, 145px);
  }
  .sp-body {
    padding: 8px 13px;
    gap: 6px;
  }
  .sp-text {
    font-size: 12.2px;
    line-height: 1.34;
  }
  .sp-hl-card {
    padding: 5px 8px;
  }
  .sp-footer {
    padding: 7px 13px 9px;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .sp-card {
    max-width: 720px;
  }
  .sp-stage {
    height: 82px;
  }
}

.sp-dots {
  display: flex;
  align-items: center;
  gap: 7px;
}

.sp-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
  transition: width 0.2s ease, background 0.2s ease;
  cursor: pointer;
}

.sp-dot.active {
  width: 24px;
  background: #fbbf24;
}

.sp-nav-btns {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sp-btn-prev {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #f8fafc;
  border-radius: 13px;
  padding: 10px 15px;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
}

.sp-btn-next {
  background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #ffffff;
  border-radius: 13px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(234, 88, 12, 0.45);
}

@keyframes titleCrestFloat {
  0%, 100% {
    transform: translateY(0px) scale(1);
    filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.78)) drop-shadow(0 0 20px rgba(251, 146, 60, 0.36));
  }
  50% {
    transform: translateY(-5px) scale(1.018);
    filter: drop-shadow(0 15px 28px rgba(0, 0, 0, 0.82)) drop-shadow(0 0 30px rgba(253, 224, 71, 0.58));
  }
}

.title-subtitle {
  font-size: 14px;
  color: #fdba74;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin: 0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
}

/* Glassmorphic Menu Card */
.title-menu-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 340px;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  border-radius: 24px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0;
}

@media (orientation: landscape) and (min-width: 600px) {
  .title-menu-card {
    margin: 0;
  }
}

.title-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 13px 18px;
  border-radius: 16px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease;
  border: 1px solid rgba(255, 255, 255, 0.18);
  touch-action: manipulation;
  text-decoration: none;
}

.title-btn:active {
  transform: scale(0.97);
}

.title-btn-continue {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.35);
  animation: pulseContinue 3s infinite ease-in-out;
  flex-direction: column;
  gap: 3px;
  padding: 12px 16px;
}

@keyframes pulseContinue {
  0%, 100% {
    box-shadow: 0 6px 20px rgba(234, 88, 12, 0.45);
  }
  50% {
    box-shadow: 0 8px 28px rgba(234, 88, 12, 0.75), 0 0 0 6px rgba(234, 88, 12, 0.2);
  }
}

.title-btn-continue:hover {
  background: linear-gradient(135deg, #fb923c 0%, #ea580c 100%);
}

.title-continue-top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
}

.title-continue-meta {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.95;
  color: #ffedd5;
}

.title-btn-new {
  background: rgba(255, 255, 255, 0.92);
  color: #0f172a;
  border-color: #ffffff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.title-btn-new:hover {
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(255, 255, 255, 0.3);
}

.title-btn-load {
  background: rgba(255, 255, 255, 0.12);
  color: #f1f5f9;
}

.title-btn-load:hover {
  background: rgba(255, 255, 255, 0.2);
}

.title-btn-settings {
  background: transparent;
  color: #cbd5e1;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  padding: 10px 16px;
  font-size: 13px;
}

.title-btn-settings:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

/* Footer */
.title-footer {
  position: relative;
  z-index: 2;
  text-align: center;
  font-size: 11px;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
}

@media (orientation: landscape) and (min-width: 600px) {
  .title-footer {
    position: absolute;
    bottom: 12px;
    left: 44px;
    right: 44px;
  }
}

.title-quote {
  font-style: italic;
  opacity: 0.85;
}

.title-footer-tag {
  color: #fb923c;
  font-weight: 700;
}

/* ---------------- Top HUD Menu Button ---------------- */
#btn-menu {
  background: rgba(15, 23, 42, 0.75);
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  color: #f8fafc;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: transform 0.1s, background 0.15s;
}

#btn-menu:active {
  transform: scale(0.94);
}

/* ---------------- In-Game Menu Modal ---------------- */
.game-menu-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.game-menu-summary {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.gms-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gms-name {
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
}

.gms-sub {
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
}

.gms-badge {
  background: #ffedd5;
  color: #c2410c;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
}

.game-menu-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #0f172a;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s, transform 0.08s;
  text-align: left;
}

.game-menu-btn:hover {
  background: #f8fafc;
}

.game-menu-btn:active {
  transform: scale(0.98);
}

.game-menu-btn .gmb-icon {
  font-size: 20px;
  width: 26px;
  text-align: center;
}

.game-menu-btn .gmb-text {
  flex: 1;
}

.game-menu-btn .gmb-hint {
  font-size: 11px;
  font-weight: 500;
  color: #94a3b8;
  display: block;
}

.game-menu-btn.primary {
  background: #ea580c;
  color: #ffffff;
  border-color: #c2410c;
}

.game-menu-btn.primary:hover {
  background: #f97316;
}

.game-menu-btn.primary .gmb-hint {
  color: #ffedd5;
}

.game-menu-btn.danger {
  color: #dc2626;
  border-color: #fee2e2;
}

.game-menu-btn.danger:hover {
  background: #fef2f2;
}

/* ---------------- Save & Load Manager Modal ---------------- */
.sl-header-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  border-bottom: 2px solid #f1f5f9;
  padding-bottom: 8px;
}

.sl-tab {
  flex: 1;
  padding: 10px;
  border-radius: 12px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.12s, color 0.12s;
}

.sl-tab.active {
  background: #ffedd5;
  color: #c2410c;
}

.sl-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: min(52dvh, 420px);
  overflow-y: auto;
  padding-right: 2px;
}

.sl-card {
  border: 1.5px solid #e2e8f0;
  border-radius: 16px;
  padding: 14px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.sl-card.is-active-slot {
  border-color: #ea580c;
  background: #fffaf5;
}

.sl-card.empty {
  border-style: dashed;
  background: #fafaf9;
}

.sl-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sl-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
}

.sl-tag-auto {
  background: #dbeafe;
  color: #1e40af;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}

.sl-tag-active {
  background: #ffedd5;
  color: #c2410c;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}

.sl-card-date {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 600;
}

.sl-card-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  background: rgba(241, 245, 249, 0.6);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  color: #334155;
}

.sl-stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.sl-stat-item strong {
  color: #0f172a;
}

.sl-empty-hint {
  font-size: 13px;
  color: #94a3b8;
  font-style: italic;
  padding: 8px 0;
}

.sl-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.sl-btn {
  flex: 1;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.08s, background 0.12s;
}

.sl-btn:active {
  transform: scale(0.96);
}

.sl-btn.save-action {
  background: #ea580c;
  color: #ffffff;
  border-color: #c2410c;
}

.sl-btn.save-action:hover {
  background: #f97316;
}

.sl-btn.load-action {
  background: #0284c7;
  color: #ffffff;
  border-color: #0369a1;
}

.sl-btn.load-action:hover {
  background: #0ea5e9;
}

.sl-btn.delete-action {
  flex: 0 0 38px;
  padding: 0;
  color: #94a3b8;
  border-color: #e2e8f0;
  background: transparent;
}

.sl-btn.delete-action:hover {
  color: #dc2626;
  background: #fef2f2;
}

.sl-btn.export-action {
  flex: 0 0 38px;
  padding: 0;
  color: #64748b;
  border-color: #e2e8f0;
  background: transparent;
}

.sl-btn.export-action:hover {
  color: #0f172a;
  background: #f1f5f9;
}

.sl-footer-tools {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.sl-tool-btn {
  background: transparent;
  border: 1px solid #cbd5e1;
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
}

.sl-tool-btn:hover {
  background: #f8fafc;
  color: #0f172a;
}

/* ---------------- New Game Prompt Modal ---------------- */
.newgame-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.newgame-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.newgame-input-wrap label {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}

.newgame-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid #cbd5e1;
  font-family: inherit;
  font-size: 15px;
  color: #0f172a;
  box-sizing: border-box;
}

.newgame-input:focus {
  outline: none;
  border-color: #ea580c;
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.15);
}

.newgame-warn {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.4;
}

.newgame-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

/* =====================================================================
   Global Screen Transition & Dim-In / Dim-Out Curtain (#screen-transition-curtain)
   ===================================================================== */
#screen-transition-curtain {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  z-index: 9500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  background: radial-gradient(circle at 50% 38%, rgba(30, 41, 59, 0.96) 0%, rgba(15, 23, 42, 0.99) 65%, #070b14 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--stc-dur, 380ms) cubic-bezier(0.22, 1, 0.36, 1), visibility var(--stc-dur, 380ms) ease;

  @media (prefers-reduced-motion: reduce) {
    transition-duration: 140ms;
  }
}

#screen-transition-curtain.stc-visible {
  visibility: visible;
  pointer-events: auto;
}

#screen-transition-curtain.stc-active {
  opacity: 1;
}

#screen-transition-curtain.stc-veil {
  background: radial-gradient(circle at 50% 42%, rgba(15, 23, 42, 0.88) 0%, rgba(2, 6, 23, 0.95) 100%);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.stc-card {
  width: min(90vw, 410px);
  padding: 22px 24px 20px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.92) 0%, rgba(15, 23, 42, 0.96) 100%);
  border: 1.5px solid rgba(251, 191, 36, 0.42);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.72), 0 0 28px rgba(245, 158, 11, 0.18);
  text-align: center;
  color: #f8fafc;
  transform: translateY(10px) scale(0.97);
  opacity: 0;
  transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1), opacity 280ms ease;

  @media (prefers-reduced-motion: reduce) {
    transform: none;
    transition: opacity 120ms ease;
  }
}

#screen-transition-curtain.stc-active .stc-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}

#screen-transition-curtain.stc-veil .stc-card {
  width: auto;
  max-width: min(88vw, 360px);
  padding: 12px 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}

.stc-icon {
  font-size: 38px;
  line-height: 1;
  margin-bottom: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(254, 243, 199, 0.22), rgba(245, 158, 11, 0.12));
  border: 1.5px solid rgba(251, 191, 36, 0.45);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  animation: stcIconPulse 1.8s ease-in-out infinite;

  @media (prefers-reduced-motion: reduce) {
    animation: none;
  }
}

#screen-transition-curtain.stc-veil .stc-icon {
  width: 38px;
  height: 38px;
  font-size: 22px;
  margin-bottom: 0;
  flex-shrink: 0;
}

@keyframes stcIconPulse {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3px) scale(1.05); }
}

.stc-text-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.stc-title {
  font-size: 16.5px;
  font-weight: 900;
  color: #fef08a;
  letter-spacing: 0.2px;
  line-height: 1.25;
}

#screen-transition-curtain.stc-veil .stc-title {
  font-size: 14px;
}

.stc-sub {
  font-size: 12.5px;
  font-weight: 600;
  color: #cbd5e1;
  line-height: 1.35;
}

#screen-transition-curtain.stc-veil .stc-sub {
  font-size: 11.5px;
}

.stc-bar-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  margin-top: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

#screen-transition-curtain.stc-veil .stc-bar-track {
  display: none;
}

.stc-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #f59e0b 0%, #fde047 50%, #fb923c 100%);
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.65);
  transition: width var(--stc-bar-dur, 700ms) cubic-bezier(0.22, 1, 0.36, 1);

  @media (prefers-reduced-motion: reduce) {
    transition-duration: 150ms;
  }
}
