/* kimi-app: база. Палитра, шапка, кнопки, формы и модалка — по образцу лендинга (DESIGN §0). */

:root {
  color-scheme: dark;
  --bg: #0a0a14;
  --bg2: #0e0515;
  --panel: #14141f;
  --panel2: #1b1b28;
  --line: #24243a;
  --txt: #fafafa;
  --dim: #a0a0b4;
  --dim2: #8888a0;
  --acc: #ff2d78;
  --acc2: #e91e63;
  --verm: #e2452b;
  --err: #ff8f8f;
  --ok: #22c55e;
  --wrap: 1100px;
  --r: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  min-height: 100vh;
  background: radial-gradient(ellipse 120% 70% at 50% 0, var(--bg2) 0, var(--bg) 70%) no-repeat, var(--bg);
  color: var(--txt);
  font: 16px/1.55 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-wrap: break-word;
}

button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input { font: inherit; }
body.is-modal { overflow: hidden; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 18px; }
.wrap--narrow { max-width: 620px; }

.tech-problems {
  background: #3a2d00; color: #ffd479; border-bottom: 1px solid #4a3a00;
  font-size: 13px; text-align: center; padding: 8px 12px;
}

/* шапка */
.head { border-bottom: 1px solid var(--line); background: rgba(10, 10, 20, .86); }
.head__in { display: flex; align-items: center; gap: 10px; height: 60px; }
.logo { font-size: 19px; font-weight: 800; letter-spacing: -.02em; text-decoration: none; color: var(--txt); }
.logo span { color: var(--acc); }
.logo .logo__no { color: var(--dim2); }
.head__age {
  padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line);
  color: var(--dim2); font-size: 11px; font-weight: 700;
}
.head__nav { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.head__who { color: var(--dim); font-size: 14px; }

/* кнопки */
.btn {
  display: inline-block; text-align: center; text-decoration: none;
  padding: 12px 22px; border-radius: 999px; font-weight: 700; font-size: 15px;
  background: linear-gradient(to right, var(--acc), var(--acc2)); color: #fff;
}
.btn--sec { background: none; border: 1px solid var(--verm); color: #ff9d8a; }
.btn--ghost { background: none; border: 1px solid var(--acc); color: var(--acc); padding: 8px 14px; font-size: 14px; }
.btn--big { padding: 15px 30px; font-size: 17px; }
.btn--full { display: block; width: 100%; }

/* секция и текст */
.sect { padding: 40px 0; }
.sect h1, .sect h2 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; text-align: center; }
.sect h1 { color: var(--acc); }
.lead { max-width: 580px; margin: 10px auto 0; text-align: center; color: var(--dim); font-size: 15px; }
.lead a { color: var(--acc); text-decoration: none; border-bottom: 1px solid rgba(255, 45, 120, .4); }
.notice {
  margin: 16px auto 0; max-width: 580px; padding: 12px 16px; border-radius: 12px;
  border: 1px solid var(--acc); background: rgba(255, 45, 120, .1); text-align: center;
}
.notice--top { margin: 16px auto 0; width: calc(100% - 36px); }
/* кнопка отправленной формы: запрос ушёл, второй раз не нажать (base.html) */
.btn.is-busy { opacity: .6; cursor: progress; pointer-events: none; }
.btn.is-busy::after { content: " …"; }
/* htmx-форма в полёте (hx-disabled-elt) */
.btn:disabled { opacity: .6; cursor: progress; }
.cta__btns { margin: 26px auto 0; display: flex; flex-direction: column; gap: 10px; max-width: 320px; }

/* формы */
.form { margin-top: 26px; display: grid; gap: 20px; text-align: left; }
.q__lbl { display: block; margin-bottom: 9px; color: var(--dim); font-size: 14px; font-weight: 600; }
.inp {
  width: 100%; padding: 13px 16px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line); color: var(--txt); outline: none;
}
.inp:focus { border-color: var(--acc); }
.inp::placeholder { color: var(--dim2); }
/* textarea не наследует шрифт и по умолчанию моноширинная */
textarea.inp { font: inherit; resize: vertical; min-height: 110px; }
.inp[aria-invalid="true"] { border-color: #ef4444; }
.q__err { margin-top: 8px; color: var(--err); font-size: 13px; }
.form__err { color: var(--err); font-size: 14px; text-align: center; }
.showpw { color: var(--dim); font-size: 14px; }
.login__fine { margin-top: 14px; text-align: center; color: var(--dim2); font-size: 12px; }
/* honeypot: вне экрана, не display:none — иные боты такие поля пропускают */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* модалка: гейт 18+ */
.modal {
  position: fixed; inset: 0; z-index: 80; display: flex; padding: 16px;
  background: rgba(4, 4, 10, .88); backdrop-filter: blur(6px); overflow-y: auto;
}
.modal__box { width: 100%; max-width: 420px; margin: auto; }
.accbox { padding: 20px 18px 22px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); }
.accbox h3 { font-size: 20px; font-weight: 800; text-align: center; }
.gate__no { display: none; text-align: center; }
.gate__no:target { display: block; }

/* виджет обратной связи (DESIGN §9), по образцу лендинга. Пилюля — поверх оверлея гейта: по MVP виджет
   доступен и на экране гейта (на лендинге она была под ним). Панель — над всем */
.ask-fab {
  position: fixed; right: 16px; bottom: 16px; z-index: 85;
  display: flex; align-items: center; gap: 8px; border-radius: 999px;
  background: linear-gradient(to right, var(--acc), var(--acc2)); color: #fff; font-weight: 700; font-size: 14px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .45);
}
.ask-fab__ic { font-size: 18px; line-height: 1; }
.ask-fab__n {
  position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
  background: var(--ok); border: 2px solid var(--bg); color: #fff; font-size: 11px; line-height: 16px; text-align: center;
}
@media (max-width: 599px) {
  /* узкий экран: пилюля с текстом заняла бы полширины — круглая кнопка, подпись только скринридерам */
  .ask-fab { width: 52px; height: 52px; padding: 0; justify-content: center; }
  .ask-fab__tx { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (min-width: 600px) { .ask-fab { padding: 12px 18px; } }
.modal.ask { z-index: 90; }
.ask .modal__box { max-width: 560px; }
.modal__bar { display: flex; justify-content: flex-end; margin-bottom: 4px; }
.modal__x {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--panel); border: 1px solid var(--line); color: var(--dim);
}
.ask .accbox h3 { margin-bottom: 4px; }
.ask .form { margin-top: 16px; gap: 14px; }
.ask-tabs, .chips { display: flex; flex-wrap: wrap; gap: 7px; }
.ask-tabs { margin-bottom: 16px; }
.ask-tabs button, .chip span {
  display: inline-block; padding: 7px 14px; border-radius: 999px; font-size: 13px;
  border: 1px solid var(--line); background: var(--panel2); color: var(--dim);
}
.ask-tabs button.on, .chip input:checked + span { border-color: var(--acc); background: rgba(255, 45, 120, .16); color: #fff; }
.chip { cursor: pointer; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip input:focus-visible + span { outline: 2px solid var(--acc); }
.ask-cnt { display: block; margin-top: 6px; text-align: right; color: var(--dim2); font-size: 12px; }
.ask-hint { color: var(--dim2); font-size: 12px; text-align: center; }
.ask-ok { margin: 10px 0; color: var(--ok); font-size: 14px; }
.ask-list { display: grid; gap: 12px; max-height: 52vh; overflow-y: auto; }
.ask-item { display: block; width: 100%; text-align: left; padding: 14px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--panel); }
a.ask-item { text-decoration: none; color: inherit; }
.ask-item.is-unread { border-color: var(--ok); }
.ask-item__top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; color: var(--dim2); font-size: 12px; }
.ask-item__cat { padding: 2px 9px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); color: var(--dim); }
.ask-item__st { padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--dim2); font-size: 11px; }
.ask-item__st--answered { border-color: var(--ok); color: var(--ok); }
.ask-item__st--closed { opacity: .75; }
.ask-item__q { display: block; color: var(--txt); font-size: 14px; }
.ask-item__last { display: block; margin-top: 6px; color: var(--dim2); font-size: 12px; }
.ask-back { margin-bottom: 12px; color: var(--acc); font-size: 13px; }
.ask-thread { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; max-height: 44vh; overflow-y: auto; padding: 2px; }
.ask-msg__at { margin: 0 4px; color: var(--dim2); font-size: 11px; }
.ask-msg__at--out { align-self: flex-end; }
.ask-msg__ctx { margin: 0 4px; color: var(--dim2); font-size: 11px; overflow-wrap: anywhere; }
.msg { flex: none; max-width: 82%; padding: 9px 12px; border-radius: 16px; font-size: 14px; line-height: 1.45; }
.msg--out { align-self: flex-end; background: linear-gradient(to right, var(--acc), var(--acc2)); color: #fff; border-bottom-right-radius: 5px; }
.msg--in { align-self: flex-start; background: var(--panel2); border-bottom-left-radius: 5px; }
.ask-reply { margin-top: 12px; display: grid; gap: 8px; }
.ask-reply textarea.inp { min-height: 70px; }
.ask-closed { margin-top: 12px; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2);
  color: var(--dim2); font-size: 13px; }
.ask-empty { padding: 34px 0; text-align: center; color: var(--dim); font-size: 14px; }

/* админка (DESIGN §13): инбокс — удобно с телефона */
.staff-list { margin-top: 18px; display: grid; gap: 10px; }
.staff-list h2 { margin-top: 14px; font-size: 16px; text-align: left; }
.staff-thread .ask-thread { max-height: none; }
.staff-thread .ask-tabs { margin: 12px 0 0; }
.is-bold { font-weight: 700; }
.staff-health { margin-top: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2); font-size: 14px; }
.staff-health__st { flex: 1; color: var(--ok); }
.staff-health__st.is-bad { color: #ff9d8a; }

/* каталог (MVP «каталог»): карточки; фото героинь — шаг 9, пока буква */
.cards { margin-top: 26px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.card { position: relative; display: grid; gap: 8px; padding: 10px; border-radius: var(--r); border: 1px solid var(--line);
  background: var(--panel); color: var(--txt); text-decoration: none; }
.card:hover { border-color: var(--acc); }
.card__pic { display: grid; place-items: center; aspect-ratio: 3 / 4; border-radius: 10px; font-size: 44px; font-weight: 800;
  background: linear-gradient(160deg, var(--acc2), var(--bg2)); color: rgba(255, 255, 255, .85); }
.card__pic--anime { background: linear-gradient(160deg, #7c3aed, var(--bg2)); }
.card__name { font-weight: 700; font-size: 15px; }
.card__tag { position: absolute; top: 16px; left: 16px; padding: 2px 9px; border-radius: 999px; background: rgba(10, 10, 20, .7);
  color: var(--ok); font-size: 12px; }
.hero { text-align: center; }
.hero__pic { width: 180px; margin: 12px auto 18px; }
.hero__desc { margin-top: 14px; color: var(--dim); text-align: left; }

/* чат (DESIGN §4): лента на всю высоту экрана, поле ввода снизу */
.chat__in { display: flex; flex-direction: column; height: calc(100dvh - 61px); padding-top: 10px; padding-bottom: 12px; }
.chat__head { display: flex; align-items: center; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.chat__head .ask-back { margin: 0; font-size: 18px; text-decoration: none; }
.chat__name { flex: 1; font-weight: 700; }
.chat-log { flex: 1; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; padding: 12px 2px; }
.msg--rp { white-space: pre-wrap; }
.msg--rp em { color: var(--dim); }
.msg--out.msg--rp em { color: rgba(255, 255, 255, .8); }
.msg.is-blocked { opacity: .5; }
.msg.is-hidden { color: var(--dim2); font-style: italic; }
.msg.is-typing:empty::after { content: "…"; color: var(--dim2); }
.chat-sys { align-self: center; max-width: 90%; color: #ff9d8a; font-size: 12px; text-align: center; }
.chat-note { color: #ff9d8a; font-size: 13px; text-align: center; padding: 4px 0; }
.chat-note a { color: var(--acc); }
.chat-left { color: var(--dim2); font-size: 12px; text-align: center; padding: 4px 0; }
.chat-form { display: grid; gap: 8px; }
.chat-input { min-height: 48px; max-height: 30vh; resize: vertical; }
.chat-form__btns { display: flex; justify-content: flex-end; gap: 8px; }
.btn--wait.htmx-request span { display: none; }
.btn--wait.htmx-request::after { content: attr(data-busy); }
.btn--wait.htmx-request { animation: busy 1.2s ease-in-out infinite; }
@keyframes busy { 50% { opacity: .4; } }
