@import url('https://fonts.googleapis.com/css2?family=Bungee&family=Rubik:wght@400;500;600;700;800&display=swap');

:root {
  --emerald: #22C55E;
  --emerald-dark: #15803D;
  --gold: #FACC15;
  --gold-dark: #CA8A04;
  --orange: #F97316;
  --orange-dark: #C2410C;
  --sky: #0EA5E9;
  --sky-dark: #0284C7;
  --text-dark: #1E293B;
  --text-muted: #475569;
  --surface-ivory: rgba(235, 255, 255, 0.92);
  --surface-bright: rgba(248, 255, 255, 0.96);
  --border-crisp: 1.5px solid rgba(14, 165, 233, 0.45);
  --border-gold: 2px solid #FACC15;
  --radius-card: 24px;
  --radius-pill: 999px;
  --shadow-card: 0 8px 22px rgba(15, 23, 42, 0.16), 0 2px 0 rgba(255, 255, 255, 0.75) inset;
  --font-head: 'Bungee', system-ui, sans-serif;
  --font-body: 'Rubik', system-ui, sans-serif;
}

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

html, body {
  width: 100%;
  height: 100%;
  font-family: var(--font-body);
  color: var(--text-dark);
  background-color: #0EA5E9;
  background-image: url('bg.jpg');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  background-attachment: scroll;
  overflow: hidden;
}

.app-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  position: relative;
  background-image: url('bg.jpg');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  background-attachment: scroll;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.32);
}

/* =========================================================
   TOP STATUS HEADER
   ========================================================= */
.top-status-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px 6px;
  z-index: 15;
}

.top-status-bar.hidden {
  display: none !important;
}

.brand-mini {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-ivory);
  border: var(--border-crisp);
  border-radius: var(--radius-pill);
  padding: 4px 12px 4px 5px;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.14);
  cursor: pointer;
  min-width: 0;
}

.brand-mini-logo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--gold);
  flex-shrink: 0;
}

.brand-mini-title {
  font-family: var(--font-head);
  font-size: 0.76rem;
  color: var(--text-dark);
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-ivory);
  border: var(--border-crisp);
  border-radius: var(--radius-pill);
  padding: 5px 10px;
  font-family: var(--font-head);
  font-size: 0.74rem;
  color: var(--text-dark);
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.12);
  cursor: pointer;
  transition: transform 0.14s ease;
}

.status-pill:active {
  transform: scale(0.95);
}

.coin-pill {
  border-color: rgba(250, 204, 21, 0.8);
}

.star-pill {
  border-color: rgba(34, 197, 94, 0.65);
}

.icon-circle-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface-ivory);
  border: var(--border-crisp);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.12);
  transition: transform 0.15s ease;
}

.icon-circle-btn:active {
  transform: scale(0.92);
}

/* =========================================================
   VIEWPORT & SCREEN SWITCHING RULES
   ========================================================= */
.screens-viewport {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

.screen {
  display: none;
  width: 100%;
  height: 100%;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

.screen:not(.active) {
  display: none !important;
}

.screen-scroll-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 6px 12px 18px;
}

/* =========================================================
   STATIC FLEX BOTTOM NAVIGATION (NEVER position:fixed)
   ========================================================= */
.bottom-nav {
  flex-shrink: 0;
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  background: rgba(235, 255, 255, 0.95);
  border-top: 2px solid rgba(14, 165, 233, 0.45);
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.12);
}

.bottom-nav.hidden {
  display: none !important;
}

.nav-tab-btn {
  appearance: none;
  border: 1.5px solid transparent;
  background: transparent;
  border-radius: 14px;
  padding: 5px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  color: var(--text-muted);
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.15s ease;
}

.nav-tab-btn:active {
  transform: scale(0.92);
}

.nav-tab-btn.active {
  background: rgba(34, 197, 94, 0.18);
  border-color: var(--emerald);
  color: var(--text-dark);
}

.nav-tab-play {
  background: linear-gradient(135deg, var(--orange), #FB923C);
  color: #FFFFFF;
  border-color: #FACC15;
  box-shadow: 0 3px 10px rgba(249, 115, 22, 0.35);
}

.nav-tab-play.active {
  background: linear-gradient(135deg, var(--emerald), #16A34A);
  color: #FFFFFF;
  border-color: #FACC15;
}

.nav-tab-icon {
  font-size: 1.12rem;
  line-height: 1;
}

.nav-tab-label {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.64rem;
  letter-spacing: 0.1px;
  white-space: nowrap;
}

/* =========================================================
   REUSABLE TACTILE CARDS & BUTTONS
   ========================================================= */
.tactile-card {
  background: var(--surface-ivory);
  border: var(--border-crisp);
  border-radius: var(--radius-card);
  padding: 14px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.screen-heading {
  font-family: var(--font-head);
  font-size: 1.05rem;
  color: var(--text-dark);
  line-height: 1.2;
}

.screen-sub {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
}

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

.card-section-title {
  font-family: var(--font-head);
  font-size: 0.86rem;
  color: var(--text-dark);
}

.card-section-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 500;
}

.btn-primary-xl,
.btn-primary-lg {
  appearance: none;
  border: 2px solid #FEF08A;
  background: linear-gradient(180deg, #22C55E 0%, #16A34A 100%);
  color: #FFFFFF;
  font-family: var(--font-head);
  font-size: 0.96rem;
  letter-spacing: 0.6px;
  border-radius: 18px;
  padding: 13px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 5px 0 #15803D, 0 8px 18px rgba(22, 163, 74, 0.36);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  width: 100%;
}

.btn-primary-xl:active,
.btn-primary-lg:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #15803D, 0 4px 10px rgba(22, 163, 74, 0.3);
}

.btn-secondary-md {
  appearance: none;
  border: 1.5px solid var(--sky);
  background: #FFFFFF;
  color: var(--text-dark);
  font-family: var(--font-head);
  font-size: 0.8rem;
  border-radius: 16px;
  padding: 10px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(14, 165, 233, 0.35);
  transition: transform 0.12s ease;
}

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

/* =========================================================
   SCREEN #1: WELCOME / INTRO SCREEN (Single Viewport, Zero Scroll)
   ========================================================= */
#screen-welcome {
  padding: 10px 12px;
  justify-content: space-between;
  overflow: hidden;
}

.welcome-card {
  flex: 1;
  min-height: 0;
  background: var(--surface-ivory);
  border: 2px solid rgba(250, 204, 21, 0.85);
  border-radius: 26px;
  padding: 12px 14px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.welcome-header-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 3px;
  flex-shrink: 0;
}

.welcome-badge {
  background: linear-gradient(90deg, var(--orange), var(--gold));
  color: var(--text-dark);
  font-family: var(--font-head);
  font-size: 0.65rem;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.7px;
}

.welcome-title {
  font-family: var(--font-head);
  font-size: clamp(1.3rem, 5vw, 1.65rem);
  color: var(--text-dark);
  text-shadow: 0 2px 0 #FACC15;
  line-height: 1.1;
}

.welcome-tagline {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 500;
  max-width: 360px;
  line-height: 1.28;
}

.welcome-preview-box {
  flex: 1;
  min-height: 120px;
  max-height: 230px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(14, 165, 233, 0.14);
  border: 1.5px solid rgba(14, 165, 233, 0.5);
  border-radius: 18px;
  padding: 6px;
}

#welcome-canvas {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 85px;
  border-radius: 13px;
  display: block;
}

.preview-status-strip {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 6px;
}

.preview-chip {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-dark);
  background: rgba(255, 255, 255, 0.86);
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(14, 165, 233, 0.35);
}

.welcome-features-grid {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.feature-chip-card {
  background: #FFFFFF;
  border: 1.5px solid rgba(14, 165, 233, 0.35);
  border-radius: 16px;
  padding: 7px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
}

.feature-icon-wrap {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.emerald-tint { background: rgba(34, 197, 94, 0.2); }
.orange-tint { background: rgba(249, 115, 22, 0.2); }
.gold-tint { background: rgba(250, 204, 21, 0.28); }

.feature-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.feature-name {
  font-family: var(--font-head);
  font-size: 0.64rem;
  color: var(--text-dark);
  line-height: 1.15;
}

.feature-desc {
  font-size: 0.62rem;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.15;
}

.welcome-actions {
  flex-shrink: 0;
}

/* =========================================================
   SCREEN #2: HOME MENU
   ========================================================= */
.hero-top-split {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hero-mascot-thumb {
  width: 66px;
  height: 66px;
  border-radius: 18px;
  object-fit: cover;
  border: 2px solid var(--gold);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
  flex-shrink: 0;
}

.hero-title-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.eyebrow-tag {
  font-family: var(--font-head);
  font-size: 0.64rem;
  color: var(--orange-dark);
  letter-spacing: 0.5px;
}

.hero-stage-heading {
  font-family: var(--font-head);
  font-size: 1.05rem;
  color: var(--text-dark);
}

.hero-stage-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.live-metrics-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.metric-tile {
  background: #FFFFFF;
  border: 1.5px solid rgba(14, 165, 233, 0.35);
  border-radius: 16px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;
}

.metric-icon {
  font-size: 1.15rem;
}

.metric-value {
  font-family: var(--font-head);
  font-size: 0.84rem;
  color: var(--text-dark);
}

.metric-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
}

.hero-cta-row {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 8px;
}

/* 7-Day Check-In Grid */
.streak-pill {
  background: linear-gradient(135deg, var(--gold), #FDE047);
  color: var(--text-dark);
  font-family: var(--font-head);
  font-size: 0.66rem;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--orange);
  white-space: nowrap;
}

.checkin-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.checkin-day-tile {
  background: #FFFFFF;
  border: 1.5px solid rgba(148, 163, 184, 0.45);
  border-radius: 14px;
  padding: 6px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 3px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.14s ease;
}

.checkin-day-tile.claimed {
  background: rgba(34, 197, 94, 0.18);
  border-color: var(--emerald);
}

.checkin-day-tile.available {
  background: linear-gradient(180deg, #FEF9C3, #FDE047);
  border: 2px solid var(--orange);
  box-shadow: 0 3px 10px rgba(249, 115, 22, 0.28);
  transform: translateY(-2px);
}

.checkin-day-tile.locked {
  opacity: 0.65;
  cursor: not-allowed;
}

.cday-num {
  font-family: var(--font-head);
  font-size: 0.58rem;
  color: var(--text-muted);
}

.cday-icon {
  font-size: 1rem;
}

.cday-reward {
  font-weight: 700;
  font-size: 0.58rem;
  color: var(--text-dark);
}

/* Equipped Rig Preview */
.btn-chip-action {
  background: var(--sky);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-pill);
  padding: 5px 11px;
  font-family: var(--font-head);
  font-size: 0.66rem;
  cursor: pointer;
}

.loadout-slots-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.loadout-slot {
  background: #FFFFFF;
  border: 1.5px solid rgba(14, 165, 233, 0.35);
  border-radius: 16px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.slot-emoji {
  font-size: 1.4rem;
}

.slot-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.slot-type {
  font-size: 0.64rem;
  color: var(--text-muted);
  font-weight: 600;
}

.slot-name {
  font-family: var(--font-head);
  font-size: 0.72rem;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-stack-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.quick-nav-card {
  flex-direction: row;
  align-items: center;
  padding: 12px;
  cursor: pointer;
  text-align: left;
  transition: transform 0.14s ease;
}

.quick-nav-card:active {
  transform: scale(0.97);
}

.quick-card-icon {
  font-size: 1.65rem;
  flex-shrink: 0;
}

.quick-card-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.quick-card-title {
  font-family: var(--font-head);
  font-size: 0.8rem;
  color: var(--text-dark);
}

.quick-card-sub {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--emerald-dark);
}

/* =========================================================
   SCREEN #3: LEVEL SELECT (30 Levels across 3 Acts)
   ========================================================= */
.levels-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.act-stars-badge {
  background: var(--gold);
  border: 1.5px solid var(--orange);
  border-radius: var(--radius-pill);
  padding: 5px 11px;
  font-family: var(--font-head);
  font-size: 0.76rem;
  color: var(--text-dark);
  white-space: nowrap;
}

.act-tabs-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.act-tab {
  background: #FFFFFF;
  border: 1.5px solid rgba(14, 165, 233, 0.4);
  border-radius: 14px;
  padding: 7px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  color: var(--text-muted);
}

.act-tab.active {
  background: linear-gradient(180deg, var(--emerald), #16A34A);
  color: #FFFFFF;
  border-color: var(--gold);
  box-shadow: 0 4px 10px rgba(22, 163, 74, 0.3);
}

.act-tab-num {
  font-family: var(--font-head);
  font-size: 0.72rem;
}

.act-tab-name {
  font-size: 0.64rem;
  font-weight: 700;
}

.act-banner-info {
  background: rgba(14, 165, 233, 0.12);
  border-left: 4px solid var(--sky);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.73rem;
  line-height: 1.35;
  color: var(--text-dark);
}

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

.level-tile {
  background: var(--surface-ivory);
  border: 2px solid rgba(14, 165, 233, 0.45);
  border-radius: 20px;
  padding: 11px 12px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.14s ease;
}

.level-tile:active {
  transform: scale(0.97);
}

.level-tile.boss-tile {
  border-color: var(--orange);
  background: linear-gradient(180deg, rgba(254, 249, 195, 0.94), rgba(235, 255, 255, 0.94));
}

.level-tile.locked {
  opacity: 0.62;
  cursor: not-allowed;
}

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

.lvl-num-badge {
  font-family: var(--font-head);
  font-size: 0.82rem;
  color: var(--text-dark);
}

.lvl-boss-tag {
  background: var(--orange);
  color: #FFFFFF;
  font-family: var(--font-head);
  font-size: 0.58rem;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
}

.lvl-title {
  font-weight: 700;
  font-size: 0.76rem;
  color: var(--text-dark);
}

.lvl-goal {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.lvl-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
}

.lvl-stars {
  font-size: 0.85rem;
  letter-spacing: 1px;
}

.lvl-play-pill {
  background: var(--emerald);
  color: #FFFFFF;
  font-family: var(--font-head);
  font-size: 0.62rem;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
}

/* =========================================================
   SCREEN #4: GAME SCREEN (Single Viewport, 60fps Canvas)
   ========================================================= */
#screen-game {
  padding: 8px 10px;
  gap: 6px;
  overflow: hidden;
}

.game-hud-top {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.hud-pill-group {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
  min-width: 0;
  flex: 1;
}

.game-hud-pill {
  background: var(--surface-ivory);
  border: 1.5px solid rgba(14, 165, 233, 0.55);
  border-radius: 14px;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.14);
  min-width: 0;
}

.hud-label {
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--text-muted);
}

.hud-val {
  font-family: var(--font-head);
  font-size: 0.72rem;
  color: var(--text-dark);
  white-space: nowrap;
}

.hud-actions-group {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.hud-icon-btn {
  height: 34px;
  min-width: 34px;
  padding: 0 8px;
  border-radius: 12px;
  background: var(--surface-ivory);
  border: 1.5px solid var(--gold-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-family: var(--font-head);
  font-size: 0.75rem;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.15);
}

.booster-count {
  font-size: 0.68rem;
  color: var(--orange-dark);
}

.game-subhud-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.objective-progress-wrap {
  flex: 1;
  height: 22px;
  background: rgba(255, 255, 255, 0.88);
  border: 1.5px solid rgba(14, 165, 233, 0.55);
  border-radius: var(--radius-pill);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: 0 10px;
}

.objective-progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, #22C55E, #FACC15);
  transition: width 0.2s ease;
}

.objective-progress-text {
  position: relative;
  z-index: 2;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shield-pips {
  background: var(--surface-ivory);
  border: 1.5px solid var(--emerald);
  border-radius: var(--radius-pill);
  padding: 2px 9px;
  font-family: var(--font-head);
  font-size: 0.7rem;
  color: var(--text-dark);
  flex-shrink: 0;
}

.game-canvas-wrap {
  flex: 1;
  min-height: 0;
  width: 100%;
  border-radius: 22px;
  border: 2.5px solid rgba(250, 204, 21, 0.9);
  box-shadow: 0 8px 25px rgba(15, 23, 42, 0.25);
  overflow: hidden;
  position: relative;
  background: rgba(14, 165, 233, 0.2);
}

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

/* =========================================================
   SCREEN #5: GEAR & UPGRADE ARMORY
   ========================================================= */
.armory-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.armory-wallet-box {
  background: #FFFFFF;
  border: 1.5px solid var(--gold-dark);
  border-radius: 14px;
  padding: 6px 10px;
  font-family: var(--font-head);
  font-size: 0.74rem;
  text-align: right;
  flex-shrink: 0;
}

.shard-line {
  font-size: 0.66rem;
  color: var(--sky-dark);
}

.upgrade-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.upgrade-row-card {
  background: #FFFFFF;
  border: 1.5px solid rgba(14, 165, 233, 0.35);
  border-radius: 16px;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.upg-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.upg-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(14, 165, 233, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.upg-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.upg-title {
  font-family: var(--font-head);
  font-size: 0.76rem;
  color: var(--text-dark);
}

.upg-desc {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.upg-pips-bar {
  display: flex;
  gap: 4px;
  margin-top: 2px;
}

.upg-pip {
  width: 18px;
  height: 6px;
  border-radius: 4px;
  background: #E2E8F0;
}

.upg-pip.filled {
  background: var(--emerald);
}

.btn-buy-upg {
  background: linear-gradient(180deg, var(--gold), #EAB308);
  border: 1.5px solid var(--orange-dark);
  border-radius: 12px;
  padding: 7px 10px;
  font-family: var(--font-head);
  font-size: 0.7rem;
  color: var(--text-dark);
  cursor: pointer;
  flex-shrink: 0;
}

.btn-buy-upg:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

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

.cosmetic-card {
  background: #FFFFFF;
  border: 2px solid rgba(14, 165, 233, 0.35);
  border-radius: 16px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 5px;
}

.cosmetic-card.equipped {
  border-color: var(--emerald);
  background: rgba(34, 197, 94, 0.1);
}

.cosmetic-preview-swatch {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  border: 2px solid rgba(15, 23, 42, 0.12);
}

.cosmetic-name {
  font-family: var(--font-head);
  font-size: 0.73rem;
  color: var(--text-dark);
}

.cosmetic-perk {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 600;
}

.btn-cosmetic-act {
  width: 100%;
  border-radius: 10px;
  padding: 6px 8px;
  font-family: var(--font-head);
  font-size: 0.66rem;
  border: 1.5px solid var(--sky-dark);
  background: var(--sky);
  color: #FFFFFF;
  cursor: pointer;
}

.btn-cosmetic-act.equipped-btn {
  background: var(--emerald);
  border-color: var(--emerald-dark);
}

/* =========================================================
   SCREEN #6: BONUS PRIZE WHEEL
   ========================================================= */
.wheel-canvas-box {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
}

#wheel-canvas {
  width: 260px;
  height: 260px;
  max-width: 100%;
  display: block;
}

.wheel-reward-banner {
  background: #FFFFFF;
  border: 1.5px solid var(--gold-dark);
  border-radius: 14px;
  padding: 9px 12px;
  text-align: center;
  font-family: var(--font-head);
  font-size: 0.78rem;
  color: var(--text-dark);
}

.wheel-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.prize-legend-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.prize-legend-item {
  background: #FFFFFF;
  border: 1px solid rgba(14, 165, 233, 0.35);
  border-radius: 12px;
  padding: 7px 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.7rem;
}

/* =========================================================
   SCREEN #7: TROPHY ROOM & ACHIEVEMENTS
   ========================================================= */
.trophy-counter-pill {
  background: var(--gold);
  border: 1.5px solid var(--orange);
  border-radius: var(--radius-pill);
  padding: 4px 11px;
  font-family: var(--font-head);
  font-size: 0.75rem;
}

.lifetime-stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.lstat-box {
  background: #FFFFFF;
  border: 1.5px solid rgba(14, 165, 233, 0.35);
  border-radius: 14px;
  padding: 7px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.lstat-val {
  font-family: var(--font-head);
  font-size: 0.82rem;
  color: var(--text-dark);
}

.lstat-lbl {
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--text-muted);
}

.achievements-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.achievement-card {
  background: var(--surface-ivory);
  border: 1.5px solid rgba(14, 165, 233, 0.45);
  border-radius: 18px;
  padding: 11px 12px;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ach-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.ach-emblem {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
  border: 2px solid rgba(15, 23, 42, 0.15);
}

.tier-bronze { background: linear-gradient(135deg, #FDBA74, #EA580C); }
.tier-silver { background: linear-gradient(135deg, #E2E8F0, #94A3B8); }
.tier-gold { background: linear-gradient(135deg, #FEF08A, #EAB308); }
.tier-prismatic { background: linear-gradient(135deg, #22C55E, #0EA5E9, #FACC15); }

.ach-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.ach-title {
  font-family: var(--font-head);
  font-size: 0.76rem;
  color: var(--text-dark);
}

.ach-desc {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.ach-prog-line {
  font-size: 0.64rem;
  font-weight: 700;
  color: var(--emerald-dark);
}

.btn-claim-ach {
  background: linear-gradient(180deg, var(--emerald), #16A34A);
  color: #FFFFFF;
  border: 1.5px solid var(--gold);
  border-radius: 12px;
  padding: 7px 10px;
  font-family: var(--font-head);
  font-size: 0.66rem;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-claim-ach:disabled {
  background: #CBD5E1;
  border-color: #94A3B8;
  color: #475569;
  cursor: default;
}

/* =========================================================
   MODALS & DIALOGS
   ========================================================= */
.modal-backdrop {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: rgba(15, 23, 42, 0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.hidden {
  display: none !important;
}

.modal-card {
  width: 100%;
  max-width: 390px;
  max-height: 86vh;
  background: var(--surface-bright);
  border: 2.5px solid var(--gold);
  border-radius: 26px;
  padding: 18px 16px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.35);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-scrollable {
  overflow-y: auto;
}

.modal-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-family: var(--font-head);
  font-size: 1.05rem;
  color: var(--text-dark);
}

.modal-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

.icon-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid #CBD5E1;
  background: #FFFFFF;
  font-weight: 800;
  cursor: pointer;
}

.modal-btn-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result-badge-header {
  align-self: center;
  background: var(--gold);
  color: var(--text-dark);
  font-family: var(--font-head);
  font-size: 0.7rem;
  padding: 3px 12px;
  border-radius: var(--radius-pill);
}

.result-stars-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  font-size: 2rem;
}

.res-star.dim {
  filter: grayscale(1);
  opacity: 0.35;
}

.result-stats-box {
  background: #FFFFFF;
  border: 1.5px solid rgba(14, 165, 233, 0.35);
  border-radius: 16px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.reward-highlight {
  color: var(--emerald-dark);
  font-weight: 700;
}

.settings-section {
  background: #FFFFFF;
  border: 1.5px solid rgba(14, 165, 233, 0.3);
  border-radius: 16px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-sec-title {
  font-family: var(--font-head);
  font-size: 0.78rem;
  color: var(--text-dark);
}

.toggle-row,
.about-version-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.76rem;
  font-weight: 600;
}

.toggle-pill {
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  font-family: var(--font-head);
  font-size: 0.68rem;
  border: 1.5px solid #94A3B8;
  background: #E2E8F0;
  cursor: pointer;
}

.toggle-pill.on {
  background: var(--emerald);
  color: #FFFFFF;
  border-color: var(--emerald-dark);
}

.settings-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.btn-outline-sm {
  background: #F8FAFC;
  border: 1.5px solid rgba(14, 165, 233, 0.45);
  border-radius: 12px;
  padding: 8px 6px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.72rem;
  color: var(--text-dark);
  cursor: pointer;
}

.subdialog-body {
  font-size: 0.78rem;
  line-height: 1.48;
  color: var(--text-dark);
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 52vh;
  overflow-y: auto;
}

.toast-banner {
  position: absolute;
  top: 58px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  background: var(--text-dark);
  color: #FFFFFF;
  border: 2px solid var(--gold);
  border-radius: var(--radius-pill);
  padding: 7px 16px;
  font-family: var(--font-head);
  font-size: 0.72rem;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  white-space: nowrap;
  pointer-events: none;
}

.toast-banner.hidden {
  display: none !important;
}
