/* ==========================================================================
   Anajia (الناجية) — styles
   Mobile-first (360px and up), RTL-ready (logical properties everywhere).
   Palette: cream-pink, soft pink, rose, lavender, mint, plum text.
   ========================================================================== */

:root {
  --cream: #FFF5F8;
  --pink: #FFE4EC;
  --rose: #FF5C8A;
  --rose-l: #FF8FB1;
  --lav: #C77DFF;
  --mint: #5ED6B5;
  --plum: #4A2C3A;
  --plum-soft: #86606F;
  --white: #FFFFFF;
  --sun: #FFD166;
  --danger: #E5386B;
  --rose-ink: #C2185B;      /* rose dark enough for small text on pink */
  --lav-ink: #7B2FBF;
  --mint-ink: #177A62;

  --grad: linear-gradient(135deg, var(--rose) 0%, var(--lav) 100%);
  --grad-soft: linear-gradient(135deg, #FFE4EC 0%, #F3E3FF 100%);
  --shadow: 0 10px 30px -12px rgba(255, 92, 138, .35), 0 2px 8px rgba(74, 44, 58, .05);
  --shadow-sm: 0 4px 14px -6px rgba(255, 92, 138, .35);
  --r-lg: 28px;
  --r-md: 22px;
  --r-sm: 16px;
  --tab-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "Nunito", "Quicksand", ui-rounded, "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-ar: "Tajawal", "Nunito", "Segoe UI", Tahoma, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--plum);
  background:
    radial-gradient(900px 500px at 10% -10%, #FFD6E4 0%, transparent 60%),
    radial-gradient(800px 500px at 100% 10%, #EBD9FF 0%, transparent 55%),
    #FFEFF4;
  background-attachment: fixed;
  line-height: 1.45;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
html[lang="ar"] body { font-family: var(--font-ar); line-height: 1.6; }
body.modal-open { overflow: hidden; }

h1, h2, h3, h4, p, ul, ol, dl, dd, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--lav); outline-offset: 2px; border-radius: 12px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--plum-soft); }
.small { font-size: 13px; }
.center { text-align: center; }
.grow { flex: 1; }
.print-only { display: none; }
.icon { width: 22px; height: 22px; flex: none; }

/* ----------------------------------------------------------- app shell */
.app {
  position: relative;
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--cream);
  box-shadow: 0 0 60px rgba(255, 92, 138, .18);
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 14px;
  background: rgba(255, 245, 248, .9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.topbar:empty { display: none; }
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand-logo { width: 36px; height: 36px; flex: none; }
.brand-logo .mascot { width: 36px; height: 36px; animation: none; }
.brand-name { font-weight: 900; font-size: 19px; letter-spacing: -.2px; white-space: nowrap; }
.brand-ar { font-family: var(--font-ar); font-weight: 800; color: var(--rose); margin-inline-start: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.lang-switch { display: flex; background: var(--pink); border-radius: 99px; padding: 3px; }
.lang-switch button {
  min-width: 34px; height: 30px; padding: 0 8px; border-radius: 99px;
  font-size: 12.5px; font-weight: 800; color: var(--plum-soft);
  transition: background .2s, color .2s;
}
.lang-switch button.on { background: var(--white); color: var(--rose-ink); box-shadow: var(--shadow-sm); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--pink); color: var(--rose-ink);
  transition: transform .15s;
}
.icon-btn:active { transform: scale(.9) rotate(20deg); }

.view {
  flex: 1;
  padding: 6px 16px calc(var(--tab-h) + var(--safe-b) + 28px);
  display: flex; flex-direction: column; gap: 14px;
  outline: none;
}
.view.enter > * { animation: rise .5s cubic-bezier(.2, .9, .3, 1.2) both; }
.view.enter > *:nth-child(2) { animation-delay: .04s; }
.view.enter > *:nth-child(3) { animation-delay: .08s; }
.view.enter > *:nth-child(4) { animation-delay: .12s; }
.view.enter > *:nth-child(5) { animation-delay: .16s; }
.view.enter > *:nth-child(n+6) { animation-delay: .2s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.tabbar {
  position: fixed; z-index: 30;
  bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  height: calc(var(--tab-h) + var(--safe-b));
  padding: 6px 2px calc(6px + var(--safe-b));
  display: flex;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -8px 30px -10px rgba(255, 92, 138, .35);
}
.tabbar:empty { display: none; }
.tab {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--plum-soft); font-weight: 800;
}
.tab-ico {
  width: 46px; height: 30px; border-radius: 99px;
  display: grid; place-items: center;
  transition: background .25s, color .25s, transform .25s;
}
.tab-label { font-size: 10px; letter-spacing: -.2px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html[lang="ar"] .tab-label { font-size: 11.5px; letter-spacing: 0; }
@media (min-width: 400px) { .tab-label { font-size: 11px; letter-spacing: 0; } }
.tab.on { color: var(--rose-ink); }
.tab.on .tab-ico { background: var(--grad); color: #fff; transform: translateY(-2px); box-shadow: var(--shadow-sm); animation: pop .35s; }
@keyframes pop { 0% { transform: scale(.8); } 60% { transform: scale(1.12) translateY(-2px); } 100% { transform: scale(1) translateY(-2px); } }

.boot { flex: 1; display: grid; place-content: center; justify-items: center; gap: 14px; min-height: 60vh; color: var(--rose); font-weight: 900; text-align: center; padding: 24px; }
.boot-dot { width: 44px; height: 44px; border-radius: 50%; background: var(--grad); animation: pulse 1s infinite alternate; }
@keyframes pulse { to { transform: scale(1.25); opacity: .6; } }

/* ----------------------------------------------------------- primitives */
.card {
  background: var(--white);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 12px;
}
.card-title { font-size: 16.5px; font-weight: 900; display: flex; align-items: center; gap: 8px; }
.count { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 99px; background: var(--grad); color: #fff; font-size: 12.5px; }
.section-title { font-size: 18px; font-weight: 900; padding: 6px 4px 0; }
.sub-title { font-size: 14px; font-weight: 900; margin-top: 4px; padding-inline-start: 10px; border-inline-start: 4px solid var(--accent, var(--rose)); }
.lead { font-weight: 700; }
.fineprint { font-size: 12px; color: var(--plum-soft); text-align: center; padding: 0 8px; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding-top: 4px; }
.page-head h1 { font-size: 25px; font-weight: 900; letter-spacing: -.3px; }
.page-head p { color: var(--plum-soft); font-size: 14px; font-weight: 600; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 20px;
  border-radius: 99px;
  font-weight: 900; font-size: 15.5px; text-decoration: none; text-align: center;
  transition: transform .15s, box-shadow .2s, filter .2s;
}
.btn:active { transform: scale(.96); }
.btn-block { width: 100%; }
.btn-lg { min-height: 56px; font-size: 17px; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 10px 22px -8px rgba(255, 92, 138, .7); text-shadow: 0 1px 2px rgba(120, 20, 70, .25); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-soft { background: var(--pink); color: var(--rose-ink); }
.btn-ghost { background: transparent; color: var(--rose-ink); }
.btn-mint { background: #DDF7EF; color: var(--mint-ink); }
.btn-danger { background: #FFE0E8; color: var(--danger); }
.btn-white { background: #fff; color: var(--danger); }
.btn-outline-white { background: rgba(255, 255, 255, .16); color: #fff; border: 2px solid rgba(255, 255, 255, .7); }
.btn-row { display: flex; gap: 10px; }

.link-btn { color: var(--rose-ink); font-weight: 800; font-size: 13.5px; text-decoration: underline; text-underline-offset: 3px; align-self: flex-start; padding: 6px 0; }
.link-btn.danger { color: var(--danger); }
.pill-btn {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  padding: 8px 12px; border-radius: 99px;
  background: var(--pink); color: var(--rose-ink); font-weight: 800; font-size: 13px;
  max-width: 46%; text-align: start; line-height: 1.2;
}
.pill-btn .icon { width: 18px; height: 18px; }
.pill-btn.strong { background: var(--grad); color: #fff; box-shadow: var(--shadow-sm); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 13.5px; font-weight: 800; color: var(--plum-soft); }
.field-label.center { text-align: center; }
.hint { font-size: 12.5px; color: var(--plum-soft); }
.input {
  width: 100%; min-height: 48px; padding: 11px 16px;
  border: 2px solid var(--pink); border-radius: var(--r-sm);
  background: var(--cream); color: var(--plum); font-weight: 700;
  transition: border-color .2s, box-shadow .2s;
}
.input:focus { outline: none; border-color: var(--rose-l); box-shadow: 0 0 0 4px rgba(255, 143, 177, .25); }
.input:disabled { opacity: .5; }
.input-lg { min-height: 56px; font-size: 18px; text-align: center; }
textarea.input { resize: vertical; min-height: 64px; }
select.input { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--rose) 50%), linear-gradient(135deg, var(--rose) 50%, transparent 50%); background-position: calc(100% - 20px) 21px, calc(100% - 14px) 21px; background-size: 6px 6px; background-repeat: no-repeat; padding-inline-end: 36px; }
[dir="rtl"] select.input { background-position: 14px 21px, 20px 21px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }

.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 16px; border-radius: var(--r-md); background: var(--white); box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.switch-row.compact { padding: 10px 4px; box-shadow: none; background: none; }
.switch-row span { display: flex; flex-direction: column; gap: 2px; font-weight: 700; font-size: 14.5px; }
.switch-row small { color: var(--plum-soft); font-weight: 600; font-size: 12.5px; }
.switch {
  appearance: none; -webkit-appearance: none; flex: none;
  width: 50px; height: 30px; border-radius: 99px; background: #F0D3DC; position: relative; cursor: pointer;
  transition: background .25s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; inset-inline-start: 3px;
  width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(74, 44, 58, .25);
  transition: inset-inline-start .25s cubic-bezier(.3, 1.4, .5, 1);
}
.switch:checked { background: var(--grad); }
.switch:checked::after { inset-inline-start: 23px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.tight { gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 42px; padding: 8px 14px;
  border-radius: 99px; border: 2px solid var(--pink);
  background: var(--white); color: var(--plum);
  font-weight: 800; font-size: 14px; text-align: start; line-height: 1.2;
  transition: transform .15s, background .2s, border-color .2s, color .2s;
}
.chip:active { transform: scale(.94); }
.chip.on { background: var(--grad); border-color: transparent; color: #fff; box-shadow: var(--shadow-sm); animation: chip-pop .3s; text-shadow: 0 1px 2px rgba(120, 20, 70, .25); }
@keyframes chip-pop { 0% { transform: scale(.9); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }
.chip-sm { min-height: 36px; padding: 6px 12px; font-size: 13px; }
.chip-alert { border-color: #FFC9D6; background: #FFF0F3; }
.chip-alert.on { background: linear-gradient(135deg, #F0426F, #E5386B); }
.chip-related { border-color: var(--lav); }
.chip .star { font-style: normal; font-size: 11px; color: var(--lav); }
.chip.on .star { color: #fff; }
.chip-dx.on { background: var(--accent); color: var(--plum); text-shadow: none; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 800; white-space: nowrap; }
.badge-src { background: var(--plum); color: #fff; }
.badge-lvl { background: #F3E3FF; color: var(--lav-ink); }
.badge-mint { background: #DDF7EF; color: var(--mint-ink); }
.badge-muted { background: #F3EAEE; color: var(--plum-soft); }
.badge-warn { background: #FFF0D0; color: #8A5A00; }
.badge-ok { background: #DDF7EF; color: var(--mint-ink); }

.note-banner, .demo-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; border-radius: var(--r-sm);
  background: #F3E3FF; color: var(--lav-ink); font-weight: 800; font-size: 13.5px;
}
.demo-banner .link-btn { color: var(--lav-ink); padding: 0; align-self: center; }

details.more { border-radius: var(--r-sm); background: var(--cream); padding: 4px 14px; }
details.more > summary {
  list-style: none; cursor: pointer; padding: 10px 0; font-weight: 900; font-size: 14px; color: var(--rose-ink);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: "+"; width: 26px; height: 26px; flex: none; border-radius: 50%; background: var(--pink); display: grid; place-items: center; font-size: 18px; transition: transform .25s; }
details.more[open] > summary::after { transform: rotate(45deg); }
details.more > *:not(summary) { margin-bottom: 12px; }
details.more h4 { margin-top: 6px; }

/* ----------------------------------------------------------- mascot */
.mascot { width: 72px; height: 72px; flex: none; animation: float 3.4s ease-in-out infinite; overflow: visible; }
.mascot-md { width: 88px; height: 88px; }
.mascot-lg { width: 104px; height: 104px; }
.mascot-xl { width: 150px; height: 150px; }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-7px) rotate(2deg); } }
.m-eyes { transform-origin: 60px 66px; animation: blink 4.5s infinite; }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }
.m-spark { transform-origin: center; transform-box: fill-box; animation: twinkle 1.4s ease-in-out infinite; }
.m-spark2 { animation-delay: .5s; }
@keyframes twinkle { 0%, 100% { transform: scale(.6); opacity: .5; } 50% { transform: scale(1.15); opacity: 1; } }
.m-tear { transform-box: fill-box; animation: drip 2.2s ease-in infinite; }
@keyframes drip { 0% { transform: translateY(-3px); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateY(9px); opacity: 0; } }
.mascot--rough { animation: wobble .9s ease-in-out infinite; }
@keyframes wobble { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
.mascot--great { animation: bounce 1.1s ease-in-out infinite; }
@keyframes bounce { 0%, 100% { transform: translateY(0) scale(1, 1); } 45% { transform: translateY(-11px) scale(.98, 1.03); } 60% { transform: translateY(0) scale(1.04, .96); } }

/* ----------------------------------------------------------- onboarding */
.onb { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: 18px 6px 10px; justify-content: center; }
.app[data-view="onboarding"] .view { padding-bottom: 28px; }
.dots { display: flex; justify-content: center; gap: 8px; }
.dot { width: 9px; height: 9px; border-radius: 99px; background: #F7C6D5; transition: width .3s, background .3s; }
.dot.on { width: 28px; background: var(--grad); }
.onb-hero { display: grid; place-items: center; padding: 10px 0 0; }
.onb-hero::before { content: ""; position: absolute; width: 210px; height: 210px; border-radius: 50%; background: var(--grad-soft); z-index: 0; }
.onb-hero.small::before { width: 150px; height: 150px; }
.onb-hero .mascot { position: relative; z-index: 1; }
.onb-hero { position: relative; min-height: 200px; }
.onb-hero.small { min-height: 150px; }
.onb-title { font-size: 27px; font-weight: 900; text-align: center; letter-spacing: -.4px; line-height: 1.2; }
.onb-sub { text-align: center; color: var(--plum-soft); font-weight: 600; }
.lang-big { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.lang-opt { flex: 1; min-width: 92px; min-height: 48px; padding: 8px 10px; border-radius: 99px; border: 2px solid var(--pink); background: #fff; font-weight: 900; }
.lang-opt.on { background: var(--grad); color: #fff; border-color: transparent; box-shadow: var(--shadow-sm); }
.privacy-note { padding: 12px 14px; border-radius: var(--r-sm); background: #DDF7EF; color: var(--mint-ink); font-weight: 700; font-size: 13.5px; }

/* ----------------------------------------------------------- home */
.hero {
  display: flex; align-items: center; gap: 12px;
  padding: 16px; border-radius: var(--r-lg);
  background: var(--grad); color: #fff;
  box-shadow: 0 16px 34px -14px rgba(199, 125, 255, .8);
  position: relative; overflow: hidden;
}
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .14); }
.hero::before { width: 150px; height: 150px; inset-inline-end: -40px; top: -60px; }
.hero::after { width: 90px; height: 90px; inset-inline-end: 50px; bottom: -50px; }
.hero-mascot { flex: none; filter: drop-shadow(0 6px 10px rgba(74, 44, 58, .25)); position: relative; z-index: 1; }
.hero-mascot .mascot { width: 92px; height: 92px; }
.bubble { position: relative; z-index: 1; min-width: 0; }
.bubble h1 { font-size: 23px; font-weight: 900; line-height: 1.15; overflow-wrap: anywhere; text-shadow: 0 1px 3px rgba(120, 20, 70, .25); }
.bubble p { font-weight: 700; font-size: 14.5px; margin-top: 4px; opacity: .97; }

.mood-row { display: flex; gap: 6px; }
.mood-btn {
  flex: 1; min-width: 0; padding: 10px 2px 8px; border-radius: 20px; background: var(--cream);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  border: 2px solid transparent; transition: transform .2s, background .2s, border-color .2s;
}
.mood-emoji { font-size: 27px; line-height: 1; transition: transform .25s cubic-bezier(.3, 1.6, .5, 1); }
.mood-label { font-size: 11.5px; font-weight: 800; color: var(--plum-soft); white-space: nowrap; }
.mood-btn:active .mood-emoji { transform: scale(.85); }
.mood-btn.on { background: var(--pink); border-color: var(--rose-l); }
.mood-btn.on .mood-emoji { transform: scale(1.25) translateY(-2px); }
.mood-btn.on .mood-label { color: var(--rose-ink); }

.cta {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 14px 18px; border-radius: var(--r-lg);
  background: var(--white); box-shadow: var(--shadow); text-align: start;
  border: 2px dashed var(--rose-l);
  transition: transform .15s;
}
.cta:active { transform: scale(.97); }
.cta-plus { width: 52px; height: 52px; flex: none; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; box-shadow: var(--shadow-sm); animation: breathe 2.4s ease-in-out infinite; }
.cta-plus .icon { width: 28px; height: 28px; stroke-width: 2.6; }
@keyframes breathe { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 92, 138, .45); } 50% { box-shadow: 0 0 0 10px rgba(255, 92, 138, 0); } }
.cta-text { display: flex; flex-direction: column; }
.cta-text strong { font-size: 18px; font-weight: 900; }
.cta-text small { color: var(--plum-soft); font-weight: 700; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.quick-label { font-size: 12.5px; font-weight: 800; color: var(--plum-soft); margin-inline-end: 2px; }

.cycle-body { display: flex; align-items: center; gap: 16px; }
.ring-wrap { position: relative; width: 112px; height: 112px; flex: none; }
.ring { width: 100%; height: 100%; }
.ring-fg { animation: ring-in 1s cubic-bezier(.3, .9, .3, 1) both; }
@keyframes ring-in { from { stroke-dashoffset: 289; } }
.ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-center small { font-size: 12px; font-weight: 800; color: var(--plum-soft); line-height: 1; }
.ring-center strong { font-size: 32px; font-weight: 900; line-height: 1.05; color: var(--rose-ink); }
.cycle-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; align-items: flex-start; }
.phase-pill { padding: 5px 12px; border-radius: 99px; font-weight: 900; font-size: 13px; background: var(--pink); color: var(--rose-ink); }
.phase-follicular { background: #DDF7EF; color: var(--mint-ink); }
.phase-ovulation { background: #FFF0D0; color: #8A5A00; }
.phase-luteal { background: #F3E3FF; color: var(--lav-ink); }
.phase-late { background: #F3EAEE; color: var(--plum-soft); }
.cycle-of { font-size: 13.5px; color: var(--plum-soft); font-weight: 700; }
.cycle-next { font-weight: 800; font-size: 14.5px; }

.tip-card { flex-direction: row; align-items: flex-start; background: linear-gradient(135deg, #FFF8E5, #FFEFF4); }
.tip-ico { font-size: 28px; line-height: 1; animation: float 3s ease-in-out infinite; }
.tip-card p { font-weight: 600; font-size: 14.5px; margin-top: 4px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: #fff; border-radius: var(--r-md); padding: 12px 6px; text-align: center; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; }
.stat strong { font-size: 24px; font-weight: 900; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat span { font-size: 11.5px; font-weight: 800; color: var(--plum-soft); line-height: 1.2; }

/* ----------------------------------------------------------- log */
.date-pill input {
  border: 0; border-radius: 99px; background: var(--pink); color: var(--rose-ink);
  font-weight: 800; font-size: 13px; padding: 9px 12px; max-width: 150px; min-height: 40px;
}
.map-card { padding: 14px; }
.map-wrap { display: flex; align-items: center; gap: 12px; }
.bodymap { width: 44%; max-width: 160px; height: auto; flex: none; overflow: visible; }
.region { fill: #FFC2D4; stroke: var(--white); stroke-width: 3; cursor: pointer; transition: fill .2s; outline: none; }
g.region path { fill: inherit; stroke: inherit; stroke-width: inherit; }
.region:hover { fill: var(--rose-l); }
.region.has { fill: #D9A8FF; }
.region.on { fill: var(--rose); animation: region-pulse 1.2s ease-in-out infinite; }
.region:focus-visible { stroke: var(--lav); stroke-width: 4; }
@keyframes region-pulse { 50% { fill: #FF7EA3; } }
.map-face { pointer-events: none; }
.map-badge { pointer-events: none; }
.map-badge circle { fill: var(--lav-ink); stroke: #fff; stroke-width: 2; }
.map-badge text { fill: #fff; font-size: 12px; font-weight: 900; font-family: var(--font); }
.map-side { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.zone-bubble {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 9px 12px; border-radius: 99px; background: var(--cream); border: 2px solid var(--pink);
  font-weight: 800; font-size: 13.5px; text-align: start; line-height: 1.15;
  transition: background .2s, border-color .2s, transform .15s;
}
.zone-bubble:active { transform: scale(.96); }
.zone-bubble b { margin-inline-start: auto; background: var(--lav-ink); color: #fff; border-radius: 99px; min-width: 20px; height: 20px; font-size: 11.5px; display: grid; place-items: center; }
.zone-bubble.has { border-color: var(--lav); }
.zone-bubble.on { background: var(--grad); color: #fff; border-color: transparent; }
.zone-current { min-height: 44px; display: flex; flex-direction: column; justify-content: center; font-size: 13.5px; padding-inline-start: 4px; }
.zone-current .link-btn { padding: 2px 0; }
.zone-hint { color: var(--plum-soft); font-weight: 800; }

.cat-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 16px 6px; margin: 0 -16px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 13px; border-radius: 99px; background: var(--pink); color: var(--plum-soft);
  font-weight: 800; font-size: 13px; white-space: nowrap; transition: background .2s, color .2s;
}
.cat-tab.on { background: var(--plum); color: #fff; }

.sel-item { padding: 12px 14px; border-radius: var(--r-md); background: var(--cream); display: flex; flex-direction: column; gap: 6px; animation: rise .3s both; }
.sel-item.binary { background: #FFF0F3; }
.sel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sel-name { font-weight: 800; font-size: 14.5px; display: inline-flex; gap: 7px; align-items: center; line-height: 1.2; }
.sel-x { width: 30px; height: 30px; border-radius: 50%; background: #fff; color: var(--plum-soft); display: grid; place-items: center; flex: none; }
.sel-x .icon { width: 15px; height: 15px; stroke-width: 2.6; }
.sel-slider { display: flex; align-items: center; gap: 10px; }
.sel-face { font-size: 28px; line-height: 1; width: 34px; text-align: center; }
.sel-slider output { width: 30px; text-align: center; font-weight: 900; font-size: 19px; color: var(--rose-ink); }
.sel-word { font-size: 12.5px; font-weight: 800; color: var(--plum-soft); padding-inline-start: 44px; }
.sel-present { font-weight: 800; color: var(--danger); font-size: 13.5px; }

input[type="range"] {
  -webkit-appearance: none; appearance: none; flex: 1; min-width: 0; height: 12px; margin: 10px 0;
  border-radius: 99px; outline-offset: 6px;
  background: linear-gradient(to right, var(--rose) 0, var(--lav) var(--pct, 50%), #F3D3DE var(--pct, 50%));
}
[dir="rtl"] input[type="range"] { background: linear-gradient(to left, var(--rose) 0, var(--lav) var(--pct, 50%), #F3D3DE var(--pct, 50%)); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 30px; height: 30px; border-radius: 50%;
  background: #fff; border: 4px solid var(--rose); box-shadow: 0 3px 8px rgba(255, 92, 138, .45); cursor: grab;
}
input[type="range"]::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 4px solid var(--rose); box-shadow: 0 3px 8px rgba(255, 92, 138, .45); cursor: grab; }
input[type="range"]::-moz-range-track { background: transparent; }

.save-bar { position: sticky; bottom: calc(var(--tab-h) + var(--safe-b) + 10px); z-index: 10; }
.save-bar .btn { box-shadow: 0 14px 28px -8px rgba(255, 92, 138, .85), 0 0 0 5px rgba(255, 245, 248, .9); }

/* ----------------------------------------------------------- insights */
.notdx { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-md); background: var(--plum); color: #fff; }
.notdx-ico { font-size: 26px; line-height: 1; }
.notdx strong { font-weight: 900; font-size: 15.5px; }
.notdx p { font-size: 13px; opacity: .92; font-weight: 600; margin-top: 2px; }
.empty { align-items: center; text-align: center; padding: 28px 18px; }
.empty h2 { font-size: 20px; font-weight: 900; }

.alert-banner { display: flex; gap: 12px; align-items: center; width: 100%; text-align: start; padding: 14px 16px; border-radius: var(--r-md); background: linear-gradient(135deg, #F0426F, #D81B60); color: #fff; font-size: 22px; box-shadow: var(--shadow); }
.alert-banner strong { display: block; font-size: 14.5px; font-weight: 900; }
.alert-banner small { font-size: 13px; text-decoration: underline; font-weight: 700; }
.soon { background: #FFF8E5; }
.soon-item strong { font-weight: 900; font-size: 14.5px; }
.soon-item p { font-size: 13.5px; font-weight: 600; color: var(--plum-soft); }

.bars { display: flex; flex-direction: column; gap: 10px; }
.bars li { display: grid; grid-template-columns: 1fr auto; gap: 3px 8px; align-items: center; }
.bar-label { font-weight: 800; font-size: 13.5px; display: inline-flex; gap: 6px; align-items: center; min-width: 0; }
.bar-val { font-size: 12px; font-weight: 800; color: var(--plum-soft); white-space: nowrap; grid-row: 1; grid-column: 2; }
.bar-track { grid-column: 1 / -1; height: 10px; border-radius: 99px; background: var(--pink); overflow: hidden; }
.bar-track i { display: block; height: 100%; border-radius: 99px; background: var(--mint); animation: grow .8s cubic-bezier(.3, .9, .3, 1) both; transform-origin: left; }
[dir="rtl"] .bar-track i, [dir="rtl"] .meter i, [dir="rtl"] .contrib-bar i { transform-origin: right; }
.bar-track i.i-mid { background: linear-gradient(90deg, var(--sun), var(--rose-l)); }
.bar-track i.i-high { background: var(--grad); }
@keyframes grow { from { transform: scaleX(0); } }

.pattern { border-top: 6px solid var(--accent); }
.pattern-head { display: flex; align-items: center; gap: 12px; }
.pattern-emoji { width: 50px; height: 50px; flex: none; border-radius: 18px; display: grid; place-items: center; font-size: 26px; background: color-mix(in srgb, var(--accent) 22%, #fff); }
.pattern-title { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.pattern-title h3 { width: 100%; font-size: 17.5px; font-weight: 900; line-height: 1.2; }
.level-pill { padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 900; background: #F3EAEE; color: var(--plum-soft); }
.lvl-strong .level-pill:not(.dx) { background: var(--grad); color: #fff; }
.lvl-moderate .level-pill:not(.dx) { background: #F3E3FF; color: var(--lav-ink); }
.lvl-low .level-pill:not(.dx) { background: #DDF7EF; color: var(--mint-ink); }
.level-pill.dx { background: var(--plum); color: #fff; }
.pattern-pct { font-size: 30px; font-weight: 900; color: var(--rose-ink); line-height: 1; }
.pattern-pct small { font-size: 15px; }
.meter { height: 14px; border-radius: 99px; background: var(--pink); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 99px; background: var(--grad); animation: grow 1s cubic-bezier(.3, .9, .3, 1) both; transform-origin: left; }
.pattern-points { font-size: 12.5px; font-weight: 800; color: var(--plum-soft); margin-top: -6px; }
.pattern-about { font-size: 14px; font-weight: 600; }
.dx-note { padding: 10px 12px; border-radius: var(--r-sm); background: var(--cream); font-size: 13px; font-weight: 700; }
.pattern h4, .sheet-body h4 { font-size: 13px; font-weight: 900; text-transform: uppercase; letter-spacing: .4px; color: var(--plum-soft); }
html[lang="ar"] .pattern h4 { letter-spacing: 0; font-size: 14px; }

.contrib-list, .rule-list { display: flex; flex-direction: column; gap: 9px; }
.contrib { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; }
.contrib-name { font-weight: 800; font-size: 14px; display: inline-flex; gap: 6px; align-items: center; }
.contrib-pts { font-weight: 900; color: var(--rose-ink); grid-row: 1 / span 2; grid-column: 2; font-size: 16px; }
.contrib-meta { font-size: 12px; color: var(--plum-soft); font-weight: 700; }
.contrib-bar { grid-column: 1 / -1; height: 6px; border-radius: 99px; background: var(--pink); overflow: hidden; }
.contrib-bar i { display: block; height: 100%; border-radius: 99px; background: var(--accent); animation: grow .8s both; transform-origin: left; }
.rule { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: var(--r-sm); background: var(--cream); font-size: 13.5px; font-weight: 700; color: var(--plum-soft); }
.rule-ico { width: 24px; height: 24px; flex: none; border-radius: 50%; background: #F0DDE4; display: grid; place-items: center; font-weight: 900; }
.rule-label { flex: 1; }
.rule-pts { font-weight: 900; font-size: 12.5px; white-space: nowrap; }
.rule.hit { background: #DDF7EF; color: var(--mint-ink); }
.rule.hit .rule-ico { background: var(--mint); color: #fff; }

.ev-list, .life-list { display: flex; flex-direction: column; gap: 10px; }
.ev { padding: 12px 14px; border-radius: var(--r-sm); background: #fff; display: flex; flex-direction: column; gap: 7px; border-inline-start: 4px solid var(--accent, var(--rose)); }
.ev p { font-size: 14px; font-weight: 600; }
.ev-meta, .life-meta { display: flex; flex-wrap: wrap; gap: 5px; }
.ev-detail { font-size: 11.5px; color: var(--plum-soft); font-weight: 600; text-align: start; unicode-bidi: plaintext; }
.life-list li { padding: 10px 12px; border-radius: var(--r-sm); background: #fff; display: flex; flex-direction: column; gap: 6px; }
.life-text { font-weight: 700; font-size: 14px; }
.other-row { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-weight: 800; font-size: 14px; padding: 4px 0; }
.other-row .muted { font-size: 12.5px; }

/* ----------------------------------------------------------- community */
.demo-data { padding: 12px 14px; border-radius: var(--r-md); background: #FFF8E5; border: 2px dashed var(--sun); display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.demo-data p { font-size: 13px; font-weight: 700; color: #6B4A00; }
.demo-tag { display: inline-block; padding: 3px 10px; border-radius: 99px; background: var(--sun); color: #5A3D00; font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .4px; }
.demo-tag.you { background: var(--pink); color: var(--rose-ink); }
.filters { gap: 10px; padding: 14px; }
.filter-row { display: flex; flex-direction: column; gap: 6px; }
.filter-label { font-size: 12px; font-weight: 900; color: var(--plum-soft); text-transform: uppercase; letter-spacing: .4px; }
html[lang="ar"] .filter-label, html[lang="ar"] .demo-tag, html[lang="ar"] .com-label { letter-spacing: 0; font-size: 13px; }
.filter-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 2px 14px; }
.filter-chips::-webkit-scrollbar { display: none; }
.filter-chips .chip { flex: none; white-space: nowrap; }
.count-line { font-size: 13px; font-weight: 800; color: var(--plum-soft); padding: 0 4px; }

.com-card { border-inline-start: 6px solid var(--accent); }
.com-head { display: flex; align-items: center; gap: 10px; }
.avatar { width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--grad-soft); display: grid; place-items: center; font-size: 22px; }
.com-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.com-who strong { font-size: 14.5px; font-weight: 900; }
.com-who small { font-size: 12.5px; color: var(--plum-soft); font-weight: 700; }
.res-badge { padding: 5px 10px; border-radius: 99px; font-size: 12px; font-weight: 900; white-space: nowrap; flex: none; }
.res-helped { background: #DDF7EF; color: var(--mint-ink); }
.res-partly { background: #FFF0D0; color: #8A5A00; }
.res-no_change { background: #F3EAEE; color: var(--plum-soft); }
.res-worse { background: #FFE0E8; color: var(--danger); }
.com-label { display: block; font-size: 11.5px; font-weight: 900; text-transform: uppercase; letter-spacing: .4px; color: var(--plum-soft); margin-bottom: 2px; }
.com-tried { font-weight: 800; font-size: 15.5px; line-height: 1.35; }
.com-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.com-grid p, .com-side p { font-weight: 700; font-size: 14px; }
.com-card blockquote { padding: 10px 14px; border-radius: var(--r-sm); background: var(--cream); font-size: 14px; font-weight: 600; font-style: italic; }
.com-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.helped-btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 99px; background: var(--pink); color: var(--rose-ink); font-weight: 900; font-size: 13.5px; transition: transform .15s, background .2s; }
.helped-btn .icon { width: 18px; height: 18px; }
.helped-btn:active { transform: scale(.94); }
.helped-btn.on { background: var(--grad); color: #fff; }
.helped-btn.on .icon { fill: #fff; }
.helped-btn.pop .icon { animation: heart-pop .5s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes heart-pop { 0% { transform: scale(.4); } 60% { transform: scale(1.5); } 100% { transform: scale(1); } }

/* ----------------------------------------------------------- doctor */
.facts { display: flex; flex-direction: column; gap: 10px; }
.facts dt { font-size: 11.5px; font-weight: 900; text-transform: uppercase; letter-spacing: .4px; color: var(--plum-soft); }
.facts dd { font-weight: 700; font-size: 14.5px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { padding: 5px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 800; line-height: 1.25; }
.i-low { background: #DDF7EF; color: var(--mint-ink); }
.i-mid { background: #FFF0D0; color: #8A5A00; }
.i-high { background: #FFDDE7; color: var(--rose-ink); }
.i-flag { background: var(--danger); color: #fff; }
.plain { display: flex; flex-direction: column; gap: 4px; font-weight: 700; font-size: 14px; }
.q-list { display: flex; flex-direction: column; gap: 8px; }
.q { display: flex; align-items: center; gap: 6px; border-radius: var(--r-sm); background: var(--cream); transition: opacity .2s; }
.q label { flex: 1; display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; cursor: pointer; font-weight: 700; font-size: 14.5px; }
.q input[type="checkbox"] { appearance: none; -webkit-appearance: none; width: 24px; height: 24px; flex: none; border-radius: 9px; border: 2px solid var(--rose-l); background: #fff; display: grid; place-items: center; margin: 0; cursor: pointer; transition: background .2s; }
.q input[type="checkbox"]:checked { background: var(--grad); border-color: transparent; }
.q input[type="checkbox"]:checked::after { content: "✓"; color: #fff; font-weight: 900; font-size: 15px; line-height: 1; }
.q.off { opacity: .5; }
.q.off span { text-decoration: line-through; }
.q .sel-x { margin-inline-end: 10px; }
.add-q { display: flex; gap: 8px; }
.add-q .input { flex: 1; min-width: 0; }
.exam-list { display: flex; flex-direction: column; gap: 8px; }
.exam-list li { padding: 11px 14px; border-radius: var(--r-sm); background: var(--cream); display: flex; flex-direction: column; gap: 2px; }
.exam-list strong { font-size: 14.5px; font-weight: 900; }
.exam-list span { font-size: 13px; font-weight: 600; color: var(--plum-soft); }
.timeline { display: flex; flex-direction: column; }
.tl-item { display: grid; grid-template-columns: 74px 1fr; gap: 12px; padding: 12px 0; border-bottom: 2px dashed var(--pink); }
.tl-item:last-child { border-bottom: 0; }
.tl-date { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.tl-date strong { font-size: 13.5px; font-weight: 900; }
.tl-cd { padding: 2px 8px; border-radius: 99px; background: var(--pink); color: var(--rose-ink); font-size: 11.5px; font-weight: 900; }
.tl-mood { font-size: 18px; line-height: 1; }
.tl-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tl-note { font-size: 13.5px; font-style: italic; font-weight: 600; color: var(--plum-soft); }

/* ----------------------------------------------------------- overlays */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(74, 44, 58, .45);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .25s both;
}
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 480px; max-height: 92vh; max-height: 92dvh;
  background: var(--cream); border-radius: 30px 30px 0 0;
  display: flex; flex-direction: column;
  animation: sheet-up .4s cubic-bezier(.2, .9, .3, 1.1) both;
  box-shadow: 0 -20px 60px rgba(74, 44, 58, .3);
}
.overlay.still, .overlay.still .sheet { animation: none; }
@keyframes sheet-up { from { transform: translateY(60%); opacity: 0; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 8px; }
.sheet-head h2 { font-size: 21px; font-weight: 900; }
.sheet-body { overflow-y: auto; padding: 6px 18px calc(24px + var(--safe-b)); display: flex; flex-direction: column; gap: 12px; -webkit-overflow-scrolling: touch; }
.sheet-body h2 { font-size: 24px; font-weight: 900; }
.sheet-h { font-size: 14px; font-weight: 900; color: var(--plum-soft); margin-top: 10px; text-transform: uppercase; letter-spacing: .4px; }
html[lang="ar"] .sheet-h { letter-spacing: 0; font-size: 15px; }
.overlay.small { align-items: center; padding: 18px; }
.overlay.small .sheet { border-radius: 30px; max-width: 400px; animation-name: pop-in; }
@keyframes pop-in { from { transform: scale(.85); opacity: 0; } }
.lang-big.row .lang-opt { min-width: 0; }

.persona-list { display: flex; flex-direction: column; gap: 10px; }
.persona { display: flex; gap: 12px; align-items: center; width: 100%; text-align: start; padding: 14px; border-radius: var(--r-md); background: #fff; box-shadow: var(--shadow-sm); border-inline-start: 6px solid var(--accent); transition: transform .15s; }
.persona:active { transform: scale(.97); }
.persona-emoji { width: 48px; height: 48px; flex: none; border-radius: 16px; display: grid; place-items: center; font-size: 26px; background: color-mix(in srgb, var(--accent) 22%, #fff); }
.persona-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.persona-text strong { font-weight: 900; font-size: 15px; }
.persona-text small { font-size: 12.5px; color: var(--plum-soft); font-weight: 600; }

.how-step { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md); background: #fff; }
.how-n { width: 32px; height: 32px; flex: none; border-radius: 50%; background: var(--grad); color: #fff; font-weight: 900; display: grid; place-items: center; }
.how-step strong { font-weight: 900; }
.how-step p { font-size: 13.5px; font-weight: 600; color: var(--plum-soft); }
.weights { display: flex; flex-direction: column; }
.weights li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--pink); font-size: 13.5px; font-weight: 700; }
.weights b { color: var(--rose-ink); font-weight: 900; white-space: nowrap; }
.weights .bonus { color: var(--mint-ink); }
.weights .bonus b { color: var(--mint-ink); }

.overlay.urgent { background: linear-gradient(160deg, #F0426F 0%, #C2185B 60%, #8E24AA 100%); align-items: stretch; overflow-y: auto; }
.urgent-screen { width: 100%; max-width: 480px; margin: auto; padding: 28px 22px calc(28px + var(--safe-b)); color: #fff; display: flex; flex-direction: column; gap: 14px; text-align: center; animation: rise .4s both; }
.urgent-ico { font-size: 60px; line-height: 1; animation: pulse 0.8s infinite alternate; }
.urgent-screen h1 { font-size: 29px; font-weight: 900; line-height: 1.15; }
.urgent-sub { font-weight: 700; font-size: 16px; }
.urgent-list { display: flex; flex-direction: column; gap: 10px; text-align: start; }
.urgent-list li { padding: 14px 16px; border-radius: var(--r-md); background: rgba(255, 255, 255, .16); border: 1.5px solid rgba(255, 255, 255, .35); }
.urgent-list strong { font-weight: 900; font-size: 16px; }
.urgent-list p { font-size: 14px; font-weight: 600; margin-top: 2px; }
.urgent-do { font-weight: 800; font-size: 15px; }
.urgent-local, .urgent-foot { font-size: 13px; font-weight: 600; opacity: .95; }

.toast-root { position: fixed; z-index: 70; left: 0; right: 0; bottom: calc(var(--tab-h) + var(--safe-b) + 18px); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { padding: 12px 20px; border-radius: 99px; background: var(--plum); color: #fff; font-weight: 800; font-size: 14px; box-shadow: 0 10px 30px rgba(74, 44, 58, .35); animation: toast-in .35s cubic-bezier(.3, 1.4, .5, 1) both; text-align: center; }
.toast.out { opacity: 0; transform: translateY(10px); transition: opacity .4s, transform .4s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.9); } }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 80; pointer-events: none; display: none; }
.confetti.on { display: block; }

/* ----------------------------------------------------------- wider screens */
@media (min-width: 520px) {
  body { padding: 18px 0; }
  .app { border-radius: 36px; min-height: calc(100vh - 36px); overflow: clip; }
  .tabbar { bottom: 18px; border-radius: 26px 26px 36px 36px; }
  .view { padding-bottom: calc(var(--tab-h) + 40px); }
  .overlay:not(.urgent) { align-items: center; padding: 18px; }
  .overlay .sheet { border-radius: 30px; max-height: 86vh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ----------------------------------------------------------- print (Doctor tab → Save as PDF) */
@media print {
  @page { margin: 14mm; }
  html, body { background: #fff !important; padding: 0; font-size: 12px; }
  .topbar, .tabbar, .no-print, #overlay-root, .toast-root, .confetti, .save-bar { display: none !important; }
  .print-only { display: block !important; }
  .app { max-width: none; box-shadow: none; background: #fff; min-height: 0; border-radius: 0; overflow: visible; }
  .view { padding: 0; gap: 10px; }
  .view.enter > * { animation: none; }
  .card { box-shadow: none; border: 1px solid #F0C9D6; border-radius: 12px; padding: 12px; break-inside: auto; }
  .card-title { font-size: 14px; }
  .print-head { border-bottom: 3px solid var(--rose); padding-bottom: 8px; }
  .print-head h1 { font-size: 20px; color: var(--rose-ink); }
  .q.off { display: none; }
  .q { background: none; }
  .q label { padding: 3px 0; }
  .q input[type="checkbox"] { width: 14px; height: 14px; border-radius: 3px; border: 1.5px solid #999; background: #fff !important; }
  .q input[type="checkbox"]::after { content: "" !important; }
  .exam-list li { background: none; padding: 3px 0; }
  .tl-item, .q, .exam-list li, .sub-title { break-inside: avoid; }
  .pill, .tl-cd, .i-flag { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .fineprint { text-align: start; }
}

/* ---- Prototype v2 additions ---- */
.badge-com { background: var(--pink); color: var(--rose-ink); }
.try-btn { align-self: flex-start; min-height: 34px; padding: 6px 12px; font-size: 13px; }
.try-btn[disabled] { opacity: .45; cursor: not-allowed; }
.q-card .q-text { font-size: 16px; margin: 4px 0 10px; }
.q-btns { display: flex; gap: 10px; margin-bottom: 8px; }
.q-btns .btn { flex: 1; }
.exp-card { border: 2px solid var(--mint); }
.exp-item { font-weight: 800; margin: 2px 0 6px; }
.exp-res { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.rank-note { margin: 0 4px 10px; }
