/* ── Reset ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ── Font Faces ── */
@font-face {
  font-family: 'OpenDyslexic';
  src: url('assets/fonts/OpenDyslexic-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'OpenDyslexic';
  src: url('assets/fonts/OpenDyslexic-Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ── Rainbow border custom property ── */
@property --rainbow-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

/* ── Tokens (Light default) ── */
:root {
  --bg: #F7F4F1;
  --surface: #FFF6EC;
  --border: #7A6854;
  --accent: #B55100;
  --accent-secondary: #9A4500;
  --text: #111827;
  --text-secondary: #374151;
  --text-muted: #4B5563;
  --text-inverse: #FFFFFF;
  --success: #15803D;
  --danger: #B91C1C;

  /* Scene banner colours - light */
  --sun-color: #CC7E68;
  --sun-opacity: 0.55;
  --moon-color: #D4D8E0;
  --moon-opacity: 0;
  --cloud1: #FFFFFF;
  --cloud2: #EBE7E1;
  --cloud3: #D8D2CA;
  --cloud4: #D5CFC8;

  /* Neomorphic shadows */
  --neu-low: 0 1px 3px rgba(0,0,0,0.06), 0 -1px 2px rgba(255,255,255,0.4);
  --neu-medium: 0 2px 8px rgba(0,0,0,0.1), 0 -2px 4px rgba(255,255,255,0.5);
  --neu-high: 0 4px 16px rgba(0,0,0,0.14), 0 -2px 6px rgba(255,255,255,0.5);

  --font: 'Outfit', system-ui, -apple-system, sans-serif;
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;

  /* Typography scale */
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 16px;
  --fs-lg: 18px;
  --fs-xl: 24px;
  --fs-xxl: 32px;
  --lh-tight: 1.2;
  --lh-normal: 1.3;
  --lh-relaxed: 1.5;
  --ls-tighter: -0.5px;
  --ls-tight: -0.25px;
  --ls-none: 0px;
  --ls-wide: 0.5px;
}

/* System dark (no manual override) */
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --bg: #152E2E;
    --surface: #1E3A3A;
    --border: #5E8E8E;
    --accent: #F1C766;
    --accent-secondary: #E0B44F;
    --text: #F5ECD9;
    --text-secondary: #DDD2BB;
    --text-muted: #B7C8C2;
    --text-inverse: #152E2E;
    --success: #4ADE80;
    --danger: #FF7575;

    --sun-color: #CC7E68;
    --sun-opacity: 0;
    --moon-color: #D4D8E0;
    --moon-opacity: 0.9;
    --cloud1: #8090A0;
    --cloud2: #5D6E7C;
    --cloud3: #3A4C58;
    --cloud4: #1A1E24;

    --neu-low: 0 1px 3px rgba(0,0,0,0.25);
    --neu-medium: 0 2px 8px rgba(0,0,0,0.35);
    --neu-high: 0 4px 16px rgba(0,0,0,0.45);
  }
}

/* Manual dark override */
html[data-theme="dark"] {
  --bg: #152E2E;
  --surface: #1E3A3A;
  --border: #5E8E8E;
  --accent: #F1C766;
  --accent-secondary: #E0B44F;
  --text: #F5ECD9;
  --text-secondary: #DDD2BB;
  --text-muted: #B7C8C2;
  --text-inverse: #152E2E;
  --success: #4ADE80;
  --danger: #FF7575;

  --sun-color: #CC7E68;
  --sun-opacity: 0;
  --moon-color: #D4D8E0;
  --moon-opacity: 0.9;
  --cloud1: #8090A0;
  --cloud2: #5D6E7C;
  --cloud3: #3A4C58;
  --cloud4: #1A1E24;

  --neu-low: 0 1px 3px rgba(0,0,0,0.25);
  --neu-medium: 0 2px 8px rgba(0,0,0,0.35);
  --neu-high: 0 4px 16px rgba(0,0,0,0.45);
}

/* Manual light override */
html[data-theme="light"] {
  --bg: #F7F4F1;
  --surface: #FFF6EC;
  --border: #7A6854;
  --accent: #B55100;
  --accent-secondary: #9A4500;
  --text: #111827;
  --text-secondary: #374151;
  --text-muted: #4B5563;
  --text-inverse: #FFFFFF;
  --success: #15803D;
  --danger: #B91C1C;

  --sun-color: #CC7E68;
  --sun-opacity: 0.55;
  --moon-color: #D4D8E0;
  --moon-opacity: 0;
  --cloud1: #FFFFFF;
  --cloud2: #EBE7E1;
  --cloud3: #D8D2CA;
  --cloud4: #D5CFC8;

  --neu-low: 0 1px 3px rgba(0,0,0,0.06), 0 -1px 2px rgba(255,255,255,0.4);
  --neu-medium: 0 2px 8px rgba(0,0,0,0.1), 0 -2px 4px rgba(255,255,255,0.5);
  --neu-high: 0 4px 16px rgba(0,0,0,0.14), 0 -2px 6px rgba(255,255,255,0.5);
}

/* Dyslexia font */
html[data-font="dyslexia"] {
  --font: 'OpenDyslexic', system-ui, sans-serif;
}

/* Font-size scale overrides */
html[data-size="m"] {
  --fs-xs: 14px; --fs-sm: 16px; --fs-md: 19px;
  --fs-lg: 22px; --fs-xl: 29px; --fs-xxl: 38px;
}
html[data-size="l"] {
  --fs-xs: 18px; --fs-sm: 20px; --fs-md: 24px;
  --fs-lg: 27px; --fs-xl: 36px; --fs-xxl: 48px;
}
html[data-size="m"] #size-toggle .size-label { font-size: 16px; }
html[data-size="l"] #size-toggle .size-label { font-size: 18px; }

/* ── Base ── */
html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Smooth theme transitions on key elements */
body,
.toolbar,
.feature-card,
.journey-block,
.store-badge,
.footer,
.h-timeline-dot,
.scene-banner,
.h-timeline,
.hero-icon,
.picker-avatar,
.quest-card,
.xp-track,
.tier-pill,
.stat-item,
.raid-card,
.heatmap-wrap {
  transition: background-color 0.4s, color 0.3s, border-color 0.3s;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Skip Link ── */
.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 999;
  padding: 8px 16px;
  background: var(--accent);
  color: var(--text-inverse);
  font-family: var(--font);
  font-weight: 700;
  font-size: var(--fs-sm);
  border-radius: var(--radius-sm);
  text-decoration: none;
}

.skip-link:focus {
  left: 50%;
  transform: translateX(-50%);
  top: 8px;
}

/* ── Scene Banner (Full-Width Strip) ── */
.scene-banner {
  position: relative;
  width: 100%;
  height: clamp(100px, 12vw, 180px);
  overflow: hidden;
}

.scene-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.scene-layer--sky,
.scene-layer--cloud1,
.scene-layer--cloud2,
.scene-layer--cloud3,
.scene-layer--cloud4 {
  transform: none;
}

.scene-sun,
.scene-moon {
  transition: opacity 0.6s ease;
}

.scene-word {
  position: absolute;
  top: 12%;
  left: 5%;
}

.scene-word-text {
  font-family: var(--font);
  font-weight: 700;
  font-size: var(--fs-sm);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--text-muted);
  opacity: 1;
  transition: opacity 0.5s ease;
}

.scene-word-text.fading {
  opacity: 0;
}

/* ── Sticky Toolbar ── */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 30%, transparent);
  box-shadow: var(--neu-low);
}

.toolbar-brand {
  font-weight: 800;
  font-size: var(--fs-md);
  letter-spacing: 1.5px;
  color: var(--text);
}

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

.toolbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font);
  font-size: var(--fs-sm);
  font-weight: 700;
  transition: background-color 0.2s, border-color 0.2s;
  position: relative;
}

.toolbar-btn:hover {
  background: color-mix(in srgb, var(--accent) 15%, var(--surface));
}

#font-toggle.active {
  border-color: var(--accent);
  color: var(--accent);
}

/* Sun/moon icon crossfade */
.icon-sun, .icon-moon {
  position: absolute;
  transition: opacity 0.3s ease;
}

.icon-moon { opacity: 0; }

html[data-theme="dark"] .icon-sun { opacity: 0; }
html[data-theme="dark"] .icon-moon { opacity: 1; }

/* System dark without manual override */
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]):not([data-theme="dark"]) .icon-sun { opacity: 0; }
  html:not([data-theme="light"]):not([data-theme="dark"]) .icon-moon { opacity: 1; }
}

/* ── Hero ── */
.hero {
  text-align: center;
  padding: 24px 24px 16px;
  position: relative;
}

.hero-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  box-shadow: var(--neu-medium);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.hero-title-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}

/* Rainbow border container */
.rainbow-border-box {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 16px;
  padding: 12px 40px;
  border-radius: var(--radius-md);
  background:
    conic-gradient(from var(--rainbow-angle),
      #FF6B6B, #FECA57, #48DBFB, #FF9FF3, #54A0FF, #5F27CD, #FF6B6B
    ) border-box;
  border: 3px solid transparent;
  background-clip: padding-box, border-box;
  background-origin: padding-box, border-box;
  animation: rainbow-spin 3s linear infinite, hero-pulse 3.2s ease-in-out infinite;
  overflow: hidden;
}

/* Inner background fill to create border-only effect */
.rainbow-border-box::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: calc(var(--radius-md) - 3px);
  background: var(--bg);
  z-index: 0;
  transition: background-color 0.4s;
}

@keyframes rainbow-spin {
  to { --rainbow-angle: 360deg; }
}

@keyframes hero-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.hero-title {
  position: relative;
  z-index: 1;
  font-size: clamp(48px, 10vw, 80px);
  font-weight: 900;
  letter-spacing: -1px;
  color: var(--text);
  line-height: 1.1;
}

/* Floating arrows */
.arrow-float {
  position: absolute;
  z-index: 1;
  color: rgba(255, 215, 0, 0.5);
  font-size: 20px;
  font-weight: 700;
  bottom: 0;
  animation: arrow-rise 2s ease-out infinite;
  opacity: 0;
}

.arrow-float:nth-child(1) { left: 8%; animation-delay: 0s; }
.arrow-float:nth-child(2) { left: 24%; animation-delay: 0.3s; }
.arrow-float:nth-child(3) { left: 42%; animation-delay: 0.7s; }
.arrow-float:nth-child(4) { left: 58%; animation-delay: 0.15s; }
.arrow-float:nth-child(5) { left: 76%; animation-delay: 0.55s; }
.arrow-float:nth-child(6) { left: 90%; animation-delay: 0.9s; }

@keyframes arrow-rise {
  0% {
    transform: translateY(0);
    opacity: 0.6;
  }
  100% {
    transform: translateY(-60px);
    opacity: 0;
  }
}

.hero-tagline {
  font-size: clamp(20px, 4vw, 28px);
  font-weight: 600;
  color: var(--accent);
  margin-top: 4px;
}

.hero-sub {
  font-size: var(--fs-md);
  color: var(--text-muted);
  margin-top: 8px;
  line-height: var(--lh-relaxed);
}

/* Store badges */
.store-badges {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 20px;
  flex-wrap: wrap;
}

.store-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  background: var(--text);
  color: var(--text-inverse);
  border-radius: 9999px;
  font-size: var(--fs-sm);
  font-weight: 500;
  box-shadow: var(--neu-low);
  transition: background-color 0.3s, color 0.3s, transform 0.2s;
}

.store-badge:hover {
  transform: translateY(-1px);
}

.store-badge svg {
  flex-shrink: 0;
}

/* ── Section shared ── */
.section-title {
  font-size: clamp(28px, 5vw, 36px);
  font-weight: 800;
  text-align: center;
  margin-bottom: 16px;
  letter-spacing: var(--ls-tighter);
}

.section-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: var(--fs-md);
  margin-bottom: 8px;
}

/* ── Character Picker ── */
.characters {
  padding: 16px 0 32px;
}

.picker-viewport {
  position: relative;
  overflow: hidden;
  padding: 12px 0;
}

.picker-track {
  display: flex;
  align-items: center;
  gap: 8px;
  will-change: transform;
  transition: transform 0.6s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.picker-item {
  position: relative;
  flex-shrink: 0;
  width: 68px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(0.55);
  opacity: 0.3;
  transition: transform 0.5s ease, opacity 0.5s ease;
}

.picker-item[data-offset="0"] {
  transform: scale(1.45);
  opacity: 1;
  z-index: 2;
}

.picker-item[data-offset="1"] {
  transform: scale(0.75);
  opacity: 0.55;
  z-index: 1;
}

.picker-item[data-offset="2"] {
  transform: scale(0.6);
  opacity: 0.35;
}

.picker-avatar {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
}

.picker-item[data-offset="0"] .picker-avatar {
  box-shadow: var(--neu-medium);
}

.picker-avatar img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.picker-frame {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

/* Brackets */
.picker-brackets {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  pointer-events: none;
  z-index: 3;
}

.bracket {
  width: 8px;
  height: 55%;
  border: 1.5px solid color-mix(in srgb, var(--accent) 50%, transparent);
}

.bracket-left {
  border-right: none;
  border-radius: 4px 0 0 4px;
}

.bracket-right {
  border-left: none;
  border-radius: 0 4px 4px 0;
}

.bracket-spacer {
  width: 107px; /* 68 * 1.45 + 8 */
}

/* ── App Preview ── */
.preview {
  padding: 40px 24px;
}

.quest-grid {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
  margin-bottom: 32px;
}

.quest-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--neu-low);
  flex: 0 0 180px;
  min-width: 180px;
  scroll-snap-align: start;
}

.quest-card-header {
  padding: 6px 12px;
  background: color-mix(in srgb, var(--rarity) 15%, var(--surface));
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.quest-badge {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--rarity);
  text-transform: uppercase;
  letter-spacing: var(--ls-wide);
}

.quest-xp {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--accent);
}

.quest-card-body {
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.quest-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--rarity);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
}

.quest-card-body strong {
  display: block;
  font-size: var(--fs-md);
  font-weight: 700;
}

.quest-card-body span {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

/* Quest card footer */
.quest-card-footer {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid color-mix(in srgb, var(--border) 15%, transparent);
}

.quest-pill {
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  background: color-mix(in srgb, var(--rarity) 15%, transparent);
  color: var(--rarity);
}

.quest-target {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-muted);
}

.quest-checklist {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 3px;
}

.quest-ember-cost {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: #E67E22;
  display: flex;
  align-items: center;
  gap: 3px;
}

/* XP Strip */
.xp-strip {
  text-align: center;
  margin-bottom: 24px;
}

.xp-strip-info {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

.xp-level {
  font-size: var(--fs-xl);
  font-weight: 800;
  color: var(--accent);
}

.xp-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-muted);
}

.xp-track {
  height: 8px;
  background: color-mix(in srgb, var(--border) 30%, var(--bg));
  border-radius: 4px;
  overflow: hidden;
  max-width: 400px;
  margin: 0 auto 6px;
}

.xp-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
}

.xp-label {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

/* Tier Strip */
.tier-strip {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.tier-pill {
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: var(--fs-xs);
  font-weight: 600;
  border: 1px solid color-mix(in srgb, var(--tier-color) 30%, transparent);
  color: var(--tier-color);
  background: color-mix(in srgb, var(--tier-color) 10%, transparent);
}

.tier-pill.active {
  background: var(--tier-color);
  color: white;
  border-color: var(--tier-color);
}

/* Stat Row */
.stat-row {
  display: flex;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
}

.stat-item {
  text-align: center;
}

.stat-value {
  display: block;
  font-size: var(--fs-xxl);
  font-weight: 800;
  color: var(--accent);
  letter-spacing: var(--ls-tighter);
}

.stat-label {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-weight: 500;
}

/* ── Features ── */
.features {
  padding: 40px 24px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.feature-card {
  position: relative;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--border) 20%, transparent);
  border-radius: var(--radius-md);
  padding: 24px 20px;
  box-shadow: var(--neu-medium);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.4s, border-color 0.3s;
}

/* Gradient accent top bar */
.feature-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--neu-high);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}

.feature-icon {
  display: block;
  width: 48px;
  height: 48px;
  padding: 4px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.feature-card h3 {
  font-size: var(--fs-lg);
  font-weight: 700;
  margin-bottom: 6px;
}

.feature-tagline {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 12px;
}

.feature-list {
  list-style: none;
  padding: 0;
}

.feature-list li {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  line-height: var(--lh-relaxed);
  padding-left: 16px;
  position: relative;
}

.feature-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* ── Journey ── */
.journey {
  padding: 40px 24px;
}

.journey-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.journey-block {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--neu-low);
  border-left: 3px solid var(--accent);
}

.journey-block h3 {
  font-size: var(--fs-lg);
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--accent);
}

.journey-block p {
  font-size: var(--fs-md);
  color: var(--text-secondary);
  line-height: var(--lh-relaxed);
}

/* ── Horizontal Timeline ── */
.h-timeline {
  margin-top: 24px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 24px 16px;
  box-shadow: var(--neu-low);
}

.h-timeline-track {
  display: flex;
  align-items: flex-start;
  position: relative;
  min-width: max-content;
  padding: 0 32px;
}

.h-timeline-line {
  position: absolute;
  top: 7px;
  left: 32px;
  right: 32px;
  height: 2px;
  background: var(--border);
}

.h-timeline-fill {
  height: 100%;
  width: 62.5%;
  background: var(--success);
  border-radius: 1px;
  transition: background-color 0.3s;
}

.h-timeline-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 160px;
  scroll-snap-align: center;
  position: relative;
  z-index: 1;
}

.h-timeline-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
  margin-bottom: 12px;
  transition: background-color 0.3s, border-color 0.3s;
}

.h-timeline-item.done .h-timeline-dot {
  background: var(--success);
  border-color: var(--success);
}

.h-timeline-item.active .h-timeline-dot {
  background: var(--accent);
  border-color: var(--accent);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 40%, transparent); }
  50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 0%, transparent); }
}

.h-timeline-label {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.h-timeline-label strong {
  font-size: var(--fs-md);
  font-weight: 700;
}

.h-timeline-label span {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.h-timeline-item:not(.done):not(.active) .h-timeline-label strong {
  color: var(--text-muted);
}

/* ── Preview Sub-heading & Divider ── */
.preview-sub-heading {
  font-size: var(--fs-lg);
  font-weight: 700;
  text-align: center;
  margin-bottom: 16px;
  color: var(--text);
}

.preview-divider {
  width: 60px;
  height: 1px;
  background: color-mix(in srgb, var(--border) 30%, transparent);
  margin: 24px auto;
}

/* ── Heatmap ── */
.heatmap-wrap {
  text-align: center;
  margin-bottom: 16px;
}

.heatmap-grid {
  display: inline-grid;
  grid-template-columns: repeat(20, 12px);
  gap: 3px;
  margin-bottom: 8px;
}

.heatmap-cell {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

.heatmap-cell[data-state="done"] {
  background: var(--success);
}

.heatmap-cell[data-state="missed"] {
  background: color-mix(in srgb, var(--success) 25%, transparent);
}

.heatmap-cell[data-state="today"] {
  background: var(--success);
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.heatmap-cell[data-state="future"] {
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--border) 40%, transparent);
}

.heatmap-cell[data-state="off"] {
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 20%, transparent);
}

.heatmap-legend {
  display: flex;
  justify-content: center;
  gap: 12px;
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.heatmap-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.heatmap-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}

.heatmap-dot.heatmap-done { background: var(--success); }
.heatmap-dot.heatmap-missed { background: color-mix(in srgb, var(--success) 25%, transparent); }
.heatmap-dot.heatmap-off {
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 20%, transparent);
}

/* ── Raid Card ── */
.raid-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--neu-low);
  max-width: 480px;
  margin: 0 auto 16px;
  overflow: hidden;
}

.raid-card-header {
  padding: 8px 16px;
  background: color-mix(in srgb, var(--raid-color) 15%, var(--surface));
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.raid-type-badge {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--ls-wide);
  color: var(--raid-color);
}

.raid-ember-reward {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: #E67E22;
}

.raid-card-body {
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.raid-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--raid-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.raid-info {
  flex: 1;
}

.raid-info strong {
  display: block;
  font-size: var(--fs-md);
  font-weight: 600;
}

.raid-info span {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.raid-checkin-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--success);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--neu-low);
  flex-shrink: 0;
}

.raid-card-footer {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid color-mix(in srgb, var(--border) 15%, transparent);
}

.raid-avatars {
  display: flex;
  align-items: center;
}

.raid-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  margin-left: -6px;
}

.raid-avatar:first-child {
  margin-left: 0;
}

.raid-avatar-more {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-muted);
  margin-left: 4px;
}

.raid-progress {
  flex: 1;
  height: 6px;
  background: color-mix(in srgb, var(--border) 30%, var(--bg));
  border-radius: 3px;
  overflow: hidden;
}

.raid-progress-bar {
  height: 100%;
  background: var(--raid-color);
  border-radius: 3px;
}

/* ── Journal Card ── */
.journal-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--neu-low);
  max-width: 480px;
  margin: 0 auto 16px;
  overflow: hidden;
}

.journal-card-header {
  padding: 10px 16px;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.journal-card-date {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text);
}

.journal-card-xp {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--accent);
}

.journal-card-body {
  padding: 16px;
}

.journal-mood-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.journal-mood-emoji {
  font-size: 28px;
  line-height: 1;
}

.journal-mood-info {
  flex: 1;
}

.journal-mood-info strong {
  display: block;
  font-size: var(--fs-md);
  font-weight: 600;
}

.journal-mood-info span {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.journal-activities {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.journal-activity-tag {
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 9999px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}

.journal-activity-tag.debuff {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}

.journal-note {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  line-height: var(--lh-relaxed);
  font-style: italic;
  padding: 8px 12px;
  border-left: 2px solid color-mix(in srgb, var(--accent) 40%, transparent);
  background: color-mix(in srgb, var(--accent) 5%, transparent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.journal-card-footer {
  padding: 10px 16px;
  display: flex;
  gap: 12px;
  border-top: 1px solid color-mix(in srgb, var(--border) 15%, transparent);
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.journal-footer-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.journal-footer-item svg {
  flex-shrink: 0;
}

/* ── Footer ── */
.footer {
  text-align: center;
  padding: 32px 24px;
  border-top: 1px solid var(--border);
}

.footer-brand {
  font-size: var(--fs-md);
  font-weight: 800;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.footer-copy {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

/* ── Desktop Picker Scale-Up ── */
@media (min-width: 768px) {
  .picker-item[data-offset="0"] { transform: scale(1.8); }
  .picker-item[data-offset="1"] { transform: scale(1.0); }
  .picker-item[data-offset="2"] { transform: scale(0.8); }
  .picker-item { transform: scale(0.65); }
  .bracket-spacer { width: 132px; /* 68 * 1.8 + 10 */ }
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .hero {
    padding: 20px 24px 12px;
  }

  .feature-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }
}

@media (max-width: 600px) {
  .hero {
    padding: 16px 16px 8px;
  }

  .hero-icon {
    width: 48px;
    height: 48px;
  }

  .hero-title-wrap {
    gap: 12px;
  }

  .features,
  .journey {
    padding: 32px 16px;
  }

  .preview {
    padding: 32px 16px;
  }

  .stat-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 32px;
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }

  .journey-content {
    grid-template-columns: 1fr;
  }

  .store-badges {
    flex-direction: column;
    align-items: center;
  }

  .rainbow-border-box {
    padding: 8px 16px;
    gap: 10px;
  }

  .characters {
    padding: 12px 0 24px;
  }
}

/* ── Desktop Quest Grid ── */
@media (min-width: 960px) {
  .quest-grid { overflow-x: visible; }
  .quest-card { flex: 1 1 0; min-width: 0; }
}

/* ── Accessibility ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}

/* Focus styles */
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
