:root {
  --bg: #0f1512; --bg2: #121a16; --surface: #17201b; --surface2: #1f2b24; --border: rgba(255,255,255,.08);
  --text: #eaf3ed; --muted: #8fa398; --accent: #b6f36a; --accent-ink: #0f1512; --accent2: #ff6b4a; --warn: #ffcc4d;
  --term: #0a0f0c; --term-text: #c9f7a0; --shadow: 0 10px 30px rgba(0,0,0,.35);
  --r: 18px; --safe-top: env(safe-area-inset-top); --safe-bottom: env(safe-area-inset-bottom);
  --font: -apple-system, BlinkMacSystemFont, "SF Hebrew", "Segoe UI", "Rubik", "Assistant", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Menlo", "Consolas", monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f4f1e8; --bg2: #ece7da; --surface: #fffdf7; --surface2: #f3efe3; --border: rgba(30,40,30,.1);
  --text: #18251d; --muted: #6b7a70; --accent: #2f9e44; --accent-ink: #fff; --accent2: #e8553a; --warn: #c98a00;
  --term: #1b2a21; --term-text: #c9f7a0; --shadow: 0 10px 30px rgba(40,50,30,.12);
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); }
body { min-height: 100dvh; overscroll-behavior-y: none; }
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(600px 300px at 110% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
              radial-gradient(500px 300px at -20% 110%, color-mix(in srgb, var(--accent2) 12%, transparent), transparent 70%); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
.hidden { display: none !important; }

/* ---------- layout ---------- */
.shell { max-width: 560px; margin: 0 auto; padding: calc(var(--safe-top) + 10px) 14px calc(var(--safe-bottom) + 90px); }
.topbar { display: flex; align-items: center; gap: 10px; padding: 4px 2px 10px; }
.logo { width: 40px; height: 40px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 22px; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); flex: none; }
.title { flex: 1; min-width: 0; }
.title h1 { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: -.3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.title .sub { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.on { background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.avatars { display: flex; flex-direction: row-reverse; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; color: #0f1512; border: 2px solid var(--bg); margin-inline-start: -8px; position: relative; }
.avatar.online::after { content: ""; position: absolute; bottom: -1px; left: -1px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); display: grid; place-items: center; font-size: 18px; flex: none; transition: transform .12s; }
.icon-btn:active { transform: scale(.92); }

/* ---------- segmented tabs ---------- */
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 4px; position: relative; margin-bottom: 12px; }
.tabs button { position: relative; z-index: 1; padding: 10px 6px; font-weight: 700; font-size: 15px; color: var(--muted); border-radius: 10px; transition: color .2s; }
.tabs button.active { color: var(--accent-ink); }
.tabs .pill { position: absolute; top: 4px; bottom: 4px; width: calc(50% - 4px); right: 4px; background: var(--accent); border-radius: 10px; transition: transform .28s cubic-bezier(.3,1.4,.5,1); }
.tabs[data-tab="shop"] .pill { transform: translateX(-100%); }
.badge { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 10px; font-size: 12px; background: var(--surface2); color: var(--text); margin-inline-start: 4px; }
.tabs button.active .badge { background: rgba(0,0,0,.18); color: inherit; }

/* ---------- command bar ---------- */
.cmd-wrap { position: sticky; top: calc(var(--safe-top) + 6px); z-index: 20; margin-bottom: 14px; }
.cmd { background: var(--term); border-radius: var(--r); padding: 10px 10px 8px; box-shadow: var(--shadow); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.cmd-row { display: flex; align-items: center; gap: 8px; }
.prompt { font-family: var(--mono); color: var(--accent); font-weight: 800; font-size: 18px; padding-inline-start: 4px; user-select: none; }
:root[data-theme="light"] .prompt { color: #b6f36a; }
.cmd input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: var(--term-text); font-size: 17px; padding: 10px 2px; caret-color: #b6f36a; }
.cmd input::placeholder { color: color-mix(in srgb, var(--term-text) 45%, transparent); }
.send { width: 42px; height: 42px; border-radius: 12px; background: #b6f36a; color: #0f1512; font-size: 20px; font-weight: 900; display: grid; place-items: center; transition: transform .12s, opacity .2s; }
.send:active { transform: scale(.9); }
.send[disabled] { opacity: .35; }
.mic { color: var(--term-text); opacity: .7; font-size: 18px; width: 34px; height: 42px; }
.preview { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 2px 4px; min-height: 0; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; padding: 4px 9px; border-radius: 999px; background: rgba(182,243,106,.12); color: var(--term-text); border: 1px solid rgba(182,243,106,.22); animation: pop .22s ease-out; }
.chip.rm { background: rgba(255,107,74,.14); color: #ffb3a2; border-color: rgba(255,107,74,.3); }
.chip .cat { opacity: .7; font-size: 11.5px; }
.hint { font-size: 12px; color: color-mix(in srgb, var(--term-text) 55%, transparent); padding: 2px 4px 0; font-family: var(--mono); direction: rtl; }
.hint b { color: var(--term-text); font-weight: 600; }
.hint code { background: rgba(255,255,255,.08); padding: 0 5px; border-radius: 5px; font-family: var(--mono); }

/* terminal output (receipt) */
.receipt { margin-top: 8px; background: #fbf8ef; color: #1d1d1d; border-radius: 6px 6px 0 0; padding: 14px 16px 18px; font-family: var(--mono); font-size: 14px; position: relative; animation: print .45s ease-out; box-shadow: var(--shadow); max-height: 55vh; overflow: auto;
  -webkit-mask: linear-gradient(#000 0 0) top/100% calc(100% - 10px) no-repeat, conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom/16px 10px repeat-x; }
.receipt h3 { margin: 0 0 6px; font-size: 15px; text-align: center; letter-spacing: 1px; }
.receipt .rule { border-top: 1px dashed #999; margin: 8px 0; }
.receipt .rc { font-weight: 700; margin-top: 6px; }
.receipt .ri { display: flex; justify-content: space-between; gap: 8px; }
.receipt .ri.done { text-decoration: line-through; opacity: .5; }
.receipt .actions { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }
.receipt button { font-family: var(--font); font-size: 13px; padding: 6px 12px; border-radius: 8px; background: #1d1d1d; color: #fff; }
.receipt .close { position: absolute; top: 6px; left: 8px; background: none; color: #555; font-size: 18px; padding: 2px 6px; }
@keyframes print { from { clip-path: inset(0 0 100% 0); transform: translateY(-6px); } to { clip-path: inset(0 0 0 0); transform: none; } }

/* ---------- list ---------- */
.cat-block { margin-bottom: 12px; animation: fadeup .3s ease-out both; }
.cat-head { display: flex; align-items: center; gap: 8px; padding: 6px 4px; font-weight: 800; font-size: 14px; color: var(--muted); letter-spacing: .2px; }
.cat-head .emo { font-size: 18px; filter: saturate(1.1); }
.cat-head .count { margin-inline-start: auto; font-size: 12px; font-weight: 600; }
.items { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.item { display: flex; align-items: center; gap: 10px; padding: 12px 12px; border-bottom: 1px solid var(--border); position: relative; min-height: 54px; transition: background .2s, opacity .25s; }
.item:last-child { border-bottom: 0; }
.item .bar { position: absolute; inset-inline-start: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; }
.item .name { flex: 1; min-width: 0; font-size: 16.5px; font-weight: 600; }
.item .meta { display: block; font-size: 11.5px; color: var(--muted); font-weight: 500; margin-top: 1px; }
.qty { font-size: 13.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--surface2); white-space: nowrap; direction: rtl; }
.item .x { width: 34px; height: 34px; border-radius: 10px; color: var(--muted); font-size: 18px; display: grid; place-items: center; }
.item .x:active { background: color-mix(in srgb, var(--accent2) 20%, transparent); color: var(--accent2); }
.item.bought .name { text-decoration: line-through; color: var(--muted); }
.item.pop { animation: pop .35s cubic-bezier(.3,1.5,.5,1); }
.item.flash { animation: flash 1.2s ease-out; }
.item.leaving { opacity: 0; transform: translateX(30px); transition: all .25s; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fadeup { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes flash { 0% { background: color-mix(in srgb, var(--accent) 30%, transparent); } 100% { background: transparent; } }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .big { font-size: 64px; margin-bottom: 8px; animation: bob 2.4s ease-in-out infinite; }
.empty h2 { color: var(--text); margin: 4px 0 6px; font-size: 19px; }
.empty .ex { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.empty .ex button { padding: 8px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 14px; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-4deg); } }

/* ---------- shop mode ---------- */
.progress { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px; display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.ring { width: 58px; height: 58px; flex: none; }
.ring circle { fill: none; stroke-width: 7; }
.ring .bg { stroke: var(--surface2); }
.ring .fg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .5s cubic-bezier(.3,1.2,.5,1); transform: rotate(-90deg); transform-origin: center; }
.progress .ptxt { flex: 1; }
.progress .ptxt b { font-size: 20px; display: block; }
.progress .ptxt span { color: var(--muted); font-size: 13px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 16px; border-radius: 14px; font-weight: 700; font-size: 15px; background: var(--surface2); border: 1px solid var(--border); transition: transform .12s; }
.btn:active { transform: scale(.96); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.danger { color: var(--accent2); }
.btn.block { width: 100%; }
.btn.sm { padding: 8px 12px; font-size: 13.5px; border-radius: 11px; }
.shop-item { display: flex; align-items: center; gap: 14px; padding: 16px 14px; min-height: 68px; border-bottom: 1px solid var(--border); user-select: none; -webkit-user-select: none; transition: background .2s; }
.shop-item:active { background: var(--surface2); }
.shop-item:last-child { border-bottom: 0; }
.check { width: 34px; height: 34px; border-radius: 50%; border: 2.5px solid var(--muted); flex: none; display: grid; place-items: center; transition: all .25s cubic-bezier(.3,1.5,.5,1); }
.check svg { width: 18px; height: 18px; stroke: var(--accent-ink); stroke-width: 3.5; fill: none; stroke-dasharray: 24; stroke-dashoffset: 24; transition: stroke-dashoffset .3s .05s; }
.shop-item.bought .check { background: var(--accent); border-color: var(--accent); transform: scale(1.05); }
.shop-item.bought .check svg { stroke-dashoffset: 0; }
.shop-item .name { flex: 1; font-size: 19px; font-weight: 700; }
.shop-item .name small { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.shop-item.bought .name { text-decoration: line-through; color: var(--muted); }
.shop-item .qty { font-size: 15px; }
.cart-head { display: flex; align-items: center; justify-content: space-between; margin: 18px 4px 8px; color: var(--muted); font-weight: 800; font-size: 14px; }
.allset { text-align: center; padding: 26px 10px; }
.allset .big { font-size: 60px; animation: bob 1.6s infinite; }

/* ---------- onboarding / cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 6px; font-size: 16.5px; }
.card p { margin: 4px 0 10px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.notif-card { border-color: color-mix(in srgb, var(--accent) 35%, transparent); background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, var(--surface)), var(--surface)); position: relative; }
.notif-card .close { position: absolute; top: 8px; left: 8px; color: var(--muted); font-size: 18px; padding: 4px 8px; }
.steps { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 8px; }
.steps li { display: flex; gap: 10px; align-items: center; font-size: 14.5px; }
.steps .n { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
.share-ico { display: inline-block; vertical-align: -3px; width: 18px; height: 18px; }

.hero { text-align: center; padding: calc(var(--safe-top) + 30px) 20px 10px; }
.hero .logo-big { width: 92px; height: 92px; border-radius: 28px; margin: 0 auto 16px; background: var(--accent); display: grid; place-items: center; font-size: 50px; box-shadow: 0 16px 40px color-mix(in srgb, var(--accent) 40%, transparent); animation: bob 3s ease-in-out infinite; }
.hero h1 { font-size: 34px; margin: 0; letter-spacing: -.5px; }
.hero h1 span { color: var(--accent); }
.hero p { color: var(--muted); margin: 8px 0 0; font-size: 15.5px; }
.floaters { position: relative; height: 0; }
.field { display: block; margin-bottom: 12px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.field input, .field select { width: 100%; padding: 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface2); font-size: 16px; outline: none; transition: border-color .2s; }
.field input:focus { border-color: var(--accent); }
.feature { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--muted); margin: 8px 0; }
.feature b { color: var(--text); }
.mylists a { display: flex; justify-content: space-between; align-items: center; padding: 12px 4px; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--border); font-weight: 600; }

/* ---------- sheet ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; animation: fade .2s; backdrop-filter: blur(2px); }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; background: var(--surface); border-radius: 24px 24px 0 0; padding: 10px 18px calc(var(--safe-bottom) + 18px); max-height: 88dvh; overflow: auto; animation: up .3s cubic-bezier(.2,1.2,.4,1); max-width: 560px; margin: 0 auto; box-shadow: 0 -10px 40px rgba(0,0,0,.3); }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--border); margin: 0 auto 12px; background: var(--muted); opacity: .4; }
.sheet h2 { margin: 0 0 12px; font-size: 19px; }
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.cat-grid button { padding: 10px 4px; border-radius: 12px; background: var(--surface2); border: 1.5px solid transparent; font-size: 12.5px; font-weight: 600; display: grid; gap: 2px; justify-items: center; }
.cat-grid button .e { font-size: 22px; }
.cat-grid button.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--surface2)); }
.qty-row { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; }
.stepper { display: flex; align-items: center; background: var(--surface2); border-radius: 14px; border: 1px solid var(--border); }
.stepper button { width: 46px; height: 48px; font-size: 22px; font-weight: 700; }
.stepper input { width: 64px; text-align: center; border: 0; background: transparent; font-size: 18px; font-weight: 700; outline: none; }
.qty-row select { flex: 1; padding: 13px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface2); font-size: 16px; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
.member { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.member .avatar { margin: 0; border: 0; }
.member .who { flex: 1; font-weight: 600; }
.member .tag { font-size: 12px; color: var(--muted); }
.link-box { display: flex; gap: 8px; align-items: center; background: var(--surface2); border-radius: 12px; padding: 10px 12px; font-family: var(--mono); font-size: 12.5px; direction: ltr; overflow: hidden; margin-bottom: 10px; }
.link-box span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa { background: #25d366 !important; color: #06240f !important; }
.section-title { font-size: 13px; color: var(--muted); font-weight: 700; margin: 16px 0 6px; }
.small { font-size: 12.5px; color: var(--muted); line-height: 1.5; }

/* ---------- toasts ---------- */
#toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--safe-bottom) + 16px); z-index: 80; display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 14px; }
.toast { pointer-events: auto; background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: 14px; font-size: 14.5px; font-weight: 600; box-shadow: var(--shadow); animation: toastin .35s cubic-bezier(.2,1.4,.4,1); max-width: 520px; display: flex; gap: 10px; align-items: center; }
.toast button { color: var(--accent); font-weight: 800; }
:root[data-theme="light"] .toast button { color: #b6f36a; }
.toast.out { animation: toastout .25s forwards; }
@keyframes toastin { from { transform: translateY(20px) scale(.95); opacity: 0; } }
@keyframes toastout { to { transform: translateY(10px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(100%); } }
.confetti { position: fixed; top: -20px; z-index: 90; font-size: 22px; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }
.offline { background: color-mix(in srgb, var(--warn) 20%, var(--surface)); color: var(--text); text-align: center; font-size: 12.5px; padding: 6px; border-radius: 10px; margin-bottom: 8px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
a.btn { text-decoration: none; color: inherit; } a.btn.primary { color: var(--accent-ink); }
.prompt { font-size: 26px; line-height: 1; padding: 0 4px; }
.shell[data-tab="shop"] .cmd-wrap { position: relative; top: 0; }
.shell[data-tab="shop"] .hint { display: none; }
img.logo-big { display: block; object-fit: cover; }
.notif-card h3 { padding-left: 26px; }
.member-pick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.mp { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--surface2); border: 1.5px solid var(--border); font-weight: 700; font-size: 15px; }
.mp .avatar { width: 28px; height: 28px; margin: 0; border: 0; font-size: 13px; }
.mp.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--surface2)); }
.mp .tgb { font-size: 13px; }
input.otp { text-align: center; font-family: var(--mono); font-size: 26px !important; letter-spacing: 8px; font-weight: 800; }
.linkish { display: block; margin: 12px auto 0; color: var(--muted); font-size: 13.5px; text-decoration: underline; }
.xfer-code { margin: 12px 0 4px; text-align: center; font-family: var(--mono); font-size: 34px; font-weight: 800; letter-spacing: 4px; padding: 14px; border-radius: 14px; background: var(--term); color: #b6f36a; animation: pop .3s; }
body:has(#sheet-root .sheet) #toasts { bottom: auto; top: calc(var(--safe-top) + 14px); }
