/* ==========================================================================
   TINY WORLD — Official Stylesheet for kishar.fun
   Cozy Indie Cosmic Game & Interactive Coming Soon
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design Tokens & CSS Custom Properties
   -------------------------------------------------------------------------- */
:root {
  /* Color Palette */
  --bg-space: #070913;
  --bg-deep: #0b0f1d;
  --bg-surface: rgba(18, 24, 43, 0.75);
  --bg-surface-hover: rgba(28, 38, 66, 0.85);
  --bg-card: rgba(15, 21, 38, 0.65);
  --bg-card-border: rgba(255, 255, 255, 0.08);

  /* Accents */
  --accent-lavender: #c084fc;
  --accent-lavender-glow: rgba(192, 132, 252, 0.35);
  --accent-cyan: #38bdf8;
  --accent-cyan-glow: rgba(56, 189, 248, 0.35);
  --accent-pink: #f472b6;
  --accent-mint: #4ade80;
  --accent-gold: #fbbf24;
  --accent-gold-glow: rgba(251, 191, 36, 0.4);

  /* Typography Colors */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* Sizing & Radius */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Transitions */
  --trans-fast: 0.15s ease;
  --trans-normal: 0.25s ease;
  --trans-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --------------------------------------------------------------------------
   2. Reset & Global Base
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  min-height: 100%;
  background-color: var(--bg-space);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Accessible hidden utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* --------------------------------------------------------------------------
   3. Ambient Background & Canvas
   -------------------------------------------------------------------------- */
.space-backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(circle at 50% 20%, #151833 0%, #070913 70%);
  overflow: hidden;
}

.nebula-glow {
  position: absolute;
  width: 700px;
  height: 700px;
  top: 10%;
  left: 50%;
  transform: translate(-50%, -20%);
  background: radial-gradient(circle, rgba(168, 85, 247, 0.12) 0%, rgba(56, 189, 248, 0.08) 40%, transparent 70%);
  filter: blur(80px);
  pointer-events: none;
  animation: nebulaBreathe 16s ease-in-out infinite alternate;
}

@keyframes nebulaBreathe {
  0% { transform: translate(-50%, -20%) scale(1); opacity: 0.8; }
  100% { transform: translate(-48%, -18%) scale(1.15); opacity: 1; }
}

/* --------------------------------------------------------------------------
   4. Application Layout Container
   -------------------------------------------------------------------------- */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  gap: 1.25rem;
}

/* --------------------------------------------------------------------------
   5. Top Header Navigation Bar
   -------------------------------------------------------------------------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--bg-card-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  gap: 1rem;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-main);
}

.brand-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-lavender), var(--accent-cyan));
  box-shadow: 0 0 16px var(--accent-lavender-glow);
  flex-shrink: 0;
}

.brand-icon svg {
  width: 20px;
  height: 20px;
  fill: #fff;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #ffffff 40%, var(--accent-lavender) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-tag {
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  color: var(--accent-cyan);
  font-weight: 500;
}

/* Header Live Stardust Counters */
.header-stats {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.stardust-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(10, 14, 28, 0.7);
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(192, 132, 252, 0.25);
  box-shadow: inset 0 0 12px rgba(192, 132, 252, 0.1);
}

.stardust-icon {
  width: 16px;
  height: 16px;
  color: var(--accent-gold);
  animation: starPulse 2.5s ease-in-out infinite;
}

@keyframes starPulse {
  0%, 100% { transform: scale(1) rotate(0deg); filter: drop-shadow(0 0 2px var(--accent-gold)); }
  50% { transform: scale(1.2) rotate(15deg); filter: drop-shadow(0 0 8px var(--accent-gold)); }
}

.stardust-value {
  font-size: 1.1rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #fff;
  min-width: 2.5rem;
}

.rate-badge {
  font-size: 0.75rem;
  color: var(--accent-mint);
  font-family: var(--font-mono);
  font-weight: 600;
  background: rgba(74, 222, 128, 0.12);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
}

/* Combo multiplier badge */
.combo-badge {
  font-size: 0.75rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-pink), var(--accent-lavender));
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  box-shadow: 0 0 12px rgba(244, 114, 182, 0.5);
  animation: comboPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.combo-badge.hidden {
  display: none;
}

@keyframes comboPop {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Header Action Buttons */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--bg-card-border);
  color: var(--text-muted);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all var(--trans-fast);
  outline: none;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.icon-btn:active {
  transform: translateY(1px);
}

.icon-btn:focus-visible {
  outline: 2px solid var(--accent-lavender);
  outline-offset: 2px;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* --------------------------------------------------------------------------
   6. Hero Announcement Banner
   -------------------------------------------------------------------------- */
.hero-banner {
  text-align: center;
  padding: 0.75rem 1rem 0.25rem;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.85rem;
  border-radius: var(--radius-full);
  background: rgba(192, 132, 252, 0.1);
  border: 1px solid rgba(192, 132, 252, 0.3);
  color: var(--accent-lavender);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.65rem;
  box-shadow: 0 0 16px rgba(192, 132, 252, 0.15);
}

.hero-pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 6px var(--accent-cyan);
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.hero-title {
  font-size: clamp(1.75rem, 4.5vw, 2.75rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 0.4rem;
  background: linear-gradient(135deg, #ffffff 30%, #e0e7ff 60%, var(--accent-lavender) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 16px rgba(192, 132, 252, 0.25));
}

.hero-subtitle {
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
  font-weight: 400;
}

/* --------------------------------------------------------------------------
   7. Interactive Canvas Game Arena
   -------------------------------------------------------------------------- */
.game-viewport {
  position: relative;
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--bg-card-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  padding: 0.75rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  height: 380px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: radial-gradient(circle at 50% 60%, #151b36 0%, #090c18 85%);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

#world-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Floating dynamic speech bubble for Momo */
.momo-speech {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(192, 132, 252, 0.4);
  padding: 0.55rem 1rem;
  border-radius: var(--radius-full);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 16px var(--accent-lavender-glow);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 10;
  white-space: nowrap;
}

.momo-speech.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

.momo-speech::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 10px;
  background: rgba(15, 23, 42, 0.88);
  border-right: 1px solid rgba(192, 132, 252, 0.4);
  border-bottom: 1px solid rgba(192, 132, 252, 0.4);
  transform: translateX(-50%) rotate(45deg);
}

/* Canvas Guidance Footer */
.canvas-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.75rem 0.25rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.game-hint {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.game-hint-icon {
  color: var(--accent-gold);
}

/* World Stage Progression Tracker */
.stage-tracker {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

.stage-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-lavender);
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.stage-bar-bg {
  width: 120px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.stage-bar-fill {
  height: 100%;
  width: 10%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-lavender));
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
  box-shadow: 0 0 8px var(--accent-lavender);
}

/* --------------------------------------------------------------------------
   8. Tabs Dashboard Navigation
   -------------------------------------------------------------------------- */
.dashboard-container {
  background: var(--bg-surface);
  border: 1px solid var(--bg-card-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Tab Headers */
.tab-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 0.75rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.tab-nav::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  transition: all var(--trans-fast);
  white-space: nowrap;
  outline: none;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  color: #fff;
  background: rgba(192, 132, 252, 0.18);
  border: 1px solid rgba(192, 132, 252, 0.4);
  box-shadow: 0 0 16px rgba(192, 132, 252, 0.15);
}

.tab-btn:focus-visible {
  outline: 2px solid var(--accent-lavender);
}

.tab-badge {
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
}

/* --------------------------------------------------------------------------
   9. Tab Contents
   -------------------------------------------------------------------------- */
.tab-content {
  display: none;
  animation: fadeInTab 0.25s ease;
}

.tab-content.active {
  display: block;
}

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

/* Category Filter Bar inside Grow Tab */
.category-filter {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.filter-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--bg-card-border);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--trans-fast);
}

.filter-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.filter-chip.active {
  background: var(--text-main);
  color: var(--bg-space);
  border-color: var(--text-main);
}

/* Upgrades Card Grid */
.upgrades-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.upgrade-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
  transition: transform var(--trans-fast), border-color var(--trans-fast), box-shadow var(--trans-fast);
  position: relative;
  overflow: hidden;
}

.upgrade-card:hover {
  border-color: rgba(192, 132, 252, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.upgrade-card.locked {
  opacity: 0.6;
  filter: grayscale(0.5);
}

.upgrade-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.upgrade-icon-box {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.upgrade-meta {
  flex: 1;
}

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

.upgrade-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}

.upgrade-level {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--accent-lavender);
  background: rgba(192, 132, 252, 0.15);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
}

.upgrade-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  line-height: 1.35;
}

.upgrade-effect {
  font-size: 0.75rem;
  color: var(--accent-mint);
  font-weight: 600;
  margin-top: 0.25rem;
}

/* Upgrade Card Bottom Action */
.upgrade-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  gap: 0.5rem;
}

.upgrade-cost {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.88rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent-gold);
}

.buy-btn {
  background: linear-gradient(135deg, var(--accent-lavender) 0%, #9333ea 100%);
  color: #fff;
  border: none;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--trans-fast);
  outline: none;
  box-shadow: 0 4px 14px rgba(147, 51, 234, 0.35);
}

.buy-btn:hover:not(:disabled) {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(147, 51, 234, 0.5);
}

.buy-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.buy-btn:disabled {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
  cursor: not-allowed;
  box-shadow: none;
}

.buy-btn:focus-visible {
  outline: 2px solid var(--accent-lavender);
}

/* --------------------------------------------------------------------------
   10. Friends Tab — Companions Roster
   -------------------------------------------------------------------------- */
.friends-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.friend-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  position: relative;
  transition: transform var(--trans-fast);
}

.friend-card:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.3);
}

.friend-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 2rem;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.2) 0%, transparent 70%);
  margin-bottom: 0.25rem;
}

.friend-name {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}

.friend-role {
  font-size: 0.75rem;
  color: var(--accent-cyan);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.friend-bio {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 0.25rem;
}

.friend-status {
  font-size: 0.72rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  margin-top: 0.5rem;
  font-weight: 600;
}

.friend-status.unlocked {
  background: rgba(74, 222, 128, 0.15);
  color: var(--accent-mint);
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.friend-status.locked {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
}

/* --------------------------------------------------------------------------
   11. Achievements Tab
   -------------------------------------------------------------------------- */
.achievements-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  border: 1px solid var(--bg-card-border);
}

.achievements-counter {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.85rem;
}

.achievement-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  transition: transform var(--trans-fast);
}

.achievement-card.unlocked {
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.04);
}

.achievement-card.locked {
  opacity: 0.5;
  filter: grayscale(0.8);
}

.achievement-icon {
  font-size: 1.5rem;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.achievement-info {
  flex: 1;
}

.achievement-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
}

.achievement-desc {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* --------------------------------------------------------------------------
   12. Lore & Stats Tab
   -------------------------------------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.stat-box {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
}

.stat-num {
  font-size: 1.4rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
}

.stat-label {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.settings-group {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.settings-group-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 0.5rem;
}

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

.setting-info h4 {
  font-size: 0.88rem;
  font-weight: 600;
}

.setting-info p {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--trans-fast);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--trans-fast);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}

/* --------------------------------------------------------------------------
   13. Toast Notifications
   -------------------------------------------------------------------------- */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  pointer-events: none;
  max-width: 340px;
  width: calc(100% - 40px);
}

.toast {
  pointer-events: auto;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(251, 191, 36, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 16px var(--accent-gold-glow);
  animation: toastIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.removing {
  opacity: 0;
  transform: translateX(30px);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-20px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.toast-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
}

.toast-msg {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   14. Modals (Offline Welcome, Reset, Stage 5 Finale)
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 15, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 900;
  display: grid;
  place-items: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid rgba(192, 132, 252, 0.3);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 30px var(--accent-lavender-glow);
  border-radius: var(--radius-lg);
  max-width: 440px;
  width: 100%;
  padding: 2rem 1.75rem;
  text-align: center;
  transform: scale(0.92);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-dialog {
  transform: scale(1);
}

.modal-badge {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.modal-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.5rem;
}

.modal-body {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

.modal-highlight {
  font-size: 1.25rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--accent-gold);
  display: block;
  margin: 0.5rem 0;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-lavender), #9333ea);
  color: #fff;
  border: none;
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(147, 51, 234, 0.4);
  transition: all var(--trans-fast);
}

.btn-primary:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   15. Site Footer
   -------------------------------------------------------------------------- */
.site-footer {
  margin-top: auto;
  text-align: center;
  padding: 1.5rem 1rem 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.footer-copy {
  color: var(--text-muted);
}

.footer-curiosity {
  font-style: italic;
  font-size: 0.75rem;
}

/* --------------------------------------------------------------------------
   16. Accessibility & Reduced Motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .nebula-glow {
    animation: none;
  }
}

/* --------------------------------------------------------------------------
   17. Responsive Media Queries
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  .app-container {
    padding: 0.75rem 0.65rem 2rem;
    gap: 0.85rem;
  }

  .site-header {
    padding: 0.55rem 0.85rem;
  }

  .brand-title {
    font-size: 0.9rem;
  }

  .stardust-pill {
    padding: 0.35rem 0.65rem;
  }

  .stardust-value {
    font-size: 0.95rem;
  }

  .canvas-wrapper {
    height: 310px;
  }

  .canvas-bottom-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .stage-tracker {
    width: 100%;
    justify-content: space-between;
    margin-left: 0;
  }

  .stage-bar-bg {
    flex: 1;
    max-width: 160px;
  }

  .dashboard-container {
    padding: 0.9rem;
  }

  .upgrades-grid,
  .achievements-grid,
  .friends-grid {
    grid-template-columns: 1fr;
  }

  .modal-dialog {
    padding: 1.5rem 1.25rem;
  }
}
