/* =========================================================
   COREX // CORE.SYS — design system
   ========================================================= */
:root {
  --bg: #070708; --bg2: #0b0b0d; --panel: #111113; --panel2: #17171a; --line: rgba(255,255,255,.065); --line2: rgba(255,255,255,.11);
  --text: #f3f5f8; --mut: #8b919b; --dim: #575c66;
  --c1: #2bb8ff; --c2: #0a5cff; --c1a: rgba(43,184,255,.12); --c1b: rgba(43,184,255,.28);
  --ok: #22c55e; --warn: #f59e0b; --bad: #ef4444;
  --r: 10px; --r2: 14px;
  --font: 'Rajdhani', 'Cairo', system-ui, sans-serif; --display: 'Orbitron', 'Cairo', sans-serif; --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
}
[dir="rtl"] { --font: 'Cairo', 'Rajdhani', system-ui, sans-serif; }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
a { color: var(--c1); text-decoration: none; }
img { max-width: 100%; }
::selection { background: var(--c1); color: #001522; }
::-webkit-scrollbar { width: 9px; height: 9px; } ::-webkit-scrollbar-track { background: var(--bg); } ::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 9px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; }
.display { font-family: var(--display); letter-spacing: .06em; }
.mono { font-family: var(--mono); font-size: .88em; }
.mut { color: var(--mut); } .dim { color: var(--dim); } .c1 { color: var(--c1); } .ok { color: var(--ok); } .bad { color: var(--bad); } .warn { color: var(--warn); }
.tag { font-family: var(--display); font-size: 11px; letter-spacing: .35em; color: var(--mut); text-transform: uppercase; }
.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }
.hidden { display: none !important; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; } .row.end { justify-content: flex-end; } .row.between { justify-content: space-between; }
.grid { display: grid; gap: 16px; } .g2 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 960px) { .g3, .g4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }
.brand-logo { mix-blend-mode: screen; } /* logo PNG has a black background — screen blend removes it on dark UI */

/* HUD corner brackets (from the brand mark) */
.hud { position: relative; }
.hud::before, .hud::after { content: ''; position: absolute; width: 22px; height: 22px; border: 2px solid var(--c1); pointer-events: none; opacity: .9; }
.hud::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.hud::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

/* buttons */
.btn { --b: var(--line2); display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: 8px; border: 1px solid var(--b);
  background: var(--panel2); color: var(--text); font: 600 15px var(--font); letter-spacing: .04em; cursor: pointer; transition: border-color .15s, background .15s, color .15s; white-space: nowrap; }
.btn:hover { border-color: var(--c1); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--c1); border-color: var(--c1); color: #001522; }
.btn.primary:hover { background: #5cc9ff; }
.btn.ghost { background: transparent; }
.btn.danger { --b: rgba(239,68,68,.45); color: #ffb4b4; } .btn.danger:hover { background: rgba(239,68,68,.12); border-color: var(--bad); }
.btn.ok { --b: rgba(34,197,94,.45); color: #a6f3c1; } .btn.ok:hover { background: rgba(34,197,94,.12); border-color: var(--ok); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 14px; } .btn.xs { height: 26px; padding: 0 9px; font-size: 13px; border-radius: 6px; }
.btn.icon { width: 40px; padding: 0; } .btn.sm.icon { width: 32px; }
.btn.discord { background: #5865f2; border-color: #5865f2; color: #fff; } .btn.discord:hover { background: #6d78f5; }

/* cards & surfaces */
.card { background: linear-gradient(180deg, var(--panel), var(--bg2)); border: 1px solid var(--line); border-radius: var(--r2); padding: 20px; }
.card.pad0 { padding: 0; } .card h3 { font-size: 18px; letter-spacing: .03em; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 99px; font-size: 13px; font-weight: 600; border: 1px solid var(--line2); color: var(--mut); white-space: nowrap; }
.badge.on { color: #9ef0bb; border-color: rgba(34,197,94,.4); background: rgba(34,197,94,.08); }
.badge.off { color: #ffb4b4; border-color: rgba(239,68,68,.4); background: rgba(239,68,68,.08); }
.badge.wa { color: #ffd591; border-color: rgba(245,158,11,.4); background: rgba(245,158,11,.08); }
.badge.cy { color: var(--c1); border-color: var(--c1b); background: var(--c1a); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; display: inline-block; }

/* forms */
label.f { display: block; margin-bottom: 14px; }
label.f > span, .flabel { display: block; font-size: 13px; color: var(--mut); margin-bottom: 6px; font-weight: 600; letter-spacing: .03em; }
.input, select.input, textarea.input { width: 100%; height: 40px; padding: 0 12px; background: var(--bg2); border: 1px solid var(--line2); border-radius: 8px; color: var(--text); font: 500 15px var(--font); outline: none; transition: border-color .15s; }
textarea.input { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--c1); }
input[type=color].input { padding: 4px; width: 64px; cursor: pointer; }
.hint { font-size: 12.5px; color: var(--dim); margin-top: 5px; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-weight: 600; }
.switch input { appearance: none; width: 42px; height: 24px; border-radius: 99px; background: var(--line2); position: relative; cursor: pointer; transition: background .15s; flex: none; margin: 0; }
.switch input::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: #c8d6e5; transition: transform .15s; }
.switch input:checked { background: var(--c1); } .switch input:checked::after { transform: translateX(18px); background: #001522; }
[dir="rtl"] .switch input:checked::after { transform: translateX(-18px); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 6px 0 10px; border-radius: 6px; background: var(--panel2); border: 1px solid var(--line2); font-size: 14px; font-weight: 600; }
.chip i { font-style: normal; width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.chip button { background: none; border: 0; color: var(--mut); cursor: pointer; font-size: 15px; padding: 0 3px; }
.chip button:hover { color: var(--bad); }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); }
table.t { width: 100%; border-collapse: collapse; font-size: 15px; }
table.t th { text-align: start; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--mut); font-weight: 700; padding: 11px 14px; background: var(--bg2); border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: var(--c1a); }
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--line); flex: none; }
.empty { text-align: center; color: var(--dim); padding: 36px 12px; }

/* modal + toast */
.modal-bg { position: fixed; inset: 0; background: rgba(2,4,6,.78); z-index: 80; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.modal { width: min(640px, 100%); background: var(--panel); border: 1px solid var(--line2); border-radius: var(--r2); padding: 22px; position: relative; }
.modal.wide { width: min(1040px, 100%); }
.modal .x { position: absolute; top: 14px; inset-inline-end: 14px; }
#toasts { position: fixed; bottom: 18px; inset-inline-end: 18px; z-index: 99; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--panel2); border: 1px solid var(--line2); border-inline-start: 3px solid var(--c1); border-radius: 8px; padding: 11px 16px; min-width: 240px; max-width: 380px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.toast.err { border-inline-start-color: var(--bad); } .toast.ok { border-inline-start-color: var(--ok); }

/* support button */
.support-fab { position: fixed; bottom: 18px; inset-inline-start: 18px; z-index: 70; display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 18px; border-radius: 99px;
  background: var(--panel2); border: 1px solid var(--c1b); color: var(--text); font-weight: 700; box-shadow: 0 0 24px rgba(43,184,255,.18); }
.support-fab:hover { border-color: var(--c1); }
.support-fab svg { width: 20px; height: 20px; color: var(--c1); }

/* reveal on scroll — single cheap transition */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .5s ease, transform .5s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } html { scroll-behavior: auto; } }

.lang-btn { font-family: var(--display); font-size: 12px; letter-spacing: .1em; }
.copy { cursor: pointer; }
.kbd { font-family: var(--mono); background: var(--bg2); border: 1px solid var(--line2); border-radius: 6px; padding: 2px 8px; font-size: 13px; }
pre.code { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; overflow-x: auto; font-family: var(--mono); font-size: 13.5px; color: #bfe6ff; margin: 0; white-space: pre; direction: ltr; text-align: left; }

/* =========================================================
   LUXE LAYER — matte black + soft studio lighting (static, no animation cost)
   ========================================================= */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 520px at 12% -8%, rgba(43,184,255,.13), transparent 60%),
    radial-gradient(760px 480px at 100% 0%, rgba(10,92,255,.10), transparent 60%),
    radial-gradient(1000px 600px at 50% 115%, rgba(43,184,255,.06), transparent 60%),
    linear-gradient(180deg, #08080a, #060607);
}
body::after {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.card, .stat, .feat, .plan, .sup, .step, .faq details, .contact a, .list-item, .feature-row, .spot, .modal, .tpl, .table-wrap {
  background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.012)), var(--panel);
  border-color: var(--line);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 18px 50px -24px rgba(0,0,0,.9);
}
.card:hover, .stat:hover, .feat:hover, .sup:hover, .plan:hover, .contact a:hover {
  border-color: rgba(43,184,255,.28);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 0 0 1px rgba(43,184,255,.06), 0 20px 60px -20px rgba(43,184,255,.22);
}
.card, .stat, .feat, .plan, .sup, .contact a { transition: border-color .25s, box-shadow .25s; }
.btn { background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02)), var(--panel2); border-color: var(--line2); box-shadow: inset 0 1px 0 rgba(255,255,255,.07); }
.btn:hover { border-color: rgba(43,184,255,.45); box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 0 18px -4px rgba(43,184,255,.35); }
.btn.primary { background: linear-gradient(180deg, #5fd0ff, var(--c1) 55%, #1a9be0); border-color: #6fd5ff; color: #00121c;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55), 0 8px 28px -6px rgba(43,184,255,.6), 0 0 0 1px rgba(43,184,255,.25); }
.btn.primary:hover { background: linear-gradient(180deg, #7ad9ff, #3fc0ff 55%, #229fe6); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.danger { background: linear-gradient(180deg, rgba(239,68,68,.12), rgba(239,68,68,.04)), var(--panel2); }
.btn.ok { background: linear-gradient(180deg, rgba(34,197,94,.12), rgba(34,197,94,.04)), var(--panel2); }
.btn.discord { background: linear-gradient(180deg, #7480ff, #5865f2); border-color: #7a85ff; box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 8px 24px -8px rgba(88,101,242,.7); }
.input, select.input, textarea.input { background: #0a0a0c; border-color: var(--line2); box-shadow: inset 0 1px 2px rgba(0,0,0,.6); }
.input:focus { border-color: var(--c1); box-shadow: 0 0 0 3px rgba(43,184,255,.12), inset 0 1px 2px rgba(0,0,0,.6); }
table.t th { background: rgba(255,255,255,.025); }
.badge { background: rgba(255,255,255,.03); }
.modal-bg { background: rgba(3,3,4,.82); backdrop-filter: blur(6px); }
.modal { border-color: var(--line2); }
.support-fab { background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.02)), #121215; backdrop-filter: blur(10px); }
.hud::before, .hud::after { filter: drop-shadow(0 0 6px rgba(43,184,255,.7)); }
.toast { background: #141417; }

/* floating buttons + AI assistant */
.fab-stack { position: fixed; bottom: 18px; inset-inline-end: 18px; z-index: 70; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.fab-stack .support-fab { position: static; }
.ai-fab { display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 18px; border-radius: 99px; cursor: pointer; font: 700 15px var(--font); color: #00121c;
  background: linear-gradient(180deg, #6fd5ff, var(--c1) 60%, #1a9be0); border: 1px solid #7fdcff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55), 0 10px 30px -6px rgba(43,184,255,.65), 0 0 40px -10px rgba(43,184,255,.8); }
.ai-fab svg { width: 20px; height: 20px; }
.ai-box { position: fixed; bottom: 130px; inset-inline-end: 18px; z-index: 75; width: min(420px, calc(100vw - 32px)); height: min(620px, calc(100vh - 160px));
  display: flex; flex-direction: column; border-radius: 18px; overflow: hidden; border: 1px solid var(--line2);
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.01)), #0e0e10;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.9), 0 0 60px -20px rgba(43,184,255,.35); }
.ai-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.02); }
.ai-head img { width: 36px; height: 36px; } .ai-head div { flex: 1; } .ai-head b { display: block; font-family: var(--display); letter-spacing: .1em; font-size: 14px; }
.ai-head small { color: var(--ok); font-size: 12px; }
.ai-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.ai-log .msg { max-width: 88%; padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; line-height: 1.65; font-size: 15px; }
.ai-log .msg.u { align-self: flex-end; background: var(--c1); color: #00121c; font-weight: 600; border-end-end-radius: 4px; }
.ai-log .msg.a { align-self: flex-start; background: #17171a; border: 1px solid var(--line2); border-end-start-radius: 4px; }
.ai-in { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
#toasts { bottom: 140px; }
@media (max-width: 600px) { .ai-fab span, .support-fab span { display: none; } .ai-fab, .support-fab { width: 46px; padding: 0; justify-content: center; } .ai-box { bottom: 130px; height: calc(100vh - 160px); } }

/* =========================================================
   PERFORMANCE PASS — same look, much lighter to render
   (blur behind sticky bars and the full-screen grain filter were the main causes of scroll lag)
   ========================================================= */
body::after { display: none; }
.nav, .top, .side, .save-bar, .modal-bg, .support-fab, .ai-box { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
.nav { background: rgba(8,8,10,.94); }
.top { background: rgba(8,8,10,.96) !important; }
.side { background: #0b0b0d !important; }
.save-bar { background: rgba(11,11,13,.97) !important; }
.modal-bg { background: rgba(3,3,4,.86) !important; }
.card, .stat, .feat, .plan, .sup, .step, .faq details, .contact a, .list-item, .feature-row, .spot, .tpl, .table-wrap { box-shadow: inset 0 1px 0 rgba(255,255,255,.05); }
.card:hover, .stat:hover, .feat:hover, .sup:hover, .plan:hover, .contact a:hover { box-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 0 0 1px rgba(43,184,255,.12); }
.view { animation: viewIn .18s ease-out; }
@keyframes viewIn { from { opacity: .4; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .view { animation: none; } }
.skeleton { height: 120px; border-radius: 14px; background: linear-gradient(90deg, rgba(255,255,255,.03), rgba(255,255,255,.06), rgba(255,255,255,.03)); background-size: 200% 100%; animation: sk 1.2s linear infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* =========================================================
   SHARP EDITION — square edges, bottom-left corner cut (COREX site + panel only, never customer sites)
   ========================================================= */
body:not(.site) { --r: 0px; --r2: 0px; --cut: 14px; --cut-s: 8px; }
body:not(.site) :is(.card, .stat, .feat, .plan, .sup, .step, .faq details, .contact a, .list-item, .feature-row, .spot, .spot-view, .tpl, .mp-card, .modal, .browser, .ai-box, .toast, .err-card, .key-box, .pv-frame, .stream-box, .inv, .pod, .studio-grp) {
  border-radius: 0 !important;
  clip-path: polygon(0 0, 100% 0, 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
}
/* thin accent line along the cut edge */
body:not(.site) :is(.card:not(.hud), .stat, .feat, .plan, .sup, .step, .contact a, .list-item, .tpl, .mp-card, .spot) { position: relative; }
body:not(.site) :is(.card:not(.hud), .stat, .feat, .plan, .sup, .step, .contact a, .list-item, .tpl, .mp-card, .spot)::after {
  content: ''; position: absolute; left: 0; bottom: var(--cut); width: calc(var(--cut) * 1.4142); height: 1px;
  background: linear-gradient(90deg, rgba(43,184,255,.9), rgba(43,184,255,.25)); transform: rotate(45deg); transform-origin: 0 0; pointer-events: none;
}
body:not(.site) :is(.btn, .input, select.input, textarea.input, .chip, .tabs button, .seg, .nav-i, .user-pill, .status-pill, .badge, .table-wrap, .stats, .urlbar) { border-radius: 0 !important; }
body:not(.site) .btn:not(.icon):not(.xs) { clip-path: polygon(0 0, 100% 0, 100% 100%, var(--cut-s) 100%, 0 calc(100% - var(--cut-s))); }
body:not(.site) :is(.support-fab, .ai-fab) { border-radius: 0 !important; clip-path: polygon(0 0, 100% 0, 100% 100%, 10px 100%, 0 calc(100% - 10px)); }
body:not(.site) .plan.pop { border-radius: 0; }
body:not(.site) .plan .pop-tag { border-radius: 0; }
body:not(.site) .ai-log .msg { border-radius: 0 !important; }
body:not(.site) .nav-i.on::before { border-radius: 0; }
body:not(.site) .plan .pop-tag { top: 0; } /* stays visible inside the clipped card */
body:not(.site) .plan.pop { padding-top: 40px; }
