/* Жыпыл: тұңғиық теңіз, алтын нұр. Тек өз файлдарымыз (CSP 'self'): Onest қаріпі /fonts ішінде, OFL лицензиясы. */
@font-face {
  font-family: "Onest"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/fonts/onest-cyrillic-ext.woff2) format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: "Onest"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/fonts/onest-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Onest"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/fonts/onest-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #050a16;
  --ink: #ffffff;
  --ink-2: rgba(255, 255, 255, .76);
  --ink-3: rgba(255, 255, 255, .52);
  --gold: #ffcf7d;
  --gold-2: #f5b041;
  --glass: rgba(255, 255, 255, .075);
  --glass-b: rgba(255, 255, 255, .2);
  --panel: rgba(7, 16, 32, .62);
  --err: #ffb4a8;
  --err-bg: rgba(120, 24, 14, .45);
  --ok: #9fe3b8;
  --safe-t: max(14px, env(safe-area-inset-top));
  --safe-b: max(16px, env(safe-area-inset-bottom));
  color-scheme: dark;
}
:root[data-theme="dark"], :root[data-theme="light"] { --bg: #050a16; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg: #050a16; } }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0; min-height: 100%; background: var(--bg); color: var(--ink);
  font: 16px/1.5 Onest, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
}
a { color: var(--gold); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* ---------- көрініс: WebGL және оның орнына сурет ---------- */
canvas#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 1; touch-action: manipulation;
  opacity: 0; transition: opacity .6s ease; }
html.ready canvas#gl { opacity: 1; }
#nogl { position: fixed; inset: 0; z-index: 0; background: var(--bg) url(/plate.webp) center 34% / cover no-repeat; }
/* WebGL жоқ кезде: суреттің үстінде жай жарық шар */
html.nogl #nogl::after {
  content: ""; position: absolute; left: 50%; top: 40%; width: 150px; height: 150px; margin: -75px 0 0 -75px; border-radius: 50%;
  background: radial-gradient(circle, #ffe3a6 0 34%, #f39a2b 50%, rgba(245, 140, 40, .35) 62%, transparent 72%);
}
html.nogl canvas#gl { display: none; }
html.scene-off canvas#gl, html.scene-off #nogl { display: none; }
html.scene-off body { background: radial-gradient(120% 80% at 50% 0%, #0f2440 0%, var(--bg) 60%) fixed; }

#app { position: fixed; inset: 0; z-index: 2; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch;
  transition: opacity .5s ease; }
#app[data-view="chat"] { overflow: hidden; }
html.scene-off #app { position: static; overflow: visible; }
html.showing #app, html.showing .menu-btn, html.showing .menu { opacity: 0; pointer-events: none; }
.noscript { position: relative; z-index: 3; text-align: center; padding: 40vh 24px 0; }

/* ---------- түймелер ---------- */
.btn {
  height: 56px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 0 22px;
  font-weight: 500; font-size: 16.5px; letter-spacing: -.01em; cursor: pointer; border: 1px solid var(--glass-b); background: var(--glass);
  color: var(--ink); text-decoration: none; -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  transition: transform .15s ease, background .2s ease, box-shadow .2s ease, opacity .2s ease;
}
.btn:hover { background: rgba(255, 255, 255, .12); }
.btn:active { transform: scale(.97); }
.btn.gold {
  border-color: rgba(255, 206, 120, .6); background: linear-gradient(180deg, rgba(255, 214, 140, .24), rgba(255, 176, 70, .1));
  box-shadow: 0 0 28px rgba(255, 176, 60, .28), inset 0 1px 0 rgba(255, 240, 205, .35);
}
.btn.gold:hover { box-shadow: 0 0 40px rgba(255, 176, 60, .42), inset 0 1px 0 rgba(255, 240, 205, .4); }
.btn.small { height: 44px; font-size: 15px; padding: 0 16px; }
.btn.ghost { background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; border-color: rgba(255, 255, 255, .16); color: var(--ink-2); }
.btn.danger { color: var(--err); border-color: rgba(255, 160, 140, .35); }
.btn:disabled, .btn[disabled] { opacity: .45; pointer-events: none; }
.btn svg, .icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.wide { width: 100%; }

.icon {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: #fff; text-decoration: none;
  border: 1px solid var(--glass-b); background: rgba(5, 12, 26, .38); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.pill {
  height: 38px; padding: 0 15px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .06);
  display: inline-flex; align-items: center; gap: 6px; font-size: 14.5px; cursor: pointer; color: var(--ink); text-decoration: none; white-space: nowrap;
}
.pill:hover { background: rgba(255, 255, 255, .12); }

/* ---------- мәзір ---------- */
.menu-btn { position: fixed; z-index: 5; top: var(--safe-t); right: 14px; transition: opacity .4s ease; }
.menu {
  position: fixed; z-index: 5; top: calc(var(--safe-t) + 52px); right: 12px; width: min(340px, calc(100vw - 24px));
  max-height: calc(100dvh - var(--safe-t) - 70px); overflow-y: auto; padding: 16px; border-radius: 22px;
  background: rgba(7, 16, 32, .82); border: 1px solid rgba(255, 255, 255, .16); box-shadow: 0 18px 50px rgba(0, 0, 0, .45);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); animation: drop .22s ease both;
}
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } }
.menu-who { font-weight: 500; }
.menu-who small { display: block; color: var(--ink-3); font-weight: 300; font-size: 13px; }
.balance { display: inline-block; margin-top: 8px; padding: 4px 12px; border-radius: 999px; font-size: 13.5px; color: var(--gold);
  border: 1px solid rgba(255, 207, 125, .4); background: rgba(255, 190, 100, .08); }
.menu-note { margin: 8px 0 0; font-size: 13px; color: var(--ink-3); font-weight: 300; }
.orders { margin-top: 14px; border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 10px; }
.orders h2 { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; margin: 0 0 6px; }
.orders a { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; color: var(--ink); text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, .06); font-size: 14.5px; }
.orders a span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.orders p { margin: 4px 0; color: var(--ink-3); font-size: 14px; }
.menu-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.badge { font-size: 12px; padding: 2px 9px; border-radius: 999px; white-space: nowrap; flex: none;
  color: var(--ink-2); border: 1px solid rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .05); }
.badge.done { color: var(--gold); border-color: rgba(255, 207, 125, .45); background: rgba(255, 190, 100, .08); }

/* ---------- басты бет, кіру, шақыру ---------- */
.stage { min-height: 100%; display: flex; flex-direction: column; justify-content: space-between; gap: 20px;
  padding: calc(var(--safe-t) + 34px) 16px var(--safe-b); }
.hello { text-align: center; padding: 0 8px; }
.hello h1 { margin: 0; font-weight: 500; font-size: clamp(28px, 8vw, 44px); line-height: 1.1; letter-spacing: -.028em;
  text-shadow: 0 2px 24px rgba(0, 0, 0, .35); overflow-wrap: anywhere; }
.hello h1 em { font-style: normal; background: linear-gradient(180deg, #ffe7b0, #f5b041); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hello p { margin: 12px auto 0; max-width: 360px; font-weight: 300; font-size: clamp(15px, 4vw, 18px); line-height: 1.45; color: var(--ink-2); }
.hello .free { font-size: 13.5px; color: var(--ink-3); margin-top: 6px; }
.rise .hello h1, .rise .hello p, .rise .cta { opacity: 0; transform: translateY(10px); animation: up .9s cubic-bezier(.2, .7, .2, 1) forwards; }
.rise .hello h1 { animation-delay: 1.3s; } .rise .hello p { animation-delay: 1.6s; } .rise .cta { animation-delay: 1.9s; }
@keyframes up { to { opacity: 1; transform: none; } }
.cta { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; max-width: 460px; margin: 0 auto; }
.cta-row { display: flex; gap: 10px; justify-content: center; width: 100%; }
.cta-row .btn { flex: 1; max-width: 220px; }
.say { min-height: 1.4em; text-align: center; font-size: clamp(17px, 4.6vw, 21px); line-height: 1.4; color: #fff6e4;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .6); padding: 0 8px; }

/* шыны карточка (кіру, шақыру формалары) */
.glass {
  width: 100%; max-width: 420px; margin: 0 auto; padding: 18px; border-radius: 24px;
  background: var(--panel); border: 1px solid rgba(255, 255, 255, .14); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
}
form { display: grid; gap: 12px; margin: 0; }
label { display: grid; gap: 5px; font-size: 13.5px; color: var(--ink-2); }
input, select, textarea {
  width: 100%; min-height: 50px; padding: 12px 16px; border-radius: 14px; border: 1px solid var(--glass-b); outline: none;
  background: rgba(5, 12, 26, .55); color: var(--ink); font-size: 16px;
}
select { appearance: none; }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:focus, select:focus, textarea:focus { border-color: rgba(255, 206, 120, .65); }
textarea { resize: none; }

.alert { margin: 4px 0; padding: 10px 14px; border-radius: 14px; font-size: 14.5px; color: var(--err); background: var(--err-bg);
  border: 1px solid rgba(255, 150, 130, .3); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.alert.info { color: #fff3dc; background: rgba(255, 190, 100, .1); border-color: rgba(255, 207, 125, .35); }
.center-note { max-width: 420px; margin: 0 auto; text-align: center; display: grid; gap: 12px; justify-items: center; }

/* ---------- чат ---------- */
.chatpage { position: absolute; inset: 0; display: flex; flex-direction: column; }
.c-top { flex: none; display: flex; align-items: flex-start; gap: 10px; padding: var(--safe-t) 66px 0 14px; min-height: calc(var(--safe-t) + 44px); }
.c-name { flex: 1; min-width: 0; padding-top: 2px; }
.c-name b { display: block; font-weight: 500; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-name small { display: flex; align-items: center; gap: 6px; margin-top: 3px; color: var(--ink-3); font-size: 12.5px; }
.feedwrap { flex: 1; min-height: 0; display: flex; flex-direction: column; margin-top: 23vh;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 34px); mask-image: linear-gradient(180deg, transparent 0, #000 34px); }
@media (min-aspect-ratio: 1/1) { .feedwrap { margin-top: 26vh; } }
.feed { flex: 1; overflow-y: auto; padding: 34px 14px 10px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: none;
  max-width: 640px; width: 100%; margin: 0 auto; overscroll-behavior: contain; }
.feed::-webkit-scrollbar { display: none; }
.feed > * { flex-shrink: 0; }
.feed > .grow { flex: 1; }
.msg { max-width: 86%; padding: 11px 15px; border-radius: 20px; font-size: 15.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.z { align-self: flex-start; color: #fdf6ea; background: rgba(9, 22, 40, .55); border: 1px solid rgba(255, 255, 255, .12);
  border-top-left-radius: 6px; -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.msg.t { align-self: flex-end; color: #fff; background: linear-gradient(180deg, rgba(255, 210, 140, .26), rgba(255, 180, 80, .16));
  border: 1px solid rgba(255, 210, 140, .38); border-top-right-radius: 6px; -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.msg a { color: var(--gold); word-break: break-all; }
.msg.dots { display: inline-flex; gap: 5px; padding: 15px 16px; }
.msg.dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 230, 190, .8); animation: dt 1.1s infinite; }
.msg.dots i:nth-child(2) { animation-delay: .15s; } .msg.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dt { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 6px 14px 8px; scrollbar-width: none; max-width: 640px; width: 100%; margin: 0 auto; flex: none; }
.chips::-webkit-scrollbar { display: none; }
.chips .pill { flex: none; border-color: rgba(255, 214, 150, .42); background: rgba(255, 200, 120, .1);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
form.comp { flex: none; display: flex; gap: 8px; align-items: flex-end; width: 100%; max-width: 664px; margin: 0 auto; padding: 0 12px var(--safe-b); }
form.comp textarea { flex: 1; min-width: 0; min-height: 50px; max-height: 30vh; border-radius: 25px; padding: 13px 18px; line-height: 1.4;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
form.comp button { width: 50px; height: 50px; flex: none; border-radius: 50%; border: 1px solid rgba(255, 206, 120, .6); cursor: pointer; color: #fff;
  background: linear-gradient(180deg, rgba(255, 214, 140, .3), rgba(255, 176, 70, .14)); display: grid; place-items: center; }
form.comp button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
form.comp button:disabled { opacity: .45; }

/* чаттағы нұрлы карточка (баға, нәтиже) */
.proj {
  align-self: stretch; max-width: 440px; width: 100%; border-radius: 22px; padding: 16px;
  background: linear-gradient(180deg, rgba(255, 226, 170, .16), rgba(255, 200, 120, .06)); border: 1px solid rgba(255, 214, 150, .5);
  box-shadow: 0 0 34px rgba(255, 170, 60, .18), inset 0 1px 0 rgba(255, 240, 210, .25); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
.proj.mat { animation: mat 1s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes mat { 0% { opacity: 0; filter: blur(10px) brightness(2.2); clip-path: inset(0 0 100% 0 round 22px); }
  60% { opacity: 1; filter: blur(2px) brightness(1.4); } 100% { filter: none; clip-path: inset(0 0 0 0 round 22px); } }
.tag { font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); font-weight: 500; }
.proj h3, .res h3 { margin: 6px 0 2px; font-size: 19px; font-weight: 500; letter-spacing: -.015em; overflow-wrap: anywhere; }
.prices { margin-top: 10px; border-top: 1px solid rgba(255, 255, 255, .12); }
.pr { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, .08); font-size: 15px; }
.pr b { font-weight: 600; font-size: 17px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pr.total b, .pr.free b { color: var(--gold); }
.note { margin: 10px 0 0; font-size: 13px; color: var(--ink-2); font-weight: 300; }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.row .btn { flex: 1; height: 46px; font-size: 15px; padding: 0 14px; }
.cancel-row { display: flex; justify-content: center; padding: 4px 0 6px; }

/* ---------- нұрмен шыққан экран ---------- */
#screen {
  position: fixed; z-index: 6; left: 50%; top: max(9vh, 56px); width: min(88vw, 560px); max-height: calc(80vh - 56px); overflow-y: auto;
  transform: translateX(-50%); border-radius: 22px; padding: 14px;
  background: linear-gradient(180deg, rgba(255, 232, 190, .22), rgba(255, 206, 130, .1)); border: 1px solid rgba(255, 220, 160, .75);
  box-shadow: 0 0 60px rgba(255, 180, 80, .35), inset 0 0 30px rgba(255, 220, 160, .18); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  opacity: 0;
}
#screen.on { animation: mat2 1.1s cubic-bezier(.2, .7, .2, 1) forwards; }
#screen.off { animation: out .5s ease forwards; }
@keyframes mat2 { 0% { opacity: 0; filter: blur(14px) brightness(2.6); transform: translateX(-50%) scaleY(.15); }
  55% { opacity: 1; filter: blur(3px) brightness(1.5); } 100% { opacity: 1; filter: none; transform: translateX(-50%); } }
@keyframes out { from { opacity: 1; } to { opacity: 0; filter: blur(10px) brightness(2); transform: translateX(-50%) scaleY(.3); } }
.screen-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.screen-btns .btn { flex: 1; height: 48px; font-size: 15px; min-width: 120px; }
.res { padding: 6px 4px 0; }
.res p { margin: 8px 0 0; color: var(--ink-2); font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.res .quote { color: #fff8ea; padding: 12px 14px; border-radius: 16px; background: rgba(5, 12, 26, .4); border: 1px solid rgba(255, 255, 255, .12); }

/* ---------- модератор пульті (көріністен тыс, жай бет) ---------- */
.plain { max-width: 960px; margin: 0 auto; padding: calc(var(--safe-t) + 8px) 16px 40px; }
.plain h1 { font-size: 24px; font-weight: 500; margin: 6px 0 14px; letter-spacing: -.02em; }
.plain h2 { font-size: 16px; font-weight: 500; margin: 0 0 12px; }
.plain .back-home { display: inline-flex; margin-bottom: 6px; }
.card { background: rgba(255, 255, 255, .045); border: 1px solid rgba(255, 255, 255, .12); border-radius: 20px; padding: 16px; margin: 12px 0; }
.grid2 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.kpi b { display: block; font-size: 18px; font-weight: 600; }
.muted { color: var(--ink-3); }
.small-text { font-size: 13.5px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 6px; border-bottom: 1px solid rgba(255, 255, 255, .08); vertical-align: top; }
th { color: var(--ink-3); font-weight: 500; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; }
.plain button:not(.btn):not(.pill) { min-height: 46px; padding: 0 18px; border-radius: 999px; border: 1px solid rgba(255, 206, 120, .6); cursor: pointer;
  background: linear-gradient(180deg, rgba(255, 214, 140, .24), rgba(255, 176, 70, .1)); font-weight: 500; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
