/* Shop Mini App — "Night Cloud": ink ground, one blue for buying, one red for live events. */
:root {
  --bg: #0B0F14;
  --bar: #0E131A;
  --surface: #131A22;
  --surface-2: #1A2330;
  --deep: #0F141B;
  --line: #1E2733;
  --line-2: #243041;
  --dash: #2A3645;
  --text: #EEF2F6;
  --text-2: #D5DCE4;
  --muted: #9AA7B6;
  --faint: #8793A3;
  --icon: #5B6879;
  --blue: #2D6BE4;
  --blue-text: #6FA3FF;
  --blue-tint: #15213A;
  --blue-sel: #132038;
  --red: #CC2F3A;
  --red-text: #FF8A91;
  --red-tint: #17121A;
  --red-line: #3A1F2A;
  --green: #3DD68C;
  --green-tint: #12291F;
  --green-line: #1F4A36;
  --radius: 18px;
  --display: 'Unbounded', 'Manrope', system-ui, sans-serif;
  --body: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
a { color: var(--blue-text); text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
input::placeholder, textarea::placeholder { color: var(--faint); }
[hidden] { display: none !important; }
svg { flex-shrink: 0; }

.view { min-height: 100vh; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.view.no-tabs { padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
.view.with-main { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
.screen { display: flex; flex-direction: column; gap: 18px; padding: 20px 16px 8px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }

/* ── type ── */
.hdr { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.h1 { margin: 0; font-family: var(--display); font-size: 24px; font-weight: 600; line-height: 30px; letter-spacing: -0.02em; }
.h2 { margin: 0; font-family: var(--display); font-size: 20px; font-weight: 600; line-height: 26px; letter-spacing: -0.01em; }
.sub { margin: 0; font-size: 13px; line-height: 18px; color: var(--muted); }
.sec { margin: 0; font-size: 12px; font-weight: 800; line-height: 16px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.sec-head span { font-size: 12px; color: var(--faint); }
.muted { color: var(--muted); }
.small { font-size: 12px; line-height: 16px; }
.price { font-family: var(--display); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: var(--mono); }
.center { text-align: center; }

/* ── controls ── */
.pill {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px 0 12px;
  border-radius: 22px; background: var(--surface); border: 1px solid var(--line-2);
  color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; flex-shrink: 0;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border: 0; border-radius: 14px;
  background: var(--blue); color: #fff; font-size: 15px; font-weight: 700;
}
.btn.wide { width: 100%; min-height: 52px; font-size: 16px; }
.btn.ghost { background: var(--surface-2); color: var(--text); }
.btn.line { background: transparent; border: 1px solid var(--dash); color: var(--text); }
.btn.red { background: var(--red); }
.btn.sm { min-height: 44px; padding: 0 14px; border-radius: 12px; font-size: 13px; }
.btn:disabled, .btn.off { opacity: .45; pointer-events: none; }
.btn:active { transform: scale(.98); }
.iconbtn {
  width: 44px; height: 44px; border: 0; border-radius: 12px; background: var(--surface-2);
  color: var(--text); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.iconbtn:disabled { opacity: .4; }
.back {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; height: 40px;
  padding: 0 8px 0 0; border: 0; background: none; color: var(--muted); font-size: 14px; font-weight: 600;
}
.search {
  display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 16px;
  border-radius: 16px; background: var(--surface); border: 1px solid var(--blue); color: var(--blue-text);
}
.search input {
  flex: 1; min-width: 0; height: 48px; border: 0; outline: none; background: transparent; color: var(--text); font-size: 16px;
}
.search input::-webkit-search-cancel-button { filter: invert(.7); }
.input {
  width: 100%; height: 48px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--text); font-size: 16px; outline: none;
}
.input:focus, textarea.input:focus { border-color: var(--blue); }
textarea.input { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; line-height: 1.4; }
.inline { display: flex; gap: 8px; }
.inline .input { flex: 1; min-width: 0; }

/* ── surfaces ── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card.pad { padding: 16px; }
.card.deep { background: var(--deep); }
.card.live { background: var(--red-tint); border-color: var(--red-line); }
.card.ok { background: var(--green-tint); border-color: var(--green-line); }
.list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 10px 12px 10px 14px;
  color: var(--text); border: 0; border-top: 1px solid var(--line); background: none; width: 100%; text-align: left;
}
.row:first-child { border-top: 0; }
.row .grow { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.row .t { font-size: 15px; font-weight: 700; line-height: 20px; overflow-wrap: anywhere; }
.row .s { font-size: 12px; line-height: 16px; color: var(--muted); }
.row.off .t { color: var(--muted); }
.row:active { background: var(--deep); }
.chev { color: var(--icon); }

.tile {
  width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); color: #C9D3DE;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  font-family: var(--display); font-size: 11px; font-weight: 600; letter-spacing: .02em;
}
.tile.emoji { font-family: var(--body); font-size: 20px; }
.tile.blue { background: var(--blue-tint); color: var(--blue-text); }
.tile.big { width: 56px; height: 56px; border-radius: 16px; font-size: 15px; }
.tile.big.emoji { font-size: 26px; }
.tile.pic { overflow: hidden; }
.tile.pic img { display: block; }
.tile.pic.ph img { width: 100%; height: 100%; object-fit: cover; }
.tile.pic.em img { width: 72%; height: 72%; object-fit: contain; }
/* Premium emoji inside text: a picture the size of a letter. */
.ce { display: inline-block; width: 1.2em; height: 1.2em; margin: 0 .05em; vertical-align: -0.22em; line-height: 1; }
.ce img { display: block; width: 100%; height: 100%; object-fit: contain; }
.ce.emoji { width: auto; height: auto; margin: 0; vertical-align: baseline; }
.chip-ic { display: inline-flex; width: 16px; height: 16px; align-items: center; justify-content: center; }
.chip-ic img { width: 16px; height: 16px; object-fit: contain; }

.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ptile {
  display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); color: var(--text); min-width: 0;
}
.ptile .t { font-size: 15px; font-weight: 700; line-height: 20px; overflow-wrap: anywhere; }
.ptile .s { font-size: 12px; color: var(--muted); }

.badge {
  display: inline-flex; align-items: center; height: 18px; padding: 0 7px; border-radius: 9px;
  font-size: 10px; font-weight: 800; line-height: 18px; letter-spacing: .04em; text-transform: uppercase; vertical-align: middle;
}
.badge.new { background: var(--green-tint); color: var(--green); }
.badge.sale { background: var(--red-tint); color: var(--red-text); border: 1px solid var(--red-line); }
.badge.me { background: var(--green-tint); color: var(--green); }
.chip-live {
  display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 12px; border-radius: 14px;
  background: var(--red); color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
}
.chip-live::before { content: ""; width: 6px; height: 6px; border-radius: 3px; background: #fff; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 14px;
  background: var(--blue-tint); color: var(--blue-text); font-size: 12px; font-weight: 700; align-self: flex-start;
}
.stock { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--green); }
.stock::before { content: ""; width: 6px; height: 6px; border-radius: 3px; background: currentColor; }
.stock.out { color: var(--faint); }
.stock.out::before { display: none; }

/* ── product & checkout ── */
.photo { width: 100%; max-height: 260px; object-fit: cover; border-radius: var(--radius); background: var(--surface); display: block; }
.desc { font-size: 14px; line-height: 21px; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.desc blockquote { margin: 6px 0; padding: 8px 12px; border-radius: 12px; background: var(--deep); }
.desc pre, .desc code { font-family: var(--mono); font-size: 13px; }
.desc pre { margin: 6px 0; padding: 10px 12px; border-radius: 12px; background: var(--deep); overflow-x: auto; }
.desc .spoiler { filter: blur(5px); transition: filter .2s; cursor: pointer; }
.desc .spoiler.shown { filter: none; }
.tiers { display: flex; flex-direction: column; gap: 4px; }
.tiers div { display: flex; justify-content: space-between; font-size: 14px; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper .n { min-width: 44px; text-align: center; font-family: var(--display); font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.opt {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 10px 14px 10px 10px;
  border-radius: 16px; border: 1.5px solid var(--line); background: var(--surface); color: var(--text); text-align: left;
}
.opt.on { border-color: var(--blue); background: var(--blue-sel); }
.opt .grow { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.opt .t { font-size: 15px; font-weight: 700; line-height: 20px; }
.opt .s { font-size: 12px; color: var(--muted); }
.radio { width: 20px; height: 20px; border-radius: 10px; border: 2px solid #3A4758; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.opt.on .radio { border-color: var(--blue-text); }
.opt.on .radio::after { content: ""; width: 10px; height: 10px; border-radius: 5px; background: var(--blue-text); }
.totals { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.totals .l { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--muted); }
.totals .l b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.totals .l.good b { color: var(--green); }
.totals .sum { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.totals .sum span { font-size: 15px; font-weight: 700; }
.totals .sum .price { font-size: 20px; }
.warn { padding: 12px 14px; border-radius: 14px; background: var(--red-tint); border: 1px solid var(--red-line); color: var(--red-text); font-size: 13px; line-height: 18px; }
.info { padding: 12px 14px; border-radius: 14px; background: var(--deep); border: 1px solid var(--line); color: var(--muted); font-size: 13px; line-height: 18px; display: flex; gap: 10px; align-items: flex-start; }
.terms { margin: 0; font-size: 12px; line-height: 17px; color: var(--faint); }

/* ── order ── */
.hero { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding-top: 12px; }
.hero .ring { width: 72px; height: 72px; border-radius: 36px; display: flex; align-items: center; justify-content: center; }
.hero .ring.ok { background: var(--green-tint); border: 1px solid var(--green-line); color: var(--green); }
.hero .ring.wait { background: var(--blue-tint); border: 1px solid #22355A; color: var(--blue-text); }
.hero .ring.bad { background: var(--surface); border: 1px solid var(--line-2); color: var(--muted); }
.unit { display: flex; flex-direction: column; gap: 8px; padding: 12px 12px 12px 14px; }
.unit + .unit { border-top: 1px solid var(--line); }
.unit .head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.unit pre {
  margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--deep); border: 1px solid var(--line);
  font-family: var(--mono); font-size: 13px; line-height: 19px; white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; -webkit-user-select: text;
}
.unit .file { display: flex; align-items: center; gap: 12px; }
.spin { width: 28px; height: 28px; border-radius: 14px; border: 3px solid var(--blue-tint); border-top-color: var(--blue-text); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── profile ── */
.avatar { width: 56px; height: 56px; border-radius: 28px; background: var(--surface-2); color: #C9D3DE; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-size: 20px; font-weight: 600; flex-shrink: 0; }
.balance { display: flex; flex-direction: column; gap: 16px; padding: 18px; }
.balance .price { font-size: 32px; line-height: 40px; letter-spacing: -0.02em; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stats div { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: 16px; background: var(--deep); border: 1px solid #1A222C; min-width: 0; }
.stats b { font-family: var(--display); font-size: 16px; font-weight: 600; line-height: 22px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stats span { font-size: 12px; color: var(--muted); }
.reflink { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 14px; border-radius: 14px; background: var(--deep); border: 1px solid var(--line); }
.reflink code { flex: 1; min-width: 0; font-family: var(--mono); font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.chips button { min-height: 44px; border-radius: 12px; border: 1px solid var(--line-2); background: transparent; color: var(--text); font-weight: 700; font-size: 14px; }
.chips button.on { border-color: var(--blue); background: var(--blue-sel); color: var(--blue-text); }

/* ── events ── */
.count { font-family: var(--display); font-size: 40px; font-weight: 600; line-height: 48px; color: var(--red-text); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.lot { display: flex; flex-direction: column; gap: 14px; padding: 16px; }
.lot .split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.lot .split b { display: block; font-family: var(--display); font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.lot .split .mono { font-size: 16px; font-weight: 600; }
.bids { display: flex; flex-direction: column; }
.bids div { display: flex; align-items: center; gap: 10px; min-height: 40px; border-top: 1px solid var(--line); font-size: 14px; }
.bids div:first-child { border-top: 0; }
.bids .who { font-family: var(--mono); font-weight: 600; }
.bids .when { flex: 1; text-align: right; font-size: 12px; color: var(--faint); }
.bids .amt { min-width: 70px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 14px; }
.steps li { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 20px; }
.steps .num { width: 28px; height: 28px; border-radius: 14px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; flex-shrink: 0; }
.steps b { display: block; }
.steps span { color: var(--muted); }
.tickets { font-family: var(--display); font-size: 48px; font-weight: 600; line-height: 56px; color: var(--red-text); }

/* ── chrome ── */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; gap: 4px;
  padding: 8px 8px calc(12px + env(safe-area-inset-bottom)); background: var(--bar); border-top: 1px solid var(--line);
}
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 52px; color: var(--faint); font-size: 11px; font-weight: 600; }
.tabs a .ic { display: flex; align-items: center; justify-content: center; width: 56px; height: 28px; border-radius: 14px; }
.tabs a.on { color: var(--blue-text); font-weight: 700; }
.tabs a.on .ic { background: var(--blue-tint); }
.fallback-main { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; padding: 10px 16px calc(14px + env(safe-area-inset-bottom)); background: var(--bar); border-top: 1px solid var(--line); }
.fallback-main .btn { width: 100%; min-height: 52px; }
.toast {
  position: fixed; left: 16px; right: 16px; top: calc(12px + env(safe-area-inset-top)); z-index: 60;
  padding: 12px 16px; border-radius: 14px; background: #1F2A38; border: 1px solid var(--line-2); color: var(--text);
  font-size: 14px; line-height: 19px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.4);
}
.toast.bad { background: #2A1519; border-color: var(--red-line); color: #FFD0D3; }
.toast.good { background: var(--green-tint); border-color: var(--green-line); color: #C9F5DE; }
.backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(3,5,8,.62); }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; max-height: 86vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px; padding: 10px 16px calc(20px + env(safe-area-inset-bottom));
  background: #121820; border-top: 1px solid var(--line-2); border-radius: 24px 24px 0 0;
}
.sheet .grab { align-self: center; width: 40px; height: 4px; border-radius: 2px; background: var(--dash); }
.empty { padding: 28px 16px; border-radius: var(--radius); border: 1px dashed var(--dash); text-align: center; color: var(--muted); font-size: 14px; line-height: 20px; }
.sk { border-radius: var(--radius); background: linear-gradient(90deg, var(--surface) 0%, #18202A 50%, var(--surface) 100%); background-size: 200% 100%; animation: sk 1.2s ease-in-out infinite; }
@keyframes sk { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.fatal { min-height: 90vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center; }
