/* =========================================================================
   VERMILION PALACE — SCULPTED EMBLEM & CREST ARCHITECTURE
   Palette: #FACC15 (24k Gold), #8B5CF6 (Royal Violet), #EC4899 (Electric Magenta), #0F1026 (Midnight Indigo)
   ========================================================================= */

:root {
  --gold: #FACC15;
  --gold-bright: #FDE047;
  --gold-deep: #CA8A04;
  --violet: #8B5CF6;
  --violet-deep: #5B21B6;
  --magenta: #EC4899;
  --magenta-deep: #BE185D;
  --indigo-bg: #0F1026;
  --emerald: #10B981;
  --card-surface: rgba(20, 18, 30, 0.85);
  --card-surface-elevated: rgba(28, 24, 44, 0.90);
  --border-gold: rgba(250, 204, 21, 0.42);
  --border-violet: rgba(139, 92, 246, 0.45);
  --text-main: #FFFBEB;
  --text-muted: #CBD5E1;
  --text-dim: #94A3B8;
  --font-display: 'Kanit', sans-serif;
  --font-body: 'Nunito', sans-serif;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  background-color: var(--indigo-bg);
  background-image: url('bg.jpg');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  background-attachment: scroll;
  color: var(--text-main);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

.app-container {
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background-color: var(--indigo-bg);
  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.65);
}

button {
  font-family: var(--font-display);
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  touch-action: manipulation;
  transition: transform 0.14s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.14s ease, border-color 0.14s ease;
}

button:active {
  transform: scale(0.97);
}

.hidden {
  display: none !important;
}

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

/* =========================================================================
   TOP PERSISTENT HEADER
   ========================================================================= */
.top-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 10px;
  background: rgba(15, 16, 38, 0.84);
  border-bottom: 1px solid var(--border-gold);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 25;
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  cursor: pointer;
}

.brand-crest {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1.5px solid var(--gold);
  background: radial-gradient(circle at 30% 30%, #8B5CF6, #0F1026);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(250, 204, 21, 0.28);
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.brand-logo-fallback {
  display: none;
  font-size: 18px;
  color: var(--gold);
}

.brand-titles {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-tag {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--gold);
  line-height: 1.1;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  color: #FFFFFF;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.metric-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(20, 18, 30, 0.9);
  border: 1px solid var(--border-gold);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: #FFFFFF;
  white-space: nowrap;
}

.star-pill {
  border-color: var(--border-violet);
}

.gold-ingot-icon {
  color: var(--gold);
  font-size: 13px;
}

.star-crest-icon {
  color: #F472B6;
  font-size: 13px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(20, 18, 30, 0.9);
  border: 1px solid var(--border-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  flex-shrink: 0;
}

/* =========================================================================
   MAIN SCREENS VIEWPORT & STATIC FLEX BOTTOM NAVIGATION
   ========================================================================= */
.screens-viewport {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 20px;
  position: relative;
  -webkit-overflow-scrolling: touch;
}

/* Welcome & Game screens lock vertical scroll to fit 100% single viewport */
.screens-viewport.no-scroll {
  overflow-y: hidden;
  padding-bottom: 0;
}

.screen-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 14px 16px;
}

.bottom-nav {
  flex: 0 0 auto;
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 6px 8px calc(env(safe-area-inset-bottom, 0px) + 8px);
  background: rgba(15, 16, 38, 0.92);
  border-top: 1px solid var(--border-gold);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.nav-item {
  position: relative;
  flex: 1;
  min-height: 46px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 12px;
  padding: 4px 2px;
  color: var(--text-dim);
}

.nav-item.active {
  color: var(--gold);
  background: linear-gradient(180deg, rgba(250, 204, 21, 0.16), rgba(139, 92, 246, 0.14));
  border: 1px solid rgba(250, 204, 21, 0.35);
}

.nav-icon {
  font-size: 18px;
  line-height: 1;
}

.nav-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.nav-dot {
  position: absolute;
  top: 5px;
  right: 22%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--magenta);
  box-shadow: 0 0 6px var(--magenta);
}

/* =========================================================================
   SCREEN #1: WELCOME / INTRO SCREEN (SINGLE VIEWPORT, ZERO OVERLAP)
   ========================================================================= */
#screen-welcome {
  height: 100%;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px calc(env(safe-area-inset-bottom, 0px) + 12px);
}

.welcome-shell {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.welcome-top-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.welcome-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--card-surface);
  border: 1px solid var(--border-gold);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--gold);
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--magenta);
  box-shadow: 0 0 8px var(--magenta);
}

.welcome-skip-btn {
  min-height: 36px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(20, 18, 30, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.welcome-art-box {
  flex: 1 1 auto;
  min-height: 165px;
  max-height: 290px;
  width: 100%;
  border-radius: 18px;
  background: rgba(15, 16, 38, 0.76);
  border: 1.5px solid var(--border-gold);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5), inset 0 0 24px rgba(139, 92, 246, 0.25);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.welcome-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.welcome-panel {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border-radius: 18px;
  background: var(--card-surface);
  border: 1px solid var(--border-gold);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.48);
}

.welcome-benefit-pill {
  align-self: flex-start;
  padding: 3px 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.35), rgba(236, 72, 153, 0.35));
  border: 1px solid rgba(236, 72, 153, 0.55);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.9px;
  color: var(--gold-bright);
}

.welcome-title {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 800;
  line-height: 1.15;
  color: #FFFFFF;
}

.welcome-desc {
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-muted);
}

.welcome-feature-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-top: 2px;
}

.mini-feat {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 6px;
  border-radius: 10px;
  background: rgba(15, 16, 38, 0.72);
  border: 1px solid rgba(250, 204, 21, 0.25);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
}

.mini-feat-icon {
  color: var(--gold);
}

.welcome-footer-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.welcome-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

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

.welcome-dot.active {
  width: 26px;
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
}

.welcome-cta-row {
  display: flex;
  width: 100%;
}

.welcome-next-btn {
  width: 100%;
}

/* =========================================================================
   BUTTON SYSTEM
   ========================================================================= */
.btn-primary {
  min-height: 46px;
  padding: 10px 18px;
  border-radius: 13px;
  background: linear-gradient(135deg, #FACC15 0%, #F59E0B 55%, #EC4899 100%);
  color: #0F1026;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(250, 204, 21, 0.38);
  border: 1px solid #FEF08A;
}

.btn-secondary {
  min-height: 46px;
  padding: 10px 16px;
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.36), rgba(20, 18, 30, 0.92));
  color: #FFFFFF;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border-violet);
}

.btn-outline-gold {
  min-height: 42px;
  padding: 8px 14px;
  border-radius: 11px;
  background: rgba(20, 18, 30, 0.85);
  border: 1px solid var(--gold);
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-sm {
  min-height: 40px;
  font-size: 13px;
  padding: 8px 12px;
}

/* =========================================================================
   SCREEN #2: HOME MENU (BENTO ARCADE COMMAND CENTER)
   ========================================================================= */
.home-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 14px 16px;
}

.bento-hero-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 15px;
  border-radius: 18px;
  background: var(--card-surface);
  border: 1.5px solid var(--border-gold);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
}

.hero-top-visual {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hero-emblem-wrap {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  border: 1.5px solid var(--gold);
  background: radial-gradient(circle at 30% 30%, #8B5CF6, #0F1026);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(250, 204, 21, 0.32);
}

.hero-crest-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-crest-fallback {
  display: none;
  font-size: 28px;
}

.hero-act-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.hero-act-badge {
  align-self: flex-start;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(236, 72, 153, 0.25);
  border: 1px solid rgba(236, 72, 153, 0.55);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: #FBCFE8;
}

.hero-stage-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 800;
  color: #FFFFFF;
  line-height: 1.15;
}

.hero-stage-sub {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.3;
}

.hero-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.hero-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(15, 16, 38, 0.9);
  border: 1px solid rgba(250, 204, 21, 0.28);
  overflow: hidden;
}

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

.magenta-fill {
  background: linear-gradient(90deg, var(--violet), var(--magenta));
}

.hero-actions-row {
  display: flex;
  gap: 8px;
}

.btn-play-now {
  flex: 1.5;
}

.btn-stage-map {
  flex: 1;
}

/* Active Loadout Strip */
.loadout-banner-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--card-surface);
  border: 1px solid var(--border-violet);
}

.loadout-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.loadout-kicker {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.9px;
  color: var(--gold);
}

.loadout-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.loadout-swatch {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 6px var(--gold);
}

.loadout-skin-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: #FFFFFF;
}

.loadout-perks {
  font-size: 11px;
  color: var(--text-muted);
}

/* Bento 2x2 Grid */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.bento-tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  min-height: 112px;
  padding: 13px;
  border-radius: 16px;
  background: var(--card-surface);
  border: 1px solid var(--border-gold);
  text-align: left;
}

.tile-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.tile-crest-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: rgba(15, 16, 38, 0.85);
  border: 1px solid var(--border-gold);
}

.tile-badge {
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(250, 204, 21, 0.16);
  border: 1px solid rgba(250, 204, 21, 0.45);
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 700;
  color: var(--gold);
}

.pulse-badge {
  background: rgba(236, 72, 153, 0.25);
  border-color: var(--magenta);
  color: #FBCFE8;
}

.tile-bottom-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tile-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  color: #FFFFFF;
}

.tile-caption {
  font-size: 11px;
  color: var(--text-muted);
}

/* Directive Card */
.directive-card {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 13px 14px;
  border-radius: 16px;
  background: var(--card-surface);
  border: 1px solid rgba(236, 72, 153, 0.42);
}

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

.directive-title {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.7px;
  color: var(--gold);
}

.directive-reward {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: #F472B6;
}

.directive-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.35;
}

.directive-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.compact-track {
  flex: 1;
}

.directive-status {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  color: var(--gold);
  white-space: nowrap;
}

/* =========================================================================
   SHARED SECTION HEADERS (LEVELS, ARMORY, TROPHIES, DAILY)
   ========================================================================= */
.section-header-card {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 14px;
  border-radius: 16px;
  background: var(--card-surface);
  border: 1px solid var(--border-gold);
}

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

.section-kicker {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--gold);
  display: block;
}

.section-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: #FFFFFF;
  line-height: 1.15;
}

.section-subtext {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.38;
}

.sub-heading {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: 0.4px;
  padding: 2px 4px 0;
}

/* =========================================================================
   SCREEN #3: LEVEL SELECT (3 ACTS, 30 LEVELS)
   ========================================================================= */
.act-stars-pill,
.armory-balance-pill,
.trophy-counter-pill,
.streak-badge {
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(15, 16, 38, 0.9);
  border: 1px solid var(--border-gold);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  white-space: nowrap;
}

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

.act-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 7px 4px;
  border-radius: 11px;
  background: rgba(15, 16, 38, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text-muted);
}

.act-tab.active {
  background: linear-gradient(135deg, rgba(250, 204, 21, 0.24), rgba(139, 92, 246, 0.32));
  border-color: var(--gold);
  color: #FFFFFF;
}

.act-tab-num {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
  color: var(--gold);
}

.act-tab-name {
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.act-flavor-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.35;
}

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

.level-tile {
  min-height: 98px;
  padding: 10px 8px;
  border-radius: 14px;
  background: var(--card-surface);
  border: 1px solid var(--border-gold);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  text-align: center;
  position: relative;
}

.level-tile.locked {
  opacity: 0.58;
  border-color: rgba(255, 255, 255, 0.15);
}

.level-tile.boss-tile {
  border-color: var(--magenta);
  background: linear-gradient(160deg, rgba(236, 72, 153, 0.22), rgba(20, 18, 30, 0.92));
}

.level-num {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: #FFFFFF;
  line-height: 1;
}

.level-name-tag {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.level-stars-row {
  display: flex;
  gap: 3px;
  font-size: 13px;
}

.lvl-star {
  color: rgba(255, 255, 255, 0.22);
}

.lvl-star.on {
  color: var(--gold);
  text-shadow: 0 0 6px rgba(250, 204, 21, 0.6);
}

.boss-crown {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--magenta);
  color: #FFFFFF;
}

/* =========================================================================
   SCREEN #4: GAME SCREEN (HIDPI CANVAS + COMPACT 360DP HUD)
   ========================================================================= */
#screen-game {
  height: 100%;
  padding: calc(env(safe-area-inset-top, 0px) + 6px) 10px calc(env(safe-area-inset-bottom, 0px) + 8px);
}

.game-shell {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Single Non-Wrapping Row Top HUD */
.game-hud {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  min-width: 0;
  white-space: nowrap;
  padding: 6px 8px;
  border-radius: 13px;
  background: rgba(15, 16, 38, 0.9);
  border: 1px solid var(--border-gold);
}

.hud-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: rgba(250, 204, 21, 0.16);
  border: 1px solid var(--gold);
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hud-pill {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px 7px;
  border-radius: 9px;
  background: rgba(20, 18, 30, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  min-width: 0;
}

.hud-label {
  font-size: 10px;
  color: var(--gold);
}

.hud-sep,
.hud-target {
  color: var(--text-muted);
  font-size: 11px;
}

.hud-combo-pill {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.35), rgba(236, 72, 153, 0.35));
  border-color: var(--magenta);
  color: var(--gold-bright);
}

.game-subhud {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.stage-progress-bar {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(15, 16, 38, 0.85);
  border: 1px solid rgba(250, 204, 21, 0.35);
  overflow: hidden;
}

.stage-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--magenta));
  transition: width 0.12s linear;
}

.hud-buff-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.buff-chip {
  flex: 1;
  text-align: center;
  padding: 3px 6px;
  border-radius: 8px;
  background: rgba(20, 18, 30, 0.84);
  border: 1px solid rgba(250, 204, 21, 0.25);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.canvas-stage-wrap {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  border-radius: 16px;
  border: 1.5px solid var(--border-gold);
  background: rgba(12, 13, 32, 0.78);
  box-shadow: inset 0 0 28px rgba(139, 92, 246, 0.22);
  overflow: hidden;
  position: relative;
}

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

.game-control-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.lane-step-btn {
  flex: 1;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--card-surface);
  border: 1px solid var(--border-gold);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  color: var(--gold);
}

.control-hint-pill {
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(20, 18, 30, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

/* =========================================================================
   SCREEN #5: GEAR & UPGRADE ARMORY
   ========================================================================= */
.skins-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.skin-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  padding: 12px;
  border-radius: 15px;
  background: var(--card-surface);
  border: 1px solid var(--border-gold);
}

.skin-card.equipped {
  border-color: var(--gold);
  box-shadow: 0 0 14px rgba(250, 204, 21, 0.28);
}

.skin-preview-orb {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  border: 1.5px solid #FFFFFF;
}

.skin-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  color: #FFFFFF;
}

.skin-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
}

.skin-action-btn {
  width: 100%;
  min-height: 38px;
  padding: 6px 10px;
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
}

.upgrades-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.upgrade-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 13px;
  border-radius: 15px;
  background: var(--card-surface);
  border: 1px solid var(--border-violet);
}

.upgrade-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.upgrade-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.upgrade-icon-box {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(15, 16, 38, 0.9);
  border: 1px solid var(--border-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.upgrade-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  color: #FFFFFF;
}

.upgrade-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.upgrade-pips {
  display: flex;
  gap: 5px;
}

.upgrade-pip {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

.upgrade-pip.filled {
  background: linear-gradient(90deg, var(--gold), var(--magenta));
}

/* =========================================================================
   SCREEN #6: TROPHY ROOM & ACHIEVEMENTS SHOWCASE
   ========================================================================= */
.trophies-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.trophy-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px;
  border-radius: 15px;
  background: var(--card-surface);
  border: 1px solid var(--border-gold);
}

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

.trophy-medallion {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  background: rgba(15, 16, 38, 0.9);
  border: 1.5px solid var(--gold);
}

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

.trophy-tier-tag {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: var(--gold);
}

.trophy-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  color: #FFFFFF;
}

.trophy-desc {
  font-size: 11px;
  color: var(--text-muted);
}

/* =========================================================================
   SCREEN #7: DAILY CHECK-IN CALENDAR SCREEN
   ========================================================================= */
.daily-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.daily-card {
  min-height: 106px;
  padding: 10px 8px;
  border-radius: 14px;
  background: var(--card-surface);
  border: 1px solid var(--border-gold);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  gap: 4px;
}

.daily-card.day-7-grand {
  grid-column: span 3;
  flex-direction: row;
  min-height: 78px;
  padding: 12px 16px;
  text-align: left;
  background: linear-gradient(135deg, rgba(250, 204, 21, 0.22), rgba(236, 72, 153, 0.22), rgba(20, 18, 30, 0.92));
  border-color: var(--gold);
}

.daily-card.claimed {
  border-color: var(--emerald);
  opacity: 0.75;
}

.daily-card.today-ready {
  border-width: 2px;
  border-color: var(--gold);
  box-shadow: 0 0 16px rgba(250, 204, 21, 0.35);
}

.daily-card.locked-day {
  opacity: 0.58;
  border-color: rgba(255, 255, 255, 0.16);
}

.daily-day-num {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  color: var(--gold);
}

.daily-icon {
  font-size: 24px;
}

.daily-reward-amt {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  color: #FFFFFF;
}

.daily-state-pill {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(15, 16, 38, 0.88);
  color: var(--text-muted);
}

.daily-claim-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border-radius: 16px;
  background: var(--card-surface);
  border: 1px solid var(--border-gold);
  text-align: center;
}

.daily-next-timer {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-bright);
}

.btn-claim-daily {
  width: 100%;
}

.btn-claim-daily:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* =========================================================================
   MODALS, BOTTOM SHEETS & TOAST
   ========================================================================= */
.modal-backdrop {
  position: absolute;
  inset: 0;
  z-index: 80;
  background: rgba(10, 10, 22, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px 12px calc(env(safe-area-inset-bottom, 0px) + 14px);
}

.modal-sheet {
  width: 100%;
  max-height: 85dvh;
  border-radius: 22px;
  padding: 18px 16px;
  background: rgba(20, 18, 34, 0.96);
  border: 1.5px solid var(--gold);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.sheet-handle {
  width: 42px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
  align-self: center;
}

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

.modal-kicker {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--gold);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 800;
  color: #FFFFFF;
}

.modal-desc {
  font-size: 13px;
  color: var(--text-muted);
}

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

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

.res-star {
  color: rgba(255, 255, 255, 0.2);
}

.res-star.earned {
  color: var(--gold);
  text-shadow: 0 0 14px var(--gold);
}

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

.res-stat-box {
  padding: 10px 6px;
  border-radius: 12px;
  background: rgba(15, 16, 38, 0.85);
  border: 1px solid rgba(250, 204, 21, 0.3);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.res-stat-label {
  font-size: 10px;
  color: var(--text-muted);
}

.res-stat-val {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  color: #FFFFFF;
}

/* Settings & Legal Rows */
.settings-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(15, 16, 38, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.settings-group-title {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: 0.6px;
}

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

.setting-label {
  display: block;
  font-size: 13px;
  color: #FFFFFF;
}

.setting-sub {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

.toggle-switch {
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  padding: 3px;
  display: flex;
  align-items: center;
  transition: background 0.2s ease;
}

.toggle-switch.active {
  background: var(--gold);
  justify-content: flex-end;
}

.toggle-knob {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #0F1026;
}

.about-version-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.settings-action-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 4px;
}

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

.legal-body-copy {
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 52dvh;
  overflow-y: auto;
  padding-right: 4px;
}

.feedback-stars-wrap {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.rate-star-btn {
  font-size: 28px;
  color: rgba(255, 255, 255, 0.25);
}

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

.feedback-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 16, 38, 0.9);
  border: 1px solid var(--border-gold);
  color: #FFFFFF;
  font-family: var(--font-body);
  font-size: 16px;
  resize: none;
}

.toast-banner {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 62px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 95;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(20, 18, 34, 0.96);
  border: 1.5px solid var(--gold);
  color: var(--gold-bright);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
}

/* =========================================================================
   MANDATORY SCREEN VISIBILITY ENFORCEMENT (RULE 1 & VERIFIER)
   ========================================================================= */
.screen {
  display: none;
}

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

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