/* Vivid Echo - Premium Mobile WebApp Styles */
:root {
  --primary-red: #E50914;
  --primary-glow: #FF2A42;
  --secondary-crimson: #B81D24;
  --accent-gold: #FFD700;
  --accent-amber: #FFA000;
  --accent-cyan: #00E5FF;
  --dark-base: #0B0B10;
  --dark-panel: rgba(18, 18, 26, 0.82);
  --dark-panel-hover: rgba(28, 28, 40, 0.9);
  --dark-panel-border: rgba(255, 255, 255, 0.12);
  --dark-panel-border-glow: rgba(229, 9, 20, 0.4);
  --text-primary: #FFFFFF;
  --text-secondary: #A6A6BC;
  --text-muted: #6B6B82;
  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --shadow-panel: 0 8px 32px 0 rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 20px rgba(229, 9, 20, 0.5);
  --shadow-gold: 0 0 16px rgba(255, 215, 0, 0.4);
}

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

html, body {
  width: 100%;
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  background-color: var(--dark-base);
  font-family: var(--font-main);
  color: var(--text-primary);
  font-size: 14px;
  touch-action: manipulation;
}

/* Background image handling with anti-blackout policy */
body {
  background-image: url('bg.jpg');
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
  display: flex;
  justify-content: center;
  align-items: stretch;
}

/* Subtle atmosphere overlay - ultra subtle to keep background 100% visible */
.bg-vignette {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: radial-gradient(circle at center, transparent 40%, rgba(11, 11, 16, 0.35) 100%);
  z-index: 0;
}

/* Main Container: Mobile Max 480px */
.app-container {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  z-index: 1;
}

/* Screen Transitions */
.screen {
  display: none;
  flex-direction: column;
  flex: 1;
  width: 100%;
  height: 100%;
  padding: 16px;
  padding-top: calc(env(safe-area-inset-top, 0px) + 14px);
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: fadeIn 0.25s ease-out forwards;
}

.screen.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Glassmorphism Classes */
.glass-card {
  background: var(--dark-panel);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--dark-panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
}

.glass-panel-glow {
  border-color: var(--dark-panel-border-glow);
  box-shadow: var(--shadow-panel), 0 0 15px rgba(229, 9, 20, 0.25);
}

/* Common UI Elements */
.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 16px;
}

.btn-icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  transition: transform 0.15s ease, background 0.2s ease;
}

.btn-icon:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.18);
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(229, 9, 20, 0.25), rgba(18, 18, 26, 0.7));
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(229, 9, 20, 0.4);
}

.brand-title {
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  background: linear-gradient(90deg, #FFFFFF 0%, #FF99A5 60%, #FF2A42 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 15px;
}

.stats-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 215, 0, 0.35);
  border-radius: var(--radius-full);
  padding: 6px 12px;
  font-weight: 700;
  font-size: 13px;
  color: var(--accent-gold);
}

/* Main Buttons */
.btn-primary {
  width: 100%;
  min-height: 52px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary-glow) 0%, var(--primary-red) 70%, var(--secondary-crimson) 100%);
  color: #FFFFFF;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(229, 9, 20, 0.45);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  touch-action: manipulation;
}

.btn-primary:active {
  transform: scale(0.97);
  box-shadow: 0 2px 10px rgba(229, 9, 20, 0.3);
}

.btn-secondary {
  width: 100%;
  min-height: 48px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease;
}

.btn-secondary:active {
  transform: scale(0.97);
  background: rgba(255, 255, 255, 0.15);
}

/* ==========================================================================
   1. WELCOME SCREEN
   ========================================================================== */
#screen-welcome {
  justify-content: space-between;
  text-align: center;
}

.welcome-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 15%;
}

.welcome-logo-frame {
  width: 120px;
  height: 120px;
  border-radius: 28px;
  background: radial-gradient(circle, rgba(229, 9, 20, 0.3) 0%, rgba(18, 18, 26, 0.8) 100%);
  border: 2px solid rgba(229, 9, 20, 0.6);
  box-shadow: 0 0 35px rgba(229, 9, 20, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  overflow: hidden;
}

.welcome-logo-img {
  width: 90%;
  height: 90%;
  object-fit: contain;
}

.welcome-title {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 2px;
  margin-bottom: 8px;
  text-transform: uppercase;
  background: linear-gradient(135deg, #FFFFFF 20%, #FFA8B3 70%, #E50914 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-tagline {
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 320px;
  line-height: 1.5;
}

.welcome-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 30px 0;
  text-align: left;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
}

.feature-icon-box {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: var(--radius-md);
  background: rgba(229, 9, 20, 0.15);
  border: 1px solid rgba(229, 9, 20, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-glow);
}

.feature-text h4 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 2px;
}

.feature-text p {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ==========================================================================
   2. HOME MENU SCREEN
   ========================================================================== */
#screen-home {
  gap: 16px;
}

.player-overview-card {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  overflow: hidden;
}

.player-overview-card::before {
  content: '';
  position: absolute;
  top: -30px;
  right: -30px;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(229, 9, 20, 0.25) 0%, transparent 70%);
  pointer-events: none;
}

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

.user-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-badge {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary-red), #4A0E13);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 22px;
  box-shadow: 0 4px 12px rgba(229, 9, 20, 0.35);
}

.user-name {
  font-size: 17px;
  font-weight: 800;
}

.user-rank {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

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

.stat-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 10px 8px;
  text-align: center;
}

.stat-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.stat-value.gold {
  color: var(--accent-gold);
}

.stat-value.red {
  color: var(--primary-glow);
}

.stat-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Home Quick Action Banner */
.hero-play-banner {
  padding: 20px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(229, 9, 20, 0.35) 0%, rgba(18, 18, 26, 0.85) 100%);
  border: 1px solid rgba(229, 9, 20, 0.45);
  box-shadow: 0 8px 24px rgba(229, 9, 20, 0.25);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hero-play-content h3 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 4px;
}

.hero-play-content p {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Menu Navigation Grid */
.menu-nav-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.menu-card-btn {
  background: var(--dark-panel);
  border: 1px solid var(--dark-panel-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.2s ease, background 0.2s ease;
  position: relative;
  overflow: hidden;
}

.menu-card-btn:active {
  transform: scale(0.96);
  border-color: var(--primary-glow);
}

.menu-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.menu-card-icon.red {
  background: rgba(229, 9, 20, 0.2);
  color: var(--primary-glow);
  border: 1px solid rgba(229, 9, 20, 0.4);
}

.menu-card-icon.gold {
  background: rgba(255, 215, 0, 0.2);
  color: var(--accent-gold);
  border: 1px solid rgba(255, 215, 0, 0.4);
}

.menu-card-icon.cyan {
  background: rgba(0, 229, 255, 0.2);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 229, 255, 0.4);
}

.menu-card-icon.purple {
  background: rgba(186, 104, 200, 0.2);
  color: #CE93D8;
  border: 1px solid rgba(186, 104, 200, 0.4);
}

.menu-card-title {
  font-size: 15px;
  font-weight: 700;
}

.menu-card-subtitle {
  font-size: 11px;
  color: var(--text-secondary);
}

.badge-notice {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--primary-red);
  color: #FFF;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

/* ==========================================================================
   3. LEVEL SELECT SCREEN
   ========================================================================== */
#screen-levels {
  padding-bottom: 24px;
}

.levels-header-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  margin-bottom: 16px;
}

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

.level-card {
  aspect-ratio: 0.85;
  background: var(--dark-panel);
  border: 1px solid var(--dark-panel-border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.2s ease;
  position: relative;
  overflow: hidden;
}

.level-card:active:not(.locked) {
  transform: scale(0.93);
}

.level-card.completed {
  border-color: rgba(255, 215, 0, 0.5);
  background: rgba(26, 26, 36, 0.88);
}

.level-card.current {
  border-color: var(--primary-glow);
  box-shadow: 0 0 14px rgba(229, 9, 20, 0.45);
  animation: pulseBorder 1.8s infinite;
}

@keyframes pulseBorder {
  0%, 100% { border-color: var(--primary-glow); }
  50% { border-color: rgba(255, 255, 255, 0.8); }
}

.level-card.locked {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.level-number {
  font-size: 17px;
  font-weight: 800;
}

.level-stars {
  display: flex;
  gap: 2px;
  font-size: 11px;
}

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

.level-stars .star.filled {
  color: var(--accent-gold);
  text-shadow: 0 0 4px rgba(255, 215, 0, 0.6);
}

.level-lock-icon {
  font-size: 16px;
  color: var(--text-muted);
}

/* ==========================================================================
   4. GAME ARENA SCREEN
   ========================================================================== */
#screen-game {
  padding: 8px 12px;
  padding-top: calc(env(safe-area-inset-top, 0px) + 8px);
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
  gap: 8px;
  justify-content: space-between;
}

.game-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 12px;
}

.hud-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hud-label {
  font-size: 10px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hud-value {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
}

.hud-combo-badge {
  background: linear-gradient(135deg, var(--primary-red), #FF5252);
  color: #FFF;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 0 10px rgba(229, 9, 20, 0.5);
  display: none;
}

.hud-combo-badge.active {
  display: inline-block;
  animation: bounceCombo 0.3s ease;
}

@keyframes bounceCombo {
  0% { transform: scale(0.7); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1.0); }
}

/* Canvas Container */
.game-canvas-wrapper {
  flex: 1;
  width: 100%;
  min-height: 380px;
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--dark-panel-border);
  background: rgba(14, 14, 20, 0.72);
  backdrop-filter: blur(12px);
  box-shadow: inset 0 0 25px rgba(0, 0, 0, 0.6);
  touch-action: none;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.aim-hint-overlay {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
  padding: 4px 12px;
  font-size: 11px;
  color: var(--text-secondary);
  pointer-events: none;
  transition: opacity 0.3s ease;
}

/* Bottom Game Controls */
.game-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 6px 4px;
}

.balls-counter-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--dark-panel);
  border: 1px solid var(--dark-panel-border);
  border-radius: var(--radius-md);
  padding: 8px 14px;
}

.ball-indicator-icon {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary-glow);
  box-shadow: 0 0 8px var(--primary-glow);
}

.balls-counter-text {
  font-size: 14px;
  font-weight: 700;
}

.btn-launch {
  flex: 1;
  min-height: 48px;
}

/* ==========================================================================
   5. SKIN SHOP SCREEN
   ========================================================================== */
.shop-preview-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  background: linear-gradient(180deg, rgba(229, 9, 20, 0.18) 0%, rgba(18, 18, 26, 0.85) 100%);
  border: 1px solid rgba(229, 9, 20, 0.35);
}

.shop-orb-stage {
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.shop-orb-view {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  box-shadow: 0 0 25px currentColor;
  transition: all 0.3s ease;
}

.shop-items-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 20px;
}

.shop-item-card {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.shop-item-card.equipped {
  border-color: var(--primary-glow);
  background: rgba(30, 20, 26, 0.88);
}

.shop-item-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.skin-thumbnail {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.skin-orb-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
}

.skin-details h4 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 2px;
}

.skin-details p {
  font-size: 11px;
  color: var(--text-secondary);
}

.btn-skin-action {
  min-width: 90px;
  height: 38px;
  font-size: 13px;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: transform 0.15s ease;
}

.btn-skin-action:active {
  transform: scale(0.95);
}

.btn-skin-action.buy {
  background: linear-gradient(135deg, var(--accent-gold), #FF8F00);
  color: #121218;
}

.btn-skin-action.equip {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #FFF;
}

.btn-skin-action.equipped {
  background: rgba(229, 9, 20, 0.25);
  border: 1px solid var(--primary-glow);
  color: var(--primary-glow);
  cursor: default;
}

/* ==========================================================================
   6. ACHIEVEMENTS SCREEN
   ========================================================================== */
.achievements-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 20px;
}

.achievement-card {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.achievement-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}

.achievement-icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: var(--radius-md);
  background: rgba(255, 215, 0, 0.12);
  border: 1px solid rgba(255, 215, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-gold);
  font-size: 18px;
}

.achievement-card.completed .achievement-icon {
  background: rgba(255, 215, 0, 0.25);
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.4);
}

.achievement-text {
  flex: 1;
}

.achievement-text h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 2px;
}

.achievement-text p {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.progress-bar-track {
  width: 100%;
  height: 6px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-red), var(--primary-glow));
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

.btn-claim-reward {
  min-width: 82px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-md);
  border: none;
  background: linear-gradient(135deg, var(--accent-gold), #FF8F00);
  color: #121218;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

.btn-claimed {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--radius-md);
}

/* ==========================================================================
   7. MODALS & BOTTOM SHEETS
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-sheet {
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  max-height: 85dvh;
  background: rgba(18, 18, 26, 0.94);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top-left-radius: 26px;
  border-top-right-radius: 26px;
  border: 1px solid var(--dark-panel-border);
  border-bottom: none;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 20px 18px calc(env(safe-area-inset-bottom, 0px) + 20px) 18px;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-sheet {
  transform: translateY(0);
}

.sheet-handle {
  width: 40px;
  height: 5px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.25);
  align-self: center;
  margin-bottom: 16px;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.sheet-title {
  font-size: 18px;
  font-weight: 800;
}

.sheet-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 10px;
}

/* Daily Reward Calendar Grid (Zero Overflow Policy) */
.daily-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 12px 0;
}

.daily-card {
  aspect-ratio: 0.72;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.daily-card.active-today {
  border-color: var(--accent-gold);
  background: rgba(255, 215, 0, 0.12);
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.3);
}

.daily-card.claimed {
  opacity: 0.6;
  border-color: rgba(255, 255, 255, 0.08);
}

.daily-day-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
}

.daily-reward-icon {
  font-size: 20px;
}

.daily-reward-amount {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent-gold);
}

.daily-badge-status {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.daily-card.claimed .daily-badge-status {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
}

.daily-card.active-today .daily-badge-status {
  background: var(--accent-gold);
  color: #121218;
}

/* Victory / Defeat Modal */
.result-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.result-stars-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  font-size: 36px;
  margin: 10px 0;
}

.result-stars-row .star {
  color: rgba(255, 255, 255, 0.15);
  transition: transform 0.4s ease, color 0.4s ease;
}

.result-stars-row .star.won {
  color: var(--accent-gold);
  text-shadow: 0 0 15px rgba(255, 215, 0, 0.7);
  transform: scale(1.15);
}

.result-stats-card {
  width: 100%;
  padding: 14px;
  display: flex;
  justify-content: space-around;
  background: rgba(0, 0, 0, 0.35);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Settings, Legal, About Lists */
.settings-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  margin-top: 10px;
}

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

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.settings-item:active {
  background: rgba(255, 255, 255, 0.08);
}

.settings-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-item-title {
  font-size: 14px;
  font-weight: 600;
}

.settings-item-subtitle {
  font-size: 11px;
  color: var(--text-secondary);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  width: 46px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.2);
  transition: 0.3s;
  border-radius: 34px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: var(--primary-red);
}

input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* Legal text modal content */
.legal-text-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 14px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary);
  max-height: 280px;
  overflow-y: auto;
}

.legal-text-box h5 {
  font-size: 13px;
  color: var(--text-primary);
  margin: 10px 0 4px 0;
}

.legal-text-box p {
  margin-bottom: 8px;
}

/* Star rating row in modal */
.rating-stars-input {
  display: flex;
  justify-content: center;
  gap: 12px;
  font-size: 32px;
  color: var(--text-muted);
  margin: 12px 0;
  cursor: pointer;
}

.rating-stars-input .rate-star.active {
  color: var(--accent-gold);
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
}

/* Toast Notification */
.toast-notice {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
  left: 50%;
  transform: translateX(-50%) translateY(50px);
  background: rgba(20, 20, 30, 0.95);
  border: 1px solid var(--primary-glow);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 0 12px rgba(229, 9, 20, 0.3);
  color: #FFF;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  white-space: nowrap;
}

.toast-notice.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
