/* ============================================================
   PAPAS BOXENSTOPP — iOS 18 Bright Design System
   ============================================================ */
:root {
  --bg: #F2F2F7;
  --bg-white: #FFFFFF;
  --surface: #FFFFFF;
  --surface2: #F2F2F7;
  --surface3: #E5E5EA;
  --glass: rgba(255,255,255,0.72);
  --glass-border: rgba(0,0,0,0.06);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.10), 0 4px 12px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.12);
  --yellow: #FF9500;
  --yellow-dim: rgba(255,149,0,0.12);
  --green: #34C759;
  --green-dim: rgba(52,199,89,0.12);
  --red: #FF3B30;
  --red-dim: rgba(255,59,48,0.10);
  --blue: #007AFF;
  --blue-dim: rgba(0,122,255,0.10);
  --purple: #AF52DE;
  --purple-dim: rgba(175,82,222,0.10);
  --orange: #FF9500;
  --teal: #5AC8FA;
  --indigo: #5856D6;
  --pink: #FF2D55;
  --text: #1C1C1E;
  --text2: #3C3C43;
  --text3: #8E8E93;
  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 10px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body {
  height: 100%; overflow: hidden;
  font-family: -apple-system, 'SF Pro Display', 'SF Pro Text', 'Inter', BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* Ambient BG — soft pastel mesh */
#ambient { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.orb { position: absolute; border-radius: 50%; filter: blur(100px); opacity: 0.35; animation: orbFloat 25s ease-in-out infinite alternate; }
.orb-1 { width: 400px; height: 400px; background: #FFD6A5; top: -150px; right: -100px; }
.orb-2 { width: 350px; height: 350px; background: #C3AED6; bottom: 10%; left: -80px; animation-delay: -8s; }
.orb-3 { width: 280px; height: 280px; background: #A8DADC; top: 35%; right: -60px; animation-delay: -16s; }
@keyframes orbFloat {
  0% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -40px) scale(1.08); }
  66% { transform: translate(-20px, 20px) scale(0.94); }
  100% { transform: translate(10px, -10px) scale(1.04); }
}

/* Splash */
#splash {
  position: fixed; inset: 0; background: #FFFFFF;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 2000; gap: 16px; transition: opacity 0.6s ease, transform 0.6s ease;
}
#splash.hide { opacity: 0; transform: scale(1.03); pointer-events: none; }
.splash-logo {
  width: 100px; height: 100px; border-radius: 24px;
  background: linear-gradient(135deg, #FF9500, #FF2D55);
  display: flex; align-items: center; justify-content: center;
  font-size: 52px; animation: splashPop 0.8s cubic-bezier(0.34,1.56,0.64,1) 0.2s both;
  box-shadow: 0 16px 48px rgba(255,149,0,0.3);
}
#splash h1 {
  font-size: 28px; font-weight: 800; letter-spacing: -0.5px;
  background: linear-gradient(135deg, #FF9500, #FF2D55);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  animation: splashPop 0.6s cubic-bezier(0.34,1.56,0.64,1) 0.5s both;
}
#splash p { color: var(--text3); font-size: 15px; font-weight: 500; animation: splashPop 0.5s ease 0.7s both; }
.splash-bar { width: 180px; height: 4px; background: var(--surface3); border-radius: 2px; overflow: hidden; margin-top: 8px; animation: splashPop 0.4s ease 0.9s both; }
.splash-bar-fill { height: 100%; background: linear-gradient(90deg, #FF9500, #FF2D55); border-radius: 2px; animation: loadBar 1.6s ease-out 1s forwards; width: 0; }
@keyframes splashPop { from { opacity: 0; transform: translateY(20px) scale(0.9); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes loadBar { to { width: 100% } }

/* App Shell */
#app { height: 100%; display: flex; flex-direction: column; position: relative; z-index: 1; opacity: 0; transition: opacity 0.4s; }
#app.show { opacity: 1; }

/* Header */
#header {
  backdrop-filter: blur(40px) saturate(180%); -webkit-backdrop-filter: blur(40px) saturate(180%);
  background: rgba(255,255,255,0.82); padding: 12px 20px 10px; flex-shrink: 0;
  border-bottom: 0.5px solid rgba(0,0,0,0.08); position: relative; z-index: 10;
}
.h-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.h-greeting { font-size: 15px; font-weight: 700; color: var(--text); }
.h-sub { font-size: 11px; color: var(--text3); font-weight: 500; margin-top: 1px; }
.h-chips { display: flex; gap: 6px; align-items: center; }
.chip {
  display: flex; align-items: center; gap: 4px;
  padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 700;
  border: none;
}
.chip-streak { background: var(--red-dim); color: var(--red); }
.chip-level { background: linear-gradient(135deg, #FF9500, #FF2D55); color: #fff; }
.xp-wrap { display: flex; align-items: center; gap: 10px; }
.xp-bar { flex: 1; height: 6px; background: var(--surface3); border-radius: 3px; overflow: hidden; }
.xp-fill {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, #FF9500, #FF2D55);
  transition: width 0.8s cubic-bezier(0.4,0,0.2,1); position: relative;
}
.xp-fill::after {
  content: ''; position: absolute; top: 0; right: 0; bottom: 0; width: 24px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5)); border-radius: 3px;
}
.xp-text { font-size: 10px; color: var(--text3); font-weight: 600; white-space: nowrap; min-width: 70px; text-align: right; }

/* Content */
#content { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; scroll-behavior: smooth; }
#content::-webkit-scrollbar { display: none; }
.page { display: none; padding: 16px 16px calc(16px + var(--safe-bottom)); }
.page.active { display: block; animation: pageIn 0.4s cubic-bezier(0.25,0.46,0.45,0.94); }
@keyframes pageIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Bottom Nav — iOS Tab Bar */
#nav {
  display: flex; backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  background: rgba(255,255,255,0.82); flex-shrink: 0;
  border-top: 0.5px solid rgba(0,0,0,0.1);
  padding: 4px 0 calc(4px + var(--safe-bottom)); position: relative;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 4px 0; gap: 1px; background: none; border: none; cursor: pointer;
  color: var(--text3); transition: all 0.2s; font-size: 10px; font-weight: 500; position: relative;
  font-family: inherit;
}
.nav-item .ni { font-size: 22px; transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1); display: flex; align-items: center; justify-content: center; height: 24px; }
.nav-item .ni svg { width: 22px; height: 22px; }
.nav-item.active { color: var(--blue); }
.nav-item.active .ni { transform: scale(1.1); }
.nav-item.active::before { display: none; }

/* Glass Card — iOS Material */
.glass {
  background: var(--surface);
  border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
  transition: transform 0.2s; position: relative; overflow: hidden;
  box-shadow: var(--shadow-sm); border: none;
}
.glass:active { transform: scale(0.985); }

/* Typography — SF Pro style */
.label { font-size: 13px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: -0.1px; }
.title-lg { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.2; color: var(--text); }
.title-md { font-size: 20px; font-weight: 700; letter-spacing: -0.3px; color: var(--text); }
.title-sm { font-size: 17px; font-weight: 600; color: var(--text); }
.body { font-size: 15px; color: var(--text2); line-height: 1.5; }
.caption { font-size: 13px; color: var(--text3); }
.gradient-text {
  background: linear-gradient(135deg, #FF9500, #FF2D55);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

/* Buttons — iOS style */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-weight: 600; font-size: 17px;
  border: none; border-radius: var(--radius-sm); padding: 16px 24px;
  cursor: pointer; width: 100%; transition: all 0.15s; position: relative; overflow: hidden;
}
.btn:active { transform: scale(0.97); opacity: 0.85; }
.btn::after { display: none; }
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 4px 16px rgba(0,122,255,0.25); }
.btn-secondary { background: var(--surface3); color: var(--text); }
.btn-purple { background: var(--purple); color: #fff; box-shadow: 0 4px 16px rgba(175,82,222,0.25); }
.btn-green { background: var(--green); color: #fff; box-shadow: 0 4px 16px rgba(52,199,89,0.25); }
.btn-blue { background: var(--blue); color: #fff; box-shadow: 0 4px 16px rgba(0,122,255,0.2); }
.btn-sm { padding: 10px 16px; font-size: 15px; border-radius: var(--radius-xs); }
.btn-xs { padding: 8px 14px; font-size: 13px; border-radius: 8px; width: auto; font-weight: 600; }

/* Home */
.hero {
  background: linear-gradient(135deg, #FF9500, #FF2D55);
  border-radius: 20px; padding: 24px; margin-bottom: 14px;
  position: relative; overflow: hidden; box-shadow: 0 8px 30px rgba(255,149,0,0.25);
}
.hero::after { content: '🏎️'; position: absolute; right: 8px; bottom: -8px; font-size: 72px; opacity: 0.2; transform: scaleX(-1); filter: blur(1px); }
.hero h2 { font-size: 22px; font-weight: 700; margin-bottom: 4px; position: relative; z-index: 1; color: #fff; }
.hero p { font-size: 14px; color: rgba(255,255,255,0.85); position: relative; z-index: 1; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.stat-item { background: var(--surface); border-radius: var(--radius-sm); padding: 14px 6px; text-align: center; box-shadow: var(--shadow-sm); }
.stat-num { font-size: 24px; font-weight: 800; line-height: 1; }
.stat-num.yellow { color: var(--orange); }
.stat-num.green { color: var(--green); }
.stat-num.blue { color: var(--blue); }
.stat-num.purple { color: var(--purple); }
.stat-lbl { font-size: 11px; color: var(--text3); font-weight: 500; margin-top: 4px; }
.challenge-card {
  background: var(--surface); box-shadow: var(--shadow-md);
  border-radius: var(--radius); padding: 18px; margin-bottom: 14px;
  border-left: 4px solid var(--purple);
}
.ch-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.ch-badge { background: var(--purple); color: #fff; font-size: 12px; font-weight: 700; padding: 4px 12px; border-radius: 20px; }
.fact-card {
  border-left: 3px solid var(--orange);
  background: var(--surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 14px 16px; margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-item {
  background: var(--surface);
  border-radius: var(--radius); padding: 20px 14px; cursor: pointer; text-align: center;
  transition: all 0.2s; box-shadow: var(--shadow-sm);
}
.quick-item:active { transform: scale(0.96); box-shadow: var(--shadow-md); }
.quick-item .qi { font-size: 36px; margin-bottom: 8px; display: block; }
.quick-item .qt { font-size: 15px; font-weight: 600; display: block; color: var(--text); }
.quick-item .qd { font-size: 12px; color: var(--text3); display: block; margin-top: 3px; }

/* Trivia */
.cat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.cat-card { border-radius: var(--radius); padding: 22px; text-align: center; cursor: pointer; transition: all 0.2s; box-shadow: var(--shadow-sm); }
.cat-card:active { transform: scale(0.96); }
.cat-card .ci { font-size: 40px; margin-bottom: 8px; display: block; }
.cc-p { background: linear-gradient(145deg, #FFF3E0, #FFE0B2); }
.cc-m { background: linear-gradient(145deg, #E8F5E9, #C8E6C9); }
.cc-x { background: linear-gradient(145deg, #E3F2FD, #BBDEFB); }
.cc-h { background: linear-gradient(145deg, #FFEBEE, #FFCDD2); }
.q-progress { height: 4px; background: var(--surface3); border-radius: 2px; overflow: hidden; margin-bottom: 14px; }
.q-progress-fill { height: 100%; background: linear-gradient(90deg, var(--blue), var(--teal)); border-radius: 2px; transition: width 0.4s; }
.q-card { background: var(--surface); border-radius: var(--radius); padding: 24px; margin-bottom: 14px; box-shadow: var(--shadow-md); }
.q-label { font-size: 13px; color: var(--text3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; }
.q-text { font-size: 20px; font-weight: 700; line-height: 1.35; color: var(--text); }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt {
  background: var(--surface); border: 2px solid var(--surface3);
  border-radius: var(--radius-sm); padding: 16px; font-size: 16px; font-weight: 600;
  text-align: left; cursor: pointer; transition: all 0.15s;
  display: flex; align-items: center; gap: 12px; font-family: inherit; color: var(--text);
  box-shadow: var(--shadow-sm);
}
.opt:active { background: var(--surface2); }
.opt .ol { width: 32px; height: 32px; border-radius: 10px; background: var(--surface2); display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; flex-shrink: 0; color: var(--text3); }
.opt.correct { background: var(--green-dim); border-color: var(--green); color: #1B5E20; }
.opt.correct .ol { background: var(--green); color: #fff; }
.opt.wrong { background: var(--red-dim); border-color: var(--red); color: #B71C1C; }
.opt.wrong .ol { background: var(--red); color: #fff; }
.opt.off { pointer-events: none; }
.fb-card { background: var(--surface); border-radius: var(--radius); padding: 18px; text-align: center; margin-bottom: 12px; transform: scale(0); transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1); box-shadow: var(--shadow-md); }
.fb-card.show { transform: scale(1); }
.fb-emoji { font-size: 44px; margin-bottom: 6px; }
.timer-pill { background: var(--surface2); border-radius: 10px; padding: 6px 14px; font-size: 18px; font-weight: 800; color: var(--blue); font-variant-numeric: tabular-nums; }
.timer-pill.warn { color: var(--red); animation: pulse 0.5s infinite alternate; }
@keyframes pulse { to { opacity: 0.5; } }
.result-wrap { text-align: center; padding: 30px 0; }
.result-emoji { font-size: 64px; margin-bottom: 12px; animation: resultBounce 0.6s cubic-bezier(0.34,1.56,0.64,1); }
@keyframes resultBounce { from { transform: scale(0); } to { transform: scale(1); } }
.result-score { font-size: 56px; font-weight: 800; margin: 8px 0; }

/* Memory */
.mem-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.mc { aspect-ratio: 1; border-radius: var(--radius-sm); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 30px; transition: all 0.35s; user-select: none; background: var(--surface); border: 2px solid transparent; position: relative; box-shadow: var(--shadow-sm); }
.mc .face { transition: opacity 0.3s, transform 0.3s; }
.mc .face-back { font-size: 22px; opacity: 0.4; }
.mc .face-front { position: absolute; opacity: 0; transform: scale(0.5) rotateY(90deg); }
.mc.flip .face-back { opacity: 0; transform: scale(0.5) rotateY(-90deg); }
.mc.flip .face-front { opacity: 1; transform: scale(1) rotateY(0deg); }
.mc.match { border-color: var(--green); background: var(--green-dim); }
.mc:active { transform: scale(0.92); }
.mem-stats { display: flex; justify-content: space-around; margin-bottom: 14px; }
.ms { text-align: center; }
.ms .n { font-size: 28px; font-weight: 800; color: var(--blue); }
.ms .l { font-size: 11px; color: var(--text3); font-weight: 500; }

/* Reaction */
.react-zone { border-radius: var(--radius); height: 260px; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; margin-bottom: 14px; gap: 10px; user-select: none; box-shadow: var(--shadow-md); }
.react-zone .rz-emoji { font-size: 56px; }
.react-zone h2 { font-size: 22px; font-weight: 700; text-align: center; color: var(--text); }
.react-zone p { font-size: 14px; color: var(--text3); text-align: center; }
.rz-wait { background: linear-gradient(145deg, #FFEBEE, #FCE4EC); }
.rz-go { background: linear-gradient(145deg, #E8F5E9, #C8E6C9); }
.rz-idle { background: var(--surface); }
.react-time { font-size: 52px; font-weight: 800; color: var(--blue); text-align: center; margin: 8px 0; }
.react-chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
.rc { background: var(--surface); border-radius: 8px; padding: 6px 12px; font-size: 13px; font-weight: 600; box-shadow: var(--shadow-sm); color: var(--text2); }

/* Word Scramble */
.scr-word { text-align: center; font-size: 34px; font-weight: 800; letter-spacing: 8px; padding: 24px; background: var(--surface); border-radius: var(--radius); margin-bottom: 12px; color: var(--blue); box-shadow: var(--shadow-md); }
.scr-input { width: 100%; background: var(--surface); border: 2px solid var(--surface3); border-radius: var(--radius-sm); padding: 16px; font-size: 20px; font-weight: 700; color: var(--text); text-align: center; text-transform: uppercase; letter-spacing: 4px; outline: none; transition: all 0.2s; font-family: inherit; }
.scr-input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(0,122,255,0.12); }
.scr-input.ok { border-color: var(--green); background: var(--green-dim); }
.scr-input.nope { border-color: var(--red); animation: shake 0.4s; }
@keyframes shake { 20%{transform:translateX(-6px)} 40%{transform:translateX(6px)} 60%{transform:translateX(-4px)} 80%{transform:translateX(4px)} }

/* Drag Race */
.race-track { background: var(--surface); border-radius: var(--radius); padding: 20px; margin-bottom: 14px; position: relative; overflow: hidden; height: 110px; box-shadow: var(--shadow-md); }
.race-road { position: absolute; bottom: 20px; left: 16px; right: 16px; height: 2px; background: var(--surface3); }
.race-road::before { content: ''; position: absolute; top: -1px; left: 0; width: 100%; height: 4px; background: repeating-linear-gradient(90deg, transparent 0, transparent 20px, var(--surface3) 20px, var(--surface3) 30px); }
.race-car { position: absolute; bottom: 30px; font-size: 42px; transition: left 0.1s; transform: scaleX(-1); }
.race-flag { position: absolute; right: 20px; bottom: 32px; font-size: 28px; }
.race-bar { height: 6px; background: var(--surface3); border-radius: 3px; overflow: hidden; margin-bottom: 14px; }
.race-bar-fill { height: 100%; background: linear-gradient(90deg, #FF9500, #FF2D55); border-radius: 3px; transition: width 0.08s; }
.race-btn { font-size: 24px; padding: 24px; border-radius: var(--radius); background: linear-gradient(135deg, #FF9500, #FF2D55); color: #fff; font-weight: 800; border: none; width: 100%; cursor: pointer; transition: transform 0.08s; font-family: inherit; box-shadow: 0 6px 24px rgba(255,149,0,0.3); }
.race-btn:active { transform: scale(0.96); }

/* Garage */
.gar-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gar-item { background: var(--surface); border-radius: var(--radius); padding: 18px; text-align: center; position: relative; overflow: hidden; transition: all 0.3s; box-shadow: var(--shadow-sm); }
.gar-item.locked { opacity: 0.35; filter: grayscale(0.7); }
.gar-item .ge { font-size: 42px; margin-bottom: 8px; display: block; }
.gar-item h4 { font-size: 15px; font-weight: 700; color: var(--text); }
.gar-item p { font-size: 12px; color: var(--text3); }
.gar-item .lock-icon { position: absolute; top: 10px; right: 10px; font-size: 18px; }
.gar-unlock { color: var(--orange); font-size: 12px; font-weight: 600; margin-top: 6px; display: block; }
.gar-item.unlocked { box-shadow: var(--shadow-md); }
.gar-item.unlocked .gar-unlock { color: var(--green); }

/* Badges */
.badge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.badge { background: var(--surface); border-radius: var(--radius-sm); padding: 16px 8px; text-align: center; transition: all 0.3s; box-shadow: var(--shadow-sm); }
.badge.got { background: linear-gradient(145deg, #FFF8E1, #FFF3E0); box-shadow: 0 4px 16px rgba(255,149,0,0.15); }
.badge.nope { opacity: 0.3; filter: grayscale(1); }
.badge .bi { font-size: 30px; margin-bottom: 4px; display: block; }
.badge span { font-size: 12px; font-weight: 600; display: block; color: var(--text); }
.badge small { font-size: 10px; color: var(--text3); }

/* Recovery */
.mile { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 0.5px solid var(--surface3); }
.mile:last-child { border-bottom: none; }
.mile-dot { width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 20px; background: var(--surface2); border: 2px solid var(--surface3); transition: all 0.3s; }
.mile.done .mile-dot { background: var(--green-dim); border-color: var(--green); }

/* Breathing */
.breath-wrap { display: flex; flex-direction: column; align-items: center; padding: 24px 0; }
.breath-ring { width: 170px; height: 170px; border-radius: 50%; background: radial-gradient(circle, rgba(0,122,255,0.08), rgba(0,122,255,0.02)); border: 3px solid rgba(0,122,255,0.3); display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 600; color: var(--blue); transition: transform 4s ease-in-out, border-color 0.5s; margin-bottom: 16px; }
.breath-ring.in { transform: scale(1.4); border-color: var(--blue); }
.breath-ring.out { transform: scale(1); border-color: rgba(0,122,255,0.2); }

/* Toast & Popups */
#toast { position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%) translateY(16px); backdrop-filter: blur(30px) saturate(180%); -webkit-backdrop-filter: blur(30px) saturate(180%); background: rgba(28,28,30,0.88); border-radius: 14px; padding: 12px 20px; font-size: 15px; font-weight: 600; color: #fff; opacity: 0; transition: all 0.35s cubic-bezier(0.34,1.56,0.64,1); pointer-events: none; z-index: 999; white-space: nowrap; max-width: 90vw; box-shadow: var(--shadow-lg); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.xp-pop { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0); backdrop-filter: blur(40px) saturate(200%); -webkit-backdrop-filter: blur(40px) saturate(200%); background: rgba(255,255,255,0.92); border: none; border-radius: 24px; padding: 36px 48px; text-align: center; z-index: 1001; transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1); box-shadow: var(--shadow-xl); }
.xp-pop.show { transform: translate(-50%, -50%) scale(1); }
#overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.25); z-index: 1000; display: none; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
#overlay.show { display: block; }
.xp-float { position: fixed; z-index: 998; font-size: 18px; font-weight: 800; color: var(--orange); pointer-events: none; animation: xpFloat 1.2s ease-out forwards; text-shadow: 0 2px 8px rgba(255,149,0,0.3); }
@keyframes xpFloat { 0% { opacity: 1; transform: translateY(0) scale(1); } 100% { opacity: 0; transform: translateY(-60px) scale(0.7); } }
.confetti { position: fixed; width: 8px; height: 8px; border-radius: 2px; pointer-events: none; z-index: 2000; animation: confDrop 2.2s ease-in forwards; }
@keyframes confDrop { 0% { transform: translateY(-20px) rotate(0deg) scale(1); opacity: 1; } 100% { transform: translateY(100vh) rotate(720deg) scale(0.3); opacity: 0; } }

/* Meditation Section */
.med-hero {
  background: linear-gradient(145deg, #E3F2FD, #EDE7F6);
  border-radius: 24px; padding: 28px 22px; margin-bottom: 14px;
  text-align: center; position: relative; overflow: hidden; box-shadow: var(--shadow-md);
}
.med-hero-glow {
  position: absolute; top: -40px; left: 50%; transform: translateX(-50%);
  width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle, rgba(0,122,255,0.1), transparent 70%);
  pointer-events: none;
}
.med-progress-wrap { background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); }
.med-journey { display: flex; align-items: center; gap: 4px; }
.med-dot {
  flex: 1; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; cursor: pointer; transition: all 0.3s;
  border: none; background: var(--surface2); color: var(--text3);
}
.med-dot.done { background: var(--green); color: #fff; }
.med-dot.current { background: var(--blue); color: #fff; animation: medPulse 2s infinite; }
.med-dot.locked { opacity: 0.3; cursor: default; }
@keyframes medPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(0,122,255,0.3); } 50% { box-shadow: 0 0 0 6px rgba(0,122,255,0); } }

.med-stats { display: flex; gap: 8px; }
.med-stat {
  flex: 1; background: var(--surface);
  border-radius: var(--radius-sm); padding: 16px 8px; text-align: center;
  box-shadow: var(--shadow-sm);
}
.med-stat-n { font-size: 26px; font-weight: 800; color: var(--blue); margin-bottom: 2px; }

.med-lesson-card {
  background: var(--surface);
  border-radius: var(--radius); padding: 16px;
  margin-bottom: 10px; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow-sm);
}
.med-lesson-card:active { transform: scale(0.98); }
.med-lesson-card.locked { opacity: 0.35; pointer-events: none; }
.med-lesson-card.done { border-left: 3px solid var(--green); }
.mlc-icon { font-size: 32px; width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.mlc-body { flex: 1; min-width: 0; }
.mlc-title { font-size: 15px; font-weight: 600; margin-bottom: 2px; color: var(--text); }
.mlc-desc { font-size: 13px; color: var(--text3); line-height: 1.3; }
.mlc-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.mlc-xp { font-size: 12px; font-weight: 700; color: var(--orange); }
.mlc-status { font-size: 16px; }

.med-quick-card {
  background: linear-gradient(145deg, #E3F2FD, #EDE7F6);
  border-radius: var(--radius); padding: 18px;
  display: flex; align-items: center; gap: 14px; cursor: pointer; transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}
.med-quick-card:active { transform: scale(0.98); }

/* Lesson View */
.med-lesson-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; padding: 16px 16px 0; }
.med-lesson-icon { font-size: 56px; text-align: center; margin-bottom: 8px; padding: 0 16px; }
.med-lesson-body { margin-bottom: 16px; padding: 0 16px; }
#mlTitle { padding: 0 16px; }
#mlQuiz, #mlPractice, #mlComplete { margin: 0 16px; }
.med-theory-card {
  background: var(--surface); border-radius: var(--radius-sm);
  padding: 16px; margin-bottom: 10px; position: relative; overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.med-theory-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--blue), var(--purple));
}
.mtc-label { font-size: 11px; font-weight: 600; color: var(--blue); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.mtc-text { font-size: 15px; color: var(--text2); line-height: 1.6; }
.mtc-text strong { color: var(--text); font-weight: 600; }
.mtc-highlight {
  background: linear-gradient(145deg, #FFF8E1, #FFF3E0);
  border-radius: var(--radius-xs);
  padding: 14px 16px; margin: 10px 0; font-size: 14px; color: var(--text2); line-height: 1.5;
}
.mtc-highlight::before { content: '💡 '; }
.med-key-point { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; }
.mkp-icon { font-size: 20px; flex-shrink: 0; margin-top: 2px; }
.mkp-text { font-size: 14px; color: var(--text2); line-height: 1.5; }
.mkp-text strong { color: var(--text); }

/* Lesson Quiz */
.med-quiz-opts { display: flex; flex-direction: column; gap: 8px; }
.mqo {
  background: var(--surface2); border: 2px solid var(--surface3);
  border-radius: var(--radius-xs); padding: 14px; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all 0.15s; font-family: inherit; color: var(--text);
  text-align: left; width: 100%; display: block;
}
.mqo:active { background: var(--surface3); }
.mqo.correct { background: var(--green-dim); border-color: var(--green); color: #1B5E20; }
.mqo.wrong { background: var(--red-dim); border-color: var(--red); color: #B71C1C; }
.mqo.off { pointer-events: none; opacity: 0.6; }
.med-quiz-fb {
  margin-top: 10px; padding: 14px; border-radius: var(--radius-xs);
  font-size: 14px; font-weight: 600; text-align: center; display: none;
}
.med-quiz-fb.show { display: block; }
.med-quiz-fb.ok { background: var(--green-dim); color: #1B5E20; }
.med-quiz-fb.nope { background: var(--red-dim); color: #B71C1C; }

/* Meditation Timer — stays dark for immersion */
#medTimer {
  position: fixed; inset: 0; z-index: 1500; background: #0A0A14;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.mt-bg { position: absolute; inset: 0; overflow: hidden; }
.mt-wave {
  position: absolute; border-radius: 50%; opacity: 0.04;
  animation: mtWave 8s ease-in-out infinite;
}
.mt-wave-1 { width: 600px; height: 600px; background: #5AC8FA; top: 50%; left: 50%; transform: translate(-50%,-50%); }
.mt-wave-2 { width: 500px; height: 500px; background: #AF52DE; top: 50%; left: 50%; transform: translate(-50%,-50%); animation-delay: -2.5s; }
.mt-wave-3 { width: 400px; height: 400px; background: #5AC8FA; top: 50%; left: 50%; transform: translate(-50%,-50%); animation-delay: -5s; }
@keyframes mtWave {
  0%,100% { opacity: 0.03; transform: translate(-50%,-50%) scale(1); }
  50% { opacity: 0.08; transform: translate(-50%,-50%) scale(1.15); }
}
.mt-close { position: absolute; top: 16px; right: 16px; z-index: 10; background: rgba(255,255,255,0.1) !important; color: #fff !important; }
.mt-center { position: relative; z-index: 5; text-align: center; }
.mt-ring { position: relative; width: 220px; height: 220px; margin: 0 auto 24px; cursor: pointer; }
.mt-svg { width: 100%; height: 100%; }
.mt-time {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -55%);
  font-size: 42px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums;
}
.mt-label {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, 30%);
  font-size: 12px; font-weight: 600; color: rgba(255,255,255,0.4); text-transform: uppercase; letter-spacing: 1px;
}
.mt-phase { font-size: 18px; font-weight: 700; color: #5AC8FA; margin-bottom: 8px; }
.mt-mantra { font-size: 14px; color: rgba(255,255,255,0.4); font-style: italic; min-height: 20px; transition: opacity 0.5s; }
.mt-bottom { position: absolute; bottom: 40px; left: 0; right: 0; z-index: 5; }
.mt-dots { display: flex; justify-content: center; gap: 6px; }
.mt-dot-item { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.15); transition: all 0.3s; }
.mt-dot-item.active { background: #5AC8FA; box-shadow: 0 0 8px rgba(90,200,250,0.5); }

/* Media Cards — Podcasts */
.media-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface);
  border-radius: var(--radius-sm); padding: 14px; margin-bottom: 8px;
  text-decoration: none; color: inherit; transition: all 0.2s; cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.media-card:active { transform: scale(0.98); }
.media-icon-wrap {
  width: 48px; height: 48px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.media-icon-spotify { background: #1DB954; }
.media-icon-spotify svg { fill: #fff; }
.media-body { flex: 1; min-width: 0; }
.media-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.media-desc { font-size: 12px; color: var(--text3); line-height: 1.3; }

/* YouTube Thumbnail Cards */
.yt-card {
  display: block; background: var(--surface); border-radius: var(--radius);
  overflow: hidden; margin-bottom: 12px; text-decoration: none; color: inherit;
  transition: all 0.2s; box-shadow: var(--shadow-sm);
}
.yt-card:active { transform: scale(0.98); }
.yt-thumb-wrap {
  position: relative; width: 100%; aspect-ratio: 16/9;
  background: var(--surface2); overflow: hidden;
}
.yt-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.yt-play-btn {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 52px; height: 52px; border-radius: 50%;
  background: rgba(0,0,0,0.65); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s;
}
.yt-card:active .yt-play-btn { transform: translate(-50%,-50%) scale(0.9); }
.yt-info { padding: 12px 14px 14px; }

/* Media Tabs */
.media-tabs { display: flex; gap: 8px; }
.media-tab {
  padding: 8px 18px; border-radius: 20px; border: none;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s;
  background: var(--surface2); color: var(--text3); font-family: inherit;
}
.media-tab.active { background: var(--blue); color: #fff; box-shadow: 0 2px 10px rgba(0,122,255,0.25); }

/* Memory Images */
.mem-img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; display: block; }
.mc .face-front { position: absolute; inset: 0; opacity: 0; transform: scale(0.5) rotateY(90deg); overflow: hidden; border-radius: 10px; }
.mc.flip .face-front { opacity: 1; transform: scale(1) rotateY(0deg); }
.mem-label {
  position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%);
  font-size: 10px; font-weight: 700; color: #fff;
  background: rgba(0,0,0,0.5); padding: 2px 6px; border-radius: 4px;
  backdrop-filter: blur(4px); white-space: nowrap;
}

/* Utility */
.divider { height: 0.5px; background: var(--surface3); margin: 10px 0; }
.spacer { height: 20px; }
.spacer-sm { height: 10px; }
.flex-sb { display: flex; align-items: center; justify-content: space-between; }
.flex-c { display: flex; align-items: center; gap: 8px; }
.gap-6 { gap: 6px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-14 { margin-bottom: 14px; }
.mb-16 { margin-bottom: 16px; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 8px; font-size: 12px; font-weight: 600; }
.tag-y { background: var(--yellow-dim); color: #E65100; }
.tag-g { background: var(--green-dim); color: #1B5E20; }
.tag-b { background: var(--blue-dim); color: #0D47A1; }
.tag-r { background: var(--red-dim); color: #B71C1C; }

/* Games 4-column grid */
.games-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.game-tile { border-radius: var(--radius-sm); padding: 12px 6px; text-align: center; cursor: pointer; transition: all 0.2s; box-shadow: var(--shadow-sm); }
.game-tile:active { transform: scale(0.94); }
.game-tile .gt-icon { font-size: 28px; margin-bottom: 4px; display: block; }
.game-tile .gt-name { font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 2px; line-height: 1.2; }
.game-tile .caption { font-size: 10px; color: var(--text3); line-height: 1.2; }

/* ============================================================
   RESULT SCREENS (shared)
   ============================================================ */
.result-wrap {
  display: flex; flex-direction: column; align-items: center;
  padding: 40px 20px; text-align: center; gap: 4px;
}
.result-emoji { font-size: 64px; margin-bottom: 8px; }
.result-score { font-size: 48px; font-weight: 900; margin: 12px 0; }
.gradient-text {
  background: linear-gradient(135deg, var(--yellow), var(--red));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

/* ============================================================
   CANVAS GAME HUD
   ============================================================ */
.hud-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 12px; border-radius: 16px;
  background: var(--surface2); border: 1.5px solid var(--surface3);
  font-size: 13px; font-weight: 700; color: var(--text);
}
