/* =====================================================================
   1-MINUTE EMPIRE — Design System
   Inspired by: Jony Ive materiality · Claude's warm palette · Linear's precision
   ===================================================================== */

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

:root {
  /* --- SURFACES (warm dark) --- */
  --bg:          #141110;
  --bg-soft:     #1a1614;
  --surface:     #1f1a17;
  --surface-2:   #261f1b;
  --surface-3:   #2e2620;
  --hairline:    rgba(255, 240, 220, 0.06);
  --hairline-strong: rgba(255, 240, 220, 0.12);

  /* --- INK --- */
  --ink:         #f5efe3;
  --ink-soft:    #d4cbba;
  --ink-muted:   #8a7f6d;
  --ink-faint:   #5a5149;

  /* --- ACCENTS (warm) --- */
  --copper:      #e9a27b;    /* primary */
  --copper-deep: #c8794d;
  --copper-glow: rgba(233, 162, 123, 0.35);
  --amber:       #e8c37a;
  --gold:        #f0b957;

  /* --- SEMANTIC --- */
  --sage:        #8fb878;    /* positive */
  --sage-soft:   rgba(143, 184, 120, 0.14);
  --clay:        #d67676;    /* negative */
  --clay-soft:   rgba(214, 118, 118, 0.14);
  --sky:         #7fb0c8;    /* info */
  --plum:        #c894c4;    /* hype */

  /* --- SYSTEM --- */
  --radius-sm:   10px;
  --radius:      16px;
  --radius-lg:   22px;
  --radius-xl:   28px;
  --spring:      cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease:        cubic-bezier(0.25, 0.1, 0.25, 1);
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bot:    env(safe-area-inset-bottom, 0px);

  /* --- TYPE --- */
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-ui:     'Inter Tight', system-ui, -apple-system, sans-serif;
}

html, body { height: 100%; overscroll-behavior: none; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-feature-settings: 'ss01', 'cv11';
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: -0.01em;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bot);
  position: relative;
}

/* Ambient background — subtle warm gradient mesh */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(233, 162, 123, 0.08), transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(232, 195, 122, 0.05), transparent 60%),
    radial-gradient(ellipse 60% 50% at 0% 60%, rgba(200, 148, 196, 0.04), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* Subtle grain texture */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.4;
  mix-blend-mode: overlay;
  pointer-events: none;
  z-index: 1;
}

#particle-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  pointer-events: none;
  z-index: 9998;
}

#app {
  width: 100%;
  max-width: 460px;
  padding: 16px 20px 32px;
  position: relative;
  z-index: 10;
  min-height: 100vh;
}

/* =====================================================================
   TOP BAR
   ===================================================================== */
#top-bar {
  display: flex;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 10px;
}

.coin-chip, .streak-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 100px;
  padding: 8px 14px 8px 12px;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  transition: transform 0.3s var(--spring);
}

.coin-chip span:first-child, .streak-chip span:first-child {
  font-size: 15px;
  filter: saturate(1.1);
}

.coin-chip { color: var(--amber); }
.streak-chip { color: var(--copper); }

.coin-chip.bump, .streak-chip.bump { animation: chipBump 0.5s var(--spring); }

@keyframes chipBump {
  0% { transform: scale(1); }
  40% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* =====================================================================
   SCREENS
   ===================================================================== */
.screen { display: none; animation: screenIn 0.4s var(--ease); }
.screen.active { display: block; }

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

/* =====================================================================
   START SCREEN
   ===================================================================== */
#start-screen {
  text-align: center;
  padding: 24px 4px 8px;
}

.logo-mark {
  display: inline-block;
  margin-bottom: 24px;
  filter: drop-shadow(0 0 40px var(--copper-glow));
  animation: logoBreathe 6s ease-in-out infinite;
}

.logo-mark svg {
  display: block;
}

@keyframes logoBreathe {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 30px var(--copper-glow)); }
  50% { transform: scale(1.04); filter: drop-shadow(0 0 50px var(--copper-glow)); }
}

#start-screen h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 56px;
  line-height: 1;
  letter-spacing: -0.03em;
  margin-bottom: 14px;
  color: var(--ink);
}

#start-screen h1 em {
  font-style: italic;
  color: var(--copper);
  font-weight: 400;
}

.tagline {
  color: var(--ink-muted);
  font-size: 15px;
  line-height: 1.5;
  margin-bottom: 32px;
  letter-spacing: -0.005em;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

.best-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 28px;
}

.best-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-align: left;
  position: relative;
  overflow: hidden;
}

.best-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 240, 220, 0.03), transparent 40%);
  pointer-events: none;
}

.best-label {
  font-size: 11px;
  color: var(--ink-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 4px;
  font-weight: 500;
}

.best-value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 400;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

/* =====================================================================
   BUTTONS
   ===================================================================== */
.btn {
  display: block;
  width: 100%;
  padding: 15px 22px;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: transform 0.18s var(--spring), box-shadow 0.18s var(--ease), opacity 0.15s;
  position: relative;
  overflow: hidden;
  font-family: inherit;
  color: var(--ink);
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(180deg, var(--copper) 0%, var(--copper-deep) 100%);
  color: #1f1410;
  box-shadow:
    0 1px 0 rgba(255, 220, 190, 0.3) inset,
    0 -1px 0 rgba(0, 0, 0, 0.15) inset,
    0 10px 30px -8px var(--copper-glow),
    0 2px 8px rgba(0, 0, 0, 0.2);
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 16px;
  padding: 17px 22px;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow:
    0 1px 0 rgba(255, 220, 190, 0.4) inset,
    0 -1px 0 rgba(0, 0, 0, 0.15) inset,
    0 16px 40px -8px var(--copper-glow),
    0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
  background: var(--surface-2);
  border: 1px solid var(--hairline-strong);
  color: var(--ink);
  margin-bottom: 10px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

.btn-ghost {
  background: transparent;
  color: var(--ink-muted);
  border: none;
  font-size: 14px;
  padding: 12px;
  font-weight: 500;
}

.btn-ghost:hover { color: var(--ink-soft); }

.btn-ad {
  background: linear-gradient(180deg, rgba(143, 184, 120, 0.15), rgba(143, 184, 120, 0.05));
  border: 1px solid rgba(143, 184, 120, 0.25);
  color: var(--sage);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
}

.ad-tag {
  background: rgba(143, 184, 120, 0.2);
  color: var(--sage);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 3px 7px;
  border-radius: 4px;
}

/* =====================================================================
   MENU GRID
   ===================================================================== */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
  margin-bottom: 20px;
}

.btn-menu {
  background: var(--surface);
  border: 1px solid var(--hairline);
  padding: 14px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  position: relative;
  transition: border-color 0.2s, background 0.2s, transform 0.15s var(--spring);
}

.btn-menu:hover {
  border-color: var(--hairline-strong);
  background: var(--surface-2);
  transform: translateY(-2px);
}

.menu-icon {
  font-size: 22px;
  filter: saturate(0.9);
}

.menu-label {
  color: var(--ink-muted);
  font-weight: 500;
  letter-spacing: -0.005em;
}

.menu-badge {
  position: absolute;
  top: 8px; right: 8px;
  background: var(--copper);
  color: #1f1410;
  font-size: 10px;
  font-weight: 800;
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px var(--bg);
}

/* =====================================================================
   BANNER AD
   ===================================================================== */
.banner-ad {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px dashed var(--hairline-strong);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13px;
  color: var(--ink-muted);
  margin-top: 16px;
}

.ad-label {
  background: var(--surface-3);
  color: var(--ink-faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 3px 7px;
  border-radius: 4px;
}

.ad-cta {
  margin-left: auto;
  background: var(--copper);
  color: #1f1410;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}

/* =====================================================================
   TIMER
   ===================================================================== */
.timer-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.timer-display {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 400;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  color: var(--ink);
  min-width: 56px;
  transition: color 0.3s;
}

.timer-display.urgent {
  color: var(--clay);
  animation: timerPulse 0.6s ease-in-out infinite;
}

@keyframes timerPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.65; transform: scale(1.08); }
}

.timer-bar-wrap {
  flex: 1;
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
}

#timer-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 1s linear, background 0.8s;
  background: var(--copper);
}

.combo-indicator {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  font-style: italic;
  color: var(--ink-muted);
  min-width: 44px;
  text-align: right;
  transition: transform 0.3s var(--spring), color 0.2s;
  letter-spacing: -0.02em;
}

.combo-indicator.active {
  color: var(--gold);
  animation: comboPop 0.5s var(--spring);
  text-shadow: 0 0 20px rgba(240, 185, 87, 0.5);
}

@keyframes comboPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* =====================================================================
   STATS
   ===================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 14px 14px 12px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s var(--spring);
}

.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 240, 220, 0.03) 0%, transparent 50%);
  pointer-events: none;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 12px; right: 12px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--stat-color, var(--copper));
  box-shadow: 0 0 12px var(--stat-color, var(--copper));
  opacity: 0.7;
}

.stat-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.stat-label > span:first-child {
  font-size: 11px;
  filter: saturate(0.9);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.1;
}

.stat-delta {
  position: absolute;
  top: 14px; right: 24px;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  opacity: 0;
  letter-spacing: -0.01em;
}

.stat-delta.pop { animation: deltaAnim 1.3s var(--ease) forwards; }

@keyframes deltaAnim {
  0%   { opacity: 1; transform: translateY(0); }
  70%  { opacity: 1; transform: translateY(-22px); }
  100% { opacity: 0; transform: translateY(-28px); }
}

/* =====================================================================
   DAILY PILL
   ===================================================================== */
.daily-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, rgba(240, 185, 87, 0.15), rgba(233, 162, 123, 0.1));
  border: 1px solid rgba(240, 185, 87, 0.25);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 14px;
  color: var(--amber);
  letter-spacing: -0.005em;
}

/* =====================================================================
   DECISION CARD
   ===================================================================== */
.decision-card {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-lg);
  padding: 22px 18px 18px;
  margin-bottom: 14px;
  animation: cardIn 0.4s var(--spring);
  position: relative;
  overflow: hidden;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 20px 40px -20px rgba(0, 0, 0, 0.4);
}

.decision-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 100% 60% at 50% 0%, rgba(233, 162, 123, 0.06), transparent 70%);
  pointer-events: none;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.decision-category {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--copper);
  margin-bottom: 8px;
}

.decision-prompt {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 18px;
  color: var(--ink);
}

.btn-option {
  background: var(--bg-soft);
  border: 1px solid var(--hairline);
  color: var(--ink);
  text-align: left;
  padding: 14px 16px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  font-size: 14px;
  transition: all 0.2s var(--ease);
  width: 100%;
  font-family: inherit;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.btn-option:hover {
  border-color: var(--copper);
  background: var(--surface-2);
  transform: translateX(3px);
  box-shadow: -3px 0 0 0 var(--copper);
}

.btn-option .opt-title {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  margin-bottom: 3px;
  color: var(--ink);
}

.btn-option .opt-desc {
  font-size: 12px;
  color: var(--ink-muted);
  margin-bottom: 8px;
  letter-spacing: -0.005em;
  font-weight: 400;
}

.btn-option .opt-effects {
  font-size: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.eff-tag {
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: -0.005em;
  font-variant-numeric: tabular-nums;
}

.eff-pos { background: var(--sage-soft); color: var(--sage); }
.eff-neg { background: var(--clay-soft); color: var(--clay); }

/* =====================================================================
   EVENT BANNER
   ===================================================================== */
#event-banner {
  position: fixed;
  top: 0; left: 50%;
  transform: translateX(-50%) translateY(-120%);
  background: var(--surface-2);
  border: 1px solid var(--hairline-strong);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 14px 22px;
  max-width: 420px;
  width: calc(100% - 40px);
  text-align: center;
  z-index: 500;
  transition: transform 0.5s var(--spring);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

#event-banner.show { transform: translateX(-50%) translateY(0); }

#event-banner .evt-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: 2px;
  color: var(--ink);
}

#event-banner .evt-sub {
  font-size: 12px;
  color: var(--ink-muted);
}

/* =====================================================================
   END SCREEN
   ===================================================================== */
#end-screen { text-align: center; padding: 16px 0 0; }

.rating-icon {
  font-size: 56px;
  margin-bottom: 8px;
  animation: ratingIn 0.7s var(--spring);
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.3));
}

@keyframes ratingIn {
  from { opacity: 0; transform: scale(0.3) rotate(-20deg); }
  to   { opacity: 1; transform: scale(1) rotate(0deg); }
}

.rating-label {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
  color: var(--ink);
}

.rating-sub {
  color: var(--ink-muted);
  font-size: 14px;
  margin-bottom: 22px;
  letter-spacing: -0.005em;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.result-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 14px;
  text-align: left;
}

.result-card .r-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

.result-card .r-value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.coins-earned {
  background: linear-gradient(135deg, rgba(240, 185, 87, 0.1), rgba(233, 162, 123, 0.05));
  border: 1px solid rgba(240, 185, 87, 0.2);
  border-radius: var(--radius);
  padding: 14px;
  font-size: 14px;
  margin-bottom: 16px;
  font-weight: 500;
  color: var(--ink-soft);
  letter-spacing: -0.005em;
}

.coin-glow {
  color: var(--amber);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  text-shadow: 0 0 16px rgba(240, 185, 87, 0.4);
  letter-spacing: -0.02em;
}

.new-best, .daily-complete {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 100px;
  margin-bottom: 14px;
  letter-spacing: 0.02em;
  animation: badgePop 0.5s var(--spring);
}

.new-best {
  background: rgba(240, 185, 87, 0.15);
  color: var(--amber);
  border: 1px solid rgba(240, 185, 87, 0.3);
}

.daily-complete {
  background: rgba(143, 184, 120, 0.15);
  color: var(--sage);
  border: 1px solid rgba(143, 184, 120, 0.3);
  margin-left: 6px;
}

@keyframes badgePop {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* =====================================================================
   MODAL
   ===================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 6, 0.7);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  z-index: 1000;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  animation: overlayFade 0.3s var(--ease);
}

@media (min-width: 500px) {
  .modal-overlay { align-items: center; padding: 20px; }
}

@keyframes overlayFade { from { opacity: 0; } to { opacity: 1; } }

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

.modal {
  background: var(--bg-soft);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  max-width: 460px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modalSlide 0.45s var(--spring);
  box-shadow: 0 -20px 80px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

@media (min-width: 500px) {
  .modal { border-radius: var(--radius-xl); }
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--hairline);
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.modal-close {
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  color: var(--ink-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
  padding-bottom: 2px;
}

.modal-close:hover { color: var(--ink); background: var(--surface-3); }

.modal-body {
  padding: 18px 20px 24px;
  overflow-y: auto;
  flex: 1;
}

/* =====================================================================
   TABS
   ===================================================================== */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--hairline);
  padding: 0 20px;
  gap: 6px;
}

.tab {
  padding: 12px 14px;
  background: transparent;
  border: none;
  color: var(--ink-muted);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: -0.005em;
  cursor: pointer;
  font-family: inherit;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
  margin-bottom: -1px;
}

.tab.active {
  color: var(--ink);
  border-bottom-color: var(--copper);
}

/* =====================================================================
   SHOP ITEM
   ===================================================================== */
.shop-item {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  position: relative;
  overflow: hidden;
}

.shop-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 240, 220, 0.02), transparent 50%);
  pointer-events: none;
}

.shop-item-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 6px;
}

.shop-item-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
  color: var(--ink);
}

.shop-item-desc {
  font-size: 13px;
  color: var(--ink-muted);
  margin-bottom: 6px;
  letter-spacing: -0.005em;
}

.shop-item-effect {
  font-size: 12px;
  color: var(--sage);
  margin-bottom: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.level-dots {
  display: flex;
  gap: 5px;
  margin-bottom: 12px;
}

.level-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--surface-3);
  transition: all 0.3s var(--spring);
}

.level-dot.filled {
  background: var(--copper);
  box-shadow: 0 0 8px var(--copper-glow);
}

.shop-buy-btn {
  width: 100%;
  padding: 11px;
  background: linear-gradient(180deg, var(--copper), var(--copper-deep));
  color: #1f1410;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  letter-spacing: -0.005em;
  box-shadow:
    0 1px 0 rgba(255, 220, 190, 0.25) inset,
    0 4px 12px -4px var(--copper-glow);
  transition: transform 0.15s var(--spring);
}

.shop-buy-btn:hover { transform: translateY(-1px); }

.shop-buy-btn:disabled {
  background: var(--surface-3);
  color: var(--ink-faint);
  cursor: not-allowed;
  box-shadow: none;
}

.shop-buy-btn.maxed {
  background: linear-gradient(180deg, var(--sage), #6d9858);
  color: #0f1a0a;
}

.premium-item {
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
  border: 1px solid rgba(240, 185, 87, 0.3);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  position: relative;
  overflow: hidden;
}

.premium-item::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.premium-price {
  background: linear-gradient(180deg, var(--gold), #c89540);
  color: #2a1d0a;
  font-weight: 700;
  padding: 11px;
  border: none;
  border-radius: var(--radius-sm);
  width: 100%;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  box-shadow:
    0 1px 0 rgba(255, 230, 180, 0.3) inset,
    0 4px 12px -4px rgba(240, 185, 87, 0.3);
}

.premium-price.owned {
  background: var(--surface-3);
  color: var(--sage);
  cursor: default;
  box-shadow: none;
}

.demo-notice {
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-left: 2px solid var(--amber);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--ink-muted);
  margin-bottom: 14px;
  line-height: 1.5;
  letter-spacing: -0.005em;
}

.demo-notice strong { color: var(--ink-soft); font-weight: 600; }

/* =====================================================================
   ACHIEVEMENTS
   ===================================================================== */
.ach-item {
  display: flex;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 8px;
  align-items: center;
  transition: border-color 0.25s;
}

.ach-item.unlocked {
  border-color: rgba(240, 185, 87, 0.3);
  background: linear-gradient(135deg, var(--surface), rgba(240, 185, 87, 0.04));
}

.ach-icon {
  font-size: 24px;
  width: 48px;
  height: 48px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: grayscale(1) brightness(0.6);
  flex-shrink: 0;
}

.ach-item.unlocked .ach-icon {
  filter: grayscale(0) brightness(1);
  background: linear-gradient(135deg, rgba(240, 185, 87, 0.15), rgba(233, 162, 123, 0.08));
  border-color: rgba(240, 185, 87, 0.3);
}

.ach-info { flex: 1; min-width: 0; }

.ach-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.ach-desc {
  color: var(--ink-muted);
  font-size: 12px;
  margin-bottom: 2px;
  letter-spacing: -0.005em;
}

.ach-reward {
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.ach-item.unlocked .ach-reward { color: var(--amber); }
.ach-item.unlocked .ach-reward:has-text('claimed') { color: var(--sage); }

.ach-claim-btn {
  background: var(--copper);
  color: #1f1410;
  border: none;
  padding: 7px 14px;
  border-radius: 100px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  letter-spacing: -0.005em;
  box-shadow: 0 0 20px var(--copper-glow);
  flex-shrink: 0;
}

/* =====================================================================
   DAILY MODAL
   ===================================================================== */
.daily-hero {
  text-align: center;
  padding: 24px 20px;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(240, 185, 87, 0.2), transparent 70%),
    linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid rgba(240, 185, 87, 0.2);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}

.daily-hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.daily-hero .d-title {
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 8px;
  font-weight: 600;
}

.daily-hero .d-obj {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
  color: var(--ink);
  line-height: 1.2;
}

.daily-hero .d-reward {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.daily-hero .d-reward b { color: var(--amber); font-weight: 700; }

/* =====================================================================
   LEADERBOARD
   ===================================================================== */
.lb-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  margin-bottom: 6px;
}

.lb-rank {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  font-style: italic;
  width: 32px;
  color: var(--copper);
  text-align: center;
  letter-spacing: -0.02em;
}

.lb-info { flex: 1; min-width: 0; }

.lb-score {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.lb-meta {
  color: var(--ink-muted);
  font-size: 11px;
  letter-spacing: -0.005em;
  margin-top: 1px;
}

.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--ink-muted);
  font-size: 14px;
  line-height: 1.5;
}

.empty-state strong { color: var(--ink-soft); display: block; margin-bottom: 4px; font-weight: 600; }

/* =====================================================================
   AD MODAL
   ===================================================================== */
.ad-modal {
  max-width: 320px;
  padding: 0;
  overflow: hidden;
  border-radius: var(--radius-xl);
}

.ad-simulation {
  background: linear-gradient(135deg, var(--copper), var(--gold));
  padding: 48px 24px;
  text-align: center;
  color: #1f1410;
  position: relative;
}

.ad-tag-big {
  position: absolute;
  top: 12px; right: 12px;
  background: rgba(31, 20, 16, 0.35);
  color: rgba(255, 240, 220, 0.9);
  padding: 4px 9px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.ad-fake {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 400;
  font-style: italic;
  margin-bottom: 24px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.ad-fake small {
  display: block;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  font-style: normal;
  opacity: 0.8;
  margin-top: 6px;
  letter-spacing: -0.005em;
}

.ad-countdown-wrap {
  background: rgba(31, 20, 16, 0.35);
  color: rgba(255, 240, 220, 0.95);
  padding: 10px 18px;
  border-radius: 100px;
  font-weight: 600;
  display: inline-block;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
}

#ad-countdown {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 400;
  margin: 0 4px;
}

/* =====================================================================
   TOAST
   ===================================================================== */
.toast-wrap {
  position: fixed;
  top: calc(var(--safe-top) + 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 420px;
  padding: 0 20px;
}

.toast {
  background: var(--surface-2);
  border: 1px solid rgba(240, 185, 87, 0.3);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 16px 50px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.5s var(--spring), toastOut 0.4s var(--ease) 2.6s forwards;
  pointer-events: auto;
  backdrop-filter: blur(12px);
}

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

@keyframes toastOut {
  to { opacity: 0; transform: translateY(-12px); }
}

.toast-icon { font-size: 22px; flex-shrink: 0; }

.toast-text { flex: 1; min-width: 0; }

.toast-title {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.toast-sub {
  color: var(--ink-muted);
  font-size: 12px;
  letter-spacing: -0.005em;
  margin-top: 1px;
}

/* =====================================================================
   RIPPLE & SHAKE
   ===================================================================== */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(233, 162, 123, 0.25);
  transform: scale(0);
  animation: rippleAnim 0.6s linear;
  pointer-events: none;
}

@keyframes rippleAnim { to { transform: scale(4); opacity: 0; } }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.shake { animation: shake 0.45s ease; }

/* =====================================================================
   SCROLLBAR
   ===================================================================== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--hairline-strong); border-radius: 4px; }

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
@media (max-height: 700px) {
  .logo-icon { font-size: 48px; margin-bottom: 12px; }
  #start-screen h1 { font-size: 44px; }
  .rating-icon { font-size: 48px; }
  .rating-label { font-size: 28px; }
  .decision-prompt { font-size: 20px; }
}
