/* =========================================================
   Family Cart - "Midnight Aurora"
   Dark glass, soft glow, thin borders, mint + violet light.
   Features: summary row, folios, counter.
   ========================================================= */
:root {
  --bg: #0A0E19; --bg2: #121a2e; --text: #E9EEFF; --mut: #8E99B8;
  --glass: rgba(255, 255, 255, .055); --glass2: rgba(255, 255, 255, .09); --line: rgba(255, 255, 255, .1);
  --accent: #5CF2C0; --accent2: #4CC9F0; --on-accent: #06251C;
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, .7); --blur: blur(18px) saturate(1.5);
  --aur1: rgba(110, 90, 255, .35); --aur2: rgba(40, 220, 190, .22); --aur3: rgba(255, 90, 150, .14);
  --danger: #FF6B8A;
  --sans: "Space Grotesk", Heebo, system-ui, sans-serif;
  --ease: cubic-bezier(.19, 1, .22, 1); /* easeOutExpo, as on Preymaker */
}
/* Light palette applies when the user picks it, or when they never chose and the system is light. */
:root[data-mode="light"] {
  --bg: #EEF2FA; --bg2: #E3E9F6; --text: #131A2E; --mut: #5F6B8A;
  --glass: rgba(255, 255, 255, .72); --glass2: rgba(255, 255, 255, .95); --line: rgba(19, 26, 46, .1);
  --accent: #0FB589; --accent2: #2A8CF0; --on-accent: #FFFFFF;
  --shadow: 0 18px 36px -20px rgba(40, 60, 110, .35);
  --aur1: rgba(130, 110, 255, .22); --aur2: rgba(40, 220, 190, .2); --aur3: rgba(255, 130, 170, .16); --danger: #E0345A;
}
:root[data-mode="light"][data-theme="violet"] { --accent: #7B5CF0; --on-accent: #fff; }
:root[data-mode="light"][data-theme="coral"]  { --accent: #E8416A; --on-accent: #fff; }
:root[data-mode="light"][data-theme="sky"]    { --accent: #1E9AD0; --on-accent: #fff; }
:root[data-mode="light"][data-theme="amber"]  { --accent: #D98A12; --on-accent: #fff; }
@media (prefers-color-scheme: light) {
  :root:not([data-mode]) {
    --bg: #EEF2FA; --bg2: #E3E9F6; --text: #131A2E; --mut: #5F6B8A;
    --glass: rgba(255, 255, 255, .72); --glass2: rgba(255, 255, 255, .95); --line: rgba(19, 26, 46, .1);
    --accent: #0FB589; --accent2: #2A8CF0; --on-accent: #FFFFFF;
    --shadow: 0 18px 36px -20px rgba(40, 60, 110, .35);
    --aur1: rgba(130, 110, 255, .22); --aur2: rgba(40, 220, 190, .2); --aur3: rgba(255, 130, 170, .16); --danger: #E0345A;
  }
  :root:not([data-mode])[data-theme="violet"] { --accent: #7B5CF0; --on-accent: #fff; }
  :root:not([data-mode])[data-theme="coral"]  { --accent: #E8416A; --on-accent: #fff; }
  :root:not([data-mode])[data-theme="sky"]    { --accent: #1E9AD0; --on-accent: #fff; }
  :root:not([data-mode])[data-theme="amber"]  { --accent: #D98A12; --on-accent: #fff; }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; } /* component display rules (flex, grid) must not beat the attribute */
body {
  margin: 0; min-height: 100vh; color: var(--text); font-family: var(--sans); line-height: 1.45; overflow-x: hidden; -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(700px 480px at 90% -8%, var(--aur1), transparent 70%),
    radial-gradient(620px 520px at -10% 38%, var(--aur2), transparent 70%),
    radial-gradient(600px 460px at 100% 95%, var(--aur3), transparent 70%),
    var(--bg);
  background-attachment: fixed; font-variant-numeric: tabular-nums;
}
button, input, textarea { font-family: inherit; }
svg { display: block; flex: none; }
[data-icon], [data-icon-label] { line-height: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.mono { font-feature-settings: "tnum"; }

/* ---------- HUD ---------- */
.hud { position: sticky; top: 0; z-index: 30; padding-top: env(safe-area-inset-top); background: color-mix(in srgb, var(--bg) 62%, transparent); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border-bottom: 1px solid var(--line); }
.hud-in { max-width: 640px; margin: 0 auto; display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; white-space: nowrap; }
.brand i { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; color: var(--on-accent); background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: 0 6px 16px -4px color-mix(in srgb, var(--accent) 60%, transparent); }
.top-actions { display: flex; gap: 8px; }
#mode { margin-inline-start: auto; }
.round { width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line); cursor: pointer; padding: 0; display: grid; place-items: center; background: var(--glass); color: var(--text); transition: transform .15s var(--ease), background .2s; }
.round:hover { background: var(--glass2); }
.round.lime { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: var(--on-accent); border-color: transparent; }
.round:active { transform: scale(.9); }

/* ---------- Summary ---------- */
.top { max-width: 640px; margin: 0 auto; padding: 18px 16px 0; }
.sum-row { display: flex; flex-direction: column; gap: 14px; }
.sum-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.sum-actions #shop-btn { flex: 1 0 100%; min-height: 52px; }
.sum-actions .btn.alt { flex: 1 1 0; justify-content: center; }
.greet { margin: 0; font-size: 15px; font-weight: 500; color: var(--mut); cursor: pointer; width: fit-content; }
.remain { display: flex; align-items: baseline; gap: 10px; margin: 2px 0 0; }
.rm-n { font-size: 56px; font-weight: 700; line-height: 1; letter-spacing: -.03em; color: var(--accent); }
.caption { font-size: 22px; font-weight: 700; }
.sum-meta { margin: 4px 0 0; font-size: 14px; color: var(--mut); min-height: 1.4em; }
.btn.compact { flex: none; min-height: 44px; padding: 8px 18px; font-size: 15px; }

/* ---------- Buttons ---------- */
.btn, .primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer; text-decoration: none;
  font: 700 16px var(--sans); color: var(--on-accent); border: 0; border-radius: 99px; padding: 11px 24px; min-height: 48px;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: 0 10px 24px -10px color-mix(in srgb, var(--accent) 70%, transparent), inset 0 1px 0 rgba(255, 255, 255, .3);
  transition: transform .15s var(--ease), filter .2s;
}
.btn:hover, .primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn:active, .primary:active { transform: scale(.97); }
.btn.alt, .btn.secondary { background: var(--glass); color: var(--text); border: 1px solid var(--line); box-shadow: none; }
.btn.alt:hover, .btn.secondary:hover { background: var(--glass2); }

/* ---------- Main ---------- */
main { max-width: 640px; margin: 0 auto; padding: 26px 16px 170px; }
#status { color: var(--mut); font-size: 14px; margin: 0 0 12px; }
#status:empty { display: none; }
#status.error { color: #fff; background: var(--danger); padding: 10px 16px; border-radius: 16px; }
ul { list-style: none; margin: 0; padding: 0; }
.cap { margin: 0 0 10px; font-size: 12px; font-weight: 600; letter-spacing: .12em; color: var(--mut); }

.hint-banner { display: flex; align-items: center; gap: 10px; background: color-mix(in srgb, var(--accent) 12%, var(--glass)); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-radius: 20px; padding: 12px 14px; margin-bottom: 22px; font-size: 14px; }
.hint-banner p { margin: 0; flex: 1; }
.demo-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 18px; padding: 9px 14px; border-radius: 99px; font-size: 13px; color: var(--mut); background: var(--glass); border: 1px dashed var(--line); }
.demo-bar b { color: var(--text); }
.demo-bar a { color: var(--accent); font-weight: 700; text-decoration: none; white-space: nowrap; }
.hint-banner .go { border: 0; border-radius: 99px; padding: 8px 18px; font-weight: 700; cursor: pointer; background: var(--accent); color: var(--on-accent); }
.hint-banner .x { width: 32px; height: 32px; border: 0; background: none; color: var(--mut); cursor: pointer; display: grid; place-items: center; }

/* quick add */
.sugg-row { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 22px; padding: 2px 16px 6px; scrollbar-width: none; }
.sugg-row::-webkit-scrollbar { display: none; }
.sugg-row { -webkit-mask-image: linear-gradient(90deg, transparent, #000 22px, #000 calc(100% - 22px), transparent); mask-image: linear-gradient(90deg, transparent, #000 22px, #000 calc(100% - 22px), transparent); }
.sugg { flex: none; display: inline-flex; align-items: center; gap: 9px; cursor: pointer; white-space: nowrap; background: var(--glass); border: 1px solid var(--line); color: var(--text); border-radius: 99px; padding: 6px 16px 6px 7px; min-height: 44px; font-size: 15px; font-weight: 500; transition: transform .15s var(--ease), background .2s, border-color .2s; }
.sugg:hover { background: var(--glass2); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.sugg:active { transform: scale(.95); }
.tile { display: grid; place-items: center; flex: none; background: var(--tb); color: var(--tf); }
.sugg .tile { width: 30px; height: 30px; border-radius: 50%; }

/* ---------- Sections ---------- */
.group { position: relative; margin-bottom: 18px; border-radius: 26px; overflow: hidden; background: linear-gradient(160deg, var(--glass2), var(--glass)); border: 1px solid var(--line); box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .08); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); animation: rise .45s var(--ease) both; }
.group::before { content: ""; position: absolute; inset-inline: 0; top: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--cc, var(--accent)), transparent); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.group:nth-child(2) { animation-delay: .05s; } .group:nth-child(3) { animation-delay: .1s; } .group:nth-child(n+4) { animation-delay: .15s; }
.group-head { display: flex; align-items: center; gap: 12px; width: 100%; margin: 0; padding: 14px 16px; background: none; color: var(--text); border: 0; cursor: pointer; text-align: start; }
.gh-tile { width: 42px; height: 42px; border-radius: 14px; box-shadow: 0 8px 20px -8px var(--tb); }
.folio { font-size: 12px; font-weight: 600; color: var(--mut); }
.gh-name { flex: 1; font-size: 19px; font-weight: 700; }
.count { font-size: 13px; font-weight: 700; color: var(--cc, var(--accent)); background: color-mix(in srgb, var(--cc, var(--accent)) 15%, transparent); border-radius: 99px; min-width: 28px; text-align: center; padding: 2px 10px; }
.group.flip { overflow: visible; z-index: 2; }
.chev { color: var(--mut); transition: transform .25s var(--ease); }
.group.collapsed .chev { transform: rotate(90deg); }
.group.collapsed .card { display: none; }
.card { background: none; border: 0; border-top: 1px solid var(--line); }

/* ---------- Items ---------- */
li { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 8px; padding-inline-start: 16px; min-height: 60px; border-top: 1px solid var(--line); animation: pop .3s cubic-bezier(.2, .9, .3, 1.15); transition: background .2s var(--ease); }
li:first-child { border-top: 0; }
li:hover { background: var(--glass); }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }
li input[type=checkbox] { appearance: none; -webkit-appearance: none; flex: none; margin: 0; cursor: pointer; width: 28px; height: 28px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--text) 30%, transparent); background: transparent; display: grid; place-items: center; transition: background .2s, border-color .2s, transform .15s, box-shadow .3s; }
li input[type=checkbox] { position: relative; }
li input[type=checkbox]::before { content: ""; position: absolute; inset: -10px; } /* 24px padding box (28px minus borders) + 20px = 44px hit area */
li input[type=checkbox]::after { content: ""; width: 7px; height: 13px; margin-top: -2px; border: solid var(--on-accent); border-width: 0 3px 3px 0; transform: rotate(45deg) scale(0); transition: transform .2s cubic-bezier(.3, 1.8, .5, 1); }
li input[type=checkbox]:hover { border-color: var(--accent); }
li input[type=checkbox]:checked { background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 60%, transparent); }
li input[type=checkbox]:checked::after { transform: rotate(45deg) scale(1); }
li input[type=checkbox]:active { transform: scale(.85); }
li label { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 2px; min-width: 0; padding: 4px 0; cursor: pointer; }
.name { font-size: 17px; font-weight: 500; overflow-wrap: anywhere; }
.qty { direction: ltr; unicode-bidi: isolate; display: inline-block; margin-inline-start: 8px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 700; background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); vertical-align: 1px; }
.meta { font-size: 13px; color: var(--mut); overflow-wrap: anywhere; }
li.done .name { text-decoration: line-through; text-decoration-thickness: 1.5px; color: var(--mut); }
li.done .qty { background: var(--glass2); color: var(--mut); }
.ibtn { position: relative; flex: none; width: 36px; height: 36px; border: 0; border-radius: 50%; background: none; color: var(--mut); cursor: pointer; display: grid; place-items: center; transition: background .2s, color .2s; }
.ibtn::before { content: ""; position: absolute; inset: -2px; } /* 40px hit area */
.ibtn:hover, .ibtn:focus-visible { background: var(--glass2); color: var(--text); }

#done-section .card { background: var(--glass); border: 1px solid var(--line); border-radius: 26px; }
.section-title { display: flex; justify-content: space-between; align-items: center; margin: 10px 4px 12px; }
.section-title .cap { margin: 0; }
.link { font-size: 14px; color: var(--mut); background: none; border: 0; padding: 8px 4px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--text); }
.link.danger { color: var(--danger); }

/* ---------- Skeleton / empty / all done ---------- */
.skeleton { display: grid; gap: 14px; margin-top: 6px; }
.skeleton i { display: block; height: 80px; border-radius: 26px; border: 1px solid var(--line); background: linear-gradient(100deg, var(--glass) 30%, var(--glass2) 50%, var(--glass) 70%); background-size: 250% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton[hidden] { display: none; }
@keyframes shimmer { to { background-position: -150% 0; } }

.empty { text-align: center; padding: 30px 12px 8px; }
.empty-art { position: relative; width: 220px; height: 170px; margin: 0 auto 20px; }
.empty-cart { position: absolute; top: 20px; left: 50%; width: 130px; height: 130px; margin-left: -65px; display: grid; place-items: center; border-radius: 50%; color: var(--accent); background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--accent) 30%, transparent), var(--glass)); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); box-shadow: 0 0 60px -6px color-mix(in srgb, var(--accent) 55%, transparent); }
.empty-art i { position: absolute; display: block; border-radius: 50%; filter: blur(.5px); animation: float 4s ease-in-out infinite; }
.empty-art .s1 { top: 6px; inset-inline-start: 14px; width: 22px; height: 22px; background: #A58BFF; box-shadow: 0 0 20px #A58BFF; }
.empty-art .s2 { top: 16px; inset-inline-end: 8px; width: 16px; height: 16px; background: #FF6B8A; box-shadow: 0 0 18px #FF6B8A; animation-delay: -1s; }
.empty-art .s3 { bottom: 14px; inset-inline-start: 6px; width: 14px; height: 14px; background: #4CC9F0; box-shadow: 0 0 16px #4CC9F0; animation-delay: -2s; }
.empty-art .s4 { bottom: 6px; inset-inline-end: 20px; width: 24px; height: 24px; background: #FFC46B; box-shadow: 0 0 20px #FFC46B; animation-delay: -.5s; }
@keyframes float { 50% { transform: translateY(-10px); } }
.empty h2 { font-size: 28px; font-weight: 800; margin: 0 0 6px; line-height: 1.15; }
.empty p { margin: 0; color: var(--mut); font-size: 17px; }

.all-done { position: relative; overflow: hidden; text-align: center; padding: 30px 20px 26px; margin-bottom: 22px; border-radius: 30px; color: #fff; border: 1px solid rgba(255, 255, 255, .25); box-shadow: 0 24px 50px -20px color-mix(in srgb, var(--accent) 60%, #000);
  background: radial-gradient(400px 200px at 80% 0, rgba(255, 255, 255, .25), transparent 70%), linear-gradient(140deg, #6E5AFF, #1fb99a); animation: pop .45s cubic-bezier(.2, .9, .3, 1.2); }
.all-done::before { content: "✦ שלב הושלם"; display: block; margin-bottom: 12px; font-size: 13px; font-weight: 600; letter-spacing: .1em; opacity: .85; }
.ad-mark { width: 68px; height: 68px; margin: 0 auto 10px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .22); border: 1px solid rgba(255, 255, 255, .4); animation: float 3s ease-in-out infinite; }
.all-done h2 { margin: 0 0 4px; font-size: 32px; font-weight: 800; color: inherit; }
.all-done p { margin: 0 0 18px; opacity: .9; }
.all-done button { font: 700 16px var(--sans); border: 0; border-radius: 99px; padding: 12px 24px; min-height: 48px; cursor: pointer; background: #fff; color: #2b2470; transition: transform .15s var(--ease); }
.all-done button:active { transform: scale(.96); }

/* ---------- Add bar ---------- */
.add-bar { position: fixed; inset-inline: 0; bottom: 0; z-index: 5; max-width: 640px; margin: 0 auto; padding: 28px 16px calc(env(safe-area-inset-bottom) + 16px); background: linear-gradient(to top, var(--bg) 55%, transparent); }
.add-box { display: flex; align-items: flex-end; gap: 6px; padding: 6px; border-radius: 30px; background: color-mix(in srgb, var(--bg2) 75%, transparent); border: 1px solid var(--line); box-shadow: 0 20px 40px -16px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .08); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); transition: border-color .25s, box-shadow .25s; }
.add-box:focus-within { border-color: color-mix(in srgb, var(--accent) 65%, transparent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent), 0 20px 40px -16px rgba(0, 0, 0, .6); }
#add-input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font-size: 17px; line-height: 1.35; padding: 12px 14px; height: 48px; max-height: 168px; resize: none; outline: none; overflow-y: auto; }
#add-input::placeholder { color: var(--mut); }
.sq { flex: none; width: 48px; height: 48px; border: 0; border-radius: 50%; cursor: pointer; display: grid; place-items: center; background: var(--glass2); color: var(--text); transition: transform .15s var(--ease), background .2s; }
.sq.accent { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: var(--on-accent); box-shadow: 0 8px 20px -6px color-mix(in srgb, var(--accent) 70%, transparent); }
.sq:active { transform: scale(.88); }
.sq.listening { background: var(--danger); color: #fff; animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgba(255, 107, 138, 0); } 0% { box-shadow: 0 0 0 0 rgba(255, 107, 138, .5); } }

/* ---------- Dialogs ---------- */
dialog { border: 1px solid var(--line); border-radius: 30px; padding: 26px 20px 16px; width: min(92vw, 440px); max-height: 88vh; color: var(--text); background: color-mix(in srgb, var(--bg2) 92%, transparent); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: 0 40px 90px -20px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .1); }
dialog[open] { animation: pop .3s cubic-bezier(.2, .9, .3, 1.15); }
dialog::backdrop { background: rgba(4, 6, 14, .6); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
dialog h2 { margin: 0 0 6px; font-size: 26px; font-weight: 800; color: var(--text); }
.hint { margin: 0 0 14px; color: var(--mut); font-size: 15px; }
.dialog-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; }
.stack { display: grid; gap: 10px; margin-top: 6px; }
.qr { display: grid; place-items: center; margin: 14px auto; background: #fff; border-radius: 22px; padding: 12px; width: fit-content; box-shadow: 0 0 40px -8px color-mix(in srgb, var(--accent) 50%, transparent); }
.qr svg { width: 190px; height: 190px; }
.swatches { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; margin: 20px 0 10px; }
.swatch { width: 52px; height: 52px; border-radius: 50%; border: 0; cursor: pointer; padding: 0; box-shadow: 0 8px 20px -6px currentColor; outline: 2px solid transparent; outline-offset: 4px; transition: transform .15s var(--ease); }
.swatch:hover { transform: scale(1.08); }
.swatch[aria-pressed="true"] { outline-color: var(--text); }

#picker-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 14px; }
.pick { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; text-align: start; background: var(--glass); color: var(--text); border-radius: 99px; padding: 6px 12px 6px 6px; border: 1px solid var(--line); cursor: pointer; transition: border-color .2s, background .2s; }
.pick:hover { background: var(--glass2); }
.pick .tile { width: 34px; height: 34px; border-radius: 50%; }
.pick.current { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
#order-list { max-height: 50vh; overflow-y: auto; display: grid; gap: 6px; }
.order-row { min-height: 0; padding: 5px 8px 5px 10px; border-radius: 99px; background: var(--glass); border: 1px solid var(--line); animation: none; gap: 10px; }
.order-row:hover { background: var(--glass); }
.order-row .tile { width: 34px; height: 34px; border-radius: 50%; }
.order-row span.lbl { flex: 1; font-weight: 600; }
.order-row button { width: 36px; height: 36px; border: 0; border-radius: 50%; font-size: 1.1rem; background: var(--glass2); color: var(--text); cursor: pointer; }
.order-row button:disabled { opacity: .3; cursor: default; }

.field { display: grid; gap: 6px; margin: 12px 0; }
.field > span { font-size: 12px; font-weight: 600; letter-spacing: .06em; color: var(--mut); }
.field input { font-size: 17px; color: var(--text); background: var(--glass); border: 1px solid var(--line); border-radius: 16px; padding: 12px 16px; min-height: 50px; outline: none; transition: border-color .2s, box-shadow .2s; }
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.stepper { display: inline-flex; align-items: center; gap: 14px; background: var(--glass); border: 1px solid var(--line); border-radius: 99px; padding: 4px; width: fit-content; }
.stepper button { width: 42px; height: 42px; border: 0; border-radius: 50%; font-size: 1.4rem; cursor: pointer; background: var(--glass2); color: var(--text); }
.stepper button:active { transform: scale(.9); }
.stepper output { min-width: 28px; text-align: center; font-size: 1.3rem; font-weight: 700; }
.cat-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 14px 6px 6px; border: 1px solid var(--line); border-radius: 99px; background: var(--glass); color: var(--text); font-size: 16px; font-weight: 600; cursor: pointer; text-align: start; }
.cat-btn .tile { width: 36px; height: 36px; border-radius: 50%; }

@media (max-width: 600px) {
  .hud-in { gap: 10px; padding: 0 14px; }
  .brand { font-size: 15px; }
  dialog { width: 100%; max-width: none; margin: auto 0 0; border-radius: 30px 30px 0 0; border-bottom: 0; padding: 32px 20px calc(env(safe-area-inset-bottom) + 18px); }
  dialog::before { content: ""; position: absolute; top: 10px; left: 50%; width: 44px; height: 5px; margin-left: -22px; border-radius: 9px; background: var(--line); }
  dialog[open] { animation: sheet .35s cubic-bezier(.2, .9, .3, 1); }
}
@keyframes sheet { from { transform: translateY(100%); } }

/* ---------- Confetti ---------- */
#confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 40; }
.piece { position: absolute; top: -30px; box-shadow: 0 0 10px currentColor; animation: fall var(--dur, 2.6s) cubic-bezier(.3, .6, .5, 1) forwards; }
@keyframes fall { to { transform: translate3d(var(--dx, 0), 110vh, 0) rotate(var(--rot, 540deg)); opacity: .9; } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  #confetti { display: none; }
}

/* =========================================================
   Round 2 from Preymaker + Visuvate
   ========================================================= */
/* intro loader: tiny corner labels, centered mark */
#boot { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--bg); transition: opacity .4s var(--ease), visibility .4s; }
#boot.out { opacity: 0; visibility: hidden; }
.boot-mark { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 22px; color: var(--on-accent); background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: 0 0 60px -6px color-mix(in srgb, var(--accent) 60%, transparent); animation: float 2.4s ease-in-out infinite; }
.boot-l, .boot-r { position: absolute; top: 50%; margin-top: -6px; font-size: 10px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--mut); }
.boot-l { left: 16px; } .boot-r { right: 16px; direction: ltr; }

/* serif accent words: sans headline + serif emphasis (Hebrew has no italic, so contrast comes from the serif) */
em, .ser { font-style: normal; font-family: "Frank Ruhl Libre", Georgia, serif; font-weight: 500; color: var(--accent); }
.empty h2 em, .all-done h2 em { font-size: 1.1em; }
.all-done h2 em { color: #fff; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; text-decoration-color: rgba(255, 255, 255, .5); }


/* light/dark switch */
.switch { position: relative; flex: none; width: 52px; height: 30px; padding: 0; border-radius: 99px; border: 1px solid var(--line); background: var(--glass); cursor: pointer; transition: background .3s var(--ease); }
.switch::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--text); transition: transform .35s var(--ease); }
.switch[aria-checked="false"]::after { transform: translateX(22px); background: var(--accent); }
[dir="rtl"] .switch[aria-checked="false"]::after { transform: translateX(-22px); }
.switch svg { position: absolute; top: 7px; width: 14px; height: 14px; color: var(--mut); }
.switch .sun { inset-inline-end: 7px; } .switch .moon { inset-inline-start: 7px; }

/* corner micro-labels */
@media (max-width: 600px) { .switch { display: none; } .hud-in .switch.show { display: block; } }

/* ---------- Shopping mode ---------- */
dialog.shop { inset: 0; width: 100%; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; border-radius: 0; background: var(--bg); }
dialog.shop::before { display: none; }
dialog.shop::backdrop { background: var(--bg); }
.shop-in { display: flex; flex-direction: column; height: 100%; max-width: 640px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 14px); }
.shop-bar { display: flex; align-items: center; gap: 12px; }
.shop-bar h2 { flex: 1; margin: 0; font-size: 20px; }
.shop-pos { font-size: 14px; font-weight: 600; color: var(--mut); }
.shop-dots { display: flex; justify-content: center; gap: 2px; padding: 6px 0 2px; flex-wrap: wrap; }
.shop-dot { position: relative; width: 28px; height: 40px; padding: 0; border: 0; background: none; cursor: pointer; }
.shop-dot::after { content: ""; position: absolute; inset-block: 16px; inset-inline: 7px; border-radius: 99px; background: var(--glass2); transition: background .25s var(--ease), inset .25s var(--ease); }
.shop-dot.full::after { background: color-mix(in srgb, var(--cc) 55%, var(--glass2)); }
.shop-dot.cur::after { background: var(--cc); inset-block: 14px; inset-inline: 4px; }
.shop-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 8px 0 16px; overscroll-behavior: contain; }
.shop-head { display: flex; align-items: center; gap: 14px; padding: 4px 2px 8px; }
.shop-head h3 { margin: 0; font-size: 30px; font-weight: 800; line-height: 1.1; }
.shop-head p { margin: 2px 0 0; font-size: 15px; color: var(--mut); }
.shop-tile { width: 56px; height: 56px; border-radius: 18px; box-shadow: 0 10px 24px -8px var(--tb); }
.shop-row { position: relative; display: flex; align-items: center; gap: 16px; min-height: 76px; padding: 14px 18px; border-radius: 22px; background: linear-gradient(160deg, var(--glass2), var(--glass)); border: 1px solid var(--line); font-size: 22px; font-weight: 600; cursor: pointer; touch-action: pan-y; user-select: none; -webkit-user-select: none; transition: background .2s var(--ease), border-color .2s var(--ease), opacity .25s; }
.shop-row.armed { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, var(--glass)); }
.shop-mark { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--text) 30%, transparent); color: transparent; transition: background .2s, border-color .2s, color .2s; }
.shop-row.done { opacity: .5; }
.shop-row.done .shop-mark { background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; color: var(--on-accent); }
.shop-row.done .shop-name { text-decoration: line-through; text-decoration-thickness: 2px; }
.shop-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.shop-note { display: block; font-size: 14px; font-weight: 500; color: var(--mut); margin-top: 2px; }
.shop-nav { display: flex; gap: 10px; padding-top: 6px; }
.shop-nav[hidden] { display: none; }
.shop-nav .btn { flex: 1; min-height: 56px; font-size: 17px; }
.shop-nav .btn:disabled { opacity: .35; pointer-events: none; }
.shop-fin { margin: auto; text-align: center; display: grid; gap: 10px; justify-items: center; }
.shop-fin h3 { margin: 0; font-size: 30px; }
.shop-fin p { margin: 0 0 8px; color: var(--mut); }
.shop-fin .ad-mark { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: var(--on-accent); border-color: transparent; }
.toast { position: fixed; inset-inline: auto; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 96px); transform: translateX(-50%); z-index: 60; max-width: min(90vw, 420px); padding: 12px 18px; border-radius: 99px; font-size: 15px; font-weight: 600; color: var(--text); background: color-mix(in srgb, var(--bg2) 94%, transparent); border: 1px solid var(--line); box-shadow: var(--shadow); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.shop-time { font-size: 14px; font-weight: 600; color: var(--mut); font-variant-numeric: tabular-nums; direction: ltr; }
.shop-prev-trip { font-size: 14px; }
.toast { display: flex; align-items: center; gap: 14px; }
.toast button { flex: none; border: 0; background: none; padding: 8px 4px; min-height: 40px; font: 700 15px var(--sans); color: var(--accent); cursor: pointer; }
li { position: relative; touch-action: pan-y; }
li.swiping { transition: none; animation: none; }
li.sw-check { background: color-mix(in srgb, var(--accent) 22%, transparent); }
li.sw-del { background: color-mix(in srgb, var(--danger) 24%, transparent); }
li.armed { box-shadow: inset 0 0 0 2px currentColor; }

/* ---------- Desktop: summary sidebar + list, instead of one thin phone column ---------- */
@media (min-width: 1000px) {
  .hud-in { max-width: 1040px; }
  .shell { display: grid; grid-template-columns: minmax(0, 640px) 340px; gap: 36px; justify-content: center; align-items: start; }
  main { order: 1; margin: 0; max-width: none; }
  .top { order: 2; position: sticky; top: 84px; margin: 0; max-width: none; padding: 26px 0 0; }
  .btn.compact { white-space: nowrap; padding: 8px 12px; }
  .sum-row { padding: 22px; border-radius: 28px; background: var(--glass); border: 1px solid var(--line); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
  .add-bar { width: 640px; margin: 0; inset-inline-start: calc(50vw - 508px); inset-inline-end: auto; }
}

/* ---------- Dialogs: animate out as well as in ----------
   Where supported (Chrome 117+, Safari 17.4+, Firefox 129+), a closing dialog fades and slides away
   instead of vanishing. Elsewhere the entrance animations above still apply. */
@supports (transition-behavior: allow-discrete) {
  dialog {
    animation: none; opacity: 0; transform: translateY(10px) scale(.97);
    transition: opacity .2s ease, transform .3s var(--ease), overlay .3s allow-discrete, display .3s allow-discrete;
  }
  dialog[open] { animation: none; opacity: 1; transform: none; }
  @starting-style { dialog[open] { opacity: 0; transform: translateY(10px) scale(.97); } }
  dialog::backdrop { opacity: 0; transition: opacity .25s ease, overlay .25s allow-discrete, display .25s allow-discrete; }
  dialog[open]::backdrop { opacity: 1; }
  @starting-style { dialog[open]::backdrop { opacity: 0; } }
  @media (max-width: 600px) {
    dialog { transform: translateY(100%); }
    dialog[open] { transform: none; }
    @starting-style { dialog[open] { transform: translateY(100%); } }
  }
  dialog.shop { transform: scale(.98); }
  dialog.shop[open] { transform: none; }
  @starting-style { dialog.shop[open] { transform: scale(.98); } }
}
