:root {
  --bg: #131313;
  --bg-2: #1a1918;
  --card: #212121;
  --card-2: #282522;
  --ink: #e8e6df;
  --muted: #8a867c;
  --faint: #5e5952;
  --gold: #c9a45c;
  --gold-2: #ae8a45;
  --blue: #4d84a8;
  --bad: #c25b4e;
  --ok: #5da97f;
  --line: #2e2c29;
  --line-2: #3a3733;
  --shadow: 0 18px 50px rgba(0, 0, 0, .45);
  --serif: "Georgia", "Times New Roman", serif;
  --mono: "SF Mono", "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.65 system-ui, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
/* архитектурная сетка на фоне */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    linear-gradient(var(--bg-2) 1px, transparent 1px) 0 0/100% 120px,
    linear-gradient(90deg, transparent calc(100% - 1px), var(--bg-2) 0) 0 0/120px 100%;
  opacity: .5;
}
main, header { position: relative; z-index: 1; }

/* ---------- анимации ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
@keyframes riseX { from { opacity: 0; transform: translateX(-26px); } to { opacity: 1; transform: none; } }
@keyframes levitate { 0%, 100% { transform: rotate(-1.5deg) translateY(0); } 50% { transform: rotate(-1.5deg) translateY(-12px); } }
@keyframes goldpulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(201, 164, 92, .4); } 60% { box-shadow: 0 0 0 14px rgba(201, 164, 92, 0); } }
@keyframes growbar { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes drawline { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.appchart { width: 100%; height: auto; }
.applist { max-height: 420px; overflow-y: auto; }
.anim { opacity: 0; animation: rise .6s cubic-bezier(.22,.61,.36,1) forwards; animation-delay: calc(var(--i, 0) * 90ms); }
@media (prefers-reduced-motion: reduce) {
  .anim { animation: none; opacity: 1; }
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- шапка ---------- */
header {
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(19, 19, 19, .88); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  color: var(--ink); padding: 12px 24px;
  position: sticky; top: 0; z-index: 10;
}
.brand { font-family: var(--serif); font-weight: 700; letter-spacing: .4px; font-size: 18px; }
.brand span { color: var(--gold); }
.hdr-right { display: flex; gap: 16px; align-items: center; }
.hdr-right a { color: var(--muted); text-decoration: none; font-size: 14px; letter-spacing: .4px; transition: color .2s; position: relative; }
.hdr-right a::after { content: ""; position: absolute; left: 0; bottom: -3px; width: 100%; height: 1px; background: var(--gold); transform: scaleX(0); transform-origin: left; transition: transform .25s; }
.hdr-right a:hover { color: var(--gold); }
.hdr-right a:hover::after { transform: scaleX(1); }
main { max-width: 1180px; margin: 0 auto; padding: 26px 18px 70px; }

/* ---------- микро-лейблы (архитектурная типографика) ---------- */
.kicker { color: var(--gold); font-family: var(--mono); font-size: 11px; letter-spacing: 3px; text-transform: uppercase; margin-bottom: 14px; }
.kicker::before { content: "— "; color: var(--faint); }
.secnum { font-family: var(--mono); color: var(--faint); font-size: 12px; letter-spacing: 2px; float: right; }

/* ---------- лендинг ---------- */
.hero { display: grid; grid-template-columns: 1.25fr 1fr; gap: 44px; align-items: center; padding: 56px 0 36px; }
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; } }
.hero h1 { font-family: var(--serif); font-size: clamp(32px, 4.6vw, 50px); line-height: 1.1; margin: 0 0 18px; font-weight: 700; }
.hero h1 em { font-style: italic; color: var(--gold); }
.lead { color: var(--muted); font-size: 17px; max-width: 560px; }
.cta { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; }
.hero-art { perspective: 900px; }
.card.demo { animation: levitate 5.5s ease-in-out infinite; box-shadow: var(--shadow); max-width: 340px; margin-left: auto; }
.demo-img { height: 140px; border-radius: 8px; margin: 8px 0;
  background: linear-gradient(135deg, #212121 0%, #373532 50%, #c9a45c 140%); }
.verdict { font-weight: 700; color: var(--bad); font-size: 14px; }
.card.demo ul { margin: 6px 0 10px; padding-left: 18px; color: var(--muted); }
.btn.mini { padding: 4px 14px; font-size: 13px; }

/* бегущая строка-разделитель */
.ticker { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); overflow: hidden; margin: 26px 0; }
.ticker-inner { display: inline-block; white-space: nowrap; padding: 10px 0; font-family: var(--mono); font-size: 12px; letter-spacing: 3px; text-transform: uppercase; color: var(--faint); animation: ticker 28s linear infinite; }
.ticker-inner b { color: var(--gold); font-weight: 400; }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 34px 0; }
@media (max-width: 900px) { .features { grid-template-columns: 1fr; } }
.feature { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 22px; transition: transform .3s, border-color .3s, background .3s; overflow: hidden; }
.feature::before { content: attr(data-n); position: absolute; top: 12px; right: 16px; font-family: var(--mono); font-size: 12px; color: var(--faint); letter-spacing: 2px; }
.feature::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: linear-gradient(90deg, var(--gold), transparent); transform: scaleX(0); transform-origin: left; transition: transform .35s; }
.feature:hover { transform: translateY(-5px); border-color: var(--line-2); background: var(--card-2); }
.feature:hover::after { transform: scaleX(1); }
.feature h3 { margin: 0 0 8px; font-size: 16px; font-family: var(--serif); }
.feature p { margin: 0; color: var(--muted); font-size: 14px; }
.foot { text-align: center; color: var(--faint); padding: 34px 0 10px; font-size: 12px; font-family: var(--mono); letter-spacing: 2px; }

/* ---------- карточки/панель ---------- */
.card { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card::before { content: ""; position: absolute; top: 0; left: 18px; right: 18px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201,164,92,.35), transparent); }
.card.narrow { max-width: 400px; margin: 70px auto; }
h1 { font-family: var(--serif); font-size: 22px; margin: 0 0 14px; }
h2 { font-family: var(--serif); font-size: 17px; margin: 0 0 12px; }
.badge { display: inline-block; background: transparent; color: var(--gold); border: 1px solid var(--gold);
  border-radius: 10px; font-size: 11px; padding: 1px 8px; vertical-align: 2px; font-family: var(--mono); }
.stats-bar { display: flex; gap: 12px; align-items: stretch; flex-wrap: wrap; margin-bottom: 16px; }
.sb-item { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 18px; min-width: 110px; animation: rise .5s cubic-bezier(.22,.61,.36,1) backwards; }
.sb-item:nth-child(1) { animation-delay: 40ms; } .sb-item:nth-child(2) { animation-delay: 110ms; }
.sb-item:nth-child(3) { animation-delay: 180ms; } .sb-item:nth-child(4) { animation-delay: 250ms; }
.sb-item:nth-child(5) { animation-delay: 320ms; } .sb-item:nth-child(6) { animation-delay: 390ms; }
.sb-item b { font-size: 22px; display: block; font-family: var(--serif); color: var(--gold); }
.sb-item span { color: var(--muted); font-size: 12px; }
.sb-cta { margin-left: auto; display: flex; align-items: center; }
button.btn, .btn {
  background: transparent; color: var(--ink); border: 1px solid var(--line-2); border-radius: 8px;
  padding: 9px 16px; font: inherit; cursor: pointer; text-decoration: none; display: inline-block;
  transition: transform .18s, border-color .2s, color .2s, background .25s;
  position: relative; overflow: hidden;
}
button.btn::before { content: ""; position: absolute; inset: 0; background: var(--gold); transform: translateY(101%); transition: transform .28s cubic-bezier(.22,.61,.36,1); z-index: 0; }
button.btn:hover::before, .btn:hover::before { transform: translateY(0); }
button.btn:hover, .btn:hover { color: #131313; border-color: var(--gold); transform: translateY(-1px); }
button.btn > *, .btn > * { position: relative; z-index: 1; }
button.btn { color: var(--ink); }
.btn.big { padding: 12px 22px; font-size: 16px; }
.btn.gold { border-color: var(--gold); color: var(--gold); animation: goldpulse 2.8s infinite; }
.btn.gold:hover { color: #131313; }
button.ok, .btn.ok { border-color: rgba(93,169,127,.5); }
button.bad, .btn.bad { border-color: rgba(194,91,78,.5); }
.btn.ghost { background: transparent; }
.btn.small { padding: 3px 9px; font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
.col { display: flex; flex-direction: column; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px dashed var(--line); transition: padding-left .2s; }
.list li:hover { padding-left: 6px; }
.list li:last-child { border-bottom: 0; }
.inline { display: inline; }
input[type=text], input[type=password], input[type=number], select, textarea {
  padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 8px;
  font: inherit; width: 100%; background: var(--bg-2); color: var(--ink);
  transition: border-color .2s, box-shadow .2s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,164,92,.14); }
select option { background: var(--card); }
input[type=color] { width: 52px; height: 36px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg-2); padding: 2px; }
.row input[type=text], .row input[type=number] { width: auto; flex: 1; min-width: 120px; }
.w-id { max-width: 150px; } .w-un { max-width: 210px; }
label { display: block; margin-bottom: 10px; color: var(--muted); font-size: 14px; }
label input, label select, label textarea { margin-top: 5px; color: var(--ink); }
.radio { display: inline-flex; gap: 6px; align-items: center; margin-right: 14px; font-size: 14px; color: var(--ink); }
.radio input { accent-color: var(--gold); margin: 0; }
.radio-row { margin-bottom: 6px; }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--bg-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; font-size: 12px; font-family: var(--mono); color: var(--muted); }
.muted { color: var(--muted); }
.error { color: var(--bad); font-weight: 600; }
.msg.ok { color: var(--ok); font-weight: 600; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); }
th { font-family: var(--mono); font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--faint); font-weight: 400; }

/* очередь */
.qitem { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; background: var(--bg-2); transition: border-color .25s, transform .25s; }
.qitem:hover { border-color: var(--gold-2); transform: translateX(4px); }
.qmeta { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.qtext { margin: 8px 0 10px; white-space: pre-wrap; word-break: break-word; }
.thumb { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line-2); }
.verdict { color: var(--bad); font-weight: 600; font-size: 14px; margin-bottom: 6px; }

/* чаты */
.chatgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.chatcard { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--bg-2); transition: transform .25s, border-color .25s; }
.chatcard:hover { transform: translateY(-3px); border-color: var(--gold-2); }
.ctype { font-size: 10px; text-transform: uppercase; letter-spacing: 2px; color: var(--gold); font-weight: 700; font-family: var(--mono); }
.ctitle { font-weight: 700; margin: 2px 0; }
.cid { margin-bottom: 8px; }

/* график: рост столбцов, золотые/красные */
.chart svg { width: 100%; height: auto; }
.chart rect { transform-origin: bottom; animation: growbar .9s cubic-bezier(.22,.61,.36,1) backwards; }
.chart rect:nth-of-type(2n) { animation-delay: 80ms; }
.axis { stroke: var(--line-2); stroke-width: 1; }
.bar-ok { fill: var(--gold); opacity: .9; }
.bar-rej { fill: var(--bad); opacity: .75; }
.lbl { font-size: 10px; fill: var(--faint); text-anchor: middle; font-family: var(--mono); }
.legend { display: flex; gap: 14px; align-items: center; color: var(--muted); font-size: 13px; margin-top: 6px; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; }
.sw.ok { background: var(--gold); } .sw.rej { background: var(--bad); }

/* ---------- настройки ИИ ---------- */
.llm-form label { display: block; margin: 8px 0; }
.llm-form .grow { flex: 1; }
.llm-grid { margin-bottom: 8px; }

/* ---------- страница «Обо мне» (тёмная архитектура) ---------- */
.about-body { background: var(--abg, #131313); min-height: 100vh; }
.about-body::before { opacity: .35; }
.about-hero { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 30px 16px; }
.about-card {
  position: relative; background: rgba(33, 33, 33, .92); border: 1px solid var(--line);
  border-radius: 4px; box-shadow: var(--shadow); max-width: 640px; width: 100%;
  padding: 46px 48px; text-align: center; animation: rise .7s cubic-bezier(.22,.61,.36,1);
}
.about-card::before { content: ""; position: absolute; top: 18px; left: 18px; width: 34px; height: 34px; border-top: 1px solid var(--acc, #c9a45c); border-left: 1px solid var(--acc, #c9a45c); }
.about-card::after { content: ""; position: absolute; bottom: 18px; right: 18px; width: 34px; height: 34px; border-bottom: 1px solid var(--acc, #c9a45c); border-right: 1px solid var(--acc, #c9a45c); }
.about-avatar { width: 132px; height: 132px; border-radius: 50%; object-fit: cover; border: 3px solid var(--acc, #c9a45c); margin-bottom: 18px; box-shadow: 0 0 40px rgba(201,164,92,.25); }
.about-card h1 { font-family: var(--serif); font-size: 36px; margin: 0 0 6px; color: var(--ink); }
.about-sub { color: var(--acc, #c9a45c); font-weight: 600; margin: 0 0 20px; font-size: 14px; letter-spacing: 2px; text-transform: uppercase; font-family: var(--mono); }
.about-body-text { text-align: left; color: var(--muted); }
.about-body-text p { margin: 0 0 13px; }
.about-links { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 24px; }
.owner-hint { margin-top: 18px; }
@media (max-width: 560px) { .about-card { padding: 30px 22px; } }

/* ---------- мини-апп: плитки ---------- */
.appbody { background: var(--bg); }
.app { max-width: 560px; margin: 0 auto; padding: 14px 14px 40px; }
.app-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.app-badge { font-size: 11px; color: var(--gold); border: 1px solid var(--line-2); background: var(--card); border-radius: 10px; padding: 3px 10px; font-family: var(--mono); letter-spacing: 1px; }
.menu-btn {
  background: transparent; border: 1px solid var(--gold-2); color: var(--gold);
  border-radius: 10px; padding: 5px 16px; font: inherit; font-weight: 600; cursor: pointer;
  transition: all .2s;
}
.menu-btn:hover { background: var(--gold); color: #131313; }
.menu-btn:active { transform: scale(.96); }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- переключатель темы (шапка сайта и аппа) ---------- */
.theme-dots { display: flex; gap: 6px; align-items: center; }
.tdot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; opacity: .55; transition: opacity .2s, border-color .2s, transform .15s; background: none; }
.tdot:hover { opacity: .9; transform: scale(1.12); }
.tdot.sel { opacity: 1; border-color: var(--ink, #e8eaed); }

.tile {
  position: relative; display: flex; flex-direction: column; align-items: flex-start;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 18px 16px 14px; cursor: pointer; text-align: left; font: inherit; color: var(--ink);
  transition: transform .25s, border-color .25s, background .25s; overflow: hidden; min-height: 108px;
}
.tile::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%;
  background: linear-gradient(90deg, var(--gold), transparent); transform: scaleX(0); transform-origin: left; transition: transform .35s; }
.tile:hover { transform: translateY(-4px); border-color: var(--gold-2); background: var(--card-2); }
.tile:hover::after { transform: scaleX(1); }
.tile:active { transform: scale(.97); }
.t-num { font-family: var(--mono); font-size: 11px; color: var(--faint); letter-spacing: 2px; position: absolute; top: 12px; right: 14px; }
.t-title { font-family: var(--serif); font-size: 18px; color: var(--gold); margin-bottom: 4px; }
.t-sub { font-size: 12px; color: var(--muted); }
.back { background: none; border: 0; color: var(--gold); font-size: 20px; cursor: pointer; padding: 0 8px 0 0; float: left; margin: -2px 4px 0 0; }

.appcard { padding: 16px; }
.section { animation: rise .4s cubic-bezier(.22,.61,.36,1); }
.hidden { display: none; }
textarea { resize: vertical; }
.wide { width: 100%; }
.msg { min-height: 20px; margin-top: 8px; font-weight: 600; font-size: 14px; }
.msg.ok { color: var(--ok); } .msg.err { color: var(--bad); }
.small { font-size: 13px; }
.starrow { display: flex; gap: 8px; margin: 12px 0; }
.star-opt { flex: 1; background: var(--card); border: 1.5px solid var(--line-2); border-radius: 10px; padding: 12px 0; font: inherit; font-weight: 700; font-size: 16px; cursor: pointer; color: var(--ink); transition: all .22s; }
.star-opt:hover { transform: translateY(-2px); border-color: var(--gold); }
.star-opt.sel { border-color: var(--gold); background: rgba(201,164,92,.12); color: var(--gold); }
.stars-custom { display: block; margin: 6px 0 14px; color: var(--muted); font-size: 13px; }
.stars-custom input { margin-top: 4px; }
.browser-note { margin-top: 18px; text-align: center; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--faint); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; margin-right: 6px; }
.appchart { width: 100%; height: auto; }
.applist { max-height: 420px; overflow-y: auto; }
.app-qitem { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; background: var(--bg-2); }
.app-qmeta { color: var(--faint); font-size: 12px; margin-bottom: 4px; }

/* аккаунт в мини-аппе */
.acc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.acc-name { font-family: var(--serif); font-size: 17px; }
.acc-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.acc-row:last-child { border-bottom: 0; }
.acc-row span { color: var(--muted); font-size: 14px; }
.acc-row b { font-family: var(--serif); color: var(--gold); font-size: 16px; }
.acc-avatar { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; border: 2px solid var(--acc, #c9a45c); display: block; margin: 0 auto 12px; }
.acc-h { text-align: center; font-family: var(--serif); font-size: 20px; margin: 0 0 4px; }
.acc .about-sub { text-align: center; }
.acc p { color: var(--muted); }
/* портфолио */
.pf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.pf-item { margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg-2); transition: transform .2s, border-color .2s; }
.pf-item:hover { transform: translateY(-3px); border-color: var(--gold-2); }
.pf-item img { width: 100%; height: 110px; object-fit: cover; display: block; }
.pf-item figcaption { padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }
.pf-item figcaption b { font-size: 14px; }
.pf-item figcaption span { font-size: 12px; color: var(--muted); }
@media (max-width: 400px) { .pf-grid { grid-template-columns: 1fr; } }
