/* Цвета и тексты — в config.py (BRAND.colors). Здесь значения по умолчанию. */
:root {
  --accent: #34c37a; --accent-dark: #1f9e5c; --accent-soft: #e8f7ee;
  --bg: #ffffff; --surface: #f5faf7; --text: #14221a; --muted: #7d8f85;
  --border: #e1eee6; --danger: #e5484d; --warn: #c98a12;
  --r-xl: 26px; --r-lg: 22px; --r-md: 16px; --r-sm: 12px;
  --nav-h: 68px;
  --shadow: 0 8px 28px rgba(31, 158, 92, .09);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body {
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px; line-height: 1.4; overscroll-behavior: none; -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(520px 260px at 85% -40px, rgba(52,195,122,.16), transparent 70%),
    radial-gradient(420px 220px at -10% 110px, rgba(52,195,122,.08), transparent 70%),
    var(--bg);
  background-repeat: no-repeat;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ───── каркас ───── */
.app { display: flex; flex-direction: column; height: 100dvh; }
.top { display: flex; align-items: center; justify-content: center; padding: 12px 20px 6px; }
.top .brand { height: 58px; width: auto; max-width: 82%; object-fit: contain; display: block; }
.page { flex: 1; overflow-y: auto; padding: 6px 20px calc(var(--nav-h) + 44px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }
.page.chat { display: flex; flex-direction: column; overflow: hidden; padding-bottom: calc(var(--nav-h) + 30px + env(safe-area-inset-bottom)); }
h1 { font-size: 28px; line-height: 1.12; margin: 10px 0 6px; font-weight: 800; letter-spacing: -.025em; }
h2 { font-size: 17px; margin: 24px 0 10px; font-weight: 800; letter-spacing: -.01em; }
.sub { color: var(--muted); margin: 0 0 20px; }

/* ───── нижняя панель: плавающая «таблетка» ───── */
.nav {
  position: fixed; left: 14px; right: 14px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 10;
  display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: end; height: var(--nav-h);
  background: rgba(255,255,255,.92); border: 1px solid var(--border); border-radius: 30px;
  box-shadow: 0 10px 34px rgba(20, 60, 40, .12); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 0 11px; color: var(--muted); font-size: 12px; font-weight: 700; transition: color .15s; }
.tab svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab.on { color: var(--accent-dark); }
.tab.mid { padding-top: 0; color: var(--accent-dark); }
.tab.mid i {
  display: grid; place-items: center; width: 62px; height: 62px; margin-top: -30px; border-radius: 50%;
  background: linear-gradient(145deg, #4bd98f, var(--accent-dark)); color: #fff; border: 5px solid #fff;
  box-shadow: 0 10px 24px rgba(31,158,92,.45); transition: transform .15s;
}
.tab.mid:active i { transform: scale(.93); }
.tab.mid svg { width: 28px; height: 28px; stroke-width: 2.6; }

/* ───── кнопки и поля ───── */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  height: 54px; border-radius: 18px; color: #fff; font-weight: 800; font-size: 16px;
  background: linear-gradient(145deg, #3fcf85, var(--accent-dark)); box-shadow: 0 8px 20px rgba(31,158,92,.28);
  transition: transform .1s, box-shadow .15s;
}
.btn:active { transform: scale(.985); box-shadow: 0 4px 10px rgba(31,158,92,.25); }
.btn:disabled { opacity: .5; }
.btn.soft { background: var(--accent-soft); color: var(--accent-dark); box-shadow: none; }
.btn.sm { height: 46px; font-size: 14px; border-radius: 14px; width: auto; padding: 0 16px; flex: none; }
a.btn { text-decoration: none; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--accent-dark); font-weight: 700; padding: 6px 0; }

.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 700; margin-bottom: 7px; }
.hint { color: var(--muted); font-size: 13px; margin-top: 6px; }
.hint.ok { color: var(--accent-dark); font-weight: 600; }
.hint.bad { color: var(--danger); font-weight: 600; }
textarea, input[type=text] {
  width: 100%; padding: 14px 16px; border: 1.5px solid var(--border); border-radius: 16px;
  background: #fff; resize: none; outline: none; font-weight: 500; transition: border-color .15s, box-shadow .15s;
}
textarea::placeholder, input[type=text]::placeholder { color: #b3c2b9; font-weight: 500; }
textarea:focus, input[type=text]:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.pick {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 16px; text-align: left;
  border: 1.5px dashed var(--accent); border-radius: 18px; background: var(--accent-soft); color: var(--accent-dark); font-weight: 700;
}
.pick svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.picked { margin-top: 8px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.picked div { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; background: #fff; border: 1px solid var(--border); border-radius: var(--r-sm); font-size: 14px; font-weight: 600; }
.picked div { min-width: 0; }
.picked span { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picked button { color: var(--muted); font-size: 20px; line-height: 1; }

/* ───── цена и промокод ───── */
.price { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 12px; padding: 16px 18px; border-radius: var(--r-lg); background: linear-gradient(150deg, var(--accent-soft), #fff); border: 1.5px solid var(--border); }
.price small { color: var(--muted); font-weight: 600; }
.price b { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.price s { color: var(--muted); margin-left: 6px; font-weight: 600; }
.chip { padding: 5px 12px; border-radius: 99px; background: var(--accent); color: #fff; font-weight: 800; font-size: 13px; }
.chip[hidden] { display: none; }
.promo { display: flex; gap: 8px; }
.promo input { flex: 1; min-width: 0; }
#go { margin-top: 18px; }

/* ───── методы ───── */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.card {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-height: 150px; padding: 16px;
  text-align: left; border: 1.5px solid var(--border); border-radius: var(--r-xl); background: #fff;
}
.card .ic { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 10px; border-radius: 16px; background: #fff; font-size: 24px; box-shadow: 0 4px 14px rgba(31,158,92,.16); }
.card b { font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.card small { color: var(--muted); font-size: 13px; line-height: 1.3; font-weight: 500; }
.card.open { background: linear-gradient(155deg, var(--accent-soft), #fff 78%); border-color: rgba(52,195,122,.55); box-shadow: var(--shadow); transition: transform .12s; }
.card.open:active { transform: scale(.975); }
.card.locked { border-style: dashed; background: var(--surface); }
.card.locked .ic { box-shadow: none; background: transparent; border: 1.5px solid var(--border); }
.card.locked b, .card.locked small { opacity: .6; }
.card.locked .ic svg { width: 22px; height: 22px; stroke: var(--muted); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ───── оплата и ожидание ───── */
.run, .pay { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; padding-top: 10vh; }
.pay .btn { max-width: 340px; }
.pay h1 { margin: 0; }
.pay .sub { margin: 0; max-width: 320px; }
.coin { display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%; font-size: 40px; font-weight: 800; color: #fff; background: linear-gradient(145deg, #4bd98f, var(--accent-dark)); box-shadow: 0 14px 30px rgba(31,158,92,.35); }
.wait { display: flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 600; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(.7); opacity: .5; } 50% { transform: scale(1.2); opacity: 1; } }
.spin { width: 56px; height: 56px; border-radius: 50%; border: 5px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ───── результат ───── */
.shots { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.shot { border: 1.5px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: #fff; box-shadow: var(--shadow); }
.shot img { display: block; width: 100%; aspect-ratio: 16/9; object-fit: cover; background: var(--surface); }
.shot .row { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 8px 6px 8px 12px; font-size: 13px; font-weight: 600; }
.shot .row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 11px; background: var(--accent-soft); color: var(--accent-dark); }
.dl svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.txt { margin-top: 14px; border: 1.5px solid var(--border); border-radius: var(--r-md); background: #fff; overflow: hidden; box-shadow: var(--shadow); }
.txt .head { display: flex; align-items: center; justify-content: space-between; padding: 10px 8px 10px 16px; font-weight: 800; }
.txt pre {
  margin: 0; padding: 14px 16px; max-height: 260px; overflow: auto; border-top: 1px solid var(--border);
  font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-word; user-select: text;
  cursor: copy; background: var(--surface);
}
.txt pre:active { background: var(--accent-soft); }
.actions { display: grid; gap: 10px; margin-top: 18px; }

/* ───── профиль ───── */
.me { display: flex; align-items: center; gap: 16px; padding: 20px; border-radius: var(--r-xl); background: linear-gradient(150deg, var(--accent-soft), #fff); border: 1.5px solid var(--border); box-shadow: var(--shadow); }
.ava { display: grid; place-items: center; width: 68px; height: 68px; flex: none; border-radius: 50%; background: linear-gradient(145deg, #4bd98f, var(--accent-dark)); color: #fff; font-size: 28px; font-weight: 800; overflow: hidden; border: 3px solid #fff; box-shadow: 0 6px 16px rgba(31,158,92,.3); }
.ava img { width: 100%; height: 100%; object-fit: cover; }
.me b { display: block; font-size: 19px; font-weight: 800; }
.me span { color: var(--muted); font-size: 14px; font-weight: 500; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.stat { padding: 16px; border-radius: var(--r-lg); background: #fff; border: 1.5px solid var(--border); }
.stat b { display: block; font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.stat:last-child b { font-size: 16px; padding-top: 6px; line-height: 1.2; }
.stat span { color: var(--muted); font-size: 13px; font-weight: 600; }
.list { border: 1.5px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: #fff; }
.item { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 14px 16px; text-align: left; font-weight: 600; }
.item + .item { border-top: 1px solid var(--border); }
.item small { color: var(--muted); font-weight: 500; }
.pill { padding: 4px 11px; border-radius: 99px; font-size: 12px; font-weight: 800; background: var(--accent-soft); color: var(--accent-dark); white-space: nowrap; }
.pill.err { background: #fdeceb; color: var(--danger); }
.pill.warn { background: #fdf3dc; color: var(--warn); }
.empty { padding: 24px 14px; text-align: center; color: var(--muted); }

/* ───── чат поддержки ───── */
.msgs { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 0 10px; }
.msg { max-width: 82%; padding: 10px 14px; border-radius: 20px; white-space: pre-wrap; word-break: break-word; font-weight: 500; }
.msg.user { align-self: flex-end; background: linear-gradient(145deg, #3fcf85, var(--accent-dark)); color: #fff; border-bottom-right-radius: 6px; }
.msg.support { align-self: flex-start; background: #fff; border: 1.5px solid var(--border); border-bottom-left-radius: 6px; }
.msg time { display: block; margin-top: 3px; font-size: 11px; opacity: .65; }
.composer { display: flex; align-items: flex-end; gap: 8px; padding-top: 8px; }
.composer textarea { flex: 1; max-height: 110px; border-radius: 22px; padding: 12px 16px; }
.send { display: grid; place-items: center; width: 48px; height: 48px; flex: none; border-radius: 50%; background: linear-gradient(145deg, #3fcf85, var(--accent-dark)); color: #fff; box-shadow: 0 6px 16px rgba(31,158,92,.3); }
.send:disabled { opacity: .5; }
.send svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ───── заглушка входа, тост, просмотр ───── */
.gate { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; height: 100dvh; padding: 30px; text-align: center; }
.gate img { width: 78%; max-width: 300px; height: auto; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 34px + env(safe-area-inset-bottom)); z-index: 50;
  max-width: 88%; padding: 12px 18px; border-radius: 16px; background: var(--text); color: #fff; font-size: 14px; font-weight: 600; text-align: center;
  opacity: 0; transform: translate(-50%, 8px); pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--danger); }
.viewer { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 16px; background: rgba(10,20,14,.92); }
.viewer[hidden] { display: none; }
.viewer img { width: 100%; border-radius: 12px; }
.viewer .row { display: flex; gap: 10px; }
.viewer .btn { background: #fff; color: var(--text); box-shadow: none; }

@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ───── плавность, оформление, чек ───── */
.page.in { animation: pagein .24s cubic-bezier(.2,.7,.2,1); }
@keyframes pagein { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.tab, .tab i, .card, .btn, .shot, .pill { transition: transform .15s ease, color .2s ease, box-shadow .2s ease, background .2s ease; }
.list .val { max-width: 60%; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--text); }
.receipt .item:last-child .val { color: var(--accent-dark); font-weight: 800; }

/* ───── логотип, тексты, плавность ───── */
.card { animation: pagein .34s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--i, 0) * 55ms); }
.shot .ph { background: linear-gradient(110deg, var(--surface) 30%, #fff 50%, var(--surface) 70%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.shot .ph img { opacity: 0; transition: opacity .35s ease; }
.shot .ph img.ld { opacity: 1; }
@keyframes shimmer { to { background-position: -200% 0; } }
.txt { transition: border-color .2s, box-shadow .2s; }
.txt.copied { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.txt .acts { display: flex; align-items: center; gap: 6px; }
.cp { height: 36px; padding: 0 12px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-dark); font-weight: 800; font-size: 13px; }
.txt pre.doc {
  font: 500 14.5px/1.55 "Manrope", -apple-system, "Segoe UI", Roboto, sans-serif; max-height: 320px;
  white-space: pre-wrap; background: #fff; cursor: copy;
}
html { scroll-behavior: smooth; }
