/* ============================================================
   YULIONA // LAB — Multi-Page Kinetic Portal Architecture
   Clean single-screen homepage + 4 dedicated workspace pages
   ============================================================ */

:root {
  --bg: #07070a;
  --bg-elevated: #0f1016;
  --bg-card: rgba(16, 17, 24, 0.68);
  --ink: #f4f1ea;
  --ink-muted: rgba(244, 241, 234, 0.62);
  --ink-faint: rgba(244, 241, 234, 0.34);
  --line: rgba(244, 241, 234, 0.12);
  --line-strong: rgba(244, 241, 234, 0.28);
  --accent: #ff4d2e;
  --accent-2: #d4ff3f;
  --accent-soft: rgba(255, 77, 46, 0.14);
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  --radius: 20px;
  --radius-sm: 12px;
  --font-display: "Syne", "Space Grotesk", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-serif: "Instrument Serif", "Songti SC", "STSong", Georgia, serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", "Fira Code", Consolas, monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
  --bg: #f3efe6;
  --bg-elevated: #eae4d8;
  --bg-card: rgba(255, 253, 248, 0.78);
  --ink: #111114;
  --ink-muted: rgba(17, 17, 20, 0.62);
  --ink-faint: rgba(17, 17, 20, 0.35);
  --line: rgba(17, 17, 20, 0.12);
  --line-strong: rgba(17, 17, 20, 0.28);
  --accent: #e63b1e;
  --accent-2: #111114;
  --accent-soft: rgba(230, 59, 30, 0.11);
  --shadow: 0 20px 50px rgba(17, 17, 20, 0.09);
}

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

html {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-display);
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.45s var(--ease-out), color 0.45s var(--ease-out);
}

::selection { background: var(--accent); color: #fff; }

/* ---------- WebGL Background & Grain ---------- */
#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  opacity: 0.92;
  transition: opacity 0.5s ease;
}

[data-theme="light"] #bg-canvas { opacity: 0.36; }

.grain-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.04;
  background-image: radial-gradient(rgba(255, 255, 255, 0.5) 0.5px, transparent 0.5px);
  background-size: 3px 3px;
}

/* ---------- Page Transition Curtain ---------- */
.page-curtain {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #07070a;
  pointer-events: none;
  transform: translateY(0%);
  transition: transform 0.65s var(--ease-out);
}

body.page-ready .page-curtain {
  transform: translateY(-102%);
}

body.page-leaving .page-curtain {
  transform: translateY(0%);
  pointer-events: auto;
}

/* ---------- Custom Cursor ---------- */
.cursor-dot, .cursor-ring {
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 9000;
  transform: translate(-50%, -50%);
  will-change: transform;
  display: none;
}

@media (pointer: fine) {
  .cursor-dot, .cursor-ring {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

.cursor-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.cursor-ring {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--ink);
  transition: width 0.25s var(--ease-out), height 0.25s var(--ease-out), background 0.25s, border-color 0.25s;
}

.cursor-ring.active {
  width: 74px; height: 74px;
  background: rgba(255, 77, 46, 0.16);
  border-color: var(--accent);
  backdrop-filter: blur(4px);
}

/* ---------- Floating Navigation ---------- */
.nav {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: min(1320px, calc(100vw - 32px));
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px 11px 22px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(10, 10, 14, 0.62);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}

[data-theme="light"] .nav { background: rgba(243, 239, 230, 0.76); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.12em;
}

.brand-mark {
  width: 9px; height: 9px;
  border-radius: 2px;
  background: var(--accent);
  transform: rotate(45deg);
  box-shadow: 0 0 12px var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-links a {
  text-decoration: none;
  color: var(--ink-muted);
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 999px;
  transition: color 0.25s, background 0.25s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--ink);
  background: var(--line);
}

.nav-links a.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.nav-actions { display: flex; align-items: center; gap: 8px; }

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 7px 13px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.25s, background 0.25s, transform 0.25s var(--ease-out);
}

.pill-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.kbd {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--line-strong);
  color: var(--ink-muted);
}

/* ============================================================
   HOME PAGE: Pure Single-Screen Portal Stage (100vh)
   ============================================================ */
.home-stage {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  width: min(1320px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 104px 0 36px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
}

.home-header {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.home-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
}

.live-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  backdrop-filter: blur(12px);
}

.pulse-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #2ef28b;
  box-shadow: 0 0 0 0 rgba(46, 242, 139, 0.7);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(46, 242, 139, 0.7); }
  70% { box-shadow: 0 0 0 9px rgba(46, 242, 139, 0); }
  100% { box-shadow: 0 0 0 0 rgba(46, 242, 139, 0); }
}

.home-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  flex-wrap: wrap;
}

.home-title {
  font-size: clamp(40px, 6.4vw, 88px);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.home-title .serif-italic {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
}

.home-title .outline-word {
  color: transparent;
  -webkit-text-stroke: 1.4px var(--ink);
}

.home-lead {
  max-width: 390px;
  font-size: 14px;
  line-height: 1.75;
  color: var(--ink-muted);
}

/* 4-Portal Interactive Kinetic Deck */
.portal-deck {
  display: flex;
  gap: 16px;
  min-height: 410px;
  flex: 1;
  max-height: 500px;
}

.portal-card {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 28px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: rgba(14, 15, 22, 0.86);
  text-decoration: none;
  color: var(--ink);
  overflow: hidden;
  transition:
    flex 0.6s var(--ease-out),
    border-color 0.35s ease,
    box-shadow 0.45s ease,
    transform 0.45s var(--ease-out);
}

.portal-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    460px circle at var(--mx, 50%) var(--my, 50%),
    var(--card-glow, rgba(255, 77, 46, 0.22)),
    transparent 62%
  );
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.portal-card::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: var(--card-accent, var(--accent));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.55s var(--ease-out);
}

.portal-deck:hover .portal-card { flex: 0.85; opacity: 0.78; }
.portal-deck .portal-card:hover {
  flex: 1.75;
  opacity: 1;
  border-color: var(--card-accent, var(--accent));
  box-shadow: var(--shadow);
  transform: translateY(-4px);
}

.portal-card:hover::before { opacity: 1; }
.portal-card:hover::after { transform: scaleX(1); }

.portal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
}

.portal-count {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--card-accent, var(--accent));
}

.portal-num {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(54px, 5.5vw, 82px);
  line-height: 0.9;
  color: var(--ink-faint);
  transition: color 0.35s, transform 0.45s var(--ease-out);
}

.portal-card:hover .portal-num {
  color: var(--card-accent, var(--accent));
  transform: translateX(6px);
}

.portal-en {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--ink-faint);
  margin-bottom: 6px;
}

.portal-name {
  font-size: clamp(24px, 2.3vw, 34px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.portal-desc {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--ink-muted);
  max-width: 340px;
}

.portal-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
}

.arrow-circle {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: transform 0.35s var(--ease-out), background 0.35s, border-color 0.35s, color 0.35s;
}

.portal-card:hover .arrow-circle,
.sys-card:hover .arrow-circle {
  transform: rotate(-45deg);
  background: var(--card-accent, var(--accent));
  border-color: var(--card-accent, var(--accent));
  color: #07070a;
}

.home-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-faint);
}

/* ============================================================
   SUBPAGES SHARED LAYOUT
   ============================================================ */
.subpage {
  position: relative;
  z-index: 2;
  width: min(1280px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 116px 0 80px;
}

.sub-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 24px;
  margin-bottom: 36px;
  border-bottom: 1px solid var(--line);
}

.sub-kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--accent);
  margin-bottom: 8px;
}

.sub-title {
  font-size: clamp(32px, 4.5vw, 56px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.sub-desc {
  font-size: 14px;
  color: var(--ink-muted);
  max-width: 460px;
  line-height: 1.7;
}

/* ---------- Systems Subpage ---------- */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
}

.sys-card {
  grid-column: span 6;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 260px;
  padding: 28px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-card);
  backdrop-filter: blur(18px);
  color: var(--ink);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.25s var(--ease-out);
}

.sys-card.featured {
  grid-column: span 7;
  min-height: 300px;
  background: linear-gradient(145deg, rgba(255, 77, 46, 0.14), var(--bg-card) 58%);
}

.sys-card.compact { grid-column: span 5; min-height: 300px; }

.bento-grid > .sys-card:last-child:nth-child(odd) {
  grid-column: span 12;
  min-height: 200px;
}

.sys-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-4px);
}

.sys-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
}

.status-pill {
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 11px;
}

.status-pill.online { border-color: rgba(46, 242, 139, 0.45); color: #2ef28b; background: rgba(46, 242, 139, 0.08); }
.status-pill.ready { border-color: rgba(255, 77, 46, 0.45); color: var(--accent); background: var(--accent-soft); }

.sys-body { margin: 22px 0; }
.sys-en { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.15em; color: var(--ink-faint); margin-bottom: 6px; }
.sys-title { font-size: clamp(22px, 2.3vw, 30px); font-weight: 800; margin-bottom: 10px; }
.sys-desc { font-size: 14px; line-height: 1.7; color: var(--ink-muted); }

.sys-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 7px; }
.tag {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink-muted);
}

/* ---------- Toolbox Subpage (Split Workbench) ---------- */
.workbench {
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 22px;
  align-items: start;
}

.tool-sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tool-tab {
  text-align: left;
  padding: 18px 20px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s, transform 0.25s var(--ease-out);
}

.tool-tab:hover { border-color: var(--line-strong); transform: translateX(4px); }
.tool-tab.active {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--accent-soft), var(--bg-card));
}

.tool-tab-code { font-family: var(--font-mono); font-size: 11px; color: var(--accent); margin-bottom: 4px; }
.tool-tab-name { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.tool-tab-desc { font-size: 12px; color: var(--ink-muted); line-height: 1.5; }

.tool-stage {
  padding: 30px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-card);
  backdrop-filter: blur(18px);
  min-height: 440px;
}

/* ---------- Notes Subpage ---------- */
.notes-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 24px;
}

.filter-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-pill {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.25s;
}

.filter-pill.active, .filter-pill:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  border-radius: 999px;
  padding: 8px 16px;
  min-width: 260px;
}

.search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--ink);
  font-size: 13px;
  width: 100%;
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.note-card {
  padding: 26px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.3s var(--ease-out), border-color 0.3s;
}

.note-card:hover { transform: translateY(-4px); border-color: var(--accent); }
.note-meta { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); }
.note-title { font-size: 20px; font-weight: 700; line-height: 1.4; }
.note-summary { font-size: 13.5px; line-height: 1.7; color: var(--ink-muted); }

/* ---------- Blog Subpage ---------- */
.blog-list { display: flex; flex-direction: column; }

.blog-row {
  position: relative;
  display: grid;
  grid-template-columns: 72px 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 28px 20px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  overflow: hidden;
  transition: padding-left 0.35s var(--ease-out), border-color 0.35s;
}

.blog-row::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--accent-soft), transparent 70%);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s var(--ease-out);
  z-index: -1;
}

.blog-row:hover { padding-left: 34px; border-color: var(--accent); }
.blog-row:hover::before { transform: scaleX(1); }
.blog-no { font-family: var(--font-serif); font-style: italic; font-size: 32px; color: var(--accent); }
.blog-title { font-size: clamp(19px, 2.2vw, 28px); font-weight: 700; margin-bottom: 6px; }
.blog-excerpt { font-size: 13.5px; color: var(--ink-muted); line-height: 1.65; }
.blog-right { text-align: right; font-family: var(--font-mono); font-size: 12px; color: var(--ink-muted); }

/* ---------- Shared Form / Code / Modal ---------- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.tool-ui textarea,
.tool-ui input[type="text"],
.tool-ui input[type="url"] {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: rgba(0, 0, 0, 0.25);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 12px 14px;
  outline: none;
  margin-bottom: 12px;
}

[data-theme="light"] .tool-ui textarea,
[data-theme="light"] .tool-ui input[type="text"],
[data-theme="light"] .tool-ui input[type="url"] { background: #fff; }

.tool-ui textarea:focus, .tool-ui input:focus { border-color: var(--accent); }
.tool-btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }

.tool-output {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 77, 46, 0.06);
  word-break: break-all;
  white-space: pre-wrap;
  min-height: 60px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(4, 4, 7, 0.74);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease-out);
}

.modal-backdrop.open { opacity: 1; pointer-events: auto; }

.modal-panel {
  width: min(820px, 100%);
  max-height: 86vh;
  overflow-y: auto;
  border-radius: 24px;
  border: 1px solid var(--line-strong);
  background: var(--bg-elevated);
  color: var(--ink);
  padding: 32px;
  box-shadow: var(--shadow);
  transform: translateY(18px) scale(0.97);
  transition: transform 0.35s var(--ease-out);
}

.modal-backdrop.open .modal-panel { transform: translateY(0) scale(1); }

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.modal-close {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  font-size: 18px;
  cursor: pointer;
}

.modal-close:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

.reader-content h3 { font-size: 17px; margin: 20px 0 10px; }
.reader-content p { font-size: 14.5px; line-height: 1.8; color: var(--ink-muted); margin-bottom: 12px; }

.code-wrap {
  margin: 12px 0 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

[data-theme="light"] .code-wrap { background: #17181d; color: #f4f1ea; }

.code-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(244, 241, 234, 0.55);
}

.copy-btn {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: transparent;
  color: #f4f1ea;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.copy-btn:hover { background: var(--accent); border-color: var(--accent); }

.code-wrap pre {
  padding: 14px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.65;
  color: #f4f1ea;
}

.cmd-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; max-height: 360px; overflow-y: auto; }
.cmd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  cursor: pointer;
}
.cmd-item:hover { background: var(--accent-soft); border-color: var(--accent); }
.cmd-type { font-family: var(--font-mono); font-size: 10px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--ink-muted); }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .portal-deck { flex-direction: column; max-height: none; }
  .portal-deck:hover .portal-card,
  .portal-deck .portal-card:hover { flex: 1; opacity: 1; }
  .workbench { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .nav-links { display: none; }
  .sys-card, .sys-card.featured, .sys-card.compact { grid-column: span 12; }
  .notes-grid { grid-template-columns: 1fr; }
  .blog-row { grid-template-columns: 48px 1fr; }
  .blog-right { display: none; }
}


/* ---------- Toolbox Card Grid (Click -> Modal) ---------- */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.tool-card {
  position: relative;
  padding: 26px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(14, 15, 22, 0.86);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 230px;
  transition: transform 0.32s var(--ease-out), border-color 0.3s, box-shadow 0.3s;
}

[data-theme="light"] .tool-card {
  background: rgba(255, 253, 248, 0.9);
}

.tool-card:hover {
  transform: translateY(-6px);
  border-color: #d4ff3f;
  box-shadow: var(--shadow);
}

.tool-code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #d4ff3f;
  letter-spacing: 0.14em;
}

[data-theme="light"] .tool-code { color: var(--accent); }

.tool-name {
  font-size: 20px;
  font-weight: 800;
  margin: 14px 0 10px;
}

.tool-desc {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--ink-muted);
}

.tool-launch {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tool-card:hover .arrow-circle {
  background: #d4ff3f;
  border-color: #d4ff3f;
  color: #07070a;
  transform: translate(2px, -2px);
}

@media (max-width: 1024px) { .tools-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .tools-grid { grid-template-columns: 1fr; } }


/* ============================================================
   V2 CSS 3D PORTAL TRANSITION STAGE
   Button -> Center 1/2 viewport -> CSS 3D Animation -> Fullscreen
   ============================================================ */
.pt-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: rgba(5, 5, 8, 0.78);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.32s var(--ease-out);
}
.pt-backdrop.active { opacity: 1; pointer-events: auto; }

.pt-stage {
  position: fixed;
  z-index: 9600;
  border-radius: 24px;
  border: 1.5px solid var(--pt-accent, var(--accent));
  background: radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.06), #0b0c12 72%);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.75), 0 0 60px var(--pt-glow, rgba(255, 77, 46, 0.28));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  will-change: left, top, width, height, border-radius;
  transition:
    left 0.42s var(--ease-out),
    top 0.42s var(--ease-out),
    width 0.42s var(--ease-out),
    height 0.42s var(--ease-out),
    border-radius 0.42s var(--ease-out);
}

.pt-stage.fullscreen {
  left: 0 !important;
  top: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  border-radius: 0 !important;
  border-color: transparent !important;
  transition:
    left 0.36s var(--ease-out),
    top 0.36s var(--ease-out),
    width 0.36s var(--ease-out),
    height 0.36s var(--ease-out),
    border-radius 0.36s var(--ease-out);
}

.pt-label {
  position: absolute;
  bottom: 24px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--pt-accent, var(--accent));
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s var(--ease-out);
}
.pt-stage.playing .pt-label { opacity: 1; transform: translateY(0); }

.pt-stage.fullscreen .pt-scene,
.pt-stage.fullscreen .pt-label {
  opacity: 0;
  transform: scale(1.16);
  transition: opacity 0.26s ease, transform 0.32s var(--ease-out);
}

.pt-scene {
  position: relative;
  width: 280px;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 900px;
  opacity: 0;
  transform: scale(0.84);
  transition: opacity 0.28s ease, transform 0.36s var(--ease-out);
}
.pt-stage.playing .pt-scene { opacity: 1; transform: scale(1); }

/* 1. VAULT DOOR */
.vault-frame {
  position: relative;
  width: 176px;
  height: 176px;
  border-radius: 50%;
  border: 6px solid #2b2e3a;
  background: radial-gradient(circle, rgba(255, 77, 46, 0.85) 0%, rgba(255, 77, 46, 0.15) 58%, #07070a 100%);
  box-shadow: inset 0 0 40px rgba(255, 77, 46, 0.65), 0 0 36px rgba(255, 77, 46, 0.25);
  perspective: 700px;
}
.vault-door {
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #3a3e4d, #181a22 75%);
  border: 4px solid #52576b;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform 0.52s cubic-bezier(0.22, 1, 0.36, 1) 0.42s;
}
.pt-stage.playing .vault-door { transform: rotateY(-118deg); }
.vault-wheel { width: 96px; height: 96px; transition: transform 0.42s cubic-bezier(0.34, 1.4, 0.64, 1) 0.05s; }
.pt-stage.playing .vault-wheel { transform: rotate(300deg); }
.vault-bolt {
  position: absolute; width: 18px; height: 7px; border-radius: 3px;
  background: #ff4d2e; box-shadow: 0 0 10px #ff4d2e;
  transition: transform 0.25s ease 0.26s, opacity 0.25s ease 0.32s;
}
.vault-bolt.b1 { top: 8px; left: 50%; transform: translateX(-50%) rotate(90deg); }
.vault-bolt.b2 { bottom: 8px; left: 50%; transform: translateX(-50%) rotate(90deg); }
.vault-bolt.b3 { left: 6px; top: 50%; transform: translateY(-50%); }
.vault-bolt.b4 { right: 6px; top: 50%; transform: translateY(-50%); }
.pt-stage.playing .vault-bolt { opacity: 0; }

/* 2. TOOLBOX OPEN */
.tb-wrap { position: relative; width: 196px; height: 150px; perspective: 800px; }
.tb-base {
  position: absolute; bottom: 8px; left: 8px; right: 8px; height: 86px;
  border-radius: 10px 10px 14px 14px;
  background: linear-gradient(180deg, #252933, #14171f);
  border: 2px solid #d4ff3f;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6), inset 0 8px 24px rgba(212, 255, 63, 0.16);
  z-index: 3;
}
.tb-stripe { position: absolute; top: 22px; left: 14px; right: 14px; height: 4px; border-radius: 99px; background: rgba(212, 255, 63, 0.35); }
.tb-latch { position: absolute; top: -7px; width: 22px; height: 14px; border-radius: 4px; background: #d4ff3f; transition: transform 0.22s ease 0.08s; }
.tb-latch.l1 { left: 32px; }
.tb-latch.l2 { right: 32px; }
.pt-stage.playing .tb-latch { transform: translateY(-8px) rotateX(60deg); }
.tb-lid {
  position: absolute; bottom: 92px; left: 6px; right: 6px; height: 36px;
  border-radius: 14px 14px 4px 4px;
  background: linear-gradient(180deg, #323745, #1f232e);
  border: 2px solid #d4ff3f;
  transform-origin: center bottom;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1) 0.2s;
  z-index: 4;
}
.tb-handle { position: absolute; top: -16px; left: 50%; transform: translateX(-50%); width: 64px; height: 16px; border: 4px solid #d4ff3f; border-bottom: none; border-radius: 10px 10px 0 0; }
.pt-stage.playing .tb-lid { transform: rotateX(122deg); }
.tb-item {
  position: absolute; bottom: 52px; left: 50%; padding: 6px 10px; border-radius: 10px;
  border: 1px solid rgba(212, 255, 63, 0.7); background: rgba(212, 255, 63, 0.16);
  color: #d4ff3f; font-family: var(--font-mono); font-size: 13px; font-weight: 700;
  opacity: 0; z-index: 2; transform: translate(-50%, 10px) scale(0.5);
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}
.pt-stage.playing .tb-item.i1 { opacity: 1; transition-delay: 0.34s; transform: translate(-115%, -72px) rotate(-12deg) scale(1); }
.pt-stage.playing .tb-item.i2 { opacity: 1; transition-delay: 0.40s; transform: translate(-25%, -96px) rotate(4deg) scale(1.08); }
.pt-stage.playing .tb-item.i3 { opacity: 1; transition-delay: 0.46s; transform: translate(65%, -74px) rotate(14deg) scale(1); }

/* 3. BOOK PAGE FLIP */
.book-wrap { position: relative; width: 184px; height: 146px; perspective: 950px; }
.book-base {
  position: absolute; inset: 0; border-radius: 6px 14px 14px 6px;
  background: #141a24; border: 2px solid #38d2ff;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6), 0 0 28px rgba(56, 210, 255, 0.22);
  padding: 20px 18px; display: flex; flex-direction: column; gap: 10px;
}
.book-line { height: 6px; border-radius: 4px; background: rgba(56, 210, 255, 0.28); }
.book-line.short { width: 58%; background: #38d2ff; }
.book-page {
  position: absolute; inset: 3px 3px 3px 6px; border-radius: 4px 12px 12px 4px;
  background: linear-gradient(90deg, #1b2433, #233044); border: 1px solid rgba(56, 210, 255, 0.55);
  transform-origin: left center; transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}
.book-cover {
  position: absolute; inset: 0; border-radius: 6px 14px 14px 6px;
  background: linear-gradient(135deg, #112636, #0c131d); border: 2px solid #38d2ff;
  transform-origin: left center; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.16em; color: #38d2ff;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.06s; z-index: 6;
}
.book-page.p1 { z-index: 5; transition-delay: 0.20s; }
.book-page.p2 { z-index: 4; transition-delay: 0.34s; }
.book-page.p3 { z-index: 3; transition-delay: 0.48s; }
.pt-stage.playing .book-cover { transform: rotateY(-165deg); }
.pt-stage.playing .book-page.p1 { transform: rotateY(-160deg); }
.pt-stage.playing .book-page.p2 { transform: rotateY(-154deg); }
.pt-stage.playing .book-page.p3 { transform: rotateY(-148deg); }

/* 4. BLOG COMMENTS BURST */
.blog-anim-wrap { position: relative; width: 280px; height: 196px; }
.blog-core-card {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 146px; height: 98px; border-radius: 14px;
  border: 1.5px solid rgba(255, 184, 56, 0.7); background: rgba(255, 184, 56, 0.08);
  padding: 14px; display: flex; flex-direction: column; gap: 8px;
}
.blog-core-bar { height: 6px; border-radius: 4px; background: rgba(255, 184, 56, 0.35); }
.blog-core-bar.hi { width: 65%; background: #ffb838; }
.cmt-bubble {
  position: absolute; padding: 7px 12px; border-radius: 14px;
  border: 1px solid rgba(255, 184, 56, 0.65); background: rgba(20, 18, 14, 0.94);
  color: #f4f1ea; font-size: 12px; white-space: nowrap; box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
  opacity: 0; transform: scale(0.4) translateY(18px);
  transition: transform 0.42s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.28s ease;
}
.cmt-bubble strong { color: #ffb838; margin-right: 4px; }
.cmt-bubble.c1 { top: 6px; left: 4px; }
.cmt-bubble.c2 { top: 26px; right: 0px; }
.cmt-bubble.c3 { bottom: 30px; left: 0px; }
.cmt-bubble.c4 { bottom: 6px; right: 6px; }
.cmt-bubble.c5 { top: -8px; left: 52%; background: #ffb838; color: #111; font-weight: 700; border: none; }
.pt-stage.playing .cmt-bubble.c1 { opacity: 1; transform: scale(1) translateY(0); transition-delay: 0.08s; }
.pt-stage.playing .cmt-bubble.c2 { opacity: 1; transform: scale(1) translateY(0); transition-delay: 0.20s; }
.pt-stage.playing .cmt-bubble.c3 { opacity: 1; transform: scale(1) translateY(0); transition-delay: 0.32s; }
.pt-stage.playing .cmt-bubble.c4 { opacity: 1; transform: scale(1) translateY(0); transition-delay: 0.44s; }
.pt-stage.playing .cmt-bubble.c5 { opacity: 1; transform: scale(1) translateY(0); transition-delay: 0.54s; }


/* ---------- ICP Compliance Footer ---------- */
.icp-link {
  color: var(--ink-muted);
  text-decoration: none;
  border-bottom: 1px dashed var(--line-strong);
  padding-bottom: 1px;
  transition: color 0.25s, border-color 0.25s;
}
.icp-link:hover {
  color: var(--ink);
  border-color: var(--accent);
}
.sub-footer {
  position: relative;
  z-index: 2;
  width: min(1280px, calc(100vw - 32px));
  margin: 0 auto 36px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-faint);
}


/* ---------- Wide Embedded Tool Modal ---------- */
.modal-panel.modal-wide {
  width: min(1180px, 94vw);
  height: 86vh;
  max-height: 86vh;
  padding: 20px 24px 22px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-panel.modal-wide .modal-header {
  margin-bottom: 14px;
  padding-bottom: 12px;
  flex-shrink: 0;
}
.modal-panel.modal-wide #modal-body {
  flex: 1;
  min-height: 0;
  display: flex;
}
.tool-iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 12px;
  background: transparent;
}
