/* Konkurs Mini App — Telegram themeParams (--tg-theme-*) bilan; tema bo'lmasa — tizim light/dark. Mobil birinchi. */
:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --bg2: var(--tg-theme-secondary-bg-color, #f1f2f6);
  --card: var(--tg-theme-section-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #111418);
  --hint: var(--tg-theme-hint-color, #8a8f98);
  --link: var(--tg-theme-link-color, #2a7de1);
  --btn: var(--tg-theme-button-color, #2a7de1);
  --btn-text: var(--tg-theme-button-text-color, #ffffff);
  --accent: var(--tg-theme-accent-text-color, #2a7de1);
  --danger: var(--tg-theme-destructive-text-color, #e5484d);
  --ok: #22a35a;
  --gold: #f5b301;
  --line: color-mix(in srgb, var(--hint) 22%, transparent);
  --soft: color-mix(in srgb, var(--btn) 12%, transparent);
  --r: 16px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 4px 14px rgba(0, 0, 0, .05);
}
@media (prefers-color-scheme: dark) {
  :root:not(.tg) {
    --bg: #0f1115; --bg2: #171a21; --card: #1b1f27; --text: #f2f3f5; --hint: #8d94a1; --link: #6ab3f3;
    --btn: #3e8ef0; --accent: #6ab3f3; --shadow: none;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg2); color: var(--text); }
body {
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh; overflow-x: hidden;
}
a { color: var(--link); text-decoration: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

#app { max-width: 560px; margin: 0 auto; padding: 12px 16px calc(96px + env(safe-area-inset-bottom)); }
.boot { display: flex; justify-content: center; padding-top: 30vh; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--btn); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* tablar */
.tabs { display: flex; gap: 6px; background: var(--card); padding: 4px; border-radius: 12px; margin-bottom: 14px; box-shadow: var(--shadow); }
.tabs button { flex: 1; padding: 9px 6px; border-radius: 9px; color: var(--hint); font-weight: 600; font-size: 14px; }
.tabs button.on { background: var(--btn); color: var(--btn-text); }

/* poster */
.poster { position: relative; border-radius: 22px; overflow: hidden; min-height: 168px; margin-bottom: 14px;
  background: radial-gradient(120% 90% at 85% 40%, #ffcf4a55 0, transparent 55%), linear-gradient(135deg, #1d2a6b, #10131c 70%);
  color: #fff; display: flex; align-items: stretch; }
.poster img { width: 100%; max-height: 320px; object-fit: cover; display: block; }
.poster .pin { flex: 1; padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 6px; z-index: 1; }
.poster .tag { align-self: flex-start; font-size: 12px; padding: 2px 9px; border-radius: 99px; background: #ffffff26; color: #ffe08a; }
.poster h2 { margin: 2px 0 0; font-size: 21px; line-height: 1.2; max-width: 70%; word-break: break-word; }
.poster .sub { font-size: 13px; opacity: .8; margin-top: auto; }
.poster .cup { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 112px; height: 112px; opacity: .95; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; padding: 5px 11px; border-radius: 99px; background: var(--card); box-shadow: var(--shadow); }
.chip svg.i { width: 15px; height: 15px; }
.chip.ok { color: var(--ok); } .chip.warn { color: #d08700; } .chip.bad { color: var(--danger); }

h1.title { font-size: 22px; line-height: 1.25; margin: 4px 0 10px; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card { background: var(--card); border-radius: var(--r); padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 10px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.card h3 .cnt { margin-left: auto; color: var(--hint); font-weight: 500; font-size: 13px; }
.muted { color: var(--hint); font-size: 13px; }
.post { word-break: break-word; }
.post.clamp { max-height: 7.3em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.post blockquote { margin: 6px 0; padding: 4px 10px; border-left: 3px solid var(--accent); background: var(--soft); border-radius: 6px; }
.post pre, .post code { font-family: ui-monospace, Menlo, monospace; font-size: 13px; background: var(--bg2); border-radius: 6px; padding: 1px 4px; }
.post .spoiler { background: var(--hint); color: transparent; border-radius: 4px; cursor: pointer; }
.post .spoiler.open { background: none; color: inherit; }
.more { color: var(--link); font-size: 14px; margin-top: 6px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); margin-bottom: 12px; }
.stats > div { padding: 12px 6px; text-align: center; }
.stats > div + div { border-left: 1px solid var(--line); }
.stats b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.stats span { font-size: 12px; color: var(--hint); }
.timer b { font-size: 17px; letter-spacing: .5px; }
.progress { height: 6px; background: var(--bg2); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.progress i { display: block; height: 100%; background: var(--btn); border-radius: 99px; transition: width .6s; }

.row { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.row + .row { border-top: 1px solid var(--line); }
.row .ava { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; flex: none;
  background: linear-gradient(135deg, #f7a23b, #e2542a); font-size: 14px; }
.row .grow { flex: 1; min-width: 0; }
.row .grow b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.st.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.st.no { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.st svg.i { width: 15px; height: 15px; stroke-width: 3; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px; border-radius: 11px; font-weight: 600; font-size: 14px;
  background: var(--soft); color: var(--accent); white-space: nowrap; }
.btn.solid { background: var(--btn); color: var(--btn-text); }
.btn.block { width: 100%; padding: 13px; font-size: 15px; }
.btn.danger { background: color-mix(in srgb, var(--danger) 13%, transparent); color: var(--danger); }
.btn:disabled { opacity: .5; }
.btn svg.i { width: 18px; height: 18px; }
.shake { animation: shake .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* captcha */
.cap-q { font-size: 15px; margin-bottom: 10px; }
.cap-q b { color: var(--accent); }
.cap-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cap-grid button { font-size: 34px; padding: 12px 0; border-radius: 14px; background: var(--bg2); transition: transform .12s; }
.cap-grid button:active { transform: scale(.94); }
.cap-img { display: block; width: 100%; max-width: 360px; margin: 6px auto 10px; border-radius: 12px; image-rendering: auto; }
.cap-text { display: flex; gap: 8px; }
.cap-text input { flex: 1; min-width: 0; font: 600 22px/1 ui-monospace, monospace; letter-spacing: 4px; text-transform: uppercase; text-align: center;
  padding: 12px; border-radius: 12px; border: 1px solid var(--line, rgba(127,127,127,.3)); background: var(--bg2); color: inherit; }
.cap-new { margin-top: 10px; }

/* chipta */
.ticket { position: relative; border-radius: 20px; padding: 18px; color: #fff; text-align: center; overflow: hidden; margin-bottom: 12px;
  background: linear-gradient(135deg, #22a35a, #138a8a); box-shadow: 0 8px 24px rgba(19, 138, 138, .25); }
.ticket.win { background: linear-gradient(135deg, #f5b301, #e26a00); }
.ticket .lbl { font-size: 13px; opacity: .9; }
.ticket .num { font-size: 44px; font-weight: 800; letter-spacing: 1px; font-variant-numeric: tabular-nums; line-height: 1.15; }
.ticket::before, .ticket::after { content: ""; position: absolute; top: 50%; width: 22px; height: 22px; border-radius: 50%; background: var(--bg2); transform: translateY(-50%); }
.ticket::before { left: -11px; } .ticket::after { right: -11px; }

/* pastki asosiy tugma (Telegram MainButton bo'lmasa) */
.dock { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--bg2) 30%); z-index: 5; }
.dock .btn { max-width: 528px; margin: 0 auto; display: flex; }

/* natija animatsiyasi */
.stage { text-align: center; padding: 18px 10px 14px; border-radius: 22px; color: #fff; margin-bottom: 12px;
  background: radial-gradient(100% 80% at 50% 0, #4a5bff55, transparent 70%), linear-gradient(160deg, #1a1f3a, #0d0f17); }
.stage .cap { font-size: 13px; opacity: .8; }
.reel { margin: 12px auto 6px; width: 220px; height: 84px; border-radius: 18px; background: #ffffff12; border: 1px solid #ffffff22;
  display: grid; place-items: center; overflow: hidden; position: relative; }
.reel .n { font-size: 46px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.reel.spin .n { filter: blur(.6px); }
.reel.hit { border-color: var(--gold); box-shadow: 0 0 0 3px #f5b30155, 0 0 30px #f5b30155; }
.stage .who { min-height: 44px; font-size: 16px; font-weight: 600; }
.stage .who small { display: block; font-weight: 400; opacity: .75; font-size: 13px; }
.stage .place { font-size: 13px; color: #ffe08a; }
.stage .skip { color: #ffffffb0; font-size: 13px; margin-top: 6px; text-decoration: underline; }

.wl .row .medal { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; flex: none; background: var(--bg2); color: var(--hint); }
.wl .row .medal.m1 { background: #f5b301; color: #fff; } .wl .row .medal.m2 { background: #a7b0bd; color: #fff; } .wl .row .medal.m3 { background: #c98a52; color: #fff; }
.wl .row.me { background: var(--soft); border-radius: 12px; padding-left: 8px; padding-right: 8px; }
.wl .row.pop { animation: pop .45s ease-out; }
@keyframes pop { from { transform: scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
.tno { font-variant-numeric: tabular-nums; color: var(--hint); font-size: 13px; white-space: nowrap; }
.wl .row .grow { display: flex; align-items: center; min-width: 0; }
.wl .row .grow b { min-width: 0; }
.you { flex: none; font-size: 11px; background: var(--btn); color: var(--btn-text); border-radius: 99px; padding: 1px 7px; margin-left: 6px; vertical-align: 2px; }

.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; word-break: break-all; background: var(--bg2); padding: 8px 10px; border-radius: 10px; }
.kv { display: grid; gap: 4px; margin-bottom: 10px; }
.kv .k { font-size: 12px; color: var(--hint); }
.checks .row { padding: 7px 0; }
.ord { display: grid; grid-template-columns: 34px 1fr auto; gap: 2px 8px; font-size: 13px; font-variant-numeric: tabular-nums; }
.ord .h { color: var(--hint); font-size: 12px; }
.lbl-w { color: var(--ok); } .lbl-s { color: #d08700; } .lbl-r { color: var(--hint); }

/* ro'yxatlar */
.item { display: flex; gap: 12px; align-items: center; background: var(--card); border-radius: var(--r); padding: 12px; margin-bottom: 8px; box-shadow: var(--shadow); width: 100%; text-align: left; }
.item .ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--soft); color: var(--accent); }
.item .ic.win { background: #f5b30122; color: #e29a00; }
.item .grow { flex: 1; min-width: 0; }
.item.fair .muted { display: block; }
.item .grow b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--bg2); color: var(--hint); white-space: nowrap; }
.pill.active { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.pill.finished { background: #f5b30122; color: #c98400; }
.pill.canceled { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.empty { text-align: center; color: var(--hint); padding: 40px 10px; }
.empty svg.i { width: 46px; height: 46px; stroke-width: 1.5; opacity: .6; }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
.tile { background: var(--card); border-radius: 14px; padding: 12px; box-shadow: var(--shadow); }
.tile b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.tile span { font-size: 12px; color: var(--hint); }
svg.chart { width: 100%; height: 150px; display: block; }
svg.chart .bar { fill: var(--btn); }
svg.chart .bar.z { fill: var(--line); }
svg.chart text { fill: var(--hint); font-size: 10px; }
svg.chart .v { fill: var(--text); font-size: 10px; font-weight: 600; }
.actions { display: grid; gap: 8px; }

.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: rgba(20, 22, 28, .92); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; transition: .25s; z-index: 20; max-width: 90vw; text-align: center; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; }
.err { text-align: center; padding: 30vh 10px 0; color: var(--hint); }
.err b { display: block; color: var(--text); font-size: 17px; margin-bottom: 6px; }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01s !important; transition-duration: .01s !important; } }

/* taklif / boost / manbalar */
.card h3 .cnt.big { font-size: 20px; font-weight: 800; color: var(--text); }
.inv-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 10px; }
.inv-stats div { background: var(--bg2); border-radius: 12px; padding: 10px; text-align: center; }
.inv-stats b { display: block; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.inv-stats span { font-size: 12px; color: var(--hint); }
.inv-link { margin-bottom: 10px; user-select: all; }
.inv-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.inv-btns .btn { width: 100%; }
.btn.ghost { background: var(--bg2); }
.src { padding: 8px 0; }
.src + .src { border-top: 1px solid var(--line); }
.src.tap { cursor: pointer; }
.src-h { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; min-width: 0; }
.src-h b { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.src-h .n { color: var(--hint); font-size: 13px; font-variant-numeric: tabular-nums; }
.src-h .ic svg.i { width: 16px; height: 16px; }

/* 📷 foto galereya */
.pgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 12px 0 90px; }
.pcard { background: var(--card); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.pimg { aspect-ratio: 1 / 1; background: var(--bg2); display: grid; place-items: center; overflow: hidden; }
.pimg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pmeta { padding: 8px 10px 4px; font-size: 13px; display: flex; flex-direction: column; gap: 2px; min-height: 38px; }
.pmeta b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pmeta .muted { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vbtn { margin: 6px 10px 10px; padding: 8px 0; border-radius: 12px; background: var(--bg2); font-weight: 600; font-size: 15px; transition: transform .12s, background .2s; }
.vbtn.on { background: color-mix(in srgb, var(--danger) 18%, transparent); }
.vbtn.mine { opacity: .55; }
.vbtn:active { transform: scale(.95); }
.upl { margin-top: 10px; cursor: pointer; }
.upl.busy { opacity: .6; pointer-events: none; }

/* ═════ D: to'liq boshqaruv — tab-bar, formalar ═════ */
body.has-tabbar #app { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around; gap: 2px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
.tabbar button { flex: 1; max-width: 110px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 12px;
  color: var(--hint); font-size: 11px; font-weight: 600; transition: color .15s, background .15s; }
.tabbar button svg.i { width: 22px; height: 22px; }
.tabbar button.on { color: var(--btn); background: var(--soft); }
body.has-tabbar .dock { bottom: calc(58px + env(safe-area-inset-bottom)); }
.ptitle { margin: 4px 2px 12px; }
.ptitle h1 { margin: 0; font-size: 24px; line-height: 1.2; }
.field { display: block; margin: 10px 0 4px; }
.field .fl { display: block; font-size: 13px; color: var(--hint); margin-bottom: 6px; font-weight: 600; }
.field .fh { display: block; font-size: 12px; color: var(--hint); margin-top: 4px; }
.inp { width: 100%; font: inherit; color: inherit; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; outline: none; }
.inp:focus { border-color: var(--btn); }
textarea.inp { resize: vertical; min-height: 90px; line-height: 1.4; }
select.inp { appearance: none; -webkit-appearance: none; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { padding: 8px 12px; border-radius: 10px; background: var(--bg2); font-weight: 600; font-size: 14px; color: var(--text); }
.seg button.on { background: var(--btn); color: var(--btn-text); }
.seg button:disabled { opacity: .45; }
.seg.seg-top { background: var(--card); padding: 4px; border-radius: 12px; box-shadow: var(--shadow); margin-bottom: 12px; flex-wrap: nowrap; overflow-x: auto; }
.seg.seg-top button { flex: 1; white-space: nowrap; background: none; color: var(--hint); }
.seg.seg-top button.on { background: var(--btn); color: var(--btn-text); }
.tgl { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; cursor: pointer; }
.tgl + .tgl { border-top: 1px solid var(--line); }
.tgl input { display: none; }
.tgl i { flex: none; width: 46px; height: 28px; border-radius: 99px; background: var(--bg2); border: 1px solid var(--line); position: relative; transition: background .2s; }
.tgl i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #0003; transition: transform .2s; }
.tgl input:checked + i { background: var(--ok); border-color: var(--ok); }
.tgl input:checked + i::after { transform: translateX(18px); }
.pick { display: grid; gap: 6px; margin-top: 8px; }
.pk { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px; background: var(--bg2); text-align: left; width: 100%; border: 2px solid transparent; }
.pk .ava, .chc .ava { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; flex: none; font-size: 13px;
  background: linear-gradient(135deg, #5b8cff, #8f6bff); }
.pk .grow { flex: 1; min-width: 0; }
.pk .grow b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk .st { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); flex: none; }
.pk.on { border-color: var(--btn); }
.pk.on .st { background: var(--btn); border-color: var(--btn); box-shadow: inset 0 0 0 4px var(--bg2); }
.stepper { display: flex; gap: 8px; align-items: center; }
.stepper button { width: 46px; height: 46px; border-radius: 12px; background: var(--bg2); font-size: 22px; font-weight: 700; }
.stepper .inp { text-align: center; font-size: 18px; font-weight: 700; }
.row2 { display: flex; gap: 8px; margin-top: 8px; }
.row2 > * { flex: 1; }
.inrow { display: flex; gap: 8px; margin-top: 8px; }
.inrow .inp { flex: 1; min-width: 0; }
.card.warn, .muted.warn { color: #c98400; }
.fcard { display: block; width: 100%; text-align: left; background: var(--card); border-radius: 18px; padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow);
  position: relative; overflow: hidden; }
.fcard::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: linear-gradient(#ffd66b, #f4b23c); }
.fc-top { display: flex; gap: 6px; margin-bottom: 6px; }
.tag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--bg2); color: var(--hint); }
.tag.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.tag.own { background: var(--soft); color: var(--accent); }
.fc-t { display: block; font-size: 16px; line-height: 1.3; margin-bottom: 4px; }
.fc-p { font-size: 13px; margin-bottom: 4px; color: #c98400; }
.grid { display: grid; gap: 6px; }
.grow-row { display: flex; gap: 6px; }
.gbtn { flex: 1; min-width: 0; padding: 10px 6px; border-radius: 10px; background: var(--bg2); font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gbtn.success { background: #22a35a; color: #fff; } .gbtn.primary { background: #2a7de1; color: #fff; } .gbtn.danger { background: #e5484d; color: #fff; }
.gbtn.add { flex: 0 0 44px; color: var(--btn); }
.sheet { position: fixed; inset: 0; z-index: 50; background: #0007; display: flex; align-items: flex-end; justify-content: center; }
.sheet-in { width: 100%; max-width: 560px; margin: 0; border-radius: 20px 20px 0 0; padding-bottom: calc(16px + env(safe-area-inset-bottom)); display: grid; gap: 8px; animation: up .2s; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
.chips.scroll .chip { white-space: nowrap; font-weight: 600; }
.chips.scroll .chip.on { background: var(--btn); color: var(--btn-text); }
.kv2 { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; font-size: 14px; }
.kv2 + .kv2 { border-top: 1px solid var(--line); }
.kv2 span { color: var(--hint); }
.acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.acts .btn { padding: 11px 8px; font-size: 13px; background: var(--bg2); }
.acts .btn.solid { background: var(--btn); }
.acts .btn.danger { background: color-mix(in srgb, var(--danger) 13%, transparent); }
.row.tap { cursor: pointer; }
.tno { font-weight: 700; font-variant-numeric: tabular-nums; }

.sheet-in { max-height: 88vh; overflow-y: auto; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; white-space: pre-wrap; word-break: break-word; }
.small { font-size: 12px; line-height: 1.4; }
.ds-err { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.bnimg { margin: 6px 0 10px; border-radius: 12px; overflow: hidden; background: var(--bg2); min-height: 40px; display: flex; align-items: center; justify-content: center; }
.bnimg img { width: 100%; display: block; max-height: 260px; object-fit: cover; }
.mbox { display: grid; gap: 8px; margin-top: 8px; }
.upl.busy { opacity: .55; pointer-events: none; }
.sheet-in { overflow-x: hidden; grid-template-columns: minmax(0, 1fr); }
.sheet-in > * { min-width: 0; }
.sheet-in .row2 { flex-wrap: wrap; }
.sheet-in .row2 > .btn { min-width: 40%; }
.card > .row2 > .upl { margin-top: 0; display: flex; align-items: center; justify-content: center; }
.row2 > .upl { margin-top: 0; display: flex; align-items: center; justify-content: center; }
.mbox .row2 { flex-wrap: wrap; }
.mbox .row2 > * { min-width: 45%; white-space: normal; }
