/* ==========================================================================
   Z-INDEX SCALE — every new layer must map onto this scale.
     0    background images / video / canvas
     1    overlays (noise, grain, vignette, gradient)   + pointer-events: none
     2    decorative elements (glow, blobs, shapes)     + pointer-events: none
     5    content (sections, text, cards)
     10   buttons and links                             + position: relative
     11   transient tap effects (floaters, crumbs)      + pointer-events: none
     100  nav
     200  toast / modal
   ========================================================================== */

:root {
  /* colors */
  --bg-primary: #fff6e8;
  --bg-secondary: #ffe9c7;
  --bg-tertiary: #ffdca0;
  --bg-panel: #ffffff;
  --bg-panel-translucent: rgba(255, 255, 255, 0.8);
  --bg-nav: rgba(255, 246, 232, 0.85);
  --bg-card: rgba(255, 246, 232, 0.06);

  --text-primary: #3a2414;
  --text-secondary: #b3701f;
  --text-muted: #d9a25c;
  --text-story: #f0ddc2;

  --accent: #e8a94a;
  --accent-dim: #6b3f1d;
  --accent-deep: #4a2c17;

  --border: rgba(107, 63, 29, 0.15);
  --border-light: rgba(255, 233, 199, 0.15);

  /* typography */
  --font-display: 'Baloo 2', sans-serif;
  --font-body: 'Fredoka', sans-serif;

  /* effects */
  --shadow-color: rgba(74, 44, 23, 0.25);
  --shadow-sm: 0 6px 18px var(--shadow-color);
  --radius-sm: 16px;
  --radius-md: 20px;
  --radius-pill: 999px;
  --transition: 0.12s ease;
  --transition-fast: 0.09s ease;

  /* layout */
  --topbar-h: 60px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg-primary);
  overflow-x: hidden;
}

h1, h2, h3 {
  font-family: var(--font-display);
  margin: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--bg-nav);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.topbar-brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--accent-deep);
  letter-spacing: 0.02em;
}

.topbar-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-link {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  background: var(--bg-panel);
  border: 1px solid var(--accent);
  color: var(--accent-deep);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.82rem;
  white-space: nowrap;
  transition: transform var(--transition), background var(--transition);
}

.topbar-link:hover {
  background: var(--bg-secondary);
  transform: translateY(-1px);
}

.topbar-link-pump {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  color: var(--bg-primary);
}

.topbar-link-pump:hover {
  background: var(--accent-dim);
}

.topbar-icon {
  font-size: 0.95rem;
  line-height: 1;
}

.scroll-container {
  scroll-snap-type: y proximity;
}

.screen {
  scroll-snap-align: start;
  min-height: calc(100vh - var(--topbar-h));
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}

/* ---------- SCREEN 1 ---------- */

.home-screen {
  background: radial-gradient(circle at 50% 0%, var(--bg-secondary) 0%, var(--bg-primary) 55%, var(--bg-tertiary) 100%);
  overflow: hidden;
}

/* decorative — layer 2, never interactive */
.bg-crumbs {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.bg-crumbs span {
  position: absolute;
  pointer-events: none;
  font-size: 2.2rem;
  opacity: 0.16;
  filter: blur(0.3px);
}

.bg-crumbs span:nth-child(1) { top: 8%;  left: 6%;  transform: rotate(-12deg); }
.bg-crumbs span:nth-child(2) { top: 18%; right: 8%;  transform: rotate(10deg); font-size: 2.8rem; }
.bg-crumbs span:nth-child(3) { bottom: 20%; left: 10%; transform: rotate(8deg); }
.bg-crumbs span:nth-child(4) { bottom: 10%; right: 14%; transform: rotate(-16deg); font-size: 2.6rem; }
.bg-crumbs span:nth-child(5) { top: 45%; left: 3%; transform: rotate(20deg); font-size: 1.8rem; }
.bg-crumbs span:nth-child(6) { top: 40%; right: 4%; transform: rotate(-8deg); font-size: 1.8rem; }

.site-header {
  position: relative;
  z-index: 5;
  text-align: center;
  margin-bottom: 8px;
}

.eyebrow {
  margin: 0 0 6px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.eyebrow.light { color: var(--text-muted); }

.ticker {
  font-size: clamp(3rem, 12vw, 6rem);
  font-weight: 800;
  color: var(--accent-deep);
  line-height: 1;
  letter-spacing: 0.01em;
  text-shadow: 0 4px 0 var(--accent);
}

.sub-eyebrow {
  margin: 12px 0 0;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.03em;
}

.game-area {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 18px;
}

.counter-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-panel-translucent);
  border: 2px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 10px 28px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(4px);
}

.counter-num {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 800;
  color: var(--accent-dim);
  line-height: 1;
  transition: transform var(--transition);
}

.counter-num.bump {
  transform: scale(1.25);
}

.counter-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.cookie-btn {
  position: relative;
  z-index: 10;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  width: min(68vw, 460px);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.cookie-btn img {
  width: 100%;
  display: block;
  filter: drop-shadow(0 18px 24px var(--shadow-color));
  transition: transform var(--transition-fast);
  user-select: none;
}

.cookie-btn:active img,
.cookie-btn.pressed img {
  transform: scale(0.9) rotate(-3deg);
}

.hint {
  margin-top: 10px;
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* transient tap effects — layer 11, never interactive */
.floater {
  position: fixed;
  pointer-events: none;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--accent-dim);
  z-index: 11;
  animation: floatUp 0.8s ease-out forwards;
}

@keyframes floatUp {
  0%   { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -70px) scale(1.2); }
}

.crumb {
  position: fixed;
  pointer-events: none;
  z-index: 11;
  animation: crumbFall 0.9s ease-in forwards;
}

@keyframes crumbFall {
  0%   { opacity: 1; transform: translate(0, 0) rotate(0deg); }
  100% { opacity: 0; transform: translate(var(--dx), 90px) rotate(var(--rot)); }
}

.scroll-cue {
  position: relative;
  z-index: 10;
  margin-top: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--accent-dim);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  opacity: 0.85;
}

.scroll-cue .arrow {
  animation: bounce 1.6s infinite;
  font-size: 1.1rem;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* ---------- SCREEN 2 ---------- */

.story-screen {
  background-image:
    linear-gradient(180deg, rgba(58, 36, 20, 0.9) 0%, rgba(74, 44, 23, 0.82) 45%, rgba(58, 36, 20, 0.94) 100%),
    url('ctw.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: var(--bg-primary);
  padding-top: 64px;
  padding-bottom: 64px;
}

.story-wrap {
  position: relative;
  z-index: 5;
  max-width: 640px;
  width: 100%;
}

.story-screen h2 {
  font-size: clamp(1.6rem, 4.5vw, 2.3rem);
  color: var(--bg-secondary);
  margin-bottom: 26px;
}

.story-card {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  margin-bottom: 16px;
}

.story-emoji {
  font-size: 1.8rem;
  line-height: 1;
  flex-shrink: 0;
}

.story-card h3 {
  font-size: 1.1rem;
  color: var(--accent);
  margin-bottom: 6px;
}

.story-card p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--text-story);
  overflow-wrap: break-word;
}

.back-link {
  position: relative;
  z-index: 10;
  display: inline-block;
  margin-top: 12px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

.back-link:hover {
  text-decoration: underline;
}

/* ---------- RESPONSIVE ---------- */

@media (max-width: 1024px) {
  .topbar { padding: 0 16px; }
  .topbar-links { gap: 6px; }
  .topbar-link { padding: 7px 12px; }
}

@media (max-width: 768px) {
  .topbar { padding: 0 14px; }
  .topbar-links {
    gap: 6px;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .topbar-links::-webkit-scrollbar { display: none; }
  .topbar-link {
    min-height: 44px;
    padding: 7px 12px;
    font-size: 0.78rem;
  }
  .scroll-cue { min-height: 44px; justify-content: center; }
  .back-link { min-height: 44px; line-height: 44px; }
}

@media (max-width: 480px) {
  .screen { padding: 24px 16px; }
  .topbar { padding: 0 12px; }
  .topbar-brand { font-size: 1rem; }
  .topbar-links { gap: 5px; }
  .topbar-link { padding: 6px 10px; font-size: 0.72rem; }
  .topbar-icon { font-size: 0.85rem; }
  .counter-card { padding: 10px 20px; }
  .story-screen { padding-left: 16px; padding-right: 16px; }
  .story-card { flex-direction: column; gap: 8px; }
}
