/* ============================================================================
   Mestinghem AI — design system "Aurum"
   Obsidian base · champagne gold · glass surfaces · restrained motion
   ========================================================================== */

:root {
  --bg: #07080d;
  --bg-2: #0b0d14;
  --surface: #10131c;
  --surface-2: #151926;
  --surface-3: #1b2030;
  --line: #232939;
  --line-soft: #1a1f2c;
  --text: #f2f0ea;
  --text-2: #c3c8d6;
  --muted: #8a91a4;
  --dim: #5f6678;

  --gold: #c8a45c;
  --gold-2: #e8c87e;
  --gold-3: #8a6d2f;
  --gold-soft: rgba(200, 164, 92, .14);
  --gold-glow: rgba(200, 164, 92, .35);

  --teal: #4fc3a1;
  --rose: #d96a7a;
  --violet: #8f7ad6;
  --blue: #5b9bd6;

  --ok: #4fc3a1;
  --warn: #e0b252;
  --err: #d96a7a;

  --r-sm: 8px;
  --r: 14px;
  --r-lg: 20px;
  --r-xl: 28px;

  --sp: 8px;
  --shadow-1: 0 2px 8px rgba(0, 0, 0, .35);
  --shadow-2: 0 18px 50px rgba(0, 0, 0, .5);
  --shadow-3: 0 40px 120px rgba(0, 0, 0, .65);
  --glass: linear-gradient(160deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .015));
  --gold-grad: linear-gradient(135deg, #f0d79a 0%, #c8a45c 42%, #8a6d2f 100%);
  --font: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Cormorant Garamond", "Georgia", serif;
  --mono: "JetBrains Mono", "SF Mono", Consolas, monospace;
  --rail: 76px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

[data-theme="ivory"] {
  --bg: #f6f4ef;
  --bg-2: #efece4;
  --surface: #ffffff;
  --surface-2: #faf8f3;
  --surface-3: #f2efe7;
  --line: #e2ddd1;
  --line-soft: #ece8de;
  --text: #14161d;
  --text-2: #333a49;
  --muted: #6b7280;
  --dim: #8d93a1;
  --gold-soft: rgba(200, 164, 92, .18);
  --glass: linear-gradient(160deg, rgba(255, 255, 255, .9), rgba(255, 255, 255, .55));
  --shadow-2: 0 18px 50px rgba(20, 22, 29, .1);
  --shadow-3: 0 40px 120px rgba(20, 22, 29, .14);
}

* { box-sizing: border-box; }
*::selection { background: var(--gold-soft); color: var(--gold-2); }

html, body {
  margin: 0; padding: 0; min-height: 100%;
  background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 15px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }
a { color: var(--gold-2); text-decoration: none; }
a:hover { color: var(--gold); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-weight: 700; letter-spacing: -.02em; line-height: 1.18; margin: 0; }
p { margin: 0 0 12px; }
code, kbd, pre { font-family: var(--mono); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 20px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--gold-3); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.gold { color: var(--gold-2); }

/* ─────────────────────────── ambient ─────────────────────────── */
.ambient { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
#aurora { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .55; }
.grain {
  position: absolute; inset: -50%;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/></filter><rect width='140' height='140' filter='url(%23n)' opacity='.5'/></svg>");
  opacity: .035; mix-blend-mode: overlay; animation: grain 7s steps(6) infinite;
}
@keyframes grain {
  0%, 100% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); }
  40% { transform: translate(2%, -3%); } 60% { transform: translate(-2%, -2%); } 80% { transform: translate(3%, 1%); }
}
.vignette { position: absolute; inset: 0; background: radial-gradient(120% 90% at 50% 0%, transparent 40%, rgba(0, 0, 0, .55) 100%); }
.orbit {
  position: absolute; border-radius: 50%; filter: blur(90px); opacity: .3;
  animation: drift 26s var(--ease) infinite alternate;
}
.orbit-1 { width: 620px; height: 620px; left: -180px; top: -140px; background: radial-gradient(circle, rgba(200, 164, 92, .5), transparent 65%); }
.orbit-2 { width: 720px; height: 720px; right: -260px; bottom: -260px; background: radial-gradient(circle, rgba(79, 195, 161, .28), transparent 65%); animation-duration: 34s; }
@keyframes drift { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(60px, 40px, 0) scale(1.12); } }

/* ─────────────────────────── boot ─────────────────────────── */
.boot {
  position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center;
  background: radial-gradient(120% 100% at 50% 30%, #0d1018, #05060a 70%);
  transition: opacity .7s var(--ease), visibility .7s;
}
.boot.done { opacity: 0; visibility: hidden; }
.boot-mark { text-align: center; }
.boot-glyph { width: 72px; height: 72px; animation: pulse-glyph 2.4s var(--ease) infinite; }
@keyframes pulse-glyph { 0%, 100% { opacity: .55; transform: scale(.96); } 50% { opacity: 1; transform: scale(1.04); } }
.boot-bar { width: 220px; height: 2px; margin: 26px auto 14px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.boot-bar span { display: block; height: 100%; width: 40%; background: var(--gold-grad); animation: boot-slide 1.3s var(--ease) infinite; }
@keyframes boot-slide { from { transform: translateX(-110%); } to { transform: translateX(320%); } }
.boot-text { font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--dim); }

/* ─────────────────────────── buttons ─────────────────────────── */
.btn {
  --btn-bg: var(--surface-2);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--btn-bg); color: var(--text); font-weight: 600; font-size: 14px;
  cursor: pointer; overflow: hidden; white-space: nowrap;
  transition: transform .25s var(--ease-out), box-shadow .25s var(--ease), border-color .25s, background .25s, color .25s;
}
.btn:hover { transform: translateY(-2px); border-color: var(--gold-3); box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
.btn:active { transform: translateY(0) scale(.985); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-gold {
  background: var(--gold-grad); color: #1a1408; border-color: transparent;
  box-shadow: 0 8px 28px rgba(200, 164, 92, .28);
}
.btn-gold:hover { box-shadow: 0 14px 44px rgba(200, 164, 92, .42); color: #14100a; }
.btn-gold::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-120%);
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, .55) 50%, transparent 80%);
  transition: transform .8s var(--ease);
}
.btn-gold:hover::after { transform: translateX(120%); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-outline { background: transparent; border-color: var(--gold-3); color: var(--gold-2); }
.btn-outline:hover { background: var(--gold-soft); }
.btn-danger { background: rgba(217, 106, 122, .14); border-color: rgba(217, 106, 122, .4); color: #f0b3bc; }
.btn-danger:hover { background: rgba(217, 106, 122, .24); }
.btn-lg { padding: 15px 30px; font-size: 15.5px; }
.btn-sm { padding: 7px 14px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn.loading { color: transparent !important; pointer-events: none; }
.btn.loading::before {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, .25); border-top-color: currentColor; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  position: relative; width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; transition: all .2s var(--ease);
}
.icon-btn:hover { border-color: var(--gold-3); background: var(--surface-2); transform: translateY(-1px); }
.icon-btn .ic { font-size: 15px; line-height: 1; }
.badge {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--gold-grad); color: #1a1408;
  font-size: 10.5px; font-weight: 800; display: grid; place-items: center;
  box-shadow: 0 0 0 2px var(--bg);
}

/* ─────────────────────────── glass ─────────────────────────── */
.glass-card {
  position: relative; background: var(--glass); border: 1px solid var(--line);
  border-radius: var(--r-lg); backdrop-filter: blur(22px) saturate(1.3);
  -webkit-backdrop-filter: blur(22px) saturate(1.3); box-shadow: var(--shadow-2);
}
.glass-card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(140deg, rgba(255, 255, 255, .09), transparent 45%);
}

/* ─────────────────────────── nav ─────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 60; display: flex; align-items: center; gap: 28px;
  padding: 16px clamp(20px, 4vw, 60px);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line-soft);
}
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--gold); }
.brand-glyph { width: 30px; height: 30px; }
.brand-name { font-weight: 800; letter-spacing: -.03em; font-size: 18px; color: var(--text); }
.brand-name em { font-style: normal; color: var(--gold); margin-left: 3px; font-weight: 600; }
.brand.small .brand-glyph { width: 22px; height: 22px; }
.nav-links { display: flex; gap: 4px; margin-left: 12px; }
.nav-links a {
  padding: 8px 14px; border-radius: 999px; color: var(--text-2); font-size: 14px; font-weight: 500;
  transition: all .2s var(--ease);
}
.nav-links a:hover { color: var(--text); background: var(--surface-2); }
.nav-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.lang-toggle {
  display: inline-flex; align-items: center; gap: 3px; padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 11.5px;
  font-weight: 700; letter-spacing: .06em; transition: all .2s var(--ease);
}
.lang-toggle:hover { border-color: var(--gold-3); }
.lang-opt { color: var(--dim); transition: color .2s; }
.lang-opt.active { color: var(--gold-2); }
.lang-sep { color: var(--dim); }

/* ─────────────────────────── hero ─────────────────────────── */
.hero {
  position: relative; z-index: 2; display: grid; grid-template-columns: 1.05fr .95fr;
  gap: clamp(28px, 5vw, 72px); align-items: center;
  padding: clamp(48px, 8vh, 110px) clamp(20px, 4vw, 60px) clamp(40px, 6vh, 80px);
  max-width: 1500px; margin: 0 auto;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 9px; padding: 7px 15px 7px 12px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-2);
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 12px var(--gold-glow); animation: blink 2.4s var(--ease) infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.hero-title {
  margin: 22px 0 18px; font-family: var(--font-display); font-weight: 600;
  font-size: clamp(52px, 8.4vw, 116px); line-height: .96; letter-spacing: -.03em;
}
.hero-title .line { display: block; overflow: hidden; }
.hero-title .gold {
  background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { max-width: 620px; color: var(--text-2); font-size: clamp(15px, 1.15vw, 17.5px); line-height: 1.72; }
.hero-cta { display: flex; gap: 14px; margin: 30px 0 40px; flex-wrap: wrap; }
.hero-metrics { display: flex; gap: clamp(18px, 3vw, 42px); flex-wrap: wrap; border-top: 1px solid var(--line-soft); padding-top: 24px; }
.metric b { display: block; font-family: var(--font-display); font-size: 34px; color: var(--gold-2); font-weight: 600; line-height: 1; }
.metric span { font-size: 12px; color: var(--muted); letter-spacing: .04em; }

.hero-visual { position: relative; min-height: 420px; }
.tilt { transition: transform .5s var(--ease-out); transform-style: preserve-3d; will-change: transform; }
.gc-head { display: flex; align-items: center; gap: 7px; padding: 13px 18px; border-bottom: 1px solid var(--line-soft); }
.gc-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--surface-3); }
.gc-dot.r { background: #d96a7a; } .gc-dot.y { background: #e0b252; } .gc-dot.g { background: #4fc3a1; }
.gc-title { margin-left: 8px; font-family: var(--mono); font-size: 11.5px; color: var(--dim); }
.gc-body { padding: 22px; font-family: var(--mono); font-size: 13px; }
.gc-line { display: flex; gap: 10px; margin-bottom: 14px; color: var(--text-2); min-height: 22px; }
.gc-line .p { color: var(--gold); }
.gc-line.ai .avatar {
  flex: 0 0 24px; height: 24px; border-radius: 7px; background: var(--gold-grad); color: #1a1408;
  display: grid; place-items: center; font-weight: 800; font-size: 12px; font-family: var(--font);
}
.gc-line .caret { display: inline-block; width: 8px; height: 15px; background: var(--gold); margin-left: 3px; animation: caret 1s steps(2) infinite; vertical-align: middle; }
@keyframes caret { 50% { opacity: 0; } }
.gc-artifacts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.artifact {
  padding: 8px 13px; border-radius: 10px; border: 1px solid var(--gold-3);
  background: var(--gold-soft); color: var(--gold-2); font-family: var(--font);
  font-size: 12px; font-weight: 600; animation: pop .5s var(--ease-out) backwards;
}
.artifact:nth-child(2) { animation-delay: .12s; } .artifact:nth-child(3) { animation-delay: .24s; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.94); } }

.floating-chip {
  position: absolute; padding: 9px 15px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--glass); backdrop-filter: blur(14px); font-size: 12.5px; font-weight: 600;
  color: var(--text-2); box-shadow: var(--shadow-1); animation: float 6s var(--ease) infinite alternate;
}
.chip-1 { top: -14px; right: 6%; }
.chip-2 { bottom: 62px; left: -22px; animation-delay: 1.4s; }
.chip-3 { bottom: -8px; right: 14%; animation-delay: 2.6s; }
@keyframes float { from { transform: translateY(0); } to { transform: translateY(-16px); } }

/* ─────────────────────────── sections ─────────────────────────── */
.section { position: relative; z-index: 2; padding: clamp(56px, 9vh, 110px) clamp(20px, 4vw, 60px); max-width: 1500px; margin: 0 auto; }
.section.dark { background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .35), transparent); max-width: none; }
.section.dark > * { max-width: 1500px; margin-left: auto; margin-right: auto; }
.section-head { max-width: 760px; margin-bottom: 46px; }
.kicker {
  display: inline-block; font-size: 11.5px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--gold); font-weight: 700; margin-bottom: 12px;
}
.section-head h2 { font-family: var(--font-display); font-size: clamp(32px, 4.2vw, 52px); font-weight: 600; }
.section-head p { color: var(--muted); margin-top: 14px; font-size: 16px; }

.module-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: 20px; }
.module-card {
  position: relative; padding: 28px; border-radius: var(--r-lg); border: 1px solid var(--line);
  background: var(--surface); overflow: hidden; cursor: pointer;
  transition: transform .4s var(--ease-out), border-color .3s, box-shadow .4s;
}
.module-card::after {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none; opacity: 0;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), var(--gold-soft), transparent 62%);
  transition: opacity .35s;
}
.module-card:hover { transform: translateY(-6px); border-color: var(--gold-3); box-shadow: var(--shadow-2); }
.module-card:hover::after { opacity: 1; }
.module-ico {
  width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center;
  background: var(--gold-soft); border: 1px solid var(--gold-3); font-size: 23px; margin-bottom: 18px;
  transition: transform .4s var(--ease-out);
}
.module-card:hover .module-ico { transform: scale(1.08) rotate(-4deg); }
.module-card h3 { font-size: 19px; margin-bottom: 9px; }
.module-card p { color: var(--muted); font-size: 14px; margin: 0; }
.module-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.tag {
  padding: 4px 10px; border-radius: 999px; background: var(--surface-3); color: var(--text-2);
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
}

.security-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.sec-item { padding: 22px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); transition: all .3s var(--ease); }
.sec-item:hover { border-color: var(--gold-3); transform: translateY(-3px); }
.sec-item h4 { display: flex; align-items: center; gap: 10px; font-size: 15px; margin-bottom: 8px; }
.sec-item h4 span { font-size: 18px; }
.sec-item p { color: var(--muted); font-size: 13.5px; margin: 0; }

.price-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; align-items: stretch; }
.price-card { padding: 30px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; transition: all .35s var(--ease-out); }
.price-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-2); }
.price-card.featured { border-color: var(--gold); background: linear-gradient(170deg, rgba(200, 164, 92, .1), var(--surface) 55%); position: relative; }
.price-card.featured::before {
  content: attr(data-badge); position: absolute; top: -12px; right: 24px; padding: 5px 13px;
  border-radius: 999px; background: var(--gold-grad); color: #1a1408; font-size: 11px; font-weight: 800;
  letter-spacing: .08em; text-transform: uppercase;
}
.price-name { font-size: 13px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.price-value { font-family: var(--font-display); font-size: 46px; font-weight: 600; margin: 10px 0 2px; }
.price-value small { font-size: 15px; color: var(--muted); font-family: var(--font); font-weight: 500; }
.price-desc { color: var(--muted); font-size: 13.5px; margin-bottom: 20px; }
.price-list { list-style: none; padding: 0; margin: 0 0 26px; flex: 1; }
.price-list li { padding: 8px 0 8px 26px; position: relative; font-size: 14px; color: var(--text-2); border-bottom: 1px solid var(--line-soft); }
.price-list li::before { content: "✓"; position: absolute; left: 2px; color: var(--gold); font-weight: 800; }
.price-list li.off { color: var(--dim); } .price-list li.off::before { content: "—"; color: var(--dim); }

.cta-band { text-align: center; }
.cta-band h2 { font-family: var(--font-display); font-size: clamp(30px, 4vw, 48px); font-weight: 600; }
.cta-band p { color: var(--muted); max-width: 620px; margin: 14px auto 28px; }

/* ─────────────────────────── footer ─────────────────────────── */
.footer { position: relative; z-index: 2; border-top: 1px solid var(--line-soft); padding: 56px clamp(20px, 4vw, 60px) 28px; background: rgba(0, 0, 0, .25); }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1.4fr 1.2fr; gap: 36px; max-width: 1500px; margin: 0 auto; }
.footer h4 { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); margin-bottom: 14px; }
.footer a { display: block; color: var(--muted); font-size: 13.5px; padding: 4px 0; transition: color .2s, transform .2s; }
.footer a:hover { color: var(--gold-2); transform: translateX(3px); }
.footer-bottom {
  max-width: 1500px; margin: 42px auto 0; padding-top: 22px; border-top: 1px solid var(--line-soft);
  display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; color: var(--dim); font-size: 12.5px;
}
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(79, 195, 161, .6); animation: pulse-ring 2.2s var(--ease) infinite; }
@keyframes pulse-ring { 70% { box-shadow: 0 0 0 8px rgba(79, 195, 161, 0); } 100% { box-shadow: 0 0 0 0 rgba(79, 195, 161, 0); } }

/* ─────────────────────────── reveal ─────────────────────────── */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .8s var(--ease-out), transform .8s var(--ease-out); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ─────────────────────────── modal / auth ─────────────────────────── */
.modal, .drawer, .palette, .lightbox { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; }
.modal-backdrop, .drawer-backdrop, .palette-backdrop { position: absolute; inset: 0; background: rgba(3, 4, 8, .72); backdrop-filter: blur(10px); animation: fade .3s var(--ease); }
@keyframes fade { from { opacity: 0; } }
.auth-card { width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; padding: 30px; animation: rise .45s var(--ease-out); position: relative; }
@keyframes rise { from { opacity: 0; transform: translateY(28px) scale(.97); } }
.modal-x { position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 19px; line-height: 1; color: var(--muted); }
.modal-x:hover { color: var(--text); border-color: var(--gold-3); }
.auth-tabs { display: flex; gap: 6px; padding: 5px; background: var(--surface-2); border-radius: 999px; margin-bottom: 24px; }
.auth-tab { flex: 1; padding: 9px; border: none; background: transparent; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--muted); transition: all .25s var(--ease); }
.auth-tab.active { background: var(--gold-grad); color: #1a1408; box-shadow: var(--shadow-1); }
.auth-form h2 { font-size: 24px; margin-bottom: 6px; }
.field { display: block; margin: 15px 0; }
.field > span { display: block; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px; }
.field input, .field select, .field textarea, .inp {
  width: 100%; padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--bg-2); color: var(--text); font-size: 14.5px; outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.field input:focus, .field select:focus, .field textarea:focus, .inp:focus {
  border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); background: var(--surface);
}
.pw-wrap { position: relative; }
.pw-eye { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border: none; background: transparent; cursor: pointer; opacity: .55; font-size: 15px; }
.pw-eye:hover { opacity: 1; }
.pw-meter { height: 4px; border-radius: 3px; background: var(--surface-3); margin-top: 8px; overflow: hidden; }
.pw-meter span { display: block; height: 100%; width: 0; background: var(--err); transition: width .4s var(--ease), background .4s; }
.pw-hint { font-size: 11.5px; color: var(--dim); margin-top: 6px; }
.check { display: flex; gap: 9px; align-items: flex-start; margin: 12px 0; font-size: 13px; color: var(--text-2); cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--gold); }
.auth-error { margin-top: 14px; padding: 11px 14px; border-radius: var(--r-sm); background: rgba(217, 106, 122, .12); border: 1px solid rgba(217, 106, 122, .35); color: #f0b3bc; font-size: 13px; }

/* ─────────────────────────── workspace shell ─────────────────────────── */
.workspace { position: relative; z-index: 5; display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh; }
.rail {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 0;
  border-right: 1px solid var(--line-soft); background: rgba(8, 9, 14, .72);
  backdrop-filter: blur(20px); position: sticky; top: 0; height: 100vh;
}
.rail-brand { color: var(--gold); margin-bottom: 16px; }
.rail-brand .brand-glyph { width: 30px; height: 30px; }
.rail-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; width: 100%; align-items: center; }
.rail-link {
  position: relative; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center;
  color: var(--muted); cursor: pointer; border: 1px solid transparent; background: transparent;
  font-size: 19px; transition: all .25s var(--ease);
}
.rail-link:hover { color: var(--text); background: var(--surface-2); transform: translateY(-2px); }
.rail-link.active { color: var(--gold-2); background: var(--gold-soft); border-color: var(--gold-3); }
.rail-link.active::before { content: ""; position: absolute; left: -14px; top: 50%; transform: translateY(-50%); width: 3px; height: 22px; border-radius: 0 3px 3px 0; background: var(--gold-grad); }
.rail-link .tip {
  position: absolute; left: 60px; top: 50%; transform: translateY(-50%) translateX(-6px);
  padding: 6px 11px; border-radius: 8px; background: var(--surface-3); border: 1px solid var(--line);
  font-size: 12px; white-space: nowrap; opacity: 0; pointer-events: none; transition: all .2s var(--ease); z-index: 40;
}
.rail-link:hover .tip { opacity: 1; transform: translateY(-50%) translateX(0); }
.rail-foot { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.rail-btn { width: 42px; height: 38px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; font-size: 11.5px; font-weight: 700; transition: all .2s; }
.rail-btn:hover { color: var(--gold-2); border-color: var(--gold-3); }
.rail-user { width: 40px; height: 40px; border-radius: 13px; background: var(--gold-grad); color: #1a1408; display: grid; place-items: center; font-weight: 800; cursor: pointer; margin-top: 6px; box-shadow: var(--shadow-1); }

.shell { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 16px;
  padding: 13px 24px; border-bottom: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(18px);
}
.crumbs { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--muted); min-width: 0; }
.crumbs b { color: var(--text); font-weight: 700; }
.crumbs .sep { color: var(--dim); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.engine-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-family: var(--mono); font-size: 11.5px; color: var(--gold-2); }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 5px 13px 5px 5px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; transition: all .2s; }
.user-chip:hover { border-color: var(--gold-3); }
.user-chip .av { width: 28px; height: 28px; border-radius: 50%; background: var(--gold-grad); color: #1a1408; display: grid; place-items: center; font-weight: 800; font-size: 12px; }
.user-chip .nm { font-size: 13px; font-weight: 600; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .pl { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }

.views { flex: 1; min-height: 0; padding: 22px 24px 40px; animation: view-in .45s var(--ease-out); }
@keyframes view-in { from { opacity: 0; transform: translateY(12px); } }

/* ─────────────────────────── generic layout ─────────────────────────── */
.view-head { display: flex; align-items: flex-end; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.view-head h1 { font-family: var(--font-display); font-size: 34px; font-weight: 600; }
.view-head p { color: var(--muted); font-size: 14px; margin: 6px 0 0; max-width: 720px; }
.view-head .actions { margin-left: auto; display: flex; gap: 9px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.panel { padding: 20px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); }
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.panel-head h3 { font-size: 15px; letter-spacing: -.01em; }
.panel-head .spacer { margin-left: auto; }
.stat-card { padding: 18px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface-2); transition: all .3s var(--ease); }
.stat-card:hover { border-color: var(--gold-3); transform: translateY(-3px); }
.stat-card .lbl { font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.stat-card .val { font-family: var(--font-display); font-size: 34px; color: var(--gold-2); font-weight: 600; line-height: 1.1; margin-top: 6px; }
.stat-card .sub { font-size: 12px; color: var(--dim); margin-top: 3px; }
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip { padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--text-2); transition: all .22s var(--ease); }
.chip:hover { border-color: var(--gold-3); color: var(--text); transform: translateY(-1px); }
.chip.active { background: var(--gold-grad); color: #1a1408; border-color: transparent; }
.empty { text-align: center; padding: 54px 20px; color: var(--dim); }
.empty .ico { font-size: 40px; margin-bottom: 12px; opacity: .5; }
.divider { height: 1px; background: var(--line-soft); margin: 18px 0; }

/* ─────────────────────────── chat ─────────────────────────── */
.chat-layout { display: grid; grid-template-columns: 264px 1fr; gap: 18px; height: calc(100vh - 132px); min-height: 520px; }
.conv-list { border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; overflow: hidden; }
.conv-head { padding: 14px 16px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: 8px; }
.conv-items { flex: 1; overflow: auto; padding: 8px; }
.conv-item { padding: 11px 13px; border-radius: var(--r-sm); cursor: pointer; margin-bottom: 3px; transition: all .2s var(--ease); border: 1px solid transparent; }
.conv-item:hover { background: var(--surface-2); }
.conv-item.active { background: var(--gold-soft); border-color: var(--gold-3); }
.conv-item .t { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item .m { font-size: 11px; color: var(--dim); margin-top: 3px; display: flex; gap: 8px; }
.chat-main { display: flex; flex-direction: column; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); overflow: hidden; min-width: 0; }
.chat-modes { display: flex; gap: 6px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); overflow-x: auto; }
.chat-stream { flex: 1; overflow: auto; padding: 22px 26px; scroll-behavior: smooth; }
.msg { display: flex; gap: 13px; margin-bottom: 22px; animation: msg-in .4s var(--ease-out); }
@keyframes msg-in { from { opacity: 0; transform: translateY(10px); } }
.msg .av { flex: 0 0 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; font-weight: 800; font-size: 13px; background: var(--surface-3); color: var(--text-2); }
.msg.ai .av { background: var(--gold-grad); color: #1a1408; }
.msg .body { min-width: 0; flex: 1; }
.msg .who { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 5px; display: flex; gap: 9px; align-items: center; }
.msg .who .eng { font-family: var(--mono); font-size: 10.5px; color: var(--gold-3); padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); }
.bubble { font-size: 14.6px; line-height: 1.72; color: var(--text); word-wrap: break-word; }
.msg.user .bubble { background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px 16px 16px 16px; padding: 13px 16px; }
.bubble p { margin: 0 0 11px; } .bubble p:last-child { margin: 0; }
.bubble h1, .bubble h2, .bubble h3 { margin: 18px 0 9px; font-size: 17px; }
.bubble ul, .bubble ol { margin: 0 0 12px; padding-left: 22px; } .bubble li { margin: 4px 0; }
.bubble code { background: var(--bg-2); padding: 2px 6px; border-radius: 5px; font-size: 13px; color: var(--gold-2); }
.bubble pre { background: #080a10; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 14px 16px; overflow: auto; margin: 0 0 14px; }
.bubble pre code { background: none; padding: 0; color: #d8dce8; font-size: 13px; line-height: 1.6; }
.bubble table { border-collapse: collapse; margin: 0 0 14px; font-size: 13.5px; width: 100%; }
.bubble th { background: var(--surface-3); color: var(--gold-2); text-align: left; padding: 8px 11px; font-size: 12.5px; }
.bubble td { padding: 7px 11px; border-bottom: 1px solid var(--line-soft); }
.bubble blockquote { border-left: 3px solid var(--gold); padding: 6px 14px; margin: 0 0 12px; background: var(--surface-2); border-radius: 0 8px 8px 0; color: var(--text-2); }
.bubble strong { color: var(--gold-2); }
.typing { display: inline-flex; gap: 5px; padding: 6px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); animation: typing 1.2s var(--ease) infinite; }
.typing i:nth-child(2) { animation-delay: .16s; } .typing i:nth-child(3) { animation-delay: .32s; }
@keyframes typing { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-4px); } }

.action-card { margin: 12px 0; padding: 13px 15px; border-radius: var(--r); border: 1px solid var(--gold-3); background: var(--gold-soft); display: flex; align-items: center; gap: 12px; animation: pop .4s var(--ease-out); }
.action-card .ic { font-size: 21px; }
.action-card .txt { flex: 1; min-width: 0; }
.action-card .txt b { display: block; font-size: 13.5px; }
.action-card .txt span { font-size: 12px; color: var(--muted); }

.composer { border-top: 1px solid var(--line-soft); padding: 14px 16px; background: var(--surface-2); }
.composer-row { display: flex; gap: 10px; align-items: flex-end; }
.composer textarea {
  flex: 1; resize: none; min-height: 52px; max-height: 240px; padding: 14px 16px;
  border-radius: var(--r); border: 1px solid var(--line); background: var(--bg-2);
  color: var(--text); font-size: 14.5px; line-height: 1.55; outline: none; transition: border-color .2s, box-shadow .2s;
}
.composer textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.composer-tools { display: flex; gap: 7px; margin-top: 10px; align-items: center; flex-wrap: wrap; }
.tool-btn { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 12px; color: var(--text-2); transition: all .2s; }
.tool-btn:hover { border-color: var(--gold-3); color: var(--gold-2); }
.tool-btn.on { background: var(--gold-soft); border-color: var(--gold-3); color: var(--gold-2); }
.send-btn { width: 46px; height: 46px; border-radius: 15px; border: none; background: var(--gold-grad); color: #1a1408; cursor: pointer; font-size: 17px; display: grid; place-items: center; transition: all .25s var(--ease-out); flex: 0 0 auto; }
.send-btn:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 10px 30px rgba(200, 164, 92, .35); }
.send-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.attach-row { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 9px; }
.attach-pill { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px; background: var(--surface-3); font-size: 12px; }
.attach-pill button { border: none; background: none; cursor: pointer; color: var(--muted); font-size: 14px; line-height: 1; }

/* ─────────────────────────── terminal ─────────────────────────── */
.term-wrap { display: grid; grid-template-columns: 1fr 300px; gap: 18px; height: calc(100vh - 132px); min-height: 500px; }
.term-panel { display: flex; flex-direction: column; border-radius: var(--r-lg); border: 1px solid var(--line); background: #080a10; overflow: hidden; min-width: 0; }
.term-head { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--line-soft); background: var(--surface); }
.term-head .cwd { font-family: var(--mono); font-size: 12px; color: var(--gold-2); margin-left: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.term-body { flex: 1; overflow: auto; padding: 14px 16px; font-family: var(--mono); font-size: 13px; line-height: 1.62; white-space: pre-wrap; word-break: break-word; color: #d8dce8; }
.term-body .cmd { color: var(--gold-2); }
.term-body .err { color: #f0b3bc; }
.term-body .ok { color: #7fdcb8; }
.term-body .dim { color: var(--dim); }
.term-body .blocked { color: #f0b3bc; background: rgba(217, 106, 122, .1); padding: 2px 6px; border-radius: 5px; }
.term-input-row { display: flex; gap: 9px; align-items: center; padding: 11px 14px; border-top: 1px solid var(--line-soft); background: var(--surface); }
.term-input-row .ps1 { font-family: var(--mono); color: var(--gold); font-size: 13px; }
.term-input-row input { flex: 1; background: transparent; border: none; outline: none; font-family: var(--mono); font-size: 13.5px; color: var(--text); }
.term-side { display: flex; flex-direction: column; gap: 14px; overflow: auto; }
.quick-cmd { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; font-size: 12.5px; transition: all .2s; text-align: left; width: 100%; }
.quick-cmd:hover { border-color: var(--gold-3); transform: translateX(3px); }
.quick-cmd code { color: var(--gold-2); font-size: 11.5px; }

/* ─────────────────────────── files ─────────────────────────── */
.files-layout { display: grid; grid-template-columns: 236px 1fr; gap: 18px; }
.tree { border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); padding: 12px; max-height: calc(100vh - 190px); overflow: auto; }
.tree-item { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: var(--r-sm); cursor: pointer; font-size: 13.5px; color: var(--text-2); transition: all .2s; }
.tree-item:hover { background: var(--surface-2); color: var(--text); }
.tree-item.active { background: var(--gold-soft); color: var(--gold-2); font-weight: 600; }
.tree-item .cnt { margin-left: auto; font-size: 11px; color: var(--dim); }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 13px; }
.file-card {
  position: relative; padding: 15px; border-radius: var(--r); border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; overflow: hidden; transition: all .3s var(--ease-out);
}
.file-card:hover { transform: translateY(-4px); border-color: var(--gold-3); box-shadow: var(--shadow-2); }
.file-card .fico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 19px; margin-bottom: 12px; background: var(--surface-3); }
.file-card[data-kind="presentation"] .fico { background: rgba(217, 106, 122, .16); color: #f0b3bc; }
.file-card[data-kind="spreadsheet"] .fico { background: rgba(79, 195, 161, .16); color: #7fdcb8; }
.file-card[data-kind="document"] .fico { background: rgba(91, 155, 214, .16); color: #a9cdec; }
.file-card[data-kind="image"] .fico { background: var(--gold-soft); color: var(--gold-2); }
.file-card[data-kind="code"] .fico { background: rgba(143, 122, 214, .16); color: #c3b6ee; }
.file-card .fname { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-card .fmeta { font-size: 11px; color: var(--dim); margin-top: 4px; }
.file-card .thumb { position: absolute; inset: 0; object-fit: cover; opacity: .82; }
.file-card .pin { position: absolute; top: 9px; right: 9px; font-size: 12px; color: var(--gold); }
.file-card .acts { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; opacity: 0; transition: opacity .2s; }
.file-card:hover .acts { opacity: 1; }
.mini-btn { width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; font-size: 12px; display: grid; place-items: center; }
.mini-btn:hover { border-color: var(--gold-3); color: var(--gold-2); }
.file-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.file-table th { text-align: left; padding: 10px 12px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); }
.file-table td { padding: 11px 12px; border-bottom: 1px solid var(--line-soft); }
.file-table tr:hover td { background: var(--surface-2); }
.dropzone { border: 2px dashed var(--line); border-radius: var(--r-lg); padding: 30px; text-align: center; color: var(--muted); transition: all .25s; cursor: pointer; }
.dropzone.over { border-color: var(--gold); background: var(--gold-soft); color: var(--gold-2); }

/* ─────────────────────────── chess ─────────────────────────── */
.chess-layout { display: grid; grid-template-columns: minmax(320px, 560px) 1fr; gap: 20px; align-items: start; }
.board-card { padding: 16px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); }
.board-frame { position: relative; }
.board {
  display: grid; grid-template-columns: repeat(8, 1fr); aspect-ratio: 1; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow-2); user-select: none; touch-action: manipulation;
}
.sq { position: relative; display: grid; place-items: center; cursor: pointer; transition: background .16s; }
.sq.light { background: #e8dcc0; } .sq.dark { background: #7d6244; }
.sq.sel { background: var(--gold) !important; box-shadow: inset 0 0 0 3px var(--gold-2); }
.sq.last { background: rgba(200, 164, 92, .48) !important; }
.sq.check { background: radial-gradient(circle, #ff6b6b 12%, rgba(255, 107, 107, .35) 60%, transparent 75%) !important; }
.sq.hint { background: rgba(79, 195, 161, .5) !important; }
.sq .dot { position: absolute; width: 26%; height: 26%; border-radius: 50%; background: rgba(20, 22, 29, .32); pointer-events: none; animation: pop .22s var(--ease-out); }
.sq .ring { position: absolute; inset: 6%; border-radius: 50%; border: 4px solid rgba(20, 22, 29, .3); pointer-events: none; }
.sq .pc { font-size: clamp(22px, 5.4vw, 46px); line-height: 1; pointer-events: none; transition: transform .18s var(--ease-out); text-shadow: 0 2px 5px rgba(0, 0, 0, .45); }
.sq:hover .pc { transform: scale(1.09); }
.pc.w { color: #fdfbf6; } .pc.b { color: #191b22; }
.sq .coord { position: absolute; font-size: 9.5px; font-weight: 700; opacity: .55; pointer-events: none; font-family: var(--mono); }
.sq .coord.file { bottom: 2px; right: 4px; } .sq .coord.rank { top: 2px; left: 4px; }
.sq.light .coord { color: #6b573c; } .sq.dark .coord { color: #e3d6b8; }
.board.dragging .pc { cursor: grabbing; }
.ghost-piece { position: fixed; z-index: 500; pointer-events: none; font-size: 44px; transform: translate(-50%, -50%); filter: drop-shadow(0 8px 16px rgba(0, 0, 0, .6)); }

.player-bar { display: flex; align-items: center; gap: 11px; padding: 9px 13px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); margin: 9px 0; }
.player-bar .nm { font-weight: 700; font-size: 13.5px; }
.player-bar .cap { margin-left: auto; font-size: 17px; letter-spacing: -2px; color: var(--muted); }
.player-bar.active { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold-soft); }
.eval-bar { position: absolute; left: -20px; top: 0; bottom: 0; width: 9px; border-radius: 5px; background: #191b22; overflow: hidden; border: 1px solid var(--line); }
.eval-bar span { position: absolute; bottom: 0; left: 0; right: 0; background: #fdfbf6; transition: height .7s var(--ease); height: 50%; }
.eval-num { position: absolute; left: -20px; width: 9px; text-align: center; font-size: 7px; font-family: var(--mono); color: var(--gold-2); }

.move-list { max-height: 260px; overflow: auto; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface-2); }
.move-row { display: grid; grid-template-columns: 40px 1fr 1fr; font-family: var(--mono); font-size: 13px; }
.move-row:nth-child(odd) { background: rgba(255, 255, 255, .02); }
.move-row > div { padding: 7px 10px; cursor: pointer; border-left: 1px solid var(--line-soft); }
.move-row > div:hover { background: var(--gold-soft); }
.move-row .n { color: var(--dim); cursor: default; border: none; }
.grade { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-left: 6px; vertical-align: middle; }
.grade.best { background: #4fc3a1; } .grade.excellent { background: #7fdcb8; } .grade.good { background: #c8a45c; }
.grade.inaccuracy { background: #e0b252; } .grade.mistake { background: #e08a52; } .grade.blunder { background: #d96a7a; }
.grade.engine { background: var(--violet); } .grade.book { background: var(--dim); }

.analysis-box { padding: 16px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); }
.analysis-box .txt { font-size: 14px; line-height: 1.7; color: var(--text-2); }
.eval-line { display: flex; gap: 11px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.eval-line .sc { font-family: var(--mono); color: var(--gold-2); min-width: 54px; font-weight: 700; }
.eval-line .pv { font-family: var(--mono); color: var(--muted); font-size: 12.5px; }
.plan-item { display: flex; gap: 10px; padding: 9px 0; font-size: 13.5px; color: var(--text-2); }
.plan-item .n { color: var(--gold); font-weight: 800; font-family: var(--mono); font-size: 12px; }

/* ─────────────────────────── documents / images ─────────────────────────── */
.doc-builder { display: grid; grid-template-columns: 400px 1fr; gap: 18px; align-items: start; }
.form-grid { display: grid; gap: 13px; }
.seg { display: flex; gap: 5px; padding: 4px; background: var(--surface-2); border-radius: 12px; }
.seg button { flex: 1; padding: 9px; border: none; background: transparent; border-radius: 9px; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--muted); transition: all .22s var(--ease); }
.seg button.active { background: var(--gold-grad); color: #1a1408; }
.progress { height: 4px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--gold-grad); transition: width .5s var(--ease); }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.img-card { position: relative; aspect-ratio: 1; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; transition: all .35s var(--ease-out); }
.img-card:hover { transform: translateY(-5px) scale(1.01); border-color: var(--gold-3); box-shadow: var(--shadow-2); }
.img-card img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease-out); }
.img-card:hover img { transform: scale(1.07); }
.img-card .ov { position: absolute; inset: auto 0 0 0; padding: 12px; background: linear-gradient(transparent, rgba(5, 6, 10, .92)); font-size: 11.5px; color: var(--text-2); opacity: 0; transition: opacity .3s; }
.img-card:hover .ov { opacity: 1; }
.img-skeleton { position: absolute; inset: 0; background: linear-gradient(100deg, var(--surface-2) 30%, var(--surface-3) 50%, var(--surface-2) 70%); background-size: 220% 100%; animation: shimmer 1.5s linear infinite; }
@keyframes shimmer { to { background-position: -220% 0; } }
.ratio-chips { display: flex; gap: 6px; }

/* ─────────────────────────── agent ─────────────────────────── */
.device-card { padding: 18px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); transition: all .3s var(--ease); }
.device-card:hover { border-color: var(--gold-3); }
.device-card .head { display: flex; align-items: center; gap: 11px; margin-bottom: 12px; }
.device-card .head .ico { width: 40px; height: 40px; border-radius: 12px; background: var(--surface-3); display: grid; place-items: center; font-size: 19px; }
.state { padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.state.online { background: rgba(79, 195, 161, .16); color: #7fdcb8; }
.state.pending { background: rgba(224, 178, 82, .16); color: #e0b252; }
.state.revoked, .state.offline { background: rgba(217, 106, 122, .14); color: #f0b3bc; }
.approval-row { display: flex; gap: 12px; align-items: flex-start; padding: 13px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface-2); margin-bottom: 9px; }
.approval-row .risk { padding: 2px 9px; border-radius: 999px; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.risk.low { background: rgba(79, 195, 161, .16); color: #7fdcb8; }
.risk.medium { background: rgba(224, 178, 82, .16); color: #e0b252; }
.risk.high, .risk.critical { background: rgba(217, 106, 122, .16); color: #f0b3bc; }
.pair-box { text-align: center; padding: 26px; border-radius: var(--r-lg); border: 1px dashed var(--gold-3); background: var(--gold-soft); }
.pair-code { font-family: var(--mono); font-size: 40px; letter-spacing: .18em; color: var(--gold-2); font-weight: 700; margin: 12px 0; }
.pair-key { font-family: var(--mono); font-size: 11.5px; color: var(--text-2); word-break: break-all; padding: 11px; border-radius: var(--r-sm); background: var(--bg-2); border: 1px solid var(--line); margin-top: 12px; }
.switch { position: relative; width: 44px; height: 25px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line); cursor: pointer; transition: all .28s var(--ease); flex: 0 0 auto; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 50%; background: var(--muted); transition: all .28s var(--ease-out); }
.switch.on { background: var(--gold-soft); border-color: var(--gold); }
.switch.on::after { left: 21px; background: var(--gold-grad); }
.perm-row { display: flex; align-items: center; gap: 13px; padding: 13px 0; border-bottom: 1px solid var(--line-soft); }
.perm-row .t { flex: 1; min-width: 0; }
.perm-row .t b { display: block; font-size: 13.5px; }
.perm-row .t span { font-size: 12px; color: var(--muted); }

/* ─────────────────────────── settings / security ─────────────────────────── */
.set-layout { display: grid; grid-template-columns: 220px 1fr; gap: 20px; align-items: start; }
.set-nav { border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); padding: 9px; position: sticky; top: 92px; }
.set-nav button { display: block; width: 100%; text-align: left; padding: 10px 13px; border: none; background: transparent; border-radius: var(--r-sm); cursor: pointer; font-size: 13.5px; color: var(--text-2); transition: all .2s; }
.set-nav button:hover { background: var(--surface-2); color: var(--text); }
.set-nav button.active { background: var(--gold-soft); color: var(--gold-2); font-weight: 600; }
.score-ring { position: relative; width: 132px; height: 132px; }
.score-ring svg { transform: rotate(-90deg); }
.score-ring .val { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-size: 38px; color: var(--gold-2); font-weight: 600; }
.log-row { display: flex; gap: 12px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.log-row .tm { font-family: var(--mono); font-size: 11px; color: var(--dim); min-width: 118px; }
.log-row .ac { font-weight: 600; }
.kv { display: grid; grid-template-columns: 190px 1fr; gap: 9px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-family: var(--mono); font-size: 12.5px; }

/* ─────────────────────────── palette / drawer / toasts ─────────────────────────── */
.palette { place-items: start center; padding-top: 12vh; }
.palette-box { width: min(640px, calc(100vw - 32px)); padding: 0; overflow: hidden; animation: rise .3s var(--ease-out); }
#paletteInput { width: 100%; padding: 19px 22px; border: none; background: transparent; outline: none; font-size: 16px; border-bottom: 1px solid var(--line); }
.palette-list { max-height: 380px; overflow: auto; padding: 8px; }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: var(--r-sm); cursor: pointer; transition: background .15s; }
.palette-item .ic { width: 30px; height: 30px; border-radius: 9px; background: var(--surface-3); display: grid; place-items: center; font-size: 14px; }
.palette-item .t { flex: 1; min-width: 0; }
.palette-item .t b { display: block; font-size: 13.5px; font-weight: 600; }
.palette-item .t span { font-size: 11.5px; color: var(--dim); }
.palette-item.sel { background: var(--gold-soft); }
.palette-item.sel .ic { background: var(--gold-grad); color: #1a1408; }
.palette-foot { padding: 10px 16px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--dim); display: flex; gap: 9px; align-items: center; }
kbd { padding: 2px 7px; border-radius: 5px; background: var(--surface-3); border: 1px solid var(--line); font-size: 11px; font-family: var(--mono); }

.drawer { place-items: end center; }
.drawer-panel { width: min(560px, 100vw); max-height: 88vh; overflow: auto; border-radius: var(--r-xl) var(--r-xl) 0 0; padding: 24px; animation: slide-up .4s var(--ease-out); }
@keyframes slide-up { from { transform: translateY(100%); } }
.drawer-panel h2 { font-family: var(--font-display); font-size: 27px; font-weight: 600; margin-bottom: 16px; }

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 400; display: flex; flex-direction: column; gap: 10px; max-width: min(400px, calc(100vw - 40px)); }
.toast {
  display: flex; gap: 11px; align-items: flex-start; padding: 13px 16px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-2);
  animation: toast-in .4s var(--ease-out); backdrop-filter: blur(14px);
}
.toast.out { animation: toast-out .3s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(40px) scale(.95); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(40px) scale(.95); } }
.toast .ic { font-size: 16px; line-height: 1.3; }
.toast .tx { flex: 1; min-width: 0; font-size: 13.5px; }
.toast .tx b { display: block; margin-bottom: 2px; }
.toast.ok { border-left: 3px solid var(--ok); } .toast.err { border-left: 3px solid var(--err); }
.toast.warn { border-left: 3px solid var(--warn); } .toast.info { border-left: 3px solid var(--gold); }

.lightbox { background: rgba(3, 4, 8, .93); backdrop-filter: blur(8px); z-index: 300; }
.lightbox img { max-width: 92vw; max-height: 88vh; border-radius: var(--r); box-shadow: var(--shadow-3); animation: pop .35s var(--ease-out); }
.lb-x { position: absolute; top: 22px; right: 26px; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 22px; cursor: pointer; }

/* ─────────────────────────── responsive ─────────────────────────── */
@media (max-width: 1180px) {
  .hero { grid-template-columns: 1fr; }
  .hero-visual { min-height: 340px; order: 2; }
  .chat-layout, .term-wrap, .doc-builder, .chess-layout { grid-template-columns: 1fr; }
  .conv-list { max-height: 220px; }
  .term-side { flex-direction: row; flex-wrap: wrap; }
  .files-layout, .set-layout { grid-template-columns: 1fr; }
  .tree, .set-nav { position: static; max-height: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .nav-links { display: none; }
  .workspace { grid-template-columns: 60px 1fr; }
  :root { --rail: 60px; }
  .views { padding: 16px 14px 34px; }
  .topbar { padding: 11px 14px; gap: 9px; }
  .engine-pill, .user-chip .nm, .user-chip .pl { display: none; }
  .hero-metrics { gap: 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .eval-bar, .eval-num { display: none; }
  .board-frame { padding-left: 0; }
}

/* ─────────────────────────── legal reader ─────────────────────────── */
.legal-body { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); padding: clamp(24px, 4vw, 54px); color: var(--text-2); }
.legal-body h1 { font-family: var(--font-display); font-size: clamp(30px, 4vw, 44px); font-weight: 600; color: var(--text); margin-bottom: 6px; }
.legal-body h2 { font-size: 21px; color: var(--text); margin: 34px 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line-soft); }
.legal-body h3 { font-size: 16.5px; color: var(--gold-2); margin: 24px 0 8px; }
.legal-body h4 { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 18px 0 6px; }
.legal-body p { margin: 0 0 13px; font-size: 14.6px; line-height: 1.78; }
.legal-body ul, .legal-body ol { padding-left: 22px; margin: 0 0 15px; }
.legal-body li { margin: 6px 0; font-size: 14.4px; }
.legal-body blockquote { border-left: 3px solid var(--gold); background: var(--gold-soft); padding: 12px 18px; border-radius: 0 10px 10px 0; margin: 16px 0; color: var(--text); }
.legal-body code { background: var(--bg-2); padding: 2px 6px; border-radius: 5px; font-size: 12.5px; color: var(--gold-2); }
.legal-body pre { background: #080a10; border: 1px solid var(--line); border-radius: var(--r); padding: 16px; overflow: auto; }
.legal-body pre code { background: none; padding: 0; color: #d8dce8; }
.legal-body hr { border: none; border-top: 1px solid var(--line-soft); margin: 28px 0; }
.legal-body table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 13.5px; }
.legal-body th { background: var(--surface-3); color: var(--gold-2); text-align: left; padding: 9px 12px; }
.legal-body td { padding: 8px 12px; border-bottom: 1px solid var(--line-soft); }
.legal-body strong { color: var(--text); }
.legal-body a { text-decoration: underline; text-decoration-color: var(--gold-3); text-underline-offset: 3px; }
