:root {
  --bg: #070b12;
  --panel: #0d141f;
  --panel2: #101a28;
  --line: #1b2737;
  --line2: #243349;
  --txt: #c9d6e6;
  --dim: #7a8ba3;
  --muted: #4d5f78;
  --acc: #5eead4;
  --acc2: #22d3ee;
  --violet: #a78bfa;
  --warn: #ffb454;
  --err: #ff6b6b;
  --grad: linear-gradient(120deg, #5eead4, #22d3ee 45%, #a78bfa);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: ui-sans-serif, -apple-system, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg); color: var(--txt);
  font: 16px/1.65 var(--sans);
  overflow-x: hidden;
}
::selection { background: rgba(94,234,212,.25); }
.container { max-width: 1020px; margin: 0 auto; padding: 0 22px; }
.hl { color: var(--acc); }
.muted { color: var(--muted); }
.prompt { color: var(--acc2); }

/* ---------- ambient background ---------- */
.bg-orbs { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .16; }
.o1 { width: 520px; height: 520px; background: #0e7490; top: -160px; left: -120px; animation: drift 22s ease-in-out infinite alternate; }
.o2 { width: 420px; height: 420px; background: #6d28d9; top: 30%; right: -140px; animation: drift 26s ease-in-out infinite alternate-reverse; }
.o3 { width: 380px; height: 380px; background: #059669; bottom: -120px; left: 30%; animation: drift 30s ease-in-out infinite alternate; }
@keyframes drift { from { transform: translate(0,0) scale(1); } to { transform: translate(60px,40px) scale(1.15); } }

/* ---------- nav ---------- */
.nav { position: sticky; top: 0; z-index: 40; backdrop-filter: blur(14px);
  background: rgba(7,11,18,.72); border-bottom: 1px solid var(--line); }
.nav-inner { display: flex; justify-content: space-between; align-items: center; height: 56px; }
.nav-logo { font-family: var(--mono); font-size: 15px; color: #fff; }
.nav-links a { color: var(--dim); text-decoration: none; font-size: 14px; margin-left: 26px; transition: color .2s; }
.nav-links a:hover { color: var(--acc); }

/* ---------- hero ---------- */
.hero { padding: 64px 0 40px; }
.terminal { max-width: 620px; border: 1px solid var(--line2); border-radius: 12px; overflow: hidden;
  background: rgba(13,20,31,.7); box-shadow: 0 18px 60px rgba(0,0,0,.45); margin-bottom: 34px; }
.term-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: rgba(16,26,40,.8); }
.dot { width: 11px; height: 11px; border-radius: 50%; }
.dot.r { background: #ff5f57; } .dot.y { background: #febc2e; } .dot.g { background: #28c840; }
.term-title { margin-left: 8px; color: var(--muted); font-family: var(--mono); font-size: 12px; }
.term-body { padding: 16px 18px; font-family: var(--mono); font-size: 14px; min-height: 84px; }
.typer { color: #e2ecf7; }
.cursor { color: var(--acc); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.term-out { color: var(--acc); margin-top: 6px; min-height: 20px; font-size: 13.5px; }

.name { font-size: 3.1rem; font-weight: 800; letter-spacing: -1.5px; line-height: 1.05;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; margin-bottom: 10px; }
.tagline { color: var(--acc2); font-family: var(--mono); font-size: 1.02rem; margin-bottom: 18px; }
.bio { color: var(--dim); max-width: 640px; margin-bottom: 24px; font-size: 1.02rem; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.chip { border: 1px solid var(--line2); color: var(--acc); border-radius: 20px; padding: 4px 13px;
  font-size: 12.5px; font-family: var(--mono); background: rgba(94,234,212,.05); }

.cta { display: flex; gap: 12px; flex-wrap: wrap; }
.btn { display: inline-block; padding: 11px 22px; border-radius: 10px; font-size: 14.5px; font-weight: 600;
  text-decoration: none; transition: transform .15s, box-shadow .2s, background .2s; }
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: var(--grad); color: #04121a; box-shadow: 0 8px 28px rgba(34,211,238,.28); }
.btn.primary:hover { box-shadow: 0 10px 34px rgba(94,234,212,.4); }
.btn.ghost { border: 1px solid var(--line2); color: var(--txt); background: rgba(13,20,31,.6); }
.btn.ghost:hover { border-color: var(--acc); color: var(--acc); }

/* ---------- stats ---------- */
.stats { border-block: 1px solid var(--line); background: rgba(13,20,31,.5); padding: 26px 0; margin: 8px 0 0; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px; text-align: center; }
.stat .num { font-size: 1.9rem; font-weight: 800; font-family: var(--mono); background: var(--grad);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat .lbl { color: var(--muted); font-size: 12.5px; letter-spacing: .4px; text-transform: uppercase; margin-top: 2px; }

/* ---------- sections ---------- */
main { padding: 56px 0 90px; }
.section { margin-bottom: 64px; scroll-margin-top: 70px; }
.section-title { margin-bottom: 26px; font-size: 1.1rem; color: var(--dim); font-family: var(--mono); font-weight: 400; }
.section-title .prompt { color: var(--acc2); }

.about-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 34px; align-items: start; }
.about-text p { margin-bottom: 14px; color: var(--dim); }
.cap-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cap { border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: var(--panel); transition: border-color .2s, transform .2s; }
.cap:hover { border-color: var(--acc); transform: translateY(-2px); }
.cap .ic { font-size: 19px; margin-bottom: 6px; display: block; }
.cap .t { color: #e8f0fa; font-size: 13.5px; font-weight: 600; margin-bottom: 3px; }
.cap .d { color: var(--muted); font-size: 11.5px; line-height: 1.5; }

/* ---------- projects ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px;
  transition: border-color .25s, transform .25s, box-shadow .25s; position: relative; overflow: hidden; }
.card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: var(--grad); transform: scaleX(0); transform-origin: left; transition: transform .35s; }
.card:hover { border-color: var(--line2); transform: translateY(-3px); box-shadow: 0 14px 40px rgba(0,0,0,.4); }
.card:hover::before { transform: scaleX(1); }
.card h3 { color: #fff; font-size: 1.02rem; margin-bottom: 8px; }
.card .blurb { color: var(--dim); font-size: 13.5px; margin-bottom: 14px; line-height: 1.55; }
.card .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.card .tags span { font-size: 11px; color: var(--acc2); border: 1px solid var(--line); border-radius: 12px; padding: 1px 9px; font-family: var(--mono); }
.card a { color: var(--acc); text-decoration: none; font-size: 13px; font-family: var(--mono); }
.card a:hover { text-decoration: underline; }

/* ---------- timeline ---------- */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px;
  background: linear-gradient(180deg, var(--acc), var(--violet), transparent); }
.tl-item { position: relative; margin-bottom: 30px; }
.tl-dot { position: absolute; left: -26px; top: 6px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--bg); border: 3px solid var(--acc); box-shadow: 0 0 14px rgba(94,234,212,.6); }
.tl-when { color: var(--acc2); font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.tl-what { color: #e8f0fa; font-weight: 600; margin: 2px 0 6px; }
.tl-note { color: var(--muted); font-size: 13.5px; max-width: 640px; }

/* ---------- contact ---------- */
.contact-card { max-width: 680px; }
.row { display: flex; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.contact-card input, .contact-card textarea {
  flex: 1; min-width: 200px; background: var(--bg); color: var(--txt);
  border: 1px solid var(--line2); border-radius: 10px; padding: 11px 13px;
  font: inherit; font-size: 14.5px; outline: none; transition: border-color .2s, box-shadow .2s;
}
.contact-card input:focus, .contact-card textarea:focus { border-color: var(--acc); box-shadow: 0 0 0 3px rgba(94,234,212,.12); }
.contact-card textarea { width: 100%; resize: vertical; }
.contact-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: 12px; font-family: var(--mono); }
button { background: var(--grad); color: #04121a; border: 0; border-radius: 10px; padding: 11px 24px;
  font: inherit; font-weight: 700; cursor: pointer; font-size: 14.5px; transition: box-shadow .2s, transform .15s; }
button:hover { box-shadow: 0 8px 26px rgba(94,234,212,.35); transform: translateY(-1px); }
.status { margin-top: 12px; font-size: 13px; min-height: 18px; font-family: var(--mono); }
.status.ok { color: var(--acc); }
.status.err { color: var(--err); }

/* ---------- footer + chat ---------- */
footer { border-top: 1px solid var(--line); padding: 24px 0 34px; background: rgba(13,20,31,.5); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12.5px; font-family: var(--mono); }
.chat-btn { background: var(--panel); border: 1px solid var(--line2); color: var(--acc); }
.chat-mode-btn { background: var(--bg); border: 1px solid var(--line2); color: var(--dim); font-size: 12px;
  border-radius: 8px; padding: 5px 10px; cursor: pointer; flex: 1; }
.chat-mode-btn.active { background: var(--panel2, var(--panel)); border-color: var(--acc2, var(--acc)); color: var(--txt); }

.chat-panel { position: fixed; right: 20px; bottom: 74px; width: 350px; max-height: 480px;
  background: var(--panel); border: 1px solid var(--line2); border-radius: 14px;
  display: flex; flex-direction: column; overflow: hidden; z-index: 60;
  box-shadow: 0 20px 60px rgba(0,0,0,.55); }
.hidden { display: none !important; }
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px;
  border-bottom: 1px solid var(--line); color: var(--acc); font-size: 13.5px; font-weight: 600; }
.chat-head button { background: none; color: var(--dim); padding: 0 4px; font-size: 15px; box-shadow: none; transform: none; }
.chat-log { flex: 1; overflow-y: auto; padding: 14px; font-size: 13.5px; min-height: 180px; max-height: 300px; }
.msg { margin-bottom: 10px; }
.msg .who { color: var(--acc2); font-size: 11.5px; font-family: var(--mono); }
.msg .body { color: var(--txt); white-space: pre-wrap; word-break: break-word; }
.msg.mine .body { color: var(--acc); }
.chat-form { border-top: 1px solid var(--line); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.chat-form input { background: var(--bg); color: var(--txt); border: 1px solid var(--line2);
  border-radius: 9px; padding: 9px 11px; font: inherit; font-size: 13.5px; outline: none; }
.chat-form .chat-send { display: flex; gap: 8px; }
.chat-send input { flex: 1; }

/* ---------- reveal animations ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
.grid > *, .cap, .tl-item, .contact-card { transition: opacity .6s ease, transform .6s ease; }

/* ---------- admin ---------- */
.admin-main { padding: 40px 0 90px; }
.admin-main h1 { font-size: 1.7rem; margin-bottom: 26px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.admin-block { margin-bottom: 40px; }
.admin-block h2 { font-size: 1rem; color: var(--acc2); font-family: var(--mono); margin-bottom: 14px; }
.admin-block input, .admin-block textarea { background: var(--bg); color: var(--txt);
  border: 1px solid var(--line2); border-radius: 9px; padding: 9px 11px; font: inherit;
  font-size: 13.5px; width: 100%; margin-bottom: 8px; outline: none; }
.admin-block input:focus, .admin-block textarea:focus { border-color: var(--acc); }
.admin-block .mini { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-block .mini input { flex: 1; min-width: 140px; }
.admin-block .danger { background: var(--err); color: #200505; }
.item-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.inbox-item { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; font-size: 13.5px; background: var(--panel); }
.inbox-item .meta { color: var(--muted); font-size: 11.5px; font-family: var(--mono); margin-bottom: 4px; }
.inbox-item .body { white-space: pre-wrap; word-break: break-word; color: var(--txt); }
#login-form, #totp-wrap { max-width: 420px; }
#login-form input, #totp-wrap input { background: var(--bg); color: var(--txt); border: 1px solid var(--line2);
  border-radius: 9px; padding: 11px 13px; font: inherit; width: 100%; margin-bottom: 10px; outline: none; }
#login-form input:focus, #totp-wrap input:focus { border-color: var(--acc); }
#totp-wrap .qr { display: block; margin: 0 auto 14px; border-radius: 10px; border: 1px solid var(--line); }
#totp-wrap .secret { text-align: center; font-family: var(--mono); color: var(--acc2); font-size: 13px; margin-bottom: 6px; }
#totp-wrap .rec-codes { font-family: var(--mono); font-size: 13px; color: var(--txt); background: var(--bg);
  border: 1px solid var(--line2); border-radius: 9px; padding: 12px; margin-bottom: 12px; line-height: 1.9; }
.state-badge { display: inline-block; font-family: var(--mono); font-size: 12px; border: 1px solid var(--line2);
  border-radius: 14px; padding: 3px 12px; margin-left: 10px; }
.state-badge.on { color: var(--acc); border-color: var(--acc); }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .name { font-size: 2.3rem; }
  .about-grid { grid-template-columns: 1fr; }
  .nav-links a { margin-left: 16px; font-size: 13px; }
  .hero { padding: 40px 0 28px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
