/* =========================================================
   ESH ZHUYKOV — portfolio v3
   Theme system: every color that changes between themes is a
   CSS custom property set by script.js (THEMES table).
   Defaults below = "ember" (dark).
   ========================================================= */
:root {
  --ac: #ffb454;            /* accent */
  --ac2: #ff6b4a;           /* secondary accent */
  --bg: #0b0906;            /* page background */
  --bgt: rgba(70, 45, 15, 0.35);  /* top radial tint */
  --acs: rgba(255, 180, 84, 0.08);  /* accent surface */
  --acs2: rgba(255, 180, 84, 0.18);
  --acb: rgba(255, 180, 84, 0.35);  /* accent border */
  --acg: rgba(255, 180, 84, 0.35);  /* accent glow */
  --tx: #ece7de;            /* text main */
  --txc: #c4bcab;           /* text card body */
  --tx2: #9a927f;           /* text secondary */
  --tx3: #7d7668;           /* text muted */
  --tx4: #57503f;           /* text faint */
  --tx5: #3a352a;           /* text faintest */
  --line: rgba(255, 255, 255, 0.08);
  --line-soft: rgba(255, 255, 255, 0.06);
  --line2: rgba(255, 255, 255, 0.14);
  --card: rgba(14, 12, 8, 0.4);
  --panel: rgba(12, 10, 7, 0.65);
  --side: rgba(10, 9, 6, 0.6);
  --gridline: rgba(255, 255, 255, 0.022);
  --modal-bg: #0b0a08;
  --shadow-deep: rgba(0, 0, 0, 0.55);
  --font-display: 'Syne', 'Unbounded', sans-serif; /* Unbounded carries Cyrillic */
}

html { scroll-behavior: smooth; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--tx);
  font-family: 'Ubuntu', sans-serif;
  overflow-x: hidden;
  background-image:
    linear-gradient(var(--gridline) 1px, transparent 1px),
    linear-gradient(90deg, var(--gridline) 1px, transparent 1px),
    radial-gradient(ellipse at 50% -10%, var(--bgt) 0%, transparent 60%);
  background-size: 56px 56px, 56px 56px, 100% 100vh;
}
body.theme-anim, body.theme-anim * { transition: background-color 0.45s ease, color 0.45s ease, border-color 0.45s ease !important; }

::selection { background: var(--acs2); }
input { outline: none; }
:focus-visible { outline: 2px solid var(--acb); outline-offset: 2px; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes pulseHint { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(0.94) translateY(12px); } to { opacity: 1; transform: none; } }

.ac-text { color: var(--ac); }
.dim { color: var(--tx5); }

/* scroll reveal */
.rv { opacity: 0; transform: translateY(24px); transition: opacity 0.7s cubic-bezier(0.22,1,0.36,1), transform 0.7s cubic-bezier(0.22,1,0.36,1); }
.rv.in { opacity: 1; transform: none; }

/* ===== LAYOUT ===== */
.layout { display: flex; align-items: flex-start; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.sidebar {
  position: sticky; top: 0; height: 100vh; width: 256px; flex: 0 0 256px;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 30px 18px 24px 22px;
  border-right: 1px solid var(--line);
  background: var(--side);
  backdrop-filter: blur(14px) saturate(160%);
  z-index: 50;
  font-family: 'Ubuntu Mono', monospace;
}
.brand {
  font-family: var(--font-display); font-weight: 800; font-size: 15.5px;
  letter-spacing: 0.01em; white-space: nowrap; overflow: hidden; max-width: 100%;
}
.brand-sub { font-size: 11px; color: var(--tx3); margin-top: 6px; }
.host-path { margin-top: 32px; font-size: 12px; color: var(--tx3); }
.step-nav { display: flex; flex-direction: column; margin-top: 10px; }

.step-btn {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: transparent; border: none; border-radius: 4px;
  padding: 9px 10px; cursor: pointer; text-align: left;
  font-family: 'Ubuntu Mono', monospace; transition: background 0.3s;
}
.step-btn.is-active { background: var(--acs); }
.step-pre { font-size: 12px; color: var(--tx4); }
.step-label { font-size: 13px; color: var(--tx3); transition: color 0.3s; }
.step-mark { margin-left: auto; font-size: 11px; color: var(--tx5); transition: color 0.3s; }
.step-btn.is-active .step-label, .step-btn.is-active .step-mark { color: var(--ac); }
.step-btn.is-done .step-label, .step-btn.is-done .step-mark { color: var(--tx2); }

.progress-track { margin-top: 24px; height: 2px; background: var(--line); border-radius: 1px; position: relative; overflow: hidden; }
.progress-fill { position: absolute; inset: 0; width: 20%; background: var(--ac); transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1); }
.progress-label { font-size: 10px; color: var(--tx4); margin-top: 8px; }

.palette-hint {
  margin-top: 22px; display: flex; align-items: center; gap: 8px; width: 100%;
  background: transparent; border: 1px dashed var(--line2); border-radius: 4px;
  padding: 8px 10px; cursor: pointer; font-family: 'Ubuntu Mono', monospace;
  font-size: 11px; color: var(--tx3); transition: border-color 0.3s, color 0.3s;
}
.palette-hint:hover { border-color: var(--acb); color: var(--ac); }
.palette-hint kbd {
  margin-left: auto; font-family: inherit; font-size: 10px; color: var(--tx2);
  border: 1px solid var(--line2); border-radius: 3px; padding: 2px 5px;
}

.sidebar-foot { display: flex; flex-direction: column; gap: 12px; }
.host-info { font-size: 10px; color: var(--tx4); line-height: 1.8; }
.theme-list { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.theme-opt {
  display: flex; align-items: center; gap: 7px;
  font-family: 'Ubuntu Mono', monospace; font-size: 11px; color: var(--tx3);
  background: transparent; border: none; border-radius: 4px; padding: 5px 8px;
  cursor: pointer; text-align: left; transition: background 0.25s, color 0.25s;
}
.theme-opt:hover { color: var(--tx); background: var(--acs); }
.theme-opt.is-active { color: var(--ac); background: var(--acs); }
.theme-opt .sw { width: 9px; height: 9px; border-radius: 2px; flex: 0 0 auto; box-shadow: 0 0 0 1px var(--line2); }
.theme-opt.is-active .nm::after { content: '_'; animation: blink 1.1s step-end infinite; }
.lang-row { display: flex; gap: 6px; }
.lang-btn {
  font-family: 'Ubuntu Mono', monospace; font-size: 11px; letter-spacing: 0.08em;
  color: var(--tx3); background: transparent; border: 1px solid var(--line2);
  border-radius: 4px; padding: 5px 10px; cursor: pointer; transition: all 0.25s;
}
.lang-btn.is-active { color: var(--ac); border-color: var(--acb); background: var(--acs); }
.loc { font-size: 10px; color: var(--tx5); }

/* ===== MAIN / SECTIONS ===== */
main { flex: 1; min-width: 0; }
.section { min-height: 100vh; padding: 110px 7vw; border-top: 1px solid var(--line-soft); }

.eyebrow { font-family: 'Ubuntu Mono', monospace; font-size: 12px; letter-spacing: 0.2em; color: var(--ac); }
.h-title { font-family: var(--font-display); font-weight: 700; font-size: clamp(30px, 4vw, 54px); letter-spacing: -0.01em; margin: 20px 0 12px; text-transform: uppercase; }
.h-desc { color: var(--tx2); font-size: 14px; max-width: 560px; line-height: 1.7; margin: 0 0 34px; text-wrap: pretty; }

/* ===== HERO ===== */
.hero-section {
  position: relative; min-height: 100vh; display: flex; flex-direction: column;
  justify-content: center; padding: 96px 7vw 120px; overflow: hidden; border-top: none;
}
.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.hero-content { position: relative; z-index: 2; }
.hero-content .eyebrow { animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) both; }
.hero-title {
  font-family: var(--font-display); font-weight: 800; font-size: clamp(46px, 8vw, 112px);
  line-height: 0.98; letter-spacing: -0.02em; margin: 26px 0 0;
  animation: fadeUp 0.8s 0.12s cubic-bezier(0.22, 1, 0.36, 1) both; text-transform: uppercase;
}
.hero-sub {
  font-family: var(--font-display); font-weight: 600; font-size: clamp(20px, 2.6vw, 34px);
  line-height: 1.2; margin: 18px 0 0; color: var(--tx2);
  animation: fadeUp 0.8s 0.24s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.hero-desc {
  max-width: 540px; font-size: 15px; line-height: 1.7; color: var(--tx2); margin: 26px 0 0;
  animation: fadeUp 0.8s 0.36s cubic-bezier(0.22, 1, 0.36, 1) both; text-wrap: pretty;
}
.hero-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 34px; animation: fadeUp 0.8s 0.48s cubic-bezier(0.22, 1, 0.36, 1) both; }
.pill-link {
  font-family: 'Ubuntu Mono', monospace; font-size: 13px; color: var(--tx); text-decoration: none;
  border: 1px solid var(--line2); border-radius: 4px; padding: 10px 16px;
  background: var(--panel); backdrop-filter: blur(10px);
  transition: border-color 0.3s, color 0.3s, transform 0.3s;
}
.pill-link:hover { border-color: var(--ac); color: var(--ac); transform: translateY(-2px); }
.scroll-hint {
  position: absolute; bottom: 34px; left: 7vw; font-family: 'Ubuntu Mono', monospace;
  font-size: 11px; letter-spacing: 0.16em; color: var(--tx4); z-index: 2;
  animation: pulseHint 2.4s ease-in-out infinite;
}

/* ===== STACK / SCHEMATIC TREE ===== */
.stack-tree {
  max-width: 900px; border: 1px solid var(--line); border-radius: 6px; background: var(--card);
  padding: 20px 24px 18px; font-family: 'Ubuntu Mono', monospace; position: relative; overflow: hidden;
}
.stack-tree::before { /* blueprint grid */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(var(--gridline) 1px, transparent 1px), linear-gradient(90deg, var(--gridline) 1px, transparent 1px);
  background-size: 28px 28px;
}
.stack-head { font-size: 12px; color: var(--tx3); margin-bottom: 14px; position: relative; }
.stack-prompt { color: var(--ac); }
.stack-row { position: relative; border-radius: 4px; padding: 8px 10px 10px; transition: background 0.25s; }
.stack-row:hover { background: var(--acs); }
.stack-line1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stack-pre, .stack-pipe { color: var(--tx4); font-size: 12px; width: 30px; flex: 0 0 30px; }
.stack-tag { color: var(--ac); font-size: 13px; letter-spacing: 0.1em; font-weight: 700; }
.stack-bar { display: inline-flex; gap: 3px; margin-left: 2px; }
.stack-bar i { width: 7px; height: 11px; background: var(--line2); display: block; transform: skewX(-12deg); transition: background 0.3s; }
.stack-bar i.on { background: var(--ac); box-shadow: 0 0 7px var(--acg); }
.stack-title { color: var(--tx2); font-family: 'Ubuntu', sans-serif; font-size: 13px; margin-left: auto; }
.stack-items { display: flex; gap: 10px; margin-top: 7px; align-items: flex-start; }
.stack-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.skill-item {
  font-family: 'Ubuntu Mono', monospace; font-size: 12px; color: var(--txc);
  border: 1px solid var(--line); border-radius: 4px; padding: 4px 9px;
  transition: border-color 0.25s, color 0.25s;
}
.skill-item:hover { border-color: var(--acb); color: var(--ac); }
.stack-foot { margin-top: 14px; font-size: 11px; color: var(--tx4); position: relative; }

/* ===== PROJECTS / COVERFLOW ===== */
.projects-section { padding-left: 0; padding-right: 0; overflow: hidden; }
.section-pad { padding: 0 7vw; }
.scroller {
  display: flex; gap: 40px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth;
  padding: 30px calc(50% - 160px) 38px; scrollbar-width: none; align-items: center;
}
.scroller::-webkit-scrollbar { display: none; }
.project-card {
  flex: 0 0 320px; scroll-snap-align: center; display: flex; flex-direction: column;
  align-items: center; gap: 18px;
  transform: perspective(1200px) rotateY(var(--ry, 0deg)) scale(var(--scale, 0.78));
  opacity: var(--opacity, 0.35); filter: blur(var(--blur, 1.5px)) saturate(var(--sat, 0.6));
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.5s, filter 0.5s;
}

/* --- phone mockup --- */
.phone {
  width: 300px; height: 640px; border-radius: 44px; background: #0e0e10;
  border: 1px solid var(--bezel, rgba(255,255,255,0.16));
  box-shadow: var(--phone-shadow, 0 16px 40px rgba(0,0,0,0.4)), inset 0 0 0 2px #000;
  padding: 12px; position: relative; transition: border-color 0.5s, box-shadow 0.5s;
}
.phone::before { /* volume keys */
  content: ''; position: absolute; left: -2px; top: 130px; width: 2px; height: 88px;
  border-radius: 2px 0 0 2px; background: #26262a;
  box-shadow: 0 114px 0 0 #26262a;
}
.phone::after { /* power key */
  content: ''; position: absolute; right: -2px; top: 170px; width: 2px; height: 60px;
  border-radius: 0 2px 2px 0; background: #26262a;
}
.phone-screen {
  width: 100%; height: 100%; border-radius: 32px; overflow: hidden; position: relative;
  background: var(--screen-bg, #0d0c0a);
  isolation: isolate; /* clip scaled iframe corners reliably */
}
.island {
  position: absolute; top: 9px; left: 50%; transform: translateX(-50%);
  width: 74px; height: 20px; border-radius: 11px; background: #000; z-index: 6;
}
.phone-frame-scale { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; }
.phone-frame-scale iframe {
  width: 390px; height: 871px; border: none; background: #0d0c0a;
  transform: scale(0.70769); transform-origin: 0 0; pointer-events: none;
}
/* --- mock app screens (concept projects) --- */
.phone-mock { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 46px 18px 18px; }
.mock-app { font-family: 'Ubuntu Mono', monospace; font-size: 10px; letter-spacing: 0.2em; }
.mock-head { font-family: var(--font-display); font-weight: 700; font-size: 23px; line-height: 1.12; margin-top: 12px; color: #fff; text-wrap: pretty; }
.mock-sub { font-size: 12px; color: rgba(255,255,255,0.55); margin-top: 8px; line-height: 1.5; }
.mock-rows { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }
.mock-row {
  display: flex; justify-content: space-between; align-items: center; background: rgba(255,255,255,0.06);
  backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,0.08); border-radius: 6px; padding: 11px 13px;
}
.mock-row-l { font-size: 12px; color: rgba(255,255,255,0.85); }
.mock-row-r { font-family: 'Ubuntu Mono', monospace; font-size: 12px; }
.mock-cta {
  text-align: center; font-family: 'Ubuntu Mono', monospace; font-size: 13px; font-weight: 700;
  color: #0b0906; border-radius: 6px; padding: 13px; margin-top: 6px;
}
.mock-badge {
  position: absolute; top: 44px; right: 14px; font-family: 'Ubuntu Mono', monospace; font-size: 9px;
  letter-spacing: 0.12em; color: #0b0906; background: var(--ac); border-radius: 3px; padding: 3px 7px;
}

.project-caption { text-align: center; }
.project-caption-top { display: flex; align-items: baseline; gap: 10px; justify-content: center; }
.project-num { font-family: 'Ubuntu Mono', monospace; font-size: 11px; color: var(--ac); }
.project-name { font-family: var(--font-display); font-weight: 700; font-size: 20px; }
.project-tagline { font-family: 'Ubuntu Mono', monospace; font-size: 11px; color: var(--tx3); margin-top: 4px; }
.project-cta-slot { height: 46px; display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 8px; }
.expand-btn {
  font-family: 'Ubuntu Mono', monospace; font-size: 12px; letter-spacing: 0.08em; color: #0b0906;
  background: var(--ac); border: none; border-radius: 4px; padding: 12px 24px; cursor: pointer;
  box-shadow: 0 0 26px var(--acg); animation: fadeUp 0.4s ease both;
}
.expand-btn.ghost { color: var(--ac); background: var(--acs); border: 1px solid var(--acb); box-shadow: none; }

.carousel-controls { display: flex; align-items: center; justify-content: center; gap: 22px; }
.nav-btn {
  width: 38px; height: 38px; border: 1px solid var(--line2); border-radius: 4px;
  background: var(--panel); color: var(--tx); cursor: pointer; font-size: 14px; transition: border-color 0.3s;
}
.nav-btn:hover { border-color: var(--ac); }
.dots { display: flex; align-items: center; gap: 7px; }
.dot-btn {
  width: var(--dot-w, 6px); height: 6px; border-radius: 3px; border: none;
  background: var(--dot-bg, rgba(128,128,128,0.3)); cursor: pointer; padding: 0;
  transition: width 0.35s, background 0.35s;
}

/* ===== VIEWER MODAL (phone / tablet / desktop) ===== */
.viewer-modal {
  display: none; position: fixed; inset: 0; z-index: 200; background: rgba(5, 4, 3, 0.88);
  backdrop-filter: blur(10px); align-items: center; justify-content: center; padding: 2.5vh 2.5vw;
}
.viewer-modal.is-open { display: flex; animation: fadeUp 0.3s ease both; }
.viewer-inner {
  width: 100%; max-width: 1280px; height: 100%;
  border: 1px solid var(--acb); border-radius: 6px; background: var(--modal-bg);
  display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 0 90px var(--acg);
}
.viewer-head {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.viewer-kicker { font-family: 'Ubuntu Mono', monospace; font-size: 11px; color: var(--ac); }
.viewer-title { font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--tx); }
.viewer-tagline { font-family: 'Ubuntu Mono', monospace; font-size: 11px; color: var(--tx3); }
.viewer-devices { margin-left: auto; display: flex; gap: 6px; }
.viewer-devices button {
  font-family: 'Ubuntu Mono', monospace; font-size: 11px; line-height: 1;
  background: transparent; color: var(--tx2);
  border: 1px solid var(--line2); border-radius: 4px; padding: 8px 12px; cursor: pointer;
  transition: all 0.25s;
}
.viewer-devices button.is-active { border-color: var(--acb); background: var(--acs); color: var(--ac); }
.viewer-live, .viewer-close {
  font-family: 'Ubuntu Mono', monospace; font-size: 11px; color: var(--tx); background: none;
  border: 1px solid var(--line2); border-radius: 4px; padding: 8px 14px; cursor: pointer;
  text-decoration: none; transition: border-color 0.3s, color 0.3s;
}
.viewer-live:hover, .viewer-close:hover { border-color: var(--ac); color: var(--ac); }
.viewer-body {
  flex: 1; display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative; padding: 18px;
  background:
    linear-gradient(var(--gridline) 1px, transparent 1px),
    linear-gradient(90deg, var(--gridline) 1px, transparent 1px);
  background-size: 40px 40px;
}
.dev-wrap { position: relative; flex: 0 0 auto; transform-origin: center center; }
.dev-frame { border: none; display: block; background: #fff; }
/* phone frame */
.dev-phone { padding: 14px; background: #101010; border-radius: 52px; box-shadow: 0 30px 80px var(--shadow-deep), inset 0 0 0 3px #000, inset 0 0 0 4px rgba(255,255,255,0.07); position: relative; }
.dev-phone .dev-frame { border-radius: 38px; }
.dev-phone::after { content: ''; position: absolute; top: 24px; left: 50%; transform: translateX(-50%); width: 90px; height: 26px; border-radius: 14px; background: #000; }
/* tablet frame */
.dev-tablet { padding: 22px; background: #101010; border-radius: 34px; box-shadow: 0 30px 80px var(--shadow-deep), inset 0 0 0 3px #000, inset 0 0 0 4px rgba(255,255,255,0.07); }
.dev-tablet .dev-frame { border-radius: 12px; }
/* desktop frame (browser chrome) */
.dev-desktop { background: #16130f; border-radius: 10px; overflow: hidden; box-shadow: 0 30px 80px var(--shadow-deep); border: 1px solid rgba(255,255,255,0.1); }
.dev-chrome { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: #1d1913; border-bottom: 1px solid rgba(255,255,255,0.07); }
.dev-chrome .dot { width: 10px; height: 10px; border-radius: 50%; }
.dev-url {
  flex: 1; font-family: 'Ubuntu Mono', monospace; font-size: 11px; color: #9a927f;
  background: rgba(0,0,0,0.35); border-radius: 5px; padding: 5px 12px; margin-left: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* request-demo panel (concept projects) */
.req-wrap { display: flex; align-items: center; justify-content: center; gap: 48px; flex-wrap: wrap; padding: 20px; overflow: auto; max-height: 100%; }
.req-note { max-width: 380px; display: flex; flex-direction: column; gap: 16px; }
.req-note p { color: var(--txc); font-size: 14px; line-height: 1.75; margin: 0; text-wrap: pretty; }
.req-badge { font-family: 'Ubuntu Mono', monospace; font-size: 10px; letter-spacing: 0.14em; color: var(--ac); border: 1px dashed var(--acb); border-radius: 4px; padding: 6px 10px; align-self: flex-start; }
.req-btn {
  font-family: 'Ubuntu Mono', monospace; font-size: 13px; color: #0b0906; background: var(--ac);
  border-radius: 4px; padding: 13px 22px; text-decoration: none; align-self: flex-start;
  box-shadow: 0 0 26px var(--acg);
}
.req-phone { width: 300px; height: 640px; flex: 0 0 auto; }

/* ===== STORY / GAME ===== */
.story-section { padding-bottom: 90px; }
.game-wrap {
  position: relative; border: 1px solid var(--line); border-radius: 6px; overflow: hidden;
  background: #05060a; height: min(72vh, 700px); min-height: 420px;
}
.game-wrap:fullscreen { height: 100vh; border-radius: 0; }
.game-canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.game-hud {
  position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between;
  align-items: flex-start; padding: 12px 14px; z-index: 6; pointer-events: none;
}
.hud-left, .hud-right { display: flex; gap: 8px; }
.hud-chip {
  font-family: 'Ubuntu Mono', monospace; font-size: 11px; letter-spacing: 0.1em; color: #ece7de;
  background: rgba(5, 6, 10, 0.7); border: 1px solid rgba(255,255,255,0.12); border-radius: 4px;
  padding: 8px 12px; backdrop-filter: blur(8px);
}
.hud-chip b { color: var(--ac); font-weight: 700; }
.hud-btn {
  pointer-events: auto; width: 34px; height: 34px; font-size: 14px; color: #ece7de;
  background: rgba(5, 6, 10, 0.7); border: 1px solid rgba(255,255,255,0.12); border-radius: 4px;
  cursor: pointer; backdrop-filter: blur(8px); transition: border-color 0.25s, color 0.25s;
}
.hud-btn:hover { border-color: var(--ac); color: var(--ac); }
.hud-btn.off { opacity: 0.45; text-decoration: line-through; }
.game-objective {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 6;
  font-family: 'Ubuntu Mono', monospace; font-size: 11px; letter-spacing: 0.12em; color: var(--ac);
  background: rgba(5, 6, 10, 0.7); border: 1px solid var(--acb); border-radius: 4px;
  padding: 8px 14px; backdrop-filter: blur(8px); pointer-events: none; max-width: 70%;
  text-align: center;
}
.game-prompt {
  position: absolute; bottom: 18%; left: 50%; transform: translateX(-50%); z-index: 6;
  font-family: 'Ubuntu Mono', monospace; font-size: 13px; color: #0b0906;
  background: var(--ac); border-radius: 4px; padding: 10px 18px; pointer-events: none;
  box-shadow: 0 0 30px var(--acg); animation: pulseHint 1.6s infinite;
}
.game-enter {
  position: absolute; inset: 0; z-index: 8; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; text-align: center;
  background: radial-gradient(ellipse at 50% 60%, rgba(5,6,10,0.25), rgba(5,6,10,0.82));
  backdrop-filter: blur(2px); transition: opacity 0.4s; padding: 20px;
}
.game-enter.is-hidden { opacity: 0; pointer-events: none; }
.game-enter-label { font-family: 'Ubuntu Mono', monospace; font-size: 11px; letter-spacing: 0.18em; color: #7d7668; }
.game-enter-title { font-family: var(--font-display); font-weight: 800; font-size: clamp(24px, 3.4vw, 44px); letter-spacing: 0.02em; color: #ece7de; text-transform: uppercase; }
.game-enter-hint { font-family: 'Ubuntu Mono', monospace; font-size: 12px; color: var(--ac); line-height: 1.9; animation: pulseHint 2.2s infinite; white-space: pre-line; }
.game-play-btn {
  font-family: 'Ubuntu Mono', monospace; font-size: 14px; font-weight: 700; letter-spacing: 0.14em;
  color: #0b0906; background: var(--ac); border: none; border-radius: 4px; padding: 15px 42px;
  cursor: pointer; box-shadow: 0 0 40px var(--acg); transition: transform 0.2s;
}
.game-play-btn:hover { transform: scale(1.06); }
.game-fallback {
  position: absolute; inset: 0; z-index: 9; display: flex; align-items: center; justify-content: center;
  font-family: 'Ubuntu Mono', monospace; font-size: 13px; color: #9a927f; padding: 30px; text-align: center;
  background: #05060a;
}

/* mobile game controls */
.joy-zone { position: absolute; left: 0; bottom: 0; width: 46%; height: 55%; z-index: 7; touch-action: none; }
.joy-base {
  position: absolute; width: 108px; height: 108px; border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.25); background: rgba(255,255,255,0.06);
  backdrop-filter: blur(4px); display: none; transform: translate(-50%, -50%);
}
.joy-base.on { display: block; }
.joy-stick {
  position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; border-radius: 50%;
  background: var(--ac); opacity: 0.85; transform: translate(-50%, -50%); box-shadow: 0 0 18px var(--acg);
}
.game-mbtn {
  position: absolute; z-index: 7; width: 62px; height: 62px; border-radius: 50%;
  font-family: 'Ubuntu Mono', monospace; font-size: 20px; font-weight: 700; color: #ece7de;
  background: rgba(255,255,255,0.08); border: 1.5px solid rgba(255,255,255,0.25);
  backdrop-filter: blur(4px); touch-action: none; user-select: none; -webkit-user-select: none;
}
.game-mbtn:active { background: var(--acs2); border-color: var(--ac); }
.game-mbtn-jump { right: 20px; bottom: 26px; }
.game-mbtn-act { right: 98px; bottom: 78px; color: #0b0906; background: var(--ac); border-color: var(--ac); }

/* chapter card */
.chapter-card {
  position: absolute; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center;
  background: rgba(5, 6, 10, 0.72); backdrop-filter: blur(6px); padding: 22px;
}
.chapter-card[hidden] { display: none; }
.chapter-inner {
  max-width: 520px; width: 100%; border: 1px solid var(--acb); border-radius: 6px;
  background: rgba(10, 11, 16, 0.96); padding: 28px 30px; animation: popIn 0.35s cubic-bezier(0.22,1,0.36,1) both;
  box-shadow: 0 0 70px var(--acg); max-height: 100%; overflow: auto;
}
.chapter-num { font-family: 'Ubuntu Mono', monospace; font-size: 11px; letter-spacing: 0.2em; color: var(--ac); }
.chapter-title { font-family: var(--font-display); font-weight: 800; font-size: clamp(20px, 2.4vw, 30px); margin-top: 12px; color: #ece7de; text-transform: uppercase; line-height: 1.1; }
.chapter-text { font-size: 14px; line-height: 1.75; color: #c4bcab; margin: 14px 0 0; text-wrap: pretty; }
.chapter-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.chapter-tags span {
  font-family: 'Ubuntu Mono', monospace; font-size: 11px; color: var(--ac);
  border: 1px solid var(--acb); background: var(--acs); border-radius: 4px; padding: 4px 9px;
}
.chapter-btn {
  display: inline-block; margin-top: 22px; font-family: 'Ubuntu Mono', monospace; font-size: 13px;
  font-weight: 700; letter-spacing: 0.08em; color: #0b0906; background: var(--ac); border: none;
  border-radius: 4px; padding: 12px 26px; cursor: pointer; text-decoration: none;
}
.chapter-btn.ghost { color: var(--ac); background: transparent; border: 1px solid var(--acb); font-weight: 400; }
.finale-links { display: flex; flex-wrap: wrap; gap: 10px; }

/* ===== TIMELINE ===== */
.timeline-head { margin: 46px 0 22px; font-family: 'Ubuntu Mono', monospace; font-size: 12px; color: var(--tx4); }
.timeline { position: relative; max-width: 760px; padding-left: 34px; display: flex; flex-direction: column; gap: 16px; }
.timeline-rail {
  position: absolute; left: 8px; top: 8px; bottom: 8px; width: 1px;
  background: linear-gradient(var(--ac), var(--ac2), transparent);
}
.timeline-item { position: relative; }
.timeline-dot {
  position: absolute; left: -30px; top: 24px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--ac); box-shadow: 0 0 10px var(--acg);
}
.timeline-card {
  border: 1px solid var(--line); border-radius: 4px; background: var(--card);
  padding: 20px 24px; transition: border-color 0.3s;
}
.timeline-card:hover { border-color: var(--acb); }
.timeline-period { font-family: 'Ubuntu Mono', monospace; font-size: 11px; letter-spacing: 0.14em; color: var(--ac); }
.timeline-title { font-family: var(--font-display); font-weight: 700; font-size: 18px; margin-top: 8px; }
.timeline-org { font-size: 13px; color: var(--tx2); margin-top: 2px; }
.timeline-desc { font-size: 13px; line-height: 1.65; color: var(--txc); margin: 10px 0 0; text-wrap: pretty; }

/* ===== TERMINAL (always dark — it's a terminal) ===== */
.terminal {
  max-width: 860px; border: 1px solid rgba(255,255,255,0.1); border-radius: 4px;
  background: rgba(8, 7, 5, 0.92); backdrop-filter: blur(12px) saturate(160%);
  overflow: hidden; position: relative; box-shadow: 0 30px 80px var(--shadow-deep); cursor: text;
  color: #ece7de;
}
.term-titlebar {
  display: flex; align-items: center; gap: 8px; padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.02);
}
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot-red { background: #ff5f57; }
.dot-yellow { background: #febc2e; }
.dot-green { background: #28c840; }
.term-titletext { font-family: 'Ubuntu Mono', monospace; font-size: 11px; color: #7d7668; margin-left: 10px; }
.term-live { margin-left: auto; font-family: 'Ubuntu Mono', monospace; font-size: 10px; color: var(--ac); animation: pulseHint 2.2s infinite; }
.term-scanlines {
  position: absolute; inset: 41px 0 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,0.016) 0 1px, transparent 1px 3px);
  z-index: 3;
}
.term-body { height: 360px; overflow-y: auto; padding: 18px 20px; font-family: 'Ubuntu Mono', monospace; font-size: 13.5px; line-height: 1.7; scrollbar-width: thin; scrollbar-color: var(--acb) transparent; }
.term-lines div { white-space: pre-wrap; }
.kinetika-embed { border: 1px solid var(--acb); border-radius: 4px; margin: 12px 0; overflow: hidden; position: relative; }
.kinetika-embed canvas { display: block; width: 100%; height: 260px; }
.kin-stop {
  position: absolute; top: 8px; right: 8px; font-family: 'Ubuntu Mono', monospace; font-size: 11px;
  color: var(--ac); background: rgba(8, 7, 5, 0.8); border: 1px solid var(--acb); border-radius: 4px;
  padding: 5px 10px; cursor: pointer;
}
.term-prompt { display: flex; align-items: center; gap: 8px; }
.term-prompt-label { color: var(--ac); }
.term-input {
  flex: 1; background: none; border: none; color: #ece7de; font-family: 'Ubuntu Mono', monospace;
  font-size: 13.5px; caret-color: var(--ac); padding: 0; min-width: 40px;
}
.term-caret { width: 8px; height: 16px; background: var(--ac); animation: blink 1.1s step-end infinite; flex: 0 0 auto; }
.term-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 16px; border-top: 1px solid rgba(255,255,255,0.07); background: rgba(255,255,255,0.015); }
.term-chips-label { font-family: 'Ubuntu Mono', monospace; font-size: 11px; color: #57503f; align-self: center; }
.chip-btn {
  font-family: 'Ubuntu Mono', monospace; font-size: 12px; color: var(--ac); background: var(--acs);
  border: 1px solid var(--acb); border-radius: 4px; padding: 7px 13px; cursor: pointer; transition: background 0.25s;
}
.chip-btn:hover { background: var(--acs2); }

.footer {
  margin-top: 80px; display: flex; flex-wrap: wrap; gap: 24px; align-items: baseline;
  font-family: 'Ubuntu Mono', monospace; font-size: 12px; color: var(--tx4);
}
.footer-link { color: var(--tx2); text-decoration: none; }
.footer-link:hover { color: var(--ac); }

/* ===== MOBILE DOCK + CORNER BAR ===== */
.mobile-dock {
  display: none; position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 90;
  gap: 4px; padding: 6px; border: 1px solid var(--line2); border-radius: 6px;
  background: var(--panel); backdrop-filter: blur(14px) saturate(160%);
  box-shadow: 0 16px 40px var(--shadow-deep);
}
.dock-btn {
  min-width: 48px; min-height: 44px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px; background: transparent; border: none; border-radius: 4px;
  cursor: pointer; padding: 4px 8px;
}
.dock-btn.is-active { background: var(--acs); }
.dock-num { font-family: 'Ubuntu Mono', monospace; font-size: 11px; color: var(--tx3); }
.dock-mark { font-family: 'Ubuntu Mono', monospace; font-size: 9px; color: var(--tx5); }
.dock-btn.is-active .dock-num, .dock-btn.is-active .dock-mark { color: var(--ac); }
.dock-btn.is-done .dock-num, .dock-btn.is-done .dock-mark { color: var(--tx2); }

.corner-bar { display: none; position: fixed; top: 12px; right: 12px; z-index: 90; gap: 6px; }
.corner-bar button {
  font-family: 'Ubuntu Mono', monospace; font-size: 12px; color: var(--tx); min-width: 40px; min-height: 36px;
  background: var(--panel); border: 1px solid var(--line2); border-radius: 4px; cursor: pointer;
  backdrop-filter: blur(10px);
}

/* ===== COMMAND PALETTE ===== */
.palette {
  display: none; position: fixed; inset: 0; z-index: 300; background: rgba(5, 4, 3, 0.7);
  backdrop-filter: blur(6px); align-items: flex-start; justify-content: center; padding: 12vh 4vw 4vh;
}
.palette.is-open { display: flex; }
.palette-box {
  width: 100%; max-width: 560px; border: 1px solid var(--acb); border-radius: 6px;
  background: var(--modal-bg); box-shadow: 0 0 70px var(--acg); overflow: hidden;
  animation: popIn 0.22s ease both;
}
.palette-input {
  width: 100%; background: transparent; border: none; border-bottom: 1px solid var(--line);
  color: var(--tx); font-family: 'Ubuntu Mono', monospace; font-size: 15px; padding: 16px 18px;
  caret-color: var(--ac);
}
.palette-list { max-height: 46vh; overflow-y: auto; padding: 6px; scrollbar-width: thin; scrollbar-color: var(--acb) transparent; }
.palette-item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: transparent; border: none; border-radius: 4px; padding: 11px 12px; cursor: pointer;
  font-family: 'Ubuntu Mono', monospace; font-size: 13px; color: var(--txc);
}
.palette-item .pi-ico { width: 20px; text-align: center; flex: 0 0 auto; }
.palette-item .pi-kind { margin-left: auto; font-size: 10px; color: var(--tx4); letter-spacing: 0.1em; }
.palette-item.is-sel { background: var(--acs); color: var(--ac); }
.palette-empty { font-family: 'Ubuntu Mono', monospace; font-size: 12px; color: var(--tx4); padding: 18px; }

/* ===== FX ===== */
.fx-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 400; pointer-events: none; }

/* ===== CUSTOM CURSOR ===== */
.cursor-dot, .cursor-ring { display: none; }
body.has-cursor .cursor-dot {
  display: block; position: fixed; top: 0; left: 0; width: 6px; height: 6px; border-radius: 50%;
  background: var(--ac); z-index: 999; pointer-events: none; opacity: 0; transform: translate(-100px, -100px);
}
body.has-cursor .cursor-ring {
  display: block; position: fixed; top: 0; left: 0; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--acb); z-index: 998; pointer-events: none; opacity: 0;
  mix-blend-mode: difference; transform: translate(-100px, -100px);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .mobile-dock { display: flex; }
  .corner-bar { display: flex; }
  .section { padding-left: 6vw; padding-right: 6vw; }
  .projects-section { padding-left: 0; padding-right: 0; }
  .scroller { padding: 30px calc(50% - 150px) 38px; gap: 30px; }
  .project-card { flex-basis: 300px; }
  .phone { width: 280px; height: 600px; border-radius: 40px; }
  .phone-screen { border-radius: 28px; }
  .phone-frame-scale iframe { height: 878px; transform: scale(0.65641); } /* 256/390 */
  .game-wrap { height: 78vh; }
  .viewer-modal { padding: 0; }
  .viewer-inner { border-radius: 0; border: none; }
  .viewer-tagline { display: none; }
  .req-phone { display: none; }
  .footer { margin-bottom: 70px; }
}

/* ===== VIEW TRANSITIONS (theme circular reveal) ===== */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-old(root) { z-index: 1; }
::view-transition-new(root) { z-index: 2; }

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rv { opacity: 1; transform: none; transition: none; }
  .hero-content .eyebrow, .hero-title, .hero-sub, .hero-desc, .hero-links { animation: none; }
  .scroll-hint, .term-live, .term-caret, .game-enter-hint, .game-prompt { animation: none; }
  * { transition-duration: 0.01ms !important; }
}
