@import url('https://fonts.googleapis.com/css2?family=Onest:wght@400;500;600;700;800;900&display=swap');

/* ============================================================
   Hubicx webapp — Soft Neutral theme
   Drop-in replacement for ma.css
   ============================================================ */
:root {
  --bg: #f3f2ee;
  --bg2: #ecebE5;
  --card: #ffffff;
  --ink: #1c1c1a;
  --muted: #8d8d87;
  --faint: #b6b6af;
  --line: #e9e8e3;
  --line2: #f0efe9;
  --accent: #fcfd76;
  --accent-ink: #1c1c1a;
  --acc-glow: rgba(208,208,90,.45);
  --sage: #7faa9d;
  --lilac: #b6b5e6;
  --grad: linear-gradient(100deg, #7faa9d, #b6b5e6);
  --soft: linear-gradient(135deg, #eef1ec, #efe9f3);
  --link: #7a9c92;
  --nav-bg: #e8e7e2;
  --nav-active: #ffffff;
  --r: 18px;
  --r-lg: 24px;
  --rl: 24px;
  --shadow: 0 6px 20px rgba(40,40,30,.07);
  --shadow-sm: 0 3px 10px rgba(40,40,30,.05);
  --shadow-lg: 0 24px 60px rgba(40,40,30,.14);
  --maxw: 392px;
  --ease: cubic-bezier(.22,.61,.36,1);
}

html.theme-dark,
body.theme-dark {
  --bg: #111318;
  --card: #191c23;
  --ink: #f2f4f8;
  --muted: #a0a7b4;
  --faint: #69707d;
  --line: #292d36;
  --accent: #f5f85d;
  --accent-ink: #111318;
  --link: #90c7b8;
  --nav-bg: #0b0d11;
  --nav-active: #232731;
  --shadow: 0 8px 26px rgba(0,0,0,.35);
  --shadow-sm: 0 4px 14px rgba(0,0,0,.28);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--nav-bg); }
html.hbx-tg-fullscreen,
html.hbx-tg-fullscreen body,
body.tg-fs {
  width: 100%;
  min-height: var(--hbx-tg-vh, 100dvh);
  height: var(--hbx-tg-vh, 100dvh);
  overflow: hidden;
}
body {
  font-family: 'Onest', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: -.01em;
}
#root { min-height: 100%; display: flex; justify-content: center; }
.phone {
  position: relative; width: 100%; max-width: 100%; min-height: var(--app-height, 100dvh);
  background: var(--bg); overflow: hidden; display: flex; flex-direction: column;
}

/* ── top segmented nav ── */
.topnav {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
  padding: 10px 18px 8px;
  background: var(--bg); position: sticky; top: 0; z-index: 60;
  border-bottom: 1px solid var(--line);
}
.tn-seg {
  flex: 1; display: flex; gap: 2px; padding: 5px; border-radius: 999px;
  background: var(--nav-bg);
}
.tn-item {
  flex: 1; height: 36px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; transition: .18s;
}
.tn-item.on { background: var(--nav-active); color: var(--ink); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.tn-icon {
  width: 42px; height: 42px; border-radius: 13px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  color: var(--ink); position: relative; cursor: pointer;
}
.tn-dot {
  position: absolute; top: 9px; right: 9px; width: 8px; height: 8px; border-radius: 50%;
  background: #e0664a; border: 2px solid var(--card);
}
.m-notif {
  position: absolute; top: 50px; right: 0; width: min(320px, calc(100vw - 36px));
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 18px 46px rgba(0,0,0,.16); padding: 12px; z-index: 80;
  color: var(--ink); cursor: default;
}
.m-notif-top { display:flex; align-items:center; justify-content:space-between; font-weight:800; font-size:15px; margin-bottom:8px; }
.m-notif-top button { width:28px; height:28px; border:0; border-radius:10px; background:var(--nav-bg); color:var(--muted); font-size:20px; line-height:1; cursor:pointer; }
.m-notif-empty { padding:18px 10px; text-align:center; color:var(--muted); font-size:13px; font-weight:600; }
.m-notif-item { display:flex; align-items:center; gap:10px; padding:10px 4px; border-top:1px solid var(--line); }
.m-notif-item:first-of-type { border-top:0; }
.m-notif-ic { width:30px; height:30px; border-radius:10px; flex:0 0 auto; display:flex; align-items:center; justify-content:center; }
.m-notif-tx { min-width:0; flex:1; }
.m-notif-t { font-size:13.5px; font-weight:800; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.m-notif-s { font-size:12px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-top:1px; }
.m-notif-time { font-size:11.5px; color:var(--muted); font-weight:700; white-space:nowrap; }

/* ── Telegram/payment return page ── */
.tg-return-page {
  position:relative; width:100%; min-height:100dvh; overflow:hidden;
  display:flex; align-items:center; justify-content:center; padding:28px 18px;
  background:
    radial-gradient(circle at 18% 12%, rgba(127,170,157,.22), transparent 32%),
    radial-gradient(circle at 88% 88%, rgba(182,181,230,.24), transparent 34%),
    var(--bg);
}
.tg-return-bg {
  position:absolute; inset:auto -20% -18% -20%; height:44%;
  background:linear-gradient(180deg, rgba(255,255,255,0), rgba(255,255,255,.52));
  pointer-events:none;
}
.tg-return-card {
  position:relative; z-index:1; width:min(100%, 430px); border-radius:30px;
  padding:20px 18px 18px; background:rgba(255,255,255,.9); border:1px solid rgba(233,232,227,.9);
  box-shadow:0 24px 70px rgba(40,40,30,.13); text-align:center;
  backdrop-filter: blur(18px);
}
.tg-return-brand { display:flex; align-items:center; justify-content:center; gap:10px; color:var(--ink); font-weight:950; font-size:16px; }
.tg-return-brand img { width:34px; height:34px; border-radius:11px; object-fit:cover; box-shadow:var(--shadow-sm); }
.tg-return-visual {
  position:relative; width:132px; height:132px; margin:18px auto 12px;
  display:flex; align-items:center; justify-content:center;
}
.tg-return-orbit {
  position:absolute; inset:0; border-radius:36px;
  background:linear-gradient(135deg, rgba(127,170,157,.22), rgba(182,181,230,.20));
  transform:rotate(8deg);
}
.tg-return-mark {
  position:relative; width:86px; height:86px; border-radius:28px;
  display:flex; align-items:center; justify-content:center; font-size:48px; font-weight:950;
  background:var(--card); color:var(--ink); box-shadow:0 14px 34px rgba(40,40,30,.12);
}
.tg-return-card.ok .tg-return-mark { color:#5f9184; }
.tg-return-card.fail .tg-return-mark { color:#c0473e; }
.tg-return-pill {
  display:inline-flex; align-items:center; justify-content:center; min-height:30px; padding:0 12px;
  border-radius:999px; background:#eef7f2; color:#5f9184; font-size:12px; font-weight:950;
}
.tg-return-card.fail .tg-return-pill { background:#fff0ec; color:#c0473e; }
.tg-return-card.plain .tg-return-pill { background:var(--nav-bg); color:var(--muted); }
.tg-return-card h1 {
  margin-top:12px; font-size:30px; line-height:1.04; font-weight:950; letter-spacing:0;
}
.tg-return-card p {
  margin:10px auto 0; max-width:350px; color:var(--muted); font-size:15px; line-height:1.46; font-weight:650;
}
.tg-return-note {
  margin-top:16px; padding:13px 14px; border-radius:18px; text-align:left;
  background:var(--nav-bg); border:1px solid var(--line);
}
.tg-return-note b { display:block; font-size:13.5px; font-weight:950; color:var(--ink); }
.tg-return-note span { display:block; margin-top:4px; font-size:12.5px; line-height:1.38; color:var(--muted); font-weight:650; }
.tg-return-actions { display:grid; gap:10px; margin-top:18px; }
.tg-return-main,
.tg-return-secondary {
  width:100%; height:56px; border-radius:18px; font-family:inherit; font-size:15.5px; font-weight:950; cursor:pointer;
}
.tg-return-main { border:0; background:var(--accent); color:var(--accent-ink); box-shadow:0 12px 28px rgba(210,210,80,.38); }
.tg-return-secondary { border:1.5px solid var(--line); background:var(--card); color:var(--ink); }
html.theme-dark .tg-return-page {
  background:
    radial-gradient(circle at 18% 12%, rgba(127,170,157,.18), transparent 32%),
    radial-gradient(circle at 88% 88%, rgba(182,181,230,.16), transparent 34%),
    var(--bg);
}
html.theme-dark .tg-return-card { background:rgba(25,28,35,.92); border-color:var(--line); }
html.theme-dark .tg-return-bg { background:linear-gradient(180deg, rgba(17,19,24,0), rgba(17,19,24,.58)); }
html.theme-dark .tg-return-mark,
html.theme-dark .tg-return-secondary { background:var(--card); }
html.theme-dark .tg-return-note,
html.theme-dark .tg-return-card.plain .tg-return-pill { background:#12151b; }

.hbx-blocked-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(28px, env(safe-area-inset-top)) 18px max(28px, env(safe-area-inset-bottom));
  background: var(--bg);
  color: var(--ink);
}
.hbx-blocked-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card);
  box-shadow: 0 24px 80px rgba(0,0,0,.16);
  padding: 28px;
  text-align: center;
}
.hbx-blocked-mark {
  width: 54px;
  height: 54px;
  margin: 0 auto 14px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: #fff36b;
  color: #111318;
  font-size: 28px;
  font-weight: 950;
  box-shadow: 0 12px 32px rgba(252,253,118,.28);
}
.hbx-blocked-k {
  color: var(--link);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.hbx-blocked-card h1 {
  margin: 8px 0 10px;
  font-size: 30px;
  line-height: 1.02;
  letter-spacing: -.03em;
}
.hbx-blocked-card p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}
.hbx-blocked-note {
  margin-top: 18px;
  border-radius: 16px;
  background: var(--soft);
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}
html.theme-dark .hbx-blocked-card { background: #191c23; border-color: #292d36; }
html.theme-dark .hbx-blocked-note { background: #12151b; }

/* ── scrollable screen body ── */
.screen {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 0 18px calc(env(safe-area-inset-bottom) + 32px);
  scrollbar-width: none;
}
body.hbx-modal-open .screen { overflow: hidden !important; }
.screen::-webkit-scrollbar { display: none; }
.mob-swipe-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  touch-action: pan-y;
  overscroll-behavior-x: contain;
}
.mob-swipe-stage > .screen,
.mob-swipe-stage > .chat-wrap { min-height: 0; }
.mob-swipe-stage.swipe-next { animation: tabInNext .2s cubic-bezier(.2,.85,.25,1) both; }
.mob-swipe-stage.swipe-prev { animation: tabInPrev .2s cubic-bezier(.2,.85,.25,1) both; }
@keyframes tabInNext { from { opacity: 0; transform: scale(.985) translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes tabInPrev { from { opacity: 0; transform: scale(.985) translateY(6px); } to { opacity: 1; transform: none; } }

/* ── cards ── */
.card {
  background: var(--card); border-radius: var(--r);
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.row-link {
  display: flex; align-items: center; gap: 14px; padding: 15px 16px; cursor: pointer;
}
.row-link:active { background: #f8f7f2; }
html.theme-dark .row-link:active { background: #20242c; }
.row-link.locked { cursor: default; }
.row-link .chev { margin-left: auto; }

.mob-profile-hero {
  display:flex; align-items:center; gap:13px; padding:14px; margin-bottom:12px;
  background:linear-gradient(135deg, #fff, #f3f7f3);
}
.mob-profile-avatar {
  width:56px; height:56px; border-radius:20px; flex:0 0 auto; overflow:hidden;
  display:grid; place-items:center; background:linear-gradient(135deg, #7faa9d, #b6b5e6);
  color:#fff; font-size:24px; font-weight:950; box-shadow:0 10px 26px rgba(127,170,157,.22);
}
.mob-profile-avatar img { width:100%; height:100%; object-fit:cover; display:block; }
.mob-profile-id { min-width:0; flex:1; }
.mob-profile-name { font-size:19px; font-weight:950; line-height:1.08; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.mob-profile-handle { margin-top:4px; color:var(--muted); font-size:12.5px; font-weight:750; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.mob-profile-topup {
  flex:0 0 auto; max-width:116px; min-height:38px; border:1px solid var(--line); border-radius:14px;
  background:var(--card); color:var(--ink); display:flex; align-items:center; justify-content:center;
  gap:5px; padding:8px 10px; font-family:inherit; font-size:12.5px; font-weight:950;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.mob-sub-card {
  display:flex; align-items:center; justify-content:space-between; gap:12px; padding:14px; margin-bottom:14px;
  background:linear-gradient(135deg, rgba(182,181,230,.11), rgba(252,253,118,.13));
}
.mob-sub-card.active { background:linear-gradient(135deg, rgba(127,170,157,.18), rgba(252,253,118,.16)); border-color:rgba(127,170,157,.28); }
.mob-sub-k { color:#7a9c92; font-size:11px; font-weight:950; text-transform:uppercase; }
.mob-sub-title { margin-top:3px; color:var(--ink); font-size:17px; font-weight:950; line-height:1.08; }
.mob-sub-meta { margin-top:4px; color:var(--muted); font-size:12px; font-weight:700; line-height:1.25; }
.mob-sub-card button {
  flex:0 0 auto; border:0; border-radius:14px; min-height:38px; padding:0 12px;
  background:var(--ink); color:var(--card); font-family:inherit; font-size:12.5px; font-weight:950;
}

.bonus-card-v2 {
  overflow: hidden; margin-top: 14px; padding: 16px;
  background: linear-gradient(135deg, rgba(127,170,157,.12), rgba(182,181,230,.10));
}
.bonus-head-v2 { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.bonus-bal-v2 { flex:0 0 auto; min-width:54px; padding:8px 9px; border-radius:14px; border:1px solid var(--line); background:var(--nav-bg); text-align:center; }
.bonus-bal-v2 b { display:block; color:var(--ink); font-size:17px; line-height:1; }
.bonus-bal-v2 span { display:block; margin-top:2px; color:var(--muted); font-size:11px; font-weight:900; }
.bonus-list-v2 { display:grid; gap:9px; margin-top:14px; }
.bonus-task-v2 { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px; border-radius:16px; border:1px solid var(--line); background:var(--card); box-shadow:var(--shadow-sm); }
.bonus-task-v2.done { opacity:.82; }
.bonus-copy-v2 { flex:1; min-width:0; }
.bonus-copy-v2 span { display:block; font-size:13.5px; font-weight:850; line-height:1.2; }
.bonus-copy-v2 small { display:block; margin-top:4px; color:var(--muted); font-size:11.5px; line-height:1.35; }
.bonus-act-v2 { flex:0 0 auto; display:flex; flex-direction:column; align-items:flex-end; gap:7px; }
.bonus-act-v2 b { color:#7a9c92; font-size:12px; white-space:nowrap; }
.bonus-act-v2 em { color:var(--muted); font-style:normal; font-size:11.5px; font-weight:900; white-space:nowrap; }
.bonus-act-v2 button,
.bonus-act-v2 a { border:0; border-radius:11px; background:var(--ink); color:var(--card); text-decoration:none; font-weight:900; font-size:11.5px; padding:8px 10px; cursor:pointer; white-space:nowrap; }
.bonus-note-v2 { margin-top:10px; color:var(--muted); font-size:12px; line-height:1.45; }

.m-lock-btn {
  margin-left: auto; width: 36px; height: 36px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto; cursor: pointer;
}
.m-lock-btn.off { background: var(--card); color: var(--muted); }
.m-lock-btn:active { transform: scale(.96); }
.divider { height: 1px; background: var(--line); margin-left: 54px; }

.duration-inline {
  padding: 15px 16px 14px;
}
.duration-inline.locked { cursor: default; }
.duration-inline-head {
  display: flex;
  align-items: center;
  gap: 14px;
}
.duration-inline-title {
  min-width: 0;
  flex: 1;
}
.duration-control {
  margin: 12px 0 0 54px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}
.duration-control.no-auto {
  grid-template-columns: minmax(0, 1fr);
}
.duration-auto {
  height: 38px;
  min-width: 58px;
  padding: 0 12px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--nav-bg);
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 900;
  cursor: pointer;
}
.duration-auto.on {
  background: var(--ink);
  color: var(--card);
  border-color: var(--ink);
}
.duration-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 38px;
  margin: 0;
  accent-color: var(--accent);
  background: transparent;
}
.duration-control.no-auto .duration-range {
  grid-column: 1 / -1;
}
.duration-range::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0 var(--duration-progress, 0%), #dfe6db var(--duration-progress, 0%) 100%);
  border: 1px solid var(--line);
}
.duration-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  margin-top: -10px;
  border-radius: 50%;
  background: var(--ink);
  border: 4px solid var(--card);
  box-shadow: 0 6px 16px rgba(0,0,0,.18);
}
.duration-scale {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 800;
}
.duration-scale b {
  color: var(--ink);
  font-size: 13px;
  font-weight: 950;
}
.duration-scale span.active { color:var(--ink); font-weight:950; }
.duration-chips {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.duration-chip {
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--nav-bg);
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
}
.duration-chip.on {
  background: var(--ink);
  color: var(--card);
  border-color: var(--ink);
}
html.theme-dark .duration-chip { background:#20242c; }
html.theme-dark .duration-chip.on { background:var(--accent); color:var(--accent-ink); border-color:var(--accent); }
html.theme-dark .duration-range::-webkit-slider-runnable-track {
  background: linear-gradient(90deg, var(--accent) 0 var(--duration-progress, 0%), #2d332f var(--duration-progress, 0%) 100%);
}
.seedance-tier {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 0 16px 14px 70px;
}
.seedance-tier-note { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.seedance-tier button {
  border: 1px solid var(--line);
  background: var(--nav-bg);
  color: var(--muted);
  border-radius: 14px;
  padding: 9px 8px;
  font: inherit;
  text-align: left;
}
.seedance-tier button b { display: block; color: var(--ink); font-size: 13px; line-height: 1.05; }
.seedance-tier button span { display: block; font-size: 10.5px; margin-top: 2px; }
.seedance-tier button.on {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 18%, var(--card));
  box-shadow: 0 8px 18px color-mix(in srgb, var(--accent) 18%, transparent);
}
html.theme-dark .seedance-tier button { background: #20242c; }
html.theme-dark .seedance-tier button.on { background: #2b3024; }

@media (max-width: 380px) {
  .duration-control { margin-left: 0; grid-template-columns: 1fr; }
  .duration-auto { width: 100%; }
}

/* ── section header ── */
.sec-h {
  display: flex; align-items: center; justify-content: space-between; margin: 22px 2px 12px;
}
.sec-h h2 { font-size: 18px; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
.sec-h .all { color: var(--link); font-size: 13.5px; font-weight: 700; cursor: pointer; }

/* ── horizontal rail ── */
.rail {
  display: flex; gap: 12px; overflow-x: auto;
  scroll-snap-type: x mandatory; padding-bottom: 4px; scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.thumb {
  position: relative; border-radius: 16px; overflow: hidden;
  background: #ebe9e0; flex: 0 0 auto; border: 1px solid var(--line);
  isolation: isolate;
  transform: translateZ(0);
}
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb video { position: relative; z-index: 0; }
.tpl-media { position: absolute; inset: 0; z-index: 0; overflow: hidden; background: #ebe9e0; transform: translateZ(0); }
.tpl-media-fallback,
.tpl-media-video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block;
}
.tpl-media-fallback { z-index: 0; }
.tpl-media-video { z-index: 0; opacity: 0; transition: opacity .22s ease; transform: translateZ(0); }
.tpl-media-video.ready { opacity: 1; }
.tpl-media-placeholder {
  position: absolute; inset: 0; z-index: 0; overflow: hidden;
  background:
    radial-gradient(circle at 28% 26%, rgba(255,255,255,.55), transparent 28%),
    linear-gradient(135deg, rgba(95,145,132,.18), rgba(111,108,200,.14)),
    var(--nav-bg);
}
.tpl-media-placeholder::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-120%);
  background: linear-gradient(105deg, transparent 18%, rgba(255,255,255,.34) 48%, transparent 78%);
  animation: tpl-shimmer 1.25s ease-in-out infinite;
}
.tpl-media-placeholder span {
  position: absolute; left: 50%; top: 50%; width: 30px; height: 30px;
  transform: translate(-50%,-50%); border-radius: 999px;
  border: 2px solid rgba(255,255,255,.62); box-shadow: 0 8px 28px rgba(0,0,0,.16);
}
.tpl-media-placeholder span::before {
  content: ""; position: absolute; left: 11px; top: 8px; width: 0; height: 0;
  border-top: 6px solid transparent; border-bottom: 6px solid transparent; border-left: 9px solid rgba(255,255,255,.72);
}
.tpl-media.has-fallback.loading::after {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: linear-gradient(105deg, transparent 18%, rgba(255,255,255,.20) 48%, transparent 78%);
  transform: translateX(-120%); animation: tpl-shimmer 1.35s ease-in-out infinite;
}
.tpl-media.ready::after { display: none; }
@keyframes tpl-shimmer {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(120%); }
}
@media (prefers-reduced-motion: reduce) {
  .tpl-media-placeholder::after,
  .tpl-media.has-fallback.loading::after { animation: none; opacity: .35; transform: none; }
}
.tpl-category { margin-top: 18px; }
.tpl-category:first-of-type { margin-top: 12px; }
.tpl-category-title { margin: 0 2px 10px; color: var(--text); font-size: 17px; font-weight: 850; }
.thumb .lbl {
  position: absolute; left: 10px; right: 10px; bottom: 9px;
  font-weight: 700; font-size: 13px; line-height: 1.15;
  text-shadow: 0 1px 6px rgba(0,0,0,.5); z-index: 12; color: #fff;
  pointer-events: none;
  transform: translate3d(0,0,2px);
  -webkit-transform: translate3d(0,0,2px);
}
.thumb .shade {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(0,0,0,.55)); z-index: 10;
  pointer-events: none;
  transform: translate3d(0,0,1px);
  -webkit-transform: translate3d(0,0,1px);
}

.thumb .mob-tpl-fav { z-index: 14 !important; transform: translate3d(0,0,3px); }

/* ── ask / search bar ── */
.askbar {
  display: flex; align-items: center; gap: 9px; height: 58px; border-radius: 19px;
  padding: 0 8px 0 18px; background: var(--card); border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(40,40,30,.08);
}
.askbar input {
  flex: 1; background: none; border: none; outline: none; color: var(--ink);
  font-size: 15.5px; font-family: inherit; font-weight: 500;
}
.askbar input::placeholder { color: var(--muted); }
.send {
  width: 44px; height: 44px; border-radius: 50%; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: var(--nav-bg); color: var(--muted); transition: background .18s, color .18s;
}
.send.on { background: var(--ink); color: #fff; }

/* ── greeting ── */
.greeting {
  font-size: 27px; font-weight: 800; line-height: 1.12; letter-spacing: -.03em; margin-top: 16px;
}
.greeting .grad {
  background: linear-gradient(90deg, #7faa9d, #b6b5e6);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}

/* ── 2×2 action grid ── */
.act-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-top: 14px; }
.act-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px; display: flex; flex-direction: column; gap: 12px;
  min-height: 96px; justify-content: space-between; cursor: pointer; box-shadow: var(--shadow-sm);
  transition: transform .15s;
}
.act-card:active { transform: scale(.96); }
.act-card .ic { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.act-card .t { font-weight: 800; font-size: 14.5px; letter-spacing: -.01em; }
.act-card .s { font-size: 11.5px; font-weight: 500; color: var(--muted); margin-top: 2px; }

/* ── quick idea tiles (4-col) ── */
.idea-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 9px; }
.idea-tile {
  border-radius: 16px; padding: 11px 9px; min-height: 86px;
  display: flex; flex-direction: column; justify-content: space-between; cursor: pointer;
}
.idea-tile .ic { width: 28px; height: 28px; border-radius: 9px; display: flex; align-items: center; justify-content: center; }
.idea-tile .l { font-size: 11px; font-weight: 700; line-height: 1.2; }

.tpl-rail {
  display: flex; gap: 12px; overflow-x: auto; padding: 1px 2px 6px;
  scroll-snap-type: x mandatory; scrollbar-width: none; margin-left: -2px; margin-right: -18px;
}
.tpl-rail::-webkit-scrollbar { display: none; }
.tpl-card {
  width: 156px; height: 192px; flex: 0 0 156px; scroll-snap-align: start;
  cursor: pointer; box-shadow: var(--shadow-sm);
}
.home-cats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}
.home-cat-card {
  min-height: 82px;
  border-radius: 17px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  padding: 9px 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  overflow: hidden;
}
.home-cat-card:active { transform: scale(.97); }
.home-cat-ic {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.home-cat-card b {
  display: block;
  margin-top: 7px;
  color: var(--ink);
  font-size: 11.5px;
  line-height: 1.08;
  font-weight: 950;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.home-cat-card small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.15;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.home-template-strip {
  margin-top: 14px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(255,255,255,.72), rgba(255,255,255,.34));
  box-shadow: var(--shadow-sm);
  padding: 12px 0 10px 12px;
  overflow: hidden;
}
.home-strip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-right: 12px;
  margin-bottom: 10px;
}
.home-strip-head span {
  color: var(--ink);
  font-size: 14px;
  font-weight: 950;
}
.home-strip-head button {
  border: 0;
  background: transparent;
  color: var(--link);
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}
.home-strip-rail {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding-right: 12px;
}
.home-strip-rail::-webkit-scrollbar { display: none; }
.home-mini-tpl {
  position: relative;
  flex: 0 0 118px;
  width: 118px;
  height: 146px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.36);
  background: var(--nav-bg);
  box-shadow: 0 7px 18px rgba(40,40,30,.08);
  cursor: pointer;
  scroll-snap-align: start;
  isolation: isolate;
  transform: translateZ(0);
}
.home-mini-tpl::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 45%, rgba(0,0,0,.58));
  transform: translate3d(0,0,1px);
  -webkit-transform: translate3d(0,0,1px);
}
.home-mini-tpl .home-mini-name {
  position: absolute;
  left: 9px;
  right: 9px;
  bottom: 9px;
  z-index: 12;
  color: #fff;
  font-size: 12px;
  line-height: 1.12;
  font-weight: 950;
  text-shadow: 0 1px 7px rgba(0,0,0,.55);
  pointer-events: none;
  transform: translate3d(0,0,2px);
  -webkit-transform: translate3d(0,0,2px);
}
.home-mini-tpl .tpl-media { background: var(--nav-bg); }
html.theme-dark .home-template-strip {
  background: linear-gradient(135deg, rgba(31,34,42,.82), rgba(20,23,29,.76));
}
html.theme-dark .home-cat-card { background: #191c23; }
.tpl-page-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.tpl-filter { position: sticky; top: 0; z-index: 40; margin-bottom: 2px; }
.tpl-scope-note {
  position: sticky;
  top: 0;
  z-index: 39;
  margin-bottom: 12px;
  min-height: 50px;
  border-radius: 17px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  padding: 8px 10px 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.tpl-scope-note span {
  min-width: 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 950;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tpl-scope-note button {
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: var(--nav-bg);
  color: var(--link);
  font: inherit;
  font-size: 12px;
  font-weight: 950;
}
.model-promo-list { display: flex; flex-direction: column; gap: 12px; padding-bottom: 2px; }
.model-promo {
  min-height: 192px; border-radius: 24px; padding: 18px; overflow: hidden; position: relative;
  display: flex; flex-direction: column; justify-content: flex-end; cursor: pointer;
  border: 1px solid rgba(255,255,255,.12); box-shadow: var(--shadow-sm);
}
.model-promo .promo-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; z-index: 0; opacity: .55;
  pointer-events: none; user-select: none; -webkit-user-select: none;
}
.model-promo::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 78% 18%, rgba(255,255,255,.20), transparent 34%),
    linear-gradient(135deg, rgba(255,255,255,.10), transparent 55%);
  pointer-events: none;
}
.model-promo-t { position: relative; font-size: 20px; font-weight: 900; letter-spacing: -.03em; }
.model-promo-s { position: relative; font-size: 13px; font-weight: 600; opacity: .82; margin-top: 3px; }

.hist-rail { display: flex; gap: 12px; overflow-x: auto; padding: 2px 2px 8px; margin-right: -18px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.hist-rail::-webkit-scrollbar { display: none; }
.profile-history-anchor {
  border-radius: 22px;
  transition: background .24s var(--ease), box-shadow .24s var(--ease);
}
.profile-history-anchor.pulse {
  background: rgba(252,253,118,.12);
  box-shadow: 0 0 0 8px rgba(252,253,118,.10);
}
.profile-history-anchor.pulse .hist-card,
.profile-history-anchor.pulse .hist-rail > .card {
  box-shadow: 0 10px 28px rgba(127,170,157,.22);
}
html.theme-dark .profile-history-anchor.pulse {
  background: rgba(245,248,93,.09);
  box-shadow: 0 0 0 8px rgba(245,248,93,.08);
}
.hist-card {
  width: 132px; flex: 0 0 132px; border-radius: 18px; background: var(--card); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm); overflow: hidden; cursor: pointer; scroll-snap-align: start;
}
.hist-thumb { width: 100%; aspect-ratio: 3 / 4; background: var(--nav-bg); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.hist-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hist-meta { padding: 9px 10px 10px; min-height: 62px; }
.hist-title { font-size: 12.5px; font-weight: 800; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ── chat plate (in agent) ── */
.chat-plate {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow-sm);
}
.chat-plate .cp-av { width: 42px; height: 42px; border-radius: 13px; overflow: hidden; flex: 0 0 auto; }
.chat-plate .cp-av img { width: 100%; height: 100%; object-fit: cover; }
.chat-plate .cp-x {
  margin-left: auto; color: var(--faint); width: 28px; height: 28px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; border-radius: 8px;
}
.chat-plate .cp-x:active { background: var(--nav-bg); }

/* ── balance card (generation) ── */
.bal-card {
  display: flex; align-items: center; padding: 16px 18px; border-radius: var(--r);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.bal-card .bk { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.bal-card .bn { display: flex; align-items: center; gap: 7px; font-size: 22px; font-weight: 800; margin-top: 4px; }
.bal-card .bb {
  margin-left: auto; height: 40px; padding: 0 18px; border-radius: 13px; border: none;
  font-family: inherit; font-weight: 800; font-size: 14px;
  background: var(--accent); color: var(--accent-ink); cursor: pointer;
  box-shadow: 0 4px 12px rgba(210,210,80,.4);
}

/* ── token badge ── */
.tb-tok {
  display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px; border-radius: 19px;
  background: var(--card); border: 1px solid var(--line); font-weight: 800; font-size: 14px;
  box-shadow: var(--shadow-sm); flex: 0 0 auto;
}

/* ── bottom sheets ── */
.sheet-ov {
  position: fixed; inset: 0; z-index: 60; background: rgba(28,28,22,.36);
  display: flex; align-items: flex-end; justify-content: center;
  animation: sheetFade .22s ease both;
  overscroll-behavior: contain; touch-action: none;
}
.sheet { width: 100%; max-width: 100%; padding: 0; touch-action: pan-y; }
.sheet-card {
  background: var(--card); border-radius: 26px 26px 0 0;
  padding: 8px 18px calc(env(safe-area-inset-bottom) + 18px); border: 1px solid var(--line); border-bottom: none;
  box-shadow: 0 -14px 38px rgba(0,0,0,.10);
  max-height: min(76dvh, 640px); overflow-y: auto; scrollbar-width: none;
  animation: sheetUp .34s cubic-bezier(.2,.86,.2,1) both;
  overscroll-behavior: contain;
  box-sizing: border-box;
}
.sheet-card::-webkit-scrollbar { display:none; }
.sheet-x {
  position:absolute; top:10px; right:14px; width:38px; height:38px; border-radius:13px;
  border:1px solid var(--line); background:var(--nav-bg); color:var(--ink);
  display:flex; align-items:center; justify-content:center; cursor:pointer;
}
.sheet-grab { width: 38px; height: 4px; border-radius: 2px; background: var(--line); margin: 8px auto 14px; }
.sheet-h { color: var(--link); font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.sheet-title { font-size: 20px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 2px; }
.opt {
  display: flex; align-items: center; gap: 12px; padding: 14px 2px; cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.opt:last-child { border-bottom: none; }
.opt:active { background: #f8f7f2; }
.opt .o-t { font-weight: 700; font-size: 15.5px; color: var(--ink); }
.opt .o-s { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.opt .o-check { margin-left: auto; color: var(--ink); }
.sheet-cta {
  width: 100%; height: 54px; border: none; border-radius: 16px; margin-top: 12px;
  background: var(--accent); color: var(--accent-ink); font-size: 16px; font-weight: 800;
  cursor: pointer; font-family: inherit; box-shadow: 0 8px 20px rgba(210,210,80,.4);
}
.topup-sheet { padding: 0; }
.topup-card {
  position: relative;
  max-height: min(88dvh, 720px);
  padding: 8px 16px calc(env(safe-area-inset-bottom) + 10px);
  display: flex;
  flex-direction: column;
}
.topup-card .sheet-grab { margin: 7px auto 9px; }
.topup-card .sheet-title { font-size: 20px; margin-bottom: 0; line-height: 1.05; }
.topup-close {
  position:absolute; top:16px; right:14px; width:34px; height:34px; border:1px solid var(--line);
  border-radius:13px; background:var(--card); color:var(--muted); display:grid; place-items:center;
}
.topup-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; padding:0 34px 10px 0; }
.topup-sub { margin-top:5px; color:var(--muted); font-size:12.5px; font-weight:700; }
.topup-balance {
  flex:0 0 auto; display:flex; align-items:center; gap:5px; max-width:118px; min-height:30px; padding:6px 9px;
  border-radius:13px; background:#f5f4ee; border:1px solid var(--line); color:var(--ink);
  font-size:12.5px; font-weight:950; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.topup-body {
  min-height:0; overflow-y:auto; overscroll-behavior:contain; scrollbar-width:none;
  padding:0 0 10px;
}
.topup-body::-webkit-scrollbar { display:none; }
.topup-bonus-lite {
  display:flex; align-items:center; gap:10px; padding:10px 11px; border-radius:17px;
  background:linear-gradient(135deg, rgba(127,170,157,.13), rgba(252,253,118,.15));
  border:1px solid rgba(127,170,157,.18); margin:2px 0 13px;
}
.topup-bonus-ic { width:36px; height:36px; border-radius:13px; display:grid; place-items:center; background:#fff8d2; flex:0 0 auto; }
.topup-bonus-lite div:nth-child(2) { min-width:0; flex:1; }
.topup-bonus-lite b { display:block; font-size:13.5px; line-height:1.1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.topup-bonus-lite span { display:block; margin-top:3px; color:var(--muted); font-size:11.5px; line-height:1.22; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.topup-bonus-lite strong { flex:0 0 auto; font-size:13px; color:#5f9184; }
.topup-section-title { display:flex; align-items:center; justify-content:space-between; gap:10px; margin:2px 0 8px; }
.topup-section-title span { color:#7a9c92; font-weight:950; font-size:15px; }
.topup-section-title em {
  font-style:normal; border-radius:999px; padding:4px 8px; background:#f5f66f; color:#454629;
  font-size:10px; font-weight:950; text-transform:uppercase;
}
.topup-template-list { display:grid; gap:8px; margin-bottom:12px; }
.topup-plan {
  width:100%; border:1px solid var(--line); border-radius:17px; background:var(--card); padding:12px;
  font-family:inherit; color:var(--ink); text-align:left; display:flex; align-items:center; gap:10px;
  box-shadow:var(--shadow-sm); transition:border-color .16s, background .16s, transform .16s;
}
.topup-plan:active { transform:scale(.992); }
.topup-plan.on { border-color:var(--accent); background:#fffde8; box-shadow:0 0 0 1px rgba(252,253,118,.65) inset, var(--shadow-sm); }
.topup-plan-radio { width:18px; height:18px; border-radius:999px; border:2px solid #d8d7cf; flex:0 0 auto; }
.topup-plan.on .topup-plan-radio { border-color:#aeb04b; box-shadow:inset 0 0 0 4px #fffde8; background:#aeb04b; }
.topup-plan-main { min-width:0; flex:1; }
.topup-plan-main b { display:block; font-size:15.5px; font-weight:950; line-height:1.1; }
.topup-plan-main small { display:block; margin-top:5px; color:var(--muted); font-size:11.5px; line-height:1.25; }
.topup-plan-side { flex:0 0 auto; display:flex; flex-direction:column; align-items:flex-end; gap:5px; }
.topup-plan-side em { font-style:normal; color:#7a9c92; font-size:10.5px; font-weight:950; }
.topup-plan-side strong { font-size:16px; font-weight:950; white-space:nowrap; }
.topup-fold-block { margin-top:8px; }
.topup-fold {
  width:100%; border:1px solid var(--line); border-radius:16px; min-height:48px; padding:10px 11px;
  background:#f8f7f2; color:var(--ink); font-family:inherit; display:flex; align-items:center; gap:8px;
}
.topup-fold span { flex:1; min-width:0; font-size:14px; font-weight:950; text-align:left; }
.topup-fold b { color:var(--muted); font-size:11.5px; font-weight:900; white-space:nowrap; }
.topup-fold i { width:26px; height:26px; border-radius:10px; background:var(--card); display:grid; place-items:center; font-style:normal; font-weight:950; }
.topup-fold.open { background:#f1f0e9; border-color:#d7d5ca; }
.topup-packs { display:flex; flex-direction:column; gap:7px; margin-top:8px; }
.topup-opt {
  min-height:50px; padding:9px 10px !important; border-radius:14px !important;
  border:1px solid var(--line); background:var(--card); display:flex; align-items:center; gap:9px;
}
.topup-opt.on { border-color:var(--ink); background:#f8f7f2; }
.topup-opt span { font-weight:900; font-size:14px; }
.topup-opt .muted { font-size:10.8px; margin-top:2px; }
.topup-opt strong { font-size:14px; white-space:nowrap; }
.topup-custom {
  margin-top:8px; display:flex; align-items:center; gap:10px; background:#f8f7f2;
  border-radius:14px; padding:10px 12px; border:1px solid var(--line);
}
.topup-custom input {
  flex:1; min-width:0; background:transparent; border:none; color:var(--ink); font-size:14px;
  font-weight:800; outline:none; font-family:inherit; -moz-appearance:textfield;
}
.topup-custom span { color:var(--muted); font-weight:900; }
.topup-custom-preview {
  margin-top:7px; border-radius:12px; background:#f0efe8; padding:9px 11px;
  display:flex; align-items:center; justify-content:space-between; font-size:13px;
}
.topup-more {
  width: 100%; border: 1px dashed var(--line); background: var(--nav-bg); color: var(--link);
  border-radius: 14px; min-height: 42px; margin: 8px 0 0; font-family: inherit;
  font-size: 13px; font-weight: 950;
}
.topup-footer {
  flex:0 0 auto; padding-top:9px; border-top:1px solid rgba(0,0,0,.06);
  background:linear-gradient(180deg, rgba(255,255,255,.78), var(--card) 34%);
}
.topup-cta { flex:0 0 auto; margin-top:0; }
.topup-footer-note { margin-top:7px; text-align:center; color:var(--muted); font-size:11.5px; font-weight:700; }
.topup-error { font-size:12.5px; margin:0 0 8px; color:#c0473e; font-weight:800; }
.bonus-card {
  width: 100%; border: 1px solid var(--line); border-radius: 18px; padding: 13px;
  background: linear-gradient(135deg, #fffef1, #f7f2ff); margin-bottom: 14px;
}
.bonus-title { font-size: 16px; font-weight: 900; color: var(--ink); }
.bonus-note { font-size: 11.5px; color: var(--muted); margin-top: 4px; line-height: 1.25; }
.bonus-tasks { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; }
.bonus-task { display:flex; align-items:center; justify-content:space-between; gap:8px; background:rgba(255,255,255,.72); border:1px solid rgba(0,0,0,.06); border-radius:13px; padding:8px 9px; }
.bonus-task b { display:block; font-size:12.5px; }
.bonus-task span { display:block; margin-top:1px; color:#7a9c92; font-size:11.5px; font-weight:800; }
.bonus-task em { font-style:normal; color:var(--muted); font-size:11.5px; font-weight:800; }
.bonus-task button { border:0; border-radius:11px; background:var(--ink); color:#fff; font-weight:800; font-size:11.5px; padding:7px 9px; font-family:inherit; }
.sub-list { width:100%; display:flex; flex-direction:column; gap:8px; margin-bottom:14px; }
.sub-card { border:1px solid var(--line); border-radius:15px; padding:11px 12px; background:#fff; }
.sub-card.pay-choice { cursor:pointer; transition: border-color .16s, background .16s, transform .16s; }
.sub-card.pay-choice.on { border-color: var(--accent); background: rgba(252,253,118,.14); box-shadow: 0 0 0 1px rgba(252,253,118,.22) inset; }
.sub-card.pay-choice:active { transform: scale(.99); }
.sub-card > div { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.sub-card b { font-size:14.5px; }
.sub-card span { color:#7a9c92; font-size:11px; font-weight:900; }
.sub-card p { margin:5px 0 0; color:var(--muted); font-size:11.5px; }
.sub-card strong { display:block; margin-top:7px; font-size:15px; }
.sub-list.compact { gap:7px; margin:8px 0 2px; }
.sub-list.compact .sub-card { padding:10px 11px; border-radius:14px; box-shadow:none; }
.sub-list.compact .sub-card b { font-size:14px; }
.sub-list.compact .sub-card p { font-size:11px; margin-top:4px; }
.sub-list.compact .sub-card strong { font-size:14px; margin-top:5px; }
html.theme-dark .topup-card {
  background:#191c23;
  color:var(--ink);
}
html.theme-dark .topup-balance,
html.theme-dark .topup-fold,
html.theme-dark .topup-opt,
html.theme-dark .topup-custom,
html.theme-dark .topup-custom-preview,
html.theme-dark .sub-card {
  background:#12151b;
  color:var(--ink);
  border-color:#292d36;
}
html.theme-dark .topup-fold.open,
html.theme-dark .topup-opt.on,
html.theme-dark .sub-card.pay-choice.on {
  background:#20242c;
  border-color:#3a404c;
}
html.theme-dark .topup-plan {
  background:#12151b;
  border-color:#292d36;
  color:var(--ink);
  box-shadow:none;
}
html.theme-dark .topup-plan.on {
  background:#fffde8;
  color:#171812;
  border-color:var(--accent);
  box-shadow:0 0 0 1px rgba(245,248,93,.65) inset, 0 10px 28px rgba(245,248,93,.08);
}
html.theme-dark .topup-plan.on .topup-plan-main b,
html.theme-dark .topup-plan.on .topup-plan-side strong {
  color:#171812;
}
html.theme-dark .topup-plan.on .topup-plan-main small {
  color:#74766b;
}
html.theme-dark .topup-plan.on .topup-plan-side em {
  color:#5f9184;
}
html.theme-dark .topup-plan.on .topup-plan-radio {
  border-color:#aeb04b;
  box-shadow:inset 0 0 0 4px #fffde8;
}
html.theme-dark .topup-fold span,
html.theme-dark .sub-card b,
html.theme-dark .sub-card strong,
html.theme-dark .topup-opt span,
html.theme-dark .topup-opt strong {
  color:var(--ink);
}
html.theme-dark .topup-fold i {
  background:#232731;
  color:var(--ink);
}
html.theme-dark .topup-bonus-lite {
  background:linear-gradient(135deg, rgba(127,170,157,.15), rgba(245,248,93,.09));
  border-color:#334139;
}
html.theme-dark .topup-bonus-ic {
  background:#29271c;
}
html.theme-dark .topup-footer {
  border-top:1px solid #292d36;
  background:linear-gradient(180deg, rgba(25,28,35,0), #191c23 34%);
}
html.theme-dark .topup-cta {
  box-shadow:0 14px 30px rgba(245,248,93,.18);
}
.pay-result-ov {
  position: fixed; inset: 0; z-index: 10000; display: grid; align-items: end; justify-items: center;
  padding: 20px 16px calc(env(safe-area-inset-bottom) + 18px);
  background: rgba(20,22,20,.34); backdrop-filter: blur(12px);
  animation: sheetFade .18s ease both;
}
.pay-result-card {
  position:relative; overflow:hidden; width: min(100%, 390px); background: var(--card); border: 1px solid var(--line);
  border-radius: 30px; padding: 24px 20px 18px; text-align: center;
  box-shadow: 0 28px 90px rgba(0,0,0,.28); animation: payPop .28s cubic-bezier(.2,.86,.2,1) both;
}
.pay-result-glow {
  position:absolute; inset:-80px -40px auto; height:150px; opacity:.52; pointer-events:none;
  background:radial-gradient(circle at 50% 0, rgba(252,253,118,.8), rgba(127,170,157,.18) 44%, transparent 70%);
}
.pay-result-mark {
  position:relative; width: 70px; height: 70px; border-radius: 24px; margin: 0 auto 14px;
  display: grid; place-items: center; font-size: 37px; font-weight: 950;
  box-shadow: 0 12px 28px rgba(0,0,0,.08);
}
.pay-result-mark span { transform:translateY(-1px); }
.pay-result-card.ok .pay-result-mark { background: #e7f2ea; color: #5f9184; }
.pay-result-card.fail .pay-result-mark { background: #fdeceb; color: #c0473e; }
.pay-result-k {
  position:relative; display:inline-flex; align-items:center; justify-content:center; min-height:26px;
  padding:5px 10px; border-radius:999px; background:#f4f3ed; color: var(--link);
  font-size: 11px; font-weight: 950; text-transform: uppercase;
}
.pay-result-card h3 { position:relative; margin: 11px 0 8px; font-size: 25px; line-height: 1.06; }
.pay-result-card p { position:relative; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.43; }
.pay-result-note {
  position:relative; margin-top:14px; border-radius:18px; padding:11px 12px; background:#f8f7f2;
  display:flex; flex-direction:column; gap:3px; text-align:left;
}
.pay-result-note b { font-size:12px; color:var(--ink); }
.pay-result-note span { color:var(--muted); font-size:12px; line-height:1.32; }
.pay-result-btn {
  position:relative; width: 100%; height: 52px; border: 0; border-radius: 18px; margin-top: 16px;
  background: var(--accent); color: var(--accent-ink); font-family: inherit; font-size: 15px; font-weight: 950;
  box-shadow: 0 10px 24px rgba(210,210,80,.28);
}
@keyframes payPop { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
@media (max-height: 760px) {
  .topup-card { max-height: 91dvh; padding-left: 14px; padding-right: 14px; }
  .topup-plan { padding:10px; }
  .topup-opt { min-height: 48px; padding-top: 8px !important; padding-bottom: 8px !important; }
  .topup-card .sheet-title { font-size: 18px; }
  .topup-bonus-lite { padding:9px 10px; margin-bottom:10px; }
}
.profile-sheet { padding: 0; }
.profile-sheet-card {
  max-height: min(92dvh, 760px);
  padding: 8px 18px calc(env(safe-area-inset-bottom) + 14px);
  display: flex; flex-direction: column;
}
.profile-sheet-scroll {
  min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: none;
  overscroll-behavior: contain; padding-bottom: 2px;
}
.profile-sheet-scroll::-webkit-scrollbar { display: none; }
.profile-sheet-cta {
  flex: 0 0 auto; position: sticky; bottom: 0; z-index: 2;
  margin-top: 14px; border-radius: 18px;
}
.profile-sheet .text-in { height: 56px; border-radius: 18px; font-size: 16px; margin-top: 16px; }
.account-link-sheet .sheet-card { padding: 16px 18px calc(env(safe-area-inset-bottom) + 20px); }
.account-link-card { text-align: left; position:relative; }
.account-link-icon {
  width: 48px; height: 48px; border-radius: 16px; margin: 8px 0 14px;
  display:flex; align-items:center; justify-content:center;
  background:#e9f1ec; border:1px solid var(--line);
}
.account-link-copy { font-size:13.5px; line-height:1.45; margin-top:8px; max-width:94%; }
.account-link-fields {
  gap:10px; margin-top:16px; overflow:visible; max-height:none; padding:0;
  display:flex; flex-direction:column;
}
.account-link-fields .text-in { margin-top:0; background:var(--bg); height:54px; border-radius:17px; }
.account-link-code-row {
  display:grid; grid-template-columns:minmax(0,1fr) 74px; gap:8px; align-items:stretch;
}
.account-link-code-row .text-in { min-width:0; }
.account-link-code-btn {
  width:74px; height:54px; border-radius:17px; padding:0; font-size:14px; font-weight:950;
  background:var(--card);
}
.account-link-error { color:#c0473e; font-weight:800; font-size:13px; margin-top:10px; line-height:1.35; }
.account-link-done {
  margin-top:16px; padding:16px; border-radius:18px; text-align:center; font-weight:900;
  display:flex; align-items:center; justify-content:center; gap:8px;
  background:#eef7f2; border:1px solid var(--line);
}
.account-link-cta { margin-top:14px; }
html.theme-dark .account-link-icon,
html.theme-dark .account-link-done {
  background:#18261f;
  border-color:#29362f;
}
html.theme-dark .account-link-fields .text-in,
html.theme-dark .account-link-code-btn {
  background:#12151b;
  border-color:#292d36;
}
.picker-card { padding-bottom: 20px; }
.picker-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px; overflow-y: auto; overflow-x: hidden; padding: 12px 1px 2px;
  scrollbar-width: none;
}
.picker-grid::-webkit-scrollbar { display:none; }
.opt.pick {
  min-height: 72px; border: 1px solid var(--line); border-radius: 15px; padding: 11px 12px;
  background: var(--nav-bg); gap: 8px; box-shadow: none;
}
.opt.pick.on { background: var(--card); border-color: var(--ink); box-shadow: var(--shadow-sm); }
.aspect-mini {
  width: 30px;
  max-height: 42px;
  min-height: 14px;
  flex: 0 0 30px;
  border-radius: 5px;
  border: 2px solid currentColor;
  background: color-mix(in srgb, var(--card) 58%, transparent);
  color: var(--muted);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
.opt.pick.on .aspect-mini { color: var(--ink); background: color-mix(in srgb, var(--accent) 22%, var(--card)); }
.opt.pick .pick-text { min-width: 0; flex: 1; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; }
.opt.pick .o-t { font-size: 14px; line-height: 1.12; white-space: normal; overflow: hidden; text-overflow: clip; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.opt.pick .o-s { font-size: 11.5px; margin-top: 0; white-space: normal; line-height: 1.18; font-weight: 500; text-align: left; max-width: 100%; color: var(--muted); }
.opt.pick .o-price { color: var(--muted); font-size: 11px; font-weight: 700; margin-left: 6px; white-space: nowrap; }
.opt.pick .o-check { margin-left: 0; flex: 0 0 auto; }
@keyframes sheetFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }

.chat-agent-btn {
  margin-left: auto; width: 40px; height: 40px; border-radius: 13px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-sm); color: var(--ink);
}
.agent-sheet { padding: 0; }
.agent-sheet .sheet-card { border-radius: 26px 26px 0 0; padding: 8px 14px calc(env(safe-area-inset-bottom) + 18px); max-height: min(76dvh, 640px); }
.agent-sheet .picker-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.agent-choice {
  border: 1px solid var(--line); border-radius: 15px; background: var(--nav-bg); padding: 9px;
  min-height: 66px; display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto;
  column-gap: 8px; row-gap: 2px; align-items: center; cursor: pointer; text-align: left;
}
.agent-choice.on { background: var(--card); border-color: var(--ink); box-shadow: var(--shadow-sm); }
.agent-choice .a-emoji { grid-row: 1 / 3; width: 34px; height: 34px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 17px; }
.agent-choice .a-name { font-size: 13px; font-weight: 900; line-height: 1.08; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.agent-choice .a-desc { font-size: 10.5px; color: var(--muted); line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chat-settings-card {
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
.chat-settings-head { display: flex; align-items: flex-start; gap: 12px; padding: 4px 0 2px; }
.chat-settings-mark {
  width: 42px; height: 42px; border-radius: 14px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: var(--nav-bg); border: 1px solid var(--line); color: var(--ink);
  font-size: 13px; font-weight: 950;
}
.chat-settings-copy { flex: 1; min-width: 0; }
.chat-settings-sub { color: var(--muted); font-size: 13px; font-weight: 600; line-height: 1.35; margin-top: 4px; }
.chat-settings-close { display: none; }
.chat-settings-body { display: grid; gap: 18px; margin-top: 18px; min-width: 0; overflow-x: hidden; }
.chat-settings-group { min-width: 0; max-width: 100%; background: transparent; overflow: hidden; }
.chat-settings-section { font-weight: 900; font-size: 15px; letter-spacing: -.01em; color: var(--ink); }
.chat-settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; min-width: 0; }
.chat-setting-choice {
  min-height: 52px; border: 1px solid var(--line); border-radius: 16px; background: var(--nav-bg);
  padding: 11px 12px; display: flex; align-items: center; justify-content: flex-start; text-align: left;
  cursor: pointer; color: var(--ink); box-shadow: none; font-family: inherit; min-width: 0;
}
.chat-setting-choice span { display: block; font-size: 13.5px; font-weight: 900; line-height: 1.18; white-space: normal; overflow: visible; text-overflow: clip; word-break: normal; }
.chat-setting-choice.on { background: var(--card); border-color: var(--ink); box-shadow: var(--shadow-sm); }
.chat-setting-choice:active { transform: scale(.985); }
.chat-settings-emoji-grid { margin-top: 10px; }
.chat-settings-text { min-height: 86px; resize: vertical; margin-top: 10px; }
.chat-settings-foot { display: grid; gap: 10px; margin-top: 16px; }
.chat-settings-saved { color: var(--muted); font-size: 13px; font-weight: 700; min-height: 18px; }
.chat-settings-saved.on { color: #6e9f8c; }
html.desktop .chat-settings-ov { align-items:center; padding:24px; z-index:90; }
html.desktop .chat-settings-ov .sheet { max-width:520px; }
html.desktop .chat-settings-ov .sheet-card {
  border-radius:24px; border-bottom:1px solid var(--line);
  padding:10px 18px 18px; box-shadow:0 30px 80px rgba(0,0,0,.26);
  max-height:min(82vh, 720px);
}

/* ── generation spinner ── */
.gen-spinner {
  width: 44px; height: 44px; border-radius: 50%;
  border: 3px solid var(--faint); border-top-color: var(--ink);
  animation: gen-spin .75s linear infinite;
}
@keyframes gen-spin { to { transform: rotate(360deg); } }

/* ── primary buttons ── */
.btn-secondary {
  width: 100%; height: 52px; border-radius: 17px; border: 1.5px solid var(--line);
  background: var(--card); color: var(--ink); font-size: 15px; font-weight: 700;
  font-family: inherit; cursor: pointer;
}
.btn-secondary:active { opacity: .75; }
.btn-secondary:disabled { opacity: .5; cursor: default; }
.btn-primary {
  width: 100%; height: 56px; border-radius: 17px; border: none; font-size: 16px; font-weight: 800;
  color: var(--accent-ink); background: var(--accent); cursor: pointer; font-family: inherit;
  box-shadow: 0 10px 24px rgba(210,210,80,.42);
}
.btn-primary:disabled { background: #eceae3; color: #b3b2a9; box-shadow: none; cursor: default; }
.btn-blue {
  background: var(--accent); color: var(--accent-ink); border: none; border-radius: 13px;
  height: 40px; padding: 0 18px; font-weight: 800; font-size: 14px; cursor: pointer; font-family: inherit;
}

/* ── segmented control ── */
.seg { display: flex; background: var(--nav-bg); border-radius: 15px; padding: 4px; gap: 3px; }
.seg button {
  flex: 1; height: 40px; border: none; background: none; color: var(--muted);
  font-weight: 700; font-size: 13.5px; border-radius: 12px; white-space: nowrap;
  display: flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; font-family: inherit;
}
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 2px 8px rgba(0,0,0,.08); }

/* ── create screen header ── */
.cr-head {
  flex: 0 0 auto; display: flex; align-items: center; gap: 12px; padding: 10px 18px 8px;
  background: var(--bg); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10;
}
.cr-back {
  width: 40px; height: 40px; border-radius: 13px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-sm); cursor: pointer;
}
.cr-title { font-size: 16px; font-weight: 800; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-tok { display: flex; align-items: center; gap: 6px; margin-left: auto; font-weight: 800; font-size: 14px; }
.cr-detail-ic {
  width: 42px; height: 42px; border-radius: 13px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: #f1f0ea; color: #171717;
}
html.theme-dark .cr-detail-ic {
  background: #252a34; color: #f5f2ea; border: 1px solid #343a46;
}

/* ── upload drop zone ── */
.drop-zone {
  border-radius: var(--r); border: 1.5px dashed var(--faint); background: #f8f7f2;
  padding: 22px; text-align: center; cursor: pointer; margin-top: 12px;
}
html.theme-dark .drop-zone,
html.theme-dark .text-in,
html.theme-dark .emoji-cell { background: #12151b; }
html.theme-dark .text-in:focus { background: var(--card); border-color: #454b58; }
html.theme-dark .emoji-cell.on { background: #252a34; border-color: var(--ink); }
.drop-zone .di {
  width: 48px; height: 48px; border-radius: 14px; margin: 0 auto 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--line);
}
.drop-zone .dt { font-weight: 800; font-size: 15px; }
.drop-zone .ds { font-size: 12.5px; font-weight: 500; color: var(--muted); margin-top: 3px; }
.drop-zone.has { padding: 0; overflow: hidden; position: relative; border-style: solid; border-color: var(--line); }
.media-drop { padding: 12px; border-style: solid; }
.media-grid { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.media-chip { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: 12px; background: var(--nav-bg); border: 1px solid var(--line); }
.media-chip img, .media-chip video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-chip b { position: absolute; left: 5px; bottom: 5px; padding: 2px 5px; border-radius: 8px; background: rgba(0,0,0,.56); color: #fff; font-size: 10px; }
.media-chip button { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border: none; border-radius: 50%; background: rgba(0,0,0,.58); color: #fff; font-weight: 900; line-height: 20px; padding: 0; }

.ref-slots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.ref-slot {
  position: relative; min-height: 178px; border-radius: 18px; overflow: hidden; cursor: pointer;
  border: 1.5px dashed var(--line); background: var(--card); box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; justify-content: flex-end;
}
.ref-slot.has { border-style: solid; }
.ref-slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.ref-slot::after { content:""; position:absolute; inset:0; background: linear-gradient(180deg, rgba(0,0,0,0) 36%, rgba(0,0,0,.66)); pointer-events:none; opacity:.9; }
.ref-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--nav-bg); }
.ref-slot button { position:absolute; top:8px; right:8px; z-index:3; width:26px; height:26px; border:0; border-radius:50%; background:rgba(0,0,0,.62); color:#fff; font-size:18px; font-weight:900; line-height:26px; padding:0; }
.ref-caption { position: relative; z-index: 2; padding: 12px; color: #fff; text-shadow: 0 1px 7px rgba(0,0,0,.45); }
.ref-caption b { display:block; font-size:14px; font-weight:900; line-height:1.1; }
.ref-caption span { display:block; margin-top:3px; font-size:11.5px; font-weight:700; opacity:.86; line-height:1.2; }
.ref-uploading { grid-column: 1 / -1; display:flex; align-items:center; justify-content:center; gap:8px; color:var(--muted); font-size:12.5px; font-weight:800; }
.media-add { aspect-ratio: 1; border-radius: 12px; border: 1.5px dashed var(--faint); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 11px; font-weight: 800; }

/* ── profile ── */
.label-sec { color: var(--link); font-weight: 700; font-size: 13px; padding: 4px 2px; }
.muted { color: var(--muted); }
.prow { display: flex; align-items: center; gap: 10px; padding: 13px 2px; cursor: pointer; }
.linkrow { color: var(--link); font-weight: 700; font-size: 15px; padding: 14px 2px; cursor: pointer; }
.switch {
  width: 46px; height: 28px; border-radius: 16px; background: var(--line);
  position: relative; flex: 0 0 auto; transition: background .22s; cursor: pointer;
}
.switch i {
  position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; transition: transform .22s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch.on { background: var(--ink); }
html.theme-dark .switch.on { background: var(--accent); }
html.theme-dark .switch.on i { background: #111318; }
.switch.on i { transform: translateX(18px); }
.text-in {
  width: 100%; height: 50px; border-radius: 14px; border: 1px solid var(--line);
  background: #f8f7f2; color: var(--ink); font-size: 15px; padding: 0 16px;
  outline: none; font-family: inherit; margin-top: 4px;
}
.text-in::placeholder { color: var(--muted); }
.text-in:focus { border-color: #c7c6bd; background: var(--card); }
.emoji-grid { display: grid; grid-template-columns: repeat(8,1fr); gap: 6px; margin-top: 6px; }
.emoji-cell {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: 22px;
  border-radius: 10px; cursor: pointer; background: #f8f7f2; border: 1.5px solid transparent;
}
.emoji-cell.on { border-color: var(--ink); background: #f0efe8; }

/* ── chat overlay ── */
.chat-wrap {
  position: fixed; top: 0; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 100%; height: 100dvh; z-index: 75;
  display: flex; flex-direction: column; background: var(--bg);
}
.chat-top {
  flex: 0 0 auto; display: flex; align-items: center; gap: 11px; padding: 12px 18px;
  padding-top: calc(12px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--line); background: var(--bg);
}
.chat-back {
  width: 40px; height: 40px; border-radius: 13px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-sm); cursor: pointer;
}
.chat-id { display: flex; align-items: center; gap: 10px; }
.chat-av { width: 40px; height: 40px; border-radius: 13px; overflow: hidden; flex: 0 0 auto; }
.chat-av img { width: 100%; height: 100%; object-fit: cover; }
.chat-body { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: none; }
.chat-body::-webkit-scrollbar { display: none; }
.bubble {
  max-width: 80%; padding: 11px 15px; border-radius: 18px; font-size: 15px;
  line-height: 1.48; white-space: normal; overflow-wrap: anywhere; word-break: normal;
}
.bubble.me { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 6px; }
.bubble.bot {
  align-self: flex-start; background: var(--card); border: 1px solid var(--line);
  border-bottom-left-radius: 6px; box-shadow: var(--shadow-sm); color: var(--ink);
}
.bubble.bot.err { background: #fef0ee; border-color: #f5c0ba; color: #a83428; }
.chat-md { display: grid; gap: 9px; min-width: 0; }
.chat-md-p { margin: 0; white-space: pre-line; }
.chat-md-list { display: grid; gap: 7px; margin: 0; padding-left: 19px; }
.chat-md-list li { padding-left: 2px; }
.chat-md-quote {
  margin: 0; padding-left: 11px; border-left: 3px solid var(--line);
  color: var(--muted); white-space: pre-line;
}
.chat-md strong { font-weight: 900; color: inherit; }
.chat-md code {
  display: inline-block; padding: 1px 6px; border-radius: 7px;
  background: rgba(0,0,0,.06); color: inherit; font-family: inherit; font-weight: 800;
}
.bubble.me .chat-md-quote { color: inherit; opacity: .82; border-color: rgba(255,255,255,.38); }
.bubble.me .chat-md code { background: rgba(255,255,255,.16); }
html.theme-dark .bubble.me { background: #f2f4f8; color: #111318; }
html.theme-dark .bubble.bot { background: #12151b; border-color: #2a303a; color: #f2f4f8; }
html.theme-dark .bubble.bot.err { background: rgba(168,52,40,.16); border-color: rgba(245,120,105,.32); color: #ffb5aa; }
html.theme-dark .bubble.bot .chat-md-quote { border-color: #343a46; color: #aab2bf; }
html.theme-dark .bubble.me .chat-md-quote { border-color: rgba(17,19,24,.28); }
html.theme-dark .bubble.me .chat-md code { background: rgba(17,19,24,.09); }
html.theme-dark .bubble.bot .chat-md code { background: rgba(255,255,255,.08); }
.bubble.typing { display: flex; gap: 5px; align-items: center; padding: 14px 16px; }
.bubble.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); animation: tdot 1.2s infinite; }
.bubble.typing span:nth-child(2) { animation-delay: .2s; }
.bubble.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes tdot { 0%,60%,100%{opacity:.4;transform:translateY(0)} 30%{opacity:1;transform:translateY(-3px)} }
.chat-input { flex: 0 0 auto; padding: 10px 18px calc(env(safe-area-inset-bottom) + 14px); }

/* ── misc ── */
.chev { color: var(--faint); display: flex; }
.pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 16px; border-radius: 15px;
  background: var(--card); color: var(--ink); font-size: 14.5px; font-weight: 700;
  border: 1px solid var(--line); cursor: pointer; box-shadow: var(--shadow-sm);
}
.pill:active { transform: scale(.96); }
.scr-enter { animation: scrUp .3s cubic-bezier(.2,.85,.25,1) both; }
@keyframes scrUp { from { transform: translateY(12px); } to { transform: none; } }
.rise { animation: rise .48s cubic-bezier(.2,.85,.25,1) both; animation-delay: var(--d, 0s); }
@keyframes rise { from { transform: translateY(14px); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .scr-enter, .bubble, .rise, .mob-swipe-stage { animation: none !important; } }

/* ══ Telegram fullscreen: 100px safe area at top ═══════════════ */
.tg-fs {
  min-height: var(--hbx-tg-vh, 100dvh);
  height: var(--hbx-tg-vh, 100dvh);
  overflow: hidden;
  background: var(--bg);
}
.tg-fs #root,
.hbx-tg-fullscreen #root,
.tg-fs .phone,
.hbx-tg-fullscreen .phone {
  min-height: var(--hbx-tg-vh, 100dvh);
  height: var(--hbx-tg-vh, 100dvh);
}
.tg-fs .topnav {
  padding-top: max(env(safe-area-inset-top, 0px), 16px);
}
.tg-fs .chat-top {
  padding-top: max(calc(12px + env(safe-area-inset-top)), 20px);
}
.tg-fs .cr-head {
  padding-top: max(calc(10px + env(safe-area-inset-top)), 18px);
}
.tg-fs.tg-fullscreen .topnav {
  padding-top: max(env(safe-area-inset-top, 0px), var(--hbx-tg-safe-top, 0px), 100px);
}
.tg-fs.tg-fullscreen .chat-top {
  padding-top: max(calc(12px + env(safe-area-inset-top)), calc(12px + var(--hbx-tg-safe-top, 0px)), 112px);
}
.tg-fs.tg-fullscreen .cr-head {
  padding-top: max(calc(10px + env(safe-area-inset-top)), calc(10px + var(--hbx-tg-safe-top, 0px)), 110px);
}

/* ══ Desktop layout — browser ≥768px OR Telegram PC ═══════════════
   html.desktop class is toggled by JS (index.html init script).
   Triggered by: viewport ≥768px in browser, OR tdesktop/macos
   platform in Telegram.
══════════════════════════════════════════════════════════════════ */
html.desktop #root { align-items: flex-start; }

html.desktop .phone {
  max-width: 100%; min-height: 100dvh;
  box-shadow: 0 0 0 1px var(--line);
}

/* Screen wrapper: column → row */
html.desktop .phone > div:first-child {
  flex-direction: row !important;
  height: 100dvh !important;
  overflow: hidden;
}

/* ── Left sidebar nav ── */
html.desktop .topnav {
  width: 220px; min-width: 220px; flex-direction: column;
  height: 100dvh; position: sticky; top: 0;
  border-bottom: none; border-right: 1px solid var(--line);
  padding: 28px 14px 24px; gap: 14px; align-items: stretch;
  overflow-y: auto;
}
html.desktop .tn-seg {
  flex-direction: column; border-radius: 16px; padding: 5px; gap: 3px;
}
html.desktop .tn-item {
  height: 44px; border-radius: 13px; font-size: 14px;
  justify-content: flex-start; padding: 0 16px; flex: 0 0 auto;
}
html.desktop .tn-icon { margin-top: auto; }

/* ── Scrollable content area ── */
html.desktop .screen {
  flex: 1; height: 100dvh; overflow-y: auto;
  max-width: 760px; padding: 0 40px 48px;
}

/* ── Chat overlay: shift right of sidebar ── */
html.desktop .chat-wrap {
  left: 220px; width: calc(100vw - 220px);
  max-width: none; transform: none;
}

/* ── Bottom sheet: centered ── */
html.desktop .sheet { max-width: 480px; margin: 0 auto; }

/* ── Wider content ── */
html.desktop .act-grid { grid-template-columns: repeat(4, 1fr); }
html.desktop .idea-grid { grid-template-columns: repeat(4, 1fr); }
html.desktop .greeting { font-size: 34px; margin-top: 32px; }
html.desktop .askbar { height: 62px; border-radius: 22px; }

/* ============================================================
   Hubicx — staged-canvas "момент генерации" (H1 «Холст»)
   ============================================================ */
.gen-canvas, .dk-stage{position:relative;width:100%;border-radius:18px;overflow:hidden;margin-top:8px;background:#ecebe5;border:1px solid var(--line)}
.gen-canvas{min-height:220px}.gen-result-canvas{aspect-ratio:1/1;min-height:0;max-height:420px}
.gen-skel{position:absolute;inset:0;overflow:hidden}
.gen-skel::before{content:"";position:absolute;left:8%;top:12%;width:52%;height:62%;border-radius:50%;background:rgba(127,170,157,.4);filter:blur(28px);animation:genBlobA 4.2s ease-in-out infinite}
.gen-skel::after{content:"";position:absolute;right:4%;bottom:6%;width:56%;height:60%;border-radius:50%;background:rgba(182,181,230,.46);filter:blur(30px);animation:genBlobB 5s ease-in-out infinite;transform:none}
@keyframes genBlobA{0%,100%{transform:translate(0,0) scale(1)}50%{transform:translate(26px,-14px) scale(1.18)}}
@keyframes genBlobB{0%,100%{transform:translate(0,0) scale(1.1)}50%{transform:translate(-22px,16px) scale(.94)}}
.gen-media{position:absolute; inset:0; width:100%; height:100%; object-fit:contain;
  opacity:0; filter:blur(16px) saturate(.6); transform:scale(1.06);
  transition:opacity .9s ease, filter 1.1s ease, transform 1.1s ease; background:rgba(0,0,0,.04);}
.gen-media.in{opacity:1; filter:blur(0) saturate(1); transform:scale(1);}
.gen-grain{position:absolute;inset:0;opacity:.6;pointer-events:none;mix-blend-mode:normal;background-image:radial-gradient(rgba(28,28,26,.05) 1px,transparent 1px);background-size:3px 3px}
.gen-ring{position:absolute;inset:0;display:grid;place-items:center;pointer-events:none}.gen-ring::after{content:"";width:46px;height:46px;border-radius:50%;border:2.5px solid rgba(28,28,26,.14);border-top-color:#1c1c1a;animation:ctaSpin 1s linear infinite}
.gen-stages{display:flex; gap:5px; margin-top:12px;}
.gen-chip{flex:1;height:5px;border-radius:3px;background:var(--line,#e9e8e3);overflow:hidden}
.gen-chip i{display:block; height:100%; width:0; border-radius:3px;
  background:linear-gradient(90deg,#7faa9d,#b6b5e6); transition:width .4s ease;}
.gen-chip.done i{width:100%;}
.gen-chip.act i{width:60%; animation:genChipPulse 1.1s ease-in-out infinite;}
@keyframes genChipPulse{0%,100%{opacity:.7}50%{opacity:1}}
.gen-stagerow{display:flex; align-items:center; justify-content:space-between; margin-top:10px; gap:12px;}
.gen-stage-l{display:flex; align-items:center; gap:8px; font-size:14px; font-weight:700;}
.gen-dot{width:7px;height:7px;border-radius:50%;background:#7faa9d;box-shadow:0 0 0 0 rgba(127,170,157,.5);animation:genPing 1.4s ease-out infinite}
@keyframes genPing{0%{box-shadow:0 0 0 0 rgba(127,170,157,.5)}100%{box-shadow:0 0 0 9px rgba(127,170,157,0)}}
.gen-eta{font-size:13px;color:var(--muted,#8d8d87);font-variant-numeric:tabular-nums;white-space:nowrap}.hist-thumb .gen-ring::after{width:28px;height:28px;border-width:2px}
@media (prefers-reduced-motion:reduce){
  .gen-skel::before,.gen-skel::after,.gen-chip.act i,.gen-dot,.gen-ring::after{animation:none}
  .gen-media{transition:none; opacity:1; filter:none; transform:none}
}

/* ============================================================
   Hubicx onboarding v1
   ============================================================ */
.onb, .mob-onb { position: fixed; inset: 0; z-index: 9999; pointer-events: none; font-family: inherit; }
.onb-dim, .mob-onb-dim { position: absolute; inset: 0; background: transparent; backdrop-filter: none; pointer-events: auto; }
.onb-spot {
  position: absolute; border-radius: 22px; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(8,10,14,.56), 0 0 0 2px rgba(252,253,118,.95), 0 22px 60px rgba(0,0,0,.28);
  background: transparent; transition: left .42s cubic-bezier(.16,1,.3,1), top .42s cubic-bezier(.16,1,.3,1), width .42s cubic-bezier(.16,1,.3,1), height .42s cubic-bezier(.16,1,.3,1), opacity .24s ease;
  will-change: left, top, width, height;
}
.onb-card {
  position: absolute; width: min(360px, calc(100vw - 32px)); pointer-events: auto;
  background: var(--card); color: var(--ink); border: 1px solid var(--line);
  border-radius: 24px; padding: 22px; box-shadow: 0 28px 90px rgba(0,0,0,.24);
}
.onb-card h3, .mob-onb-sheet h3 { margin: 6px 0 8px; font-size: 22px; line-height: 1.08; letter-spacing: -.03em; }
.onb-card p, .mob-onb-sheet p { color: var(--muted); font-size: 14px; line-height: 1.48; }
.onb-kicker, .mob-onb-k { color: var(--link); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.onb-dots, .mob-onb-dots { display: flex; gap: 6px; margin: 18px 0 16px; }
.onb-dots i, .mob-onb-dots i { width: 7px; height: 7px; border-radius: 99px; background: var(--line); transition: width .28s cubic-bezier(.16,1,.3,1), background .22s ease, opacity .22s ease; }
.onb-dots i.on, .mob-onb-dots i.on { width: 22px; background: var(--accent); }
.onb-actions, .mob-onb-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.onb-actions button, .mob-onb-actions button { border: 0; border-radius: 13px; height: 40px; padding: 0 15px; font-family: inherit; font-weight: 900; cursor: pointer; transition: transform .16s cubic-bezier(.16,1,.3,1), background .2s ease, opacity .2s ease, box-shadow .2s ease; }
.onb-actions button:active, .mob-onb-actions button:active { transform: scale(.96); }
.onb-ghost, .mob-onb-ghost { background: var(--nav-bg); color: var(--muted); }
.onb-primary, .mob-onb-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 20px rgba(210,210,80,.26); }
html.theme-dark .onb-card, html.theme-dark .mob-onb-sheet { background: #191c23; border-color: #292d36; }
html.theme-dark .onb-ghost, html.theme-dark .mob-onb-ghost { background: #252a34; color: #c4cad4; }

.mob-onb { display: flex; align-items: flex-end; justify-content: center; }
.mob-onb-spot { border-radius: 20px; }
.mob-onb-sheet {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: min(100%, 430px); pointer-events: auto; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-bottom: 0; border-radius: 28px 28px 0 0;
  padding: 22px 20px calc(env(safe-area-inset-bottom) + 20px); box-shadow: 0 -18px 70px rgba(0,0,0,.24);
  max-height: min(50dvh, 390px); overflow: auto; scrollbar-width: none;
  animation: mobSheetIn .46s cubic-bezier(.16,1,.3,1);
  will-change: transform, opacity;
  transform-origin: bottom center;
}
.mob-onb-sheet::-webkit-scrollbar { display:none; }
.mob-onb-sheet-spot { margin: 0; border-radius: 28px 28px 0 0; }
.mob-onb-x { position: absolute; top: 12px; right: 12px; z-index: 2; width: 34px; height: 34px; border: 0; border-radius: 12px; background: var(--nav-bg); color: var(--muted); font-size: 22px; line-height: 1; transition: transform .16s cubic-bezier(.16,1,.3,1), opacity .2s ease; }
.mob-onb-x:active { transform: scale(.94); }
.mob-onb-content { animation: mobOnbContentNext .34s cubic-bezier(.16,1,.3,1) both; }
.mob-onb-sheet.is-back .mob-onb-content { animation-name: mobOnbContentBack; }
.mob-onb-ic { width: 52px; height: 52px; border-radius: 18px; display: grid; place-items: center; font-size: 26px; background: var(--soft); margin-bottom: 12px; transform-origin: center; animation: mobOnbIconPop .38s cubic-bezier(.16,1,.3,1) both; }
@keyframes mobSheetIn { from { transform: translateX(-50%) translateY(34px) scale(.985); opacity: 0; } to { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; } }
@keyframes mobOnbContentNext { from { opacity: 0; transform: translateX(18px) translateY(4px); filter: blur(4px); } to { opacity: 1; transform: translateX(0) translateY(0); filter: blur(0); } }
@keyframes mobOnbContentBack { from { opacity: 0; transform: translateX(-18px) translateY(4px); filter: blur(4px); } to { opacity: 1; transform: translateX(0) translateY(0); filter: blur(0); } }
@keyframes mobOnbIconPop { 0% { opacity: 0; transform: scale(.86) rotate(-2deg); } 100% { opacity: 1; transform: scale(1) rotate(0); } }

@media (prefers-reduced-motion: reduce) {
  .onb-spot, .mob-onb-sheet, .mob-onb-content, .mob-onb-ic, .mob-onb-actions button, .mob-onb-dots i {
    animation: none !important;
    transition: none !important;
  }
}

.bonus-toast-top {
  position: fixed; left: 14px; right: 14px; top: max(76px, calc(env(safe-area-inset-top) + 54px));
  z-index: 90; display: flex; align-items: center; gap: 10px; min-height: 64px;
  padding: 10px 10px 10px 12px; border-radius: 22px; color: #fff;
  background: rgba(28,28,26,.94); box-shadow: 0 18px 50px rgba(0,0,0,.26);
  backdrop-filter: blur(14px); animation: bonusToastIn .38s cubic-bezier(.2,.86,.2,1) both;
}
.bonus-toast-ic { width: 40px; height: 40px; border-radius: 14px; display:grid; place-items:center; background: rgba(255,255,255,.12); font-size: 20px; flex: 0 0 auto; }
.bonus-toast-copy { min-width: 0; flex: 1; display:flex; flex-direction:column; gap:2px; }
.bonus-toast-copy b { font-size: 14px; line-height: 1.1; }
.bonus-toast-copy span { font-size: 12px; color: rgba(255,255,255,.72); }
.bonus-toast-main { border:0; border-radius:14px; padding:9px 12px; background:#fff; color:#1c1c1a; font-family:inherit; font-weight:950; font-size:13px; }
.bonus-toast-x { width:30px; height:30px; border:0; border-radius:11px; background:rgba(255,255,255,.10); color:#fff; font-size:18px; line-height:1; }

.gen-toast-top {
  position: fixed;
  z-index: 80;
  left: 16px;
  right: 16px;
  top: max(18px, calc(env(safe-area-inset-top) + 12px));
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 12px;
  border-radius: 22px;
  background: rgba(26, 28, 32, .92);
  color: #fff;
  box-shadow: 0 18px 48px rgba(0,0,0,.22);
  backdrop-filter: blur(18px);
  animation: genToastIn .34s cubic-bezier(.2,.9,.2,1) both;
}
.tg-fs .gen-toast-top,
.hbx-tg-fullscreen .gen-toast-top {
  top: max(104px, calc(var(--hbx-tg-safe-top, 0px) + 18px));
}
.gen-toast-ic {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: rgba(255,255,255,.12);
  font-size: 19px;
}
.gen-toast-copy {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.gen-toast-copy b { font-size: 14px; line-height: 1.1; }
.gen-toast-copy span { font-size: 12px; line-height: 1.18; color: rgba(255,255,255,.72); }
.gen-toast-main {
  border: 0;
  border-radius: 14px;
  padding: 9px 12px;
  background: #f5ff4f;
  color: #161712;
  font-family: inherit;
  font-weight: 950;
  font-size: 13px;
}
.gen-toast-x {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 11px;
  background: rgba(255,255,255,.10);
  color: #fff;
  font-size: 18px;
  line-height: 1;
}
@keyframes genToastIn {
  from { opacity: 0; transform: translateY(-12px) scale(.98); }
  to { opacity: 1; transform: none; }
}

.gen-queue-screen {
  padding-top: 18px !important;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}
.gen-queue-card {
  width: 100%;
  min-height: 210px;
  border-radius: 28px;
  border: 1px solid var(--line);
  background: var(--card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 28px 20px;
  box-shadow: var(--shadow-sm);
}
.gen-queue-card h3 {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.05;
}
.gen-queue-card p {
  margin: 0;
  max-width: 280px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
}
html.theme-dark .gen-queue-card {
  background: #171b22;
  border-color: #2b303a;
}
@keyframes bonusToastIn { from { opacity:0; transform: translateY(-14px) scale(.985); } to { opacity:1; transform: translateY(0) scale(1); } }

@media (max-width: 720px) {
  .onb-card { left: 16px !important; right: 16px; top: auto !important; bottom: 16px; }
}

/* Hubicx UI patch: interaction tokens, chips and dismissible sheets. */
.bb,.sheet-cta,.mob-onb-primary,.mob-onb-ghost,.topup-plan,.row-link,.bonus-act-v2 button,.bonus-act-v2 a{transition:transform .12s cubic-bezier(.2,.85,.25,1),box-shadow .12s ease}
.bb:active,.mob-onb-ghost:active,.bonus-act-v2 button:active,.bonus-act-v2 a:active{transform:scale(.96)}
.sheet-cta:active,.mob-onb-primary:active,.topup-plan:active,.row-link:active{transform:scale(.98);box-shadow:0 3px 10px rgba(210,210,80,.25)}
.hist-card,.opt{transition:transform .12s cubic-bezier(.2,.85,.25,1),background .12s}.hist-card:active,.opt:active{transform:scale(.98)}
.tn-item{transition:transform .12s cubic-bezier(.2,.85,.25,1),background .18s,color .18s}.tn-item:active{transform:scale(.95)}
.cta-spin{width:18px;height:18px;border-radius:50%;border:2.5px solid rgba(28,28,26,.25);border-top-color:#1c1c1a;animation:ctaSpin .75s linear infinite;display:inline-block}
@keyframes ctaSpin{to{transform:rotate(360deg)}}.cta-done-pop{animation:ctaCheckPop .3s cubic-bezier(.34,1.56,.64,1) both}@keyframes ctaCheckPop{0%{transform:scale(.4);opacity:0}70%{transform:scale(1.12)}100%{transform:scale(1);opacity:1}}
.hx-chip{display:inline-flex;align-items:center;gap:6px;border-radius:999px;font-weight:900;white-space:nowrap;border:1px solid transparent;letter-spacing:-.01em}.hx-chip--l{height:34px;padding:0 13px;font-size:13px}.hx-chip--s{height:24px;padding:0 9px;font-size:11px;gap:4px}.hx-chip--sage{background:rgba(127,170,157,.16);color:#4d7d70;border-color:rgba(127,170,157,.36)}.hx-chip--lilac{background:rgba(182,181,230,.22);color:#54529e;border-color:rgba(182,181,230,.45)}.hx-chip--accent{background:#fcfd76;color:#454629;border-color:rgba(0,0,0,.06)}.hx-chip--neutral{background:#f5f4ee;color:#6b6b64;border-color:var(--line,#e9e8e3)}.hx-chip--ink{background:#1c1c1a;color:#f3f2ee;border-color:#1c1c1a}
.sheet-ov{animation:sheetFade .26s ease both}.sheet-ov.hx-closing{animation:sheetFadeOut .3s ease both}@keyframes sheetFadeOut{from{opacity:1}to{opacity:0}}.sheet-card{animation:sheetUp .38s cubic-bezier(.16,1,.3,1) both}.sheet-card.hx-dragging{animation:none;transition:none}.sheet-card.hx-settling{animation:none;transition:transform .3s cubic-bezier(.16,1,.3,1)}.sheet-card.hx-out{animation:none;transition:transform .3s cubic-bezier(.4,0,1,1);transform:translateY(104%)!important}.sheet-grab{width:38px;height:4px;border-radius:2px;background:#d8d7cf;margin:8px auto 14px}.sheet-grab-zone{touch-action:none;cursor:grab;margin:-8px -18px 0;padding:8px 18px 0}
html.theme-dark .hx-chip--neutral{background:#20242c;color:#c5c7ce;border-color:#343946}html.theme-dark .gen-canvas{background:#20242a}

/* ── Profile sections: Аккаунт / Партнёрство ── */
.pf-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 14px;
  border-radius: 16px; background: var(--nav-bg); border: 1px solid var(--line);
}
.pf-tab {
  height: 42px; border: none; border-radius: 12px; background: transparent; color: var(--muted);
  font: inherit; font-size: 14.5px; font-weight: 750; cursor: pointer; transition: background .18s var(--ease), color .18s var(--ease);
}
.pf-tab.on { background: var(--nav-active); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ── Partner program ── */
.pt-loading { padding: 28px 18px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.pt-loading .btn-secondary { max-width: 200px; }
.pt-hero, .pt-link-card, .pt-balance-card, .pt-ops, .pt-how { padding: 18px; margin-bottom: 14px; }
.pt-hero-title { font-size: 19px; font-weight: 850; letter-spacing: -.02em; }
.pt-hero-sub { color: var(--muted); font-size: 13.5px; line-height: 1.45; margin-top: 6px; }
.pt-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.pt-stat {
  padding: 13px 14px; border-radius: 15px; border: 1px solid var(--line); background: var(--bg);
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
}
.pt-stat span { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.pt-stat b { font-size: 20px; font-weight: 850; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-stat.accent { border-color: rgba(247,248,108,.35); }
.pt-stat.accent b { color: var(--accent); }
.pt-note { display: flex; align-items: center; gap: 7px; margin-top: 12px; color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.pt-k { color: var(--muted); font-size: 12px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px; }
.pt-link {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); font: inherit; font-size: 14px; text-align: left; cursor: pointer;
  overflow-wrap: anywhere;
}
.pt-actions, .pt-balance-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.pt-btn { display: flex; align-items: center; justify-content: center; gap: 8px; }
.pt-balance-actions .btn-primary, .pt-balance-actions .btn-secondary, .pt-btn { height: 50px; font-size: 15px; }
.pt-balance { font-size: 32px; font-weight: 900; letter-spacing: -.03em; }
.pt-balance-note { color: var(--muted); font-size: 13px; margin-top: 4px; }
.pt-balance-note b { color: var(--ink); }
.pt-mini-stats { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 14px; color: var(--muted); font-size: 12.5px; }
.pt-mini-stats b { color: var(--ink); }
.pt-op { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.pt-op:first-of-type { border-top: none; }
.pt-op-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pt-op-main b { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-op-main span { color: var(--muted); font-size: 12px; }
.pt-op strong { font-size: 14.5px; white-space: nowrap; }
.pt-step { display: flex; gap: 12px; align-items: flex-start; padding: 7px 0; font-size: 13.5px; line-height: 1.45; }
.pt-step i {
  flex: 0 0 auto; width: 24px; height: 24px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-style: normal; font-size: 12.5px; font-weight: 850; color: var(--accent-ink); background: var(--accent);
}
.pt-sheet-sub { color: var(--muted); font-size: 13px; line-height: 1.45; margin: 4px 0 14px; }
.pt-field { display: block; margin-bottom: 12px; }
.pt-field > span { display: block; color: var(--muted); font-size: 12.5px; font-weight: 650; }
.pt-input-wrap { position: relative; }
.pt-input-wrap em { position: absolute; right: 16px; top: 50%; transform: translateY(-38%); font-style: normal; color: var(--muted); font-weight: 700; }
.pt-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 12px; border-radius: 14px; background: var(--nav-bg); border: 1px solid var(--line); }
.pt-seg-item { height: 38px; border: none; border-radius: 10px; background: transparent; color: var(--muted); font: inherit; font-weight: 750; cursor: pointer; }
.pt-seg-item.on { background: var(--nav-active); color: var(--ink); }
.topup-cta-partner { margin-bottom: 8px; background: transparent !important; color: var(--ink) !important; border: 1px solid rgba(247,248,108,.5) !important; box-shadow: none !important; }


/* ── Top bar: home icon + balance pill ── */
.tn-item-icon { flex: 0 0 52px; }
.tn-balance {
  flex: 0 0 auto; height: 42px; padding: 0 14px; border-radius: 13px;
  display: flex; align-items: center; gap: 7px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  color: var(--ink); font: inherit; font-size: 15px; font-weight: 800; cursor: pointer;
}
.tn-balance:active { transform: scale(.97); }

/* ── Chat balance in the chat header ── */
.chat-credits {
  height: 32px; padding: 0 10px; border-radius: 10px; display: flex; align-items: center; gap: 6px;
  background: var(--card); border: 1px solid var(--line); color: var(--ink);
  font: inherit; font-size: 13px; font-weight: 800; cursor: pointer; white-space: nowrap;
}
.chat-credits.empty { color: var(--muted); }
