/* BrightWins — blocky, dark, game-app theme. Original artwork, system fonts only. */
:root {
  --green: #00b06f;
  --green-dark: #00a065;
  --green-edge: #007a4d;
  --blue: #335fff;
  --blue-edge: #1f3bb3;
  --red: #d92b23;
  --red-edge: #8f1a15;
  --red-text: #ff6f68;
  --gold: #ffc933;
  --bux: #2fb5ff;
  --bux-ink: #8fdcff;
  --bux-edge: #0f5f95;
  --bg: #232527;
  --bg-deep: #191b1d;
  --card: #393b3d;
  --card-2: #2b2d2f;
  --line: #4d5053;
  --line-soft: #3c3e41;
  --field-line: #6a6d71;
  --grey-btn: #4a4d50;
  --grey-edge: #2a2c2e;
  --ink: #ffffff;
  --muted: #bdbebe;
  --link: #8aa5ff;
  --radius: 10px;
  --radius-sm: 8px;
  --font: "Builder Sans", "Gotham", "Montserrat", "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  font-family: var(--font);
  color: var(--ink);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); min-height: 100vh; line-height: 1.4; font-size: 17px; font-weight: 600; }
body.no-scroll { overflow: hidden; }
[hidden] { display: none !important; }
h1 { font-size: 1.8rem; font-weight: 900; margin: 0.4rem 0 0.8rem; letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; font-weight: 800; margin: 0 0 0.6rem; }
h3 { margin: 0; font-size: 1.3rem; font-weight: 800; }
h1, h2, h3 { overflow-wrap: anywhere; } /* a 40-letter name must wrap, not push the page sideways */
p { margin: 0.3rem 0; }
a { color: var(--link); }
strong { font-weight: 800; }
.muted { color: var(--muted); font-size: 0.95rem; font-weight: 600; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.loading-screen { text-align: center; margin-top: 30vh; color: var(--muted); font-weight: 800; }
.small-note { font-size: 0.85rem; margin: 1rem 0; }
.token { flex: none; display: block; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.35)); }

/* ---------- Buttons (chunky, with a darker bottom edge that presses in) ---------- */
.btn {
  appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 800;
  padding: 0.75rem 1.1rem; border-radius: var(--radius); min-height: 52px;
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
  text-decoration: none; color: #fff; background: var(--grey-btn); line-height: 1.15;
  box-shadow: 0 4px 0 var(--grey-edge);
  transition: transform 0.06s, box-shadow 0.06s, filter 0.15s; touch-action: manipulation;
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--grey-edge); }
@media (hover: hover) { .btn:hover:not(:disabled) { filter: brightness(1.1); } }
.btn:disabled { cursor: not-allowed; background: #34363a; color: #a3a5a8; box-shadow: 0 4px 0 #26282a; }
.btn:focus-visible, .chip:focus-visible, .nav-link:focus-visible, .brand:focus-visible, a:focus-visible {
  outline: 3px solid #fff; outline-offset: 3px;
}
.btn.good, .btn.primary { background: var(--green); color: #04180f; box-shadow: 0 4px 0 var(--green-edge); }
.btn.good:active:not(:disabled), .btn.primary:active:not(:disabled) { background: var(--green-dark); box-shadow: 0 1px 0 var(--green-edge); }
@media (hover: hover) { .btn.good:hover:not(:disabled), .btn.primary:hover:not(:disabled) { background: var(--green-dark); filter: none; } }
.btn.good:disabled, .btn.primary:disabled { background: #2c6b52; color: #c8e8da; box-shadow: 0 4px 0 #1b4635; }
.btn.accent { background: var(--blue); color: #fff; box-shadow: 0 4px 0 var(--blue-edge); }
.btn.accent:active:not(:disabled) { box-shadow: 0 1px 0 var(--blue-edge); }
.btn.secondary, .btn.light { background: var(--grey-btn); color: #fff; box-shadow: 0 4px 0 var(--grey-edge); }
.btn.ghost { background: transparent; color: #fff; box-shadow: inset 0 0 0 2px #8e9195; }
.btn.ghost:active:not(:disabled) { transform: scale(0.97); box-shadow: inset 0 0 0 2px #8e9195; }
.btn.ghost:disabled { background: transparent; color: #a3a5a8; box-shadow: inset 0 0 0 2px #55585b; }
.btn.textbtn { background: transparent; color: #fff; box-shadow: none; text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px; text-decoration-color: #8e9195; }
.btn.textbtn:active:not(:disabled) { transform: none; box-shadow: none; }
.btn.danger { background: var(--red); color: #fff; box-shadow: 0 4px 0 var(--red-edge); }
.btn.danger:active:not(:disabled) { box-shadow: 0 1px 0 var(--red-edge); }
.btn.danger-outline { background: transparent; color: var(--red-text); box-shadow: inset 0 0 0 2px var(--red-text); }
.btn.danger-outline:active:not(:disabled) { transform: scale(0.97); box-shadow: inset 0 0 0 2px var(--red-text); }
.btn.big { min-height: 58px; font-size: 1.1rem; }
.btn.small { min-height: 48px; padding: 0.4rem 0.9rem; font-size: 0.95rem; border-radius: var(--radius-sm); box-shadow: 0 3px 0 var(--grey-edge); }
.btn.small.good, .btn.small.primary { box-shadow: 0 3px 0 var(--green-edge); }
.btn.small.ghost { box-shadow: inset 0 0 0 2px #8e9195; }
.btn.small.danger-outline { box-shadow: inset 0 0 0 2px var(--red-text); }
.btn.block { width: 100%; }
.btn.as-link { background: none; box-shadow: none; }

/* ---------- Layout ---------- */
.page { max-width: 760px; margin: 0 auto; padding: 1rem 1rem 3rem; }
.page.narrow { max-width: 440px; }
.section { margin: 1.4rem 0; }
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3); padding: 1rem; margin: 0.8rem 0;
  border: 1px solid var(--line);
}
.row { display: flex; gap: 0.7rem; }
.row > .btn { flex: 1; }
.row.wrap { flex-wrap: wrap; }
.empty { color: var(--muted); background: var(--card-2); border: 2px dashed var(--line); border-radius: var(--radius); padding: 1rem; text-align: center; font-weight: 700; }
.error { color: #ff9a94; background: #3d2222; border: 1px solid #8f3a35; border-left: 6px solid var(--red); border-radius: var(--radius-sm); padding: 0.6rem 0.8rem; font-weight: 700; margin: 0.6rem 0; }
.back { display: inline-flex; align-items: center; min-height: 44px; margin: 0.1rem 0; font-weight: 800; color: var(--link); text-decoration: none; }
.back::before { content: ""; width: 9px; height: 9px; border-left: 3px solid currentColor; border-bottom: 3px solid currentColor; transform: rotate(45deg); margin-right: 0.55rem; }
.pill { display: inline-block; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; padding: 0.2rem 0.55rem; border-radius: 5px; background: #2a3570; color: #c4d0ff; margin-left: 0.5rem; vertical-align: middle; }
.pill.warn { background: #5a4308; color: #ffd978; margin-left: 0; }
.pill.good { background: #0c4a33; color: #6ff0b8; }
.pill.soft { background: #4a4d50; color: #e4e5e6; }

/* ---------- Header (parent) ---------- */
.top { background: var(--bg-deep); border-bottom: 1px solid var(--line-soft); position: sticky; top: 0; z-index: 20; padding-top: env(safe-area-inset-top); }
.top-inner { max-width: 760px; margin: 0 auto; padding: 0.35rem 1rem 0; display: flex; align-items: center; flex-wrap: wrap; gap: 0 0.7rem; }
.brand { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 48px; font-weight: 900; font-size: 1.35rem; letter-spacing: -0.01em; color: #fff; text-decoration: none; }
.logo-mark { flex: none; display: block; }
.nav { margin-left: auto; display: flex; flex-wrap: wrap; gap: 0.1rem; }
.nav-link { display: inline-flex; align-items: center; min-height: 48px; font: inherit; font-weight: 800; font-size: 0.95rem; text-decoration: none; color: var(--muted); background: none; border: 0; border-bottom: 4px solid transparent; padding: 0.3rem 0.7rem 0; border-radius: 0; cursor: pointer; }
.nav-link:hover { color: #fff; }
.nav-link.active { color: #fff; border-bottom-color: var(--green); }
@media (max-width: 699px) {
  .nav { margin-left: 0; width: 100%; justify-content: space-between; }
}
@media (max-width: 520px) {
  .nav-link { padding: 0.3rem 0.35rem 0; font-size: 0.9rem; }
}

/* ---------- Forms ---------- */
.field { display: block; margin: 0.9rem 0; }
.field-label { display: block; font-weight: 800; margin-bottom: 0.35rem; }
.hint { display: block; color: var(--muted); font-size: 0.85rem; margin-top: 0.25rem; font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date] {
  font: inherit; font-weight: 700; width: 100%; padding: 0.75rem 0.9rem; border: 2px solid var(--field-line); border-radius: var(--radius-sm); background: var(--bg-deep); color: #fff;
  min-height: 52px; box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.35);
}
select.big-select {
  appearance: none; -webkit-appearance: none; font: inherit; font-weight: 700; width: 100%; min-height: 52px; padding: 0.75rem 2.6rem 0.75rem 0.9rem;
  border: 2px solid var(--field-line); border-radius: var(--radius-sm); background-color: var(--bg-deep); color: #fff; cursor: pointer;
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.35);
  background-image: linear-gradient(45deg, transparent 50%, #fff 50%), linear-gradient(135deg, #fff 50%, transparent 50%);
  background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%; background-size: 6px 6px, 6px 6px; background-repeat: no-repeat;
}
select.big-select option { background: var(--bg-deep); color: #fff; }
select.big-select:disabled { opacity: 0.6; cursor: wait; }
select.big-select:focus, select.big-select:focus-visible { border-color: var(--blue); outline: none; box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.35), 0 0 0 3px rgba(80, 120, 255, 0.55); }
input::placeholder { color: #9b9ea1; font-weight: 600; }
input:focus, input:focus-visible { border-color: var(--blue); outline: none; box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.35), 0 0 0 3px rgba(80, 120, 255, 0.55); }
.with-action { display: flex; gap: 0.5rem; align-items: center; }
.with-action .btn { flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip { font: inherit; font-weight: 800; padding: 0.55rem 1rem; min-height: 48px; border-radius: var(--radius-sm); border: 2px solid var(--field-line); background: var(--card-2); color: #fff; cursor: pointer; }
.chip[aria-pressed=true] { background: var(--blue); border-color: #7f9bff; color: #fff; box-shadow: 0 3px 0 var(--blue-edge); }
.stepper { display: flex; align-items: center; gap: 0.6rem; }
.stepper .step-btn { flex: 0 0 76px; min-height: 68px; font-size: 1rem; background: var(--grey-btn); box-shadow: 0 4px 0 var(--grey-edge); border-radius: var(--radius); }
.stepper .step-btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--grey-edge); }
.stepper-input { text-align: center; font-size: 2.2rem !important; font-weight: 900 !important; min-height: 68px !important; -moz-appearance: textfield; }
.stepper-input::-webkit-outer-spin-button, .stepper-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------- Auth ---------- */
.auth-page { max-width: 440px; margin: 0 auto; padding: 2.4rem 1rem 3rem; }
.auth-logo { text-align: center; margin-bottom: 0.9rem; }
.auth-logo img { border-radius: 16px; box-shadow: 0 5px 0 rgba(0, 0, 0, 0.4); transform: rotate(-4deg); }
.auth-logo h1 { color: #fff; font-size: 2.5rem; font-weight: 900; margin: 0.7rem 0 0.2rem; letter-spacing: -0.02em; }
.auth-card { padding: 1.2rem; }
.auth-invite { text-align: center; margin: 1.1rem 0.5rem 0; line-height: 1.45; }
.auth-invite strong { color: #fff; }
.auth-card h2 { font-size: 1.4rem; font-weight: 900; }

/* ---------- Avatars & balance ---------- */
.avatar { width: 56px; height: 56px; border-radius: 12px; color: #fff; font-weight: 900; font-size: 1.6rem; display: inline-flex; align-items: center; justify-content: center; flex: none;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.25), 0 2px 0 rgba(0, 0, 0, 0.35); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3); }
.avatar.small { width: 44px; height: 44px; border-radius: 10px; font-size: 1.3rem; }
.kid-avatar { background: var(--green); color: #04180f; text-shadow: none; }
.balance { display: inline-flex; flex-direction: column; align-items: center; gap: 0.3rem; line-height: 1; }
.coin-badge { display: inline-flex; align-items: center; gap: 0.4rem; background: var(--bg-deep); border: 1px solid var(--line); border-radius: 10px; padding: 0.3rem 0.8rem 0.3rem 0.45rem; box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.4); }
.balance-num { font-size: 2rem; font-weight: 900; line-height: 1; color: #fff; font-variant-numeric: tabular-nums; }
.balance-unit { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.balance.big .balance-num { font-size: 3.2rem; }
.balance.big .coin-badge { padding: 0.4rem 1.1rem 0.4rem 0.7rem; gap: 0.6rem; border-radius: 12px; }

/* ---------- Parent dashboard ---------- */
.request { border-left: 6px solid var(--green); }
.request-head { display: flex; gap: 0.8rem; align-items: flex-start; margin-bottom: 0.9rem; }
.request-text { font-size: 1.05rem; min-width: 0; }
.request-text strong { font-size: 1.15rem; }
.quote { font-style: italic; font-weight: 700; overflow-wrap: anywhere; }
.kid-head { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 1rem; }
.kid-head > div:nth-child(2) { flex: 1; min-width: 0; }
.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.btn-grid .btn { min-height: 56px; }
.btn-grid .span-2 { grid-column: span 2; }
.balance-card { display: flex; justify-content: center; padding: 1.1rem; }
.person { display: flex; align-items: center; gap: 0.8rem; }
.parent-card { display: flex; flex-direction: column; gap: 0.8rem; }
.name-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.5rem; }
.name-line .pill { margin-left: 0; }
.name-line .you { font-weight: 700; }
.pill.none { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); text-transform: none; letter-spacing: 0; font-size: 0.8rem; font-weight: 700; }
.label-change .field-label { font-size: 0.9rem; color: var(--muted); margin-bottom: 0.3rem; }
.type-card { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
.type-card.greyed { opacity: 0.8; background: var(--card-2); }
.channel { display: flex; flex-direction: column; gap: 0.7rem; }
.link-box { margin-top: 0.6rem; padding: 0.7rem; background: var(--bg-deep); border: 1px solid var(--line); border-radius: var(--radius-sm); word-break: break-all; }

/* ---------- Ledger (transaction rows) ---------- */
.ledger-row { display: flex; gap: 0.8rem; align-items: center; background: var(--card-2); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 0.7rem 0.8rem; margin: 0.5rem 0; }
.ledger-amount { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.1rem; font-size: 1.5rem; font-weight: 900; min-width: 4.6rem; text-align: center; background: var(--bg-deep); border-radius: var(--radius-sm); padding: 0.35rem 0.4rem; box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.4); font-variant-numeric: tabular-nums; }
.ledger-amount.plus { color: #2fe69a; }
.ledger-amount.minus { color: var(--red-text); }
.ledger-body { flex: 1; min-width: 0; }
.ledger-title { font-weight: 800; }
.ledger-reason { word-wrap: break-word; overflow-wrap: anywhere; font-weight: 700; }
.ledger-meta { color: var(--muted); font-size: 0.85rem; margin-top: 0.15rem; font-weight: 600; }

/* ---------- Sheet ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(8, 9, 10, 0.72); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade 0.15s; }
.sheet { position: relative; background: var(--card-2); color: #fff; width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; border-radius: 16px 16px 0 0; border: 1px solid var(--line); border-bottom: 0;
  padding: 1.6rem 1.1rem calc(1.4rem + env(safe-area-inset-bottom)); animation: rise 0.2s ease-out; }
.sheet::before { content: ""; position: absolute; top: 0.6rem; left: 50%; width: 44px; height: 5px; margin-left: -22px; border-radius: 3px; background: #7a7d81; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.4rem; }
.sheet-head h2 { margin: 0; font-size: 1.3rem; font-weight: 900; }
.sheet-text { font-size: 1.1rem; }
.sheet-actions { display: grid; gap: 0.7rem; margin-top: 0.9rem; }
@media (min-width: 700px) {
  .backdrop { align-items: center; }
  .sheet { border-radius: 14px; border-bottom: 1px solid var(--line); padding-top: 1.2rem; }
  .sheet::before { display: none; }
}
@keyframes rise { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Toast ---------- */
#toast-root { position: fixed; left: 0; right: 0; top: calc(0.8rem + env(safe-area-inset-top)); z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; pointer-events: none; padding: 0 1rem; }
.toast { background: #2b2d2f; color: #fff; padding: 0.8rem 1.1rem; border-radius: var(--radius-sm); border: 1px solid var(--line); border-left: 8px solid #7f9bff; font-weight: 800; max-width: 440px; box-shadow: 0 6px 0 rgba(0, 0, 0, 0.35), 0 10px 24px rgba(0, 0, 0, 0.4); animation: rise 0.2s; transition: opacity 0.4s; }
.toast.good { border-left-color: var(--green); }
.toast.bad { border-left-color: var(--red); }
.toast.hide { opacity: 0; }

/* ---------- Kid theme ---------- */
body[data-theme=kid] {
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 50% -10%, rgba(0, 176, 111, 0.16), transparent 55%),
    radial-gradient(circle, rgba(255, 255, 255, 0.07) 0 3px, transparent 3.5px);
  background-size: auto, 30px 30px;
  background-attachment: fixed, scroll;
  color: #fff;
}
.spinner { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 6px solid #4a4d50; border-top-color: var(--green); animation: spin 0.9s linear infinite; }
.dots { display: inline-flex; gap: 5px; margin-left: -0.2rem; }
.dots i { width: 8px; height: 8px; border-radius: 2px; background: var(--green); animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: 0.2s; }
.dots i:nth-child(3) { animation-delay: 0.4s; }
.kid-sub { text-align: center; font-size: 1.15rem; font-weight: 700; margin: 0.8rem 0 1.1rem; color: #e4e5e6; }
.kid-page .empty { font-size: 1.1rem; }
.kid-row { padding: 0.8rem; }
.kid-row .ledger-amount { font-size: 2rem; min-width: 4.4rem; }
.kid-row .ledger-reason { font-size: 1.1rem; font-weight: 800; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1.15); } }

/* ---------- Celebration ---------- */
.celebrate { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 1rem; overflow: hidden; color: #fff; animation: fade 0.3s;
  background-color: var(--bg-deep);
  background-image: radial-gradient(circle at 50% 38%, rgba(0, 176, 111, 0.3), transparent 60%), radial-gradient(circle, rgba(255, 255, 255, 0.06) 0 3px, transparent 3.5px);
  background-size: auto, 30px 30px; }
.celebrate-card { position: relative; text-align: center; max-width: 420px; width: 100%; z-index: 2; animation: pop 0.6s cubic-bezier(0.2, 1.4, 0.4, 1); }
.celebrate-title { display: inline-block; font-size: 3.4rem; font-weight: 900; letter-spacing: 0.03em; color: #ffd23f; transform: rotate(-5deg); margin-bottom: 0.4rem;
  text-shadow: 0 2px 0 #e0a100, 0 4px 0 #c98a00, 0 6px 0 #a87000, 0 8px 0 #7d5200, 0 12px 16px rgba(0, 0, 0, 0.55); }
.celebrate-amount { display: flex; align-items: center; justify-content: center; gap: 0.7rem; margin: 0.6rem auto; width: fit-content; max-width: 100%; background: var(--card-2); border: 2px solid var(--line); border-radius: 16px; padding: 0.5rem 1.4rem 0.5rem 0.9rem; box-shadow: inset 0 4px 0 rgba(0, 0, 0, 0.4), 0 6px 0 rgba(0, 0, 0, 0.4); }
.celebrate-num { font-size: 4.8rem; font-weight: 900; line-height: 1.1; text-shadow: 0 5px 0 rgba(0, 0, 0, 0.45); }
.celebrate-unit { font-size: 1.6rem; font-weight: 900; align-self: flex-end; padding-bottom: 0.9rem; }
.celebrate-from { font-size: 1.7rem; font-weight: 900; margin-top: 0.8rem; }
.celebrate-reason { font-size: 1.35rem; margin: 0.6rem 0 1.6rem; font-weight: 700; color: #e4e5e6; overflow-wrap: anywhere; }
.btn.kid-yay { min-width: 240px; min-height: 84px; font-size: 2.1rem; font-weight: 900; border-radius: 14px; background: var(--green); color: #04180f; box-shadow: 0 7px 0 var(--green-edge); }
.btn.kid-yay:hover:not(:disabled) { background: var(--green-dark); filter: none; }
.btn.kid-yay:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 2px 0 var(--green-edge); }
.confetti { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.confetti span { position: absolute; top: -30px; border-radius: 2px; opacity: 0.95; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25); animation: fall linear infinite; }
@keyframes fall { 0% { transform: translate(0, -30px) rotate(0); } 100% { transform: translate(var(--drift), 110vh) rotate(var(--spin)); } }
@keyframes pop { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .confetti span, .spinner, .dots i, .celebrate-card, .sheet, .backdrop, .celebrate, .toast { animation: none; }
  .confetti { display: none; }
  .dots i { opacity: 1; }
  .btn { transition: none; }
}

@media (min-width: 700px) {
  #toast-root { top: auto; bottom: 1.2rem; }
}

/* ---------- Achievements (trophy wall) ---------- */
.ach h1 { margin-top: 0.2rem; }
.ach-hero { text-align: center; padding: 1rem; background: var(--card-2); box-shadow: 0 5px 0 rgba(0, 0, 0, 0.35); border-radius: 14px; }
.ach-from { color: #e4e5e6; font-weight: 800; margin: 0.8rem 0 0; font-size: 1.05rem; }
.ach-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.7rem; margin: 1.1rem 0; }
.ach-tiles .ach-tile:last-child:nth-child(odd) { grid-column: span 2; }
.ach-tile { --cat: #8e9195; --cat-ink: #dcdddf; --cat-bg: #4a4d50; min-width: 0; appearance: none; font: inherit; color: #fff; cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 0.15rem; min-height: 96px;
  padding: 0.55rem 0.8rem 0.65rem; background: var(--card); border: 1px solid var(--line); border-top: 8px solid var(--cat); border-radius: var(--radius);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35); transition: transform 0.06s, box-shadow 0.06s; touch-action: manipulation; }
.ach-tile:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35); }
.ach-tile:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.ach-tile-name { overflow-wrap: anywhere; font-size: 0.8rem; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; color: var(--cat-ink); }
.ach-tile-count { font-size: 2.3rem; font-weight: 900; line-height: 1.05; font-variant-numeric: tabular-nums; }
.ach-tile-plays { font-weight: 800; color: #2fe69a; font-size: 0.95rem; }
.ach-tile[aria-pressed=true] { background: var(--cat-bg); border-color: var(--cat); box-shadow: 0 0 0 3px var(--cat), 0 4px 0 rgba(0, 0, 0, 0.35); }
.ach-tile.is-empty { opacity: 0.5; cursor: default; box-shadow: none; }
.ach-tile.is-empty .ach-tile-plays { color: var(--muted); }
.ach-filter { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; font-weight: 800; margin: 0 0 0.4rem; }
.ach-row { border-left: 6px solid var(--cat, var(--line)); align-items: center; }
.ach-row .ledger-amount { font-size: 1.7rem; min-width: 4rem; }
.ach-reason { font-size: 1.15rem; font-weight: 900; overflow-wrap: anywhere; line-height: 1.25; }
.ach-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.35rem 0 0.1rem; }
.ach-tags .pill { margin-left: 0; }
.cat-pill { --cat: #8e9195; --cat-ink: #dcdddf; --cat-bg: #4a4d50; display: inline-block; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; padding: 0.2rem 0.55rem; border-radius: 5px; background: var(--cat-bg); color: var(--cat-ink); box-shadow: inset 0 -3px 0 var(--cat); }
.pill.gold { background: #5a4308; color: #ffd978; }
@media (min-width: 700px) {
  .ach-tiles { grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); }
  .ach-tiles .ach-tile:last-child:nth-child(odd) { grid-column: auto; }
}

/* ---------- Avatars (original blocky SVG art, see js/avatar.js) ---------- */
.avatar-svg { display: block; flex: none; }
.avatar-head { filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.35)); }
.avatar-full { filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.18)); }
.ledger-meta.with-face { display: flex; align-items: center; gap: 0.45rem; }
.ledger-meta.with-face .avatar-head { filter: none; }
.picked-note { color: var(--muted); font-size: 0.82rem; font-weight: 700; margin-top: 0.15rem; }
.text-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 0.3rem; }
.text-links .btn.textbtn { padding: 0.4rem 0.5rem; min-height: 48px; }
.celebrate-from { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem; }
.celebrate-from .avatar-head { filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.4)); }
.history-title { display: flex; align-items: center; gap: 0.8rem; }
.history-title h1 { margin: 0.4rem 0 0.8rem; }
.stage { position: relative; overflow: hidden; background: linear-gradient(#3b4a6b 0%, #2a3350 64%, #2a3350 100%); border-radius: 12px; }
.stage::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 28%;
  background-color: #3d4045;
  background-image: radial-gradient(ellipse at 50% 50%, rgba(255, 255, 255, 0.22) 0 4px, rgba(0, 0, 0, 0.18) 4.5px 6px, transparent 6.5px);
  background-size: 22px 14px; background-position: 2px 3px; border-top: 3px solid #565a60; }
.stage-avatar { position: absolute; left: 0; right: 0; bottom: 10px; display: flex; justify-content: center; }

/* builder */
.builder h1 { margin-top: 0.2rem; }
.stage { height: 300px; border: 1px solid var(--line); box-shadow: 0 5px 0 rgba(0, 0, 0, 0.35); }
.stage-avatar { bottom: 22px; }
.stage-avatar .avatar-full { filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.2)); }
.picked-by { text-align: center; color: var(--muted); font-weight: 800; margin: 0.7rem 0 0; }
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.4rem; margin: 1rem 0 0.2rem; }
.tab { appearance: none; font: inherit; font-weight: 800; font-size: 0.88rem; color: var(--muted); background: var(--card-2); border: 2px solid var(--line-soft); border-radius: var(--radius-sm); min-height: 48px; padding: 0.3rem 0.2rem; cursor: pointer; touch-action: manipulation; line-height: 1.1; }
.tab.active { color: #fff; background: var(--blue); border-color: #7f9bff; box-shadow: 0 3px 0 var(--blue-edge); }
.tab:focus-visible, .opt:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.opt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 0.55rem; margin: 0.7rem 0 1rem; }
.opt { appearance: none; font: inherit; color: #fff; cursor: pointer; background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 0.45rem 0.2rem 0.45rem; display: flex; flex-direction: column; align-items: center; gap: 0.3rem; min-height: 104px; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35); touch-action: manipulation; transition: transform 0.06s; }
.opt:active { transform: translateY(2px); }
.opt.selected { border-color: var(--green); background: #1d3b2f; outline: 3px solid var(--green); outline-offset: 0; }
.opt-visual { display: flex; align-items: center; justify-content: center; height: 62px; }
.opt-visual.tall { height: 84px; }
.opt-visual .avatar-full { filter: none; }
.opt-label { font-size: 0.78rem; font-weight: 800; text-align: center; line-height: 1.15; overflow-wrap: break-word; padding: 0 0.1rem; }
.swatch { display: block; width: 46px; height: 46px; border-radius: 10px; box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.22), 0 0 0 2px rgba(255, 255, 255, 0.2); }
.builder-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; margin-top: 0.4rem; }
.builder-actions .good { grid-column: span 2; order: -1; }
@media (prefers-reduced-motion: reduce) {
  .opt { transition: none; }
}

/* ---------- PlayBux + Store ---------- */
.kid-balances { display: flex; justify-content: space-around; gap: 0.6rem; margin: -0.2rem 0 1rem; }
.kid-balances .balance { flex: 1; padding: 0.5rem 0.3rem; background: var(--card-2); border: 1px solid var(--line-soft); border-radius: var(--radius); }
.kid-balances .balance-num { font-size: 1.7rem; }
.ledger-amount .amt-num { line-height: 1.05; }
.ledger-amount .amt-unit { font-size: 0.62rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; line-height: 1.1; color: #ffd978; }
.ledger-amount.cur-bux .amt-unit { color: var(--bux-ink); }
.kid-row .ledger-amount { min-width: 5rem; }
.kid-row .ledger-amount .amt-unit { font-size: 0.7rem; }
.ach-row .ledger-amount { min-width: 4.6rem; }
.balance.cur-bux .balance-unit { color: var(--bux-ink); }
.balance-card.two { gap: 1.2rem; flex-wrap: wrap; }
.balance-card.two .balance.big .balance-num { font-size: 2.6rem; }
.ach-totals { display: flex; justify-content: center; gap: 1.2rem; flex-wrap: wrap; }
.ach-totals .balance.big .balance-num { font-size: 2.4rem; }
.ach-tile-plays.bux { color: var(--bux-ink); }
.price-line { display: flex; align-items: center; gap: 0.4rem; font-weight: 900; color: var(--bux-ink); margin: 0.2rem 0; }
.request.purchase { border-left-color: var(--bux); }
.request.deliver { border-left-color: var(--gold); }
.check { display: flex; align-items: center; gap: 0.7rem; margin: 1rem 0; font-weight: 800; min-height: 48px; cursor: pointer; }
.check input { width: 28px; height: 28px; accent-color: var(--green); flex: none; }
.sheet-facts { margin: 0.2rem 0 0.6rem; padding-left: 1.2rem; font-weight: 700; color: #e4e5e6; }
.sheet-facts li { margin: 0.25rem 0; }
.kid-title { font-size: 2.2rem; margin: 0.2rem 0 0.6rem; }

/* store page */
.store-items { margin: 1.1rem 0; }
.store-item { padding: 1rem; background: var(--card); }
.store-item-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.8rem; }
.store-item h3 { font-size: 1.35rem; overflow-wrap: anywhere; }
.store-item h3 .pill { margin-left: 0.6rem; }
.price-tag { flex: none; display: inline-flex; align-items: center; gap: 0.35rem; background: var(--bg-deep); border: 1px solid #1e6c9c; border-radius: 10px; padding: 0.25rem 0.7rem 0.25rem 0.4rem; font-size: 1.4rem; font-weight: 900; color: #fff; box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.4); font-variant-numeric: tabular-nums; }
.store-desc { color: #e4e5e6; font-weight: 700; margin: 0.4rem 0; overflow-wrap: anywhere; }
.store-facts { list-style: none; margin: 0.5rem 0; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.store-facts li { font-weight: 800; padding-left: 1.5rem; position: relative; color: #e4e5e6; }
.store-facts li::before { content: ""; position: absolute; left: 0.2rem; top: 0.45em; width: 0.65rem; height: 0.65rem; border-radius: 2px; background: var(--green); }
.store-facts li:nth-child(2)::before { background: var(--gold); }
.store-limit { font-weight: 900; color: var(--bux-ink); margin: 0.4rem 0 0.8rem; }
.store-limit.none { color: var(--red-text); }
.store-item .btn.block { margin-top: 0.6rem; }
.status-pill { display: inline-block; font-size: 0.78rem; font-weight: 900; letter-spacing: 0.04em; padding: 0.3rem 0.6rem; border-radius: 6px; white-space: nowrap; background: #4a4d50; color: #fff; }
.status-pill.s-waiting_approval { background: #5a4308; color: #ffd978; }
.status-pill.s-to_deliver { background: #1e2c66; color: #b9caff; }
.status-pill.s-done { background: #0c4a33; color: #6ff0b8; }
.status-pill.s-declined { background: #5a2220; color: #ff9a94; }
.status-pill.s-cancelled { background: #4a4d50; color: #dcdddf; }

/* ---------- store sections + avatar shop ---------- */
.tier-pill { display: inline-block; font-size: 0.66rem; font-weight: 900; letter-spacing: 0.07em; text-transform: uppercase; padding: 0.15rem 0.5rem; border-radius: 5px; line-height: 1.25; margin-left: 0.5rem; vertical-align: middle; }
.tier-pill.tier-cool { background: #1e3f8f; color: #b9d0ff; box-shadow: inset 0 -2px 0 #3f7bea; }
.tier-pill.tier-rare { background: #4a2a86; color: #dcc8ff; box-shadow: inset 0 -2px 0 #9a6cf0; }
.tier-pill.tier-legendary { background: #6b4a05; color: #ffe08a; box-shadow: inset 0 -2px 0 #ffc933; }

.store-tabs { display: flex; gap: 0.5rem; overflow-x: auto; margin: 1rem -0.4rem 0; padding: 0.3rem 0.4rem 0.7rem; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.store-tabs::-webkit-scrollbar { display: none; }
.store-tab { flex: none; appearance: none; font: inherit; font-weight: 800; font-size: 0.95rem; color: var(--muted); background: var(--card-2); border: 2px solid var(--line-soft); border-radius: 999px; min-height: 46px; padding: 0.3rem 1.05rem; white-space: nowrap; cursor: pointer; touch-action: manipulation; }
.store-tab.active { color: #fff; background: var(--blue); border-color: #7f9bff; box-shadow: 0 3px 0 var(--blue-edge); }
.store-tab:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.store-items { margin-top: 0.2rem; }
.store-section-head { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; margin: 0.2rem 0 0.5rem; }
.store-section-head .kid-h2 { margin: 0; }
.levels-tag { font-size: 0.74rem; font-weight: 900; letter-spacing: 0.07em; text-transform: uppercase; padding: 0.25rem 0.6rem; border-radius: 6px; background: #0c4a33; color: #6ff0b8; box-shadow: inset 0 -3px 0 var(--green); }
.store-items .store-item + .store-item { margin-top: 0.8rem; }
.av-hint { margin: 0.2rem 0 0.9rem; font-size: 1rem; }
.av-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.av-card { padding: 0.7rem 0.6rem 0.8rem; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.3rem; border-top: 5px solid var(--line); background: var(--card); min-width: 0; }
.av-card.tier-cool { border-top-color: #3f7bea; }
.av-card.tier-rare { border-top-color: #9a6cf0; }
.av-card.tier-legendary { border-top-color: #ffc933; background: linear-gradient(180deg, #4a4020 0%, var(--card) 55%); }
.av-preview { height: 124px; width: 100%; display: flex; align-items: center; justify-content: center; }
.av-preview.tall { height: 140px; }
.av-name { font-size: 1.02rem; line-height: 1.2; margin: 0.1rem 0 0; overflow-wrap: anywhere; }
.av-card .tier-pill { margin: 0; }
.av-buy { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; margin-top: 0.3rem; }
.av-buy .btn { margin: 0; min-height: 46px; font-size: 0.95rem; line-height: 1.15; padding: 0.3rem 0.5rem; }
.av-have { width: 100%; margin: 0.4rem 0 0; padding: 0.6rem 0.3rem; border-radius: 8px; background: #0c4a33; color: #6ff0b8; font-weight: 900; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25); }
.av-card.owned { opacity: 0.92; }
.sheet-preview { display: flex; justify-content: center; margin: 0.2rem 0 0.5rem; background: var(--card-2); border-radius: 12px; padding: 0.6rem; }
.sheet-tier { text-align: center; margin: 0 0 0.3rem; }
.sheet-tier .tier-pill { margin: 0; font-size: 0.8rem; padding: 0.25rem 0.7rem; }

/* builder: locked premium options */
.opt { position: relative; }
.opt .tier-pill { margin: 0; font-size: 0.58rem; padding: 0.08rem 0.35rem; letter-spacing: 0.05em; }
.opt.tier-cool.locked { border-color: #3f7bea; }
.opt.tier-rare.locked { border-color: #9a6cf0; }
.opt.tier-legendary.locked { border-color: #ffc933; }
.opt.locked { border-style: dashed; background: var(--card-2); }
.opt.locked .opt-visual { opacity: 0.55; filter: saturate(0.55); }
.opt-cost { font-size: 0.72rem; font-weight: 900; color: var(--bux-ink); line-height: 1.1; white-space: nowrap; }
.opt-own { font-size: 0.68rem; font-weight: 900; color: #6ff0b8; line-height: 1.1; }
.lock { position: absolute; top: 12px; right: 7px; width: 17px; height: 13px; border-radius: 3px; background: #ffd978; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.45); z-index: 2; }
.lock::before { content: ""; position: absolute; left: 2px; top: -9px; width: 9px; height: 9px; border: 3px solid #d9dde3; border-bottom: 0; border-radius: 7px 7px 0 0; }
.lock::after { content: ""; position: absolute; left: 6px; top: 4px; width: 5px; height: 5px; border-radius: 50%; background: #6b4a05; }
.builder-wallet { display: flex; align-items: center; justify-content: center; gap: 0.5rem; margin: 0.5rem 0 0; font-weight: 900; color: var(--bux-ink); }
.builder-note { text-align: center; margin: 0.5rem 0 0; font-weight: 800; color: #6ff0b8; }

.store-item h3 .tier-pill { margin-left: 0.5rem; }
.av-card .av-buy, .av-card .av-have { margin-top: auto; }
.av-card .tier-pill + .av-buy, .av-card .tier-pill + .av-have { margin-top: auto; }
.av-card .av-name { min-height: 2.4em; display: flex; align-items: center; justify-content: center; }
.store-body { padding-top: 0.2rem; }
.store-title-row { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; margin: 0.7rem 0 0.7rem; }
.store-title { font-size: 2rem; line-height: 1.1; margin: 0; flex: 1 1 auto; }
.text-btn { color: var(--link); font-weight: 900; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; padding: 0 0.3rem; font-size: 1rem; }
.text-btn:hover { text-decoration: underline; }

/* hero carousel */
.hero { position: relative; margin: 0 0 1.1rem; }
.hero-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; border-radius: 18px;
  -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; cursor: grab; box-shadow: 0 6px 0 rgba(0, 0, 0, 0.35); }
.hero-track::-webkit-scrollbar { display: none; }
.hero-track.dragging { scroll-snap-type: none; cursor: grabbing; user-select: none; }
.hero-slide { flex: 0 0 100%; scroll-snap-align: start; position: relative; overflow: hidden; aspect-ratio: 16 / 9; min-height: 205px; max-height: 380px;
  display: grid; grid-template-columns: minmax(0, 42%) minmax(0, 1fr); gap: 0.4rem; padding: 0.9rem 1rem 2rem 0.5rem; box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.22); }
.hero-slide::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.07) 0 22px, transparent 22px 44px); }
.hero-slide::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 22% 48%, rgba(255, 255, 255, 0.34), transparent 52%); }
.hero-slide.tier-legendary { box-shadow: inset 0 0 0 4px #ffd45a, inset 0 0 40px rgba(255, 220, 90, 0.35); }
.hero-bits { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.hero-bits i { position: absolute; z-index: 0; width: 16px; height: 16px; background: rgba(255, 255, 255, 0.22); border-radius: 3px; animation: float 5s ease-in-out infinite; }
.hero-bits i:nth-child(1) { right: 8%; top: 12%; }
.hero-bits i:nth-child(2) { right: 30%; bottom: 22%; width: 10px; height: 10px; animation-delay: 1s; }
.hero-bits i:nth-child(3) { left: 44%; top: 10%; width: 12px; height: 12px; animation-delay: 2s; }
.hero-bits i:nth-child(4) { right: 4%; bottom: 30%; width: 22px; height: 22px; animation-delay: 3s; }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(14deg); } 50% { transform: translateY(-8px) rotate(30deg); } }
.hero-art { position: relative; z-index: 1; min-height: 0; }
.hero-art svg { position: absolute; inset: 0; margin: auto; width: 100%; height: 100%; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, 0.25)); }
.hero-copy { position: relative; z-index: 1; align-self: center; display: flex; flex-direction: column; align-items: flex-start; gap: 0.5rem; min-width: 0; }
.hero-kicker { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.7rem; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase;
  color: #fff; background: rgba(15, 17, 40, 0.38); padding: 0.2rem 0.55rem; border-radius: 6px; }
.hero-kicker .tier-pill { margin: 0; }
.hero-name { margin: 0; font-size: clamp(1.15rem, 5.2vw, 2.2rem); line-height: 1.08; font-weight: 900; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
  overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hero-actions { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.hero-actions .btn { min-width: 96px; }
.hero-dots { position: absolute; left: 0; right: 0; bottom: 4px; display: flex; justify-content: center; pointer-events: none; z-index: 2; }
.hero-dot { pointer-events: auto; appearance: none; border: 0; background: none; width: 28px; height: 28px; padding: 0; cursor: pointer; position: relative; }
.hero-dot::after { content: ""; position: absolute; left: 50%; top: 50%; width: 9px; height: 9px; border-radius: 5px; transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.5); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35); transition: width 0.2s, background 0.2s; }
.hero-dot[aria-current=true]::after { width: 24px; background: #fff; }
.hero-dot:focus-visible { outline: 3px solid #fff; border-radius: 8px; }

/* "almost yours" highlight */
.almost { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.8rem; padding: 0.7rem 0.8rem; margin: 0 0 1.2rem;
  border-radius: 16px; background: linear-gradient(120deg, #2b2f4e, #3c2f66); border: 2px solid #7f6bff; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35); }
.almost-art svg { display: block; width: 58px; height: 58px; }
.almost-text { margin: 0 0 0.4rem; font-weight: 900; font-size: 1.02rem; line-height: 1.2; overflow-wrap: anywhere; }
.almost-count { margin: 0.25rem 0 0; font-size: 0.78rem; font-weight: 800; color: var(--bux-ink); font-variant-numeric: tabular-nums; }
.progress { height: 12px; border-radius: 7px; background: rgba(0, 0, 0, 0.45); overflow: hidden; box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.4); }
.progress-fill { display: block; height: 100%; border-radius: 7px; background: linear-gradient(90deg, #2fb5ff, #8fe3ff); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.16); transition: width 0.6s; }

/* rows of cards */
.store-row { margin: 0 0 1rem; }
.row-head { display: flex; align-items: center; gap: 0.6rem; margin: 0 0 0.2rem; }
.row-title { margin: 0; font-size: 1.3rem; font-weight: 900; line-height: 1.15; }
.row-head .levels-tag { white-space: nowrap; font-size: 0.62rem; padding: 0.2rem 0.45rem; }
.see-all { margin-left: auto; white-space: nowrap; color: var(--link); font-weight: 900; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; padding: 0 0.2rem; }
.see-all:hover { text-decoration: underline; }
.scroll-row { display: flex; gap: 0.7rem; overflow-x: auto; scroll-snap-type: x proximity; scroll-padding: 0 1rem; margin: 0 -1rem; padding: 0.3rem 1rem 0.9rem;
  scrollbar-width: none; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; cursor: grab; }
.scroll-row::-webkit-scrollbar { display: none; }
.scroll-row.dragging { scroll-snap-type: none; cursor: grabbing; user-select: none; }
.scroll-row > * { scroll-snap-align: start; flex: 0 0 auto; }
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.8rem; }
.item-grid .item-card { width: auto; }

/* the shared item card */
.item-card { appearance: none; font: inherit; color: #fff; text-align: left; display: flex; flex-direction: column; align-items: stretch; gap: 0.4rem; width: 152px;
  padding: 6px 6px 0.65rem; background: var(--card); border: 2px solid var(--line); border-radius: 16px; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35); cursor: pointer;
  position: relative; transition: transform 0.12s, box-shadow 0.12s; touch-action: manipulation; -webkit-tap-highlight-color: transparent; user-select: none; }
@media (hover: hover) { .item-card:hover { transform: translateY(-4px); box-shadow: 0 8px 0 rgba(0, 0, 0, 0.35), 0 12px 22px rgba(0, 0, 0, 0.35); } }
.item-card:active { transform: translateY(1px) scale(0.98); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); }
.item-card:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.item-thumb { position: relative; display: block; aspect-ratio: 1; border-radius: 12px; overflow: hidden; }
.item-thumb svg { display: block; width: 100%; height: 100%; }
.thumb-tl { position: absolute; left: 6px; top: 6px; }
.thumb-tl .tier-pill { margin: 0; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4); }
.thumb-bl { position: absolute; left: 6px; right: 6px; bottom: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.mini-chip { font-size: 0.6rem; font-weight: 900; letter-spacing: 0.05em; text-transform: uppercase; padding: 0.14rem 0.42rem; border-radius: 5px; background: rgba(15, 17, 36, 0.8); color: #fff; line-height: 1.2; }
.mini-chip.warn { background: #7a2220; color: #ffb3ad; }
.item-name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.4em; padding: 0 0.3rem; font-weight: 900; font-size: 0.95rem; line-height: 1.2; overflow-wrap: anywhere; }
.price-pill { display: inline-flex; align-items: center; gap: 0.3rem; align-self: flex-start; margin: 0 0.3rem; background: var(--bg-deep); border: 2px solid #1e6c9c; border-radius: 999px;
  padding: 0.1rem 0.7rem 0.1rem 0.3rem; font-weight: 900; font-size: 1rem; font-variant-numeric: tabular-nums; color: #fff; box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.4); }
.price-pill.big { font-size: 1.4rem; padding: 0.12rem 0.9rem 0.12rem 0.4rem; margin: 0; }
.have-pill { align-self: flex-start; margin: 0 0.3rem; background: #0c4a33; color: #6ff0b8; font-weight: 900; font-size: 0.85rem; padding: 0.25rem 0.75rem; border-radius: 999px; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25); }
.item-card.owned .item-thumb svg { filter: saturate(0.8); }
.item-card.sold-out .item-thumb { opacity: 0.7; }
.reason-chip { display: block; margin: 2px 2px 0; text-align: center; font-size: 0.72rem; font-weight: 900; letter-spacing: 0; padding: 0.2rem 0.3rem; border-radius: 7px; background: #3a3d4a; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reason-chip.r-almost-yours { background: #6b4300; color: #ffd978; box-shadow: inset 0 -3px 0 #ffc933; }
.reason-chip.r-you-can-get-this { background: #0f5a3a; color: #b6ffd9; box-shadow: inset 0 -3px 0 #00d98a; }
.reason-chip.r-levels-you-up { background: #0c4a33; color: #6ff0b8; box-shadow: inset 0 -3px 0 var(--green); }
.reason-chip.r-new { background: #1e3f8f; color: #b9d0ff; box-shadow: inset 0 -3px 0 #3f7bea; }
.reason-chip.r-popular-in-your-family { background: #54246a; color: #f3c8ff; box-shadow: inset 0 -3px 0 #d06bff; }
.reason-chip.r-treat-yourself { background: #6b2250; color: #ffc2e6; box-shadow: inset 0 -3px 0 #ff5fb8; }
.item-card.tier-cool { border-color: #3f7bea; }
.item-card.tier-rare { border-color: #9a6cf0; }
.item-card.tier-legendary { padding: 5px 5px 0.6rem; border: 3px solid transparent; animation: shimmer 2.6s linear infinite alternate;
  background: linear-gradient(#3b3a30, #3b3a30) padding-box, linear-gradient(110deg, #ffb300, #fff3b0, #ffc933, #fff3b0, #ffb300) border-box; background-size: 100% 100%, 300% 100%; }
@keyframes shimmer { from { background-position: 0 0, 0% 0; } to { background-position: 0 0, 100% 0; } }
.twinkles { position: absolute; inset: 0; pointer-events: none; }
.twinkles i { position: absolute; width: 16px; height: 16px; background: #fff8c8; opacity: 0; animation: twinkle 2.4s ease-in-out infinite;
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); }
.twinkles i:nth-child(1) { right: 12%; top: 14%; }
.twinkles i:nth-child(2) { left: 16%; top: 44%; animation-delay: 0.8s; width: 12px; height: 12px; }
.twinkles i:nth-child(3) { right: 24%; bottom: 20%; animation-delay: 1.5s; }
@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(0.4) rotate(0); } 50% { opacity: 1; transform: scale(1.1) rotate(45deg); } }

.store-purchases-link { margin-top: 0.6rem; }
.purchase-art { flex: none; }
.purchase-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 0.45rem; }
.purchase-side .btn { min-height: 44px; }
.purchase-art svg { display: block; width: 52px; height: 52px; }

/* item detail sheet */
.detail-art { position: relative; width: min(70vw, 260px); margin: 0.2rem auto 0.9rem; border-radius: 20px; overflow: hidden; box-shadow: 0 6px 0 rgba(0, 0, 0, 0.35); }
.detail-art svg { display: block; width: 100%; height: auto; }
.detail.tier-legendary .detail-art { box-shadow: 0 0 0 4px #ffd45a, 0 0 28px rgba(255, 201, 51, 0.55); }
.detail.tier-rare .detail-art { box-shadow: 0 0 0 4px #9a6cf0, 0 6px 0 rgba(0, 0, 0, 0.35); }
.detail.tier-cool .detail-art { box-shadow: 0 0 0 4px #3f7bea, 0 6px 0 rgba(0, 0, 0, 0.35); }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.7rem; flex-wrap: wrap; }
.detail-name { margin: 0; flex: 1 1 11rem; font-size: 1.6rem; line-height: 1.1; font-weight: 900; overflow-wrap: anywhere; }
.detail-price { display: flex; align-items: center; gap: 0.5rem; }
.detail-price .tier-pill { margin: 0; }
.detail-desc { margin: 0.5rem 0 0; font-weight: 700; color: #e4e5e6; overflow-wrap: anywhere; }
.detail-sub { margin: 0.9rem 0 0.2rem; font-size: 0.8rem; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.detail-limit { margin: 0.4rem 0 0; font-weight: 900; color: var(--bux-ink); }
.detail .btn.block { margin-top: 0.9rem; }
.detail-short { margin-top: 0.9rem; }
.detail-short .btn.block { margin-top: 0.5rem; }
.detail-short-note { margin: 0.35rem 0 0; font-weight: 800; color: var(--bux-ink); text-align: center; }
.detail-have p { margin: 0.9rem 0 0; text-align: center; font-weight: 900; font-size: 1.15rem; background: #0c4a33; color: #6ff0b8; padding: 0.7rem; border-radius: 10px; }
.sheet-preview.art { background: none; padding: 0; }
.sheet-preview.art svg { width: 150px; height: 150px; border-radius: 16px; }

/* coin burst after a purchase */
.coin-burst { position: fixed; left: 50%; top: 52%; z-index: 90; pointer-events: none; }
.coin-bit { position: absolute; left: -15px; top: -15px; opacity: 0; animation: coin-fly 1.2s cubic-bezier(0.2, 0.8, 0.3, 1) var(--delay) forwards; }
@keyframes coin-fly {
  0% { opacity: 1; transform: translate(0, 0) scale(0.5) rotate(0); }
  55% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx), calc(var(--dy) + 150px)) scale(1) rotate(var(--rot)); }
}

/* wide screens: bigger cards, more of them */
@media (min-width: 700px) {
  .item-card { width: 176px; }
  .item-name { font-size: 1rem; }
  .hero-slide { padding: 1.2rem 1.6rem 2.2rem 1rem; gap: 1rem; }
  .store-title { font-size: 2.4rem; }
  .scroll-row { margin: 0 -1rem; }
}
@media (min-width: 1000px) {
  .item-card { width: 184px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-bits i, .item-card.tier-legendary { animation: none; }
  .twinkles i { animation: none; opacity: 0.9; transform: none; }
  .twinkles i:nth-child(n+2) { display: none; }
  .item-card, .progress-fill, .hero-dot::after { transition: none; }
}

.art-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; }
@media (min-width: 520px) { .art-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.art-opt { appearance: none; font: inherit; color: #fff; background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 0.35rem 0.3rem 0.5rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.3rem; cursor: pointer; font-weight: 800; font-size: 0.78rem; text-align: center; line-height: 1.15; touch-action: manipulation; }
.art-opt svg { display: block; width: 100%; height: auto; border-radius: 10px; }
.art-opt[aria-pressed=true] { border-color: var(--green); background: #1d3b2f; outline: 3px solid var(--green); }
.btn.hero-btn { background: #fff; color: #1d2140; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35); }
.btn.hero-btn:active:not(:disabled) { box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35); }
@media (hover: hover) { .btn.hero-btn:hover:not(:disabled) { background: #fff6c8; } }

/* ---------- Custom categories ---------- */
.cat-pill.in-title { margin-left: 0.5rem; vertical-align: middle; }
.ach-row { --cat: #8e9195; }
.cat-dot { display: inline-block; flex: none; width: 0.8rem; height: 0.8rem; border-radius: 3px; background: var(--cat, #8e9195); box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.15); }
.cat-dot.big { width: 1.1rem; height: 1.1rem; border-radius: 4px; }
.cat-chip { display: inline-flex; align-items: center; gap: 0.5rem; }
.cat-chip[aria-pressed=true] { background: var(--cat-bg, #4a4d50); border-color: var(--cat, #8e9195); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35), 0 0 0 2px var(--cat, #8e9195); }
.chip-new { background: transparent; border-style: dashed; color: var(--link); }
.chip-new[aria-expanded=true] { background: var(--card-2); border-style: solid; color: #fff; }
.cat-new { margin-top: 0.7rem; padding: 0.8rem; background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius); }
.cat-new .field { margin-bottom: 0.7rem; }
.cat-new .row > .btn { flex: 1; }
.swatches { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.swatch { appearance: none; width: 44px; height: 44px; border-radius: 10px; border: 3px solid rgba(255, 255, 255, 0.18); background: var(--sw); cursor: pointer; padding: 0; touch-action: manipulation; }
.swatch[aria-checked=true] { border-color: #fff; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--sw); transform: translateY(-2px); }
.swatch[aria-checked=true]::after { content: "\2713"; color: #10121a; font-weight: 900; font-size: 1.2rem; line-height: 1; }
.swatch:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
/* Categories card: chip grid + edit sheet */
.cat-manage-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.5rem; }
.cat-manage-head h2 { margin: 0; }
.cat-manage-head .muted { font-size: 0.85rem; }
.cat-chip-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.cat-edit-chip { --cat: #8e9195; --cat-ink: #dcdddf; --cat-bg: #4a4d50; appearance: none; font: inherit; font-weight: 800; font-size: 0.95rem; display: inline-flex; align-items: center; gap: 0.45rem; min-height: 44px; max-width: 100%; padding: 0.3rem 0.85rem; border-radius: 999px; background: var(--cat-bg); color: var(--cat-ink); border: 2px solid var(--cat); cursor: pointer; touch-action: manipulation; }
.cat-edit-chip:active:not(:disabled) { transform: scale(0.97); }
.cat-edit-chip:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.cat-edit-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-edit-chip.is-hidden { opacity: 0.6; border-style: dashed; }
.cat-add-chip { background: transparent; border: 2px dashed #8e9195; color: var(--link); }
.cat-add-chip:disabled { opacity: 0.45; cursor: not-allowed; }
.cat-hidden { margin-top: 0.4rem; }
.cat-hidden .cat-chip-grid { margin: 0.2rem 0 0.2rem; }
.btn.cat-hidden-toggle { min-height: 44px; padding: 0.3rem 0; box-shadow: none; font-size: 0.95rem; }
.cat-pos[hidden], .cat-manage-sheet-hint[hidden] { display: none; }
.cat-pos-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.cat-pos-text { display: block; margin-top: 0.4rem; font-weight: 800; color: var(--muted); text-align: center; }
.cat-builtin { margin-left: 0; }

/* ---------- Family: compact People card (same language as the categories card) ---------- */
.people-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.3rem; }
.people-head h2 { margin: 0; }
.people-head .muted { font-size: 0.85rem; }
.people-group { margin-top: 0.6rem; }
.people-group-title { margin: 0 0 0.4rem; font-size: 0.8rem; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.person-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 0.5rem; }
.person-tile { appearance: none; font: inherit; color: #fff; cursor: pointer; touch-action: manipulation; min-width: 0; min-height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 0.25rem;
  padding: 0.6rem 0.3rem 0.5rem; background: var(--card-2); border: 2px solid var(--line); border-radius: var(--radius); text-align: center; }
.person-tile:active { transform: scale(0.97); }
.person-tile:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.person-tile .avatar-svg { border-radius: 14px; flex: none; }
.person-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; font-size: 0.95rem; }
.person-meta { color: var(--muted); font-size: 0.75rem; font-weight: 700; line-height: 1.2; }
.person-tags { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.15rem 0.35rem; min-height: 1.3rem; }
.person-pill { margin-left: 0; font-size: 0.68rem; padding: 0.15rem 0.45rem; }
.person-you { color: var(--muted); font-size: 0.75rem; font-weight: 700; }
.person-add { background: transparent; border: 2px dashed #8e9195; color: var(--link); justify-content: center; min-height: 72px; }
.person-add-text { font-weight: 800; font-size: 0.95rem; overflow-wrap: anywhere; }
.sheet-person { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; margin: 0.4rem 0 0.2rem; }
.sheet-person .avatar-svg { border-radius: 20px; }
.sheet-person .picked-note { margin: 0; }
.signs-in { margin: 0.4rem 0 0; color: var(--muted); font-weight: 700; overflow-wrap: anywhere; }
.pw-row { display: flex; gap: 0.5rem; align-items: stretch; }
.pw-row .big-input { flex: 1; min-width: 0; }
.pw-row .btn { flex: none; min-width: 4.6rem; }
input[type=date] { color-scheme: dark; -webkit-appearance: none; appearance: none; min-width: 0; }

/* ---------- Family: Family settings + Invite a family cards, join page ---------- */
.fset-head, .inv-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.3rem; }
.fset-head h2, .inv-head h2 { margin: 0; }
.fset-head .muted, .inv-head .muted { font-size: 0.85rem; }
.fset-card .field { margin: 0.5rem 0; }
.fset-check { margin: 0.9rem 0 0.2rem; }
.fset-hint { margin-top: 0.1rem; }
.inv-about { margin: 0.3rem 0 0.8rem; color: var(--muted); font-weight: 600; font-size: 0.95rem; }
.inv-card .btn.small.good { width: 100%; }
.inv-rows { display: grid; gap: 0.5rem; margin-top: 0.8rem; }
.inv-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem 0.8rem; padding: 0.6rem 0.7rem; background: var(--card-2); border: 2px solid var(--line); border-radius: var(--radius); }
.inv-info { flex: 1 1 10rem; min-width: 0; }
.inv-name { font-weight: 800; overflow-wrap: anywhere; }
.inv-pill { margin: 0 0 0 0.5rem; }
.inv-detail { color: var(--muted); font-size: 0.85rem; font-weight: 700; margin-top: 0.1rem; }
.inv-actions { display: flex; gap: 0.5rem; flex: 0 0 auto; }
.inv-actions .btn { min-width: 44px; }
.inv-used, .inv-expired, .inv-revoked { opacity: 0.8; }
.inv-past { margin-top: 0.4rem; }
.btn.inv-past-toggle { min-height: 44px; padding: 0.3rem 0; box-shadow: none; font-size: 0.95rem; }
.inv-link { font-size: 0.95rem; }
.copy-scratch { position: fixed; left: -9999px; top: 0; opacity: 0; }
.join-intro p, .join-signed-in p { margin: 0.5rem 0; }
.join-intro h2, .join-signed-in h2, .join-bad h2 { margin: 0 0 0.4rem; }
.join-intro { margin-bottom: 0.9rem; }
.join-message { font-size: 1.1rem; font-weight: 700; margin: 0.4rem 0 1rem; }
.auth-page .sheet-actions { margin-top: 0.9rem; }

/* ---------- Parent: card-driven store manager (#/store/manage) ---------- */
.page.page-wide { max-width: 1240px; }
.manage-title { margin: 0.2rem 0 0.9rem; display: flex; align-items: baseline; justify-content: space-between; gap: 0.2rem 1rem; flex-wrap: wrap; }
.manage-title h1 { margin: 0; }
.manage-title .muted { font-size: 0.9rem; }

/* Top row of tiles: waiting for OK / to deliver (or All caught up) + Purchase history */
.top-tiles { display: flex; gap: 0.6rem; align-items: stretch; }
.top-tile { appearance: none; font: inherit; color: #fff; text-align: left; flex: 1 1 0; min-width: 0; min-height: 76px; display: flex; flex-direction: column; justify-content: center; gap: 0.2rem;
  padding: 0.55rem 0.7rem; border-radius: var(--radius); border: 2px solid var(--line); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3); }
button.top-tile { cursor: pointer; touch-action: manipulation; }
button.top-tile:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3); }
button.top-tile:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.tile-text { font-weight: 800; line-height: 1.2; font-size: 0.92rem; min-width: 0; overflow-wrap: anywhere; }
.needs-tile.is-waiting { background: #3b3118; border-color: #c9962a; }
.needs-tile.is-deliver { background: #1f2850; border-color: #3f7bea; }
.needs-num { font-size: 1.9rem; line-height: 1; font-weight: 900; font-variant-numeric: tabular-nums; }
.is-waiting .needs-num { color: #ffd978; }
.is-deliver .needs-num { color: #b9caff; }
.needs-clear { background: #14342a; border-color: #1d6a4c; color: #6ff0b8; box-shadow: none; }
.needs-tick { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--green); position: relative; }
.needs-tick::after { content: ""; position: absolute; left: 8px; top: 4px; width: 6px; height: 11px; border: solid #04180f; border-width: 0 3px 3px 0; transform: rotate(45deg); }
.hist-tile { flex-grow: 1.7; background: #11363f; border-color: #25a7b0; }
.hist-num { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; color: #7ff0f0; }
.hist-count { font-size: 1.9rem; line-height: 1; font-weight: 900; font-variant-numeric: tabular-nums; }
.hist-icon { flex: none; opacity: 0.85; }
.hist-title { display: block; font-size: 1rem; font-weight: 900; }
.hist-hint { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 0.1rem; color: #b8e6e8; font-size: 0.8rem; font-weight: 700; }
@media (min-width: 640px) {
  .top-tile { flex-direction: row; align-items: center; gap: 0.8rem; min-height: 72px; padding: 0.5rem 0.9rem; }
  .needs-num { min-width: 2.2rem; text-align: center; }
  .tile-text { font-size: 1rem; }
  .hist-num { justify-content: flex-start; gap: 0.6rem; flex: none; }
  .hist-count { min-width: 2.2rem; text-align: center; }
  .hist-icon { display: none; }
  .hist-hint { font-size: 0.85rem; }
}

/* Section chips */
.manage-chips { margin: 0.7rem -1rem 0; padding: 0.3rem 1rem 0.6rem; }

/* Sections + card grid */
.manage-block { margin: 0.4rem 0 1.4rem; scroll-margin-top: 70px; }
.manage-block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; margin: 0 0 0.6rem; padding-bottom: 0.4rem; border-bottom: 1px solid var(--line-soft); }
.manage-block-head h2 { margin: 0; font-size: 1.2rem; font-weight: 900; }
.manage-block-count { flex: none; font-size: 0.82rem; font-weight: 800; color: var(--muted); }
.manage-block-note { margin: -0.2rem 0 0.7rem; color: var(--muted); font-size: 0.88rem; font-weight: 600; }
.manage-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; }
@media (min-width: 700px) { .manage-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.8rem; } }
@media (min-width: 1000px) { .manage-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (min-width: 1240px) { .manage-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.manage-grid .item-card { width: auto; min-width: 0; }
.manage-card .price-pill { margin-top: auto; }
.manage-tl { right: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.manage-tl .tier-pill { align-self: flex-start; }
.mini-chip.feat { background: #ffd45a; color: #3a2a00; padding-left: 0.3rem; display: inline-flex; align-items: center; gap: 0.2rem; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); }
.mini-chip.feat::before { content: ""; width: 0.75rem; height: 0.75rem; background: #3a2a00; clip-path: polygon(50% 0, 62% 36%, 100% 38%, 70% 60%, 80% 100%, 50% 76%, 20% 100%, 30% 60%, 0 38%, 38% 36%); }
.manage-card.is-hidden { border-style: dashed; background: var(--card-2); }
.manage-card.is-hidden .item-thumb, .manage-card.is-hidden .item-name, .manage-card.is-hidden .price-pill { opacity: 0.42; filter: grayscale(0.7); }
.hidden-badge { position: absolute; z-index: 2; left: 50%; top: 40%; transform: translate(-50%, -50%); font-size: 0.78rem; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; padding: 0.25rem 0.7rem; border-radius: 6px; background: #14161a; color: #fff; border: 2px solid #8e9195; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.45); pointer-events: none; }
.manage-add { background: transparent; border: 2px dashed #8e9195; box-shadow: none; align-items: center; justify-content: center; gap: 0.2rem; min-height: 190px; color: var(--link); }
@media (hover: hover) { .manage-add:hover { transform: none; box-shadow: none; background: rgba(255, 255, 255, 0.04); } }
.manage-add:active { box-shadow: none; }
.manage-add-plus { font-size: 2.4rem; line-height: 1; font-weight: 900; }
.manage-add-text { font-weight: 800; font-size: 0.95rem; }

/* Edit sheet */
.edit-hero { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; margin: 0.3rem 0 0.4rem; text-align: center; }
.edit-art svg { display: block; width: 128px; height: 128px; border-radius: 20px; box-shadow: 0 5px 0 rgba(0, 0, 0, 0.35); }
.edit-art-name { color: var(--muted); font-weight: 700; font-size: 0.9rem; overflow-wrap: anywhere; }
.edit-art-title { font-size: 1.2rem; font-weight: 900; overflow-wrap: anywhere; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.field-pair .field { min-width: 0; }
.sheet form .check { margin: 0.3rem 0; }
.sheet form .field { margin: 0.7rem 0; }
.sheet form .field-pair .field { margin: 0.7rem 0; }
.sheet-actions.two { grid-template-columns: 1fr 1fr; }
body:has(.page-wide) .top-inner { max-width: 1240px; }
.sheet form .error { margin-top: 0.8rem; }

/* Needs-you sheet */
.need-hint { margin: 0.3rem 0 0.8rem; color: var(--muted); font-weight: 700; }
.need-list { display: flex; flex-direction: column; gap: 0.7rem; }
.need-row { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.7rem; }
.need-head { display: flex; gap: 0.7rem; align-items: center; }
.buy-art { flex: none; display: block; line-height: 0; }
.buy-art svg { display: block; border-radius: 10px; }
.need-main { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.need-item { font-size: 1.05rem; line-height: 1.2; overflow-wrap: anywhere; }
.need-who { display: flex; align-items: center; gap: 0.4rem; color: var(--muted); font-size: 0.88rem; font-weight: 700; }
.need-who .avatar-svg { border-radius: 7px; }
.need-price { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--bux-ink); font-weight: 900; }
.need-row .quote { margin: 0.5rem 0 0; }
.need-actions { margin-top: 0.7rem; }

/* Purchase history sheet */
.sheet-tall { height: 92vh; height: 92dvh; max-width: 640px; display: flex; flex-direction: column; overflow: hidden; }
.sheet-tall .sheet-head { flex: none; }
.sheet-tall .sheet-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ph-top { flex: none; }
.ph-summary { margin: 0.1rem 0 0.5rem; font-weight: 900; color: var(--bux-ink); font-size: 1rem; }
.ph-chips { display: flex; gap: 0.45rem; overflow-x: auto; margin: 0 -1.1rem 0.5rem; padding: 0 1.1rem 0.25rem; scrollbar-width: none; }
.ph-chips::-webkit-scrollbar { display: none; }
.ph-chip { flex: none; min-height: 44px; padding: 0.4rem 0.85rem; display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap; font-size: 0.92rem; }
.ph-kids .ph-chip { padding-left: 0.4rem; }
.ph-kids .ph-chip:first-child { padding-left: 0.85rem; }
.ph-chip-face { display: block; line-height: 0; }
.ph-chip-face .avatar-svg { border-radius: 8px; }
.ph-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 -0.5rem; padding: 0 0.5rem 0.5rem; }
.ph-day { margin: 0.9rem 0 0.4rem; font-size: 0.8rem; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.ph-day:first-child { margin-top: 0.2rem; }
.ph-group { display: flex; flex-direction: column; gap: 0.45rem; }
.ph-row { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.ph-row.is-open { border-color: #7a7d81; }
.ph-head { appearance: none; font: inherit; color: #fff; text-align: left; width: 100%; display: flex; align-items: center; gap: 0.65rem; min-height: 68px; padding: 0.45rem 0.6rem; background: none; border: 0; cursor: pointer; touch-action: manipulation; }
.ph-head:focus-visible { outline: 3px solid #fff; outline-offset: -3px; }
.ph-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.ph-item { font-size: 1rem; line-height: 1.2; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ph-who { display: flex; align-items: center; gap: 0.4rem; color: var(--muted); font-size: 0.82rem; font-weight: 700; min-width: 0; }
.ph-who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph-who .avatar-svg { border-radius: 6px; flex: none; }
.ph-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 0.3rem; }
.ph-price { display: inline-flex; align-items: center; gap: 0.25rem; color: var(--bux-ink); font-weight: 900; font-variant-numeric: tabular-nums; }
.ph-side .status-pill { font-size: 0.7rem; padding: 0.22rem 0.45rem; }
.ph-detail { padding: 0.2rem 0.8rem 0.8rem; border-top: 1px solid var(--line-soft); background: rgba(0, 0, 0, 0.12); }
.ph-detail[hidden] { display: none; }
.ph-line { margin: 0.55rem 0 0; font-weight: 700; color: #e4e5e6; font-size: 0.92rem; }
.ph-detail .quote { margin: 0.5rem 0 0; }
.ph-detail .need-actions { margin-top: 0.8rem; }
.ph-empty { margin-top: 0.6rem; display: flex; flex-direction: column; align-items: center; gap: 0.7rem; }
.ph-empty p { margin: 0.3rem 0 0; }
.ph-more { text-align: center; }
@media (min-width: 700px) {
  .sheet-tall { height: min(86vh, 860px); }
  .ph-chips { flex-wrap: wrap; overflow: visible; margin: 0 0 0.5rem; padding: 0; }
}

/* ---------- Parent profile button + menu (top bar) ---------- */
/* Wide: brand, nav (Home, Store, Family), Alerts bell, profile. Phones: brand, bell, profile on the first row; nav on its own row. */
.top-inner > .nav { order: 2; }
.top-inner > .bell-link { order: 3; }
.profile-wrap { order: 4; position: relative; margin-left: 0.4rem; }
.profile-btn { min-width: 0; appearance: none; font: inherit; color: #fff; cursor: pointer; touch-action: manipulation; display: inline-flex; align-items: center; gap: 0.5rem;
  min-height: 48px; padding: 0.15rem 0.6rem 0.15rem 0.3rem; background: transparent; border: 2px solid transparent; border-radius: 999px; }
@media (hover: hover) { .profile-btn:hover { background: #2a2d30; } }
.profile-btn[aria-expanded="true"] { background: #2a2d30; border-color: var(--line); }
.profile-btn:focus-visible, .pm-item:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.profile-face, .pm-face { display: block; flex: none; border-radius: 50%; overflow: hidden; line-height: 0; }
.profile-face { width: 36px; height: 36px; box-shadow: 0 0 0 2px var(--line); }
.pm-face { width: 84px; height: 84px; box-shadow: 0 0 0 3px var(--line); }
.profile-face .avatar-svg, .pm-face .avatar-svg { display: block; border-radius: 0; }
.profile-text { display: inline-flex; align-items: center; gap: 0.4rem; min-width: 0; overflow: hidden; font-weight: 800; font-size: 0.95rem; }
.profile-first { min-width: 1.6rem; max-width: 6rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-pill { flex: none; margin-left: 0; font-size: 0.68rem; padding: 0.15rem 0.45rem; }
.profile-caret { flex: none; width: 0; height: 0; border: solid transparent; border-width: 5px 4px 0; border-top-color: var(--muted); }
.profile-backdrop { position: fixed; inset: 0; z-index: 1; background: transparent; }
.profile-panel { position: absolute; z-index: 2; top: calc(100% + 8px); right: 0; width: min(360px, calc(100vw - 2rem)); background: var(--card-2); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55); padding: 1rem; animation: pop 0.12s ease-out; }
@keyframes pop { from { transform: translateY(-6px); opacity: 0; } to { transform: none; opacity: 1; } }
.pm-head { display: flex; align-items: center; gap: 0.9rem; padding: 0.1rem 0.2rem 0.9rem; border-bottom: 1px solid var(--line); }
.pm-who { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 0.15rem; }
.pm-name { font-size: 1.3rem; font-weight: 900; line-height: 1.2; overflow-wrap: anywhere; }
.pm-pill { margin-left: 0; }
.pm-email, .pm-family { color: var(--muted); font-size: 0.88rem; font-weight: 700; overflow-wrap: anywhere; }
.pm-list { display: flex; flex-direction: column; margin: 0.5rem 0 0; }
.pm-item { appearance: none; font: inherit; font-weight: 800; color: #fff; text-decoration: none; text-align: left; cursor: pointer; touch-action: manipulation; width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; min-height: 52px; padding: 0.45rem 0.7rem; background: transparent; border: 0; border-radius: var(--radius); }
@media (hover: hover) { .pm-item:hover { background: #3a3d40; } }
.pm-item:active { background: #44474b; }
.pm-item-text { display: flex; flex-direction: column; min-width: 0; }
.pm-item-label { font-size: 1.02rem; }
.pm-item-sub { color: var(--muted); font-size: 0.8rem; font-weight: 700; }
.pm-item-go { flex: none; width: 8px; height: 8px; margin-right: 0.2rem; border-top: 2px solid var(--muted); border-right: 2px solid var(--muted); transform: rotate(45deg); }
.pm-sep { border: 0; border-top: 1px solid var(--line); margin: 0.35rem 0.2rem; }
.pm-foot { margin-top: 0.7rem; }
/* Wide: one row, never wrapped. The nav keeps its size and a long first name shrinks (ellipsis) instead of pushing the profile button to a second row. */
@media (min-width: 700px) {
  .top-inner { flex-wrap: nowrap; }
  .top-inner > .nav { flex: none; flex-wrap: nowrap; }
  .profile-wrap { flex: 0 1 auto; min-width: 0; }
  .profile-btn { max-width: 100%; }
  .top-inner > .brand, .top-inner > .bell-link { flex: none; }
}
/* The header column is 760px wide: brand + 3 links + Alerts leave room for the first name and caret only, so the label pill is hidden on wide screens.
   The unread count sits on the bell icon, so it never changes the header's width. */
@media (min-width: 700px) {
  .profile-pill { display: none; }
  .profile-first { max-width: 5rem; }
}
@media (min-width: 700px) and (max-width: 779px) {
  .profile-text, .profile-caret { display: none; }
  .profile-btn { padding: 0.15rem; }
}
@media (max-width: 699px) {
  .profile-backdrop { background: rgba(8, 9, 10, 0.72); animation: fade 0.15s; }
  .profile-panel { position: fixed; top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 92vh; max-height: 92dvh; overflow-y: auto; border-radius: 16px 16px 0 0; border-bottom: 0;
    padding: 1.6rem 1.1rem calc(1.2rem + env(safe-area-inset-bottom)); box-shadow: none; animation: rise 0.2s ease-out; }
  .profile-panel::before { content: ""; position: absolute; top: 0.6rem; left: 50%; width: 44px; height: 5px; margin-left: -22px; border-radius: 3px; background: #7a7d81; }
  .top-inner > .nav { order: 5; }
  .top-inner > .bell-link { margin-left: auto; }
  .profile-wrap { margin-left: 0.2rem; }
}
@media (max-width: 520px) {
  .profile-text, .profile-caret { display: none; }
  .profile-btn { padding: 0.15rem; }
  .brand { font-size: 1.25rem; }
}
@media (max-width: 399px) {
  .bell-text { display: none; }
  .bell-link { padding: 0.3rem 0.5rem 0; }
}
@media (prefers-reduced-motion: reduce) { .profile-panel, .profile-backdrop { animation: none; } }

/* ---------- Alerts bell (top bar) + alerts inbox ---------- */
.bell-link { gap: 0.7rem; white-space: nowrap; }
.bell-wrap { position: relative; display: inline-flex; line-height: 0; }
.bell-icon { display: block; }
.bell-count { position: absolute; top: -7px; right: -10px; min-width: 18px; height: 18px; padding: 0 0.3rem; box-sizing: border-box; border-radius: 9px; background: var(--red); color: #fff;
  font-size: 0.7rem; font-weight: 900; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--bg-deep); }
.bell-count[hidden] { display: none; }
.alerts-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.alerts-settings { flex: none; display: inline-flex; align-items: center; min-height: 44px; font-weight: 800; color: var(--link); text-decoration: none; }
.alerts-settings:hover { text-decoration: underline; }
.alert-list { display: flex; flex-direction: column; gap: 0.6rem; }
.alert-row { display: flex; align-items: center; gap: 0.8rem; margin: 0; color: inherit; text-decoration: none; }
.alert-row .avatar-svg { flex: none; }
.alert-text { min-width: 0; overflow-wrap: anywhere; }
.alert-when { font-size: 0.82rem; }
@media (hover: hover) { .alert-row:hover { background: #34373a; } }
