/* Treat app styles — shared by /send, /t, /treats, /memes. Tokens come from treat-tokens.css. */
*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; letter-spacing: var(--tracking-body); min-height: 100vh; }
a { color: var(--color-accent); text-decoration: none; }
a:hover { color: #0077d6; }
button { font-family: inherit; }
img, video { max-width: 100%; }
:focus-visible { outline: none; box-shadow: 0 0 0 var(--ring-width) var(--ring-accent); border-radius: var(--radius-pill); }
[hidden] { display: none !important; }

.container { width: 100%; max-width: var(--container-5xl); margin: 0 auto; padding: 0 20px; }
.ui { font-size: var(--text-13); font-weight: var(--weight-medium); letter-spacing: var(--tracking-ui); line-height: var(--leading-snug); }
.meta { font-size: var(--text-13); font-weight: var(--weight-normal); letter-spacing: var(--tracking-ui); line-height: var(--leading-snug); color: var(--color-muted); }
.h1 { font-family: var(--font-display); font-weight: var(--weight-extrabold); letter-spacing: var(--tracking-display); font-size: clamp(36px, 6vw, 56px); line-height: 0.98; color: var(--color-fg-strong); margin: 0; text-wrap: balance; }
.h2 { font-size: var(--text-xl); font-weight: var(--weight-bold); line-height: var(--leading-tight); letter-spacing: var(--tracking-heading); color: var(--color-fg-strong); margin: 0; }
.h3 { font-size: var(--text-lg); font-weight: var(--weight-semibold); line-height: var(--leading-tight); letter-spacing: -0.5px; color: var(--color-fg-strong); margin: 0; }
.title-15 { font-size: var(--text-15); font-weight: var(--weight-semibold); letter-spacing: -0.3px; color: var(--color-fg-strong); }
.wordmark { font-family: var(--font-display); font-weight: var(--weight-extrabold); letter-spacing: var(--tracking-display); font-size: 26px; line-height: 1; color: var(--color-fg-strong); }
.display-num { font-family: var(--font-display); font-weight: var(--weight-extrabold); letter-spacing: var(--tracking-display); font-variant-numeric: tabular-nums; color: var(--color-accent); line-height: 1; }
.mono { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0; }
.muted { color: var(--color-muted); }
.green { color: var(--color-green); }
.red { color: var(--color-red); }
.row { display: flex; align-items: center; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-sm { padding: 10px 14px; font-size: var(--text-13); letter-spacing: var(--tracking-ui); }
.btn-lg { padding: 14px 20px; font-size: var(--text-base); font-weight: var(--weight-medium); }
.btn-block { width: 100%; }
button:disabled, .btn-primary:disabled, .btn-fire:disabled { opacity: 0.45; cursor: not-allowed; filter: none !important; transform: none !important; }

/* Nav — header spans the window on every page; content below stays capped */
header#nav.container { max-width: none; padding-left: 24px; padding-right: 24px; }
.nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 24px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--color-fg-strong); }
.brand:hover { color: var(--color-fg-strong); }
.candy { width: 30px; height: 30px; flex: none; display: block; transform: rotate(-45deg); }
.candy-sm { width: 24px; height: 24px; }
.beta { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: var(--radius-pill); background: var(--color-fire-soft); color: var(--color-fire-deep); font-size: 12px; font-weight: var(--weight-semibold); letter-spacing: -0.2px; line-height: 1.3; position: relative; top: 1px; }
.nav-links { display: flex; align-items: center; gap: 4px; padding: 6px 8px; }  /* landing page only */
.nav-links a { color: var(--color-fg); padding: 6px 12px; border-radius: var(--radius-pill); }
.nav-links a:hover { background: rgba(255,255,255,0.9); }
.nav-links a[aria-current="page"] { background: #fff; color: var(--color-fg-strong); }
.wallet-btn { display: inline-flex; align-items: center; gap: 8px; }
#wallet-label { display: inline-flex; align-items: center; gap: 8px; }
.wallet-dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--color-live); box-shadow: 0 0 0 3px var(--color-green-soft); }
.wallet-dot.demo { background: var(--color-fire); box-shadow: 0 0 0 3px var(--color-fire-soft); }
@media (max-width: 720px) { .nav-links { display: none; } }
.wallet-btn[aria-expanded="true"] { background: #fff; }
.vsep { width: 1px; height: 16px; background: var(--color-border); margin: 0 2px; }
.menu-sep { height: 1px; background: var(--color-hairline); margin: 4px 6px; }
.menu-wallet { padding: 8px 14px 4px; display: flex; flex-direction: column; gap: 2px; max-width: 240px; }
.menu-pop button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 10px 14px; border-radius: 10px; color: var(--color-fg); font: inherit; font-size: 14px; cursor: pointer; }
.menu-pop button:hover { background: var(--color-surface-2); color: var(--color-fg-strong); }
.menu-pop button:disabled { opacity: 0.5; cursor: default; }
.menu-wrap { position: relative; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 8px); min-width: 200px; padding: 6px; border-radius: 16px; background: var(--color-surface); box-shadow: var(--shadow-card); display: flex; flex-direction: column; gap: 2px; z-index: 40; }
.menu-pop a { display: block; padding: 10px 14px; border-radius: 10px; color: var(--color-fg); font-size: 14px; }
.menu-pop a:hover { background: var(--color-surface-2); color: var(--color-fg-strong); }
.menu-pop a[aria-current="page"] { background: var(--color-accent-soft); color: #0077d6; }
@media (max-width: 720px) { .wallet-btn { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } }

/* Page */
.page { padding: 40px 0 96px; display: flex; flex-direction: column; gap: 24px; }
.page-head { display: flex; flex-direction: column; gap: 8px; }
.page-head p { margin: 0; max-width: 34rem; text-wrap: pretty; }
.footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 18px; padding: 24px 0 64px; }

/* Inputs */
.input { width: 100%; }
.textarea { width: 100%; border: 0; border-radius: var(--radius-3xl); background: var(--color-input); color: var(--color-fg); padding: 14px 16px; font: inherit; font-size: var(--text-base); letter-spacing: var(--tracking-body); line-height: var(--leading-snug); resize: vertical; min-height: 120px; }
.textarea:focus { outline: none; box-shadow: 0 0 0 var(--ring-width) var(--ring-accent-input); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: var(--text-13); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-ui); color: var(--color-fg-strong); }
.hint { display: flex; justify-content: space-between; gap: 10px; }
.select { appearance: none; border: 0; border-radius: var(--radius-pill); background: var(--color-glass); box-shadow: var(--shadow-pill); color: var(--color-fg); padding: 10px 34px 10px 14px; font: inherit; font-size: var(--text-13); font-weight: var(--weight-medium); letter-spacing: var(--tracking-ui); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%231a2e3f' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; cursor: pointer; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--radius-pill); font-size: var(--text-15); line-height: 1.27; font-weight: var(--weight-medium); letter-spacing: -0.3px; white-space: nowrap; background: var(--color-surface-2); color: var(--color-muted); border: 0; cursor: pointer; }
.chip[aria-pressed="true"], .chip.on { background: var(--color-accent-soft); color: #0077d6; }
.chip-sm { font-size: 12px; padding: 3px 8px; }
.chip-fire { background: var(--color-fire-soft); color: var(--color-fire-deep); }
.chip-green { background: var(--color-green-soft); color: var(--color-green); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.toolbar .input { max-width: 320px; }
.search { position: relative; flex: 1; min-width: 200px; max-width: 320px; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--color-muted); pointer-events: none; }
.search .input { padding-left: 38px; }

/* Meme grid */
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
@media (min-width: 720px) { .mgrid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); } }
.mcard { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 8px; border: 0; border-radius: 18px; background: var(--color-surface); box-shadow: var(--shadow-card); cursor: pointer; text-align: left; color: var(--color-fg); transition: transform var(--duration) var(--ease), box-shadow var(--duration) var(--ease); }
.mcard:hover { transform: translateY(-2px); }
.mcard:focus-visible { border-radius: 18px; }
.mcard .art { position: relative; overflow: hidden; border-radius: 12px; background: var(--color-surface-2); aspect-ratio: 3 / 4; }
.mcard .art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.mcard .art .badge { position: absolute; left: 8px; top: 8px; padding: 2px 7px; border-radius: var(--radius-pill); background: rgba(14,14,16,0.6); color: #fff; font-size: 11px; font-weight: var(--weight-semibold); letter-spacing: -0.2px; backdrop-filter: blur(var(--blur-sm)); }
.mcard .name { font-size: var(--text-13); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-ui); color: var(--color-fg-strong); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcard .by { font-size: 12px; color: var(--color-muted); letter-spacing: -0.2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcard .cap { padding: 0 4px 2px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mcard .check { position: absolute; right: 14px; top: 14px; width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,0.85); backdrop-filter: blur(var(--blur-sm)); display: grid; place-items: center; color: transparent; box-shadow: 0 1px 3px rgba(0,0,0,0.15); transition: background var(--duration) var(--ease); }
.mcard[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--color-accent), var(--shadow-card); }
.mcard[aria-pressed="true"] .check { background: var(--color-accent); color: #fff; }
.mcard .price { position: absolute; right: 14px; bottom: 54px; padding: 2px 7px; border-radius: var(--radius-pill); background: rgba(255,255,255,0.88); color: var(--color-fire-deep); font-size: 11px; font-weight: var(--weight-bold); }
.more { display: flex; justify-content: center; padding-top: 6px; }
.empty { padding: 40px 20px; text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }

/* Composer */
.compose { display: grid; grid-template-columns: 1fr; gap: 20px; align-items: start; }
@media (min-width: 960px) { .compose { grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; } }
.steps { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.step { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.step-head { display: flex; align-items: center; gap: 12px; }
.step-num { font-family: var(--font-display); font-weight: var(--weight-extrabold); letter-spacing: var(--tracking-display); font-size: 28px; line-height: 1; color: var(--color-accent); font-variant-numeric: tabular-nums; width: 28px; }
.step-head .meta { margin-left: auto; text-align: right; }
.summary { position: sticky; top: 20px; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.picked { display: flex; flex-direction: column; gap: 6px; }
.picked-row { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 12px; background: var(--color-surface-2); }
.picked-row img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; flex: none; background: #ddd; }
.picked-row .x { border: 0; background: transparent; color: var(--color-muted); padding: 6px; border-radius: 50%; cursor: pointer; line-height: 0; }
.picked-row .x:hover { background: #fff; color: var(--color-red); }
.fan { display: flex; height: 92px; align-items: flex-end; justify-content: center; overflow: hidden; padding: 6px 4px 14px; }
.fan img { width: 56px; height: 72px; object-fit: cover; border-radius: 8px; box-shadow: var(--shadow-card); background: var(--color-surface-2); flex: none; transform-origin: bottom center; transform: rotate(var(--rot, 0deg)) translateY(var(--lift, 0px)); animation: fan-in 420ms var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms); }
@keyframes fan-in { from { opacity: 0; transform: rotate(var(--rot, 0deg)) translateY(calc(var(--lift, 0px) + 18px)) scale(0.9); } to { opacity: 1; transform: rotate(var(--rot, 0deg)) translateY(var(--lift, 0px)); } }
.fan img + img { margin-left: var(--overlap, -10px); }
.fan .fan-empty { width: 56px; height: 72px; border-radius: 8px; border: 1.5px dashed var(--color-border-base); }
.bill { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; border-top: 1px solid var(--color-hairline); }
.bill .line { display: flex; justify-content: space-between; gap: 10px; }
.bill .total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 6px; }
.bill .total .display-num { font-size: 28px; }
.recipient { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px; background: var(--color-surface-2); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--gradient-accent); flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.status { display: inline-flex; align-items: center; gap: 6px; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--color-accent-soft); border-top-color: var(--color-accent); animation: spin 0.8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Dialogs */
dialog.sheet { border: 0; padding: 0; background: transparent; max-width: min(520px, calc(100vw - 32px)); width: 100%; }
dialog.sheet::backdrop { background: rgba(20, 51, 77, 0.35); backdrop-filter: blur(8px); }
.sheet-card { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.close { border: 0; background: var(--color-surface-2); width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--color-fg); }
.close:hover { background: var(--color-input); }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 0; border-radius: 16px; background: var(--color-surface-2); cursor: pointer; text-align: left; color: var(--color-fg); }
.opt:hover { background: var(--color-input); }
.opt .ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: #fff; flex: none; }
.opt .t { font-size: var(--text-15); font-weight: var(--weight-semibold); letter-spacing: -0.3px; color: var(--color-fg-strong); }
.progress { display: flex; flex-direction: column; gap: 8px; }
.progress .p { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--color-surface-2); }
.progress .p.done { color: var(--color-green); }
.progress .p.active { background: var(--color-accent-soft); color: #0077d6; }
.progress .p .n { width: 20px; height: 20px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 11px; font-weight: var(--weight-bold); flex: none; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; padding: 12px 16px; border-radius: var(--radius-pill); background: var(--color-dark); color: #fff; font-size: var(--text-13); font-weight: var(--weight-medium); letter-spacing: var(--tracking-ui); box-shadow: var(--shadow-pill); transition: opacity 200ms var(--ease), transform 200ms var(--ease); z-index: 50; pointer-events: none; max-width: calc(100vw - 40px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Envelope / treat page */
.treat-wrap { display: grid; grid-template-columns: 1fr; gap: 20px; align-items: start; }
@media (min-width: 900px) { .treat-wrap { grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; } }
.envelope { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.envelope svg { display: block; width: 100%; height: auto; }
.env-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 4px; flex-wrap: wrap; }
.seal-stage { position: relative; }
.flap { transform-origin: 152px 30px; transition: transform 700ms var(--ease); }
.is-opening .flap { transform: rotateX(180deg); }
.opened-cards { display: grid; grid-template-columns: 1fr; gap: 14px; align-items: start; }
@media (min-width: 640px) { .opened-cards.n2, .opened-cards.n3, .opened-cards.n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) { .opened-cards.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.bigcard { padding: 12px; display: flex; flex-direction: column; gap: 10px; animation: pop 500ms var(--ease) both; }
.bigcard:nth-child(2) { animation-delay: 120ms; } .bigcard:nth-child(3) { animation-delay: 240ms; } .bigcard:nth-child(4) { animation-delay: 360ms; }
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(0.97); } to { opacity: 1; transform: none; } }
.bigcard .art { position: relative; overflow: hidden; border-radius: 14px; background: var(--color-surface-2); }
.bigcard .art img, .bigcard .art video { width: 100%; height: auto; display: block; }
.play-gif { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); }
.bigcard .cap { display: flex; flex-direction: column; gap: 2px; padding: 0 4px 2px; min-width: 0; }
.postcard-note { padding: 20px 22px; display: flex; flex-direction: column; gap: 12px; background: #fff; background-image: repeating-linear-gradient(transparent 0 27px, var(--color-hairline) 27px 28px); }
.postcard-note .txt { font-size: var(--text-lg); line-height: 28px; letter-spacing: var(--tracking-body); color: var(--color-fg); white-space: pre-wrap; margin: 0; overflow-wrap: anywhere; }
.side { display: flex; flex-direction: column; gap: 12px; }
.side .card { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.kv { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.kv .k { color: var(--color-muted); }
.linkbox { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border-radius: var(--radius-pill); background: var(--color-surface-2); }
.linkbox .url { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-13); color: var(--color-fg); }
.share { display: flex; flex-wrap: wrap; gap: 8px; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 12px; border-radius: 2px; animation: fall 1.8s ease-in forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); opacity: 0; } }

/* Treat list */
.tlist { display: flex; flex-direction: column; gap: 10px; }
.trow { display: flex; align-items: center; gap: 14px; padding: 12px 14px; color: var(--color-fg); }
.trow:hover { color: var(--color-fg); transform: translateY(-1px); }
.trow .thumbs { display: flex; flex: none; }
.trow .thumbs img { width: 44px; height: 56px; object-fit: cover; border-radius: 8px; background: var(--color-surface-2); margin-right: -14px; box-shadow: 0 1px 3px rgba(0,0,0,0.15); }
.trow .thumbs img:last-child { margin-right: 0; }
.trow .env { width: 44px; height: 56px; border-radius: 8px; background: var(--color-surface-2); display: grid; place-items: center; flex: none; }
.tabs { display: inline-flex; gap: 4px; padding: 6px 8px; }
.tabs button { border: 0; background: transparent; color: var(--color-fg); padding: 6px 12px; border-radius: var(--radius-pill); font: inherit; font-size: var(--text-13); font-weight: var(--weight-medium); letter-spacing: var(--tracking-ui); cursor: pointer; }
.tabs button[aria-selected="true"] { background: #fff; color: var(--color-fg-strong); }

/* Meme detail */
.detail { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 640px) { .detail { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); } }
.detail .art { position: relative; border-radius: 14px; overflow: hidden; background: var(--color-surface-2); }
.detail .art img, .detail .art video { width: 100%; height: auto; display: block; }
.detail .desc { font-size: var(--text-sm); line-height: 1.45; color: var(--color-fg); white-space: pre-wrap; margin: 0; }
.traits { display: flex; flex-wrap: wrap; gap: 6px; }

@media (prefers-reduced-motion: reduce) { .mcard, .bigcard, .flap, .confetti i { transition: none; animation: none; } }

/* Composer, two stages */
.stepper { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--radius-pill); background: var(--color-glass); box-shadow: var(--shadow-pill); color: var(--color-muted); }
.stepper b { color: var(--color-accent); font-weight: var(--weight-bold); }
.stepper .sep { opacity: 0.5; }
.stepper .done { color: var(--color-green); }
.sentinel { height: 1px; }
.fan-lg { height: 122px; }
.fan-lg img { width: 68px; height: 88px; }
.fan img[data-rm] { cursor: pointer; transition: transform var(--duration) var(--ease), filter var(--duration) var(--ease); }
.fan img[data-rm]:hover { filter: brightness(0.7); transform: rotate(var(--rot, 0deg)) translateY(calc(var(--lift, 0px) - 8px)); }
.stage2 { display: grid; grid-template-columns: 1fr; gap: 20px; align-items: start; }
@media (min-width: 960px) { .stage2 { grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; } }
.review-cards { display: flex; flex-wrap: wrap; gap: 10px; }
.rcard { display: flex; flex-direction: column; gap: 4px; width: 96px; }
.rcard img { width: 96px; height: 120px; object-fit: cover; border-radius: 10px; background: var(--color-surface-2); box-shadow: var(--shadow-card); }
.rcard .meta { font-size: 12px; }
.linklike { border: 0; background: none; padding: 0; color: var(--color-accent); font: inherit; cursor: pointer; }

/* Mobile sticky bar for the composer (summary card is below the grid on small screens) */
.mobile-bar { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 10px 10px 16px; border-radius: var(--radius-pill); background: rgba(255,255,255,0.86); backdrop-filter: blur(var(--blur-md)); box-shadow: var(--shadow-card); }
@media (min-width: 960px) { .mobile-bar { display: none !important; } }
@media (max-width: 959px) { .page { padding-bottom: 120px; } }

/* Contained card grid + note in the summary column */
.grid-scroll { overflow-y: auto; overscroll-behavior: contain; max-height: calc(100vh - 250px); min-height: 440px; padding: 6px 6px 12px; margin: -6px -6px 0; border-radius: 12px; }
.grid-scroll .sentinel { height: 1px; }
.note-block { display: flex; flex-direction: column; gap: 10px; padding-top: 10px; border-top: 1px solid var(--color-hairline); }
.note-block .step-num { font-size: 22px; width: 22px; }
.note-block .textarea { min-height: 88px; padding: 12px 14px; font-size: 15px; }
.summary .field label { font-size: 12px; }
@media (max-width: 959px) { .grid-scroll { max-height: 70vh; min-height: 360px; } }

/* Picked cards: 5-up thumbnail grid, wraps, never overflows */
.picked-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.picked-grid .fan-empty { grid-column: 1 / -1; justify-self: center; width: 56px; height: 72px; border-radius: 8px; border: 1.5px dashed var(--color-border-base); }
.pthumb { position: relative; display: block; aspect-ratio: 3 / 4; border-radius: 8px; overflow: hidden; background: var(--color-surface-2); box-shadow: 0 1px 3px rgba(0,0,0,0.12); cursor: pointer; }
.pthumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: filter var(--duration) var(--ease); }
.pthumb i { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-style: normal; font-weight: 700; font-size: 14px; opacity: 0; background: rgba(14,14,16,0.45); transition: opacity var(--duration) var(--ease); }
.pthumb:hover i, .pthumb:focus-visible i { opacity: 1; }
.pthumb:focus-visible { border-radius: 8px; }

/* /send: fixed viewport on desktop — no page scroll, the grid fills the leftover height */
@media (min-width: 960px) and (min-height: 600px) {
  html:has(body.fit), body.fit { height: 100%; overflow: hidden; }
  body.fit { display: flex; flex-direction: column; }
  body.fit .nav { padding-top: 16px; }
  body.fit .page { flex: 1; min-height: 0; padding: 16px 24px 16px; gap: 14px; }
  body.fit .page-head .h1 { font-size: 36px; }
  body.fit .compose3 { flex: 1; min-height: 0; }
  body.fit #step-pick { height: 100%; min-height: 0; }
  body.fit .container { max-width: 1400px; }
  body.fit .grid-scroll { flex: 1; min-height: 0; max-height: none; }
  body.fit .summary { position: static; max-height: 100%; overflow-y: auto; overscroll-behavior: contain; }
  body.fit .step { padding: 16px 18px; }
  body.fit #step-note .textarea { min-height: 96px; }
  body.fit .toolbar .input { padding-top: 9px; padding-bottom: 9px; }
  body.fit .picked-grid { gap: 5px; }
  body.fit .bill { gap: 4px; }
  body.fit .bill .total .display-num { font-size: 24px; }
  body.fit #done { margin-top: 0; overflow-y: auto; max-height: 100%; }
}
@media (min-width: 960px) and (max-height: 820px) {
  body.fit .summary { gap: 10px; padding: 14px 16px; }
  body.fit #fan-hint { display: none; }
  body.fit .page { padding-top: 12px; gap: 10px; }
}
@media (min-width: 960px) and (max-height: 700px) {
  body.fit .page-head { display: none; }
}

/* Composer: category rail · middle · summary */
.compose3 { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
.cstage { display: contents; }
@media (min-width: 960px) { .compose3 { grid-template-columns: 210px minmax(0, 1fr) 340px; gap: 20px; } }
.rail { padding: 14px 10px; display: flex; flex-direction: column; gap: 4px; }
.rail-title { padding: 4px 10px 8px; }
.cat { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; border-radius: 14px; background: transparent; text-align: left; color: var(--color-fg); cursor: pointer; transition: background var(--duration) var(--ease); }
.cat:hover { background: var(--color-surface-2); }
.cat[aria-pressed="true"] { background: var(--color-accent-soft); }
.cat[aria-pressed="true"] .cat-t { color: #0077d6; }
.cat .cat-t { display: block; font-size: var(--text-15); font-weight: var(--weight-semibold); letter-spacing: -0.3px; color: var(--color-fg-strong); }
.cat .grow { display: flex; flex-direction: column; gap: 1px; }
.cat .chip { cursor: inherit; }
.rail.is-dim { opacity: 0.55; pointer-events: none; }
.cat-soon, .cat-soon:hover { background: transparent; cursor: default; }
.cat-soon .cat-t { color: var(--color-muted); font-weight: var(--weight-medium); }
.cat-soon .chip { opacity: 0.7; }
.cat:disabled { opacity: 1; }
.soon-panel { flex: 1; min-height: 320px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 24px; }
@media (max-width: 959px) {
  .rail { flex-direction: row; overflow-x: auto; gap: 6px; padding: 8px; }
  .rail-title { display: none; }
  .cat { width: auto; flex: none; padding: 8px 12px 8px 8px; }
  .cat .meta { display: none; }
}

/* Left column: rail + vote card */
.leftcol { display: flex; flex-direction: column; gap: 16px; min-height: 0; }
.vote { padding: 18px 16px; display: flex; flex-direction: column; gap: 6px; align-items: center; text-align: center; background: linear-gradient(180deg, #fff 0%, rgba(255,143,57,0.14) 100%); box-shadow: var(--shadow-card); }
.vote .btn-fire { margin-top: 6px; }
@media (max-width: 959px) { .vote { flex-direction: row; align-items: center; flex-wrap: wrap; } .vote p { flex: 1; min-width: 160px; } }

/* Stage 2 middle column scrolls inside itself if it ever outgrows the viewport */
@media (min-width: 960px) and (min-height: 600px) { body.fit #stage-2 .mid { max-height: 100%; overflow-y: auto; padding: 6px; margin: -6px; } }
