@import url("https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@400;500;600;700&family=Martian+Mono:wght@400;500;700&display=swap");

:root {
  --bg: #050810;
  --bg-raised: #0a0f1c;
  --bg-card: #0d1322;
  --bg-card-hover: #111929;

  --ink: #dce4f0;
  --ink-soft: #6f819e;
  --ink-faint: #354260;

  --accent: #4a9eff;
  --accent-dim: rgba(74, 158, 255, 0.1);
  --accent-glow: rgba(74, 158, 255, 0.35);

  --slime: #36f0c8;
  --slime-dim: rgba(54, 240, 200, 0.1);
  --slime-glow: rgba(54, 240, 200, 0.35);

  --orange: #ff8a4c;
  --orange-dim: rgba(255, 138, 76, 0.1);
  --yellow: #ffd166;
  --green: #7df552;
  --green-dim: rgba(125, 245, 82, 0.1);

  --border: #151e35;
  --border-light: #22325a;

  --space-section: clamp(80px, 12vw, 140px);
  --space-inner: clamp(16px, 2.4vw, 28px);
  --gutter: clamp(16px, 4vw, 32px);
  --max-w: 1120px;

  --radius: 6px;
  --radius-lg: 10px;
}

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

html, body { margin: 0; min-height: 100%; }

body {
  font-family: "Chakra Petch", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Noise texture */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 180px;
}

.ambient-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(600px circle at var(--glow-x, 30%) var(--glow-y, 20%), rgba(54, 240, 200, 0.02), transparent 50%),
    radial-gradient(400px circle at 80% 80%, rgba(125, 245, 82, 0.012), transparent 50%);
  animation: ambient-drift 20s ease-in-out infinite alternate;
}

@keyframes ambient-drift {
  0%   { --glow-x: 20%; --glow-y: 15%; }
  50%  { --glow-x: 70%; --glow-y: 60%; }
  100% { --glow-x: 40%; --glow-y: 85%; }
}

a { color: inherit; text-decoration: none; }

h1, h2, h3 { margin: 0; line-height: 1.08; font-weight: 700; }
h1 { letter-spacing: -0.03em; }
h2 { letter-spacing: -0.02em; }

/* ─── Nav ─── */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 16px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--ink);
  letter-spacing: -0.01em;
}

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

.nav-links a {
  padding: 6px 10px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink-faint);
  border-bottom: 2px solid transparent;
  transition: color 150ms, border-color 150ms;
}

.nav-links a:hover { color: var(--ink); }

.nav-links a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.nav-session-link {
  color: var(--slime) !important;
  border-bottom-color: var(--slime) !important;
}

/* ─── Layout ─── */
.page-wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: clamp(22px, 4vw, 44px) var(--gutter) var(--space-section);
}

.grid { display: grid; gap: var(--space-inner); }
.grid.two  { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ─── Typography ─── */
.section-label {
  display: inline-block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  color: var(--ink-faint);
  margin-bottom: 14px;
  padding-left: 14px;
  border-left: 2px solid var(--accent);
}

.section-label.theme-nexo {
  border-left-color: var(--orange);
  color: var(--orange);
}

.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  line-height: 1.05;
}

.hero-subtitle {
  margin: 14px 0 0;
  max-width: 56ch;
  color: var(--ink-soft);
  font-size: 1.05rem;
  line-height: 1.6;
}

/* ─── Card ─── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(24px, 3vw, 36px);
  transition: border-color 250ms, background 250ms;
}

/* Removed generic card:hover — only interactive elements get hover states */

.card h2, .card h3 { margin: 0; }

.card p {
  margin: 12px 0 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ─── Profile open section (no card wrapper) ─── */
.profile-open {
  padding-bottom: clamp(20px, 3vw, 32px);
  border-bottom: 1px solid var(--border);
  margin-bottom: clamp(20px, 3vw, 32px);
}

.profile-name {
  font-size: clamp(2.2rem, 4.5vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.stats-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 22px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.stats-bar-item { display: flex; flex-direction: column; gap: 2px; min-width: 64px; }

.stats-bar-value {
  font-family: "Martian Mono", monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
}

.stats-bar-value.slime { color: var(--slime); }
.stats-bar-dim { color: var(--ink-faint); font-weight: 400; }

.stats-bar-label {
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
}

.stats-bar-sep {
  width: 1px;
  height: 28px;
  background: var(--border);
  flex-shrink: 0;
}

.profile-open .xp-track { margin-top: 14px; }

/* Profile 2-column layout (skills + side panel) */
.profile-columns {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: clamp(20px, 3vw, 36px);
  align-items: start;
  margin-bottom: clamp(24px, 4vw, 40px);
}

.section-block {
  padding-bottom: clamp(20px, 3vw, 28px);
  margin-bottom: clamp(20px, 3vw, 28px);
  border-bottom: 1px solid var(--border);
}

.section-block:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.section-block h2 { margin-bottom: 4px; }

/* Side panel (lineage breakdown) */
.profile-col-side {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(18px, 2vw, 24px);
  position: sticky;
  top: 80px;
}

.profile-col-side h3 {
  font-size: 0.88rem;
  margin-bottom: 16px;
}

.lineage-bars { display: grid; gap: 12px; }

.lineage-row {
  display: grid;
  grid-template-columns: 70px 1fr 28px;
  gap: 10px;
  align-items: center;
}

.lineage-name {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.lineage-track {
  height: 4px;
  background: var(--border);
  border-radius: 0;
  overflow: hidden;
}

.lineage-fill { height: 100%; transition: width 400ms ease; }
.lineage-fill.lineage-glitch { background: var(--orange); }
.lineage-fill.lineage-espectro { background: var(--slime); }
.lineage-fill.lineage-bestia { background: var(--green); }

.lineage-count {
  font-family: "Martian Mono", monospace;
  font-size: 0.72rem;
  color: var(--ink-faint);
  text-align: right;
}

/* ─── Collection showcase ─── */
.collection-section {
  margin-bottom: clamp(24px, 4vw, 40px);
}

.collection-section h2 {
  margin-bottom: 18px;
}

.collection-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: clamp(16px, 2.5vw, 28px);
  align-items: start;
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}

.col-thumb {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: transform 250ms, box-shadow 300ms, border-color 250ms;
}

.col-thumb:hover {
  transform: translateY(-3px);
  border-color: var(--border-light);
}

.col-thumb-img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 4px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(17, 25, 41, 0.5), rgba(10, 15, 28, 0.7));
}

.col-thumb-img img {
  object-fit: contain;
}

/* Stage-based sizing — collection (% of container, always centered) */
.col-thumb.stage-egg .col-thumb-img img,
.col-thumb.stage-child .col-thumb-img img  { width: 50%; height: 50%; }
.col-thumb.stage-young .col-thumb-img img  { width: 65%; height: 65%; }
.col-thumb.stage-adult .col-thumb-img img  { width: 80%; height: 80%; }
.col-thumb.stage-boss .col-thumb-img img   { width: 100%; height: 100%; }

/* Children — smaller */
.col-thumb.id-emblit .col-thumb-img img,
.col-thumb.id-buggon .col-thumb-img img,
.col-thumb.id-pixlur .col-thumb-img img   { width: 38%; height: 38%; }
.col-thumb.id-shroomlet .col-thumb-img img { width: 36%; height: 36%; }

/* Children — bigger */
.col-thumb.id-vermini .col-thumb-img img,
.col-thumb.id-shellbit .col-thumb-img img,
.col-thumb.id-bombling .col-thumb-img img,
.col-thumb.id-brawlet .col-thumb-img img { width: 68%; height: 68%; }

.col-thumb.id-rootik .col-thumb-img img,
.col-thumb.id-monokit .col-thumb-img img,
.col-thumb.id-wadlet .col-thumb-img img,
.col-thumb.id-turtlet .col-thumb-img img,
.col-thumb.id-crimlet .col-thumb-img img,
.col-thumb.id-tucalet .col-thumb-img img { width: 84%; height: 84%; }

.col-thumb.id-flicklit .col-thumb-img img { width: 100%; height: 100%; }

/* Young — position fix */
.col-thumb.id-thorabyte .col-thumb-img img { margin-top: 10%; }

/* Young — smaller */
.col-thumb.id-mangrowl .col-thumb-img img  { width: 50%; height: 50%; }
.col-thumb.id-crabbyte .col-thumb-img img,
.col-thumb.id-citrawing .col-thumb-img img { width: 48%; height: 48%; }

/* Young — bigger */
.col-thumb.id-spiketort .col-thumb-img img { width: 90%; height: 90%; }
.col-thumb.id-monorge .col-thumb-img img   { width: 90%; height: 90%; }
.col-thumb.id-trekuin .col-thumb-img img   { width: 110%; height: 110%; }
.col-thumb.id-pinamace .col-thumb-img img  { width: 115%; height: 115%; }
.col-thumb.id-shellgrit .col-thumb-img img { width: 94%; height: 94%; }
.col-thumb.id-fungaze .col-thumb-img img   { width: 120%; height: 120%; }

/* Adult — bigger */
.col-thumb.id-furrmask .col-thumb-img img,
.col-thumb.id-mycelith .col-thumb-img img { width: 85%; height: 85%; }
.col-thumb.id-pinahelm .col-thumb-img img { width: 94%; height: 94%; }
.col-thumb.id-gleamtort .col-thumb-img img { width: 88%; height: 88%; }
.col-thumb.id-voltrax .col-thumb-img img,
.col-thumb.id-thornox .col-thumb-img img,
.col-thumb.id-frostgrump .col-thumb-img img,
.col-thumb.id-infernex .col-thumb-img img,
.col-thumb.id-gravok .col-thumb-img img   { width: 98%; height: 98%; }

/* Adult — much bigger (overflow centered + clipped symmetrically) */
.col-thumb.id-moltorex .col-thumb-img,
.col-thumb.id-monomash .col-thumb-img,
.col-thumb.id-lanceron .col-thumb-img { overflow: visible; position: relative; }
.col-thumb.id-moltorex .col-thumb-img img,
.col-thumb.id-monomash .col-thumb-img img,
.col-thumb.id-lanceron .col-thumb-img img { width: 200%; height: 200%; position: absolute; top: 35%; left: 50%; transform: translate(-50%, -50%); }
.col-thumb.id-megalix .col-thumb-img { overflow: visible; position: relative; }
.col-thumb.id-megalix .col-thumb-img img   { width: 200%; height: 200%; position: absolute; top: 35%; left: 50%; transform: translate(-50%, -50%); }

.col-thumb-empty {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
}

.col-thumb-name {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.col-thumb-rarity {
  font-size: 0.54rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink-faint);
}

/* Rarity-based decoration */
.col-thumb.rarity-uncommon { border-color: rgba(54, 240, 200, 0.15); }
.col-thumb.rarity-uncommon:hover { box-shadow: 0 4px 16px rgba(54, 240, 200, 0.08); }
.col-thumb.rarity-uncommon .col-thumb-rarity { color: var(--slime); }

.col-thumb.rarity-rare { border-color: rgba(74, 158, 255, 0.2); }
.col-thumb.rarity-rare:hover { box-shadow: 0 4px 16px rgba(74, 158, 255, 0.1); border-color: var(--accent); }
.col-thumb.rarity-rare .col-thumb-rarity { color: var(--accent); }
.col-thumb.rarity-rare .col-thumb-name { color: var(--accent); }

.col-thumb.rarity-mythic {
  border-color: rgba(255, 209, 102, 0.25);
  background: linear-gradient(180deg, rgba(255, 209, 102, 0.03), var(--bg-card));
}
.col-thumb.rarity-mythic:hover { box-shadow: 0 4px 20px rgba(255, 209, 102, 0.12); border-color: var(--yellow); }
.col-thumb.rarity-mythic .col-thumb-rarity { color: var(--yellow); }
.col-thumb.rarity-mythic .col-thumb-name { color: var(--yellow); }

.col-thumb.rarity-legendary {
  border-color: rgba(255, 138, 76, 0.25);
  background: linear-gradient(180deg, rgba(255, 138, 76, 0.03), var(--bg-card));
}
.col-thumb.rarity-legendary:hover { box-shadow: 0 4px 20px rgba(255, 138, 76, 0.12); border-color: var(--orange); }
.col-thumb.rarity-legendary .col-thumb-rarity { color: var(--orange); }
.col-thumb.rarity-legendary .col-thumb-name { color: var(--orange); }

/* ─── Codex panel ─── */
.codex-panel {
  position: sticky;
  top: 70px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(18px, 2vw, 24px);
  min-height: 200px;
}

.codex-empty {
  text-align: center;
  padding: 28px 0;
}

.codex-empty-label {
  font-family: "Martian Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  text-transform: uppercase;
}

.codex-empty p {
  margin: 10px 0 0;
  font-size: 0.82rem;
  color: var(--ink-faint);
}

.codex-img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 4px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(17, 25, 41, 0.5), rgba(10, 15, 28, 0.7));
  border: 1px solid var(--border);
  margin-bottom: 14px;
  overflow: hidden;
}

.codex-img img {
  width: 85%;
  height: 85%;
  object-fit: contain;
}

.codex-img.lineage-glitch { border-color: rgba(255, 138, 76, 0.15); }
.codex-img.lineage-espectro { border-color: rgba(54, 240, 200, 0.15); }
.codex-img.lineage-bestia { border-color: rgba(125, 245, 82, 0.15); }

.codex-name {
  font-size: 1.15rem;
  margin-bottom: 10px;
}

.codex-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.codex-tag {
  padding: 2px 8px;
  border: 1px solid var(--border-light);
  border-radius: 2px;
  font-size: 0.66rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.codex-lore {
  margin: 0 0 14px;
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--ink-soft);
  padding-left: 12px;
  border-left: 2px solid var(--border-light);
}

.codex-creator {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid rgba(255, 209, 102, 0.2);
  border-radius: var(--radius);
  background: rgba(255, 209, 102, 0.04);
  margin-bottom: 8px;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.codex-creator strong { color: var(--yellow); }

.codex-creator-badge {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--yellow);
}

.codex-capture {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
}

.codex-capture-label {
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
}

.codex-capture-date {
  font-family: "Martian Mono", monospace;
  font-size: 0.72rem;
  color: var(--ink-soft);
}

/* Active thumb in collection */
.col-thumb.codex-active {
  border-color: var(--accent) !important;
  background: var(--bg-card-hover);
}

/* DEX section (no card wrapper, own section) */
.dex-section {
  padding-top: clamp(20px, 3vw, 32px);
  border-top: 1px solid var(--border);
}

/* ─── Metrics ─── */
.metric-row {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 18px;
}

.metric-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--bg-raised);
}

.metric-label {
  color: var(--ink-faint);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}

.metric-value {
  margin-top: 8px;
  font-size: clamp(1.2rem, 2.3vw, 1.8rem);
  font-family: "Martian Mono", monospace;
  color: var(--ink);
}

.metric-value.slime { color: var(--slime); }

/* ─── Founder badge ─── */
.founder-badge {
  margin-left: 10px;
  padding: 2px 8px;
  border: 1px solid rgba(255, 138, 76, 0.35);
  background: rgba(255, 138, 76, 0.12);
  color: var(--orange);
  border-radius: 2px;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-weight: 600;
}

/* ─── XP bar ─── */
.xp-line { margin-top: 18px; }

.xp-track {
  margin-top: 8px;
  width: 100%;
  height: 8px;
  border-radius: 2px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  overflow: hidden;
}

.xp-fill {
  height: 100%;
  background: linear-gradient(90deg, rgba(54, 240, 200, 0.65), var(--slime));
  box-shadow: 0 0 8px var(--slime-glow);
  transition: width 300ms ease;
  animation: xp-pulse 3s ease-in-out infinite;
}

@keyframes xp-pulse {
  0%, 100% { box-shadow: 0 0 6px var(--slime-glow); }
  50%      { box-shadow: 0 0 14px var(--slime-glow); }
}

.code-pill {
  display: inline-block;
  margin-top: 10px;
  font-family: "Martian Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border: 1px solid var(--border);
  padding: 5px 8px;
  border-radius: 2px;
}

/* ─── Buttons ─── */
.button, .link-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: "Chakra Petch", sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 2px;
  border: 1px solid transparent;
  padding: 13px 22px;
  cursor: pointer;
  transition: transform 100ms ease, box-shadow 100ms ease, background 100ms ease, border-color 100ms ease;
}

.button:hover, .link-chip:hover { transform: translateY(-1px); }
.button:active, .link-chip:active { transform: translateY(0); }

.button.primary, .link-chip.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 700;
}

.button.primary:hover, .link-chip.primary:hover {
  box-shadow: 0 0 28px rgba(74, 158, 255, 0.3);
}

.button.secondary, .link-chip.secondary {
  background: transparent;
  border-color: var(--border-light);
  color: var(--ink-soft);
}

.button.secondary:hover, .link-chip.secondary:hover {
  border-color: var(--ink-faint);
  color: var(--ink);
}

.cluster { display: flex; gap: 10px; flex-wrap: wrap; }

/* ─── Skills / Achievements ─── */
.skill-list, .achievement-list {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.skill-item, .achievement-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--bg-raised);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  position: relative;
  overflow: hidden;
  transition: background 200ms, border-color 200ms;
}

/* Animated left border reveal on hover */
.skill-item::before, .achievement-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 0%;
  background: var(--accent);
  transition: height 300ms ease;
}

.skill-item:hover::before, .achievement-item:hover::before {
  height: 100%;
}

.achievement-item::before { background: var(--slime); }

.skill-item:hover, .achievement-item:hover {
  background: var(--bg-card);
  border-color: var(--border-light);
}

.skill-name, .achievement-name { color: var(--ink); font-size: 0.9rem; }

.skill-tag, .achievement-date {
  color: var(--ink-soft);
  font-family: "Martian Mono", monospace;
  font-size: 0.7rem;
}

.skill-tag.evolved {
  color: var(--slime);
  border: 1px solid rgba(54, 240, 200, 0.25);
  padding: 1px 6px;
  border-radius: 2px;
}

/* ─── DEX grid ─── */
.dex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(154px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.creature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  min-height: 184px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
  transition: border-color 250ms, background 250ms, transform 250ms;
}

/* Animated left accent that reveals on hover */
.creature-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 0%;
  background: var(--accent);
  transition: height 350ms ease;
}

.creature-card:not(.locked):hover::before { height: 100%; }
.creature-card:not(.locked):hover { transform: translateY(-2px); }

.creature-card.lineage-glitch::before { background: var(--orange); }
.creature-card.lineage-espectro::before { background: var(--slime); }
.creature-card.lineage-bestia::before { background: var(--green); }

.creature-card:not(.locked):hover {
  border-color: var(--border-light);
  background: var(--bg-card-hover);
}

.creature-card.locked {
  opacity: 0.35;
  border-style: dashed;
}

/* DEX rarity decoration */
.creature-card.rarity-rare:not(.locked) { border-color: rgba(74, 158, 255, 0.15); }
.creature-card.rarity-rare:not(.locked) .creature-name { color: var(--accent); }
.creature-card.rarity-rare:not(.locked):hover { box-shadow: 0 0 20px rgba(74, 158, 255, 0.08); }

.creature-card.rarity-mythic:not(.locked) {
  border-color: rgba(255, 209, 102, 0.2);
  background: linear-gradient(180deg, rgba(255, 209, 102, 0.02), var(--bg-card));
}
.creature-card.rarity-mythic:not(.locked) .creature-name { color: var(--yellow); }
.creature-card.rarity-mythic:not(.locked):hover { box-shadow: 0 0 24px rgba(255, 209, 102, 0.1); }

.creature-card.rarity-legendary:not(.locked) {
  border-color: rgba(255, 138, 76, 0.2);
  background: linear-gradient(180deg, rgba(255, 138, 76, 0.02), var(--bg-card));
}
.creature-card.rarity-legendary:not(.locked) .creature-name { color: var(--orange); }
.creature-card.rarity-legendary:not(.locked):hover { box-shadow: 0 0 24px rgba(255, 138, 76, 0.1); }

.creature-visual {
  border: 1px solid var(--border);
  border-radius: 4px;
  height: 88px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(17, 25, 41, 0.7), rgba(10, 15, 28, 0.8));
}

.creature-visual img {
  object-fit: contain;
}

/* Stage-based sizing — DEX */
.creature-card.stage-egg .creature-visual img,
.creature-card.stage-child .creature-visual img  { width: 40px; height: 40px; }
.creature-card.stage-young .creature-visual img  { width: 52px; height: 52px; }
.creature-card.stage-adult .creature-visual img  { width: 66px; height: 66px; }
.creature-card.stage-boss .creature-visual img   { width: 78px; height: 78px; }

.silhouette {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--border-light);
  background: radial-gradient(circle, rgba(53, 66, 96, 0.75), rgba(13, 19, 34, 0.8));
}

.creature-name { font-size: 0.95rem; }

.meta-line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ─── Badges ─── */
.badge {
  border: 1px solid var(--border-light);
  border-radius: 2px;
  padding: 2px 6px;
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.badge.mythic {
  color: var(--yellow);
  border-color: rgba(255, 209, 102, 0.3);
  background: rgba(255, 209, 102, 0.06);
}

.badge.legendary {
  color: var(--orange);
  border-color: rgba(255, 138, 76, 0.3);
  background: rgba(255, 138, 76, 0.06);
}

.badge.rare {
  color: var(--accent);
  border-color: rgba(74, 158, 255, 0.25);
}

.badge.uncommon {
  color: var(--slime);
  border-color: rgba(54, 240, 200, 0.2);
}

/* ─── Empty state ─── */
.empty-state {
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius);
  border-left: 3px solid var(--orange);
  padding: clamp(24px, 3vw, 36px);
}

.empty-state p {
  margin: 10px 0 0;
  color: var(--ink-soft);
}

/* ─── Forms ─── */
.search-row {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.form-grid { margin-top: 14px; display: grid; gap: 10px; }

.input {
  width: min(320px, 100%);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--ink);
  padding: 14px 12px;
  font-family: "Chakra Petch", sans-serif;
  font-size: 0.95rem;
  transition: border-color 150ms;
}

.input:focus { outline: none; border-color: var(--accent); }

.input::placeholder { color: var(--ink-faint); }

.textarea {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--ink);
  padding: 14px 12px;
  font-family: "Martian Mono", monospace;
  font-size: 0.72rem;
  line-height: 1.45;
  resize: vertical;
}

.textarea:focus { outline: none; border-color: var(--accent); }

.inline-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ─── Status ─── */
.status-box {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 0.82rem;
  color: var(--ink-soft);
  background: var(--bg-raised);
}

.status-ok {
  border-color: rgba(54, 240, 200, 0.35);
  background: var(--slime-dim);
  color: var(--ink);
}

.status-error {
  border-color: rgba(255, 138, 76, 0.45);
  background: rgba(255, 138, 76, 0.08);
  color: var(--ink);
}

.status-warn {
  border-color: rgba(255, 209, 102, 0.4);
  background: rgba(255, 209, 102, 0.08);
  color: var(--ink);
}

/* ─── Ranking ─── */
.rank-table-wrap { overflow-x: auto; margin-top: 16px; }

.rank-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

.rank-table th, .rank-table td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.rank-table th {
  color: var(--ink-faint);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.rank-table td { color: var(--ink); }
.rank-table tbody tr { transition: background 150ms; }
.rank-table tbody tr:hover { background: var(--bg-card-hover); }

.rank-table td.mono {
  font-family: "Martian Mono", monospace;
  font-size: 0.8rem;
}

.rank-num {
  font-family: "Martian Mono", monospace;
  font-weight: 700;
  color: var(--ink-faint);
}

.rank-num.top-1 { color: var(--yellow); }
.rank-num.top-2 { color: var(--ink-soft); }
.rank-num.top-3 { color: var(--orange); }

.rank-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* ─── Home ─── */
.home-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(20px, 3vw, 36px);
  align-items: start;
  margin-bottom: var(--space-inner);
}

.home-search-col {
  padding: clamp(24px, 3vw, 36px) 0;
}

.home-search {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.home-search .input {
  width: min(280px, 100%);
  font-size: 0.95rem;
  padding: 14px 12px;
}

.home-login-col,
.home-session-col {
  padding: clamp(22px, 3vw, 32px) 0 clamp(22px, 3vw, 32px) clamp(20px, 3vw, 32px);
  border-left: 2px solid var(--border-light);
}

.home-login-col h3 { margin-bottom: 8px; }

.home-login-col > p {
  margin: 0 0 16px;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.5;
}

.home-login-hint {
  margin: 12px 0 0;
  font-size: 0.72rem;
  color: var(--ink-faint);
}

.login-form {
  display: grid;
  gap: 10px;
}

.login-form .input { width: 100%; }

.home-ranking-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 4px;
}

/* Session bar */
.session-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.session-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.session-avatar {
  width: 36px;
  height: 36px;
  border-radius: 2px;
  border: 1px solid rgba(54, 240, 200, 0.28);
  background: var(--slime-dim);
  display: grid;
  place-items: center;
  font-family: "Martian Mono", monospace;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--slime);
}

.session-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}

.session-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  font-weight: 600;
}

/* ─── Dashboard ─── */
.dashboard-info {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.dashboard-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
  font-size: 0.88rem;
}

/* ─── Loading state ─── */
.loading-state {
  text-align: center;
  padding: clamp(48px, 8vw, 80px) 0;
}

.loading-state h2 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  margin-bottom: 10px;
}

.loading-state p {
  color: var(--ink-soft);
  margin: 0;
}

.loading-bar {
  width: 120px;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin: 20px auto 0;
}

.loading-bar-fill {
  width: 60%;
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  animation: loading-slide 1.2s ease-in-out infinite;
}

@keyframes loading-slide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}

/* ─── NanoLabs notification ─── */
.nanolabs-notification {
  position: fixed;
  left: 22px;
  bottom: 22px;
  width: min(420px, calc(100vw - 44px));
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 2px;
  padding: 14px 16px;
  z-index: 50;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 320ms ease, transform 320ms ease;
}

.nanolabs-notification.visible { opacity: 1; transform: translateY(0); }
.tone-corporate { border-left-color: var(--accent); }
.tone-warm { border-left-color: var(--slime); }
.tone-slip { border-left-color: var(--yellow); }
.tone-cold { border-left-color: var(--orange); }

.nanolabs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.nanolabs-sender {
  color: var(--ink-soft);
  font-family: "Martian Mono", monospace;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.nanolabs-close {
  background: transparent;
  border: 0;
  color: var(--ink-faint);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

.nanolabs-close:hover { color: var(--ink); }

.nanolabs-body {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.55;
}

/* ─── Reveal ─── */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 600ms ease, transform 600ms ease;
}

.reveal.visible { opacity: 1; transform: translateY(0); }
.reveal-delay-1 { transition-delay: 120ms; }
.reveal-delay-2 { transition-delay: 240ms; }

/* ─── Footer ─── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px var(--gutter);
  margin-top: 20px;
}

.site-footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--ink-faint);
}

.site-footer-brand {
  font-family: "Martian Mono", monospace;
  letter-spacing: 0.12em;
  font-size: 0.7rem;
}

.site-footer-links { display: flex; gap: 20px; }

.site-footer-links a {
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  padding: 4px 0;
  border-bottom: 1px solid var(--border-light);
  transition: color 150ms, border-color 150ms;
}

.site-footer-links a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ─── Responsive ─── */
@media (max-width: 960px) {
  .grid.two, .grid.three, .metric-row { grid-template-columns: 1fr; }
  .home-top { grid-template-columns: 1fr; }
  .profile-columns { grid-template-columns: 1fr; }
  .profile-col-side { position: static; }
  .collection-layout { grid-template-columns: 1fr; }
  .codex-panel { position: static; }
  .stats-bar { flex-wrap: wrap; }

  .top-nav { flex-wrap: wrap; }
}

@media (max-width: 620px) {
  .top-nav { padding-top: 10px; padding-bottom: 10px; }
  .page-wrap { padding-top: 18px; }
  .nav-links { flex-wrap: wrap; }
}

.profile-nexo-hint {
  margin-top: 48px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--ink-faint);
  text-align: center;
}

.profile-nexo-hint a {
  color: var(--slime);
  text-decoration: none;
}

.profile-nexo-hint a:hover { text-decoration: underline; }
