:root {
  --void: #07090E;
  --jade: #00E890;
  --ice: #00AAFF;
  --amber: #FFC000;
  --violet: #8866FF;
  --chalk: #EEF2FF;
  --ghost: #8A9DBF;
  --steel: #3D5070;
  --font-display: 'Barlow Condensed', sans-serif;
  --font-body: 'Space Grotesk', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body {
  background: var(--void);
  color: var(--chalk);
  font-family: var(--font-body);
  min-height: 100vh;
  font-size: 15px;
}

a { color: var(--jade); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── SCANLINE OVERLAY ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(0, 0, 0, 0.04) 3px,
    rgba(0, 0, 0, 0.04) 4px
  );
}

/* ── NAV ── */
.nav {
  border-bottom: 1px solid var(--steel);
  padding: 0 24px;
  position: sticky;
  top: 0;
  background: var(--void);
  z-index: 10;
}
.nav-inner {
  max-width: 1140px;
  margin: 0 auto;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 0.05em;
  color: var(--jade);
}
.nav-sep { color: var(--steel); }
.nav-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 0.05em;
  color: var(--chalk);
}
.nav-status {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--jade);
  margin-left: auto;
  transition: color 0.3s;
}
.nav-status.processing { color: var(--amber); }
.nav-status.complete   { color: var(--jade); }
.nav-status.error      { color: var(--amber); }
.nav-clock {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--steel);
  letter-spacing: 0.08em;
}

/* ── KEYFRAMES ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: none; }
}

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

@keyframes zonePulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(0,232,144,0.25), inset 0 0 40px rgba(0,232,144,0.04); }
  50%       { box-shadow: 0 0 0 2px rgba(0,232,144,0.5),  inset 0 0 60px rgba(0,232,144,0.09); }
}

@keyframes scanLine {
  0%   { top: -30%; }
  100% { top: 130%; }
}

@keyframes glitchFlicker {
  0%, 100% { text-shadow: none; transform: none; }
  15%  { text-shadow: -2px 0 var(--jade), 2px 0 var(--ice); transform: skewX(-1deg) translateX(2px); }
  30%  { text-shadow: 2px 0 var(--violet), -1px 0 var(--amber); transform: skewX(0.5deg); }
  50%  { text-shadow: -1px 0 var(--jade); transform: translateX(-1px); }
  70%  { text-shadow: 1px 0 var(--ice), -1px 0 var(--jade); transform: none; }
  85%  { text-shadow: none; transform: translateX(1px); }
}

@keyframes sectionIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes logIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: none; }
}

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

@keyframes shake {
  0%, 100% { transform: none; }
  15%  { transform: translateX(-6px); }
  30%  { transform: translateX(6px); }
  45%  { transform: translateX(-4px); }
  60%  { transform: translateX(4px); }
  75%  { transform: translateX(-2px); }
  90%  { transform: translateX(2px); }
}

/* ── HERO ── */
.hero {
  padding: 72px 24px 56px;
  border-bottom: 1px solid var(--steel);
}
.hero-inner { max-width: 720px; margin: 0 auto; }

/* label + title: opacity driven by JS (starts at 1 for no-JS fallback) */
.hero-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--jade);
  letter-spacing: 0.12em;
  margin-bottom: 20px;
}
.hero-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(60px, 10vw, 100px);
  line-height: 0.88;
  letter-spacing: -0.01em;
  color: var(--chalk);
  margin-bottom: 28px;
}
.hero-title.glitch-active {
  animation: glitchFlicker 0.22s linear;
}
.hero-desc {
  font-size: 15px;
  color: var(--ghost);
  line-height: 1.65;
  max-width: 500px;
  margin-bottom: 28px;
  animation: fadeUp 0.6s 0.1s ease both;
}
.hero-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  animation: fadeUp 0.6s 0.22s ease both;
}

.chip {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 5px 12px;
  border: 1px solid var(--steel);
  color: var(--ghost);
}
.chip-note { color: var(--steel); border-color: rgba(61,80,112,0.5); }

/* ── UPLOAD ── */
.upload-section {
  padding: 64px 24px;
  border-bottom: 1px solid var(--steel);
  animation: fadeUp 0.6s 0.34s ease both;
}
.upload-zone {
  max-width: 720px;
  margin: 0 auto;
  border: 2px dashed var(--steel);
  padding: 72px 40px;
  text-align: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color 0.25s, background 0.25s, box-shadow 0.25s;
}
.upload-zone:hover {
  border-color: var(--jade);
  background: rgba(0, 232, 144, 0.03);
  box-shadow: 0 0 0 1px rgba(0, 232, 144, 0.12), inset 0 0 40px rgba(0, 232, 144, 0.03);
}

/* drag-over: glow pulse + scan line sweep */
.upload-zone.drag-over {
  border-color: var(--jade);
  background: rgba(0, 232, 144, 0.05);
  animation: zonePulse 1.1s ease-in-out infinite;
}
.upload-zone.drag-over::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -30%;
  height: 30%;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(0, 232, 144, 0.08) 50%,
    transparent
  );
  animation: scanLine 1.6s ease-in-out infinite;
  pointer-events: none;
}

.upload-icon {
  font-size: 36px;
  color: var(--jade);
  margin-bottom: 20px;
  display: block;
  animation: iconFloat 2.8s ease-in-out infinite;
  transition: transform 0.2s;
}
.upload-zone.drag-over .upload-icon {
  animation: none;
  transform: translateY(4px);
}
.upload-label {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 32px;
  letter-spacing: 0.04em;
  color: var(--chalk);
  margin-bottom: 10px;
  transition: color 0.2s;
}
.upload-zone.drag-over .upload-label { color: var(--jade); }
.upload-hint {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ghost);
  letter-spacing: 0.08em;
}

/* error state */
.upload-zone.error {
  border-color: var(--amber);
  background: rgba(255, 192, 0, 0.03);
  box-shadow: 0 0 0 1px rgba(255, 192, 0, 0.18), inset 0 0 40px rgba(255, 192, 0, 0.04);
}
.upload-zone.shake { animation: shake 0.45s ease both; }
.upload-zone.error .upload-icon  { color: var(--amber); animation: none; }
.upload-zone.error .upload-label { color: var(--amber); }
.upload-error {
  max-width: 720px;
  margin: 12px auto 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--amber);
  letter-spacing: 0.08em;
  padding: 10px 16px;
  border: 1px solid rgba(255, 192, 0, 0.25);
  background: rgba(255, 192, 0, 0.05);
  animation: fadeUp 0.3s ease both;
}

/* ── SECTION TRANSITIONS ── */
.section-enter { animation: sectionIn 0.4s ease both; }

/* ── LOADING ── */
.loading-section {
  padding: 48px 24px 64px;
  border-bottom: 1px solid var(--steel);
}
.loading-inner { max-width: 720px; margin: 0 auto; }

/* terminal log */
.loading-terminal {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  height: 110px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  margin-bottom: 24px;
  position: relative;
}
.loading-terminal::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 50px;
  background: linear-gradient(to bottom, var(--void), transparent);
  pointer-events: none;
  z-index: 1;
}
.log-line {
  padding: 2px 0;
  color: var(--ghost);
  line-height: 1.65;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transform: translateX(-8px);
  animation: logIn 0.15s ease forwards;
  flex-shrink: 0;
}
.log-line.active { color: var(--jade); }

/* progress */
.loading-track {
  height: 2px;
  background: var(--steel);
  margin-bottom: 16px;
  overflow: hidden;
}
.loading-bar {
  height: 100%;
  width: 0%;
  background: var(--jade);
  transition: width 0.4s ease;
  box-shadow: 0 0 8px var(--jade);
}
.loading-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--jade);
  letter-spacing: 0.1em;
}
.loading-label::after {
  content: '_';
  animation: blink 1s step-end infinite;
}

/* ── STATS ROW ── */
.stats-row {
  max-width: 1140px;
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  gap: 40px;
  border-bottom: 1px solid var(--steel);
  flex-wrap: wrap;
}
.stat { display: flex; flex-direction: column; gap: 3px; }
.stat-val {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 28px;
  color: var(--jade);
  line-height: 1;
}
.stat-lbl {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ghost);
  letter-spacing: 0.1em;
}

/* noise bar */
.noise-track {
  height: 2px;
  background: var(--steel);
  width: 64px;
  margin: 5px 0 2px;
}
.noise-fill {
  height: 100%;
  width: 0%;
  background: var(--jade);
  box-shadow: 0 0 6px var(--jade);
  transition: width 1s cubic-bezier(0.25, 1, 0.5, 1);
}

/* ── RESULT SECTION ── */
.result-section { padding-bottom: 64px; }

.result-section.section-enter .stats-row      { animation: fadeUp 0.45s 0.05s ease both; }
.result-section.section-enter .panel:first-child { animation: fadeUp 0.45s 0.16s ease both; }
.result-section.section-enter .panel:last-child  { animation: fadeUp 0.45s 0.26s ease both; }
.result-section.section-enter .result-footer  { animation: fadeUp 0.45s 0.34s ease both; }

/* ── PANELS ── */
.panels {
  max-width: 1140px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-left: 1px solid var(--steel);
  border-right: 1px solid var(--steel);
  border-bottom: 1px solid var(--steel);
}
.panel {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--steel);
}
.panel:last-child { border-right: none; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-bottom: 1px solid var(--steel);
  background: rgba(255,255,255,0.018);
}
.panel-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ghost);
  letter-spacing: 0.12em;
}
.panel-label.jade { color: var(--jade); }
.panel-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--steel);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}
.panel-body {
  padding: 20px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--ghost);
  max-height: 480px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  flex: 1;
}
.panel:last-child .panel-body { color: var(--chalk); }

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--steel); }

/* ── COPY BTN ── */
.copy-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--ghost);
  background: none;
  border: 1px solid var(--steel);
  padding: 4px 12px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.copy-btn:hover, .copy-btn.copied { color: var(--jade); border-color: var(--jade); }

/* ── RESULT FOOTER ── */
.result-footer {
  max-width: 1140px;
  margin: 24px auto 0;
  padding: 0 24px;
  display: flex;
  gap: 12px;
  align-items: center;
}
.btn-primary {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.08em;
  color: var(--void);
  background: var(--jade);
  border: none;
  padding: 12px 28px;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-primary:hover { opacity: 0.85; }
.btn-outline {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.08em;
  color: var(--ghost);
  border: 1px solid var(--steel);
  padding: 12px 24px;
  transition: color 0.2s, border-color 0.2s;
}
.btn-outline:hover { color: var(--chalk); border-color: var(--chalk); text-decoration: none; }

/* ── GATE ── */
.gate-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 9, 14, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
  backdrop-filter: blur(2px);
}
.gate-overlay:not([hidden]) .gate-modal {
  animation: modalIn 0.32s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.gate-modal {
  background: var(--void);
  border: 1px solid var(--violet);
  padding: 48px;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 0 48px rgba(136, 102, 255, 0.18);
}
.gate-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--violet);
  letter-spacing: 0.12em;
  margin-bottom: 14px;
}
.gate-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 44px;
  letter-spacing: 0.02em;
  color: var(--chalk);
  margin-bottom: 16px;
}
.gate-desc {
  font-size: 14px;
  color: var(--ghost);
  line-height: 1.65;
  margin-bottom: 32px;
}
.gate-form { display: flex; flex-direction: column; gap: 10px; }
.gate-input {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--steel);
  color: var(--chalk);
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 12px 16px;
  outline: none;
  width: 100%;
  transition: border-color 0.2s;
}
.gate-input:focus { border-color: var(--violet); }
.gate-input::placeholder { color: var(--steel); }
.gate-submit {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.06em;
  color: var(--void);
  background: var(--violet);
  border: none;
  padding: 14px 24px;
  cursor: pointer;
  transition: opacity 0.2s;
}
.gate-submit:hover { opacity: 0.85; }
.gate-submit:disabled { opacity: 0.5; cursor: not-allowed; }
.gate-confirmed { text-align: center; }
.gate-msg {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ghost);
  line-height: 1.65;
  margin-bottom: 24px;
}
.gate-cta {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.06em;
  color: var(--void);
  background: var(--jade);
  padding: 14px 32px;
  transition: opacity 0.2s;
}
.gate-cta:hover { opacity: 0.85; text-decoration: none; }

/* ── FOOTER ── */
.footer {
  border-top: 1px solid var(--steel);
  padding: 20px 24px;
}
.footer-inner {
  max-width: 1140px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ghost);
  gap: 12px;
  flex-wrap: wrap;
}
.footer a { color: var(--ghost); }
.footer a:hover { color: var(--jade); text-decoration: none; }
.footer-note { color: var(--steel); }

/* ── MOBILE ── */
@media (max-width: 720px) {
  .panels { grid-template-columns: 1fr; }
  .panel { border-right: none; border-bottom: 1px solid var(--steel); }
  .hero-title { font-size: 60px; }
  .gate-modal { padding: 32px 24px; }
  .stats-row { gap: 20px; }
  .nav-clock { display: none; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

/* ── REDUCED MOTION ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  body::before { display: none; }
}
