/* Thmanyah Sans: the app's only typeface. Served from the app itself, so it works offline. */
@font-face { font-family: 'Thmanyah'; src: url('/fonts/thmanyah-sans-Regular.otf') format('opentype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Thmanyah'; src: url('/fonts/thmanyah-sans-Bold.otf') format('opentype'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Thmanyah'; src: url('/fonts/thmanyah-sans-Black.otf') format('opentype'); font-weight: 900; font-style: normal; font-display: swap; }
/* Pharma Trainer. Palette, type and components follow the reference study-app design:
   Onest, orange accent, cream background, pastel cards, floating round bottom bar. */
:root {
  --orange: #f95e08;
  --orange-2: #fe8118;
  --orange-soft: #fff1e7;
  --ink: #1c1b19;
  --ink-2: #4f4b45;
  --muted: #8b857d;
  --bg: #fcfaf6;
  --surface: #ffffff;
  --line: #efe9e1;
  --peach: #fbe8da;
  --cream: #f9eedf;
  --lime: #ecedc7;
  --lavender: #ded1e8;
  --mint: #d2e4e2;
  --sage: #d9e7cb;
  --sky: #cfe6f4; --yellow: #fe8118;
  --orange-deep: #c2410c;   /* text and icons on soft orange */
  --orange-tint: #ffe9dc;   /* soft orange fills */
  --orange-line: #ffcdb0;   /* borders on soft orange */
  --ok: #2f9e5b;
  --ok-soft: #e3f4e8;
  --bad: #e5484d;
  --bad-soft: #fde8e8;
  --r-sm: 12px;
  --r-md: 20px;
  --r-lg: 28px;
  --radius: var(--r-lg);
  --radius-sm: var(--r-md);
  --shadow: 0 10px 30px rgba(60, 40, 20, .07);
  --shadow-lg: 0 24px 60px rgba(60, 40, 20, .14);
  --grad: linear-gradient(90deg, var(--orange), var(--orange-2));
  --font: 'Thmanyah', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html {
  -webkit-text-size-adjust: 100%;
  height: 100%;
  overscroll-behavior-y: none;
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  user-select: none;
  -webkit-user-select: none;
}
#app {
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  margin: 0 auto;
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
input, textarea, [contenteditable="true"] {
  user-select: text;
  -webkit-user-select: text;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
p { margin: 0; }
em { font-style: normal; color: var(--orange); }
img, svg { flex-shrink: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(249, 94, 8, .45); outline-offset: 2px; }
[dir="rtl"] .flip-rtl { transform: scaleX(-1); }

.boot, .boot-error { margin: 40vh auto 0; text-align: center; color: var(--muted); max-width: 420px; padding: 20px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.pad { padding: 16px; }

/* Tones */
.tone-sage { background: var(--sage); }
.tone-mint { background: var(--mint); }
.tone-lime { background: var(--lime); }
.tone-lavender { background: var(--lavender); }
.tone-peach { background: var(--peach); }
.tone-sky { background: var(--sky); }

/* The white scribble drawn across the reference header cards. */
.swoosh { position: relative; overflow: hidden; isolation: isolate; }
.swoosh::before {
  content: '';
  position: absolute;
  inset: -10px -20px auto auto;
  width: 280px;
  height: 170px;
  z-index: -1;
  opacity: .7;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 220 130'%3E%3Cpath d='M18 104C52 30 78 18 92 52s4 72 34 58 30-82 58-86 22 40 22 40' fill='none' stroke='white' stroke-width='20' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / contain;
}
[dir="rtl"] .swoosh::before { inset: -10px auto auto -20px; transform: scaleX(-1); }

/* Buttons and controls */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--surface);
  font-weight: 600;
  white-space: nowrap;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 10px 22px rgba(249, 94, 8, .28); }
.btn-primary:hover { box-shadow: 0 14px 28px rgba(249, 94, 8, .36); }
.btn-soft { background: var(--orange-soft); color: var(--orange); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-cream { background: var(--cream); color: var(--ink-2); }
.btn-white { background: #fff; color: var(--ink); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-block { display: flex; width: 100%; }
.btn-lg { min-height: 54px; padding: 0 24px; font-size: 16px; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.grow { flex: 1; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  transition: background .15s ease, color .15s ease;
}
.icon-btn.sm { width: 38px; height: 38px; border-radius: var(--r-sm); }
.icon-btn.on { background: var(--orange); border-color: var(--orange); color: #fff; }
.icon-btn.on svg path { fill: currentColor; }
.icon-btn:disabled { opacity: .6; cursor: default; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .65);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  border: 0;
}
.chip-white { background: #fff; }
.chip-peach { background: var(--peach); color: var(--ink-2); }

.chip-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-tab {
  display: inline-flex;
  align-items: center;
  padding: 12px 16px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
  transition: all .15s ease;
}
.chip-tab.active, .chip-tab:has(input:checked) { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 8px 18px rgba(249, 94, 8, .25); }
.chip-tab input { position: absolute; opacity: 0; pointer-events: none; }
.chip-tab:has(input:focus-visible) { outline: 3px solid rgba(249, 94, 8, .45); }

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #fff;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}
.pill-btn.hot { background: var(--grad); color: #fff; }

.tag { padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--line); color: var(--ink-2); white-space: nowrap; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--orange-soft); color: var(--orange-deep); }
.tag.hot { background: var(--orange-soft); color: var(--orange); }

.bar { height: 8px; border-radius: 999px; background: rgba(28, 27, 25, .08); overflow: hidden; }
.bar-fill { height: 100%; border-radius: inherit; background: var(--grad); transition: width .5s ease; }
.bar-thin { height: 6px; }
.bar-on-tone { background: rgba(255, 255, 255, .7); }

.ring { position: relative; flex-shrink: 0; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: rgba(28, 27, 25, .08); stroke-width: 10; }
.ring-fill { fill: none; stroke: var(--orange); stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset .8s ease; }
.ring-label { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: 15px; direction: ltr; }

.avatar { display: grid; place-items: center; border-radius: 50%; font-weight: 700; flex-shrink: 0; border: 3px solid #fff; box-shadow: 0 4px 12px rgba(0, 0, 0, .06); }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); }

.art { display: block; width: 100%; height: auto; }
.mascot { width: auto; }

.empty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 32px 20px; text-align: center; color: var(--ink-2); }

.logo { display: inline-flex; align-items: center; gap: 12px; font-weight: 800; font-size: 18px; }
.logo-mark { display: grid; place-items: center; border-radius: var(--r-sm); background: var(--grad); color: #fff; box-shadow: 0 8px 18px rgba(249, 94, 8, .3); }

.lang-toggle { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 13px; font-weight: 600; }

/* Toasts */
.toasts { position: fixed; inset: auto 0 110px; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 80; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 999px; font-weight: 500; font-size: 14px; box-shadow: var(--shadow-lg); animation: toast-in .25s ease; transition: opacity .3s ease, transform .3s ease; }
.toast.ok { background: var(--ok); }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 90; }

/* App layout: phone first, floating bottom bar. */
.layout { min-height: 100vh; }
.sidebar { display: none; }
.main { min-width: 0; }
.page { max-width: 560px; margin: 0 auto; padding: 12px 16px 130px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; min-height: 46px; }
.topbar-start, .topbar-end { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-title { font-size: 20px; font-weight: 700; }

.stat-pills { display: flex; gap: 8px; }
.stat-pill { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: var(--r-md); background: #fff; border: 1px solid var(--line); font-size: 14px; direction: ltr; }
.stat-pill small { color: var(--muted); font-size: 11px; font-weight: 600; }
.stat-pill-ico { display: grid; place-items: center; width: 30px; height: 30px; border-radius: var(--r-sm); }
.stat-pill-ico.flame { background: var(--yellow); color: var(--orange-deep); }
.stat-pill-ico.bolt { background: var(--orange-soft); color: var(--orange); }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 24px 2px 12px; gap: 12px; }
.section-title { font-size: 19px; font-weight: 700; }
.see-all { font-size: 13px; color: var(--muted); font-weight: 500; }

.bottom-nav {
  position: fixed;
  inset: auto 0 calc(14px + env(safe-area-inset-bottom));
  margin: 0 auto;
  width: min(420px, calc(100% - 24px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  z-index: 50;
}
.nav-btn { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 50%; background: #fff; color: var(--ink-2); box-shadow: 0 4px 12px rgba(0, 0, 0, .05); transition: color .15s ease, background .15s ease; }
.nav-btn.active { color: var(--orange); background: var(--orange-soft); }
.nav-btn.active svg { fill: rgba(249, 94, 8, .15); }
.nav-center { display: grid; place-items: center; width: 64px; height: 64px; margin-top: -26px; border-radius: 50%; background: var(--grad); color: #fff; box-shadow: 0 14px 26px rgba(249, 94, 8, .45); transition: transform .15s ease; }
.nav-center:hover { transform: translateY(-2px) rotate(-6deg); }

/* Home */
.home-grid { display: grid; gap: 4px; }
.home-aside { display: grid; gap: 16px; margin-top: 24px; align-content: start; }

.buddy-card { background: var(--peach); border-radius: var(--radius); padding: 16px; }
.buddy-card.static { box-shadow: none; }
.buddy-head { display: flex; align-items: center; gap: 12px; min-height: 70px; padding-inline-end: 96px; position: relative; }
.buddy-text { display: flex; flex-direction: column; min-width: 0; }
.buddy-text small { color: var(--ink-2); font-size: 13px; }
.buddy-text b { font-size: 21px; font-weight: 700; }
.buddy-bot { position: absolute; inset-inline-end: -6px; top: -14px; animation: float 4s ease-in-out infinite; }
.ask-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 8px; border-radius: 999px; background: rgba(255, 255, 255, .7); }
.round-btn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: #fff; color: var(--ink-2); flex-shrink: 0; }
.ask-input { flex: 1; min-width: 0; height: 44px; border: 0; background: #fff; border-radius: 999px; padding: 0 16px; outline: none; color: var(--ink); display: flex; align-items: center; }
span.ask-input { color: var(--muted); }
.ask-input::placeholder { color: var(--muted); }
.send-btn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--grad); color: #fff; flex-shrink: 0; box-shadow: 0 6px 14px rgba(249, 94, 8, .3); }

.goal-card { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 12px 16px; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); }
.goal-card .ring-label { font-size: 13px; }
.goal-body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.goal-body b { font-size: 16px; }
.goal-body small { color: var(--muted); }
.goal-streak { display: flex; flex-direction: column; align-items: center; padding: 8px 12px; border-radius: var(--r-md); background: var(--orange-soft); min-width: 72px; }
.goal-streak b { font-size: 18px; line-height: 1.1; }
.goal-streak small { font-size: 11px; color: var(--ink-2); text-align: center; }
.flame { color: var(--orange); display: inline-grid; }

.hero-card { position: relative; display: grid; grid-template-rows: auto auto; padding: 16px 20px 20px; border-radius: var(--r-lg); background: var(--lime); min-height: 280px; overflow: hidden; transition: transform .2s ease; }
.hero-card:hover { transform: translateY(-2px); }
.hero-art { max-width: 320px; margin: 0 auto; width: 88%; }
.hero-card h2 { font-size: 24px; font-weight: 700; max-width: 75%; }
.hero-go { position: absolute; inset-inline-end: 20px; bottom: 20px; display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%; background: var(--grad); color: #fff; box-shadow: 0 10px 22px rgba(249, 94, 8, .35); }

.suggest-list { display: grid; gap: 12px; }
.suggest { display: flex; align-items: center; gap: 12px; padding: 12px 12px; border-radius: var(--r-md); background: #fff; border: 1px solid var(--line); transition: transform .15s ease, box-shadow .15s ease; }
.suggest:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.suggest-ico { display: grid; place-items: center; width: 46px; height: 46px; border-radius: var(--r-md); flex-shrink: 0; }
.suggest-body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.suggest-body small { color: var(--muted); font-size: 13px; }
.suggest-arrow { color: var(--muted); }

.subject-grid { display: grid; gap: 12px; }
.subject-card { position: relative; display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: var(--r-lg); overflow: hidden; transition: transform .15s ease, box-shadow .15s ease; isolation: isolate; }
.subject-card:not(.static):hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.subject-card::after {
  content: '';
  position: absolute;
  inset: auto -10px -16px auto;
  width: 110px;
  height: 110px;
  z-index: -1;
  opacity: .35;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.6' stroke-linecap='round'%3E%3Crect x='5' y='3' width='14' height='18' rx='3'/%3E%3Cpath d='M9 8h6M9 12h6M9 16h3'/%3E%3C/svg%3E") no-repeat center / contain;
}
[dir="rtl"] .subject-card::after { inset: auto auto -16px -10px; }
.subject-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.subject-card h3 { font-size: 17px; font-weight: 700; }
.subject-desc { color: var(--ink-2); font-size: 13px; }
.subject-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.subject-foot .pill-btn { margin-inline-start: auto; }

.level-card { display: grid; gap: 12px; padding: 16px; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); }
.level-card-top { display: flex; align-items: center; gap: 12px; }
.level-card-top div { flex: 1; display: flex; flex-direction: column; }
.level-card-top small { color: var(--muted); }
.level-xp { font-weight: 700; color: var(--orange); direction: ltr; }
.level-badge { display: grid; place-items: center; width: 48px; height: 48px; border-radius: var(--r-md); background: var(--yellow); color: var(--orange-deep); flex-shrink: 0; }

.side-card { padding: 16px 16px; display: grid; gap: 12px; }
.side-card .section-head { margin: 0; }
.side-card .section-title { font-size: 16px; }
.badge-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.badge-mini { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.badge-mini small { font-size: 11px; color: var(--ink-2); line-height: 1.25; }
.badge-mini .badge-ico { width: 46px; height: 46px; }
.board-mini { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.board-mini li { display: flex; align-items: center; gap: 12px; padding: 8px 8px; border-radius: var(--r-sm); }
.board-mini li b { flex: 1; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-mini li.me { background: var(--orange-soft); }
.rank { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--line); font-weight: 700; font-size: 13px; flex-shrink: 0; }
.rank.r1 { background: var(--yellow); }
.rank.r2 { background: #e3e7ee; }
.rank.r3 { background: var(--orange-line); }
.board-xp { font-weight: 700; font-size: 13px; color: var(--orange); direction: ltr; white-space: nowrap; }

/* Subjects */
.subjects-hero { padding: 16px; border-radius: var(--radius); background: var(--peach); display: grid; gap: 16px; }
.subjects-hero-top { display: flex; align-items: center; gap: 12px; }
.subjects-hero h1, .subjects-hero h3 { font-size: 22px; font-weight: 700; }
.subjects-hero-bot { flex-shrink: 0; animation: float 4s ease-in-out infinite; }
.activity-list { padding: 8px; }
.activity { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--r-md); }
.activity + .activity { border-top: 1px solid var(--line); border-radius: 0; }
.activity-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-sm); background: var(--bg); color: var(--ink-2); flex-shrink: 0; }
.activity-body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.activity-body small { color: var(--muted); font-size: 12px; }

/* Search */
.ask-card { padding: 16px; border-radius: var(--radius); background: var(--peach); }
.ask-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ask-card h1 { font-size: 24px; font-weight: 700; }
.ask-card p { color: var(--ink-2); font-size: 14px; }
.ask-bot { flex-shrink: 0; margin: -10px 0 -18px; }
.filter-row { display: flex; gap: 8px; overflow-x: auto; padding: 12px 2px 8px; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.results { display: grid; gap: 12px; margin-top: 8px; }
.try-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.try-chips .chip { border: 1px solid var(--line); cursor: pointer; padding: 8px 12px; direction: ltr; }
.result-grid { display: grid; gap: 12px; }
.result-card { padding: 16px; border-radius: var(--r-lg); display: grid; gap: 12px; }
.result-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.result-head h3 { font-size: 19px; margin-top: 8px; }
.brand-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.brand-rows li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 12px 12px; border-radius: var(--r-md); background: rgba(255, 255, 255, .7); font-size: 13px; }
.brand-rows li b { font-size: 15px; }
.brand-rows li span { color: var(--ink-2); }
.result-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.source { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }

/* Library */
.lib-head { padding: 20px; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); }
.lib-head::before { filter: invert(1); opacity: .05; }
.lib-head h1, .lib-head h3 { font-size: 26px; font-weight: 800; }
.lib-head p { color: var(--ink-2); margin-top: 2px; }
.lib-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.lib-stat { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--r-md); border: 1px solid var(--line); background: #fff; }
.lib-stat b { display: grid; place-items: center; width: 56px; height: 56px; border-radius: var(--r-md); font-size: 22px; font-weight: 700; flex-shrink: 0; }
.lib-stat span { font-size: 15px; line-height: 1.25; font-weight: 500; }
.seg-tabs { display: flex; gap: 4px; padding: 4px; margin: 16px 0; border-radius: 999px; background: var(--cream); }
.seg { flex: 1; text-align: center; padding: 12px 8px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--ink-2); }
.seg.active { background: var(--grad); color: #fff; box-shadow: 0 8px 18px rgba(249, 94, 8, .25); }
.review-banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 12px; border-radius: var(--r-md); background: var(--ink); color: #fff; font-weight: 600; }
.review-banner span { flex: 1; }
.lib-grid { display: grid; gap: 12px; }
.lib-card { position: relative; display: grid; gap: 12px; padding: 16px 16px; border-radius: var(--r-lg); }
.lib-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.status { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; }
.status.fixed { color: var(--ok); }
.status.pending { color: var(--orange-deep); }
.lib-q { font-size: 16px; font-weight: 600; }
.lib-a { font-size: 14px; color: var(--ink-2); }
.lib-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lib-card-foot small { color: var(--ink-2); font-size: 12px; }
.rating { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 13px; }
.rating svg { color: var(--orange-2); fill: var(--orange-2); }
.lib-title { font-size: 18px; }
.lib-brands { font-size: 13px; color: var(--ink-2); }
.icon-actions { display: flex; gap: 8px; }
.icon-actions .icon-btn { border: 0; }

.prog-top { display: grid; gap: 12px; }
.prog-overall { display: flex; align-items: center; gap: 16px; padding: 16px; }
.prog-overall > div:last-child { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mini-tiles { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.mini-tiles span { display: flex; flex-direction: column; padding: 8px 12px; border-radius: var(--r-sm); background: var(--bg); font-size: 12px; color: var(--muted); }
.mini-tiles b { font-size: 17px; color: var(--ink); }
.heat-card { padding: 16px; display: grid; gap: 12px; }
.heat { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; direction: ltr; }
.heat span { aspect-ratio: 1; border-radius: var(--r-sm); background: #f1ece5; }
.heat .h1 { background: var(--orange-tint); }
.heat .h2 { background: var(--orange-line); }
.heat .h3 { background: var(--orange-2); }
.heat .h4 { background: var(--orange); }
.prog-list { padding: 8px; }
.prog-row { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--r-md); }
.prog-row:hover { background: var(--bg); }
.prog-dot { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-sm); font-weight: 800; flex-shrink: 0; }
.prog-body { flex: 1; display: grid; gap: 4px; min-width: 0; }
.prog-body small { color: var(--muted); font-size: 12px; }
.prog-pct { font-weight: 700; min-width: 44px; text-align: end; direction: ltr; }
.how-card { margin-top: 16px; padding: 16px; display: grid; gap: 12px; }
.how-card b { display: flex; align-items: center; gap: 8px; }
.how-card ul { margin: 0; padding-inline-start: 20px; color: var(--ink-2); font-size: 14px; display: grid; gap: 4px; }
.how-card .btn { justify-self: start; }

/* Profile */
.profile-grid { display: grid; gap: 16px; }
.profile-card { padding: 16px; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); }
.profile-card::before { filter: invert(1); opacity: .05; }
.profile-top { display: flex; align-items: center; gap: 12px; }
.profile-id { flex: 1; min-width: 0; }
.profile-id h1 { font-size: 22px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.profile-id small { color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; text-align: start; }
.profile-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.ptile { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 8px 8px 12px; border-radius: var(--r-md); background: var(--bg); }
.ptile b { display: grid; place-items: center; width: 100%; padding: 12px 0; border-radius: var(--r-md); font-size: 26px; font-weight: 800; direction: ltr; }
.ptile span { font-size: 14px; color: var(--ink-2); }

.level-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 12px;
  border-radius: var(--r-md);
  background: linear-gradient(100deg, var(--orange-tint) 0%, var(--orange-tint) 35%, var(--orange-2) 70%, var(--orange-2) 100%);
  box-shadow: 0 12px 30px rgba(249, 94, 8, .18);
}
.level-banner-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.level-banner-text small { color: var(--ink-2); font-size: 13px; }
.level-banner .level-badge { background: var(--yellow); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .08); }
.levelup { animation: pop .5s ease; }

.settings-list { display: grid; gap: 12px; align-content: start; }
.setting { display: flex; align-items: center; gap: 12px; padding: 12px 12px; border-radius: var(--r-md); background: #fff; border: 1px solid var(--line); text-align: start; width: 100%; }
button.setting:hover, a.setting:hover { box-shadow: var(--shadow); }
.setting-ico { display: grid; place-items: center; width: 42px; height: 42px; border-radius: var(--r-sm); background: var(--bg); flex-shrink: 0; }
.setting-body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.setting-body small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.setting-arrow { color: var(--muted); }
.setting.danger .setting-ico { background: var(--bad-soft); color: var(--bad); }
.setting.danger b { color: var(--bad); }
.mini-select { border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; background: #fff; }
.switch { position: relative; width: 52px; height: 30px; border-radius: 999px; border: 0; background: #ddd6cc; flex-shrink: 0; transition: background .2s ease; }
.switch span { position: absolute; top: 3px; inset-inline-start: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .15); transition: inset-inline-start .2s ease; }
.switch.on { background: var(--orange); }
.switch.on span { inset-inline-start: 25px; }
.btn-signout { background: #fff; border: 1px solid var(--line); min-height: 54px; margin-top: 8px; }

/* Badges and leaderboard */
.badges-hero, .board-hero { display: flex; align-items: center; gap: 16px; padding: 16px 20px; border-radius: var(--radius); background: var(--lavender); }
.board-hero { background: var(--mint); justify-content: space-between; }
.badges-hero h1, .board-hero h1 { font-size: 22px; font-weight: 700; }
.badges-hero p, .board-hero p { color: var(--ink-2); font-size: 14px; margin-top: 4px; }
.badges-art { width: 140px; flex-shrink: 0; }
.badge-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 16px; }
.badge { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 12px; border-radius: var(--r-md); background: #fff; border: 1px solid var(--line); text-align: center; }
.badge small { font-size: 12px; color: var(--muted); line-height: 1.35; }
.badge .bar { width: 100%; margin-top: 4px; }
.badge-count { font-weight: 600; color: var(--ink-2) !important; }
.badge-ico { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%; background: #f1ece5; color: #b9b1a6; }
.badge.earned .badge-ico, .badge-mini.earned .badge-ico { background: var(--grad); color: #fff; box-shadow: 0 8px 18px rgba(249, 94, 8, .3); }
.badge.earned { border-color: var(--orange-line); }
.badge.pop { animation: pop .6s ease; }
.level-ladder { padding: 8px; }
.ladder-step { display: flex; align-items: center; gap: 12px; padding: 12px 12px; border-radius: var(--r-md); color: var(--muted); }
.ladder-step b { flex: 1; font-weight: 600; }
.ladder-n { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #f1ece5; font-weight: 700; }
.ladder-step.past { color: var(--ink); }
.ladder-step.past .ladder-n { background: var(--sage); }
.ladder-step.now { color: var(--ink); background: var(--orange-soft); }
.ladder-step.now .ladder-n { background: var(--grad); color: #fff; }

.podium { display: grid; grid-template-columns: repeat(3, 1fr); align-items: end; gap: 12px; margin: 20px 0 12px; }
.podium-col { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; min-width: 0; }
.podium-col b { font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium-col small { color: var(--orange); font-weight: 700; direction: ltr; }
.podium-step { width: 100%; margin-top: 8px; border-radius: var(--r-md) var(--r-md) var(--r-sm) var(--r-sm); display: grid; place-items: center; font-size: 22px; font-weight: 800; color: var(--ink-2); }
.podium-col.p1 .podium-step { height: 96px; background: var(--yellow); }
.podium-col.p2 .podium-step { height: 70px; background: #e3e7ee; }
.podium-col.p3 .podium-step { height: 54px; background: var(--orange-line); }
.podium-col.me b { color: var(--orange); }
.board-list { padding: 8px; }
.board-row { display: flex; align-items: center; gap: 12px; padding: 12px 12px; border-radius: var(--r-md); }
.board-row.me { background: var(--orange-soft); }
.board-body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.board-body small { color: var(--muted); font-size: 12px; }

/* Training session */
.play { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.play-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: rgba(252, 250, 246, .92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); max-width: 760px; width: 100%; margin: 0 auto; }
.play-bar { flex: 1; min-width: 0; }
.segments { display: flex; gap: 4px; direction: inherit; }
.segments span { flex: 1; height: 10px; border-radius: 999px; background: #ece5dc; transition: background .3s ease; }
.segments span.now { background: var(--orange-line); }
.segments span.ok { background: var(--ok); }
.segments span.bad { background: var(--bad); }
.timer { height: 12px; border-radius: 999px; background: #ece5dc; overflow: hidden; }
.timer-fill { height: 100%; width: 100%; background: var(--grad); border-radius: inherit; transition: width .2s linear; }
.timer-fill.low { background: var(--bad); animation: blink .6s ease infinite alternate; }
.play-pills { display: flex; gap: 8px; }
.combo-pill, .xp-pill { position: relative; display: inline-flex; align-items: center; gap: 4px; padding: 8px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-weight: 700; font-size: 14px; direction: ltr; }
.combo-pill { color: var(--muted); }
.combo-pill.hot { color: #fff; background: linear-gradient(90deg, var(--orange), var(--orange)); border-color: transparent; animation: pulse 1s ease infinite; }
.xp-pill { color: var(--orange); }
.float-text { position: absolute; inset-inline-start: 50%; top: -4px; font-weight: 800; font-size: 15px; pointer-events: none; animation: float-up .9s ease forwards; }
.float-text.ok { color: var(--ok); }
.float-text.dim { color: var(--muted); }

.play-body { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 8px 16px 220px; display: flex; flex-direction: column; gap: 12px; }
.play-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px; }
.play-meta .chip { border: 1px solid var(--line); max-width: 60%; overflow: hidden; text-overflow: ellipsis; }
.question-card { position: relative; padding: 20px 20px 24px; border-radius: var(--r-lg); min-height: 170px; display: flex; flex-direction: column; justify-content: flex-end; gap: 12px; overflow: hidden; }
.q-bot { position: absolute; top: 4px; inset-inline-end: 10px; }
.q-bot.bounce { animation: bounce .6s ease; }
.q-bot.shake { animation: shake .45s ease; }
.q-type { display: inline-flex; align-self: flex-start; padding: 4px 12px; border-radius: 999px; background: rgba(255, 255, 255, .75); font-size: 12px; font-weight: 600; color: var(--ink-2); margin-inline-end: 90px; }
.q-text { font-size: 22px; font-weight: 700; line-height: 1.45; }
.q-name { color: var(--orange); font-weight: 800; }
.choices { display: grid; gap: 12px; }
.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 62px;
  padding: 12px 12px;
  border-radius: var(--r-md);
  border: 2px solid var(--line);
  background: #fff;
  text-align: start;
  font-size: 16px;
  font-weight: 600;
  transition: transform .12s ease, border-color .15s ease, background .15s ease, opacity .2s ease;
}
.choice:hover:not(:disabled) { border-color: var(--orange-line); transform: translateY(-1px); }
.choice:active:not(:disabled) { transform: scale(.98); }
.choice:disabled { cursor: default; }
.choice-key { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-sm); background: var(--bg); font-weight: 700; flex-shrink: 0; color: var(--ink-2); }
.choice-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.choice-mark { display: grid; place-items: center; width: 28px; height: 28px; flex-shrink: 0; }
.choice.is-correct { border-color: var(--ok); background: var(--ok-soft); animation: pop .35s ease; }
.choice.is-correct .choice-key { background: var(--ok); color: #fff; }
.choice.is-correct .choice-mark { color: var(--ok); }
.choice.is-wrong { border-color: var(--bad); background: var(--bad-soft); animation: shake .4s ease; }
.choice.is-wrong .choice-key { background: var(--bad); color: #fff; }
.choice.is-wrong .choice-mark { color: var(--bad); }
.choice.is-dim { opacity: .45; }
.kbd-hint { display: none; text-align: center; font-size: 12px; color: var(--muted); }
@media (hover: hover) and (pointer: fine) { .kbd-hint { display: block; } }

.sheet { position: fixed; inset: auto 0 0; z-index: 30; transform: translateY(110%); transition: transform .3s cubic-bezier(.2, .9, .3, 1.2); pointer-events: none; }
.sheet.show { transform: none; pointer-events: auto; }
.sheet-inner { max-width: 760px; margin: 0 auto; padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); border-radius: var(--r-lg) var(--r-lg) 0 0; background: #fff; box-shadow: 0 -16px 40px rgba(60, 40, 20, .14); display: grid; gap: 12px; border-top: 5px solid var(--ok); }
.sheet.bad .sheet-inner { border-top-color: var(--bad); }
.sheet-head { display: flex; align-items: center; gap: 12px; font-size: 18px; }
.sheet-head b { flex: 1; }
.sheet-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--ok); color: #fff; flex-shrink: 0; }
.sheet.bad .sheet-ico { background: var(--bad); }
.xp-gain { font-weight: 800; color: var(--orange); direction: ltr; }
.sheet-correct { font-size: 15px; color: var(--ink-2); }
.sheet-correct b { color: var(--ok); }
.drug-fact { display: grid; gap: 2px; padding: 12px 12px; border-radius: var(--r-md); background: var(--bg); font-size: 14px; color: var(--ink-2); }
.drug-fact > span[dir="ltr"] { text-align: start; }
.drug-fact b { color: var(--ink); }
.report-form { display: grid; gap: 8px; }
.report-form textarea { width: 100%; border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 12px; resize: vertical; background: var(--bg); }
.report-form .btn { justify-self: start; }
.sheet-actions { display: flex; align-items: center; gap: 8px; }

.combo-burst { position: fixed; top: 38%; inset-inline: 0; margin: 0 auto; width: max-content; display: flex; align-items: center; gap: 8px; padding: 12px 24px; border-radius: 999px; background: linear-gradient(90deg, var(--orange), var(--orange)); color: #fff; font-size: 22px; box-shadow: 0 18px 40px rgba(249, 94, 8, .4); z-index: 40; pointer-events: none; animation: burst 1.3s ease forwards; }

/* Results */
.result-hero { display: grid; justify-items: center; gap: 12px; padding: 20px; border-radius: var(--r-lg); text-align: center; }
.result-art { width: 170px; }
.result-art .mascot { margin: 0 auto; }
.result-text { display: grid; justify-items: center; gap: 8px; }
.result-text h1 { font-size: 28px; font-weight: 800; }
.result-text p { color: var(--ink-2); }
.result-ring { background: rgba(255, 255, 255, .7); border-radius: 50%; padding: 8px; }
.result-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.rtile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 8px; border-radius: var(--r-md); background: #fff; border: 1px solid var(--line); text-align: center; }
.rtile b { font-size: 22px; direction: ltr; }
.rtile small { color: var(--muted); font-size: 12px; }
.rtile-ico { display: grid; place-items: center; width: 38px; height: 38px; border-radius: var(--r-sm); }
.rtile-ico.bolt { background: var(--orange-soft); color: var(--orange); }
.rtile-ico.flame { background: var(--orange-soft); color: var(--orange); }
.rtile-ico.target { background: var(--ok-soft); color: var(--ok); }
.xp-break { margin-top: 12px; padding: 8px 16px; }
.xp-row { display: flex; justify-content: space-between; padding: 12px 0; }
.xp-row + .xp-row { border-top: 1px dashed var(--line); }
.xp-row b { color: var(--orange); direction: ltr; }
.wrong-list { padding: 8px 16px; }
.wrong-row { padding: 12px 0; display: grid; gap: 4px; }
.wrong-row + .wrong-row { border-top: 1px solid var(--line); }
.wrong-row p { font-weight: 600; }
.wrong-row small { color: var(--ink-2); }
.wrong-row small b { color: var(--ok); }
.result-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.result-actions .btn { flex: 1 1 180px; }

/* Landing */
.landing { max-width: 1200px; margin: 0 auto; padding: 0 16px 24px; }
.land-nav { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(10px + env(safe-area-inset-top, 0px)) 0 12px; background: rgba(252, 250, 246, .96); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.land-links { display: none; gap: 8px; }
.land-links button { border: 0; background: none; padding: 8px 12px; border-radius: 999px; font-weight: 500; color: var(--ink-2); }
.land-links button:hover { background: #fff; }
.land-actions { display: flex; align-items: center; gap: 8px; }
@media (max-width: 640px) {
  .land-actions .land-btn-install,
  .land-actions .land-btn-login,
  .land-actions .land-btn-logout {
    display: none !important;
  }
}
.land-hero { display: grid; gap: 32px; padding: 24px 0 40px; align-items: center; }
.land-hero-text { display: grid; gap: 16px; justify-items: start; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; background: var(--orange-soft); color: var(--orange); font-weight: 600; font-size: 13px; }
.land-hero h1 { font-size: clamp(32px, 6vw, 58px); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.lead { font-size: 17px; color: var(--ink-2); max-width: 560px; }
.land-cta { display: flex; flex-wrap: wrap; gap: 12px; }
.land-stats { display: flex; gap: 12px; flex-wrap: wrap; }
.land-stats div { display: flex; flex-direction: column; padding: 12px 16px; border-radius: var(--r-md); background: #fff; border: 1px solid var(--line); }
.land-stats b { font-size: 24px; font-weight: 800; }
.land-stats span { font-size: 13px; color: var(--muted); }
.land-devices { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 14px; flex-wrap: wrap; }
.land-hero-visual { position: relative; display: grid; place-items: center; padding: 32px 0; min-height: 560px; }
.hero-blob { position: absolute; inset: 6% 4%; border-radius: var(--r-lg); background: linear-gradient(160deg, var(--orange-tint), var(--orange-2) 60%, var(--orange-2)); }
.hero-blob::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background-image: linear-gradient(rgba(255, 255, 255, .25) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .25) 1px, transparent 1px); background-size: 28px 28px; }
.device { position: relative; width: 270px; height: 550px; padding: 12px; border-radius: var(--r-lg); background: #1d1d1f; box-shadow: var(--shadow-lg), inset 0 0 0 2px #3a3a3c; rotate: -6deg; animation: float 6s ease-in-out infinite; }
.device-notch { position: absolute; top: 20px; inset-inline: 0; margin: 0 auto; width: 90px; height: 26px; border-radius: 999px; background: #000; z-index: 2; }
.device-screen { position: relative; height: 100%; border-radius: var(--r-lg); background: var(--bg); overflow: hidden; padding: 52px 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.mini-top { display: flex; justify-content: space-between; align-items: center; }
.mini-btn { display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--r-sm); background: #fff; border: 1px solid var(--line); }
.mini-pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px 3px 3px; border-radius: var(--r-sm); background: #fff; border: 1px solid var(--line); font-size: 11px; font-weight: 700; direction: ltr; }
.mini-pill i { display: grid; place-items: center; width: 20px; height: 20px; border-radius: var(--r-sm); background: var(--yellow); }
.mini-buddy { padding: 12px; border-radius: var(--r-md); background: var(--peach); position: relative; }
.mini-buddy-text { display: flex; flex-direction: column; padding-inline-end: 50px; }
.mini-buddy-text small { font-size: 9px; color: var(--ink-2); }
.mini-buddy-text b { font-size: 13px; }
.mini-buddy-bot { position: absolute; top: -8px; inset-inline-end: 2px; }
.mini-ask { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; padding: 4px 4px 4px 12px; border-radius: 999px; background: #fff; font-size: 10px; color: var(--muted); }
.mini-ask i { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--grad); color: #fff; }
.mini-label { font-weight: 700; font-size: 12px; }
.mini-hero { position: relative; padding: 12px; border-radius: var(--r-md); background: var(--lime); display: grid; gap: 4px; flex: 1; align-content: start; }
.mini-hero b { font-size: 13px; padding-inline-end: 34px; }
.mini-go { position: absolute; bottom: 10px; inset-inline-end: 10px; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--grad); color: #fff; }
.mini-nav { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-radius: 999px; background: #fff; box-shadow: var(--shadow); }
.mini-nav i { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--bg); }
.mini-nav i.c { width: 32px; height: 32px; margin-top: -12px; background: var(--grad); color: #fff; }
.float-chip { position: absolute; display: inline-flex; align-items: center; gap: 8px; padding: 12px 12px; border-radius: 999px; background: #fff; box-shadow: var(--shadow-lg); font-weight: 700; font-size: 14px; animation: float 5s ease-in-out infinite; }
.chip-xp { top: 12%; inset-inline-start: 6%; color: var(--orange); }
.chip-streak { top: 46%; inset-inline-end: 4%; color: var(--orange-deep); animation-delay: -1.5s; }
.chip-ok { bottom: 12%; inset-inline-start: 10%; color: var(--ok); animation-delay: -3s; }
.float-mascot { position: absolute; bottom: 4%; inset-inline-end: 8%; animation: float 4.5s ease-in-out infinite; animation-delay: -2s; }

.land-features { display: grid; gap: 20px; }
.feature { display: grid; gap: 20px; padding: 24px; border-radius: var(--r-lg); background: #f6f3ee; align-items: center; }
.feature-text { display: grid; gap: 12px; }
.feature-text h2 { font-size: clamp(24px, 3.6vw, 36px); font-weight: 800; }
.feature-text p { color: var(--ink-2); font-size: 16px; max-width: 480px; }
.show-card { display: grid; gap: 12px; padding: 16px; border-radius: var(--r-lg); background: #fff; box-shadow: var(--shadow); }
.show-row { display: flex; align-items: center; gap: 12px; }
.show-row .art { width: 150px; }
.show-row b { font-size: 20px; }
.show-card .lib-head { box-shadow: none; }
.show-card .profile-tiles { margin-top: 0; }
.show-card .level-banner { margin-top: 0; }

.land-fun { padding: 60px 0 20px; text-align: center; display: grid; gap: 12px; justify-items: center; }
.land-fun h2, .land-source h2 { font-size: clamp(26px, 4vw, 40px); font-weight: 800; }
.fun-grid { display: grid; gap: 12px; width: 100%; margin-top: 16px; text-align: start; }
.fun-card { padding: 20px; border-radius: var(--r-lg); display: grid; gap: 8px; transition: transform .2s ease; }
.fun-card:hover { transform: translateY(-4px) rotate(-.5deg); }
.fun-ico { display: grid; place-items: center; width: 48px; height: 48px; border-radius: var(--r-md); background: #fff; color: var(--orange); }
.fun-card h3 { font-size: 18px; }
.fun-card p { color: var(--ink-2); font-size: 14px; }
.land-source { display: grid; gap: 20px; align-items: center; margin: 40px 0; padding: 32px; border-radius: var(--r-lg); background: #fff; border: 1px solid var(--line); }
.source-bot { justify-self: center; }
.source-text { display: grid; gap: 16px; }
.check-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.check-list li { display: flex; gap: 12px; align-items: flex-start; color: var(--ink-2); }
.check-list svg { color: var(--ok); margin-top: 2px; }
.land-band { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 32px; border-radius: var(--r-lg); background: var(--grad); color: #fff; box-shadow: 0 24px 50px rgba(249, 94, 8, .3); }
.land-band h2 { font-size: 28px; font-weight: 800; }
.land-band p { opacity: .9; }
.land-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 32px 4px 12px; color: var(--muted); font-size: 13px; }

/* Onboarding and sign-in */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 0; }
.ob-card { width: 100%; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.ob-visual { position: relative; flex: 1; min-height: 340px; display: grid; place-items: center; padding: 70px 20px 32px; border-radius: 0 0 var(--r-lg) var(--r-lg); overflow: hidden; }
.ob-top { position: absolute; top: 14px; inset-inline: 16px; display: flex; align-items: center; justify-content: space-between; }
.ob-art { position: relative; width: min(340px, 86%); }
.ob-mascot { position: absolute; bottom: -10px; inset-inline-end: -16px; animation: float 4s ease-in-out infinite; }
.ob-body { display: grid; gap: 12px; padding: 22px 20px calc(24px + env(safe-area-inset-bottom)); }
.dots { display: flex; gap: 8px; }
.dots span { width: 8px; height: 8px; border-radius: 999px; background: #e6ddd2; transition: width .2s ease; }
.dots span.on { width: 26px; background: var(--orange); }
.ob-title { font-size: 28px; font-weight: 800; line-height: 1.3; }
.ob-text { color: var(--ink-2); }
.slide-btn {
  --fill: 0;
  position: relative;
  display: flex;
  align-items: center;
  height: 60px;
  padding: 8px;
  border-radius: 999px;
  background: var(--grad);
  color: #fff;
  user-select: none;
  touch-action: pan-y;
  cursor: grab;
  box-shadow: 0 12px 26px rgba(249, 94, 8, .3);
  overflow: hidden;
}
.slide-knob { position: relative; z-index: 2; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: rgba(255, 255, 255, .28); transition: transform .25s ease; }
.slide-label { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: 16px; opacity: calc(1 - var(--fill)); }
.slide-arrows { position: absolute; inset-inline-end: 20px; display: flex; opacity: .55; animation: nudge 1.4s ease infinite; }
.slide-arrows svg + svg { margin-inline-start: -8px; }
.slide-btn.done .slide-knob { background: #fff; color: var(--orange); }
.auth-switch { text-align: center; color: var(--ink-2); font-size: 14px; }
.auth-switch a { color: var(--orange); font-weight: 700; }

.auth-wrap { width: 100%; min-height: 100vh; min-height: 100dvh; display: grid; }
.auth-art { display: none; }
.auth-card { width: 100%; max-width: 520px; margin: 0 auto; padding: calc(16px + env(safe-area-inset-top, 16px)) 16px calc(32px + env(safe-area-inset-bottom, 16px)); display: grid; gap: 16px; align-content: start; }
.auth-top { display: flex; align-items: center; justify-content: space-between; }
.auth-hero { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-radius: var(--radius); background: var(--peach); }
.auth-hero small { color: var(--ink-2); }
.auth-hero h1 { font-size: 26px; font-weight: 800; }
.auth-hero-bot { margin: -16px 0 -22px; }
.form { display: grid; gap: 12px; }
.field { display: grid; gap: 8px; }
.field-label { font-weight: 600; font-size: 14px; padding: 0 4px; }
.field-box { display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 16px; border-radius: var(--r-md); background: #fff; border: 1.5px solid var(--line); color: var(--muted); transition: border-color .15s ease, box-shadow .15s ease; }
.field-box:focus-within { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(249, 94, 8, .12); color: var(--orange); }
.field-box input { flex: 1; min-width: 0; border: 0; outline: none; background: none; height: 100%; color: var(--ink); }
[dir="rtl"] .field-box input[dir="ltr"] { text-align: right; }
.eye-btn { border: 0; background: none; color: var(--muted); display: grid; place-items: center; padding: 4px; }
.choice-group { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.choice-group .chip-tab { position: relative; }
.form-error { min-height: 20px; color: var(--bad); font-weight: 500; font-size: 14px; }
.fine { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 12px; text-align: center; }

/* Animations */
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes pop { 0% { transform: scale(.94); } 60% { transform: scale(1.03); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 35% { transform: translateY(-14px) rotate(-4deg); } 65% { transform: translateY(0) rotate(2deg); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes blink { to { opacity: .55; } }
@keyframes float-up { from { opacity: 1; transform: translate(-50%, 0); } to { opacity: 0; transform: translate(-50%, -26px); } }
@keyframes burst { 0% { opacity: 0; transform: scale(.6); } 20% { opacity: 1; transform: scale(1.08); } 70% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: translateY(-30px) scale(.96); } }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(5px); } }
[dir="rtl"] .slide-arrows { animation-name: nudge-rtl; }
@keyframes nudge-rtl { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-5px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Phones only */
@media (max-width: 480px) {
  .hide-phone { display: none; }
  .stat-pill small { display: none; }
  .q-text { font-size: 19px; }
  .result-text h1 { font-size: 24px; }
  .land-hero-visual { min-height: 500px; }
  .device { width: 240px; height: 490px; }
}

/* Tablets (iPad) and up */
@media (min-width: 720px) {
  body { font-size: 16px; }
  .page { max-width: 860px; padding: 20px 32px 140px; }
  .subject-grid, .lib-grid, .result-grid { grid-template-columns: repeat(2, 1fr); }
  .suggest-list { grid-template-columns: repeat(2, 1fr); }
  .badge-grid { grid-template-columns: repeat(3, 1fr); }
  .prog-top { grid-template-columns: 1.3fr 1fr; }
  .home-aside { grid-template-columns: repeat(2, 1fr); }
  .home-aside .level-card { grid-column: 1 / -1; }
  .result-hero { grid-template-columns: 170px 1fr auto; text-align: start; justify-items: start; align-items: center; }
  .result-text { justify-items: start; }
  .hero-card { grid-template-columns: 1fr 1.1fr; align-items: center; min-height: 240px; }
  .hero-card h2 { max-width: none; font-size: 28px; grid-row: 1; padding-inline-end: 40px; }
  .hero-art { grid-column: 2; width: 100%; }
  .question-card { min-height: 210px; padding: 32px 32px 32px; }
  .q-text { font-size: 26px; }
  .choices { grid-template-columns: repeat(2, 1fr); }
  .choice { min-height: 76px; }
  .fun-grid { grid-template-columns: repeat(2, 1fr); }
  .land-source { grid-template-columns: auto 1fr; padding: 40px; }
  .ob-card { min-height: auto; max-width: 980px; display: grid; grid-template-columns: 1fr 1fr; border-radius: var(--r-lg); overflow: hidden; background: #fff; box-shadow: var(--shadow-lg); margin: 24px; }
  .ob-visual { border-radius: 0; min-height: 600px; }
  .ob-body { align-content: center; padding: 40px; }
  .ob-title { font-size: 34px; }
  .auth-page { padding: 24px; }
}

/* Landing two-column layout */
@media (min-width: 960px) {
  .landing { padding: 0 32px 32px; }
  .land-links { display: flex; }
  .land-hero { grid-template-columns: 1.05fr 1fr; padding: 40px 0 70px; }
  .feature { grid-template-columns: 1fr 1fr; padding: 40px; gap: 40px; }
  .feature.reverse .feature-text { order: 2; }
  .fun-grid { grid-template-columns: repeat(3, 1fr); }
  .land-band { padding: 40px 48px; }
  .auth-wrap { grid-template-columns: 1fr 1fr; max-width: 1100px; min-height: auto; border-radius: var(--r-lg); overflow: hidden; background: #fff; box-shadow: var(--shadow-lg); }
  .auth-art { display: grid; align-content: space-between; gap: 16px; padding: 32px; background: linear-gradient(160deg, var(--orange-2), var(--orange) 70%); color: #fff; position: relative; overflow: hidden; }
  .auth-art .logo-mark { background: #fff; color: var(--orange); }
  .auth-art-bot { justify-self: center; animation: float 4s ease-in-out infinite; }
  .auth-art h2 { font-size: 30px; font-weight: 800; }
  .auth-art ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
  .auth-art li { display: flex; align-items: center; gap: 12px; font-weight: 500; }
  .auth-card { padding: 32px 40px; max-width: none; }
}

/* Laptops: sidebar instead of the bottom bar */
@media (min-width: 1100px) {
  .layout { display: grid; grid-template-columns: 270px 1fr; }
  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px 16px;
    background: #fff;
    border-inline-end: 1px solid var(--line);
  }
  .sidebar-logo { padding: 4px 8px; }
  .sidebar-cta { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 54px; border-radius: 999px; background: var(--grad); color: #fff; font-weight: 700; box-shadow: 0 12px 24px rgba(249, 94, 8, .3); transition: transform .15s ease; }
  .sidebar-cta:hover { transform: translateY(-2px); }
  .sidebar-nav { display: grid; gap: 4px; }
  .side-link { display: flex; align-items: center; gap: 12px; padding: 12px 12px; border-radius: var(--r-md); font-weight: 500; color: var(--ink-2); transition: background .15s ease; }
  .side-link:hover { background: var(--bg); }
  .side-link.active { background: var(--orange-soft); color: var(--orange); font-weight: 700; }
  .side-user { margin-top: auto; display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--r-md); background: var(--bg); }
  .side-user-body { flex: 1; display: grid; gap: 4px; min-width: 0; }
  .side-user-body b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .side-user-body small { color: var(--muted); font-size: 12px; }
  .bottom-nav, .hide-desktop { display: none; }
  .page { max-width: 1180px; padding: 24px 40px 60px; }
  .toasts { bottom: 30px; }
  .home-grid { grid-template-columns: minmax(0, 1fr) 340px; gap: 32px; align-items: start; }
  .home-aside { position: sticky; top: 26px; grid-template-columns: 1fr; margin-top: 62px; }
  .subject-grid, .lib-grid, .result-grid { grid-template-columns: repeat(2, 1fr); }
  .profile-grid { grid-template-columns: 1fr 1fr; align-items: start; }
  .badge-grid { grid-template-columns: repeat(4, 1fr); }
  .play-body { padding-bottom: 240px; }
}

@media (min-width: 1400px) {
  .subject-grid, .lib-grid, .result-grid { grid-template-columns: repeat(3, 1fr); }
  .home-main .subject-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Pictures (SVG) */
.vis { display: block; }
.vt { font-size: 10px; fill: #7a736a; font-family: var(--font); }
.vt-strong { fill: var(--ink); font-weight: 700; }
.q-visual { display: grid; place-items: center; padding: 8px 0; margin-inline-end: 90px; align-self: flex-start; }
.q-visual .ix { margin-inline-end: -90px; }
.choice-art { display: grid; place-items: center; flex-shrink: 0; }
.choices.two { grid-template-columns: repeat(2, 1fr); }
.preg-badge { display: inline-grid; place-items: center; border-radius: 50%; background: var(--bg); color: var(--fg); font-weight: 800; border: 2px solid var(--fg); }
.preg-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.preg-row b { min-width: 38px; font-size: 13px; color: var(--ink-2); }

.freq { display: grid; gap: 8px; margin: 4px 0 12px; }
.freq-bar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; gap: 2px; background: #ece7df; }
.freq-legend { display: flex; flex-wrap: wrap; gap: 8px 12px; font-size: 12px; color: var(--ink-2); }
.freq-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-inline-end: 5px; }

.hl-chart, .dose-clock { margin: 12px 0; }
.hl-chart svg, .dose-clock svg { direction: ltr; width: 100%; max-width: 360px; height: auto; display: block; }
.hl-chart figcaption, .dose-clock figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; }

.ix { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; padding: 12px; border-radius: var(--r-md); background: rgba(255, 255, 255, .7); }
.ix-node { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--r-md); background: #fff; border: 1px solid var(--line); font-size: 14px; max-width: 46%; }
.ix-node b { overflow-wrap: anywhere; }
.ix-mid { display: grid; place-items: center; min-width: 44px; color: var(--orange); text-align: center; }
.ix-mid.lowers { color: #3b6fd0; }
.ix-mid small { font-size: 11px; font-weight: 700; }
.ix-unknown { font-size: 28px; font-weight: 800; color: var(--muted); }
.ix-item { display: grid; gap: 8px; padding: 12px 0; }
.ix-item + .ix-item { border-top: 1px solid var(--line); }
.ix-item p { font-size: 14px; color: var(--ink-2); }

/* Matching board */
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.match-col { display: grid; gap: 8px; align-content: start; }
.match-item { min-height: 54px; padding: 8px 12px; border-radius: var(--r-md); border: 2px solid var(--line); background: #fff; text-align: center; font-weight: 600; font-size: 14px; overflow-wrap: anywhere; transition: border-color .15s ease, background .15s ease, transform .15s ease; }
.match-item:hover:not(:disabled) { border-color: var(--orange-line); }
.match-item.picked { border-color: var(--orange); background: var(--orange-soft); transform: scale(1.02); }
.match-item.solved { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); opacity: .85; }
.match-item.wrong { border-color: var(--bad); background: var(--bad-soft); animation: shake .4s ease; }
.match-hint { font-size: 13px; }

/* Answer explanation */
.sheet-inner { max-height: 82vh; overflow-y: auto; }
.explain:empty { display: none; }
.explain { display: grid; gap: 8px; padding: 12px 12px; border-radius: var(--r-md); background: var(--bg); }
.expl-row { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.expl-row p, .expl-text { font-size: 14px; color: var(--ink-2); }
.expl-text b { color: var(--ink); }

/* Drug card */
.dhead { display: flex; align-items: center; gap: 16px; padding: 20px; border-radius: var(--radius); }
.dhead-art { display: grid; place-items: center; width: 92px; height: 92px; border-radius: var(--r-lg); background: rgba(255, 255, 255, .75); flex-shrink: 0; }
.dhead-body { display: grid; gap: 8px; justify-items: start; min-width: 0; }
.dhead h1 { font-size: 26px; font-weight: 800; overflow-wrap: anywhere; }
.dhead p { color: var(--ink-2); font-size: 14px; }
.dfacts { display: grid; gap: 12px; padding: 16px 16px; margin-top: 12px; }
.dfact { display: grid; gap: 8px; }
.dfact small { color: var(--muted); font-weight: 600; }
.dfact p { font-size: 14px; color: var(--ink-2); }
.study-btn { margin: 12px 0 8px; }
.dsec { margin-top: 12px; border-radius: var(--r-md); background: #fff; border: 1px solid var(--line); overflow: hidden; }
.dsec summary { display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; list-style: none; }
.dsec summary::-webkit-details-marker { display: none; }
.dsec summary b { flex: 1; }
.dsec-ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-sm); background: var(--orange-soft); color: var(--orange); }
.dsec-arrow { color: var(--muted); transition: transform .2s ease; transform: rotate(90deg); }
.dsec[open] .dsec-arrow { transform: rotate(-90deg); }
.dsec-body { padding: 4px 16px 16px; display: grid; gap: 12px; }
.chip-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-cloud .chip { background: var(--bg); border: 1px solid var(--line); }
.mini-h { font-size: 14px; margin-top: 8px; color: var(--ink-2); }
.ind { display: grid; gap: 4px; justify-items: start; padding: 12px 12px; border-radius: var(--r-md); background: var(--bg); }
.ind p { font-size: 14px; color: var(--ink-2); }
.kv { display: grid; gap: 2px; }
.kv p { font-size: 14px; color: var(--ink-2); }
.organ-card { display: flex; align-items: center; gap: 12px; padding: 12px 12px; border-radius: var(--r-md); background: var(--bg); }
.organ-card p { font-size: 14px; color: var(--ink-2); }
.tier { display: grid; gap: 8px; }
.tier b { font-size: 13px; color: var(--ink-2); }
.tier-common .chip-cloud .chip { background: var(--orange-soft); border-color: var(--orange-line); }
.plain-list { margin: 0; padding-inline-start: 20px; display: grid; gap: 8px; font-size: 14px; color: var(--ink-2); }
.brand-lines { display: grid; gap: 8px; }
.brand-line { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: var(--r-md); background: var(--bg); }
.brand-line > div { flex: 1; min-width: 0; display: grid; }
.brand-line small { color: var(--muted); }
.dnote { margin-top: 16px; font-size: 12px; }
.result-actions-row { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.result-foot .pill-btn { background: #fff; }
.result-foot .pill-btn.hot { background: var(--grad); }
.chip svg.vis { margin-inline-end: 2px; }

@media (min-width: 720px) {
  .match-item { min-height: 62px; font-size: 15px; }
  .dsec-body { grid-template-columns: 1fr; }
}
@media (min-width: 1100px) {
  .dcard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
}

/* Lessons */
.lesson-head { display: flex; align-items: center; gap: 16px; padding: 20px; border-radius: var(--radius); margin-bottom: 16px; }
.lesson-head-art { display: grid; place-items: center; width: 84px; height: 84px; flex-shrink: 0; background: none; }
.lesson-head h1 { font-size: 22px; font-weight: 800; }
.lesson-head p { color: var(--ink-2); font-size: 14px; }
.stage-path { display: grid; gap: 12px; margin-bottom: 16px; }
.stage { display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: var(--r-lg); background: #fff; border: 1px solid var(--line); }
.stage-n { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--bg); font-weight: 800; flex-shrink: 0; }
.stage-body { flex: 1; display: grid; gap: 8px; min-width: 0; }
.stage-body b { font-size: 16px; }
.stage-body small { color: var(--ink-2); font-size: 13px; }
.stage-meta { color: var(--muted) !important; }
.stage-passed .stage-n { background: var(--ok); color: #fff; }
.stage-open .stage-n { background: var(--grad); color: #fff; }
.stage-locked { opacity: .6; }
.stage-lock { color: var(--muted); }
.contrast { display: grid; gap: 8px; padding: 12px; border-radius: var(--r-md); background: var(--bg); }
.contrast-row { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: baseline; font-size: 14px; }
.contrast-row small { grid-column: 2; color: var(--muted); font-size: 12px; }
.contrast-label { font-weight: 700; color: var(--ink-2); font-size: 13px; }
.lesson-head { width: 100%; box-sizing: border-box; }
.lesson-head > div:last-child { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.lesson-head-art svg { max-width: 100%; height: auto; }

/* Subjects that are outside the plan, the plan card, and the admin panel */
.subject-card.is-locked { opacity: .7; }
.pick-card { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--r-md); background: var(--peach); color: var(--ink); }
.pick-card > span { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.pick-card small { color: var(--ink-2); font-size: 13px; }
.upgrade-card { display: grid; justify-items: center; text-align: center; gap: 12px; padding: 32px 20px; margin-top: 12px; }
.upgrade-card h2 { font-size: 20px; font-weight: 800; }
.upgrade-card p { color: var(--ink-2); max-width: 420px; }
.btn-danger { background: var(--bad-soft); color: var(--bad); }
.admin { display: grid; gap: 12px; }
.admin-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.admin-stats .stat { display: grid; gap: 2px; padding: 12px; text-align: center; }
.admin-stats .stat b { font-size: 24px; font-weight: 800; direction: ltr; }
.admin-stats .stat span { color: var(--muted); font-size: 13px; }
.admin-bulk { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-list { display: grid; gap: 12px; }
.admin-row { display: grid; gap: 12px; padding: 12px; }
.admin-row.is-off { opacity: .65; }
.admin-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.admin-body { display: grid; gap: 3px; min-width: 0; flex: 1; }
.admin-body b { overflow-wrap: anywhere; }
.admin-body small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.admin-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-actions .btn { min-height: 34px; }
@media (min-width: 720px) {
  .admin-stats { grid-template-columns: repeat(4, 1fr); }
  .admin-row { grid-template-columns: 1fr auto; align-items: center; }
}



/* ---- Native phone feel ---- */
html, body { overscroll-behavior-y: none; -webkit-tap-highlight-color: transparent; }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea, select, [contenteditable] { -webkit-user-select: text; user-select: text; }
input, textarea, select { font-size: 16px; }
.page { animation: page-in .28s cubic-bezier(.2, .8, .2, 1); }
@keyframes page-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.bottom-nav { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
.page { padding-bottom: calc(130px + env(safe-area-inset-bottom)); }
.icon-btn, .nav-btn, .btn, .chip-tab, .choice, .suggest, .subject-card, .stage, .start-hero { touch-action: manipulation; }
.btn:active, .subject-card:active, .suggest:active, .start-hero:active, .choice:active { transform: scale(.98); }

/* ---- Start card ("ابدأ التدريب") ---- */
.start-hero {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 176px;
  padding: 20px 20px 20px 16px;
  border-radius: var(--r-lg);
  overflow: hidden;
  color: var(--ink);
  background: linear-gradient(135deg, var(--orange-soft) 0%, var(--orange-tint) 55%, var(--orange-2) 100%);
  box-shadow: 0 18px 40px rgba(249, 94, 8, .18);
}
.start-hero::after {
  content: '';
  position: absolute;
  inset-inline-end: -40px;
  top: -40px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .35);
  pointer-events: none;
}
.start-text { position: relative; z-index: 1; flex: 1; display: grid; gap: 8px; min-width: 0; justify-items: start; }
.start-kicker { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px; border-radius: 999px; background: rgba(255, 255, 255, .8); font-size: 12px; font-weight: 700; color: var(--orange); }
.start-text h2 { font-size: 26px; font-weight: 800; line-height: 1.2; }
.start-text p { font-size: 15px; color: var(--ink-2); }
.start-cta { margin-top: 8px; display: inline-flex; align-items: center; gap: 8px; padding: 12px 16px; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 700; font-size: 14px; }
.start-bot { position: relative; z-index: 1; flex-shrink: 0; width: 118px; animation: float 4s ease-in-out infinite; }
.start-bot svg { width: 100%; height: auto; }

/* ---- Side menu (phones) ---- */
.drawer-wrap { position: fixed; inset: 0; z-index: 80; pointer-events: none; }
.drawer-wrap:not([hidden]) { pointer-events: auto; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(28, 27, 25, .35); opacity: 0; transition: opacity .28s ease; }
.drawer {
  position: absolute;
  top: 0;
  bottom: 0;
  inset-inline-start: 0;
  width: min(84vw, 330px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: calc(22px + env(safe-area-inset-top)) 16px calc(18px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-radius: 0 var(--r-lg) var(--r-lg) 0;
  box-shadow: 0 0 40px rgba(28, 27, 25, .18);
  transform: translateX(var(--off, 105%));
  transition: transform .28s cubic-bezier(.2, .8, .2, 1);
}
:root[dir="ltr"] .drawer { border-radius: var(--r-lg) 0 0 var(--r-lg); --off: -105%; }
:root[dir="rtl"] .drawer, :root:not([dir]) .drawer { --off: 105%; }
.drawer-wrap.open .drawer { transform: translateX(0); }
.drawer-wrap.open .drawer-backdrop { opacity: 1; }
.drawer-user { display: flex; align-items: center; gap: 12px; padding: 12px; margin-bottom: 8px; border-radius: var(--r-md); background: #fff; border: 1px solid var(--line); }
.drawer-user > div { display: grid; min-width: 0; }
.drawer-user b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-user small { color: var(--muted); font-size: 12px; }
.drawer-nav { display: grid; gap: 4px; }
.drawer-link { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 12px; border-radius: var(--r-md); color: var(--ink); font-weight: 600; font-size: 16px; background: none; border: 0; width: 100%; text-align: start; }
.drawer-link span { flex: 1; }
.drawer-link:active { background: #fff; }
.drawer-link.active { background: var(--orange-soft); color: var(--orange); }
.drawer-arrow { color: var(--muted); }
.drawer-out { margin-top: auto; color: var(--bad); }

/* ---- Confirm sheet (replaces the browser dialog) ---- */
.sheet-wrap { position: fixed; inset: 0; z-index: 90; pointer-events: none; }
.sheet-wrap.open { pointer-events: auto; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(28, 27, 25, .4); opacity: 0; transition: opacity .25s ease; }
.confirm-sheet {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  margin: 0 auto;
  width: min(480px, 100%);
  display: grid;
  gap: 12px;
  padding: 12px 20px calc(20px + env(safe-area-inset-bottom));
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: #fff;
  box-shadow: 0 -16px 40px rgba(28, 27, 25, .16);
  transform: translateY(105%);
  transition: transform .28s cubic-bezier(.2, .8, .2, 1);
}
.sheet-wrap.open .confirm-sheet { transform: none; }
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.confirm-sheet .grab { justify-self: center; width: 44px; height: 5px; border-radius: 999px; background: #e2dbd1; margin-bottom: 8px; }
.confirm-sheet h3 { font-size: 20px; font-weight: 800; text-align: center; }
.confirm-sheet p { text-align: center; color: var(--ink-2); font-size: 15px; margin-bottom: 8px; }
.btn-danger-solid { background: var(--bad); color: #fff; box-shadow: 0 10px 22px rgba(229, 72, 77, .25); }

/* ---- Admin area ---- */
.admin-layout .page { padding-top: calc(14px + env(safe-area-inset-top)); }
.admin-search { margin-top: 4px; }
.admin-plan { display: grid; gap: 12px; padding: 16px; }
.admin-plan h3 { font-size: 17px; font-weight: 800; }
.admin-plan p { color: var(--ink-2); font-size: 14px; }
.topbar-spacer { width: 46px; height: 46px; flex-shrink: 0; }


/* ---- Admin dashboard ---- */
.vt { font-size: 10px; fill: #7a736a; font-family: var(--font); }
.chart { width: 100%; height: auto; display: block; }
.admin-panel { display: grid; gap: 12px; padding: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-head h3 { font-size: 16px; font-weight: 800; }
.split { display: flex; height: 14px; border-radius: 999px; overflow: hidden; gap: 2px; background: #ece7df; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 12px; font-size: 13px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-inline-end: 5px; }
.subj-row { display: grid; grid-template-columns: 1fr 1fr auto; align-items: center; gap: 12px; }
.subj-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subj-acc { font-size: 13px; font-weight: 800; direction: ltr; min-width: 40px; text-align: end; }
.recent-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px; border-radius: var(--r-md); background: none; border: 0; text-align: start; color: var(--ink); }
.recent-row:active { background: var(--bg); }
.recent-body { flex: 1; display: grid; min-width: 0; }
.recent-body small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.admin-row { display: grid; gap: 12px; padding: 12px; width: 100%; text-align: start; color: var(--ink); cursor: pointer; }
.admin-row .admin-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.admin-row .admin-body { display: grid; gap: 3px; min-width: 0; flex: 1; }
.admin-open { display: flex; align-items: center; justify-content: flex-end; gap: 4px; color: var(--orange); font-weight: 700; font-size: 13px; }
.admin-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0; }
.sheet-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sheet-stats div { display: grid; gap: 2px; padding: 12px 4px; border-radius: var(--r-md); background: var(--bg); text-align: center; }
.sheet-stats b { font-size: 17px; font-weight: 800; direction: ltr; }
.sheet-stats span { font-size: 11px; color: var(--muted); }
.sheet-subjects { display: grid; gap: 8px; }
.sheet-meta { font-size: 13px; text-align: center; }
.action-sheet .action-list { display: grid; gap: 8px; }
.action-item { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 0 16px; border-radius: var(--r-md); background: var(--bg); border: 1px solid var(--line); color: var(--ink); font-weight: 700; font-size: 16px; width: 100%; text-align: start; }
.action-item span { flex: 1; }
.admin-list { display: grid; gap: 12px; }
.admin-users-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.admin-users-bar .admin-search { flex: 1; margin: 0; }
.admin-create-btn { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; height: 48px; padding: 0 16px; border-radius: var(--r-md); font-weight: 700; white-space: nowrap; }
.filter-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }



/* ---- App behaviour: one scroll container, no scroll bars, no zoom, no selection ---- */
html, body { height: 100%; overflow: hidden; touch-action: pan-x pan-y; }
body { position: fixed; inset: 0; width: 100%; }
#app { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; }
* { scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { display: none; width: 0; height: 0; }
img, svg, a, button { -webkit-user-drag: none; user-drag: none; }

/* ---- One header and one gutter on every screen ---- */
.page { --gutter: 16px; padding-top: 0; }
@media (min-width: 720px) { .page { --gutter: 28px; } }
@media (min-width: 1100px) { .page { --gutter: 40px; } }
.topbar {
  position: sticky;
  top: 0;
  z-index: 12;
  margin: 0 calc(var(--gutter) * -1) 12px;
  padding: 8px var(--gutter);
  padding-top: calc(8px + env(safe-area-inset-top));
  background: rgba(252, 250, 246, .9);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

/* ---- More colour on the start card ---- */
.start-hero { background: linear-gradient(135deg, var(--orange-tint) 0%, var(--orange-2) 100%); box-shadow: 0 18px 36px rgba(249, 94, 8, .24); }
.start-hero::after { background: rgba(255, 255, 255, .28); }
.start-cta { background: var(--ink); color: #fff; }

/* ---- Study cards, interaction checker, reminder ---- */
.study-link { margin-bottom: 12px; }
.study-stage { margin: 16px 0; }
.flip { perspective: 1200px; cursor: pointer; }
.flip-inner { position: relative; min-height: 300px; transition: transform .45s cubic-bezier(.2, .8, .2, 1); transform-style: preserve-3d; }
.flip.is-flipped .flip-inner { transform: rotateY(180deg); }
.flip-face {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 24px;
  border-radius: var(--r-lg);
  text-align: center;
  border: 1px solid var(--line);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.flip-front small, .flip-back small { color: var(--ink-2); font-weight: 700; font-size: 13px; }
.flip-front b { font-size: 28px; font-weight: 800; }
.flip-front span { color: var(--ink-2); font-size: 14px; margin-top: -4px; }
.flip-front em { margin-top: 12px; font-style: normal; font-size: 13px; color: var(--muted); }
.flip-back { transform: rotateY(180deg); background: #fff; }
.flip-generic { font-size: 28px; font-weight: 800; overflow-wrap: anywhere; }
.flip-meta { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 14px; }
.study-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.study-actions[hidden] { display: none; }

.checker { display: grid; gap: 16px; padding: 16px; margin-top: 12px; }
.picker { display: grid; gap: 8px; }
.picker small { font-weight: 700; color: var(--ink-2); font-size: 13px; }
.picker-chip { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 8px 8px 16px; border-radius: var(--r-md); background: var(--orange-soft); }
.suggest-box { display: grid; gap: 4px; }
.suggest-item { text-align: start; min-height: 46px; padding: 0 16px; border-radius: var(--r-md); border: 1px solid var(--line); background: #fff; font-weight: 600; color: var(--ink); }
.suggest-item:active { background: var(--bg); }
.checker-result { display: grid; gap: 12px; margin-top: 12px; }
.checker-none { display: flex; gap: 12px; padding: 16px; border-radius: var(--r-md); background: var(--ok-soft); color: var(--ink); }
.checker-none p { font-size: 14px; color: var(--ink-2); margin-top: 4px; }
.remind-card { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-top: 12px; border-radius: var(--r-md); background: var(--orange-soft); color: var(--ink); }
.remind-card > span { flex: 1; display: grid; }
.remind-card small { color: var(--ink-2); font-size: 13px; }
.remind-card svg:first-child { color: var(--orange); }

/* ---- Phone home and profile ---- */
.greet { font-size: 22px; font-weight: 800; margin: 4px 2px 12px; }
.goal-row { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 14px; border-radius: var(--r-lg); background: #fff; border: 1px solid var(--line); }
.goal-row .goal-body { flex: 1; display: grid; min-width: 0; }
.goal-row .goal-body b { font-size: 15px; }
.goal-row .goal-body small { color: var(--muted); font-size: 12px; }
.goal-row .goal-streak { display: grid; justify-items: center; padding: 6px 12px; border-radius: var(--r-md); background: var(--orange-soft); }
.goal-row .goal-streak b { font-size: 18px; }
.goal-row .goal-streak small { font-size: 11px; color: var(--ink-2); }
.subject-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.subject-tile { position: relative; display: grid; gap: 8px; min-height: 104px; padding: 14px; border-radius: var(--r-lg); color: var(--ink); align-content: space-between; }
.subject-tile .tile-name { font-size: 15px; font-weight: 800; line-height: 1.3; }
.subject-tile .tile-meta { font-size: 12px; color: var(--ink-2); }
.subject-tile.is-locked { opacity: .6; }
.subject-tile .tile-lock { position: absolute; top: 12px; inset-inline-end: 12px; color: var(--ink-2); }
.profile-head { display: flex; align-items: center; gap: 14px; padding: 4px 2px 0; }
.profile-head .profile-id { display: grid; gap: 4px; min-width: 0; justify-items: start; }
.profile-head h1 { font-size: 20px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.profile-head small { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.profile-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0 12px; }
.profile-stats div { display: grid; gap: 2px; justify-items: center; padding: 14px 6px; border-radius: var(--r-lg); background: #fff; border: 1px solid var(--line); }
.profile-stats b { font-size: 22px; font-weight: 800; direction: ltr; }
.profile-stats span { font-size: 12px; color: var(--ink-2); }
.group-title { font-size: 13px; font-weight: 700; color: var(--muted); margin: 20px 4px 8px; }
.settings-list .setting { min-height: 56px; padding: 10px 14px; border-radius: var(--r-md); }
.settings-list .setting > .mini-select { flex-shrink: 0; max-width: 46%; min-width: 0; padding: 8px 10px; font-size: 14px; }
.settings-list .setting-body small { white-space: normal; }
.btn-signout { margin-top: 20px; }

/* ---- Choice sheet and picker buttons ---- */
.pick-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; max-width: 100%; padding: 0 12px 0 14px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); color: var(--ink); font-weight: 700; font-size: 14px; flex-shrink: 0; }
.pick-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.choice-sheet { max-height: 80vh; display: flex; flex-direction: column; gap: 10px; }
.choice-sheet h3 { flex-shrink: 0; }
.choice-list { display: grid; gap: 8px; overflow-y: auto; max-height: 56vh; padding: 2px; }
.choice-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; padding: 10px 16px; border-radius: var(--r-md); background: #fff; border: 1.5px solid var(--line); color: var(--ink); text-align: start; width: 100%; }
.choice-item:active { background: var(--bg); }
.choice-item[disabled] { opacity: .55; }
.choice-item.selected { border-color: var(--orange); background: var(--orange-soft); }
.choice-item.selected svg { color: var(--orange); }
.choice-text { display: grid; min-width: 0; }
.choice-text b { font-size: 16px; font-weight: 700; }
.choice-text small { color: var(--muted); font-size: 12px; }

/* ---- Landing: real screenshots ---- */
.landing { max-width: 980px; margin: 0 auto; padding: 0 20px 40px; }
.land-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; }
.land-actions { display: flex; align-items: center; gap: 8px; }
.land-hero { padding: 28px 0 24px; display: grid; gap: 14px; }
.land-hero h1 { font-size: clamp(30px, 6vw, 48px); font-weight: 800; line-height: 1.2; }
.land-hero .lead { color: var(--ink-2); font-size: 17px; max-width: 560px; }
.land-cta { display: flex; flex-wrap: wrap; gap: 10px; }
.shot { margin: 0; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); background: #fff; box-shadow: 0 12px 28px rgba(60, 40, 20, .08); }
.shot img { display: block; width: 100%; height: auto; }
.land-shots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 16px 0 32px; }
.land-point { display: grid; gap: 20px; align-items: center; margin: 36px 0; }
.land-point-text h2 { font-size: 24px; font-weight: 800; margin-bottom: 8px; }
.land-point-text p { color: var(--ink-2); font-size: 16px; max-width: 520px; }
.land-band { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 24px; margin: 40px 0 24px; border-radius: var(--r-lg); background: var(--ink); color: #fff; }
.land-band h2 { font-size: 22px; font-weight: 800; }
.land-band p { opacity: .8; }
.land-band .btn-white { color: var(--ink); }
.land-foot { color: var(--muted); font-size: 13px; text-align: center; padding: 12px 0 0; }
@media (max-width: 719px) {
  .land-shots { grid-template-columns: 1fr 1fr; }
  .land-shots .shot:last-child { display: none; }
}
@media (min-width: 720px) {
  .land-point { grid-template-columns: 1fr 260px; }
  .land-point:nth-of-type(even) { grid-template-columns: 260px 1fr; }
  .land-point:nth-of-type(even) .land-point-text { order: 2; }
}

/* ---- Full screen on phones, a compact layout, and the home header ---- */
.app-head { display: flex; align-items: center; gap: 10px; padding: 6px 0 2px; }
.app-head-icon { width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; }
.app-head-title { flex: 1; min-width: 0; font-size: 19px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page { --gutter: 14px; padding-top: 8px; }
@media (max-width: 1099px) {
  .bottom-nav { inset: auto 0 0; width: 100%; max-width: none; border-radius: 22px 22px 0 0; border: 0; border-top: 1px solid var(--line); padding: 6px 12px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 20px rgba(60, 40, 20, .06); background: rgba(255, 255, 255, .97); }
  .nav-btn { width: 46px; height: 46px; }
  .nav-center { width: 58px; height: 58px; margin-top: -22px; }
  .page { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
}
/* Tighter cards: less padding, smaller gaps between sections. */
.start-hero { min-height: 136px; padding: 16px 16px 16px 14px; border-radius: var(--r-lg); }
.start-bot { width: 92px; }
.start-text h2 { font-size: 22px; }
.start-cta { margin-top: 4px; padding: 9px 14px; font-size: 13px; }
.goal-row { margin-top: 10px; padding: 10px 12px; }
.suggest { padding: 9px 12px; border-radius: var(--r-md); gap: 10px; }
.suggest-ico { width: 40px; height: 40px; border-radius: var(--r-sm); }
.suggest-list { gap: 8px; }
.section-head { margin: 16px 2px 8px; }
.subject-tiles { gap: 8px; }
.subject-tile { min-height: 84px; padding: 11px; border-radius: var(--r-md); }
.subject-tile .tile-name { font-size: 14px; }
.profile-head { gap: 12px; }
.profile-stats { margin: 12px 0 8px; gap: 8px; }
.profile-stats div { padding: 9px 4px; border-radius: var(--r-md); }
.profile-stats b { font-size: 19px; }
.level-banner { margin-top: 8px; padding: 10px; border-radius: var(--r-md); }
.group-title { margin: 14px 4px 6px; }
.settings-list { gap: 6px; }
.settings-list .setting { min-height: 50px; padding: 8px 12px; gap: 10px; border-radius: var(--r-md); }
.settings-list .setting-ico { width: 36px; height: 36px; border-radius: var(--r-sm); }
.settings-list .setting-body b { font-size: 15px; }
.settings-list .setting-body small { font-size: 12px; line-height: 1.35; }
.pick-btn { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn-signout { margin-top: 14px; min-height: 48px; }
.choice-item { min-height: 52px; padding: 8px 14px; }

/* ---- Capsule navigation, content kept above it, and a quieter header ---- */
@media (max-width: 1099px) {
  .bottom-nav { inset: auto 0 calc(12px + env(safe-area-inset-bottom)); margin: 0 auto; width: min(420px, calc(100% - 28px)); max-width: 420px; border-radius: 999px; border: 1px solid var(--line); padding: 10px 14px; box-shadow: var(--shadow-lg); background: rgba(255, 255, 255, .92); }
  .nav-btn { width: 50px; height: 50px; }
  .nav-center { width: 64px; height: 64px; margin-top: -26px; }
  .page { padding-bottom: calc(118px + env(safe-area-inset-bottom)); }
}
.app-head { gap: 8px; padding: 4px 0 0; }
.app-head-icon { width: 28px; height: 28px; border-radius: 8px; }
.app-head-title { font-size: 15px; font-weight: 600; color: var(--ink-2); }
.app-head .icon-btn { width: 36px; height: 36px; background: none; border: 0; box-shadow: none; }
.start-kicker { display: none; }

/* ---- Room for the nav bar at the end of every screen ---- */
.page::after { content: ''; display: block; height: calc(100px + env(safe-area-inset-bottom)); }

/* ---- Profile header ---- */
.profile-hero { display: grid; justify-items: center; gap: 6px; padding: 18px 16px 16px; border-radius: var(--r-lg); background: #fff; border: 1px solid var(--line); text-align: center; }
.profile-hero h1 { font-size: 20px; font-weight: 800; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-hero small { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.profile-hero .chip { margin-top: 4px; }
.avatar-ring { padding: 4px; border-radius: 50%; background: conic-gradient(#f95e08, var(--orange-2), #f95e08); }
.avatar-ring .avatar { border: 3px solid #fff; }

/* ---- One spacing system and smaller text ---- */
body { font-size: 14px; }
.page { display: flex; flex-direction: column; gap: 16px; }
.page > * { margin: 0 !important; }
.page > .topbar { margin: 0 calc(var(--gutter) * -1) !important; }
.suggest-list, .subject-tiles, .settings-list, .admin-list, .lib-grid, .result-grid, .subject-grid, .stage-path, .badge-grid, .subject-list { gap: 10px; }
.topbar { gap: 10px; }
.topbar-title { font-size: 16px; font-weight: 700; }
.section-title { font-size: 17px; }
.section-head { margin: 0; }
.setting-body b, .suggest-body b { font-size: 14px; }
.subject-tile .tile-name { font-size: 13px; }
.profile-hero h1 { font-size: 18px; }
.start-text h2 { font-size: 20px; }
.q-text { font-size: 20px; }
.choice { font-size: 15px; }
.app-head-title { font-size: 14px; }
.goal-row .goal-body b { font-size: 14px; }

/* ---- Horizontal chip rows run edge to edge, with no hard cut at the gutter ---- */
.filter-row, .chip-row, .subject-chips { margin: 0 calc(var(--gutter) * -1); padding: 4px var(--gutter); scroll-padding: 0 var(--gutter); }

/* ---- Centre button: white, with Capsy\x27s head ---- */
.nav-center { background: #ffffff; border: 2px solid var(--orange); box-shadow: 0 10px 22px rgba(249, 94, 8, .28); }
.nav-center .capsy-face { display: block; }

/* ---- Subject tiles: the lock stays visible, long names wrap ---- */
.subject-tile .tile-name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.subject-tile .tile-lock { position: static; order: -1; justify-self: start; color: var(--ink-2); }

/* ---- Header: solid, with no line, so content does not show through ---- */
.topbar { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none; border: 0; }

/* ---- Filter chips: soft pills, no borders ---- */
.filter-row { gap: 8px; }
.filter-row .chip-tab { border: 0; background: #efe9e1; color: var(--ink-2); font-size: 13px; font-weight: 600; min-height: 36px; padding: 0 14px; box-shadow: none; }
.filter-row .chip-tab.active { background: var(--orange); color: #fff; box-shadow: none; }

/* ---- Landing: the live app in a phone frame, with tabs to switch screens ---- */
.demo-tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 16px 0 14px; }
.demo-tab { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 0; background: #efe9e1; color: var(--ink-2); font-weight: 600; font-size: 13px; }
.demo-tab.active { background: var(--orange); color: #fff; }
.land-points { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin: 32px 0; }
.land-points .card { padding: 18px; display: grid; gap: 6px; }
.land-points h2 { font-size: 17px; font-weight: 800; }
.land-points p { color: var(--ink-2); font-size: 14px; }
/* The live app keeps a real phone size (390 x 800) and is scaled to fit, inside a phone frame. */
.demo-device { --s: .85; width: calc(390px * var(--s) + 20px); max-width: 100%; box-sizing: border-box; margin: 0 auto; padding: 10px; border-radius: 46px; background: #1c1b19; box-shadow: 0 24px 60px rgba(60, 40, 20, .22); direction: ltr; }
.demo-screen { width: calc(390px * var(--s)); height: calc(800px * var(--s)); border-radius: 36px; overflow: hidden; background: var(--bg); }
.demo-screen iframe { display: block; width: 390px; height: 800px; border: 0; transform: scale(var(--s)); transform-origin: 0 0; }

/* ---- Every screen scrolls as one full page: the header moves with the content, nothing is cut at the top ---- */
html { background: var(--bg); }
.topbar { position: relative; top: auto; }
.topbar-start { flex: 1; min-width: 0; }
.topbar-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Filter row on the search screen runs from screen edge to screen edge ---- */
.page > .filter-row { margin: 0 calc(var(--gutter) * -1) !important; padding: 2px var(--gutter); scroll-padding: 0 var(--gutter); }

/* ---- Home start card: flat, no glow spilling onto the cards below ---- */
.start-hero { box-shadow: none; }

/* ---- Answer sheet: a floating card clear of the screen edges, long names wrap ---- */
.sheet { inset: auto 10px calc(10px + env(safe-area-inset-bottom)); transform: translateY(calc(100% + 40px)); }
.sheet.show { transform: none; }
.sheet-inner, .sheet.bad .sheet-inner { max-width: 620px; max-height: 72vh; padding: 12px; gap: 10px; border: 0; border-radius: 26px; box-shadow: 0 14px 44px rgba(28, 27, 25, .2); }
.sheet-head { padding: 10px 12px; border-radius: 18px; background: var(--ok-soft); font-size: 16px; gap: 10px; }
.sheet.bad .sheet-head { background: var(--bad-soft); }
.sheet-head b { min-width: 0; overflow-wrap: anywhere; }
.sheet-ico { width: 34px; height: 34px; }
.xp-gain { flex-shrink: 0; padding: 3px 10px; border-radius: 999px; background: #fff; font-size: 13px; }
.sheet-correct { padding: 0 4px; font-size: 14px; }
.sheet-inner > *, .drug-fact > *, .contrast-row > *, .expl-row > *, .expl-text, .sheet-correct b { min-width: 0; overflow-wrap: anywhere; }
.sheet-actions .btn-primary { box-shadow: none; }

/* ---- Calmer screens: no watermark letters, plain rows, clear drug names ---- */
.swoosh::before, .lib-head::before { display: none; }
.q-type { margin-inline-end: 90px; max-width: calc(100% - 90px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-text { font-size: 19px; line-height: 1.6; margin-inline-end: 90px; }
.lib-title { font-size: 18px; font-weight: 800; overflow-wrap: anywhere; }
.lib-brands { font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
.lib-kind { font-size: 12px; color: var(--muted); font-weight: 600; }
.flip-back b { font-size: 20px; font-weight: 800; }
.flip-back span { font-size: 14px; color: var(--ink-2); }
.organ-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px; border-radius: var(--r-md); background: var(--bg); }
.organ-row b { display: block; margin-bottom: 2px; }
.organ-row p { font-size: 14px; color: var(--ink-2); }
.organ-row .tag { flex-shrink: 0; }
.tag.bad { background: var(--bad-soft); color: var(--bad); }

/* ---- Clinical tools: a clear strength table, a collapsed English summary ---- */
.iv-table { display: grid; gap: 6px; margin-top: 10px; }
.iv-row { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; align-items: baseline; padding: 10px 12px; border-radius: var(--r-md); background: var(--bg); font-size: 14px; }
.iv-row b { font-weight: 800; white-space: nowrap; }
.iv-row small { color: var(--muted); font-weight: 600; white-space: nowrap; }
.preg-more { margin-top: 10px; }
.preg-more summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.preg-more p { margin-top: 6px; font-size: 13px; line-height: 1.6; color: var(--ink-2); }

/* ---- IV dilution: compatible and incompatible solutions, each in its own colour ---- */
.iv-group { display: grid; gap: 6px; margin-top: 10px; padding: 10px 12px; border-radius: var(--r-md); font-size: 13px; }
.iv-group b { font-weight: 800; }
.iv-group.ok { background: var(--ok-soft); }
.iv-group.ok b { color: var(--ok); }
.iv-group.bad { background: var(--bad-soft); }
.iv-group.bad b { color: var(--bad); }
.iv-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.iv-chips .chip { font-size: 12px; }

/* ---- Clinical lists: cards stay inside the screen and long text wraps ---- */
.iv-list, .preg-list { grid-template-columns: minmax(0, 1fr); }
.iv-list > *, .preg-list > * { min-width: 0; max-width: 100%; box-sizing: border-box; }
.iv-row b, .iv-row small { white-space: normal; overflow-wrap: anywhere; }

/* ---- Home: one subject, three stages, one button ---- */
.path-card { display: grid; gap: 12px; padding: 14px; border-radius: var(--r-lg); }
.path-top { display: flex; align-items: center; gap: 10px; }
.path-ico { display: grid; place-items: center; width: 52px; height: 52px; flex-shrink: 0; background: none; }
.path-title { flex: 1; min-width: 0; display: grid; gap: 2px; }
.path-title small { color: var(--ink-2); font-size: 12px; font-weight: 600; }
.path-title h2 { font-size: 17px; font-weight: 800; overflow-wrap: anywhere; }
.path-steps { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; }
.path-step { flex: 1; display: grid; justify-items: center; gap: 4px; padding: 8px 4px; border-radius: var(--r-md); background: rgba(255, 255, 255, .55); font-size: 12px; font-weight: 600; text-align: center; color: var(--ink-2); }
.path-dot { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: rgba(28, 27, 25, .1); font-size: 12px; font-weight: 800; }
.path-step.is-done .path-dot { background: var(--ok); color: #fff; }
.path-step.is-now { background: #fff; color: var(--ink); }
.path-step.is-now .path-dot { background: var(--orange); color: #fff; }
.path-done { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.path-link { justify-self: center; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.pick-card { width: 100%; text-align: start; }
.tool-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.tool-tile { display: grid; justify-items: center; gap: 4px; padding: 10px 2px; border-radius: var(--r-md); font-size: 11px; font-weight: 700; text-align: center; }
@media (max-width: 390px) {
  .tool-row { gap: 4px; }
  .tool-tile { padding: 8px 1px; font-size: 10px; }
  .tool-tile span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
}

/* ---- Pregnancy: the allowed list and the card game ---- */
.preg-rule { display: grid; gap: 10px; padding: 16px; border-radius: var(--r-lg); background: var(--peach); }
.preg-rule h1 { font-size: 20px; font-weight: 800; }
.preg-rule p { font-size: 14px; color: var(--ink-2); line-height: 1.6; }
.preg-card { display: grid; gap: 6px; justify-items: center; text-align: center; padding: 28px 16px; border-radius: var(--r-lg); background: #fff; border: 1px solid var(--line); }
.preg-card h2 { font-size: 24px; font-weight: 800; overflow-wrap: anywhere; }
.preg-card small { color: var(--ink-2); }
.preg-card.is-right { background: var(--ok-soft); border-color: var(--ok); }
.preg-card.is-wrong { background: var(--bad-soft); border-color: var(--bad); }
.preg-answer { margin-top: 8px; font-size: 15px; }
.preg-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---- Pickers in the same style as the rest of the app ---- */
.pick-field { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 52px; padding: 0 16px; border-radius: var(--r-md); border: 1px solid var(--line); background: #fff; font-size: 15px; text-align: start; }
.pick-field b { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.choice-search { width: 100%; min-height: 44px; margin: 0 0 8px; padding: 0 14px; border-radius: 999px; border: 0; background: #efe9e1; font-size: 16px; outline: none; }
.choice-item[hidden] { display: none; }

/* ---- IV dilution: a closed row per drug, four steps inside ---- */
.iv-item { padding: 0; overflow: hidden; }
.iv-item > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; cursor: pointer; list-style: none; }
.iv-item > summary::-webkit-details-marker { display: none; }
.iv-name { display: grid; gap: 2px; min-width: 0; }
.iv-name b { font-size: 16px; overflow-wrap: anywhere; }
.iv-name small, .iv-name .ar-title { color: var(--ink-2); font-size: 13px; }
.iv-item[open] > summary .dsec-arrow { transform: rotate(90deg); }
.iv-body { display: grid; gap: 14px; padding: 0 16px 16px; }
.iv-step { display: grid; gap: 6px; }
.iv-step h4 { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 800; }
.iv-n { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--orange); color: #fff; font-size: 12px; }
.iv-line { padding: 8px 12px; border-radius: var(--r-sm); background: var(--bg); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.iv-line.is-head { background: transparent; padding: 0 4px; color: var(--muted); font-size: 12px; font-weight: 700; }
.iv-sub { margin-top: 4px; font-size: 12px; font-weight: 800; color: var(--ink-2); }

/* ---- Learn first: classes, drugs, uses, brands ---- */
.learn-list { display: grid; gap: 10px; }
.learn-class { padding: 0; overflow: hidden; }
.learn-class > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; cursor: pointer; list-style: none; }
.learn-class > summary::-webkit-details-marker { display: none; }
.learn-body { display: grid; gap: 8px; padding: 0 12px 12px; }
.learn-drug { display: grid; gap: 2px; padding: 10px 12px; border-radius: var(--r-md); background: var(--bg); }
.learn-drug b { font-size: 15px; overflow-wrap: anywhere; }
.learn-drug span { font-size: 13px; color: var(--ink-2); }
.learn-drug small { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.learn-count { margin-top: 4px; font-size: 13px; font-weight: 700; }
.learn-notes { display: grid; gap: 6px; padding: 12px; border-radius: var(--r-md); background: var(--ok-soft); }
.learn-notes h4 { font-size: 14px; font-weight: 800; }
.learn-notes p { font-size: 13px; line-height: 1.7; color: var(--ink); }
.learn-notes b { color: var(--ink); }

/* ---- Subject card: lighter and calmer ---- */
.path-card { gap: 14px; padding: 16px; box-shadow: none; }
.path-ico { width: 44px; height: 44px; background: none; }
.path-title small { font-weight: 500; }
.path-title h2 { font-size: 16px; font-weight: 600; }
.path-card .pick-btn { font-weight: 500; font-size: 12px; background: rgba(255, 255, 255, .6); }
.path-steps { gap: 4px; }
.path-step { background: transparent; padding: 4px 2px; font-size: 11px; font-weight: 500; gap: 6px; }
.path-step.is-now { background: transparent; color: var(--ink); font-weight: 700; }
.path-dot { width: 22px; height: 22px; font-weight: 600; }
.path-card .btn { min-height: 46px; font-weight: 600; box-shadow: none; }
.path-link { font-weight: 500; font-size: 12px; }
.path-done { font-size: 13px; }

/* ---- Drug card: one column, plain rows, a clear order ---- */
.dcard-head { display: grid; gap: 4px; padding: 4px 2px 0; }
.dcard-class { font-size: 12px; font-weight: 600; color: var(--muted); }
.dcard-head h1 { font-size: 28px; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.dcard-head p { font-size: 14px; color: var(--ink-2); }
.dcard-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 14px; border-radius: var(--r-md); background: #fff; border: 1px solid var(--line); }
.dfact { display: grid; gap: 6px; align-content: start; min-width: 0; }
.dfact small { font-size: 12px; font-weight: 600; color: var(--muted); }
.dfact p { font-size: 13px; line-height: 1.6; color: var(--ink-2); overflow-wrap: anywhere; }
.dcats { display: flex; flex-wrap: wrap; gap: 6px; }
.dcat { padding: 4px 10px; border-radius: 999px; background: var(--bg); font-size: 12px; color: var(--ink-2); }
.dcat b { font-weight: 800; color: var(--ink); margin-inline-start: 4px; }
.dcard-cta { justify-content: center; }
.dcard-list { display: grid; gap: 8px; }
.dsec { border-radius: var(--r-md); background: #fff; border: 1px solid var(--line); overflow: hidden; }
.dsec > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px; padding: 0 16px; cursor: pointer; list-style: none; font-size: 15px; font-weight: 700; }
.dsec > summary::-webkit-details-marker { display: none; }
.dsec > summary::after { content: ''; width: 8px; height: 8px; border-inline-end: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2); transform: rotate(-45deg); transition: transform .2s; flex-shrink: 0; margin-inline-start: 6px; }
.dsec[open] > summary::after { transform: rotate(45deg); }
.dcount { margin-inline-start: auto; min-width: 26px; padding: 2px 8px; border-radius: 999px; background: var(--bg); font-size: 12px; font-weight: 700; text-align: center; }
.dsec-body { display: grid; gap: 0; padding: 0 16px 14px; border-top: 1px solid var(--line); }
.drow { display: grid; gap: 4px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.drow:last-child { border-bottom: 0; }
.drow > b { font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.drow p { font-size: 14px; line-height: 1.7; color: var(--ink-2); overflow-wrap: anywhere; }
.dhint { font-size: 12px; color: var(--muted); }
.dtag { justify-self: start; padding: 2px 10px; border-radius: 999px; font-weight: 700; }
.dtag.tag-ok { background: var(--ok-soft); color: var(--ok); }
.dtag.tag-warn { background: var(--orange-soft); color: var(--orange-deep); }
.dtag.tag-bad { background: var(--bad-soft); color: var(--bad); }
.dsub { margin: 12px 0 2px; font-size: 13px; font-weight: 800; color: var(--ink-2); }
.dlist { display: grid; gap: 6px; padding-inline-start: 18px; font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.dlist li { overflow-wrap: anywhere; }
.dnone { font-size: 13px; color: var(--muted); }
.dbrand { display: grid; gap: 2px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.dbrand:last-child { border-bottom: 0; }
.dbrand b { font-size: 15px; font-weight: 800; }
.dbrand small { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.tier-common .dsec-body, .tier-common { color: var(--ink); }
.dsec .drow .dlist { font-size: 13px; }
.dsec .drow b { font-size: 13px; }

/* ---- Calculator strength choices: compact, not oversized ---- */
.field-label .chip-tabs { gap: 6px; }
.field-label .chip-tabs .chip-tab { min-height: 34px; padding: 0 12px; font-size: 12px; font-weight: 600; }

/* Phone: the first screens use smaller, lighter headings and a shorter picture, so more content fits on screen. */
@media (max-width: 719px) {
  .ob-visual { flex: 0 0 auto; height: 36vh; min-height: 240px; max-height: 320px; }
  .ob-title { font-size: 22px; font-weight: 700; line-height: 1.35; }
  .ob-text { font-size: 15px; line-height: 1.6; }
  .land-hero { padding: 16px 0 24px; }
  .land-hero h1 { font-size: 26px; font-weight: 700; line-height: 1.25; }
  .land-hero .lead { font-size: 15px; }
  .land-hero-visual { min-height: 0; padding: 16px 0; }
}

/* ==========================================================================
   Responsive Auth Pages (Signup, Login, Onboarding)
   ========================================================================== */
.auth-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 16px;
  background: var(--bg);
  width: 100%;
}
.auth-wrap {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.auth-art {
  display: none !important;
}
@media (min-width: 860px) {
  .auth-wrap {
    max-width: 880px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
    gap: 28px;
  }
  .auth-art {
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 32px 24px;
    background: var(--peach);
    border-radius: var(--r-lg);
    border: 1px solid var(--line);
  }
  .auth-art h2 {
    font-size: 22px;
    font-weight: 800;
    margin: 16px 0 10px;
    color: var(--ink);
  }
  .auth-art ul {
    list-style: none;
    padding: 0;
    margin: 14px 0 0;
    display: grid;
    gap: 10px;
    text-align: start;
  }
  .auth-art li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 14px;
    color: var(--ink-2);
  }
  .auth-art li svg {
    color: var(--ok);
  }
}
.auth-card {
  background: #ffffff;
  border-radius: var(--r-lg);
  padding: 18px 16px;
  box-shadow: 0 8px 30px rgba(60, 40, 20, .06);
  border: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}
.auth-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0px;
}
.auth-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--orange-soft);
  border-radius: var(--r-md);
  margin-bottom: 2px;
  border: none;
}
.auth-hero small {
  color: var(--orange);
  font-weight: 700;
  font-size: 11.5px;
  display: block;
}
.auth-hero h1 {
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
  margin-top: 1px;
}
.auth-hero-bot {
  flex-shrink: 0;
}
.form {
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
}
.field-box {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--cream);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  padding: 0 12px;
  min-height: 42px;
  transition: all .15s ease;
}
.field-box:focus-within {
  border-color: var(--orange);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(249, 94, 8, .12);
}
.field-box svg {
  color: var(--muted);
  flex-shrink: 0;
  margin-inline-end: 8px;
  width: 18px;
  height: 18px;
}
.field-box input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 0;
  font-size: 13.5px;
  color: var(--ink);
  outline: none;
  width: 100%;
}
.eye-btn {
  background: none;
  border: none;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  cursor: pointer;
}
.choice-group {
  border: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chip-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip-tab {
  position: relative;
  cursor: pointer;
  margin: 0;
}
.chip-tab input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.chip-tab span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--cream);
  border: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  transition: all .15s ease;
}
.chip-tab input[type="radio"]:checked + span {
  background: var(--orange-soft);
  color: var(--orange);
  font-weight: 700;
  box-shadow: inset 0 0 0 1.5px var(--orange);
}
.form-error {
  color: var(--bad);
  font-size: 12px;
  font-weight: 600;
  min-height: 16px;
  margin: 0;
  text-align: center;
}
.btn-block {
  width: 100%;
}
.btn-lg {
  min-height: 44px;
  font-size: 14.5px;
  font-weight: 700;
  border-radius: var(--r-md);
  border: none;
}
.auth-switch {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin: 3px 0 0;
}
.auth-switch a {
  color: var(--orange);
  font-weight: 700;
  text-decoration: underline;
}
.fine {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
  margin: 2px 0 0;
}

/* Onboarding */
.ob-card {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  background: #ffffff;
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
@media (max-width: 600px) {
  .ob-card {
    border-radius: 0;
    border: 0;
    box-shadow: none;
    min-height: 100dvh;
    min-height: 100vh;
  }
}
.ob-visual {
  position: relative;
  padding: calc(18px + env(safe-area-inset-top, 16px)) 20px 20px;
  min-height: 250px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-radius: 0 0 28px 28px;
}
.ob-top {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  position: relative;
  z-index: 5;
  margin-bottom: 8px;
}
.ob-art {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 0;
}
.ob-body {
  padding: 20px 20px calc(24px + env(safe-area-inset-bottom, 16px));
  display: flex;
  flex-direction: column;
  gap: 13px;
  flex: 1;
  justify-content: space-between;
}
.ob-title {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.3;
  color: var(--ink);
  text-align: center;
  margin: 0;
}
.ob-text {
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-2);
  text-align: center;
  margin: 0;
}
.dots {
  display: flex;
  justify-content: center;
  gap: 6px;
}
.dots span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--line);
  transition: all .2s;
}
.dots span.on {
  width: 24px;
  background: var(--orange);
}
.slide-btn {
  position: relative;
  min-height: 50px;
  background: var(--orange-soft);
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  cursor: pointer;
  user-select: none;
  overflow: hidden;
  border: 1.5px solid var(--line);
}
.slide-knob {
  position: absolute;
  inset-inline-start: 5px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--orange);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(249, 94, 8, .3);
}
.slide-label {
  font-weight: 700;
  color: var(--ink);
  font-size: 15px;
}
.slide-arrows {
  display: flex;
  color: var(--orange);
  margin-inline-start: 8px;
}

/* ==========================================================================
   Smart PWA Install Prompt (iOS & Android)
   ========================================================================== */
/* Hidden fully below and out of sight until it is shown, so no edge of the sheet can peek into the page. */
.install-prompt-modal {
  position: fixed;
  inset-inline: 12px;
  bottom: 12px;
  margin-inline: auto;
  max-width: 440px;
  z-index: 99999;
  transform: translateY(calc(100% + 40px));
  opacity: 0;
  visibility: hidden;
  transition: transform .35s cubic-bezier(.16, 1, .3, 1), opacity .25s ease, visibility .35s;
  pointer-events: none;
}
.install-prompt-modal.active {
  transform: none;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.install-sheet {
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: 0 16px 40px rgba(60, 40, 20, 0.16);
  border: 1px solid var(--line);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.install-close {
  position: absolute;
  top: 10px;
  inset-inline-end: 10px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--cream);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s ease;
}
.install-close:hover {
  background: var(--peach);
}
.install-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-inline-end: 24px;
}
.install-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(249, 94, 8, 0.2);
  flex-shrink: 0;
}
.install-title {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.3;
}
.install-tag {
  display: block;
  font-size: 12px;
  color: var(--ink-2);
  margin-top: 2px;
  line-height: 1.4;
}
.ios-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--cream);
  padding: 12px 14px;
  border-radius: var(--r-md);
}
.ios-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}
.ios-num {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--orange);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ios-text {
  flex: 1;
  line-height: 1.4;
}
.ios-ico-share {
  color: #007aff;
  display: flex;
  align-items: center;
  background: #fff;
  padding: 4px;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.ios-ico-plus {
  color: var(--ink);
  display: flex;
  align-items: center;
  background: #fff;
  padding: 4px;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.ios-pointer {
  text-align: center;
  margin-top: -6px;
}
.ios-arrow-bounce {
  display: inline-block;
  font-size: 20px;
  color: #007aff;
  animation: bounceDown 1.4s infinite ease-in-out;
}
@keyframes bounceDown {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}



/* Phone: the top bar of the landing page wraps instead of running off the screen; the sign-in and sign-up headings are smaller and lighter. */
@media (max-width: 719px) {
  .land-nav { flex-wrap: wrap; row-gap: 8px; }
  .land-actions { flex-wrap: wrap; justify-content: flex-end; }
  .auth-hero h1 { font-size: 16px; font-weight: 700; }
  .auth-hero small { font-size: 11px; }
}

/* Install bar: one small row at the bottom of the welcome, onboarding, log-in and sign-up screens. */
.install-bar {
  position: fixed;
  inset-inline: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  margin-inline: auto;
  max-width: 440px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 12px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(60, 40, 20, .14);
}
.install-bar-icon { width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0; }
.install-bar-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.install-bar-text b { font-size: 14px; font-weight: 700; }
.install-bar-text small { font-size: 12px; color: var(--ink-2); line-height: 1.4; }
.install-bar .btn { flex-shrink: 0; }
.install-bar-close { flex-shrink: 0; width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 999px; background: #f3eee8; color: var(--ink-2); }
body.has-install-bar #app { padding-bottom: 84px; }

/* ---- Landing page: two columns on large screens (text and numbers beside the live app), colour tiles for the features ---- */
.lp { max-width: 1160px; margin: 0 auto; padding: 0 16px 32px; width: 100%; box-sizing: border-box; overflow-x: clip; }
.lp-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; }
.lp-brand { display: flex; align-items: center; gap: 8px; font-size: 21px; font-weight: 800; color: var(--ink); text-decoration: none; }
.lp-brand .art.mascot { display: block; overflow: visible; flex-shrink: 0; }
.lp-nav-actions { display: flex; align-items: center; gap: 8px; }
.lp-hero { display: grid; gap: 28px; padding: 12px 0 36px; }
.lp-hero-text { display: grid; gap: 16px; align-content: center; justify-items: start; }
.lp-kicker { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--orange-soft); color: var(--orange); font-weight: 700; font-size: 13px; }
.lp-hero h1 { font-size: 30px; font-weight: 800; line-height: 1.2; letter-spacing: -.01em; }
.lp-lead { font-size: 16px; color: var(--ink-2); line-height: 1.7; max-width: 540px; }
.lp-cta { display: flex; flex-wrap: wrap; gap: 10px; }
.lp-install { display: inline-flex; align-items: center; gap: 6px; padding: 4px 0; border: 0; background: none; color: var(--ink-2); font-weight: 600; font-size: 14px; }
.lp-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.lp-stats div { display: grid; min-width: 96px; padding: 10px 14px; border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow); }
.lp-stats b { font-size: 22px; font-weight: 800; color: var(--orange); }
.lp-stats span { font-size: 12px; color: var(--muted); }
.lp-hero-demo { display: grid; justify-items: center; gap: 12px; }
.lp-hero-demo .demo-tabs { margin: 0; }
.lp-demo-note { max-width: 360px; font-size: 13px; color: var(--muted); text-align: center; }
.lp-features { padding: 24px 0; }
.lp-section-title { margin-bottom: 16px; font-size: 24px; font-weight: 800; }
.lp-feature-grid { display: grid; gap: 12px; }
.lp-feature { display: grid; align-content: start; gap: 8px; padding: 20px; border-radius: var(--r-lg); }
.lp-feature-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: rgba(255, 255, 255, .7); color: var(--ink); }
.lp-feature h3 { font-size: 17px; font-weight: 800; }
.lp-feature p { font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.lp-band { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin: 24px 0 8px; padding: 24px; border-radius: var(--r-lg); background: var(--ink); color: #fff; }
.lp-band h2 { font-size: 22px; font-weight: 800; }
.lp-band p { opacity: .75; }
.lp-band .btn-white { color: var(--ink); }
.lp-foot { padding: 16px 0 0; font-size: 13px; color: var(--muted); text-align: center; }
@media (max-width: 480px) { .lp-hide-phone { display: none; } }
@media (min-width: 640px) { .lp-feature-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) {
  .lp { padding: 0 32px 40px; }
  .lp-hero { grid-template-columns: 1.1fr .9fr; align-items: center; gap: 48px; padding: 24px 0 56px; }
  .lp-hero h1 { font-size: 52px; }
  .lp-lead { font-size: 18px; }
  .lp-section-title { margin-bottom: 24px; font-size: 30px; text-align: center; }
  .lp-feature-grid { grid-template-columns: repeat(4, 1fr); }
  .lp-feature { padding: 24px; }
  .lp-band { padding: 32px 40px; }
}
.lp-hero-demo .demo-tabs { display: flex; flex-wrap: nowrap; justify-content: flex-start; width: 100%; max-width: 100%; box-sizing: border-box; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding: 4px 0; margin: 0; }
.lp-hero-demo .demo-tabs::-webkit-scrollbar { display: none; }
.lp-hero-demo .demo-tab { flex-shrink: 0; min-height: 34px; padding: 0 12px; font-size: 13px; }
/* On large screens the landing page has its own install link, so the bottom bar is for phones only. */
@media (min-width: 900px) {
  .install-bar { display: none; }
  body.has-install-bar #app { padding-bottom: 0; }
  .lp-hero-demo .demo-tabs { width: max-content; margin-inline: auto; justify-content: center; }
}
/* The app's logo (the Capsy robot) in the landing header, and the robot itself beside the live app on large screens. */
.lp-logo { width: 40px; height: 40px; border-radius: 12px; }
.lp-mascot { display: none; }
@media (min-width: 1000px) {
  .lp-hero-demo { position: relative; }
  .lp-mascot { display: block; position: absolute; z-index: 2; bottom: 60px; inset-inline-start: -90px; filter: drop-shadow(0 18px 24px rgba(60, 40, 20, .18)); animation: float 4s ease-in-out infinite; pointer-events: none; }
}

/* ---- Tools list: one card, one row per tool, each row with its own colour and icon ---- */
.tool-list { padding: 6px; display: grid; margin: 12px 0; }
.tool-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--r-md); color: var(--ink); text-decoration: none; }
.tool-item + .tool-item { border-top: 1px solid var(--line); border-radius: 0; }
.tool-item:active { background: var(--bg); }
.tool-ico { background: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0; color: var(--ink); }
.tool-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.tool-text b { font-size: 16px; font-weight: 700; }
.tool-text small { font-size: 13px; color: var(--muted); line-height: 1.4; }
.tool-chev { color: var(--muted); flex-shrink: 0; }

/* ---- Skincare: the same parts as the rest of the app ---- */
.skin-tabs { margin-bottom: 10px; }
.skin-content { display: grid; gap: 12px; min-width: 0; }
.skin-search { margin: 0; }
.skin-clear { flex-shrink: 0; }
.skin-count { font-size: 13px; margin: 0; }
.skin-list { display: grid; gap: 10px; min-width: 0; }
.skin-item { display: grid; gap: 10px; text-align: start; padding: 14px; width: 100%; color: var(--ink); font: inherit; border: 0; cursor: pointer; }
.skin-item-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; min-width: 0; }
.skin-item-title { display: grid; gap: 2px; min-width: 0; }
.skin-item-title b { font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; }
.skin-item-title small { font-size: 13px; color: var(--muted); line-height: 1.5; }
.skin-item .tag { flex-shrink: 0; }
.skin-chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.skin-label { font-size: 13px; font-weight: 700; color: var(--muted); margin: 0; }
.skin-compat, .skin-quiz { display: grid; gap: 12px; padding: 16px; }
.skin-compat h2, .skin-quiz h2 { font-size: 18px; margin: 0; }
.skin-compat p, .skin-quiz p { margin: 0; }
.skin-pick { display: grid; gap: 4px; justify-items: stretch; min-width: 0; }
.skin-pick .field-select { min-width: 0; width: 100%; }
.skin-vs { font-size: 13px; color: var(--muted); font-weight: 700; }
.skin-result { display: grid; gap: 6px; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid var(--line); min-width: 0; }
.skin-result p { font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.skin-result.tone-ok { background: var(--ok-soft); }
.skin-result.tone-bad { background: var(--bad-soft); }
.skin-result.tone-warn { background: var(--cream); }
.skin-quiz-nav { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.skin-case { font-size: 15px; line-height: 1.75; }
.skin-options { display: grid; gap: 8px; }
.skin-option { text-align: start; min-height: 48px; padding: 10px 14px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: 14px; line-height: 1.5; cursor: pointer; }
.skin-option:disabled { cursor: default; }
.skin-option.is-right { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); font-weight: 700; }
.skin-option.is-wrong { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }
.skin-sheet { max-height: 88vh; overflow-y: auto; overflow-x: hidden; min-width: 0; }
.skin-sheet h2 { font-size: 20px; margin: 4px 0; overflow-wrap: anywhere; }
.skin-detail { display: grid; gap: 14px; margin: 10px 0; }
.skin-detail h3 { font-size: 14px; margin: 0 0 4px; color: var(--muted); }
.skin-detail p, .skin-detail li { font-size: 15px; line-height: 1.75; overflow-wrap: anywhere; }
.skin-detail ul { margin: 0; padding-inline-start: 20px; }
.skin-flag { padding: 10px 12px; border-radius: var(--r-md); background: var(--bad-soft); }
.skin-flag h3, .skin-flag p { color: var(--bad); }
.skin-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; text-align: center; }
.skin-facts div { display: grid; gap: 2px; padding: 10px 6px; border-radius: var(--r-md); background: var(--bg); border: 1px solid var(--line); min-width: 0; }
.skin-facts small { font-size: 11px; color: var(--muted); }
.skin-facts b { font-size: 13px; overflow-wrap: anywhere; }

/* Skincare interaction checker: each ingredient is one full-width row that opens the list */
.skin-pickrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 56px; padding: 8px 14px; border-radius: var(--r-md); border: 1.5px solid var(--line); background: #fff; color: var(--ink); text-align: start; }
.skin-pickrow > span { display: grid; gap: 2px; min-width: 0; }
.skin-pickrow small { color: var(--muted); font-size: 12px; }
.skin-pickrow b { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.skin-vs { justify-self: center; }

/* Interaction findings: a coloured edge shows how serious each one is */
.ix-item { display: grid; gap: 8px; justify-items: start; padding: 14px 16px; }
.ix-item p { margin: 0; overflow-wrap: anywhere; }
.ix-item .ix-advice { color: var(--ink-2); font-size: 14px; }
.ix-item.ix-sev-3 { border-inline-start: 4px solid var(--bad); }
.ix-item.ix-sev-2 { border-inline-start: 4px solid var(--orange-2); }
.ix-item.ix-sev-1 { border-inline-start: 4px solid var(--ok); }
