/* ==========================================================================
   IMPERIAL STARLIGHT — OFFICIAL VIETNAMESE CRIMSON RED & FIVE-POINTED GOLD
   DESIGN SYSTEM (100% Crisp Unblurred bg.jpg Law Enforced)
   ========================================================================== */

:root {
  --flag-crimson: #DA251D;
  --crimson-deep: #B91C1C;
  --ruby-surface: rgba(69, 10, 10, 0.90);
  --ruby-dark: rgba(42, 5, 5, 0.94);
  --ruby-shadow: #7F1D1D;
  --star-gold: #FFD700;
  --star-bright: #FFFF00;
  --amber-gold: #F59E0B;
  --gold-shadow: #B45309;
  --ivory-text: #FFFDF5;
  --parchment-warm: #FDE68A;
  --jade-green: #10B981;
  --jade-bright: #34D399;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Fredoka', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ivory-text);
  /* 100% CRISP UNBLURRED BACKGROUND LAW: No blur(), no full-screen dark scrim */
  background: url('bg.jpg') center/cover no-repeat fixed;
}

#app-shell {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 540px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ==========================================================================
   REUSABLE RUBY & GOLD CARDS AND BUTTONS
   ========================================================================== */

.ruby-card {
  background: var(--ruby-surface);
  border: 2px solid var(--star-gold);
  border-radius: 18px;
  box-shadow: 0 6px 0 var(--ruby-shadow), 0 10px 24px rgba(0, 0, 0, 0.55);
}

.cta-gold-3d {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 15px 22px;
  font-family: 'Fredoka', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: #3B0707;
  background: linear-gradient(180deg, #FFFF55 0%, #FFD700 45%, #F59E0B 100%);
  border: 2px solid #FFFDF5;
  border-radius: 16px;
  box-shadow: 0 6px 0 var(--gold-shadow), 0 10px 20px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  text-transform: uppercase;
}

.cta-gold-3d:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 var(--gold-shadow), 0 4px 10px rgba(0, 0, 0, 0.4);
}

.pulse-glow {
  animation: goldPulse 2.2s infinite ease-in-out;
}

@keyframes goldPulse {
  0%, 100% {
    box-shadow: 0 6px 0 var(--gold-shadow), 0 0 14px rgba(255, 215, 0, 0.45);
  }
  50% {
    box-shadow: 0 6px 0 var(--gold-shadow), 0 0 28px rgba(255, 255, 0, 0.85);
  }
}

.pill-btn {
  padding: 10px 16px;
  font-family: 'Fredoka', sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.pill-btn:active {
  transform: translateY(2px);
}

.gold-outline {
  background: rgba(185, 28, 28, 0.88);
  color: var(--ivory-text);
  border: 2px solid var(--star-gold);
  box-shadow: 0 4px 0 #450A0A;
}

.gold-sm-btn {
  padding: 8px 14px;
  font-family: 'Fredoka', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  color: #3B0707;
  background: linear-gradient(180deg, #FFE866 0%, #FFD700 60%, #F59E0B 100%);
  border: 2px solid #FFFDF5;
  border-radius: 10px;
  box-shadow: 0 4px 0 var(--gold-shadow);
  cursor: pointer;
}

.gold-sm-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--gold-shadow);
}

.crimson-sm-btn {
  padding: 8px 14px;
  font-family: 'Fredoka', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ivory-text);
  background: linear-gradient(180deg, #EF4444 0%, #B91C1C 100%);
  border: 2px solid var(--parchment-warm);
  border-radius: 10px;
  box-shadow: 0 4px 0 #450A0A;
  cursor: pointer;
}

.full-w-btn {
  width: 100%;
  margin-top: 8px;
  padding: 11px;
}

.star-color {
  color: var(--star-gold);
}

.jade-color {
  color: var(--jade-bright);
}

/* ==========================================================================
   SCREEN SWITCHING (HeroMainMenuPush)
   ========================================================================== */

.screen {
  display: none;
  width: 100%;
  height: 100%;
  flex-direction: column;
}

.screen.active {
  display: flex;
}

/* ==========================================================================
   1. WELCOME / TITLE SCREEN
   ========================================================================== */

#screen-welcome {
  justify-content: center;
  align-items: center;
  padding: 18px;
}

.welcome-container {
  width: 100%;
  padding: 24px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.top-festival-ribbon {
  display: inline-block;
  background: linear-gradient(90deg, #B91C1C, #DA251D, #B91C1C);
  border: 1.5px solid var(--star-gold);
  color: var(--parchment-warm);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 1.4px;
  padding: 5px 16px;
  border-radius: 999px;
}

.hero-logo-frame {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 4px;
}

.hero-logo-img {
  width: 126px;
  height: 126px;
  object-fit: cover;
  border-radius: 24px;
  border: 3px solid var(--star-gold);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.65), 0 0 18px rgba(255, 215, 0, 0.45);
}

.star-crown-badge {
  margin-top: -12px;
  background: #450A0A;
  border: 2px solid var(--star-gold);
  color: var(--star-gold);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  letter-spacing: 0.8px;
}

.brand-title {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--star-gold);
  text-shadow: 0 3px 0 #7F1D1D, 0 5px 12px rgba(0, 0, 0, 0.6);
  letter-spacing: 0.8px;
}

.lore-subtitle {
  font-size: 0.94rem;
  line-height: 1.42;
  color: var(--ivory-text);
  max-width: 440px;
}

.welcome-Quick-toggles {
  display: flex;
  gap: 10px;
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
}

/* ==========================================================================
   2. MAIN MENU HUB
   ========================================================================== */

#screen-hub {
  padding: 12px 14px 16px;
  gap: 10px;
}

.hub-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  flex-shrink: 0;
}

.hub-brand-mini {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mini-logo {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 2px solid var(--star-gold);
  object-fit: cover;
}

.dynasty-rank-tag {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--parchment-warm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hub-title-small {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--star-gold);
}

.currency-cluster {
  display: flex;
  gap: 8px;
}

.currency-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--ruby-dark);
  border: 1.5px solid var(--star-gold);
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
}

.hub-scroll-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding-bottom: 10px;
}

.hub-hero-banner {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.hero-banner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.chapter-pill {
  background: var(--flag-crimson);
  border: 1.5px solid var(--star-gold);
  color: var(--ivory-text);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}

.stage-stars-earned {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--star-gold);
}

.hero-banner-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hub-center-emblem {
  width: 76px;
  height: 76px;
  border-radius: 16px;
  border: 2.5px solid var(--star-gold);
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.hero-stage-preview h2 {
  font-size: 1.12rem;
  color: var(--star-gold);
  margin-bottom: 3px;
}

.hero-stage-preview p {
  font-size: 0.83rem;
  color: var(--ivory-text);
  line-height: 1.3;
  margin-bottom: 6px;
}

.stage-meta-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.meta-badge {
  background: rgba(185, 28, 28, 0.9);
  border: 1px solid var(--parchment-warm);
  color: var(--parchment-warm);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
}

.dynasty-progress-box {
  background: var(--ruby-dark);
  border: 1px solid rgba(255, 215, 0, 0.45);
  border-radius: 10px;
  padding: 8px 10px;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.76rem;
  color: var(--parchment-warm);
  margin-bottom: 5px;
  font-weight: 600;
}

.progress-track {
  width: 100%;
  height: 9px;
  background: #2A0505;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 215, 0, 0.4);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #DA251D, #FFD700, #FFFF00);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.big-launch-btn {
  font-size: 1.2rem;
  padding: 14px 20px;
}

/* Dragon Loadout Strip */
.hub-stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 10px 8px;
  text-align: center;
  gap: 4px;
}

.stat-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-right: 1px solid rgba(255, 215, 0, 0.25);
}

.stat-cell:last-child {
  border-right: none;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--parchment-warm);
}

.stat-val {
  font-size: 0.92rem;
  color: var(--star-gold);
}

/* 4 Secondary Navigation Grid */
.hub-nav-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.nav-card-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 11px;
  text-align: left;
  color: var(--ivory-text);
  font-family: 'Fredoka', sans-serif;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease;
}

.nav-card-btn:active {
  transform: translateY(3px);
}

.nav-card-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--flag-crimson), #7F1D1D);
  border: 2px solid var(--star-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.nav-card-text h3 {
  font-size: 0.84rem;
  color: var(--star-gold);
  line-height: 1.15;
  margin-bottom: 2px;
}

.nav-card-text p {
  font-size: 0.72rem;
  color: var(--parchment-warm);
  line-height: 1.15;
}

/* ==========================================================================
   3. SEPARATE FULLSCREEN GAMEPLAY ARENA
   ========================================================================== */

#screen-arena {
  position: relative;
  justify-content: space-between;
  padding: 8px 10px 12px;
}

.arena-hud {
  z-index: 10;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.hud-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hud-stage-info {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hud-stage-tag {
  background: var(--flag-crimson);
  border: 1.5px solid var(--star-gold);
  color: var(--star-gold);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
}

.hud-stage-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ivory-text);
}

.hud-hearts {
  font-size: 0.95rem;
  color: #FF4D4D;
  letter-spacing: 2px;
  text-shadow: 0 0 6px rgba(255, 215, 0, 0.7);
}

.hud-pause-btn {
  background: var(--ruby-dark);
  border: 1.5px solid var(--star-gold);
  color: var(--star-gold);
  font-family: 'Fredoka', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.hud-bottom-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  background: var(--ruby-dark);
  border: 1px solid rgba(255, 215, 0, 0.35);
  border-radius: 10px;
  padding: 5px 8px;
  text-align: center;
}

.hud-metric {
  display: flex;
  flex-direction: column;
}

.metric-lbl {
  font-size: 0.64rem;
  color: var(--parchment-warm);
  letter-spacing: 0.5px;
}

.metric-num {
  font-size: 0.86rem;
  color: var(--ivory-text);
}

.combo-badge {
  color: var(--star-bright);
}

/* Boss HUD Strip */
.boss-hud-strip {
  background: #2A0505;
  border: 1.5px solid #FF4444;
  border-radius: 8px;
  padding: 4px 8px;
}

.boss-hud-top {
  display: flex;
  justify-content: space-between;
  font-size: 0.74rem;
  font-weight: 700;
  color: #FCA5A5;
  margin-bottom: 3px;
}

.boss-hp-track {
  width: 100%;
  height: 8px;
  background: #1A0303;
  border-radius: 999px;
  overflow: hidden;
}

.boss-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #EF4444, #FFD700);
  transition: width 0.15s ease;
}

/* Canvas Area - Transparent so bg.jpg shines through 100% crisp! */
.canvas-wrapper {
  position: relative;
  flex: 1;
  width: 100%;
  margin: 6px 0;
  border-radius: 16px;
  border: 2px solid rgba(255, 215, 0, 0.75);
  overflow: hidden;
  background: rgba(42, 5, 5, 0.18);
  box-shadow: inset 0 0 24px rgba(69, 10, 10, 0.45);
}

#dragon-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* Bottom Skill Dock */
.arena-Action-dock {
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  flex-shrink: 0;
}

.skill-dock-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 8px;
  border-radius: 14px;
  border: 2px solid var(--star-gold);
  background: var(--ruby-surface);
  color: var(--ivory-text);
  font-family: 'Fredoka', sans-serif;
  box-shadow: 0 4px 0 var(--ruby-shadow);
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease;
}

.skill-dock-btn:active {
  transform: translateY(3px);
}

.skill-dock-btn.ready-glow {
  background: linear-gradient(180deg, #DA251D 0%, #7F1D1D 100%);
  border-color: var(--star-bright);
  box-shadow: 0 4px 0 #450A0A, 0 0 12px rgba(255, 215, 0, 0.65);
}

.skill-icon {
  font-size: 1.25rem;
}

.skill-txt {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.skill-txt strong {
  font-size: 0.76rem;
  color: var(--star-gold);
}

.skill-txt small {
  font-size: 0.68rem;
  color: var(--parchment-warm);
}

/* ==========================================================================
   MODALS (STAGES, SHOP, TROPHIES, SETTINGS, RESULT)
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(25, 3, 3, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.hidden {
  display: none !important;
}

.modal-window {
  width: 100%;
  max-width: 500px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(90deg, #7F1D1D, #B91C1C);
  border-bottom: 2px solid var(--star-gold);
}

.modal-header h2 {
  font-size: 1.08rem;
  color: var(--star-gold);
}

.modal-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 2px solid var(--star-gold);
  background: #450A0A;
  color: var(--star-gold);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.modal-body-scroll {
  padding: 14px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Chapter Tabs & 30 Stages Grid */
.chapter-tabs, .settings-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--ruby-dark);
  border-bottom: 2px solid var(--star-gold);
}

.chapter-tab, .settings-tab {
  padding: 10px 6px;
  background: transparent;
  border: none;
  border-right: 1px solid rgba(255, 215, 0, 0.3);
  color: var(--parchment-warm);
  font-family: 'Fredoka', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.chapter-tab.active, .settings-tab.active {
  background: var(--flag-crimson);
  color: var(--star-bright);
}

.chapter-info-banner {
  background: var(--ruby-dark);
  border: 1px solid var(--star-gold);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 0.8rem;
  color: var(--parchment-warm);
  line-height: 1.35;
}

.stages-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
}

.stage-card {
  background: var(--ruby-dark);
  border: 2px solid rgba(255, 215, 0, 0.55);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.stage-card:active {
  transform: scale(0.98);
}

.stage-card.boss-stage {
  border-color: #FF5555;
  background: linear-gradient(180deg, rgba(127, 29, 29, 0.92), rgba(42, 5, 5, 0.95));
}

.stage-card.locked {
  opacity: 0.55;
  border-color: rgba(255, 255, 255, 0.25);
}

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

.stage-num-badge {
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--flag-crimson);
  color: var(--star-gold);
  padding: 2px 7px;
  border-radius: 6px;
}

.stage-stars-row {
  font-size: 0.88rem;
  color: var(--star-gold);
  letter-spacing: 1px;
}

.stage-card h4 {
  font-size: 0.88rem;
  color: var(--ivory-text);
}

.stage-card p {
  font-size: 0.72rem;
  color: var(--parchment-warm);
}

/* Shop List */
.shop-currency-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 14px;
  background: var(--ruby-dark);
  border-bottom: 1.5px solid rgba(255, 215, 0, 0.4);
  font-size: 0.85rem;
}

.shop-list, .trophies-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shop-card, .trophy-card {
  background: var(--ruby-dark);
  border: 1.5px solid var(--star-gold);
  border-radius: 13px;
  padding: 11px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.shop-info h4, .trophy-info h4 {
  font-size: 0.94rem;
  color: var(--star-gold);
  margin-bottom: 2px;
}

.shop-info p, .trophy-info p {
  font-size: 0.76rem;
  color: var(--ivory-text);
  line-height: 1.3;
}

.shop-lvl-tag {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--parchment-warm);
  font-weight: 700;
}

/* Settings & Legal */
.stab-pane {
  display: none;
  flex-direction: column;
  gap: 10px;
}

.stab-pane.active {
  display: flex;
}

.setting-row-card, .sub-module-card {
  background: var(--ruby-dark);
  border: 1.5px solid rgba(255, 215, 0, 0.6);
  border-radius: 12px;
  padding: 12px;
}

.setting-row-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.setting-row-card h4, .sub-module-card h4 {
  font-size: 0.92rem;
  color: var(--star-gold);
  margin-bottom: 3px;
}

.setting-row-card p, .sub-module-card p {
  font-size: 0.76rem;
  color: var(--parchment-warm);
  line-height: 1.32;
}

.about-status-box {
  background: linear-gradient(135deg, #7F1D1D, #450A0A);
  border: 2px solid var(--star-gold);
  border-radius: 12px;
  padding: 12px;
}

.about-app-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.about-mini-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  border: 2px solid var(--star-gold);
}

.version-badge, .engine-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  margin-top: 3px;
  margin-right: 4px;
}

.version-badge {
  background: var(--flag-crimson);
  border: 1px solid var(--star-gold);
  color: var(--ivory-text);
}

.engine-badge {
  background: #064E3B;
  border: 1px solid var(--jade-bright);
  color: var(--jade-bright);
}

.about-summary-text {
  font-size: 0.78rem;
  line-height: 1.38;
  color: var(--ivory-text);
}

/* Rate Widget & Inputs */
.rate-stars-row {
  display: flex;
  gap: 8px;
  margin: 8px 0;
}

.star-pick-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1.5px solid var(--star-gold);
  background: #450A0A;
  color: rgba(255, 215, 0, 0.35);
  font-size: 1.3rem;
  cursor: pointer;
}

.star-pick-btn.lit {
  color: var(--star-bright);
  background: var(--flag-crimson);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
}

.field-lbl {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--parchment-warm);
  margin: 8px 0 3px;
}

.imperial-input {
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1.5px solid var(--star-gold);
  background: #2A0505;
  color: var(--ivory-text);
  font-family: 'Fredoka', sans-serif;
  font-size: 0.84rem;
}

.invite-code-box {
  margin: 8px 0;
  padding: 10px;
  background: #2A0505;
  border: 1.5px dashed var(--star-gold);
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--star-bright);
  text-align: center;
}

.feedback-note {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #064E3B;
  border: 1px solid var(--jade-bright);
  color: var(--ivory-text);
  font-size: 0.78rem;
}

.ticket-history-wrap {
  margin-top: 12px;
  border-top: 1px solid rgba(255, 215, 0, 0.3);
  padding-top: 8px;
}

.ticket-history-wrap h5 {
  font-size: 0.8rem;
  color: var(--star-gold);
  margin-bottom: 6px;
}

.ticket-log-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 130px;
  overflow-y: auto;
}

.ticket-item {
  background: #450A0A;
  border: 1px solid rgba(255, 215, 0, 0.45);
  border-radius: 8px;
  padding: 6px 9px;
  font-size: 0.74rem;
}

.legal-switch-row {
  display: flex;
  gap: 8px;
}

.legal-switch-row button {
  flex: 1;
}

.legal-scroll-box {
  background: var(--ruby-dark);
  border: 1.5px solid var(--star-gold);
  border-radius: 12px;
  padding: 12px;
  max-height: 320px;
  overflow-y: auto;
  font-size: 0.8rem;
  line-height: 1.45;
}

.legal-scroll-box h3 {
  color: var(--star-gold);
  font-size: 0.96rem;
  margin-bottom: 6px;
}

.legal-scroll-box h4 {
  color: var(--parchment-warm);
  font-size: 0.86rem;
  margin-top: 10px;
  margin-bottom: 3px;
}

/* Tutorial Step Cards */
.tutorial-step-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--ruby-dark);
  border: 1.5px solid var(--star-gold);
  border-radius: 12px;
  padding: 11px;
}

.step-badge {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--flag-crimson);
  border: 2px solid var(--star-gold);
  color: var(--star-bright);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tutorial-step-card h4 {
  color: var(--star-gold);
  font-size: 0.9rem;
  margin-bottom: 3px;
}

.tutorial-step-card p {
  font-size: 0.78rem;
  line-height: 1.35;
}

/* Result Window */
.result-window {
  padding: 20px 18px;
  text-align: center;
  align-items: center;
  gap: 10px;
}

.result-ribbon {
  background: var(--flag-crimson);
  border: 1.5px solid var(--star-gold);
  color: var(--star-gold);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 999px;
}

.result-stars-display {
  font-size: 2.2rem;
  color: var(--star-gold);
  text-shadow: 0 0 14px rgba(255, 215, 0, 0.8);
  letter-spacing: 6px;
}

.result-stats-box {
  width: 100%;
  background: var(--ruby-dark);
  border: 1.5px solid rgba(255, 215, 0, 0.5);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.res-line {
  display: flex;
  justify-content: space-between;
  font-size: 0.86rem;
}

.result-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

/* Toast Notification */
.imperial-toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 250;
  background: linear-gradient(90deg, #7F1D1D, #DA251D);
  border: 2px solid var(--star-gold);
  color: var(--ivory-text);
  font-size: 0.86rem;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.65);
  text-align: center;
  max-width: 90%;
}


/* ==========================================================================
   STRICT MOBILE PORTRAIT FRAME & TOUCH OPTIMIZATION (PHONE-ONLY VIEWPORT)
   ========================================================================== */
html {
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

body {
  width: 100%;
  max-width: 480px;
  height: 100dvh;
  margin: 0 auto !important;
  position: relative;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
}

#app-shell,
#app-root,
.screen {
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

canvas {
  touch-action: none;
  display: block;
}
