/* ─────────────────────────────────────────────────────
   POKE — Modern kawaii dashboard
   Palette: kawaii red/yellow/black + electric accents
   Layout: sidebar nav + main canvas
   ───────────────────────────────────────────────────── */

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

:root {
  /* Core palette — bright, electric, kawaii */
  --bg: #0a0a14;
  --bg-soft: #16162a;
  --bg-card: #1c1c36;
  --bg-elevated: #232347;
  --border: rgba(255,221,0,0.15);
  --border-strong: rgba(255,221,0,0.4);

  --text: #ffffff;
  --text-soft: #b8b8d0;
  --text-dim: #6e6e8e;

  /* Brand colors — Pikachu-vibe but legally distinct */
  --primary: #ffdd00;     /* electric yellow */
  --primary-glow: #ffeb33;
  --secondary: #ff3366;   /* hot pink/red */
  --accent: #00d4ff;      /* electric blue */

  /* Element colors for creatures */
  --el-fire: #ff5733;
  --el-water: #3399ff;
  --el-grass: #66cc66;
  --el-electric: #ffdd00;
  --el-ice: #99ddff;
  --el-dark: #6633cc;
  --el-rock: #aa6633;
  --el-air: #ccddee;
  --el-bug: #cc66ff;
  --el-cosmic: #9966ff;

  /* Status colors */
  --success: #00ff88;
  --warning: #ffaa00;
  --danger: #ff4466;

  /* Spacing scale */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;

  /* Typography — arcade/retro game vibe */
  --font-sans: 'Press Start 2P', 'Silkscreen', system-ui, sans-serif;
  --font-display: 'Bungee', 'Press Start 2P', system-ui, sans-serif;
  --font-body: 'Rubik', 'Inter', -apple-system, system-ui, sans-serif;
  --font-mono: 'VT323', 'JetBrains Mono', ui-monospace, monospace;

  /* Effects */
  --radius: 16px;
  --radius-sm: 8px;
  --radius-lg: 24px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 16px 48px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 24px rgba(255,221,0,0.4);

  --sidebar-width: 240px;
  --sidebar-width-collapsed: 72px;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  width: 100vw;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Animated gradient background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(255,51,102,0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255,221,0,0.08) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(0,212,255,0.05) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
  animation: gradient-shift 20s ease-in-out infinite alternate;
}
@keyframes gradient-shift {
  0% { transform: translate(0,0) scale(1); }
  100% { transform: translate(2%,-2%) scale(1.1); }
}

a { color: var(--primary); text-decoration: none; transition: color 150ms ease; }
a:hover { color: var(--primary-glow); }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* ─── LAYOUT ──────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ─── SIDEBAR ─────────────────────────────────────── */
.sidebar {
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  padding: var(--s-5) var(--s-4);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 0 var(--s-3) var(--s-5) var(--s-3);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--s-5);
}
.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-image: url('/capsule/closed.png');
  background-size: cover;
  background-position: center;
  background-color: var(--bg-elevated);
  box-shadow: var(--shadow-glow);
  animation: pulse 3s ease-in-out infinite;
  flex-shrink: 0;
}
.brand-logo-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 20px;
  color: var(--bg);
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 16px rgba(255,221,0,0.4); }
  50% { box-shadow: 0 0 32px rgba(255,221,0,0.7); }
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 1.5px;
}
.brand-tagline {
  font-size: 9px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-family: var(--font-sans);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: all 150ms ease;
  position: relative;
}
.nav-link:hover {
  background: var(--bg-card);
  color: var(--text);
}
.nav-link.active {
  background: linear-gradient(90deg, rgba(255,221,0,0.15) 0%, transparent 100%);
  color: var(--primary);
  font-weight: 600;
}
.nav-link.active::before {
  content: '';
  position: absolute;
  left: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 60%;
  background: var(--primary);
  border-radius: 0 4px 4px 0;
  box-shadow: 0 0 8px var(--primary);
}
.nav-link svg, .nav-link .icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding-top: var(--s-5);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.sidebar-footer a {
  font-size: 11px;
  color: var(--text-dim);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--radius-sm);
  transition: all 150ms ease;
}
.sidebar-footer a:hover { color: var(--text); background: var(--bg-card); }

/* ─── MAIN CANVAS ─────────────────────────────────── */
.canvas {
  padding: var(--s-6) var(--s-7);
  max-width: 100%;
  width: 100%;
}

.page-head {
  margin-bottom: var(--s-6);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: var(--s-4);
}
.page-title {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 800;
  letter-spacing: 0px;
  background: linear-gradient(135deg, var(--text) 0%, var(--primary) 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: var(--s-2);
  text-transform: uppercase;
}
.page-subtitle {
  color: var(--text-soft);
  font-size: 14px;
}

/* ─── BUTTONS ─────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-5);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 1px;
  transition: all 200ms ease;
  cursor: pointer;
  white-space: nowrap;
  border: 1px solid transparent;
  text-transform: uppercase;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: var(--bg);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}
.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  background: var(--bg-elevated);
  border-color: var(--primary);
}
.btn-ghost {
  background: transparent;
  color: var(--text-soft);
}
.btn-ghost:hover { color: var(--text); background: var(--bg-card); }

/* ─── CARDS ───────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--s-5);
  transition: all 200ms ease;
}
.card-hover:hover {
  border-color: var(--border-strong);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

/* ─── STATS GRID ──────────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--s-4);
  margin-bottom: var(--s-6);
}
.stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--s-5);
  position: relative;
  overflow: hidden;
}
.stat::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 0%, var(--primary) 100%);
  opacity: 0;
  transition: opacity 200ms ease;
}
.stat:hover::before { opacity: 0.05; }
.stat-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: var(--s-2);
}
.stat-value {
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.stat-delta {
  font-size: 12px;
  margin-top: var(--s-2);
  color: var(--text-soft);
}
.stat-delta.up { color: var(--success); }

/* ─── CAPSULE / CREATURE CARDS ────────────────────── */
.creature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--s-4);
}
.creature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--s-4);
  transition: all 200ms ease;
  position: relative;
  overflow: hidden;
}
.creature-card.creature {
  border-color: var(--primary);
  box-shadow: 0 0 16px rgba(255,221,0,0.2);
}
.creature-card.capsule {
  border-color: var(--accent);
}
.creature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}
.creature-img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--s-3);
  position: relative;
  overflow: hidden;
}
.creature-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: -webkit-optimize-contrast;
}
.creature-id {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  margin-bottom: var(--s-1);
}
.creature-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  margin-bottom: var(--s-2);
}
.creature-meta {
  font-size: 11px;
  color: var(--text-soft);
  display: flex;
  justify-content: space-between;
}

/* Capsule animation */
.capsule-icon {
  width: 100%;
  aspect-ratio: 1;
  background: linear-gradient(135deg, #ff3366 0%, #cc1144 50%, #ffffff 50%, #f0f0f0 100%);
  border-radius: 50%;
  border: 4px solid var(--bg);
  position: relative;
  box-shadow:
    inset 0 -8px 16px rgba(0,0,0,0.3),
    inset 0 8px 16px rgba(255,255,255,0.2),
    0 8px 24px rgba(255,51,102,0.4);
  animation: capsule-bob 2s ease-in-out infinite;
}
.capsule-icon::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 30%;
  aspect-ratio: 1;
  background: var(--bg);
  border: 4px solid var(--bg-elevated);
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px var(--text);
}
.capsule-icon::after {
  content: '';
  position: absolute;
  top: 47%;
  left: 0;
  right: 0;
  height: 6%;
  background: var(--bg);
  z-index: -1;
}
@keyframes capsule-bob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-8px) rotate(2deg); }
}

/* Evolution timer */
.evo-timer {
  position: absolute;
  bottom: var(--s-2);
  right: var(--s-2);
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(8px);
  padding: var(--s-1) var(--s-2);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
}

/* Element badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-fire { background: rgba(255,87,51,0.15); color: var(--el-fire); }
.badge-water { background: rgba(51,153,255,0.15); color: var(--el-water); }
.badge-grass { background: rgba(102,204,102,0.15); color: var(--el-grass); }
.badge-electric { background: rgba(255,221,0,0.15); color: var(--el-electric); }
.badge-ice { background: rgba(153,221,255,0.15); color: var(--el-ice); }
.badge-dark { background: rgba(102,51,204,0.15); color: var(--el-dark); }
.badge-rock { background: rgba(170,102,51,0.15); color: var(--el-rock); }
.badge-air { background: rgba(204,221,238,0.15); color: var(--el-air); }
.badge-bug { background: rgba(204,102,255,0.15); color: var(--el-bug); }
.badge-cosmic { background: rgba(153,102,255,0.15); color: var(--el-cosmic); }

.badge-status-capsule { background: rgba(0,212,255,0.15); color: var(--accent); }
.badge-status-creature { background: rgba(255,221,0,0.15); color: var(--primary); }
.badge-status-open { background: rgba(110,110,142,0.2); color: var(--text-dim); }

/* ─── TABLES ──────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table th, table td {
  padding: var(--s-3) var(--s-4);
  text-align: left;
  border-bottom: 1px solid var(--border);
}
table th {
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
}
table tr:hover td { background: var(--bg-elevated); }

/* ─── LOADING / SHIMMER ──────────────────────────── */
.shimmer {
  background: linear-gradient(90deg, var(--bg-card) 0%, var(--bg-elevated) 50%, var(--bg-card) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.shimmer.h-1 { height: 16px; }
.shimmer.h-2 { height: 24px; }
.shimmer.h-4 { height: 60px; }

/* ─── INPUTS ──────────────────────────────────────── */
input, select, textarea {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--s-3) var(--s-4);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  width: 100%;
  transition: border-color 150ms ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255,221,0,0.15);
}
input::placeholder { color: var(--text-dim); }

/* ─── HERO ────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-soft) 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: var(--s-7);
  margin-bottom: var(--s-6);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 60%;
  height: 200%;
  background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
  opacity: 0.15;
  pointer-events: none;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: 56px;
  font-weight: 900;
  letter-spacing: 0px;
  line-height: 1.1;
  margin-bottom: var(--s-4);
  text-transform: uppercase;
  position: relative;
  z-index: 1;
  text-shadow: 4px 4px 0 var(--secondary);
}
.hero p {
  font-size: 16px;
  color: var(--text-soft);
  max-width: 600px;
  margin-bottom: var(--s-5);
  position: relative;
  z-index: 1;
}
.hero-actions {
  display: flex;
  gap: var(--s-3);
  position: relative;
  z-index: 1;
}

/* ─── PROGRESS BAR ────────────────────────────────── */
.progress {
  background: var(--bg-elevated);
  border-radius: 100px;
  height: 8px;
  overflow: hidden;
  position: relative;
}
.progress-fill {
  background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
  height: 100%;
  border-radius: 100px;
  transition: width 600ms ease;
  box-shadow: 0 0 12px rgba(255,221,0,0.5);
}

/* ─── EVOLUTION COUNTDOWN BIG ─────────────────────── */
.countdown-big {
  font-family: var(--font-mono);
  font-size: 64px;
  font-weight: 900;
  text-align: center;
  background: linear-gradient(135deg, var(--accent) 0%, var(--primary) 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -2px;
  line-height: 1;
}
.countdown-label {
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-top: var(--s-2);
}

/* ─── EVOLVING ANIMATION ──────────────────────────── */
.evolving {
  animation: evolve-pulse 1s ease-in-out infinite;
}
@keyframes evolve-pulse {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.05); filter: brightness(1.5) drop-shadow(0 0 16px var(--primary)); }
}

/* ─── MOBILE ─────────────────────────────────────── */
.mobile-toggle {
  display: none;
  position: fixed;
  top: var(--s-4);
  left: var(--s-4);
  z-index: 100;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    width: 80%;
    max-width: 300px;
    z-index: 99;
    transition: left 250ms ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { left: 0; }
  .mobile-toggle { display: flex; }
  .canvas { padding: var(--s-7) var(--s-4) var(--s-5); }
  .hero { padding: var(--s-5); }
  .hero h1 { font-size: 32px; text-shadow: 2px 2px 0 var(--secondary); }
  .page-title { font-size: 22px; }
  .stat-value { font-size: 26px; }
}

/* ─── UTILITIES ──────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.gap-1 { gap: var(--s-1); }
.gap-2 { gap: var(--s-2); }
.gap-3 { gap: var(--s-3); }
.gap-4 { gap: var(--s-4); }
.gap-5 { gap: var(--s-5); }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.text-center { text-align: center; }
.text-dim { color: var(--text-dim); }
.text-soft { color: var(--text-soft); }
.text-primary { color: var(--primary); }
.text-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }
.text-xs { font-size: 11px; }
.text-sm { font-size: 13px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 20px; }
.mb-2 { margin-bottom: var(--s-2); }
.mb-3 { margin-bottom: var(--s-3); }
.mb-4 { margin-bottom: var(--s-4); }
.mb-5 { margin-bottom: var(--s-5); }
.mt-3 { margin-top: var(--s-3); }
.mt-4 { margin-top: var(--s-4); }
.mt-5 { margin-top: var(--s-5); }
.w-full { width: 100%; }
.hidden { display: none; }

/* Fade-in for content */
.fade-in {
  animation: fade-in 400ms ease;
}
@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
