/* StarsBot — панель управления (Telegram Mini App). Без внешних ресурсов, без инлайн-стилей. */

:root {
  --fb-bg: #f2f2f7;
  --fb-card: #ffffff;
  --fb-text: #111114;
  --fb-hint: #7c7c85;
  --fb-link: #2a7de1;
  --fb-btn: #2f80ed;
  --fb-btn-text: #ffffff;
  --fb-danger: #d92d3a;
  --sep: rgba(0, 0, 0, 0.08);
  --soft: rgba(0, 0, 0, 0.045);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 6px 18px rgba(20, 20, 40, 0.05);
  --star-grad: linear-gradient(135deg, #ffd34e 0%, #ffab1a 55%, #ff8a1c 100%);
  --star-ink: #2b1900;
  --star-text: linear-gradient(135deg, #e69500 0%, #c2570a 100%);
  --tg-grad: linear-gradient(135deg, #8b5cf6 0%, #5b7cfa 100%);
  --glow: rgba(255, 171, 26, 0.28);

  --green: #1f9d55; --green-bg: rgba(31, 157, 85, 0.13);
  --amber: #b45f06; --amber-bg: rgba(245, 158, 11, 0.17);
  --red: #d92d3a; --red-bg: rgba(217, 45, 58, 0.12);
  --blue: #2563eb; --blue-bg: rgba(37, 99, 235, 0.12);
  --indigo: #5b46d6; --indigo-bg: rgba(99, 76, 240, 0.13);
  --teal: #0f8a8a; --teal-bg: rgba(15, 138, 138, 0.13);
  --gray: #6b6b75; --gray-bg: rgba(110, 110, 125, 0.14);

  --bg: var(--tg-theme-secondary-bg-color, var(--fb-bg));
  --card: var(--tg-theme-section-bg-color, var(--fb-card));
  --text: var(--tg-theme-text-color, var(--fb-text));
  --hint: var(--tg-theme-hint-color, var(--fb-hint));
  --link: var(--tg-theme-link-color, var(--fb-link));
  --btn: var(--tg-theme-button-color, var(--fb-btn));
  --btn-text: var(--tg-theme-button-text-color, var(--fb-btn-text));
  --danger: var(--tg-theme-destructive-text-color, var(--fb-danger));

  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  --sa-top: calc(max(env(safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px)) + var(--tg-content-safe-area-inset-top, 0px));
  --sa-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --tab-h: 62px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --fb-bg: #141416;
  --fb-card: #202024;
  --fb-text: #f3f3f6;
  --fb-hint: #9a9aa5;
  --fb-link: #6ab3f3;
  --fb-btn: #3d8bfd;
  --fb-danger: #ff6b73;
  --sep: rgba(255, 255, 255, 0.09);
  --soft: rgba(255, 255, 255, 0.06);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 22px rgba(0, 0, 0, 0.28);
  --star-text: linear-gradient(135deg, #ffd34e 0%, #ff9f1c 100%);
  --glow: rgba(255, 171, 26, 0.18);
  --green: #4cd488; --green-bg: rgba(76, 212, 136, 0.15);
  --amber: #ffbf4d; --amber-bg: rgba(255, 191, 77, 0.16);
  --red: #ff7a84; --red-bg: rgba(255, 122, 132, 0.15);
  --blue: #6aa6ff; --blue-bg: rgba(106, 166, 255, 0.16);
  --indigo: #a393ff; --indigo-bg: rgba(163, 147, 255, 0.17);
  --teal: #4fd1d1; --teal-bg: rgba(79, 209, 209, 0.15);
  --gray: #a4a4b0; --gray-bg: rgba(164, 164, 176, 0.15);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--link); text-decoration: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- каркас ---------- */
.app { max-width: 640px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
#view { flex: 1; padding: calc(var(--sa-top) + 6px) 16px calc(var(--tab-h) + var(--sa-bottom) + 28px); }
.screen { animation: enter 0.26s var(--ease) both; }
.screen > * + * { margin-top: 14px; }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 2px 2px; }
.page-head h1 { font-size: 30px; line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; }
.page-head .sub { color: var(--hint); font-size: 14px; margin-top: 2px; }
.section-title { font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--hint); padding: 8px 6px 0; }
.muted { color: var(--hint); }
.small { font-size: 13px; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }

.card { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 16px; position: relative; }
.card.flush { padding: 0; overflow: hidden; }
.card h2 { font-size: 17px; font-weight: 700; }
.card > * + * { margin-top: 12px; }
.card.flush > * + * { margin-top: 0; }

/* ---------- таб-бар ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: center;
  background: var(--card);
  background: color-mix(in srgb, var(--card) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(18px); backdrop-filter: saturate(1.6) blur(18px);
  border-top: 1px solid var(--sep);
  padding-bottom: var(--sa-bottom);
}
.tabbar nav { display: flex; width: 100%; max-width: 640px; }
.tab {
  flex: 1; min-height: var(--tab-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--hint); font-size: 11px; font-weight: 600; position: relative; transition: color 0.2s;
}
.tab svg { width: 25px; height: 25px; transition: transform 0.25s var(--ease); }
.tab.active { color: var(--btn); }
.tab.active svg { transform: translateY(-1px) scale(1.08); }
.tab .badge { position: absolute; top: 7px; left: calc(50% + 6px); }
.badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; line-height: 1;
}
body.kbd .tabbar { display: none; }
body.kbd #view { padding-bottom: 40vh; }

/* ---------- кнопки ---------- */
.btn {
  appearance: none; border: 0; cursor: pointer; min-height: 46px; padding: 0 18px; border-radius: 14px;
  background: var(--soft); color: var(--text); font-weight: 600; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-align: center; line-height: 1.2;
  transition: transform 0.12s var(--ease), opacity 0.2s, background 0.2s; position: relative; user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled, .btn[aria-busy="true"] { opacity: 0.55; pointer-events: none; }
.btn.primary { background: var(--btn); color: var(--btn-text); }
.btn.gold { background: var(--star-grad); color: var(--star-ink); box-shadow: 0 6px 18px var(--glow); }
.btn.tg { background: var(--tg-grad); color: #fff; }
.btn.danger { background: var(--red-bg); color: var(--danger); }
.btn.danger.solid { background: var(--danger); color: #fff; }
.btn.ghost { background: transparent; color: var(--link); }
.btn.block { display: flex; width: 100%; }
.btn.sm { min-height: 44px; padding: 0 14px; font-size: 15px; border-radius: 12px; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-row > .btn { flex: 1 1 140px; }
.icon-btn {
  appearance: none; border: 0; background: var(--card); color: var(--text); width: 44px; height: 44px; border-radius: 14px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; box-shadow: var(--shadow); flex: none; transition: transform 0.12s var(--ease);
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn[aria-busy="true"] svg { animation: spin 0.9s linear infinite; }
.icon-btn svg { width: 22px; height: 22px; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- чипы ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 650; line-height: 1.5; white-space: nowrap; background: var(--gray-bg); color: var(--gray); }
.chip.c-green { background: var(--green-bg); color: var(--green); }
.chip.c-amber { background: var(--amber-bg); color: var(--amber); }
.chip.c-red { background: var(--red-bg); color: var(--red); }
.chip.c-blue { background: var(--blue-bg); color: var(--blue); }
.chip.c-indigo { background: var(--indigo-bg); color: var(--indigo); }
.chip.c-teal { background: var(--teal-bg); color: var(--teal); }
.chip.pulse::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.35; transform: scale(0.7); } }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--gray); flex: none; }
.dot.ok { background: var(--green); box-shadow: 0 0 0 4px var(--green-bg); }
.dot.bad { background: var(--red); box-shadow: 0 0 0 4px var(--red-bg); }
.dot.off { background: var(--gray); }

/* ---------- сегменты ---------- */
.seg { display: flex; background: var(--soft); border-radius: 14px; padding: 3px; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button {
  flex: 1 0 auto; min-height: 40px; padding: 0 12px; border: 0; background: transparent; border-radius: 11px; font-weight: 600; font-size: 14.5px; color: var(--hint); cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s; white-space: nowrap;
}
.seg button[aria-selected="true"] { background: var(--card); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.14); }

/* ---------- формы ---------- */
.field > label, .label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; color: var(--hint); }
.input, .textarea {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 14px; border: 1.5px solid transparent; background: var(--soft); color: var(--text);
  font-size: 16px; outline: none; transition: border-color 0.2s, background 0.2s; appearance: none;
}
.textarea { resize: vertical; min-height: 110px; line-height: 1.45; }
.input:focus, .textarea:focus { border-color: var(--btn); background: var(--card); }
.input.invalid, .textarea.invalid { border-color: var(--danger); }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 52px; }
.input-wrap .toggle-eye { position: absolute; right: 2px; top: 2px; width: 44px; height: 44px; border: 0; background: transparent; color: var(--hint); display: flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 12px; }
.toggle-eye svg { width: 22px; height: 22px; }
.field-error { color: var(--danger); font-size: 13.5px; margin-top: 6px; }
.hint { color: var(--hint); font-size: 13.5px; margin-top: 6px; }
.code-input { text-align: center; letter-spacing: 0.35em; font-size: 24px; font-weight: 700; }
details.fold { border-radius: 14px; background: var(--soft); }
details.fold summary { min-height: 44px; padding: 0 14px; display: flex; align-items: center; cursor: pointer; font-weight: 600; font-size: 14.5px; color: var(--hint); list-style: none; }
details.fold summary::-webkit-details-marker { display: none; }
details.fold[open] summary { color: var(--text); }
details.fold .fold-body { padding: 0 12px 12px; }
.ph-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ph-chip { min-height: 36px; padding: 0 12px; border-radius: 10px; border: 1px dashed var(--sep); background: var(--soft); color: var(--link); font-weight: 600; font-size: 14px; cursor: pointer; font-family: ui-monospace, Menlo, Consolas, monospace; }
.preview { background: var(--soft); border-radius: 14px; padding: 12px 14px; font-size: 15px; }
.preview .label { margin-bottom: 4px; }

/* ---------- сообщения ---------- */
.alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--r-md); font-size: 14.5px; line-height: 1.4; background: var(--blue-bg); color: var(--text); }
.alert > svg { width: 22px; height: 22px; flex: none; margin-top: 1px; }
.alert.warn { background: var(--amber-bg); }
.alert.warn > svg { color: var(--amber); }
.alert.err { background: var(--red-bg); }
.alert.err > svg { color: var(--red); }
.alert.info > svg { color: var(--blue); }
.alert .alert-body > * + * { margin-top: 8px; }
.alert .alert-body a { font-weight: 600; }
.alert-stack > * + * { margin-top: 10px; }

/* ---------- главная ---------- */
.hero { border-radius: var(--r-lg); padding: 18px; background: var(--card); box-shadow: var(--shadow); position: relative; overflow: hidden; transition: background 0.4s; }
.hero.on { background: var(--star-grad); color: var(--star-ink); box-shadow: 0 10px 30px var(--glow); }
.hero.on::after { content: "★"; position: absolute; right: -14px; top: -34px; font-size: 150px; opacity: 0.14; transform: rotate(14deg); pointer-events: none; }
.hero .row { position: relative; z-index: 1; }
.hero h2 { font-size: 21px; font-weight: 800; letter-spacing: -0.01em; }
.hero .state { font-size: 14.5px; opacity: 0.8; margin-top: 2px; }
.hero:not(.on) .state { color: var(--hint); opacity: 1; }
.switch {
  appearance: none; border: 0; padding: 0; cursor: pointer; width: 68px; height: 40px; border-radius: 20px; flex: none; position: relative;
  background: rgba(120, 120, 135, 0.35); transition: background 0.3s var(--ease);
}
.hero.on .switch { background: rgba(43, 25, 0, 0.82); }
.switch .knob {
  position: absolute; top: 3px; left: 3px; width: 34px; height: 34px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  display: flex; align-items: center; justify-content: center; color: #b9b9c4; transition: transform 0.3s var(--ease), color 0.3s; font-size: 17px;
}
.switch[aria-checked="true"] .knob { transform: translateX(28px); color: #ff9f1c; }
.switch[aria-busy="true"] .knob { animation: pulse 0.9s ease-in-out infinite; }
.switch:disabled { opacity: 0.7; }
.hero .meta { margin-top: 14px; font-size: 13.5px; display: flex; flex-wrap: wrap; gap: 6px 14px; position: relative; z-index: 1; }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 380px) { .pair { grid-template-columns: 1fr; } }
.acc-tile { padding: 14px; display: flex; flex-direction: column; gap: 8px; min-height: 108px; }
.acc-tile .ico { width: 36px; height: 36px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: #fff; }
.acc-tile .ico.fp { background: var(--star-grad); color: var(--star-ink); }
.acc-tile .ico.tg { background: var(--tg-grad); }
.acc-tile .ico svg { width: 20px; height: 20px; }
.acc-tile .name { font-weight: 700; }
.acc-tile .who { font-size: 13.5px; color: var(--hint); }

.balance { overflow: hidden; }
.balance::before { content: ""; position: absolute; inset: -40% -10% auto auto; width: 200px; height: 200px; background: radial-gradient(circle, var(--glow), transparent 65%); pointer-events: none; }
.balance .num { font-size: 40px; font-weight: 850; letter-spacing: -0.03em; line-height: 1.1; background: var(--star-text); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; font-variant-numeric: tabular-nums; }
.balance.low .num { background: none; -webkit-text-fill-color: var(--red); color: var(--red); }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tile { text-decoration: none; color: inherit; padding: 14px 16px; display: block; transition: transform 0.12s var(--ease); }
.tile:active { transform: scale(0.97); }
.tile .n { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile .t { font-size: 13.5px; color: var(--hint); margin-top: 2px; }
.tile.hot .n { color: var(--red); }

.check-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 56px; }
.check-item + .check-item { border-top: 1px solid var(--sep); }
.check-mark { width: 26px; height: 26px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; background: var(--soft); color: transparent; border: 2px solid var(--sep); }
.check-mark svg { width: 15px; height: 15px; }
.check-item.done .check-mark { background: var(--green); border-color: var(--green); color: #fff; }
.check-item.done .grow { color: var(--hint); text-decoration: line-through; }

/* ---------- списки ---------- */
.list-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; min-height: 60px; color: inherit; text-decoration: none; transition: background 0.15s; cursor: pointer; width: 100%; background: transparent; border: 0; text-align: left; }
.list-row:active { background: var(--soft); }
.list-row + .list-row { border-top: 1px solid var(--sep); }
.list-row .ico { width: 36px; height: 36px; border-radius: 11px; display: flex; align-items: center; justify-content: center; background: var(--blue-bg); color: var(--blue); flex: none; }
.list-row .ico svg { width: 20px; height: 20px; }
.list-row .ico.gold { background: var(--amber-bg); color: var(--amber); }
.list-row .ico.violet { background: var(--indigo-bg); color: var(--indigo); }
.list-row .ico.green { background: var(--green-bg); color: var(--green); }
.list-row .ico.gray { background: var(--gray-bg); color: var(--gray); }
.list-row .chev { width: 18px; height: 18px; color: var(--hint); opacity: 0.6; flex: none; }
.list-row .title { font-weight: 600; }
.list-row .sub { font-size: 13.5px; color: var(--hint); }

.order-card { display: block; padding: 14px 16px; color: inherit; text-decoration: none; transition: transform 0.12s var(--ease); animation: enter 0.3s var(--ease) both; animation-delay: calc(var(--i, 0) * 30ms); }
.order-card:active { transform: scale(0.985); }
.order-card .top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.order-card .oid { font-weight: 750; font-size: 16.5px; letter-spacing: 0.01em; }
.order-card .mid { display: flex; align-items: baseline; gap: 10px; margin-top: 6px; }
.order-card .amt { font-weight: 800; font-size: 19px; font-variant-numeric: tabular-nums; }
.order-card .amt .st { color: #f59f00; }
.order-card .who { color: var(--hint); font-size: 14.5px; min-width: 0; }
.order-card .bot { margin-top: 6px; font-size: 13px; color: var(--hint); display: flex; gap: 8px; justify-content: space-between; }
.order-card .reason { color: var(--amber); }
.list-stack > * + * { margin-top: 10px; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0; font-size: 15px; }
.kv dt { color: var(--hint); }
.kv dd { margin: 0; text-align: right; overflow-wrap: anywhere; font-weight: 500; }

.gift-row { padding: 14px 16px; }
.gift-row + .gift-row { border-top: 1px solid var(--sep); }
.gift-row .emoji { width: 44px; height: 44px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 26px; background: var(--amber-bg); flex: none; }
.gift-row .gname { font-weight: 650; }
.gift-row .err { margin-top: 8px; font-size: 13.5px; color: var(--red); overflow-wrap: anywhere; }
.gift-row .gift-actions { margin-top: 12px; }
.gift-row > .alert { margin-top: 10px; }

.timeline { padding: 6px 16px 10px; }
.tl-item { display: flex; gap: 12px; padding: 10px 0; position: relative; }
.tl-item + .tl-item { border-top: 1px solid var(--sep); }
.tl-ico { width: 32px; height: 32px; border-radius: 10px; flex: none; display: flex; align-items: center; justify-content: center; background: var(--gray-bg); color: var(--gray); }
.tl-ico svg { width: 17px; height: 17px; }
.tl-ico.k-green { background: var(--green-bg); color: var(--green); }
.tl-ico.k-amber { background: var(--amber-bg); color: var(--amber); }
.tl-ico.k-red { background: var(--red-bg); color: var(--red); }
.tl-ico.k-blue { background: var(--blue-bg); color: var(--blue); }
.tl-ico.k-indigo { background: var(--indigo-bg); color: var(--indigo); }
.tl-body { min-width: 0; flex: 1; }
.tl-kind { font-weight: 600; font-size: 14.5px; }
.tl-detail { font-size: 13.5px; color: var(--hint); overflow-wrap: anywhere; white-space: pre-wrap; }
.tl-meta { font-size: 12.5px; color: var(--hint); margin-top: 2px; }

.msg-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.msg-row + .msg-row { border-top: 1px solid var(--sep); }

/* ---------- подарки / планы ---------- */
.gift-edit { padding: 0 16px 16px; }
.gift-edit > * + * { margin-top: 10px; }
.plan { padding: 14px 16px; display: flex; align-items: center; gap: 14px; }
.plan + .plan { border-top: 1px solid var(--sep); }
.plan .amt { font-weight: 850; font-size: 20px; min-width: 64px; font-variant-numeric: tabular-nums; }
.plan .amt .st { color: #f59f00; }
.plan .emojis { font-size: 22px; letter-spacing: 2px; }
.plan .cost { font-size: 13px; color: var(--hint); }

/* ---------- пусто / скелетоны ---------- */
.empty { text-align: center; padding: 44px 24px; color: var(--hint); }
.empty .art { width: 84px; height: 84px; margin: 0 auto 14px; border-radius: 28px; display: flex; align-items: center; justify-content: center; background: var(--star-grad); color: var(--star-ink); box-shadow: 0 10px 26px var(--glow); }
.empty .art svg { width: 42px; height: 42px; }
.empty h3 { color: var(--text); font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.skeleton { border-radius: 10px; background: linear-gradient(100deg, var(--soft) 30%, rgba(128, 128, 140, 0.18) 50%, var(--soft) 70%); background-size: 220% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.sk-line { height: 14px; }
.sk-card { height: 84px; border-radius: var(--r-lg); }
.sk-num { height: 44px; width: 150px; }

/* ---------- toast / modal ---------- */
.toast-host { position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + var(--sa-bottom) + 12px); z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; max-width: 560px; background: #26262c; color: #fff; padding: 12px 16px; border-radius: 16px; font-size: 14.5px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); animation: toast-in 0.28s var(--ease) both; display: flex; gap: 10px; align-items: flex-start; overflow-wrap: anywhere; }
.toast.err { background: #b3202d; }
.toast.ok { background: #1c7c47; }
.toast.out { animation: toast-out 0.2s ease-in both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }
body.kbd .toast-host { bottom: 16px; }

.backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, 0.5); display: flex; align-items: flex-end; justify-content: center; animation: fade 0.2s both; padding-top: var(--sa-top); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal { background: var(--card); width: 100%; max-width: 520px; border-radius: 26px 26px 0 0; padding: 22px 18px calc(18px + var(--sa-bottom)); max-height: 88vh; overflow-y: auto; animation: sheet 0.3s var(--ease) both; }
@keyframes sheet { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal h2 { font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.modal .body > * + * { margin-top: 12px; }
.modal .btn-row { margin-top: 18px; flex-direction: column-reverse; }
.modal .btn-row > .btn { flex: none; width: 100%; }
@media (min-width: 560px) { .backdrop { align-items: center; } .modal { border-radius: 26px; } }

.mini-list { background: var(--soft); border-radius: 14px; overflow: hidden; }
.mini-list .it { display: flex; justify-content: space-between; gap: 10px; padding: 10px 14px; font-size: 14.5px; }
.mini-list .it + .it { border-top: 1px solid var(--sep); }

/* ---------- аккаунты / QR ---------- */
.qr-box { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.qr-frame { background: #fff; padding: 14px; border-radius: 22px; box-shadow: var(--shadow); width: min(100%, 290px); aspect-ratio: 1; display: flex; align-items: center; justify-content: center; position: relative; }
.qr-frame img { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.qr-frame.stale img { opacity: 0.25; filter: blur(2px); }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; }
.steps { margin: 0; padding-left: 20px; color: var(--hint); font-size: 14px; }
.steps li + li { margin-top: 4px; }
.success-art { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto; display: flex; align-items: center; justify-content: center; background: var(--green-bg); color: var(--green); animation: pop 0.5s var(--ease) both; }
.success-art svg { width: 38px; height: 38px; }
@keyframes pop { from { transform: scale(0.4); opacity: 0; } to { transform: none; opacity: 1; } }
.center { text-align: center; }

.fatal { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 32px 24px; text-align: center; }
.fatal .art { width: 96px; height: 96px; margin: 0 auto 18px; border-radius: 32px; display: flex; align-items: center; justify-content: center; background: var(--star-grad); color: var(--star-ink); box-shadow: 0 12px 30px var(--glow); }
.fatal .art svg { width: 48px; height: 48px; }
.fatal h1 { font-size: 24px; font-weight: 800; margin-bottom: 8px; }
.fatal p { color: var(--hint); max-width: 340px; margin: 0 auto; }

@media (min-width: 700px) {
  #view { padding-top: 24px; }
  .tabbar { background: var(--card); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------- дополнения ---------- */
.order-sum b { font-size: 34px; font-weight: 850; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.order-sum .st { color: #f59f00; }
.num-name { font-size: 20px; font-weight: 750; margin-top: 2px; overflow-wrap: anywhere; }
.success-art.warn { background: var(--amber-bg); color: var(--amber); }
.card.center > * + * { margin-top: 14px; }
a.card { color: inherit; }

/* ---------- карточка автовыдачи: главный акцент ---------- */
.hero { padding: 20px; border: 1.5px solid var(--sep); background: linear-gradient(160deg, var(--amber-bg) 0%, transparent 55%), var(--card); }
.hero.on {
  border-color: transparent;
  background: radial-gradient(120% 90% at 100% 0%, rgba(255, 255, 255, 0.38) 0%, transparent 55%), var(--star-grad);
  box-shadow: 0 14px 36px var(--glow), 0 0 0 1px rgba(255, 171, 26, 0.35);
  animation: halo 3.6s ease-in-out infinite;
}
@keyframes halo { 0%, 100% { box-shadow: 0 14px 36px var(--glow), 0 0 0 1px rgba(255, 171, 26, 0.35); } 50% { box-shadow: 0 18px 46px var(--glow), 0 0 0 1px rgba(255, 171, 26, 0.5); } }
.hero-badge { width: 48px; height: 48px; border-radius: 16px; flex: none; display: flex; align-items: center; justify-content: center; background: var(--soft); color: var(--hint); }
.hero-badge svg { width: 26px; height: 26px; }
.hero.on .hero-badge { background: rgba(43, 25, 0, 0.14); color: var(--star-ink); }
.hero.on .hero-badge svg { fill: currentColor; }
.tile.wide { grid-column: 1 / -1; }
