/* ================================================================
   INFINITY LAYER
   Layout/effect patterns adapted from infinity.cyberwarfare.live,
   rendered in the site's original fonts and colour palette:
   floating glass pill nav, spinning-border resume button, aurora +
   dot-grid hero, hairline dividers, dual-row marquee, progress ring,
   attack-surface hub, side-quest challenge.
   Loaded after main.css - delete the <link> to revert.
================================================================ */

:root { --dot: rgba(148, 163, 184, 0.14); }
[data-theme="light"] { --dot: rgba(15, 23, 42, 0.12); }

@property --spin {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

/* === 1. FLOATING GLASS PILL NAV === */
#scroll-progress { display: none; }

#navbar,
#navbar.scrolled {
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: min(1180px, calc(100% - 24px));
  height: 56px;
  border-radius: 9999px;
  background: rgba(18, 20, 26, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
#navbar.scrolled { background: rgba(14, 16, 21, 0.78); }
[data-theme="light"] #navbar,
[data-theme="light"] #navbar.scrolled {
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 10px 30px -12px rgba(15, 23, 42, 0.2);
}
#navbar .nav-container { padding: 0 0.6rem 0 1.4rem; }
.nav-num { display: none; }
.nav-link { font-family: 'Inter', var(--font-sans); font-weight: 500; }

/* === 2. RESUME BUTTON === */
/* Nav resume: spinning gradient border + glow (their "SignIn") */
.nav-actions .btn {
  position: relative;
  isolation: isolate;
  border: none;
  color: #fff;
  border-radius: 9999px;
  padding: 0.45rem 1.05rem;
  background:
    linear-gradient(#0c0f18, #0c0f18) padding-box,
    conic-gradient(from var(--spin), #22d3ee, #6366f1, #f472b6, #22d3ee) border-box;
  border: 1.5px solid transparent;
  animation: spin-border 4s linear infinite;
}
.nav-actions .btn::after {
  content: '';
  position: absolute;
  inset: -2px;
  z-index: -1;
  border-radius: inherit;
  background: conic-gradient(from var(--spin), #22d3ee, #6366f1, #f472b6, #22d3ee);
  filter: blur(12px);
  opacity: 0.55;
  animation: spin-border 4s linear infinite;
}
.nav-actions .btn:hover { transform: translateY(-1px); color: #fff; }
[data-theme="light"] .nav-actions .btn {
  background:
    linear-gradient(#fff, #fff) padding-box,
    conic-gradient(from var(--spin), #0891b2, #6366f1, #db2777, #0891b2) border-box;
  color: #0f172a;
}
@keyframes spin-border { to { --spin: 360deg; } }

/* === 3. HERO: AURORA + DOT GRID === */
.hero-grid {
  background-image: radial-gradient(var(--dot) 1px, transparent 1.2px);
  background-size: 22px 22px;
  opacity: 1;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 30%, transparent 100%);
          mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 30%, transparent 100%);
}
.hero-grid::before { display: none; }
#matrix-canvas { opacity: 0.03; }

.hero-aurora { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.hero-aurora span {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
  animation: aurora-drift 18s ease-in-out infinite alternate;
}
.hero-aurora span:nth-child(1) { width: 46vw; height: 46vw; left: -10vw; top: -8vw; background: #0e7490; }
.hero-aurora span:nth-child(2) { width: 38vw; height: 38vw; right: -8vw; top: 10vh; background: #4c1d95; animation-delay: -6s; }
.hero-aurora span:nth-child(3) { width: 30vw; height: 30vw; right: 20vw; bottom: -12vw; background: #1e3a8a; opacity: 0.3; animation-delay: -12s; }
[data-theme="light"] .hero-aurora span { opacity: 0.18; }
@keyframes aurora-drift {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(4vw, 3vh) scale(1.08); }
  100% { transform: translate(-3vw, -2vh) scale(0.95); }
}

/* === 5. HAIRLINE DIVIDERS BETWEEN SECTIONS === */
#main-content > .section + .section { position: relative; }
#main-content > .section + .section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(760px, 80%);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(148, 163, 184, 0.45), transparent);
}

/* === 6. CARDS: SOFT SHADOW, GRADIENT ICON TILES === */
.info-card,
.project-card,
.stat-item,
.bstrip-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.12);
}
.info-card:hover,
.project-card:hover,
.stat-item:hover,
.bstrip-card:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
  box-shadow: 0 24px 40px -12px rgba(0, 0, 0, 0.5);
}
.info-card { padding: 1.5rem; }

/* Gradient-framed icon tile */
.info-card-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  color: var(--accent);
  border-radius: 10px;
  border: 1.5px solid transparent;
  background:
    linear-gradient(160deg, var(--surface-elevated), var(--bg-primary)) padding-box,
    linear-gradient(135deg, var(--accent), var(--accent-2)) border-box;
  box-shadow: 0 0 18px -6px var(--accent);
  margin-bottom: 1rem;
}

/* Project cards: coloured spotlight instead of flat placeholder */
.project-card-img-placeholder {
  background:
    radial-gradient(ellipse 70% 90% at 50% 110%, color-mix(in srgb, var(--project-color, #6366f1) 45%, transparent), transparent 70%),
    radial-gradient(var(--dot) 1px, transparent 1.2px) 0 0 / 16px 16px,
    linear-gradient(135deg, var(--surface-elevated), var(--bg-tertiary));
}
.project-icon { opacity: 0.55; font-size: 2.25rem; filter: drop-shadow(0 0 14px var(--project-color, #6366f1)); }
.project-category-badge { backdrop-filter: blur(6px); }

/* CTA card: gradient edge */
.cta-card {
  border: 1px solid transparent;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(135deg, var(--accent), var(--border) 45%, var(--accent-2)) border-box;
}
/* === 7. DUAL-ROW MARQUEE (skills) === */
.marquee {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.marquee-row {
  display: flex;
  gap: 0.75rem;
  width: max-content;
  animation: marquee 38s linear infinite;
}
.marquee-row.reverse { animation-direction: reverse; animation-duration: 44s; }
.marquee:hover .marquee-row { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }

.marquee .skill-pill {
  padding: 0.5rem 1.05rem;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  white-space: nowrap;
}
.marquee .skill-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}


/* === 8. SCROLL PROGRESS RING (replaces back-to-top) === */
#scroll-top {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--surface-elevated);
  backdrop-filter: blur(8px);
  border: none;
  color: var(--text-primary);
  font-size: 0.68rem;
  font-weight: 600;
}
#scroll-top svg { position: absolute; inset: 0; transform: rotate(-90deg); }
#scroll-top .ring-track { stroke: var(--border); }
#scroll-top .ring-fill { stroke: url(#ring-grad); transition: stroke-dashoffset 0.1s linear; }
#scroll-top .ring-pct { position: relative; }
#scroll-top .ring-up { position: relative; display: none; font-size: 0.85rem; }
#scroll-top:hover { background: var(--surface-hover); color: var(--accent); }
#scroll-top:hover .ring-pct { display: none; }
#scroll-top:hover .ring-up { display: inline; }

/* === REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
  .hero-aurora span, .marquee-row, .nav-actions .btn, .nav-actions .btn::after { animation: none; }
  .marquee { overflow-x: auto; }
}

@media (max-width: 768px) {
  #navbar .nav-container { padding: 0 0.75rem 0 1.1rem; }

  /* The pill navbar above uses transform + backdrop-filter, which makes #navbar
     the containing block for any position:fixed descendant. main.css styles the
     mobile menu as a full-screen fixed drawer, so inside the pill it collapsed
     to the pill's own box (a ~43px sliver). Anchor it under the pill as an
     absolutely positioned dropdown instead - which is what this design wants. */
  .nav-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    bottom: auto;
    width: auto;
    height: auto;
    max-height: calc(100vh - var(--nav-height) - 2rem);
    max-height: calc(100dvh - var(--nav-height) - 2rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
    padding: 0.6rem;
    border-radius: 20px;
    /* Solid, not glass: a nested backdrop-filter inside the already-blurred
       pill has no page backdrop to sample, so translucency here just makes
       the hero text behind it show through. */
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 18px 50px -12px rgba(0, 0, 0, 0.8);
    transform: translateY(-10px);
    opacity: 0;
    visibility: hidden;
    transition: transform var(--transition), opacity var(--transition),
                visibility 0s linear 0.25s;
  }
  .nav-menu.open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    transition: transform var(--transition), opacity var(--transition),
                visibility 0s;
  }
  [data-theme="light"] .nav-menu {
    border-color: rgba(15, 23, 42, 0.1);
    box-shadow: 0 18px 50px -14px rgba(15, 23, 42, 0.28);
  }

  .nav-menu li { width: 100%; }
  .nav-link { font-size: 1rem; padding: 0.72rem 0.9rem; border-radius: 12px; }
  .nav-toggle { padding: 0.6rem 0.5rem; }

  .hero-aurora span { filter: blur(60px); }
}

/* ================================================================
   10. ATTACK SURFACE HUB - HUD cards around a chip core
================================================================ */
.hub-section { overflow: hidden; }
.hub {
  position: relative;
  width: min(100%, 900px);
  aspect-ratio: 900 / 590;
  margin: 1rem auto 0;
}
/* faint circuit field behind the core */
.hub::before {
  content: '';
  position: absolute;
  inset: 10% 20%;
  background:
    repeating-linear-gradient(0deg, rgba(148, 163, 184, 0.06) 0 1px, transparent 1px 26px),
    repeating-linear-gradient(90deg, rgba(148, 163, 184, 0.06) 0 1px, transparent 1px 26px);
  -webkit-mask-image: radial-gradient(circle, #000 20%, transparent 70%);
          mask-image: radial-gradient(circle, #000 20%, transparent 70%);
}

.hub-traces { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.hub-traces path { fill: none; vector-effect: non-scaling-stroke; }
.trace path { stroke: rgba(148, 163, 184, 0.22); stroke-width: 1.25; }
.trace-dots circle { fill: rgba(148, 163, 184, 0.45); }
.packets path {
  stroke: #00d4ff;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-dasharray: 4 96;
  filter: drop-shadow(0 0 4px #00d4ff);
  animation: packet 3.6s linear infinite;
  animation-delay: var(--d);
}
.packets path:nth-child(odd) { stroke: #8b5cf6; filter: drop-shadow(0 0 4px #8b5cf6); }
@keyframes packet { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }

/* core */
.hub-core {
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(150px, 27%, 240px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle, #0d1e38 55%, #060b14 70%);
  box-shadow:
    -50px -40px 90px -10px rgba(0, 212, 255, 0.3),
     50px  40px 90px -10px rgba(139, 92, 246, 0.38),
    inset 0 0 40px rgba(0, 0, 0, 0.9);
}
.core-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: conic-gradient(
    transparent 0 12deg, #00d4ff 12deg 100deg, transparent 100deg 118deg,
    rgba(0, 212, 255, 0.35) 118deg 150deg, transparent 150deg 192deg,
    #8b5cf6 192deg 282deg, transparent 282deg 300deg,
    rgba(139, 92, 246, 0.35) 300deg 332deg, transparent 332deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px));
  filter: drop-shadow(0 0 8px rgba(0, 212, 255, 0.55)) drop-shadow(0 0 8px rgba(139, 92, 246, 0.5));
  animation: core-spin 16s linear infinite;
}
.core-ring-2 {
  inset: 14%;
  background: repeating-conic-gradient(rgba(203, 213, 225, 0.35) 0 2deg, transparent 2deg 9deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  filter: none;
  animation-direction: reverse;
  animation-duration: 40s;
}
@keyframes core-spin { to { transform: rotate(360deg); } }

.core-chip {
  position: relative;
  width: 44%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 2px solid transparent;
  background:
    linear-gradient(150deg, #111827, #060b14) padding-box,
    linear-gradient(135deg, #00d4ff, #8b5cf6) border-box;
  box-shadow: 0 0 24px rgba(0, 212, 255, 0.35);
}
/* chip pins */
.core-chip::before {
  content: '';
  position: absolute;
  inset: -11px;
  background:
    repeating-linear-gradient(90deg, rgba(0, 212, 255, 0.55) 0 2px, transparent 2px 7px) top    / 70% 7px no-repeat,
    repeating-linear-gradient(90deg, rgba(0, 212, 255, 0.55) 0 2px, transparent 2px 7px) bottom / 70% 7px no-repeat,
    repeating-linear-gradient(0deg,  rgba(0, 212, 255, 0.55) 0 2px, transparent 2px 7px) left   / 7px 70% no-repeat,
    repeating-linear-gradient(0deg,  rgba(0, 212, 255, 0.55) 0 2px, transparent 2px 7px) right  / 7px 70% no-repeat;
  z-index: -1;
  opacity: 0.8;
}
.core-chip span {
  font-weight: 700;
  font-size: clamp(1.6rem, 3.4vw, 2.6rem);
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, #00d4ff, #8b5cf6);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 8px rgba(0, 212, 255, 0.35));
}

/* HUD cards */
.hud-card {
  --w: clamp(200px, 26%, 236px);
  --h: calc(var(--w) * 0.45);
  --cut: 14px;
  position: absolute;
  left: calc(var(--x) - var(--w) / 2);
  top: calc(var(--y) - var(--h) / 2);
  width: var(--w);
  height: var(--h);
  padding: 1.5px;
  z-index: 2;
  background: linear-gradient(135deg, var(--accent), var(--border) 30%, var(--border) 70%, var(--accent-2));
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.6));
  animation: hud-float 6s ease-in-out infinite;
  animation-delay: var(--f);
  transition: scale 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.3s;
}
.hud-card:hover {
  scale: 1.06;
  z-index: 3;
  filter: drop-shadow(0 0 22px color-mix(in srgb, var(--c) 55%, transparent));
}
@keyframes hud-float {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 -8px; }
}
.hud-inner {
  height: 100%;
  display: grid;
  grid-template-columns: 1fr var(--h);
  background: linear-gradient(160deg, var(--surface), var(--bg-primary));
  clip-path: polygon(calc(var(--cut) - 1px) 0, 100% 0, 100% calc(100% - var(--cut) + 1px), calc(100% - var(--cut) + 1px) 100%, 0 100%, 0 calc(var(--cut) - 1px));
}
.hud-card.flip .hud-inner { grid-template-columns: var(--h) 1fr; }

.hud-label {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.35rem;
  padding: 0 0.9rem;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-primary);
}
.hud-card.flip .hud-label { align-items: flex-end; text-align: right; }
.hud-label i { color: var(--c); font-size: 0.95rem; filter: drop-shadow(0 0 6px var(--c)); }

/* icon tile */
.hud-art {
  position: relative;
  margin: 8px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 120%, color-mix(in srgb, var(--c) 38%, transparent), transparent 70%),
    linear-gradient(160deg, var(--surface-elevated), var(--bg-secondary));
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.hud-art i {
  font-size: calc(var(--h) * 0.34);
  color: var(--c);
  filter: drop-shadow(0 0 10px color-mix(in srgb, var(--c) 60%, transparent));
  transition: transform 0.35s ease;
}
.hud-card:hover .hud-art i { transform: scale(1.08); }
@media (max-width: 900px) {
  .hub {
    aspect-ratio: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }
  .hub::before, .hub-traces { display: none; }
  .hub-core {
    position: relative;
    left: auto; top: auto;
    transform: none;
    grid-column: 1 / -1;
    justify-self: center;
    width: 170px;
    margin: 0.5rem 0 1.5rem;
  }
  .hud-card {
    --w: 100%;
    position: relative;
    left: auto; top: auto;
    height: 110px;
    --h: 110px;
    animation: none;
  }
}
@media (max-width: 560px) {
  .hub { grid-template-columns: 1fr; }
  .hud-card.flip .hud-inner { grid-template-columns: 1fr var(--h); }
  .hud-card.flip .hud-art { order: 2; }
  .hud-card.flip .hud-label { align-items: flex-start; text-align: left; }
}

/* ================================================================
   12. CURSOR SPOTLIGHT ON CARDS + HERO STATUS PILL
================================================================ */
.info-card,
.project-card,
.stat-item,
.bstrip-card {
  background:
    radial-gradient(380px circle at var(--mx, -999px) var(--my, -999px), rgba(0, 212, 255, 0.07), transparent 45%),
    var(--surface);
}
.info-card:hover,
.project-card:hover,
.stat-item:hover,
.bstrip-card:hover {
  background:
    radial-gradient(380px circle at var(--mx, -999px) var(--my, -999px), rgba(0, 212, 255, 0.09), transparent 45%),
    var(--surface-hover);
}

.hero-status {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 1.4rem;
  padding: 0.38rem 0.9rem 0.38rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  backdrop-filter: blur(6px);
  transition: border-color var(--transition), color var(--transition);
}
.hero-status:hover { color: var(--text-primary); border-color: rgba(16, 185, 129, 0.5); }
.hero-status i { font-size: 0.7rem; transition: transform var(--transition); }
.hero-status:hover i { transform: translateX(3px); }
.status-sep { color: var(--text-muted); }
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent-3);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  animation: status-pulse 2s infinite;
}
@keyframes status-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
  80%, 100% { box-shadow: 0 0 0 9px rgba(16, 185, 129, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .packets path, .core-ring, .hud-card, .status-dot { animation: none; }
}

/* ================================================================
   13. SIDE QUEST - treasure chest challenge (hero, replaces terminal)
================================================================ */
.treasure-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

/* header strip */
.tq-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
}
.tq-label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}
.tq-label span { color: var(--accent-2); }
.tq-status {
  --st: var(--accent-red);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  border: 1px solid color-mix(in srgb, var(--st) 40%, transparent);
  background: color-mix(in srgb, var(--st) 10%, transparent);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--st);
  font-variant-numeric: tabular-nums;
  transition: color 0.3s, border-color 0.3s, background 0.3s;
}
.tq-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tq-status.open { --st: var(--accent-3); }
.tq-status.open .tq-dot { animation: status-pulse 2s infinite; }
.tq-status.flash { animation: tq-flash 0.45s ease; }
@keyframes tq-flash { 50% { background: color-mix(in srgb, var(--st) 30%, transparent); } }

/* stage */
.treasure-scene {
  position: relative;
  height: 150px;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding-bottom: 26px;
  background:
    radial-gradient(ellipse 55% 85% at 50% 100%, var(--accent-dim), transparent 70%),
    radial-gradient(var(--dot) 1px, transparent 1.2px) 0 0 / 18px 18px;
  border-bottom: 1px solid var(--border-subtle);
}
.treasure-scene::after {           /* floor line */
  content: '';
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 25px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}
.tq-stage {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 1.1rem;
}
.tq-stage::before {                /* contact shadow */
  content: '';
  position: absolute;
  left: -10px;
  right: -10px;
  bottom: -6px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.5), transparent 70%);
}
.treasure-guard {
  position: relative;
  z-index: 2;
  font-size: 3.4rem;
  line-height: 1;
  margin-bottom: 2px;              /* sit the glyph on the floor line */
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.45));
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.6s;
}

/* chest */
.chest {
  position: relative;
  width: 112px;
  height: 92px;
  perspective: 500px;
}
.chest-body {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 56px;
  border-radius: 3px 3px 7px 7px;
  background:
    linear-gradient(90deg, transparent 13px, #b8923a 13px 19px, transparent 19px calc(100% - 19px), #b8923a calc(100% - 19px) calc(100% - 13px), transparent calc(100% - 13px)),
    repeating-linear-gradient(180deg, transparent 0 13px, rgba(0, 0, 0, 0.18) 13px 14px),
    linear-gradient(180deg, #3d2c1d, #22170e);
  border: 2px solid #b8923a;
  box-shadow: inset 0 -10px 16px rgba(0, 0, 0, 0.45);
  z-index: 1;
}
.chest-lock {
  position: absolute;
  top: -3px;
  left: 50%;
  width: 18px;
  height: 22px;
  transform: translateX(-50%);
  border-radius: 3px;
  background: linear-gradient(180deg, #f5c451, #a16207);
  box-shadow: 0 0 0 2px #22170e, 0 2px 6px rgba(0, 0, 0, 0.5);
}
.chest-lock::after {               /* keyhole */
  content: '';
  position: absolute;
  left: 50%;
  top: 6px;
  width: 5px;
  height: 9px;
  transform: translateX(-50%);
  border-radius: 3px 3px 1px 1px;
  background: #22170e;
}
.chest-lid {
  position: absolute;
  bottom: 54px;
  width: 100%;
  height: 36px;
  border-radius: 44px 44px 3px 3px / 28px 28px 3px 3px;
  background:
    linear-gradient(90deg, transparent 13px, #b8923a 13px 19px, transparent 19px calc(100% - 19px), #b8923a calc(100% - 19px) calc(100% - 13px), transparent calc(100% - 13px)),
    linear-gradient(180deg, #4d3826, #2c1f13);
  border: 2px solid #b8923a;
  transform-origin: 50% 0%;
  transition: transform 0.9s cubic-bezier(0.34, 1.4, 0.64, 1) 0.3s;
  z-index: 2;
}
/* lit interior, revealed when the lid lifts */
.chest-mouth {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 50px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 60%, #fde68a, #b45309 55%, #22170e 80%);
  box-shadow: 0 0 14px rgba(245, 196, 81, 0.7);
  opacity: 0;
  transition: opacity 0.4s ease 0.5s;
  z-index: 3;
}
.chest-glow {
  position: absolute;
  left: 50%;
  bottom: 40px;
  width: 110px;
  height: 110px;
  transform: translateX(-50%) scale(0.2);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(253, 224, 138, 0.85), rgba(245, 196, 81, 0.3) 40%, transparent 70%);
  opacity: 0;
  transition: opacity 0.6s ease 0.5s, transform 0.8s ease 0.5s;
}
.chest-sparks { position: absolute; left: 0; right: 0; bottom: 56px; height: 0; }
.chest-sparks i {
  position: absolute;
  bottom: 0;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #fde68a;
  box-shadow: 0 0 6px #f5c451;
  opacity: 0;
}
.chest-sparks i:nth-child(1) { left: 22%; }
.chest-sparks i:nth-child(2) { left: 38%; animation-delay: 0.5s !important; }
.chest-sparks i:nth-child(3) { left: 52%; animation-delay: 1.1s !important; }
.chest-sparks i:nth-child(4) { left: 66%; animation-delay: 0.3s !important; }
.chest-sparks i:nth-child(5) { left: 78%; animation-delay: 0.8s !important; }
@keyframes spark {
  0%   { opacity: 0; transform: translateY(0) scale(1); }
  20%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(-58px) scale(0.4); }
}

/* states */
.treasure-scene.denied .treasure-guard { animation: guard-block 0.45s ease; }
@keyframes guard-block {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px) rotate(-7deg); }
  40% { transform: translateX(7px) rotate(7deg); }
  60% { transform: translateX(-5px) rotate(-4deg); }
  80% { transform: translateX(4px) rotate(3deg); }
}
.treasure-scene.open .treasure-guard { transform: translateX(-26px) rotate(-8deg); opacity: 0.85; }
.treasure-scene.open .chest-lid { transform: translateY(-4px) rotateX(58deg); }
.treasure-scene.open .chest-mouth { opacity: 1; }
.treasure-scene.open .chest-glow { opacity: 1; transform: translateX(-50%) scale(1); }
.treasure-scene.open .chest-sparks i { animation: spark 1.8s ease-out 1s infinite; }

/* body */
.treasure-body { padding: 1.15rem 1.25rem 1.2rem; }
.treasure-title {
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin-bottom: 0.85rem;
}
.treasure-form { display: flex; gap: 0.6rem; }
.treasure-input,
.treasure-form .btn {
  height: 44px;
}
.treasure-input {
  flex: 1;
  min-width: 0;
  padding: 0 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.treasure-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.treasure-input:disabled { opacity: 0.55; }
.treasure-form .btn { padding-top: 0; padding-bottom: 0; justify-content: center; min-width: 118px; }
.treasure-form .btn:disabled { opacity: 0.55; cursor: default; transform: none; box-shadow: none; }

.tq-foot {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-top: 0.75rem;
  min-height: 26px;
}
.treasure-hint-toggle {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.22rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  transition: color var(--transition), border-color var(--transition);
}
.treasure-hint-toggle:hover,
.treasure-hint-toggle[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); }
.treasure-msg {
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--text-muted);
}
.treasure-msg.err { color: var(--accent-red); }
.treasure-msg.ok  { color: var(--accent-3); }
.treasure-msg a { color: var(--text-primary); text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.treasure-hint {
  margin-top: 0.75rem;
  padding: 0.55rem 0.8rem;
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--accent-dim);
  font-size: 0.84rem;
  color: var(--text-secondary);
  animation: hint-in 0.25s ease;
}
@keyframes hint-in { from { opacity: 0; transform: translateY(-4px); } }

@media (max-width: 480px) {
  .tq-foot { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .treasure-form .btn { min-width: 0; }
}
@media (max-width: 1024px) {
  .hero-scroll { display: none; }   /* stacked hero is taller than the viewport; indicator overlapped the stats */
}
@media (prefers-reduced-motion: reduce) {
  .chest-lid, .chest-glow, .treasure-guard { transition: none; }
  .treasure-scene.denied .treasure-guard, .treasure-scene.open .chest-sparks i, .tq-status.open .tq-dot { animation: none; }
}

/* keep hero grid columns from being stretched by wide terminal content on phones */
.hero-container > * { min-width: 0; }

/* ================================================================
   14. SITE-WIDE SCALE - renders everything at 90%, like browser zoom.
   Change --site-zoom to adjust; 1 disables it.
================================================================ */
:root { --site-zoom: 0.9; }
html { zoom: var(--site-zoom); }
/* vh units are not zoom-aware: keep full-screen sections full-screen */
.hero, .error-page { min-height: calc(100vh / var(--site-zoom)); }
