/* SugarHero design system — mobile-first, RTL/LTR logical properties, light/dark */
:root {
  --bg: #F4F5FB; --surface: #FFFFFF; --surface-2: #F0F2FA; --ink: #14162B; --ink-2: #565B78; --ink-3: #8B90AA; --line: #E4E7F2;
  --brand: #5B5BF0; --brand-2: #8B5CF6; --brand-soft: #ECECFE; --brand-ink: #3A3AC8;
  --c-vlow: #B42318; --c-low: #F04438; --c-ok: #12B76A; --c-high: #F79009; --c-vhigh: #8E44EC;
  --bg-vlow: #FEE4E2; --bg-low: #FEE4E2; --bg-ok: #D3F8E2; --bg-high: #FEF0C7; --bg-vhigh: #F0E7FD;
  --t-vlow: #912018; --t-low: #B42318; --t-ok: #067647; --t-high: #B54708; --t-vhigh: #6B21A8;
  --radius: 22px; --shadow: 0 1px 2px rgba(20, 22, 43, .04), 0 10px 30px rgba(20, 22, 43, .06);
  --font-ar: "Cairo", "Segoe UI", Tahoma, "Noto Sans Arabic", system-ui, sans-serif;
  --font-en: "Inter", -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  --tab-h: 68px; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] { --bg: #0D0F1F; --surface: #171A30; --surface-2: #1F2340; --ink: #EEF0FF; --ink-2: #AEB3D3; --ink-3: #7F85A8; --line: #2A2E50;
    --brand: #8B8BFF; --brand-soft: #25285A; --brand-ink: #C9C9FF;
    --bg-vlow: #4A1D1A; --bg-low: #4A1D1A; --bg-ok: #12392A; --bg-high: #46320D; --bg-vhigh: #31205A;
    --t-vlow: #FDA29B; --t-low: #FDA29B; --t-ok: #6CE9A6; --t-high: #FEC84B; --t-vhigh: #D6BBFB;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .3); color-scheme: dark; }
}
html[data-theme="dark"] { --bg: #0D0F1F; --surface: #171A30; --surface-2: #1F2340; --ink: #EEF0FF; --ink-2: #AEB3D3; --ink-3: #7F85A8; --line: #2A2E50;
  --brand: #8B8BFF; --brand-soft: #25285A; --brand-ink: #C9C9FF;
  --bg-vlow: #4A1D1A; --bg-low: #4A1D1A; --bg-ok: #12392A; --bg-high: #46320D; --bg-vhigh: #31205A;
  --t-vlow: #FDA29B; --t-low: #FDA29B; --t-ok: #6CE9A6; --t-high: #FEC84B; --t-vhigh: #D6BBFB;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .3); color-scheme: dark; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
html[lang="ar"] body { font-family: var(--font-ar); }
html[lang="en"] body { font-family: var(--font-en); }
body.noscroll { overflow: hidden; }
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; border-radius: 10px; }
[hidden] { display: none !important; }

#app { max-width: 560px; margin: 0 auto; min-height: 100dvh; background: var(--bg); position: relative; }
@media (min-width: 640px) { body { background: radial-gradient(1200px 600px at 50% -10%, color-mix(in srgb, var(--brand) 14%, var(--bg)), var(--bg)); } #app { box-shadow: 0 0 0 1px var(--line), 0 30px 80px rgba(20, 22, 43, .12); } }
.ic { flex: none; }
.muted { color: var(--ink-2); }
.hint { color: var(--ink-3); font-size: 13px; margin-top: 8px; line-height: 1.5; }
.fine { color: var(--ink-3); font-size: 12.5px; padding: 8px 20px 0; display: flex; gap: 6px; align-items: flex-start; }
.fine .ic { margin-top: 3px; }
.center { text-align: center; justify-content: center; }
.pad { padding-inline: 4px; }
small { font-size: .62em; font-weight: 600; color: var(--ink-3); }

/* ---------- boot splash ---------- */
#boot { min-height: 100dvh; display: grid; place-items: center; }
#boot span { width: 42px; height: 42px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--brand); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- app bar & tab bar ---------- */
.appbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px); }
.child-chip { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 12px 4px 4px; padding-inline: 4px 12px; font-weight: 700; cursor: pointer; box-shadow: var(--shadow); }
.child-chip .hero { border-radius: 50%; background: var(--brand-soft); }
.appbar-end { display: flex; gap: 8px; }
.icon-btn { border: 0; background: var(--surface-2); width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; cursor: pointer; color: var(--ink-2); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 10px; }
.icon-btn.sos { width: auto; padding: 0 12px; display: flex; gap: 6px; background: var(--bg-low); color: var(--t-low); font-weight: 800; font-size: 13px; border-radius: 999px; }
.view { padding: 4px 16px calc(var(--tab-h) + 48px + env(safe-area-inset-bottom)); }
.report-view { padding-bottom: 32px; }
.tabbar { position: fixed; bottom: 0; inset-inline: 0; margin-inline: auto; width: 100%; max-width: 560px; z-index: 30; height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); display: grid; grid-template-columns: 1fr 1fr 78px 1fr 1fr; align-items: center; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px); border-top: 1px solid var(--line); }
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; color: var(--ink-3); font-size: 11.5px; font-weight: 600; padding: 8px 0; }
.tab.active { color: var(--brand); }
.fab { justify-self: center; width: 58px; height: 58px; margin-top: -26px; border-radius: 50%; border: 4px solid var(--bg); color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); display: grid; place-items: center; cursor: pointer; box-shadow: 0 10px 24px color-mix(in srgb, var(--brand) 45%, transparent); transition: transform .15s; }
.fab:active { transform: scale(.94); }
.platebar { position: fixed; inset-inline: 0; margin-inline: auto; bottom: calc(var(--tab-h) + 10px + env(safe-area-inset-bottom)); width: calc(100% - 24px); max-width: 536px; z-index: 25; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px 10px 16px; padding-inline: 16px 12px; border-radius: 18px; background: var(--ink); color: var(--bg); box-shadow: 0 12px 30px rgba(0, 0, 0, .25); }
.platebar > div { display: flex; align-items: center; gap: 10px; font-size: 14px; }

/* ---------- typography & cards ---------- */
.page-title { font-size: 28px; font-weight: 800; letter-spacing: -.01em; margin: 8px 4px 14px; }
.greet { padding: 6px 4px 6px; }
.greet h1 { font-size: 27px; font-weight: 800; line-height: 1.25; letter-spacing: -.01em; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin: 12px 0; }
.card.pad { padding: 18px; }
.card-flat { background: var(--surface-2); border-radius: 16px; padding: 12px 14px; margin: 12px 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.card-head h3 { font-size: 16.5px; font-weight: 800; }
.card-head a { color: var(--brand); font-size: 14px; font-weight: 700; text-decoration: none; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--brand); font-weight: 700; text-decoration: none; margin: 8px 2px 0; }
html[dir="ltr"] .back .ic-chev { transform: scaleX(-1); }
html[dir="rtl"] .back .ic-chev { transform: none; }
html[dir="rtl"] .ic-chev { transform: scaleX(-1); }
.link { color: var(--brand); font-weight: 700; }

/* ---------- glucose hero ---------- */
.s-vlow { --sc: var(--c-vlow); --sc-bg: var(--bg-vlow); --sc-t: var(--t-vlow); }
.s-low { --sc: var(--c-low); --sc-bg: var(--bg-low); --sc-t: var(--t-low); }
.s-ok { --sc: var(--c-ok); --sc-bg: var(--bg-ok); --sc-t: var(--t-ok); }
.s-high { --sc: var(--c-high); --sc-bg: var(--bg-high); --sc-t: var(--t-high); }
.s-vhigh { --sc: var(--c-vhigh); --sc-bg: var(--bg-vhigh); --sc-t: var(--t-vhigh); }
.glu-card { background: linear-gradient(160deg, var(--sc-bg), var(--surface) 68%); padding: 20px 18px 18px; }
.glu-row { display: flex; align-items: center; gap: 18px; }
.glu-info { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.glu-when { font-size: 20px; font-weight: 800; }
.glu-ctx { color: var(--ink-2); font-size: 14px; }
.ring { position: relative; flex: none; }
.ring svg { position: absolute; inset: 0; }
.ring-bg { fill: none; stroke: color-mix(in srgb, var(--sc) 16%, var(--surface)); stroke-width: 12; }
.ring-fg { fill: none; stroke: var(--sc); stroke-width: 12; stroke-linecap: round; }
.ring-txt { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05; direction: ltr; }
.ring-txt b { font-size: 36px; font-weight: 800; letter-spacing: -.02em; }
.ring-txt span { font-size: 12px; color: var(--ink-2); font-weight: 600; margin-top: 2px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.glu-card .badge, .a1c-card .badge { background: var(--sc); color: #fff; }
.b-vlow { background: var(--bg-vlow); color: var(--t-vlow); } .b-low { background: var(--bg-low); color: var(--t-low); } .b-ok { background: var(--bg-ok); color: var(--t-ok); } .b-high { background: var(--bg-high); color: var(--t-high); } .b-vhigh { background: var(--bg-vhigh); color: var(--t-vhigh); }
.glu-card .badge.b-ok, .glu-card .badge.b-high, .glu-card .badge.b-low, .glu-card .badge.b-vlow, .glu-card .badge.b-vhigh { background: var(--sc); color: #fff; }
.rangebar { position: relative; margin-top: 22px; padding-bottom: 20px; direction: ltr; }
.rb-track { height: 10px; border-radius: 999px; }
.rb-pin { position: absolute; top: -6px; width: 6px; height: 22px; margin-inline-start: -3px; background: var(--ink); border: 2px solid var(--surface); border-radius: 6px; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); }
.rb-l { position: absolute; top: 16px; font-size: 11px; color: var(--ink-3); transform: translateX(-50%); }

/* banners */
.banner { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 18px; margin: 12px 0; }
.banner p { font-size: 13.5px; opacity: .92; }
.banner > div { flex: 1; }
.banner-low { background: var(--c-low); color: #fff; }
.banner-high { background: var(--bg-vhigh); color: var(--t-vhigh); }
.banner-info { background: var(--brand-soft); color: var(--brand-ink); }
.callout { display: flex; gap: 12px; padding: 14px; border-radius: 16px; margin-top: 14px; }
.callout p { font-size: 14px; margin-top: 2px; }
.callout.danger { background: var(--bg-low); color: var(--t-low); } .callout.warn { background: var(--bg-high); color: var(--t-high); }
.callout .ic { margin-top: 2px; }

/* ---------- quick actions & stats ---------- */
.quick, .quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0; }
.quick-grid { margin: 8px 0 12px; }
.qa { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 4px; border: 1px solid var(--line); background: var(--surface); border-radius: 18px; font-weight: 700; font-size: 12.5px; text-align: center; cursor: pointer; text-decoration: none; box-shadow: var(--shadow); }
.qa:active { transform: scale(.97); }
.qi { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; font-style: normal; }
.q-g { background: #E7F0FF; color: #2563EB; } .q-i { background: #FFE9E4; color: #E5484D; } .q-f { background: #E3F8EC; color: #16A34A; } .q-l { background: #F1E8FD; color: #8E44EC; }
html[data-theme="dark"] .qi, html[data-theme="auto"] .qi { filter: none; }
@media (prefers-color-scheme: dark) { html[data-theme="auto"] .q-g { background: #1B2A4D; color: #7BA7FF; } html[data-theme="auto"] .q-i { background: #4A2321; color: #FF9A94; } html[data-theme="auto"] .q-f { background: #14382A; color: #6CE9A6; } html[data-theme="auto"] .q-l { background: #31205A; color: #D6BBFB; } }
html[data-theme="dark"] .q-g { background: #1B2A4D; color: #7BA7FF; } html[data-theme="dark"] .q-i { background: #4A2321; color: #FF9A94; } html[data-theme="dark"] .q-f { background: #14382A; color: #6CE9A6; } html[data-theme="dark"] .q-l { background: #31205A; color: #D6BBFB; }
.stats3, .stats4 { display: grid; gap: 10px; margin: 12px 0; }
.stats3 { grid-template-columns: repeat(3, 1fr); } .stats4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 400px) { .stats4 { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 12px 10px; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.stat b { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.stat span { font-size: 12px; color: var(--ink-2); }
.stat.warn b { color: var(--t-low); }

/* TIR + chart */
.tir-bar { direction: ltr; display: flex; height: 16px; border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.tir-seg { display: block; height: 100%; } .tir-seg.c-none { background: var(--line); }
.tir-seg.c-vlow, .dot.c-vlow, .ch-pt.c-vlow { background: var(--c-vlow); fill: var(--c-vlow); } .tir-seg.c-low, .dot.c-low, .ch-pt.c-low { background: var(--c-low); fill: var(--c-low); }
.tir-seg.c-ok, .dot.c-ok, .ch-pt.c-ok { background: var(--c-ok); fill: var(--c-ok); } .tir-seg.c-high, .dot.c-high, .ch-pt.c-high { background: var(--c-high); fill: var(--c-high); }
.tir-seg.c-vhigh, .dot.c-vhigh, .ch-pt.c-vhigh { background: var(--c-vhigh); fill: var(--c-vhigh); }
.tir-legend { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 6px 14px; }
.tir-legend li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.tir-legend b { margin-inline-start: auto; color: var(--ink); }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: none; }
.chart { width: 100%; height: auto; display: block; }
.ch-band { fill: var(--bg-ok); opacity: .75; } .ch-grid { stroke: var(--line); stroke-dasharray: 3 4; }
.ch-t { fill: var(--ink-3); font-size: 10px; font-family: inherit; } .ch-line { fill: none; stroke: var(--ink-3); stroke-width: 1.4; opacity: .45; stroke-linejoin: round; }
.ch-pt { stroke: var(--surface); stroke-width: 1.6; cursor: pointer; }

/* streak */
.streak-top { display: flex; align-items: center; gap: 12px; }
.flame { width: 46px; height: 46px; border-radius: 15px; background: #FFF1D6; color: #F59E0B; display: grid; place-items: center; }
.streak-top b { font-size: 18px; font-weight: 800; } .streak-top p { font-size: 13px; }
.week { display: flex; justify-content: space-between; margin-top: 14px; }
.week span { width: 38px; height: 38px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; color: transparent; }
.week span.on { background: #FFF1D6; color: #F59E0B; }

/* ---------- lists & timeline ---------- */
.list { list-style: none; padding: 4px 0; margin: 8px 0 14px; }
.list.card { padding: 4px 0; }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; text-decoration: none; cursor: pointer; border-bottom: 1px solid var(--line); }
li:last-child > .li, .list > .li:last-child { border-bottom: 0; }
.li-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.li-main b { font-size: 16px; font-weight: 700; } .li-main span { color: var(--ink-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; font-size: 12.5px; color: var(--ink-3); }
.food .li-end { flex-direction: row; align-items: center; gap: 8px; }
.day-h { font-size: 13.5px; color: var(--ink-3); font-weight: 700; margin: 18px 6px 0; letter-spacing: .02em; }
.tl { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.tl li { display: flex; align-items: center; gap: 12px; padding: 8px 0; cursor: pointer; }
.tl li > div { flex: 1; display: flex; flex-direction: column; } .tl li span { font-size: 13px; color: var(--ink-2); } .tl time { font-size: 13px; color: var(--ink-3); }
.tl-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); flex: none; font-style: normal; }
.tl-ic.c-vlow, .tl-ic.c-low { background: var(--bg-low); color: var(--t-low); } .tl-ic.c-ok { background: var(--bg-ok); color: var(--t-ok); } .tl-ic.c-high { background: var(--bg-high); color: var(--t-high); } .tl-ic.c-vhigh { background: var(--bg-vhigh); color: var(--t-vhigh); }
.tl-ic.c-ins { background: #FFE9E4; color: #E5484D; } .tl-ic.c-meal { background: #E3F8EC; color: #16A34A; } .tl-ic.c-lab { background: #F1E8FD; color: #8E44EC; }
.empty, .empty-card { text-align: center; padding: 28px 16px; color: var(--ink-2); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-card { padding: 28px 20px; } .empty-card h2 { font-size: 21px; font-weight: 800; color: var(--ink); }
.empty-li { padding: 24px; text-align: center; color: var(--ink-3); list-style: none; }
.a1c-card { background: linear-gradient(160deg, var(--sc-bg), var(--surface) 70%); }
.a1c-num { display: flex; align-items: baseline; gap: 4px; margin-top: 2px; } .a1c-num b { font-size: 44px; font-weight: 800; line-height: 1.1; } .a1c-num span { font-size: 20px; font-weight: 700; color: var(--ink-2); } .a1c-num .badge { margin-inline-start: 10px; align-self: center; }

/* ---------- buttons & forms ---------- */
.btn { min-height: 50px; padding: 0 22px; border-radius: 16px; border: 0; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; background: var(--surface-2); color: var(--ink); transition: transform .12s, filter .15s; }
.btn:active { transform: scale(.98); } .btn:disabled { opacity: .6; cursor: wait; }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: 0 8px 20px color-mix(in srgb, var(--brand) 32%, transparent); }
.btn-secondary { background: var(--brand-soft); color: var(--brand-ink); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-danger { background: var(--c-low); color: #fff; }
.btn-danger-ghost { background: var(--bg-low); color: var(--t-low); }
.btn-light { background: #fff; color: var(--t-low); }
.btn-block { width: 100%; margin-top: 12px; } .btn-lg { min-height: 54px; font-size: 17px; } .btn-sm { min-height: 38px; padding: 0 14px; border-radius: 12px; font-size: 14px; }
.btn.btn-block + .btn.btn-block { margin-top: 10px; }
.label { display: block; font-size: 13.5px; font-weight: 700; color: var(--ink-2); margin: 16px 2px 6px; }
.input { width: 100%; padding: 14px 16px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface-2); color: var(--ink); font: inherit; font-size: 16px; min-height: 50px; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); background: var(--surface); }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-size: 6px 6px; background-position: calc(100% - 20px) 55%, calc(100% - 14px) 55%; background-repeat: no-repeat; }
html[dir="rtl"] select.input { background-position: 20px 55%, 14px 55%; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bigfield { position: relative; margin-top: 8px; }
.input.big { font-size: 44px; font-weight: 800; text-align: center; min-height: 92px; padding-inline: 16px 90px; border-radius: 20px; direction: ltr; }
.bigfield .unit { position: absolute; inset-inline-end: 18px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-weight: 700; font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 2px 0 6px; margin-inline: -16px; padding-inline: 16px; }
.chips.scroll::-webkit-scrollbar { display: none; } .chips.sub { margin-top: 0; }
.chip { position: relative; } .chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chip span, .chip-btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 15px; min-height: 40px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 600; font-size: 14.5px; white-space: nowrap; cursor: pointer; color: var(--ink-2); }
.chip input:checked + span, .chip-btn.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; }
.chip-btn.on .dot { box-shadow: 0 0 0 2px #fff; }
.range { margin: 10px 0 0; }
.seg { display: flex; background: var(--surface-2); border-radius: 16px; padding: 4px; gap: 4px; margin: 8px 0 12px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 10px 8px; border-radius: 12px; font-weight: 700; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 2px 8px rgba(20, 22, 43, .1); }
.seg-scroll { overflow-x: auto; scrollbar-width: none; }
.check { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; font-size: 14px; color: var(--ink-2); } .check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--brand); flex: none; }
.check a { color: var(--brand); font-weight: 700; }
.search { position: relative; margin: 6px 0 10px; } .search .ic { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); } .search .input { padding-inline-start: 42px; }
.stepper { display: inline-flex; align-items: center; gap: 12px; }
.stepper button { width: 38px; height: 38px; border-radius: 12px; border: 0; background: var(--surface-2); font-size: 22px; font-weight: 700; cursor: pointer; line-height: 1; }
.stepper b { min-width: 28px; text-align: center; }
.stepper.big { display: flex; position: relative; } .stepper.big button { width: 54px; height: 54px; flex: none; font-size: 28px; }
.stepper.big .input { text-align: center; font-size: 30px; font-weight: 800; direction: ltr; padding-inline: 12px; } .stepper.big .unit { position: absolute; inset-inline: 0; bottom: 3px; text-align: center; font-size: 11px; color: var(--ink-3); pointer-events: none; }
.add-btn { width: 36px; height: 36px; border-radius: 12px; border: 0; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; font-weight: 800; cursor: pointer; flex: none; }
.add-btn.in { background: var(--brand); color: #fff; }
.carb { font-size: 13px; color: var(--ink-2); background: var(--surface-2); padding: 3px 9px; border-radius: 999px; white-space: nowrap; } .carb b { color: var(--ink); }
.legend { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--ink-2); } .legend .ic { margin-top: 2px; color: var(--brand); }
.avatars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.av { position: relative; display: block; } .av input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.av span { display: grid; place-items: center; padding: 6px; border-radius: 18px; border: 2px solid var(--line); background: var(--surface-2); }
.av input:checked + span { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent); }
.av input:focus-visible + span { outline: 3px solid var(--brand); }

/* recipes */
.recipes { display: grid; gap: 12px; margin-top: 8px; }
.recipe { text-align: start; border: 1px solid var(--line); background: var(--surface); border-radius: 22px; padding: 16px; cursor: pointer; box-shadow: var(--shadow); display: block; width: 100%; }
.recipe h3 { font-size: 18px; font-weight: 800; margin: 8px 0 4px; } .recipe p { color: var(--ink-2); font-size: 14px; }
.recipe-top { display: flex; justify-content: space-between; align-items: center; }
.rtag { display: inline-block; padding: 3px 11px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-ink); font-size: 12px; font-weight: 700; }
.rcarb { font-size: 13px; color: var(--ink-2); } .rcarb b { font-size: 20px; color: var(--ink); }
.rmeta { margin-top: 10px; display: flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: 13px; }
.recipe-sheet h3 { font-size: 16px; margin: 18px 0 6px; font-weight: 800; }
.bul, .num { margin: 6px 0; padding-inline-start: 22px; color: var(--ink); line-height: 1.8; } .bul li::marker { color: var(--brand); } .num li::marker { color: var(--brand); font-weight: 800; }

/* more / learn */
.sos-card { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 22px; background: linear-gradient(135deg, #F04438, #D92D20); color: #fff; text-decoration: none; margin: 4px 0 8px; box-shadow: 0 12px 28px rgba(217, 45, 32, .28); }
.sos-card > div { flex: 1; display: flex; flex-direction: column; } .sos-card b { font-size: 18px; } .sos-card span { font-size: 13px; opacity: .92; }
.acc { padding: 0; } .acc summary { list-style: none; display: flex; align-items: center; justify-content: space-between; padding: 16px; font-weight: 800; cursor: pointer; } .acc summary::-webkit-details-marker { display: none; }
html[dir] .acc summary .ic-chev { transform: rotate(90deg); transition: transform .2s; } html[dir] .acc[open] summary .ic-chev { transform: rotate(-90deg); } .acc-body { padding: 0 16px 16px; }
.em h2 { display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 800; margin-bottom: 6px; } .em-low { border-color: color-mix(in srgb, var(--c-low) 40%, var(--line)); }
.steps { list-style: none; counter-reset: s; margin: 14px 0 0; padding: 0; display: grid; gap: 12px; }
.steps li { counter-increment: s; position: relative; padding-inline-start: 44px; min-height: 34px; } .steps li p { color: var(--ink-2); font-size: 14px; margin-top: 2px; }
.steps li::before { content: counter(s); position: absolute; inset-inline-start: 0; top: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--c-low); color: #fff; display: grid; place-items: center; font-weight: 800; }
.prose p { margin: 6px 0 14px; color: var(--ink-2); } .prose h3 { font-weight: 800; margin-top: 6px; }

/* ---------- auth ---------- */
.auth { min-height: 100dvh; padding: calc(16px + env(safe-area-inset-top)) 20px 32px; background: radial-gradient(700px 360px at 50% -40px, color-mix(in srgb, var(--brand) 24%, transparent), transparent); }
.auth-top { display: flex; justify-content: flex-end; }
.pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 14px; cursor: pointer; }
.auth-hero { text-align: center; padding: 14px 0 20px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.auth-hero h1 { font-size: 34px; font-weight: 800; letter-spacing: -.02em; background: linear-gradient(135deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-hero p { color: var(--ink-2); } .auth-hero.small h1 { font-size: 26px; background: none; color: var(--ink); -webkit-text-fill-color: initial; }
.auth-hero .hero { filter: drop-shadow(0 14px 22px color-mix(in srgb, var(--brand) 35%, transparent)); animation: float 4s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px); } }
.auth-card { padding: 20px; margin-top: 4px; }

/* ---------- sheets & toasts ---------- */
.sheet-root { position: fixed; inset: 0; z-index: 60; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(10, 12, 30, .5); opacity: 0; transition: opacity .22s; backdrop-filter: blur(2px); }
.sheet { position: absolute; bottom: 0; inset-inline: 0; margin-inline: auto; width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; background: var(--surface); border-radius: 28px 28px 0 0; padding: 8px 20px calc(24px + env(safe-area-inset-bottom)); transform: translateY(100%); transition: transform .26s cubic-bezier(.2, .8, .2, 1); box-shadow: 0 -20px 60px rgba(0, 0, 0, .25); }
.sheet-root.open .sheet-backdrop { opacity: 1; } .sheet-root.open .sheet { transform: none; }
.sheet-grab { width: 44px; height: 5px; border-radius: 99px; background: var(--line); margin: 4px auto 14px; }
.sheet-title { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 20px; align-items: stretch; } .sheet-actions .btn-block { margin-top: 0; flex: 1; }
.alert-sheet { text-align: center; } .alert-sheet .alert-ic { width: 70px; height: 70px; border-radius: 50%; margin: 0 auto 10px; display: grid; place-items: center; }
.alert-sheet.low .alert-ic { background: var(--bg-low); color: var(--c-low); } .alert-sheet.high .alert-ic { background: var(--bg-vhigh); color: var(--c-vhigh); }
.alert-sheet .steps, .alert-sheet .bul, .alert-sheet .callout, .alert-sheet p.hint { text-align: start; } .big-val { font-size: 42px; font-weight: 800; margin: 4px 0 10px; direction: ltr; }
.plate-list { list-style: none; padding: 0; margin: 12px 0; } .plate-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); } .plate-list li div:first-child { display: flex; flex-direction: column; } .plate-list span { color: var(--ink-2); font-size: 13px; }
.total { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 16px; background: var(--brand-soft); color: var(--brand-ink); border-radius: 16px; font-weight: 700; } .total b { font-size: 26px; font-weight: 800; }
#toasts { position: fixed; top: calc(14px + env(safe-area-inset-top)); inset-inline: 0; z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 700; font-size: 14.5px; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); opacity: 0; transform: translateY(-12px); transition: all .25s; max-width: 92vw; }
.toast.show { opacity: 1; transform: none; } .toast.err { background: var(--c-low); color: #fff; } .toast.ok { background: #0F9F5B; color: #fff; }

/* ---------- report & print ---------- */
.report-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.report-head { display: flex; gap: 14px; align-items: center; margin: 12px 0; } .report-head h1 { font-size: 20px; font-weight: 800; } .report-head p { color: var(--ink-2); font-size: 14px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; } .tbl th { text-align: start; color: var(--ink-3); font-weight: 700; padding: 6px 4px; } .tbl td { padding: 7px 4px; border-top: 1px solid var(--line); }
.tbl tr.r-low td, .tbl tr.r-vlow td { background: var(--bg-low); } .tbl tr.r-high td { background: var(--bg-high); } .tbl tr.r-vhigh td { background: var(--bg-vhigh); }
@media print {
  .noprint, .tabbar, .appbar, .platebar, #toasts { display: none !important; }
  body { background: #fff !important; color: #000; } #app { box-shadow: none; max-width: none; background: #fff; }
  .card { box-shadow: none; break-inside: avoid; } .report-view { padding: 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* dark-mode tints for timeline icons */
html[data-theme="dark"] .tl-ic.c-ins { background: #4A2321; color: #FF9A94; } html[data-theme="dark"] .tl-ic.c-meal { background: #14382A; color: #6CE9A6; } html[data-theme="dark"] .tl-ic.c-lab { background: #31205A; color: #D6BBFB; }
html[data-theme="dark"] .flame, html[data-theme="dark"] .week span.on { background: #46320D; }
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] .tl-ic.c-ins { background: #4A2321; color: #FF9A94; } html[data-theme="auto"] .tl-ic.c-meal { background: #14382A; color: #6CE9A6; } html[data-theme="auto"] .tl-ic.c-lab { background: #31205A; color: #D6BBFB; }
  html[data-theme="auto"] .flame, html[data-theme="auto"] .week span.on { background: #46320D; }
}

/* ---- v1.1: child photo, home clock, password reset, share ---- */
.kid-photo { border-radius: 50%; object-fit: cover; display: block; background: var(--brand-soft); flex: none; }
.child-chip .kid-photo { box-shadow: 0 0 0 2px var(--surface); }
.photo-pick { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 18px; background: var(--surface-2); border: 1px solid var(--line); }
.photo-prev { display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%; background: var(--brand-soft); flex: none; overflow: hidden; }
.photo-prev .kid-photo { box-shadow: 0 0 0 3px var(--brand); }
.photo-btns { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.photo-btns label { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.greet { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.clock { text-align: end; display: flex; flex-direction: column; gap: 2px; flex: none; max-width: 48%; }
.clock b { font-size: 22px; font-weight: 800; color: var(--brand-ink); line-height: 1.1; font-variant-numeric: tabular-nums; }
.clock span { font-size: 12.5px; color: var(--ink-2); line-height: 1.35; }
.link-btn { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; margin-top: 14px; background: none; border: 0; color: var(--brand); font: inherit; font-weight: 700; font-size: 14.5px; cursor: pointer; padding: 6px; }
.callout.info { background: var(--brand-soft); color: var(--brand-ink); }
.demo-code { display: inline-block; font-size: 26px; letter-spacing: .3em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.code-input { font-size: 24px; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; }
.share-card { display: flex; align-items: center; gap: 14px; width: 100%; margin: 14px 0; padding: 16px 18px; border: 0; border-radius: 22px; cursor: pointer; text-align: start; font: inherit; color: #fff; background: linear-gradient(135deg, #22C55E, #0EA5A4); box-shadow: 0 10px 24px -10px rgba(14,165,164,.6); }
.share-card div { flex: 1; display: flex; flex-direction: column; } .share-card b { font-size: 17px; } .share-card span { font-size: 13px; opacity: .9; }
.share-url { margin: 12px 0; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px dashed var(--line); font-size: 13.5px; color: var(--ink-2); word-break: break-all; text-align: left; }
.share-url small { display: block; margin-bottom: 6px; }
.share-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 10px; }
.share-opt { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 6px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; text-decoration: none; }
.share-opt i { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); font-style: normal; }
.share-opt.wa i { background: #25D366; color: #fff; }

/* ---- v1.2: أبطال السكري heroes ---- */
.duo { display: flex; justify-content: center; align-items: flex-end; direction: ltr; margin-bottom: 4px; }
.duo .hero { margin: 0 -10px; }
.hero-builder { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 20px; background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 6px; }
.hb-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hb-opt { position: relative; display: block; cursor: pointer; }
.hb-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.hb-big span { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); min-height: 60px; }
.hb-big b { font-size: 15px; }
.hb-big input:checked + span { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.hb-opt input:focus-visible + span { outline: 3px solid var(--brand); outline-offset: 2px; }
.hb-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.hb-line > span { font-weight: 700; font-size: 14px; color: var(--ink-2); }
.hb-dots { display: flex; gap: 10px; }
.hb-dot span { display: block; width: 36px; height: 36px; border-radius: 50%; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--line); }
.hb-dot input:checked + span { box-shadow: 0 0 0 3px var(--surface), 0 0 0 6px var(--brand); }
.hb-dot { padding: 4px; }
.hb-big span { padding: 8px 10px; gap: 8px; }
.hb-big b { font-size: 14px; white-space: nowrap; }

/* ---- v1.3: game & rewards ---- */
.play-card { display: flex; align-items: center; gap: 12px; margin: 14px 0; padding: 12px 16px; border-radius: 22px; text-decoration: none; color: #fff; background: linear-gradient(135deg, #6D6BFF, #4338CA); box-shadow: 0 10px 24px -12px rgba(67,56,202,.7); }
.play-card div { flex: 1; display: flex; flex-direction: column; } .play-card b { font-size: 17px; } .play-card div span { font-size: 13px; opacity: .9; }
.play-card .hero { background: rgba(255,255,255,.18); border-radius: 50%; flex: none; }
.star-pill { display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; border-radius: 999px; background: #FFD166; color: #1E1B4B; font-weight: 800; font-size: 15px; white-space: nowrap; }
.star-pill.big { font-size: 18px; padding: 6px 14px; }
.game-card { padding: 16px; }
.g-head { display: flex; align-items: center; gap: 12px; } .g-head h2 { margin: 0 0 4px; font-size: 19px; } .g-head p { margin: 0; color: var(--ink-2); font-size: 14px; line-height: 1.6; }
.g-head .hero { flex: none; }
.g-legend { display: grid; gap: 8px; margin: 14px 0 10px; }
.g-legend > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border-radius: 14px; background: var(--surface-2); }
.g-icons { display: flex; gap: 4px; direction: ltr; }
.g-legend b { font-size: 14px; } .g-legend .up { color: #C2410C; } .g-legend .down { color: #4338CA; } .g-legend .ok { color: #0369A1; }
.g-why { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; line-height: 1.6; color: var(--ink-2); background: var(--brand-soft); padding: 10px 12px; border-radius: 14px; margin: 0 0 14px; }
.g-why svg { flex: none; margin-top: 3px; }
.g-none { text-align: center; font-weight: 700; padding: 10px; background: var(--surface-2); border-radius: 14px; }
.g-stage { display: flex; justify-content: center; }
.g-stage canvas { border-radius: 22px; touch-action: none; outline: none; max-width: 100%; }
.g-stage canvas:focus-visible { box-shadow: 0 0 0 3px var(--brand); }
.g-pad { display: flex; justify-content: space-between; gap: 12px; margin-top: 12px; direction: ltr; }
.g-btn { flex: 1; height: 64px; border-radius: 20px; border: 0; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; touch-action: none; cursor: pointer; }
.g-btn:active { background: var(--brand); color: #fff; }
.g-btn[data-move=left] svg { transform: scaleX(-1) !important; } .g-btn[data-move=right] svg { transform: none !important; }
.g-stage { position: relative; }
.g-msg { position: absolute; top: 44px; left: 12px; right: 50px; padding: 10px 12px; opacity: 0; transform: translateY(-8px); transition: opacity .25s, transform .25s; pointer-events: none; font-weight: 700; font-size: 14px; line-height: 1.6; border-radius: 14px; box-shadow: 0 8px 20px -10px rgba(30,27,75,.35); }
.g-msg.show { opacity: 1; transform: none; }
.g-msg.low { background: #FEF2F2; color: #991B1B; } .g-msg.high { background: #FFF7ED; color: #9A3412; }
.g-result { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 8px 0; }
.g-result h2 { margin: 4px 0 0; font-size: 24px; } .g-result p { margin: 0; color: var(--ink-2); }
.g-stars { font-size: 32px; color: #F2B630; letter-spacing: 4px; margin: 4px 0 8px; }
.acc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.acc { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; border-radius: 18px; border: 2px solid var(--line); background: var(--surface-2); position: relative; }
.acc.on { border-color: var(--brand); background: var(--brand-soft); }
.acc b { font-size: 14px; } .acc .btn { width: 100%; font-size: 13px; padding-inline: 6px; white-space: nowrap; }
.acc-tag { position: absolute; top: 6px; inset-inline-start: 6px; font-size: 11px; font-weight: 800; background: var(--brand); color: #fff; padding: 2px 8px; border-radius: 999px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.btn[aria-disabled="true"] { opacity: .55; }
#game-host { scroll-margin-top: 76px; }

/* ===== v2: family, notifications, community, hero, legal ===== */
html[data-mode="child"] [data-act="addL"], html[data-mode="child"] [data-act="addFood"], html[data-mode="child"] [data-act="delFood"], html[data-mode="child"] .sheet-actions [data-act="del"] { display: none !important; }
html[data-mode="child"] li[data-act^="edit"] { cursor: default; }
html[data-mode="child"] .child-chip { cursor: default; }
.card-title { display: flex; align-items: center; gap: 8px; font-size: 17px; margin: 0 0 10px; }
.sec-title { font-size: 16px; margin: 20px 4px 6px; color: var(--ink-2); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ok-line { display: flex; align-items: center; gap: 8px; color: var(--t-ok); font-weight: 700; margin: 0; }
.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; margin-bottom: 4px; }
.tag.pend { background: var(--bg-high); color: var(--t-high); }
.tl-ic.ok { background: var(--bg-ok); color: var(--t-ok); }
.child-login { margin: 4px 16px 0; width: calc(100% - 32px); }
.fam-kid { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.fam-kid:first-of-type { border-top: 0; }
.switch-row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2); margin-top: 6px; }
.switch-row input { width: 20px; height: 20px; accent-color: var(--brand); flex: none; }
.big-code { font: 800 44px/1.1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; text-align: center; padding: 18px; margin: 12px 0 4px; border-radius: 18px; background: var(--brand-soft); color: var(--brand-ink); }
.code-input { font: 700 26px ui-monospace, monospace; letter-spacing: .3em; text-align: center; }
.rem-time { font: 800 18px ui-monospace, monospace; color: var(--brand-ink); min-width: 58px; }
.mini-switch { position: relative; width: 44px; height: 26px; flex: none; }
.mini-switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.mini-switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background .2s; }
.mini-switch span::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.mini-switch input:checked + span { background: var(--brand); }
.mini-switch input:checked + span::after { transform: translateX(18px); }
[dir="rtl"] .mini-switch input:checked + span::after { transform: translateX(-18px); }
.mini-switch input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 10px 0; }
.preset { text-align: start; border: 1.5px solid var(--line); background: var(--surface-2); border-radius: 16px; padding: 12px; cursor: pointer; display: grid; gap: 2px; color: var(--ink); }
.preset b { font-size: 14.5px; } .preset span { font-size: 12.5px; color: var(--ink-2); }
.preset:hover { border-color: var(--brand); }
.src-box { margin: 8px 0; font-size: 13px; color: var(--ink-2); } .src-box summary { cursor: pointer; font-weight: 700; color: var(--brand); }
.src-box ul { margin: 6px 0; padding-inline-start: 18px; } .src-box a, .hq-src a { color: var(--brand); }
.src-url { display: block; font-size: 12px; color: var(--brand); word-break: break-all; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; } .chips.scroll::-webkit-scrollbar { display: none; }
.post-li { align-items: center; }
.post-title { font-size: 20px; margin: 4px 0; }
.post-meta { font-size: 12.5px; color: var(--ink-3); margin: 0 0 8px; }
.post-body { white-space: normal; overflow-wrap: anywhere; line-height: 1.7; }
.reply { margin: 8px 0; padding: 12px 14px; }
.ugc-actions { display: flex; gap: 14px; margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.ugc-actions .link-btn { font-size: 13px; color: var(--ink-3); display: inline-flex; gap: 4px; align-items: center; margin: 0; padding: 0; }
.link-btn.danger { color: var(--t-low) !important; }
.rules-box { max-height: 280px; overflow: auto; padding: 4px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); font-size: 14px; }
.legal h2, .legal h3 { margin-top: 18px; } .legal li { margin: 4px 0; } .legal a { color: var(--brand); word-break: break-word; }
.hq { margin: 10px 0; } .hq-q { font-weight: 700; margin: 0 0 8px; }
.hq-a { background: var(--brand-soft); color: var(--ink); border-radius: 14px; padding: 12px 14px; line-height: 1.75; }
.hq-src { font-size: 13px; margin: 8px 0 0; }
.hq .link-btn { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; }
.hero-ask textarea, .reply textarea { resize: vertical; }
.src-pick { border: 1px solid var(--line); border-radius: 14px; padding: 4px 12px 10px; margin: 12px 0; } .src-pick legend { font-weight: 700; font-size: 14px; padding: 0 6px; }
.mod-item .post-body { background: var(--surface-2); border-radius: 12px; padding: 10px; margin: 6px 0; }
