/* ============================================================
   RTX SPARK — $N1X · one chip, the whole PC
   ============================================================ */

/* self-hosted latin subsets — CN/CJK rơi về system font qua unicode-range */

@font-face {
  font-family: "Chakra Petch";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("assets/fonts/chakra-petch-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Chakra Petch";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("assets/fonts/chakra-petch-700.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("assets/fonts/jetbrains-mono.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("assets/fonts/ibm-plex-sans.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #0A0F0A;
  --panel: #101810;
  --spark: #5DE24A;
  --ink: #EAF7E6;
  --grid: #2A342A;
  --muted: #B7C4B7;
  --font-display: "Chakra Petch", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --breathe: 2s;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--bg);
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  background: transparent; /* html giữ nền — canvas rain z:-1 nằm giữa nền và nội dung */
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.55;
  min-height: 100vh;
}

img,
video,
svg {
  max-width: 100%;
  display: block;
}

::selection {
  background: var(--spark);
  color: var(--bg);
}

:focus-visible {
  outline: 2px solid var(--spark);
  outline-offset: 2px;
}

.container {
  width: min(1100px, 92%);
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  background: var(--spark);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 10px 16px;
  border-radius: 0 0 8px 8px;
  text-decoration: none;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 0;
}

/* ============ shared type helpers ============ */

.kicker {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  color: var(--spark);
  margin-bottom: 10px;
}

.section {
  padding: 84px 0;
}

.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.6rem, 4vw, 2.3rem);
  letter-spacing: 0.02em;
}

/* ============ 1. HERO / CONFIGURATOR ============ */

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-image:
    linear-gradient(rgba(42, 52, 42, 0.35) 1px, transparent 1px),
    linear-gradient(90deg, rgba(42, 52, 42, 0.35) 1px, transparent 1px);
  background-size: 48px 48px;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 70% 55% at 50% 45%, rgba(93, 226, 74, 0.07), transparent 70%);
}

.topbar {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px 4%;
  flex-wrap: wrap;
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.18em;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 4px;
  object-fit: cover;
  box-shadow: 0 0 14px rgba(93, 226, 74, 0.35);
}

.topnav {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.nav-ca {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--spark);
  text-decoration: none;
  border: 1px solid var(--spark);
  border-radius: 3px;
  padding: 6px 16px;
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-ca:hover {
  background: var(--spark);
  color: var(--bg);
}

.topbar-tag {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  border: 1px solid var(--grid);
  border-radius: 3px;
  padding: 6px 12px;
}

.hero-core {
  position: relative;
  z-index: 1;
  margin: auto;
  width: min(760px, 92%);
  text-align: center;
  padding: 24px 0 56px;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.5rem, 5vw, 2.75rem); /* fallback khi thiếu container query */
  letter-spacing: 0.02em;
  line-height: 1.15;
}

/* "BUILD YOUR PC." một dòng, CN xuống dòng riêng 55% */
.hero-title-en {
  display: block;
}

.hero-title-zh {
  display: block;
  font-size: 0.55em;
  margin-top: 4px;
}

.tagline {
  font-family: var(--font-mono);
  color: var(--spark);
  letter-spacing: 0.18em;
  font-size: clamp(0.85rem, 2vw, 1rem);
  margin-top: 10px;
}

/* --- hero head: headline ~60% + mascot ~40% --- */

.hero-head {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 24px;
  align-items: center;
  text-align: left;
}

.hero-headline {
  container-type: inline-size;
  min-width: 0;
}

@supports (font-size: 1cqw) {
  /* scale theo bề ngang cột headline → EN không bao giờ wrap */
  .hero-title {
    font-size: clamp(1.4rem, 10.4cqw, 2.75rem);
  }
}

.hero-mascot {
  position: relative;
  display: flex;
  justify-content: center;
}

.mascot-float {
  position: relative;
  width: clamp(260px, 22vw, 320px);
  animation: mascot-float 4s ease-in-out infinite;
  will-change: transform;
}

.mascot-float::before {
  content: "";
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  box-shadow: 0 0 70px 24px rgba(93, 226, 74, 0.3);
  animation: breathe var(--breathe) ease-in-out infinite alternate; /* đồng bộ nhịp trang */
}

.mascot-img {
  width: 100%;
  height: auto;
  border-radius: 50%; /* mask tròn — nền vuông của ảnh biến mất */
  filter: drop-shadow(0 0 18px rgba(93, 226, 74, 0.3));
}

/* mắt trái (ống kính xanh) loé 300ms mỗi 7s */
.eye-flash {
  position: absolute;
  left: 30%;
  top: 25.5%;
  width: 22%;
  height: 22%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(234, 247, 230, 0.95) 0%, rgba(93, 226, 74, 0.55) 40%, transparent 70%);
  opacity: 0;
  mix-blend-mode: screen;
  pointer-events: none;
  animation: eye-flash 7s linear 3s infinite;
}

@keyframes mascot-float {
  0%, 100% { transform: translateY(-8px); }
  50% { transform: translateY(8px); }
}

@keyframes eye-flash {
  0%, 4.5%, 100% { opacity: 0; }
  1.5%, 3% { opacity: 1; }
}

/* --- configurator panel --- */

.panel {
  margin-top: 40px;
  background: var(--panel);
  border: 1px solid var(--grid);
  border-radius: 4px;
  text-align: left;
  box-shadow: 0 0 60px rgba(93, 226, 74, 0.06);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 20px;
  border-bottom: 1px solid var(--grid);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.panel-body {
  padding: 20px;
  min-height: 460px;
  display: flex;
  flex-direction: column;
}

#config-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.part-row {
  display: grid;
  grid-template-columns: 170px 1fr 28px;
  align-items: center;
  gap: 12px;
  background: var(--bg);
  border: 1px solid var(--grid);
  border-radius: 3px;
  padding: 10px 14px;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.part-row label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.part-zh {
  display: block;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.part-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235DE24A' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 12px center;
  border: 1px solid var(--grid);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  padding: 10px 36px 10px 12px;
  border-radius: 3px;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.part-select:hover {
  border-color: var(--spark);
}

.tick {
  color: var(--spark);
  font-weight: 700;
  font-size: 1.1rem;
  text-align: center;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.part-row.locked {
  border-color: var(--spark);
  box-shadow: 0 0 14px rgba(93, 226, 74, 0.22), inset 0 0 10px rgba(93, 226, 74, 0.06);
}

.part-row.locked .tick {
  opacity: 1;
  transform: scale(1);
}

/* --- build controls --- */

#build-controls {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#build-btn {
  width: 100%;
  min-height: 56px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.22em;
  border-radius: 3px;
  border: 1px solid var(--grid);
  background: transparent;
  color: var(--muted);
  cursor: not-allowed;
  transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

#build-btn:not(:disabled) {
  background: var(--spark);
  border-color: var(--spark);
  color: var(--bg);
  cursor: pointer;
  box-shadow: 0 0 26px rgba(93, 226, 74, 0.45);
}

#build-btn:not(:disabled):hover {
  box-shadow: 0 0 40px rgba(93, 226, 74, 0.65);
}

.second-btn {
  margin-top: 12px;
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-decoration: underline dotted;
  text-underline-offset: 4px;
  cursor: pointer;
  padding: 8px 12px;
}

.second-btn:hover {
  color: var(--ink);
}

.build-status {
  margin-top: 18px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.status-n {
  color: var(--spark);
  font-weight: 600;
}

/* --- result stage (the one chip) --- */

#result-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
  padding: 16px 0;
}

.chip-wrap {
  position: relative;
  width: min(230px, 58vw);
  animation: chip-pulse var(--breathe) ease-in-out infinite alternate;
}

.chip-wrap::before,
.chip-wrap::after {
  content: "";
  position: absolute;
  inset: 12%;
  border: 2px solid rgba(93, 226, 74, 0.55);
  border-radius: 20px;
  opacity: 0;
  pointer-events: none;
  animation: chip-ripple 1s ease-out 0.15s 1 forwards;
}

.chip-wrap::after {
  animation-delay: 0.4s;
  animation-duration: 1.1s;
}

.chip {
  width: 100%;
  height: auto;
  animation: chip-pop 0.55s cubic-bezier(0.2, 1.5, 0.45, 1);
}

@keyframes chip-pop {
  from {
    transform: scale(0.15);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes chip-ripple {
  0% {
    opacity: 0.8;
    transform: scale(0.7);
  }
  100% {
    opacity: 0;
    transform: scale(1.65);
  }
}

@keyframes chip-pulse {
  from {
    filter: drop-shadow(0 0 12px rgba(93, 226, 74, 0.35));
  }
  to {
    filter: drop-shadow(0 0 32px rgba(93, 226, 74, 0.6));
  }
}

.result-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.25rem, 3.5vw, 1.8rem);
  letter-spacing: 0.04em;
}

.result-cn {
  font-family: var(--font-mono);
  color: var(--spark);
  letter-spacing: 0.14em;
}

#rebuild-btn {
  min-height: 44px;
  padding: 0 24px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  background: transparent;
  border: 1px solid var(--grid);
  color: var(--muted);
  border-radius: 3px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

#rebuild-btn:hover {
  border-color: var(--spark);
  color: var(--ink);
}

/* ============ VIDEO STRIP ============ */

.video-strip {
  padding: 24px 0 64px;
}

.video-frame {
  width: min(960px, 92%);
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--grid);
  background: #060906;
  box-shadow: 0 0 50px rgba(93, 226, 74, 0.1);
}

.video-frame video,
.video-frame .video-poster-fallback {
  width: 100%;
  height: auto;
  display: block;
}

/* ============ OLD PARTS, NEW PURPOSE ============ */

.extra {
  padding-top: 0;
}

.extra-card {
  width: min(640px, 100%);
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--grid);
  border-radius: 4px;
  overflow: hidden;
}

.extra-card img {
  width: 100%;
  height: auto;
}

.extra-card figcaption {
  padding: 16px 20px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid var(--grid);
}

/* ============ 3. SPEC SHEET ============ */

.specs .container {
  text-align: center;
}

.spec-table {
  width: min(760px, 100%);
  margin: 36px auto 0;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--grid);
  border-radius: 4px;
  overflow: hidden;
}

.spec-table th,
.spec-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--grid);
}

.spec-table tr:last-child th,
.spec-table tr:last-child td {
  border-bottom: none;
}

.spec-table th {
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--ink);
}

.spec-zh {
  margin-left: 8px;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 400;
}

.spec-table td {
  text-align: right;
  color: var(--spark);
  font-weight: 500;
}

/* ============ 4. CA BLOCK ============ */

.ca-panel {
  width: min(860px, 100%);
  margin: 0 auto;
  background: var(--panel);
  border: 2px solid var(--spark);
  border-radius: 4px;
  padding: clamp(24px, 5vw, 48px);
  box-shadow: 0 0 60px rgba(93, 226, 74, 0.12);
}

.ca-title {
  color: var(--spark);
}

.ca-box {
  display: flex;
  gap: 12px;
  align-items: stretch;
  flex-wrap: wrap;
  margin-top: 24px;
}

.ca {
  font-family: var(--font-mono);
  font-size: clamp(15px, 2.4vw, 24px);
  word-break: break-all;
  color: #EAF7E6;
  flex: 1 1 320px;
  background: var(--bg);
  border: 1px solid var(--grid);
  border-radius: 3px;
  padding: 16px;
  display: flex;
  align-items: center;
}

#copy-ca {
  min-height: 52px;
  min-width: 130px;
  padding: 0 22px;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  background: transparent;
  border: 1px solid var(--spark);
  color: var(--spark);
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

#copy-ca:hover,
#copy-ca.copied {
  background: var(--spark);
  color: var(--bg);
}

.ca-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.btn {
  flex: 1 1 220px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 28px;
  border-radius: 3px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.1em;
  text-decoration: none;
  text-align: center;
  transition: box-shadow 0.2s ease, background 0.2s ease;
}

.btn-outline {
  border: 2px solid var(--spark);
  color: var(--ink);
}

.btn-outline:hover {
  background: rgba(93, 226, 74, 0.1);
}

.btn-fill {
  border: 2px solid var(--spark);
  background: var(--spark);
  color: var(--bg);
}

.btn-fill:hover {
  box-shadow: 0 0 32px rgba(93, 226, 74, 0.5);
}

.ca-warning {
  margin-top: 18px;
  font-size: 0.9rem;
  color: var(--muted);
}

.ca-warning-cn {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
}

/* ============ 5. HOW TO BUY ============ */

.how {
  border-top: 1px solid var(--grid);
}

.steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 40px;
}

.step {
  background: var(--panel);
  border: 1px solid var(--grid);
  border-radius: 4px;
  padding: 24px 22px;
  transition: border-color 0.2s ease;
}

.step:hover {
  border-color: var(--spark);
}

.step-num {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--spark);
  display: block;
}

.step h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 1.02rem;
  margin: 10px 0 8px;
}

.step p {
  font-size: 0.92rem;
  color: var(--muted);
}

.step-cn {
  margin-top: 6px;
  font-size: 0.85rem;
}

/* ============ 6. FOOTER ============ */

.footer {
  border-top: 1px solid var(--grid);
  padding: 36px 4%;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

.footer p + p {
  margin-top: 6px;
}

.footer-logo {
  width: 72px;
  height: 72px;
  border-radius: 4px;
  margin: 0 auto 14px;
}

/* ============ sticky CA bar (mobile) ============ */

.sticky-ca {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 55;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  background: var(--panel);
  border-top: 1px solid var(--spark);
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.5);
}

.sticky-ca-text {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#sticky-ca-short {
  color: var(--spark);
}

#sticky-copy {
  min-height: 44px;
  padding: 0 16px;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  background: var(--spark);
  border: 1px solid var(--spark);
  color: var(--bg);
  border-radius: 3px;
  cursor: pointer;
}

#sticky-close {
  min-height: 44px;
  min-width: 44px;
  background: transparent;
  border: 1px solid var(--grid);
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  border-radius: 3px;
  cursor: pointer;
}

@media (max-width: 768px) {
  .sticky-ca {
    display: flex;
  }

  body.has-sticky {
    padding-bottom: 76px;
  }
}

/* ============ toast ============ */

#toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 16px);
  z-index: 60;
  background: var(--panel);
  border: 1px solid var(--spark);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  padding: 12px 20px;
  border-radius: 4px;
  box-shadow: 0 0 24px rgba(93, 226, 74, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ============ responsive ============ */

@media (max-width: 760px) {
  .steps {
    grid-template-columns: 1fr;
  }

  .panel-body {
    min-height: 520px;
  }

  /* mascot thu nhỏ, đặt TRÊN headline, căn giữa */
  .hero-head {
    grid-template-columns: 1fr;
    gap: 14px;
    text-align: center;
  }

  .hero-mascot {
    order: -1;
  }

  .mascot-float {
    width: 140px;
  }
}

@media (max-width: 640px) {
  .part-row {
    grid-template-columns: 1fr 28px;
    row-gap: 8px;
  }

  .part-row label {
    grid-column: 1 / -1;
  }

  .part-zh {
    display: inline;
    margin-left: 8px;
  }

  .section {
    padding: 64px 0;
  }

  .video-frame {
    aspect-ratio: 16 / 9;
  }
}

/* ============================================================
   SILICON TAKEOVER THEATRE
   ============================================================ */

/* mono identity — ligature tắt, số tabular */
pre, code,
.kicker, .tagline, .panel-head, .part-select, .build-status, .second-btn, .result-cn,
#rebuild-btn, .spec-table, .ca, #copy-ca, .topbar-tag, .nav-ca, .step-num,
.extra-card figcaption, .ca-warning-cn, .sticky-ca-text, #sticky-copy, #toast,
.regbar, .hex-scroll, .instr-scroll, .marquee, #bios, #bios-cursor {
  font-feature-settings: "liga" 0, "calt" 0;
  font-variant-numeric: tabular-nums;
}

/* --- site head + register dump bar --- */

.site-head {
  position: relative;
  z-index: 2;
  background: var(--bg);
  border-bottom: 1px solid var(--grid);
}

.regbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg);
  border-bottom: 1px solid var(--grid);
  padding: 6px 4%;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--spark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- hero stage: hexdump | configurator | instruction stream --- */

.hero-stage {
  position: relative;
  z-index: 1;
  margin: auto;
  width: min(1400px, 96%);
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 300px;
  gap: 20px;
  align-items: stretch;
  padding: 32px 0;
}

.hero-stage .hero-core {
  width: 100%;
  margin: 0;
}

.theatre {
  position: relative;
  border: 1px solid var(--grid);
  background: rgba(16, 24, 16, 0.72);
  overflow: hidden;
  min-height: 0;
}

.theatre-label {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--muted);
  opacity: 0.5;
  user-select: none;
}

.hex-scroll {
  position: absolute;
  inset: 0;
  padding: 30px 14px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.7;
  color: var(--spark);
  opacity: 0.65;
  white-space: pre;
}

.hex-block {
  animation: hex-crawl 48s linear infinite;
  will-change: transform;
}

@keyframes hex-crawl {
  from { transform: translateY(0); }
  to   { transform: translateY(-50%); }
}

.instr-scroll {
  position: absolute;
  inset: 0;
  padding: 30px 14px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.8;
  color: var(--spark);
  white-space: pre;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.instr-scroll .del .op {
  color: var(--ink);
  font-weight: 700;
}

/* stream dừng cao hơn nút BUY nổi góc phải-dưới:
   cap chiều cao panel theo viewport (đáy panel < mép trên nút) + đệm cuối stream */
@media (min-width: 1181px) {
  .theatre {
    align-self: start;
    height: clamp(420px, calc(100svh - 240px), 780px);
  }
}

@media (min-width: 769px) {
  .instr-scroll {
    padding-bottom: 96px;
  }
}

.instr-scroll .cmt {
  opacity: 0.5;
}

/* --- mạch SVG tự vẽ, lan từ chip --- */

.circuit {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.16;
  pointer-events: none;
}

.circuit .trace {
  stroke-dasharray: 1;
  stroke-dashoffset: 0; /* trạng thái nghỉ = đã vẽ xong — an toàn cho reduced-motion */
  animation: trace-draw 1.6s ease-out backwards;
}

.circuit .trace:nth-child(2) { animation-delay: 0.15s; }
.circuit .trace:nth-child(3) { animation-delay: 0.3s; }
.circuit .trace:nth-child(4) { animation-delay: 0.45s; }
.circuit .trace:nth-child(5) { animation-delay: 0.6s; }
.circuit .trace:nth-child(6) { animation-delay: 0.75s; }

@keyframes trace-draw {
  from { stroke-dashoffset: 1; }
}

.circuit .pad {
  animation: pad-in 0.3s ease-out 1.5s backwards;
}

@keyframes pad-in {
  from { opacity: 0; }
}

/* --- marquee mép dưới hero --- */

.marquee {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--grid);
  overflow: hidden;
  padding: 10px 0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  color: var(--spark);
  white-space: nowrap;
}

.marquee-track {
  display: inline-flex;
  white-space: nowrap;
  animation: marq 26s linear infinite;
  will-change: transform;
}

@keyframes marq {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* --- binary rain canvas + film fx --- */

#rain {
  position: fixed;
  inset: 0;
  z-index: -1;
}

.fx {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  background-image:
    radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.45) 100%),
    repeating-linear-gradient(0deg, rgba(93, 226, 74, 0.03) 0 1px, transparent 1px 3px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.09'/%3E%3C/svg%3E");
}

/* --- BIOS boot intro --- */

#bios {
  display: none;
}

html.bios-pending #bios,
#bios.bios-done {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 90;
  background: #000;
  padding: clamp(20px, 8vh, 64px) clamp(16px, 8vw, 80px);
  cursor: pointer;
}

/* cắt khô bằng transform thay vì remove khỏi DOM:
   tránh Chrome re-emit LCP candidate lúc overlay biến mất (splash-screen penalty) */
#bios.bios-done {
  transform: translateY(-110%);
  pointer-events: none;
  cursor: default;
}

html.bios-pending body {
  overflow: hidden;
}

/* BIOS dùng system mono: đúng chất firmware thật + không bị webfont-swap repaint (LCP) */
#bios pre {
  display: inline;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: clamp(12px, 2.2vw, 16px);
  line-height: 1.9;
  color: var(--spark);
  white-space: pre-wrap;
}

#bios-cursor {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: clamp(12px, 2.2vw, 16px);
  color: var(--spark);
  animation: cursor-blink 0.64s steps(1) infinite;
}

@keyframes cursor-blink {
  50% { opacity: 0; }
}

/* --- nhịp thở 2s đồng bộ: chip + viền mọi panel --- */

.panel,
.theatre,
.ca-panel {
  position: relative;
}

.panel::after,
.theatre::after,
.ca-panel::after {
  content: "";
  position: absolute;
  inset: -1px;
  border: 1px solid var(--spark);
  border-radius: inherit;
  box-shadow: 0 0 18px rgba(93, 226, 74, 0.28), inset 0 0 8px rgba(93, 226, 74, 0.08);
  opacity: 0.18;
  pointer-events: none;
  animation: breathe var(--breathe) ease-in-out infinite alternate;
}

@keyframes breathe {
  from { opacity: 0.12; }
  to   { opacity: 0.55; }
}

/* --- glitch hover 150ms trên heading --- */

.glitch {
  position: relative;
}

.glitch:hover::before,
.glitch:hover::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  pointer-events: none;
  opacity: 0;
  animation: glitch-flash 0.15s steps(2) 1;
}

.glitch:hover::before {
  color: var(--spark);
  clip-path: inset(0 0 52% 0);
  transform: translateX(2px);
}

.glitch:hover::after {
  color: var(--ink);
  clip-path: inset(52% 0 0 0);
  transform: translateX(-2px);
}

@keyframes glitch-flash {
  0%, 99% { opacity: 1; }
  100% { opacity: 0; }
}

/* --- BUY nổi góc + glow thở --- */

.buy-float {
  display: none;
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  min-height: 52px;
  padding: 0 22px;
  align-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  background: var(--spark);
  color: var(--bg);
  border: 1px solid var(--spark);
  border-radius: 3px;
  text-decoration: none;
  animation: buy-breathe var(--breathe) ease-in-out infinite alternate;
  will-change: transform;
}

@media (min-width: 769px) {
  .buy-float:not([hidden]) {
    display: inline-flex;
  }
}

@keyframes buy-breathe {
  from { box-shadow: 0 0 14px rgba(93, 226, 74, 0.35); }
  to   { box-shadow: 0 0 34px rgba(93, 226, 74, 0.65); }
}

.btn-fill {
  will-change: transform;
}

/* --- sóng xung kích khi BUILD --- */

.shock {
  position: fixed;
  z-index: 45;
  width: 120px;
  height: 120px;
  margin: -60px 0 0 -60px;
  border: 2px solid var(--spark);
  border-radius: 50%;
  pointer-events: none;
  animation: shock-out 0.7s ease-out forwards;
}

@keyframes shock-out {
  from { transform: scale(0.1); opacity: 0.9; }
  to   { transform: scale(14); opacity: 0; }
}

/* --- perf: bỏ render phần dưới màn hình --- */

.video-strip,
.extra,
.specs,
.how {
  content-visibility: auto;
  contain-intrinsic-size: auto 640px;
}

/* --- responsive stage --- */

@media (max-width: 1180px) {
  .hero-stage {
    grid-template-columns: 1fr 1fr;
  }

  .hero-stage .hero-core {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .theatre {
    height: 220px;
  }
}

@media (max-width: 640px) {
  .hero-stage {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .theatre {
    height: 170px;
  }

  .regbar {
    font-size: 10px;
  }
}

/* ============ reduced motion ============ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  #rain {
    display: none;
  }

  #bios {
    display: none !important;
  }
}
