* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #0d0a1a; --card: rgba(255,255,255,.035); --line: #2c2545; --line2: #4a3f6e;
  --text: #ece8f5; --muted: #9a90b8; --a: #a06bff; --b: #38c8ff;
}
body {
  font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text);
  min-height: 100vh; overflow-x: hidden;
}
.bg-glow {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(600px 400px at 20% 10%, rgba(120,80,255,.18), transparent),
    radial-gradient(700px 500px at 85% 80%, rgba(0,200,255,.12), transparent);
}
header { text-align: center; padding: 44px 16px 22px; position: relative; z-index: 1; }
h1 { font-size: 52px; letter-spacing: 4px; font-weight: 800; }
h1 .logo { background: linear-gradient(135deg, var(--a), var(--b)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tagline { color: var(--muted); margin-top: 8px; font-size: 17px; }
main { max-width: 960px; margin: 0 auto; padding: 16px; position: relative; z-index: 1; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; }
.hidden { display: none !important; }

/* загрузка */
.dropzone { border: 2px dashed var(--line2); padding: 72px 24px; text-align: center; cursor: pointer; transition: .2s; }
.dropzone:hover, .dropzone.over { border-color: var(--a); background: rgba(160,107,255,.06); transform: translateY(-2px); }
.dz-icon { font-size: 52px; margin-bottom: 12px; }
.dz-title { font-size: 24px; font-weight: 700; }
.dz-sub { color: var(--muted); margin-top: 6px; }
.dz-hint { color: #6f6690; margin-top: 16px; font-size: 13px; }

/* генерация */
.working { display: flex; gap: 24px; align-items: center; padding: 28px; }
.thumb { width: 150px; height: 150px; object-fit: contain; border-radius: 12px; background: #16122a; flex: none; }
.work-body { flex: 1; min-width: 0; }
.work-title { font-size: 20px; font-weight: 700; }
.bar { height: 10px; border-radius: 99px; background: rgba(255,255,255,.07); margin: 16px 0 10px; overflow: hidden; }
.bar-fill { height: 100%; width: 3%; border-radius: 99px; background: linear-gradient(90deg, var(--a), var(--b)); transition: width .6s; }
.work-text { color: var(--text); }
.work-note { color: var(--muted); font-size: 13px; margin-top: 10px; }

/* результат */
.result { overflow: hidden; }
#viewer { height: 520px; }
.viewer-bar { display: flex; gap: 10px; padding: 12px; border-top: 1px solid var(--line); align-items: center; flex-wrap: wrap; }
.res-info { margin-left: auto; color: var(--muted); font-size: 13px; }
.btn {
  padding: 10px 18px; border-radius: 10px; border: 1px solid var(--line2); background: rgba(255,255,255,.05);
  color: var(--text); cursor: pointer; font-size: 14px; text-decoration: none; display: inline-block; transition: .2s; font-family: inherit;
}
.btn:hover { border-color: var(--a); }
.btn-main { background: linear-gradient(135deg, var(--a), var(--b)); border: none; font-weight: 700; color: #fff; }
.error { text-align: center; padding: 44px 20px; color: #ff8a8a; }
.error .btn { margin-top: 16px; }
footer { text-align: center; color: #5a5078; padding: 28px 16px 90px; font-size: 13px; position: relative; z-index: 1; }

/* верхняя панель и тарифы */
.topbar { position: relative; z-index: 2; display: flex; justify-content: flex-end; align-items: center; gap: 16px; padding: 14px 22px 0; }
.top-link { color: var(--muted); text-decoration: none; font-size: 15px; }
.top-link:hover { color: var(--text); }
.top-buy { padding: 9px 16px; }
.tariffs { margin-top: 40px; scroll-margin-top: 20px; }
.sec-title { text-align: center; font-size: 30px; margin-bottom: 20px; }
.tariff-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.tariff { position: relative; padding: 26px 24px; text-align: center; display: flex; flex-direction: column; }
.tariff-main { border-color: var(--a); box-shadow: 0 0 0 1px var(--a), 0 14px 40px rgba(120,80,255,.25); }
.t-badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); padding: 4px 14px; border-radius: 99px;
  font-size: 12px; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--a), var(--b)); }
.t-name { font-size: 20px; font-weight: 700; }
.t-price { font-size: 44px; font-weight: 800; margin-top: 8px; }
.tariff-main .t-price { background: linear-gradient(135deg, var(--a), var(--b)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.t-period { color: var(--muted); margin-bottom: 16px; }
.tariff .plan-list { margin-bottom: 20px; flex: 1; }
.t-btn { width: 100%; text-align: center; padding: 13px; }
.t-note { text-align: center; color: #6f6690; font-size: 13px; margin-top: 16px; }
.btn:disabled { opacity: .55; cursor: default; }

/* баланс и подписка */
.balance { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-bottom: 14px; padding: 12px 16px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); color: var(--muted); }
.balance .btn { padding: 8px 16px; }
.modal { position: fixed; inset: 0; z-index: 30; background: rgba(5,3,12,.72); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box { position: relative; width: 100%; max-width: 400px; background: #151126; border: 1px solid var(--line2); border-radius: 20px; padding: 28px 24px; text-align: center; }
.modal-x { position: absolute; right: 14px; top: 12px; }
.modal-box h2 { font-size: 22px; margin-bottom: 18px; }
.plan-price { font-size: 46px; font-weight: 800; background: linear-gradient(135deg, var(--a), var(--b)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.plan-days { color: var(--muted); margin-bottom: 16px; }
.plan-list { list-style: none; text-align: left; margin: 0 auto 20px; max-width: 300px; }
.plan-list li { padding: 7px 0 7px 26px; position: relative; border-bottom: 1px solid rgba(255,255,255,.06); }
.plan-list li::before { content: '✓'; position: absolute; left: 4px; color: var(--b); font-weight: 700; }
.plan-btn { width: 100%; padding: 14px; font-size: 16px; }
.plan-note { color: #6f6690; font-size: 12px; margin-top: 12px; }

/* cookie и подвал */
.foot-link { color: #7a70a0; }
.cookie-bar { position: fixed; left: 16px; right: 96px; bottom: 16px; z-index: 25; display: flex; gap: 14px; align-items: center;
  padding: 12px 16px; border-radius: 14px; background: #1b1630; border: 1px solid var(--line2); font-size: 13px; color: var(--muted);
  box-shadow: 0 10px 30px rgba(0,0,0,.45); }
.cookie-bar a { color: var(--b); }
.cookie-bar .btn { flex: none; padding: 8px 16px; }
@media (max-width: 700px) { .cookie-bar { right: 16px; bottom: 86px; flex-direction: column; align-items: stretch; } }

/* чат */
.chat-toggle {
  position: fixed; right: 22px; bottom: 22px; z-index: 20; width: 58px; height: 58px; border-radius: 50%;
  border: none; cursor: pointer; font-size: 26px; color: #fff;
  background: linear-gradient(135deg, var(--a), var(--b)); box-shadow: 0 8px 26px rgba(120,80,255,.45);
}
.chat {
  position: fixed; right: 22px; bottom: 92px; z-index: 21; width: 370px; height: 520px; max-height: calc(100vh - 120px);
  display: flex; flex-direction: column; background: #151126; border: 1px solid var(--line2); border-radius: 18px;
  box-shadow: 0 18px 50px rgba(0,0,0,.55); overflow: hidden;
}
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; font-weight: 700;
  background: linear-gradient(135deg, rgba(160,107,255,.25), rgba(56,200,255,.15)); border-bottom: 1px solid var(--line); }
.chat-x { background: none; border: none; color: var(--text); font-size: 18px; cursor: pointer; }
.chat-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 86%; padding: 10px 13px; border-radius: 14px; line-height: 1.45; font-size: 14px; white-space: pre-wrap; word-wrap: break-word; }
.msg.bot { background: rgba(255,255,255,.06); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.me { background: linear-gradient(135deg, var(--a), #6f7dff); align-self: flex-end; border-bottom-right-radius: 4px; color: #fff; }
.msg.wait { color: var(--muted); font-style: italic; }
.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.chat-form textarea {
  flex: 1; resize: none; border-radius: 10px; border: 1px solid var(--line2); background: #0f0c1e; color: var(--text);
  padding: 10px; font: inherit; font-size: 14px; max-height: 110px;
}
.chat-form .btn { padding: 0 16px; }

@media (max-width: 700px) {
  .tariff-grid { grid-template-columns: 1fr; gap: 24px; }
  h1 { font-size: 36px; }
  .working { flex-direction: column; text-align: center; }
  #viewer { height: 400px; }
  .res-info { margin-left: 0; width: 100%; }
  .chat { right: 8px; left: 8px; width: auto; bottom: 86px; }
}
