/* ============================================================
   Agent Taxonomy — Stylesheet
   Design system: Pokédex / App-native / Bakso Sapi
   Color update: primary #F5D458 (warmer gold)
   ============================================================ */

/* === Self-hosted fonts === */
@font-face {
  font-family: 'BaksoSapi';
  src: url('fonts/BaksoSapi.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('fonts/inter-400.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('fonts/inter-500.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('fonts/inter-600.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* === Design Tokens === */
:root {
  --color-primary:    #F5D458;
  --color-primary-dk: #D4B52A;
  --color-ink:        #1A1A1A;
  --color-ink-subtle: #4A4A4A;
  --color-surface:    #FFFFFF;
  --color-ghost:      #F0F0F0;
  --color-overlay:    rgba(26, 26, 26, 0.05);

  /* Type-dot colors (taxonomy levels) */
  --type-domain:   #A8A878;
  --type-kingdom:  #EE99AC;
  --type-phylum:   #6890F0;
  --type-class:    #F08030;
  --type-order:    #C8A800;
  --type-family:   #F85888;
  --type-genus:    #7038F8;
  --type-species:  #706840;

  /* Rarity colors */
  --rarity-common:    #A8A878;
  --rarity-uncommon:  #78C850;
  --rarity-rare:      #6890F0;
  --rarity-legendary: #E8B800;

  /* Layout */
  --app-max:    500px;
  --side-pad:   24px;
  --radius-pill: 999px;
  --radius-lg:   32px;
  --radius-md:   20px;
  --radius-sm:   12px;

  /* Typography */
  --font-display: 'BaksoSapi', 'Bungee', 'Fredoka One', cursive;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono:    "SF Mono", "Fira Code", Menlo, "Courier New", monospace;

  /* Motion */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out:    cubic-bezier(0.0, 0.0, 0.2, 1);
  --ease-std:    0.2s ease;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background-color: var(--color-primary);
  color: var(--color-ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100dvh;
  background-image: none;
}

img  { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
a { color: inherit; text-decoration: none; }

/* === Utility === */
.hidden { display: none !important; }

/* === Animations === */
@keyframes reveal-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes dot-pop {
  0%   { transform: scale(0.5); opacity: 0; }
  70%  { transform: scale(1.2); }
  100% { transform: scale(1.0); opacity: 1; }
}

@keyframes legendary-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(232, 184, 0, 0.3); }
  50%       { box-shadow: 0 0 0 8px rgba(232, 184, 0, 0.6); }
}

.fade-in {
  animation: reveal-up 0.3s var(--ease-out) both;
}

/* ============================================================
   APP SHELL
   ============================================================ */

/* Outer wrapper — centers the 500px column */
body > header,
body > main,
body > footer {
  max-width: var(--app-max);
  margin: 0 auto;
  width: 100%;
}

main {
  padding-bottom: 40px;
  padding-bottom: max(40px, env(safe-area-inset-bottom));
}

/* ============================================================
   HEADER (App nav bar)
   ============================================================ */

header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 var(--side-pad);
  padding-top: max(12px, env(safe-area-inset-top));
  background: var(--color-primary);
  background-image: none;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0 12px;
  border-bottom: 1.5px solid rgba(26, 26, 26, 0.12);
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--color-ink);
}

.logo-emoji { font-size: 22px; line-height: 1; }
.logo-img { width: 32px; height: 32px; border-radius: 6px; }

.logo-text {
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 0.5px;
  color: var(--color-ink);
}

.logo-badge {
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 600;
  color: var(--color-ink-subtle);
  letter-spacing: 0.5px;
  background: rgba(26, 26, 26, 0.08);
  border-radius: var(--radius-pill);
  padding: 2px 8px;
  text-transform: uppercase;
}

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

.nav-link {
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-ink);
  border-radius: var(--radius-pill);
  transition: all var(--ease-std);
  text-decoration: none;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(26,26,26,0.08);
}

.github-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-ink);
  border-radius: var(--radius-pill);
  box-shadow: 0 2px 8px rgba(26,26,26,0.25);
  transition: all var(--ease-std);
  text-decoration: none;
}

.github-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(26,26,26,0.35);
}

/* ============================================================
   HERO
   ============================================================ */

.hero {
  text-align: center;
  padding: 48px var(--side-pad) 32px;
}

.hero-emoji {
  font-size: 64px;
  margin-bottom: 20px;
  line-height: 1;
  display: block;
  animation: float-anim 4s ease-in-out infinite;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(36px, 10vw, 52px);
  letter-spacing: 1px;
  line-height: 1.0;
  color: var(--color-ink);
  margin-bottom: 16px;
}

.hero-subtitle {
  font-size: 16px;
  color: var(--color-ink-subtle);
  line-height: 1.6;
  max-width: 80%;
  margin: 0 auto 24px;
}

.hero-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-meta > span {
  font-family: var(--font-display);
  border-radius: var(--radius-pill);
  padding: 10px 22px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--color-ink);
  background: rgba(255,255,255,0.45);
  border: 2px solid rgba(26,26,26,0.15);
  backdrop-filter: blur(4px);
}



.hero-meta-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(26,26,26,0.25);
  display: none; /* replaced by gap */
}

/* ============================================================
   QUESTIONNAIRE
   ============================================================ */

#questionnaire {
  padding: 0 var(--side-pad) 60px;
}

/* --- Step nav bar (inside questionnaire) --- */

.q-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  padding-top: 4px;
}

.q-nav-back {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(26,26,26,0.06);
  border: 1.5px solid rgba(26,26,26,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--color-ink);
  cursor: pointer;
  transition: all var(--ease-std);
  flex-shrink: 0;
}

.q-nav-back:hover {
  background: rgba(26,26,26,0.12);
  transform: scale(1.08);
}

.q-nav-title {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 1px;
  color: var(--color-ink);
  text-align: center;
  flex: 1;
}

.q-nav-ring {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2.5px solid rgba(26,26,26,0.08);
  border-top-color: var(--color-ink);
  border-right-color: var(--color-ink);
  animation: spin 1.2s linear infinite;
  flex-shrink: 0;
}

/* --- Step content --- */

.q-content {
  animation: reveal-up 0.3s var(--ease-out) both;
}

.q-level-tag {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--color-ink);
  background: rgba(26,26,26,0.08);
  border: 1.5px solid rgba(26,26,26,0.12);
  border-radius: var(--radius-pill);
  padding: 5px 14px;
  margin-bottom: 14px;
}

.step-title {
  font-family: var(--font-display);
  font-size: clamp(24px, 7vw, 34px);
  letter-spacing: 0.5px;
  line-height: 1.1;
  color: var(--color-ink);
  margin-bottom: 28px;
}

/* --- Option pills (full-width stacked) --- */

.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  background: transparent;
  border-radius: var(--radius-pill);
  border: 2.5px solid var(--color-ink);
  cursor: pointer;
  text-align: left;
  transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  box-shadow: none;
  outline: none;
  width: 100%;
  position: relative;
  overflow: hidden;
}

.option-card:hover {
  background: var(--color-ink);
  transform: scale(1.02);
  box-shadow: 0 0 24px rgba(26, 26, 26, 0.2);
}

.option-card:hover .option-label,
.option-card:hover .option-desc {
  color: var(--color-primary);
}

.option-card:hover .option-emoji {
  filter: none;
}

.option-card:hover .option-arrow {
  opacity: 1;
  transform: translateX(0);
}

.option-card:focus-visible {
  outline: 2px solid var(--color-ink);
  outline-offset: 3px;
}

.option-card.selected {
  background: var(--color-ink);
  border-color: var(--color-ink);
  box-shadow: 0 4px 20px rgba(26, 26, 26, 0.25);
}

.option-card.selected .option-label,
.option-card.selected .option-desc {
  color: var(--color-primary);
}

.option-card.selected .option-check {
  opacity: 1;
  transform: scale(1);
}

.option-card.selected .option-arrow {
  display: none;
}

.option-emoji {
  font-size: 24px;
  line-height: 1;
  flex-shrink: 0;
  width: 32px;
  text-align: center;
}

.option-text {
  flex: 1;
  min-width: 0;
}

.option-label {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 700;
  color: var(--color-ink);
  display: block;
  line-height: 1.3;
  letter-spacing: 0.3px;
  transition: color 0.3s ease;
}

.option-desc {
  font-size: 12px;
  color: var(--color-ink-subtle);
  line-height: 1.4;
  display: block;
  margin-top: 2px;
  transition: color 0.3s ease;
}

.option-arrow {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-primary);
  opacity: 0;
  transform: translateX(-10px);
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.option-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--color-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  opacity: 0;
  transform: scale(0.6);
  transition: all 0.2s var(--ease-spring);
}

/* --- Name Step --- */

.name-step {
  animation: reveal-up 0.3s var(--ease-out) both;
}

.field-group { margin-bottom: 20px; }

.field-label {
  display: block;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-ink);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.field-label-optional {
  font-weight: 400;
  color: var(--color-ink-subtle);
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
  margin-left: 4px;
}

.field-input {
  width: 100%;
  padding: 14px 18px;
  font-size: 16px;
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--color-ink);
  background: var(--color-surface);
  border: 2px solid transparent;
  border-radius: var(--radius-pill);
  outline: none;
  transition: all var(--ease-std);
  box-shadow: 0 2px 8px rgba(26,26,26,0.10);
}

.field-input:focus {
  border-color: var(--color-ink);
  box-shadow: 0 4px 14px rgba(26,26,26,0.15);
}

.field-input.error {
  border-color: #EF4444;
}

.field-hint {
  font-size: 12px;
  color: var(--color-ink-subtle);
  margin-top: 8px;
  line-height: 1.4;
  padding: 0 6px;
}

/* --- Step nav (back + classify) --- */

.step-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
  justify-content: center;
}

.btn-back {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.55);
  border: 1.5px solid rgba(26,26,26,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--color-ink);
  cursor: pointer;
  transition: all var(--ease-std);
  flex-shrink: 0;
}

.btn-back:hover {
  background: rgba(255,255,255,0.85);
  transform: scale(1.08);
}

/* Primary action pill (black) */
.btn-classify {
  flex: 1;
  max-width: 320px;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-ink);
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  transition: all 0.2s var(--ease-spring);
  box-shadow: 0 8px 20px rgba(26, 26, 26, 0.25);
  letter-spacing: 0.2px;
}

.btn-classify:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(26, 26, 26, 0.30);
}

.btn-classify:active {
  transform: scale(0.96);
  box-shadow: 0 4px 12px rgba(26, 26, 26, 0.20);
}

.btn-classify:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 4px 10px rgba(26, 26, 26, 0.10);
}

/* ============================================================
   SPECIES RESULT — Open hero layout (no card frame)
   ============================================================ */

#species-result {
  padding: 0 var(--side-pad) 60px;
}

.species-view {
  animation: reveal-up 0.4s var(--ease-out) both;
}

/* Back nav at top */
.species-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-top: 4px;
}

/* --- Portrait zone --- */

.portrait-zone {
  width: 100%;
  margin: 0 0 24px;
  border-radius: var(--radius-lg);
  border: 2px solid rgba(26,26,26,0.1);
  background: rgba(255,255,255,0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
}

.portrait-genus-img {
  width: 100%;
  max-width: 400px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  display: block;
}

.portrait-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(255,255,255,0.2) 0%,
    transparent 60%
  );
  pointer-events: none;
}

.portrait-art-emoji {
  font-size: 48px;
  line-height: 1;
}

.portrait-hint {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-ink-subtle);
  text-align: center;
  padding: 0 16px;
}

.portrait-example-note {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--color-ink-subtle);
  text-align: center;
  padding: 8px 16px 0;
  margin: 0;
}

.portrait-prompt-text {
  display: none;
}

.portrait-copy-btn {
  width: calc(100% - 32px);
  margin: 0 16px 16px;
  padding: 10px 16px;
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.5px;
  color: var(--color-ink);
  background: rgba(26,26,26,0.08);
  border-radius: var(--radius-pill);
  border: 1.5px solid rgba(26,26,26,0.12);
  cursor: pointer;
  transition: all var(--ease-std);
  position: relative;
}

.portrait-copy-btn:hover {
  background: rgba(26,26,26,0.14);
}

.portrait-copy-btn.copied {
  background: #D4EDDA;
  border-color: #78C850;
  color: #2E7D32;
}

/* --- Prompt dialog --- */

.prompt-dialog {
  border: none;
  border-radius: 16px;
  padding: 0;
  max-width: 560px;
  width: 90vw;
  box-shadow: 0 24px 80px rgba(0,0,0,0.25);
  background: var(--color-surface);
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
}

.prompt-dialog::backdrop {
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
}

.prompt-dialog-inner {
  padding: 24px;
}

.prompt-dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.prompt-dialog-header h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--color-ink);
}

.prompt-dialog-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--color-muted);
  padding: 4px 8px;
  border-radius: 8px;
  transition: background 0.15s;
}

.prompt-dialog-close:hover {
  background: rgba(0,0,0,0.06);
}

.prompt-dialog-text {
  font-size: 14px;
  line-height: 1.7;
  color: var(--color-ink);
  background: rgba(26,26,26,0.04);
  border: 1px solid rgba(26,26,26,0.1);
  border-radius: 10px;
  padding: 16px;
  margin: 0 0 16px 0;
  word-break: break-word;
  white-space: pre-wrap;
}

.prompt-dialog .portrait-copy-btn {
  width: 100%;
}

/* --- Rarity/Stage pills row --- */

.type-pills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  align-items: center;
}

/* Type pill: consistent pill design system */
.type-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  background: rgba(26,26,26,0.08);
  border: 1.5px solid rgba(26,26,26,0.12);
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-ink);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
}

.type-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.type-dot--domain   { background: var(--type-domain); }
.type-dot--kingdom  { background: var(--type-kingdom); }
.type-dot--phylum   { background: var(--type-phylum); }
.type-dot--class    { background: var(--type-class); }
.type-dot--order    { background: var(--type-order); }
.type-dot--family   { background: var(--type-family); }
.type-dot--genus    { background: var(--type-genus); }
.type-dot--species  { background: var(--type-species); }

.type-dot--common     { background: var(--rarity-common); }
.type-dot--uncommon   { background: var(--rarity-uncommon); }
.type-dot--rare       { background: var(--rarity-rare); }
.type-dot--legendary  { background: var(--rarity-legendary); }

/* Legendary rarity pill gets animated outline */
.type-pill.legendary-pill {
  animation: legendary-pulse 2s ease-in-out infinite;
}

/* --- Binomial name --- */

.species-binomial {
  font-family: var(--font-display);
  font-size: clamp(32px, 10vw, 48px);
  letter-spacing: 1px;
  line-height: 1.0;
  color: var(--color-ink);
  margin-bottom: 10px;
  animation: reveal-up 0.4s 0.1s var(--ease-out) both;
}

.species-subtitle {
  font-size: 16px;
  font-weight: 500;
  color: var(--color-ink-subtle);
  margin-bottom: 8px;
  animation: reveal-up 0.4s 0.15s var(--ease-out) both;
}

.species-agent-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-ink);
  margin-bottom: 16px;
  animation: reveal-up 0.4s 0.2s var(--ease-out) both;
}

.species-desc {
  font-size: 15px;
  color: var(--color-ink-subtle);
  line-height: 1.65;
  margin-bottom: 24px;
  animation: reveal-up 0.4s 0.2s var(--ease-out) both;
}

/* --- Taxonomy pills section --- */

.taxonomy-pills-section {
  margin-bottom: 24px;
  animation: reveal-up 0.4s 0.25s var(--ease-out) both;
}

.section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--color-ink-subtle);
  margin-bottom: 10px;
  display: block;
  padding: 0 2px;
}

.taxonomy-pills-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* --- Stats container (frosted glass) --- */

.stats-container {
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 4px 16px rgba(26,26,26,0.08);
  animation: reveal-up 0.4s 0.3s var(--ease-out) both;
}

.stats-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* --- Dot-track stat row --- */

.stat-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--color-ink-subtle);
  min-width: 72px;
  flex-shrink: 0;
}

.dot-track {
  display: flex;
  gap: 5px;
  align-items: center;
  flex: 1;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-ghost);
  flex-shrink: 0;
  transition: background 0.2s ease;
}

.dot.filled {
  background: var(--color-ink);
}

/* Staggered dot-fill animation */
.dot.filled:nth-child(1) { animation: dot-pop 0.3s 0.05s var(--ease-spring) both; }
.dot.filled:nth-child(2) { animation: dot-pop 0.3s 0.10s var(--ease-spring) both; }
.dot.filled:nth-child(3) { animation: dot-pop 0.3s 0.15s var(--ease-spring) both; }
.dot.filled:nth-child(4) { animation: dot-pop 0.3s 0.20s var(--ease-spring) both; }
.dot.filled:nth-child(5) { animation: dot-pop 0.3s 0.25s var(--ease-spring) both; }
.dot.filled:nth-child(6) { animation: dot-pop 0.3s 0.30s var(--ease-spring) both; }
.dot.filled:nth-child(7) { animation: dot-pop 0.3s 0.35s var(--ease-spring) both; }
.dot.filled:nth-child(8) { animation: dot-pop 0.3s 0.40s var(--ease-spring) both; }

.stat-value-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-ink-subtle);
  min-width: 24px;
  text-align: right;
  flex-shrink: 0;
}

/* Evolution stage section inside stats */
.evo-section {
  padding-top: 14px;
  border-top: 1.5px solid rgba(26,26,26,0.08);
  margin-top: 4px;
}

/* --- Card actions --- */

.card-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: reveal-up 0.4s 0.35s var(--ease-out) both;
}

/* Primary black pill */
.btn-pill-black {
  width: 100%;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 0.5px;
  color: var(--color-primary);
  background: var(--color-ink);
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  transition: all 0.2s var(--ease-spring);
  box-shadow: 0 8px 20px rgba(26, 26, 26, 0.25);
}

.btn-pill-black:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(26, 26, 26, 0.30);
}

.btn-pill-black:active {
  transform: scale(0.96);
}

/* Secondary ghost pill */
.btn-pill-ghost {
  width: 100%;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.5px;
  color: var(--color-ink);
  background: rgba(26,26,26,0.08);
  border-radius: var(--radius-pill);
  border: 1.5px solid rgba(26,26,26,0.12);
  cursor: pointer;
  transition: all var(--ease-std);
}

.btn-pill-ghost:hover {
  background: rgba(255,255,255,0.8);
  transform: translateY(-1px);
}

.btn-pill-ghost:active {
  transform: scale(0.97);
}

/* Inline row of secondary buttons */
.card-actions-row {
  display: flex;
  gap: 8px;
}

.card-actions-row .btn-pill-ghost {
  flex: 1;
}

/* ============================================================
   GALLERY
   ============================================================ */

#gallery {
  padding: 0 0 60px;
}

.section-divider {
  border: none;
  border-top: 1.5px solid rgba(26,26,26,0.1);
  margin: 0 var(--side-pad) 28px;
}

.section-header {
  text-align: center;
  margin-bottom: 20px;
  padding: 0 var(--side-pad);
}

.section-title {
  font-family: var(--font-display);
  font-size: 26px;
  letter-spacing: 0.5px;
  color: var(--color-ink);
  margin-bottom: 6px;
}

.section-subtitle {
  font-size: 14px;
  color: var(--color-ink-subtle);
}

/* Single-card carousel */
.gallery-grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px var(--side-pad) 20px;
}

.carousel-card-wrap {
  width: 100%;
  animation: reveal-up 0.25s var(--ease-out) both;
}

/* --- Card --- */

.gallery-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  width: 100%;
  box-shadow: 0 4px 16px rgba(26,26,26,0.12);
  overflow: hidden;
  transition: box-shadow 0.25s ease;
}

.gallery-card:hover {
  box-shadow: 0 8px 24px rgba(26,26,26,0.16);
}

/* Carousel navigation */
.carousel-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
}

.carousel-dots {
  display: flex;
  gap: 8px;
  align-items: center;
}

.carousel-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--color-ink);
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s ease;
}

.carousel-dot.active {
  background: var(--color-ink);
  transform: scale(1.2);
}

.carousel-dot:hover:not(.active) {
  background: rgba(26,26,26,0.3);
}

.carousel-arrow {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--color-ink);
  background: transparent;
  color: var(--color-ink);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
}

.carousel-arrow:hover:not(:disabled) {
  background: var(--color-ink);
  color: var(--color-primary);
}

.carousel-arrow:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Rarity accent: left border stripe */
.gallery-card.rarity--common   { border-left: 4px solid var(--rarity-common); }
.gallery-card.rarity--uncommon { border-left: 4px solid var(--rarity-uncommon); }
.gallery-card.rarity--rare     { border-left: 4px solid var(--rarity-rare); }
.gallery-card.rarity--legendary {
  border-left: 4px solid var(--rarity-legendary);
  animation: legendary-pulse 2s ease-in-out infinite;
}
.gallery-card.rarity--legendary:hover { animation: none; }

.gallery-card__portrait {
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--color-ink);
  position: relative;
}

.gallery-card__portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.gallery-card:hover .gallery-card__portrait img {
  transform: scale(1.05);
}

.gallery-card__portrait-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 32px 16px 14px;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  pointer-events: none;
}

.gallery-card__portrait-name {
  font-family: var(--font-display);
  font-size: 24px;
  color: #fff;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.7), 0 0 16px rgba(0,0,0,0.5);
}

.gallery-card__head-body {
  padding: 14px 16px 12px;
}

.gallery-card__binomial {
  font-family: var(--font-mono);
  font-size: 15px;
  font-style: italic;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-ink);
  line-height: 1.25;
  margin-bottom: 10px;
}

.gallery-card__meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Gallery type pills */
.gallery-card .type-pill {
  font-size: 12px;
  padding: 5px 12px;
}

/* Expand toggle */
.gallery-toggle-btn {
  width: 100%;
  padding: 9px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-ink-subtle);
  background: rgba(26,26,26,0.04);
  border: none;
  border-top: 1.5px solid rgba(26,26,26,0.06);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  transition: all var(--ease-std);
}

.gallery-toggle-btn:hover {
  background: rgba(26,26,26,0.08);
  color: var(--color-ink);
}

.toggle-arrow {
  display: inline-block;
  transition: transform 0.2s ease;
  font-style: normal;
}

.gallery-toggle-btn[aria-expanded="true"] .toggle-arrow {
  transform: rotate(180deg);
}

.gallery-card__detail {
  border-top: 1.5px solid rgba(26,26,26,0.06);
  padding: 12px 14px;
  background: rgba(26,26,26,0.02);
}

.gallery-taxonomy {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.gallery-taxonomy li {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 11px;
}

.gallery-taxon-rank {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--color-ink-subtle);
  min-width: 56px;
  flex-shrink: 0;
}

.gallery-taxon-value {
  font-size: 11px;
  color: var(--color-ink);
  font-weight: 500;
}

.gallery-prompt-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(26,26,26,0.08);
}

.gallery-prompt-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-ink-subtle);
  margin: 0 0 8px 0;
}

.gallery-prompt-text {
  font-size: 13px;
  line-height: 1.7;
  color: var(--color-ink);
  background: rgba(26,26,26,0.04);
  border: 1px solid rgba(26,26,26,0.1);
  border-radius: 10px;
  padding: 12px;
  margin: 0 0 12px 0;
  word-break: break-word;
  white-space: pre-wrap;
}

.gallery-copy-btn {
  font-size: 13px !important;
  padding: 8px 16px !important;
}

/* ============================================================
   ABOUT PAGE
   ============================================================ */

/* ============================================================
   ABOUT PAGE — Notion-style clean typography
   ============================================================ */

.about-page.notion-style {
  padding: 40px var(--side-pad) 48px;
  max-width: 720px;
  margin: 0 auto;
}

.about-page.notion-style h1 {
  font-family: var(--font-display);
  font-size: clamp(32px, 8vw, 44px);
  letter-spacing: 0.5px;
  color: var(--color-ink);
  margin-bottom: 12px;
}

.about-page.notion-style .lead {
  font-size: 17px;
  color: var(--color-ink-subtle);
  line-height: 1.65;
  margin-bottom: 0;
}

.about-page.notion-style hr {
  border: none;
  border-top: 1.5px solid rgba(26,26,26,0.08);
  margin: 32px 0;
}

.about-page.notion-style h2 {
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: 0.3px;
  color: var(--color-ink);
  margin-bottom: 12px;
}

.about-page.notion-style h3 {
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 0.2px;
  color: var(--color-ink-subtle);
  text-transform: uppercase;
  margin: 24px 0 10px;
}

.about-page.notion-style p {
  font-size: 15px;
  color: var(--color-ink-subtle);
  line-height: 1.75;
  margin-bottom: 14px;
}

.about-page.notion-style p strong {
  color: var(--color-ink);
  font-weight: 600;
}

/* Rank flow — numbered vertical list */
.rank-flow {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 20px 0;
  border-left: 3px solid var(--color-ink);
  padding-left: 0;
}

.rank-flow-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 16px;
  font-size: 15px;
  color: var(--color-ink);
  border-bottom: 1px solid rgba(26,26,26,0.05);
}

.rank-flow-item:last-child { border-bottom: none; }

.rank-flow-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-ink);
  color: var(--color-gold);
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.dim { color: var(--color-ink-subtle); }

/* Callout */
.callout {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: rgba(255,255,255,0.5);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(26,26,26,0.08);
  margin: 20px 0;
}

.callout-icon {
  font-size: 20px;
  flex-shrink: 0;
  line-height: 1.5;
}

.callout-body {
  font-size: 14px;
  color: var(--color-ink-subtle);
  line-height: 1.65;
}

.callout-body strong {
  color: var(--color-ink);
}

/* Notion-style table */
.notion-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 13px;
}

.notion-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--color-ink-subtle);
  padding: 8px 12px;
  border-bottom: 2px solid rgba(26,26,26,0.12);
}

.notion-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(26,26,26,0.06);
  color: var(--color-ink);
  line-height: 1.5;
  vertical-align: top;
}

.notion-table td:last-child {
  color: var(--color-ink-subtle);
  font-size: 12px;
  font-style: italic;
}

/* Compare cards (ChatGPT vs OpenClaw) */
.compare-row {
  display: flex;
  align-items: stretch;
  gap: 12px;
  margin: 20px 0;
}

.compare-card {
  flex: 1;
  background: rgba(255,255,255,0.55);
  border-radius: var(--radius-sm);
  padding: 16px;
  border: 1.5px solid rgba(26,26,26,0.08);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.compare-vs {
  display: flex;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-ink-subtle);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.compare-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-ink-subtle);
  margin-bottom: 6px;
}

.compare-binomial {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--color-ink);
  margin-bottom: 6px;
}

.compare-traits {
  font-size: 11px;
  color: var(--color-ink-subtle);
  line-height: 1.4;
  margin-bottom: 10px;
}

.compare-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  margin-top: auto;
}

.compare-pill--common {
  background: #A8A878;
  color: #000;
}

.compare-pill--legendary {
  background: #E8B800;
  color: #000;
}

/* Rarity bar */
.rarity-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 16px 0;
}

.rarity-seg {
  text-align: center;
  padding: 12px 8px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rarity-seg span { font-size: 13px; font-weight: 600; }
.rarity-seg small { font-size: 10px; opacity: 0.75; }

.rarity-seg--common     { background: #A8A878; color: #000; }
.rarity-seg--uncommon   { background: #78C850; color: #000; }
.rarity-seg--rare       { background: #6890F0; color: #fff; }
.rarity-seg--legendary  { background: #E8B800; color: #000; }

/* Evolution bar */
.evo-bar {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  margin: 16px 0;
  padding: 16px 12px;
  background: rgba(255,255,255,0.4);
  border-radius: var(--radius-md);
  border: 1.5px solid rgba(26,26,26,0.08);
}

.evo-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-ink);
  flex: 1;
}

.evo-step span { font-size: 24px; }

/* CTA at bottom of about */
.about-cta {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

@media (max-width: 500px) {
  .compare-row { flex-direction: column; }
  .compare-vs { justify-content: center; }
  .rarity-bar { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   FOOTER
   ============================================================ */

footer {
  padding: 24px var(--side-pad);
  text-align: center;
  border-top: 1.5px solid rgba(26,26,26,0.08);
  background: rgba(255,255,255,0.15);
}

.footer-links {
  font-size: 14px;
  color: var(--color-ink);
  margin-bottom: 8px;
}

.footer-links a {
  color: var(--color-ink);
  font-weight: 600;
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
}

.footer-sep {
  margin: 0 6px;
  opacity: 0.5;
}

.footer-credit {
  font-size: 13px;
  color: var(--color-ink-subtle);
}

.footer-credit a {
  color: var(--color-ink);
  font-weight: 600;
  text-decoration: none;
}

.footer-credit a:hover {
  text-decoration: underline;
}

/* ============================================================
   TOAST
   ============================================================ */

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--color-ink);
  color: var(--color-primary);
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  z-index: 999;
  pointer-events: none;
  white-space: nowrap;
  transition: transform 0.3s var(--ease-spring);
  box-shadow: 0 8px 24px rgba(26,26,26,0.25);
  letter-spacing: 0.2px;
}

.toast.visible {
  transform: translateX(-50%) translateY(0);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 540px) {
  :root { --side-pad: 18px; }

  .hero { padding: 36px var(--side-pad) 24px; }
  .hero-title { font-size: clamp(30px, 10vw, 42px); }

  .gallery-card {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .github-btn span { display: none; }
  .github-btn { padding: 7px 10px; }
  .nav-link { padding: 7px 10px; font-size: 12px; }
  .hero-meta { flex-direction: column; gap: 8px; }
  .hero-meta > span { font-size: 14px; padding: 8px 18px; }
}

@media (max-width: 380px) {
  :root { --side-pad: 14px; }
  .logo-badge { display: none; }
  .logo-text { font-size: 17px; }

  .gallery-card {
    width: 100%;
  }
}

/* Wide screens: cap and center */
@media (min-width: 540px) {
  header, main, footer {
    border-left: 1px solid rgba(26,26,26,0.07);
    border-right: 1px solid rgba(26,26,26,0.07);
  }

  body {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  body > * {
    width: 100%;
  }
}

.loading-text {
  text-align: center;
  color: var(--color-ink-subtle);
  padding: 40px 0;
  font-size: 14px;
  font-family: var(--font-body);
}
