:root {
  /* Brand Palette */
  --brand-quest: #e06010;
  --brand-choose: #6aaa38;
  --brand-bg-icon: #f5ecd4;
  --brand-stroke: rgba(160, 110, 40, 0.2);
  --brand-stroke-solid: #a06e28;
  --brand-premium: #d97706;

  /* App Theme Mappings */
  --bg: #f5ecd4; /* Soft Sand - Updated */
  --panel: #ffffff;
  --text: #3D405B; /* Deep Charcoal/Navy */
  --muted: #818181;
  
  --accent: var(--brand-quest); /* Primary Action - Quest Orange */
  --accent-hover: #c0520d;
  --accent-2: var(--brand-bg-icon); /* Secondary/Highlight - Icon BG Cream */
  --accent-success: var(--brand-choose); /* Success - Choose Green */
  --accent-3: #ef4444; /* Error Red */
  
  --card-shadow: 0 8px 24px rgba(61, 64, 91, 0.08);
  --hero: var(--brand-quest);
  --hero-2: var(--brand-quest);

  /* Safe area insets - must be defined before use */
  --sat: env(safe-area-inset-top);
  --sab: env(safe-area-inset-bottom);

  /* Tabbar sizing */
  --tabbar-h: 60px;
  --tabbar-total: calc(var(--tabbar-h) + var(--sab));

  /* Font stack — use these everywhere, never hardcode font-family */
  --font-body: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  --font-display: Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; }
html, body, #app { height: 100%; min-height: 100vh; min-height: 100dvh; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: calc(100% + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}

/* Access state pill badges */
.access-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: bold;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.access-pill-free {
  background: var(--brand-choose);
  color: white;
}
.access-pill-premium {
  background: var(--brand-premium);
  color: white;
}
.access-pill-unlocked {
  background: white;
  color: var(--brand-premium);
  border: 2px solid var(--brand-premium);
  box-shadow: none;
}

.page { max-width: 420px; margin: 0 auto; padding: 20px; }
.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.topbar .nav { display: flex; gap: 8px; }
.nav-btn { cursor: pointer; border: none; background: #ffffff; color: var(--text); padding: 8px 12px; border-radius: 12px; box-shadow: var(--card-shadow); }
.nav-btn.primary { background: var(--accent); color: #ffffff; border: none; box-shadow: var(--card-shadow); }
.locale { display: flex; gap: 8px; }
.locale button { cursor: pointer; border: none; background: #ffffff; color: var(--text); padding: 6px 10px; border-radius: 12px; box-shadow: var(--card-shadow); }
.locale button.active { background: var(--accent); color: #ffffff; border: none; }

.panel { background: var(--panel); border: none; border-radius: 20px; padding: 22px; box-shadow: var(--card-shadow); }
.panel-titlebar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.panel-actions { display: flex; align-items: center; gap: 8px; }
.search-input { border: 1px solid transparent; background: #ffffff; color: var(--text); padding: 8px 10px; border-radius: 12px; box-shadow: var(--card-shadow); min-width: 140px; width: 100%; }
.journal-search { margin-bottom: 10px; }
.icon-btn { appearance: none; border: none; background: #ffffff; color: var(--text); width: 36px; height: 36px; border-radius: 999px; box-shadow: var(--card-shadow); font-size: 22px; line-height: 1; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-btn:active { transform: scale(0.98); }
.add-entry-btn { background: #ffffff; }
.title { font-size: 22px; margin-bottom: 8px; color: var(--text); font-weight: 700; }
.treasure-info-title { font-size: 18px; }
.content { font-size: 16px; line-height: 1.6; color: var(--muted); margin-bottom: 20px; }
.title-large { font-size: 24px; font-weight: 800; color: var(--text); margin: 4px 0 6px; }

.illustration { width: 100%; aspect-ratio: 9 / 16; background: linear-gradient(180deg, #F9C74F 0%, #F4F1DE 100%); border-radius: 22px; margin-bottom: 16px; display: flex; align-items: center; justify-content: center; color: #22415f; box-shadow: var(--card-shadow); overflow: hidden; }
.illustration img { width: 100%; height: 100%; object-fit: cover; display: block; }
.story-card { position: relative; margin-top: -40px; }

.options { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
.option-card { width: 100%; border: none; background: #ffffff; color: var(--text); padding: 10px; border-radius: 16px; cursor: pointer; font-size: 16px; box-shadow: var(--card-shadow); display: flex; align-items: center; gap: 10px; }
.series-card { align-items: flex-start; }
.series-num { font-size: 16px; font-weight: 800; color: var(--muted); width: 32px; flex-shrink: 0; padding-top: 0; text-align: center; margin-top: 2px; }
.option-card.completed .series-num { color: var(--accent-success); }
.series-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2px; }
.quest-desc-line { font-size: 13px; color: var(--muted); margin-bottom: 6px; line-height: 1.4; }
.quest-tags { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.standalone-cta { margin-top: 24px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.standalone-desc { font-size: 15px; line-height: 1.5; color: var(--muted); text-align: center; max-width: 90%; }
.big-play-btn { width: 100%; padding: 16px; font-size: 18px; border-radius: 18px; box-shadow: 0 10px 25px rgba(243, 114, 44, 0.3); }
.option-card.selected { outline: 2px solid var(--accent); box-shadow: 0 0 0 4px rgba(243, 114, 44, 0.2); }
.option-card .option-badge { width: 24px; height: 24px; border-radius: 999px; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; }
.option-card .badge-blue { background: #dbeafe; color: #1e3a8a; }
.option-card .badge-yellow { background: #fef3c7; color: #92400e; }
.option-card .badge-green { background: #d1fae5; color: #065f46; }
.option-card .label { flex: 1; }
.option-card .enter-icon { margin-left: auto; color: var(--muted); font-weight: 700; }
.status-badge { display: inline-block; padding: 4px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; margin-left: 8px; }
.status-badge.completed { background: #d1fae5; color: #065f46; }
.option-card.completed { outline: 2px solid var(--accent-success); box-shadow: 0 0 0 4px rgba(141, 182, 0, 0.2); }
.quest-number { display: block; font-size: 12px; color: var(--muted); }
.quest-title { display: block; font-size: 16px; font-weight: 700; }

.controls { display: flex; gap: 10px; margin-top: 16px; }
.primary { background: var(--accent); color: #ffffff; border: none; padding: 12px 16px; border-radius: 10px; font-weight: 600; cursor: pointer; }
.secondary { background: #ffffff; color: var(--text); border: 1px solid transparent; padding: 12px 16px; border-radius: 12px; cursor: pointer; box-shadow: var(--card-shadow); }
.secondary.active { background: var(--accent); color: #ffffff; border: none; }

.textarea { width: 100%; min-height: 120px; margin-top: 12px; border-radius: 16px; padding: 12px; background: #ffffff; color: var(--text); border: none; box-shadow: var(--card-shadow); font-size: 16px; }

.progress { margin-top: 14px; color: var(--muted); font-size: 14px; }
.progress-bar { height: 4px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent-success); width: 0; transition: width 240ms ease; }
.top-progress { margin: 12px 12px 14px; }
.summary-progress { margin: 6px 0 12px; }
.summary-progress .progress-bar { height: 4px; }
.summary-progress .progress-fill { background: var(--accent-success); opacity: 0.5; }
.layout-toggle { display: flex; gap: 8px; }
.layout-toggle button { cursor: pointer; border: none; background: #ffffff; color: var(--text); padding: 6px 10px; border-radius: 12px; box-shadow: var(--card-shadow); }
.layout-toggle button.active { background: var(--accent); color: #ffffff; border: none; }
.nav-icons { display: flex; gap: 8px; }
.nav-icons button { cursor: pointer; border: none; background: #ffffff; color: var(--text); padding: 6px 10px; border-radius: 12px; box-shadow: var(--card-shadow); }
.bg-wrap { position: relative; height: 100vh; border-radius: 0; overflow: hidden; background-color: var(--bg); }
.bg-wrap .bg-img { display: none; } /* Removed bg image */
.bg-wrap .overlay-gradient { display: none; } /* Removed gradient */
.bg-wrap .overlay-content { position: absolute; left: 0; right: 0; bottom: 12px; padding: 12px; display: flex; flex-direction: column; justify-content: flex-start; z-index: 2; }
.bg-wrap .overlay-content .overlay-card + .overlay-card { margin-top: 16px; }
.bg-wrap.home-mode .overlay-content { top: 0; bottom: var(--tabbar-h); overflow-y: auto; -webkit-overflow-scrolling: touch; padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
.bg-wrap.home-mode { overflow: hidden; }
.overlay-card { background: #ffffff; border: none; border-radius: 20px; padding: 20px; box-shadow: var(--card-shadow); display: flex; flex-direction: column; flex-grow: 1; margin: 12px; }
.overlay-card .card-image { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 12px; box-shadow: var(--card-shadow); margin-bottom: 14px; display: block; }
.overlay-card .card-body { flex: 1; padding: 4px; }

.bg-topbar { position: absolute; top: 24px; left: 16px; right: 16px; z-index: 10; display: none; justify-content: space-between; align-items: flex-start; pointer-events: none; }
.app-logo-centered { position: absolute; left: 0; right: 0; display: flex; justify-content: center; margin-top: 10px; pointer-events: none; }
.bg-topbar .nav-icons { margin-left: auto; z-index: 11; }
.bg-topbar > * { pointer-events: auto; }


.bg-topbar .nav { display: flex; gap: 8px; }
.bg-topbar .locale { display: flex; gap: 8px; }
.bg-title { position: absolute; top: 120px; left: 0; right: 0; z-index: 3; text-align: center; font-size: 26px; font-weight: 800; color: #ef4444 !important; text-shadow: none; }
.bg-progress { position: absolute; left: 12px; right: 12px; top: 90px; z-index: 2; }
.bg-progress .progress-bar { background: rgba(0,0,0,0.1); }
.bg-progress .progress-fill { background: var(--accent); opacity: 1; }

/* Scene Header - Story Pages */
.scene-header { padding: 40px 20px 20px 20px; display: flex; align-items: center; gap: 12px; }
.scene-header-title-block { flex: 1; min-width: 0; }
.scene-header-icons { display: flex; gap: 8px; flex-shrink: 0; }
.scene-header-icon-btn { width: 32px; height: 32px; border-radius: 50%; background: white; border: none; box-shadow: 0 2px 8px rgba(0,0,0,0.1); display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 16px; }
.scene-header-icon-btn.active { color: var(--brand-quest); }
.scene-header-icon-btn.favorite { color: red; }
.scene-header-icon-btn.inactive { color: #ccc; }
.scene-header-icon-btn:not(.active):not(.favorite) { color: #64748b; }
.scene-header-title { font-size: 13px; font-weight: bold; color: var(--text); line-height: 1.2; }
.scene-header-page { font-size: 12px; color: var(--brand-quest); font-weight: bold; margin-top: 4px; letter-spacing: 1px; }

.tip-box { background: #eef2ff; border: 1px solid #c7d2fe; color: #1f2937; border-radius: 12px; padding: 10px 12px; box-shadow: var(--card-shadow); margin-top: 10px; }
.tip-actions { display: flex; justify-content: flex-end; margin-top: 8px; }
.tip-actions .secondary { padding: 8px 12px; }
.bg-wrap.outcome-mode .tip-box { font-style: italic; margin-top: 18px; background: #f8fafc; border-color: #e2e8f0; color: var(--muted); box-shadow: none; padding: 8px 10px; font-size: 14px; }
.panel.outcome .tip-box { font-style: italic; margin-top: 18px; background: #f8fafc; border-color: #e2e8f0; color: var(--muted); box-shadow: none; padding: 8px 10px; font-size: 14px; }
.bg-wrap.decision-mode .tip-box { font-style: italic; margin-top: 18px; background: #f8fafc; border-color: #e2e8f0; color: var(--muted); box-shadow: none; padding: 8px 10px; font-size: 14px; }
.panel.decision .tip-box { font-style: italic; margin-top: 18px; background: #f8fafc; border-color: #e2e8f0; color: var(--muted); box-shadow: none; padding: 8px 10px; font-size: 14px; }
.home-hero { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.home-hero .adventure-cover { border-radius: 16px; }
.journal-list { display: flex; flex-direction: column; gap: 10px; }
.journal-card { background: #ffffff; border: none; border-radius: 12px; padding: 10px; box-shadow: var(--card-shadow); }
.journal-card { text-align: left; cursor: pointer; }
.journal-card:focus { outline: 2px solid var(--accent); box-shadow: 0 0 0 4px rgba(243, 114, 44, 0.2); }
.journal-card:hover { transform: translateY(-1px); }
.journal-source { font-size: 15px; font-weight: 800; color: var(--text); }
.journal-title { font-size: 14px; font-weight: 700; color: var(--text); margin: 4px 0 6px; }
.journal-text { font-size: 15px; line-height: 1.6; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.journal-date { font-size: 12px; color: var(--muted); margin-top: 8px; }
.adventures { display: flex; gap: 12px; overflow-x: auto; padding: 12px 0; }
.adventure-card { min-width: 240px; background: #ffffff; border: none; border-radius: 14px; padding: 10px; box-shadow: var(--card-shadow); cursor: pointer; }
.adventure-cover-wrap { position: relative; }
.adventure-cover-wrap::after { content: ""; position: absolute; inset: 0; border-radius: 10px; background: linear-gradient(180deg, rgba(10,27,46,0.0) 0%, rgba(10,27,46,0.35) 70%, rgba(10,27,46,0.6) 100%); }
.adventure-cover { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; margin-bottom: 8px; display: block; }
.adventure-card-title { position: absolute; left: 12px; bottom: 16px; color: #ffffff; font-weight: 800; text-shadow: 0 2px 6px rgba(0,0,0,0.35); }
.adventure-title { font-weight: 700; margin-bottom: 4px; }
.adventure-progress { margin-top: 8px; }
.home-title { letter-spacing: 0.2px; }
.home-band { background: none; color: var(--text); font-size: 26px; font-weight: 800; padding: 0 12px; margin: 14px 12px 8px; }
.bg-wrap.home-mode .home-band { color: var(--text); text-shadow: none; padding: 0 12px; }
.home-body { display: flex; flex-direction: column; gap: 16px; padding: 12px 12px 8px; }
.home-adventures { margin-top: 18px; }
.hero-card { position: relative; background: #ffffff; color: var(--text); border-radius: 22px; padding: 14px; box-shadow: var(--card-shadow); margin: 0 12px; }
.hero-card::before { display: none; }
.hero-illustration { width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; background: linear-gradient(180deg, #F3722C 0%, #D95D1E 100%); margin-bottom: 10px; object-fit: cover; display: block; }
.hero-title { font-size: 26px; font-weight: 800; margin: 6px 0 12px; padding: 0 4px; }
.hero-card .content { color: var(--muted); font-size: 14px; line-height: 1.4; margin: 0 4px 12px; }
/* Hero Card No-Image Fallback */
.hero-card.no-image {
  border: 2px dashed var(--accent-2); /* Saffron dashed border */
  background: #fffdf5;
  text-align: center;
  padding: 24px 14px;
}
.hero-card.no-image .hero-title {
  font-size: 32px;
  margin: 12px 0;
  color: var(--accent);
}
.hero-placeholder-icon {
  font-size: 48px;
  margin-bottom: 12px;
  animation: float 3s ease-in-out infinite;
}
@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-6px); }
  100% { transform: translateY(0px); }
}

/* Contextual Cards */
.contextual-card { background: var(--panel); border-radius: 20px; padding: 16px; box-shadow: var(--card-shadow); margin: 0; max-width: 600px; }
.contextual-card-title { font-family: var(--font-body); font-weight: 800; font-size: 18px; color: var(--text); margin-bottom: 8px; line-height: 1.3; }
.contextual-card-subtitle { font-family: var(--font-body); font-size: 14px; color: var(--muted); line-height: 1.4; margin-bottom: 16px; }
.contextual-card-icon { font-size: 48px; margin-right: 12px; }
.contextual-card-content { display: flex; align-items: flex-start; }
.contextual-card-content-centered { display: flex; flex-direction: column; align-items: center; text-align: center; }
.contextual-card-content-centered .contextual-card-icon { margin-right: 0; margin-bottom: 8px; }
.contextual-card-text { flex: 1; }
.gift-card-border { border: 2px solid rgba(224, 96, 16, 0.85); }
.proof-pills-container { display: flex; gap: 8px; margin-top: 12px; }
.proof-pill { flex: 1; background: var(--bg); border: 1px solid var(--brand-stroke); border-radius: 12px; padding: 8px 6px; text-align: center; font-size: 12px; }
.proof-pill-top { font-weight: 800; color: var(--text); display: block; }
.proof-pill-bottom { color: var(--muted); display: block; margin-top: 2px; }
.scroll-nudge { display: block; text-align: center; color: var(--brand-quest); font-size: 13px; margin-top: 12px; cursor: pointer; text-decoration: none; font-weight: 600; }
.scroll-nudge:hover { text-decoration: underline; }
.card-eyebrow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--brand-quest); margin-bottom: 4px; }
.lapsed-card-layout { display: flex; gap: 12px; align-items: center; }
.lapsed-card-thumbnail { width: 80px; height: 80px; border-radius: 12px; object-fit: cover; flex-shrink: 0; }
.lapsed-card-thumbnail-fallback { width: 80px; height: 80px; border-radius: 12px; background: var(--brand-bg-icon); display: flex; align-items: center; justify-content: center; font-size: 40px; flex-shrink: 0; }
.lapsed-card-content { flex: 1; min-width: 0; }
.lapsed-card-meta { font-size: 11px; color: var(--muted); margin-bottom: 12px; }

.pill-button { background: var(--accent); color: #ffffff; border: none; padding: 12px 20px; border-radius: 999px; font-weight: 700; box-shadow: var(--card-shadow); font-size: 16px; }
.section-title { font-size: 22px; font-weight: 800; color: var(--text); margin: 14px 12px 8px; font-family: var(--font-body); }
.quests-carousel { display: flex; gap: 12px; overflow-x: auto; padding: 8px 12px; }
.quest-card { min-width: 240px; background: #ffffff; color: var(--text); border-radius: 18px; padding: 12px; box-shadow: var(--card-shadow); border: none; display: flex; align-items: center; gap: 10px; }
.quest-icon { width: 44px; height: 44px; border-radius: 10px; background: #fff8e7; display: flex; align-items: center; justify-content: center; font-size: 22px; }
.quest-title { font-weight: 800; margin-bottom: 4px; }
.quest-desc { color: var(--muted); font-size: 14px; }
.journal-band { background: #fff8e7; border-radius: 18px; padding: 12px; box-shadow: var(--card-shadow); border: none; margin: 0 12px; }
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; display: flex; justify-content: space-around; align-items: flex-start; background: #ffffff; border: none; border-radius: 0; height: 60px; padding-top: 6px; padding-bottom: env(safe-area-inset-bottom, 0px); box-shadow: 0 -8px 24px rgba(61, 64, 91, 0.05); z-index: 20; }
.tabbar button { appearance: none; border: none; background: transparent; width: 64px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--muted); }
.tabbar button.active { outline: none; box-shadow: none; }
.tabbar button.active { color: var(--accent); } 
/* Active icon color overrides */
.tabbar button.active .icon-home::before { background: var(--accent); opacity: 1; }
.tabbar button.active .icon-home::after { border-bottom-color: var(--accent); opacity: 1; }
.tabbar button.active .icon-journal { border-color: var(--accent); }
.tabbar button.active .icon-journal::before { background: var(--accent); }
.tabbar button.active .icon-journal::after { background: var(--accent); }
.tabbar button.active .icon-profile::before { background: var(--accent); }
.tabbar button.active .icon-profile::after { background: var(--accent); }
.tabbar .tab-svg { width: 28px; height: 28px; display: block; }
.tab-icon { display: inline-block; width: 28px; height: 28px; position: relative; }
/* Home icon */
.icon-home::before { content: ""; position: absolute; left: 3px; right: 3px; bottom: 3px; height: 12px; background: var(--muted); border-radius: 4px; }
.icon-home::after { content: ""; position: absolute; left: 50%; top: 2px; width: 0; height: 0; border-left: 10px solid transparent; border-right: 10px solid transparent; border-bottom: 10px solid var(--muted); transform: translateX(-50%); }
/* Journal icon */
.icon-journal { border: 2px solid var(--muted); border-radius: 6px; }
.icon-journal::before { content: ""; position: absolute; left: 6px; right: 6px; top: 6px; height: 2px; background: var(--muted); }
.icon-journal::after { content: ""; position: absolute; left: 6px; right: 6px; top: 12px; height: 2px; background: var(--muted); }
/* Profile icon */
.icon-profile::before { content: ""; position: absolute; left: 6px; top: 2px; width: 12px; height: 12px; background: var(--muted); border-radius: 999px; }
.icon-profile::after { content: ""; position: absolute; left: 3px; bottom: 2px; width: 18px; height: 10px; background: var(--muted); border-radius: 999px; }
/* Treasure chest icon uses inline SVG (tab-svg) */
.status-bar { position: fixed; top: 8px; left: 12px; right: 12px; background: #fff8e7; color: var(--text); border: 1px solid var(--accent-2); border-radius: 12px; padding: 8px 12px; box-shadow: var(--card-shadow); z-index: 3; font-size: 14px; }
.home-quests { margin-top: 18px; }
.quote-card { background: #fff8e7; color: var(--text); border-radius: 16px; padding: 12px; margin: 8px 12px; box-shadow: var(--card-shadow); font-weight: 600; border: none; }
.quote-container { text-align: center; padding: 8px 16px; margin: 0 auto; max-width: 600px; }
.quote-divider { width: 50%; height: 1px; background: var(--brand-stroke); margin: 0 auto; }
.quote-divider.top { margin-bottom: 8px; }
.quote-divider.bottom { margin-top: 8px; }
.quote-text { font-style: italic; font-size: 18px; color: var(--text); line-height: 1.4; font-family: var(--font-display); }
/* .bg-wrap.overview-mode - removed as unused */
.adv-hero { background: rgba(255,255,255,0.94); border-radius: 16px; padding: 12px; box-shadow: var(--card-shadow); margin: 0 12px; border: none; }
.adv-cover { width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; object-fit: cover; display: block; margin-bottom: 8px; }
.adv-title { padding: 0 4px; }
.adv-desc { padding: 0 4px; }
.adv-progress { margin: 8px 4px; }
.adv-quests { display: flex; flex-direction: column; gap: 10px; padding: 12px; }
.adv-quest-card { background: rgba(255,255,255,0.94); border-radius: 16px; padding: 12px; box-shadow: var(--card-shadow); display: flex; justify-content: space-between; align-items: center; border: none; }
.adv-quest-card .quest-actions .primary { padding: 10px 14px; }
/* Safe area variables moved to main :root block above */
.page { max-width: 430px; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
.bg-wrap { height: 100svh; }
.bg-topbar { top: calc(24px + env(safe-area-inset-top, 0px)); }
.bg-title { top: calc(120px + env(safe-area-inset-top, 0px)) !important; line-height: 1.2; padding: 0 20px; font-size: 24px !important; color: #ef4444 !important; font-weight: 900 !important; }
.bg-progress { top: calc(90px + env(safe-area-inset-top, 0px)); }
.bg-wrap .overlay-content { bottom: 12px; display: flex; flex-direction: column; }
.bg-wrap.story-mode .overlay-content { top: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); padding-top: calc(180px + env(safe-area-inset-top, 0px)); }
.bg-wrap.decision-mode .overlay-content { top: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); padding-top: calc(180px + env(safe-area-inset-top, 0px)); }
.bg-wrap.outcome-mode .overlay-content { top: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); padding-top: calc(180px + env(safe-area-inset-top, 0px)); }
.bg-wrap.reflection-mode .overlay-content { top: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); padding-top: calc(180px + env(safe-area-inset-top, 0px)); }
.bg-wrap.takeaway-mode .overlay-content { top: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); padding-top: calc(180px + env(safe-area-inset-top, 0px)); }
.bg-wrap.reward-mode .overlay-content { top: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); padding-top: calc(180px + env(safe-area-inset-top, 0px)); }

@media (max-height: 700px) {
  .bg-wrap .overlay-content { padding: 10px; }
}
/* Profile */
.profile-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.avatar-emoji { width: 56px; height: 56px; display: flex; align-items: center; justify-content: center; font-size: 36px; border-radius: 12px; background: #eef2ff; }
.profile-row { display: flex; gap: 10px; align-items: center; margin: 10px 0; }
.profile-row { flex-wrap: wrap; }
.profile-row input[type="text"] { flex: 1; border: none; border-radius: 12px; padding: 10px; box-shadow: var(--card-shadow); }
.rewards { font-weight: 600; color: var(--text); }
.section-head { display: flex; justify-content: space-between; align-items: center; margin: 12px 0 6px; padding: 0 4px; }
.chevron-btn { appearance: none; border: none; background: #ffffff; color: var(--text); padding: 6px 10px; border-radius: 12px; box-shadow: var(--card-shadow); cursor: pointer; }
.badge-strip { display: flex; gap: 12px; overflow-x: auto; padding: 8px 4px 12px; }
.badge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 8px 4px 12px; }
.badge-wrap { appearance: none; border: none; background: transparent; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; }
.badge-square { width: 72px; height: 72px; border-radius: 18px; background: #ffffff; border: none; box-shadow: var(--card-shadow); position: relative; display: flex; align-items: center; justify-content: center; }
.badge-square.large { width: 120px; height: 120px; border-radius: 22px; margin: 8px 0; }
.badge-square.completed { outline: 1px solid var(--accent-success); box-shadow: 0 0 0 2px rgba(141, 182, 0, 0.2); }
.badge-icon { font-size: 32px; }
.badge-pill { position: absolute; top: 6px; left: 6px; background: var(--accent); color: #ffffff; border-radius: 999px; padding: 2px 6px; font-size: 10px; font-weight: 800; box-shadow: var(--card-shadow); }
.badge-count { position: absolute; bottom: 6px; right: 6px; background: #ffffff; color: var(--text); border-radius: 6px; padding: 2px 6px; font-size: 10px; border: 1px solid transparent; }
.badge-label { font-size: 12px; color: var(--text); text-align: center; max-width: 90px; }
.records-carousel { display: flex; gap: 10px; overflow-x: auto; padding: 8px 4px 12px; }
.record-card { min-width: 140px; border-radius: 18px; background: #ffffff; border: none; box-shadow: var(--card-shadow); padding: 10px; display: flex; align-items: center; gap: 10px; }
.treasure-strip { display: flex; gap: 12px; overflow-x: auto; padding: 8px 4px 12px; }
.treasure-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 8px 4px 12px; }
.treasure-card { background: #ffffff; border: none; border-radius: 14px; padding: 8px; box-shadow: var(--card-shadow); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.treasure-image { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 10px; display: block; }
.treasure-fallback { width: 100%; aspect-ratio: 1 / 1; border-radius: 10px; background: #eef2ff; display: flex; align-items: center; justify-content: center; font-size: 28px; }
.treasure-label { font-size: 12px; font-weight: 700; text-align: center; color: var(--text); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.treasure-info-image { width: 100%; max-width: 420px; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 14px; margin: 12px auto; display: block; }
.input-text { border: none; background: #ffffff; color: var(--text); padding: 10px 12px; border-radius: 12px; box-shadow: var(--card-shadow); width: 100%; margin-bottom: 8px; font-size: 16px; }

/* Theme specific utilities */
.btn-install {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 1000;
    display: none;
    padding: 12px 24px;
    border-radius: 24px;
    background: var(--accent);
    color: white;
    border: none;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(243, 114, 44, 0.2);
}

.toast-notification {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent-2); /* Saffron Yellow - Warning/Notice style */
    color: #3D405B;
    padding: 12px 24px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: none;
    z-index: 2000;
    align-items: center;
    gap: 12px;
}

.toast-btn {
    background: #ffffff;
    color: var(--accent);
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Payment Failed Banner */
.payment-failed-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2500;
    background: var(--accent-3);
    color: #fff;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 13px;
    font-weight: 600;
    flex-wrap: wrap;
    text-align: center;
}

.payment-failed-banner__cta {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.payment-failed-banner__cta:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* Google Login Button */
.google-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    margin-bottom: 4px;
    background: #fff;
    border: 1px solid #dadce0;
    border-radius: 8px;
    font-size: 15px;
    font-family: var(--font-body);
    color: #3c4043;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.15s;
}
.google-login-btn:hover {
    background: #f8f8f8;
}

.login-divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: #999;
    font-size: 13px;
    margin: 12px 0;
}
.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e0e0e0;
}
.login-divider span {
    padding: 0 10px;
}

/* Subscription Status Box (ProfilePage) */
.sub-status-box {
    background: var(--brand-bg-icon);
    border: 1px solid var(--brand-stroke-solid);
    border-radius: 12px;
    padding: 14px 16px;
    margin-top: 8px;
}

.sub-status-box--active {
    border-color: var(--brand-choose);
    background: #f0faf0;
}

.sub-status-box--warning {
    border-color: var(--accent-3);
    background: #fff0f0;
}

.sub-status-box__label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

/* Your Unlocks Section (ProfilePage) */
.unlocks-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.unlocks-section__heading {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
}

.unlock-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--brand-bg-icon);
    border: 1px solid var(--brand-stroke-solid);
    margin-bottom: 8px;
    gap: 8px;
}

.unlock-item__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.unlock-item__badge {
    font-size: 12px;
    font-weight: 600;
    color: var(--brand-choose);
    background: #f0faf0;
    border: 1px solid var(--brand-choose);
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
}

