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

:root {
  --bg: #0a0a0f;
  --surface: #13131a;
  --surface2: #1c1c27;
  --accent: #f5a623;
  --accent2: #e8572a;
  --green: #2ecc71;
  --red: #e74c3c;
  --text: #f0f0f0;
  --muted: #888;
  --radius: 16px;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* HEADER */
header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10,10,15,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #ffffff10;
  padding: 0 24px;
}
.header-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.logo { font-size: 1.3rem; font-weight: 900; letter-spacing: -0.5px; }
nav { display: flex; gap: 8px; }
.nav-btn {
  background: transparent; border: 1px solid #ffffff15;
  color: var(--muted); padding: 6px 16px; border-radius: 999px;
  cursor: pointer; font-size: 0.85rem; font-family: inherit;
  transition: all 0.2s;
}
.nav-btn:hover, .nav-btn.active {
  background: var(--accent); border-color: var(--accent);
  color: #000; font-weight: 600;
}
.vs-mode-btn { border-color: #ffffff30; }
.vs-mode-btn.active { background: var(--accent2); border-color: var(--accent2); color: #fff; }

/* HERO */
.hero {
  max-width: 1200px; margin: 0 auto;
  padding: 80px 24px 48px;
  text-align: center;
}
.hero h1 { font-size: clamp(2.5rem, 6vw, 4.5rem); font-weight: 900; line-height: 1.1; }
.accent { color: var(--accent); }
.hero p { color: var(--muted); font-size: 1.1rem; margin: 16px 0 32px; }
.search-wrap { max-width: 480px; margin: 0 auto; }
#searchInput {
  width: 100%; padding: 14px 20px;
  background: var(--surface); border: 1px solid #ffffff15;
  border-radius: 999px; color: var(--text);
  font-size: 1rem; font-family: inherit; outline: none;
  transition: border-color 0.2s;
}
#searchInput:focus { border-color: var(--accent); }

/* VS BANNER */
.vs-banner {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border-top: 2px solid var(--accent2);
  border-bottom: 2px solid var(--accent2);
  padding: 20px 24px;
}
.vs-banner-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.vs-banner-inner > span { color: var(--muted); font-size: 0.9rem; }
.vs-slots { display: flex; align-items: center; gap: 12px; flex: 1; }
.vs-slot {
  flex: 1; padding: 10px 16px; background: #ffffff10;
  border: 2px dashed #ffffff25; border-radius: var(--radius);
  text-align: center; font-weight: 600; color: var(--muted);
  min-width: 120px;
}
.vs-slot.filled { border-style: solid; border-color: var(--accent); color: var(--text); }
.vs-divider { font-weight: 900; font-size: 1.2rem; color: var(--accent2); }
.btn-fight {
  padding: 10px 28px; background: var(--accent2); border: none;
  border-radius: 999px; color: #fff; font-weight: 700;
  font-family: inherit; cursor: pointer; font-size: 1rem;
  transition: opacity 0.2s;
}
.btn-fight:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-fight:not(:disabled):hover { opacity: 0.85; }
.btn-cancel {
  background: transparent; border: none; color: var(--muted);
  cursor: pointer; font-size: 1.2rem; padding: 4px;
}

/* STATS */
.stats {
  max-width: 1200px; margin: 0 auto;
  display: flex; gap: 24px; padding: 0 24px 40px;
  justify-content: center;
}
.stat {
  background: var(--surface); border: 1px solid #ffffff10;
  border-radius: var(--radius); padding: 20px 40px;
  text-align: center;
}
.stat span { font-size: 2rem; font-weight: 900; color: var(--accent); display: block; }
.stat small { color: var(--muted); font-size: 0.85rem; }

/* GRID */
main { max-width: 1200px; margin: 0 auto; padding: 0 24px 80px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.loading { grid-column: 1/-1; text-align: center; color: var(--muted); padding: 80px 0; font-size: 1.1rem; }

/* CARD */
.card {
  background: var(--surface); border: 1px solid #ffffff0d;
  border-radius: var(--radius); overflow: hidden;
  cursor: pointer; transition: transform 0.2s, border-color 0.2s;
  position: relative;
}
.card:hover { transform: translateY(-4px); border-color: #ffffff25; }
.card.vs-selected { border-color: var(--accent); border-width: 2px; }
.card-img {
  width: 100%; height: 180px; object-fit: cover;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  font-size: 4rem;
}
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 16px; }
.card-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.72rem; font-weight: 600; padding: 3px 10px;
  border-radius: 999px; margin-bottom: 8px;
}
.badge-living { background: #2ecc7120; color: var(--green); }
.badge-extinct { background: #e74c3c20; color: var(--red); }
.card-name { font-size: 1.2rem; font-weight: 700; margin-bottom: 2px; }
.card-lat { font-size: 0.78rem; color: var(--muted); font-style: italic; margin-bottom: 10px; }
.card-desc {
  font-size: 0.85rem; color: #aaa; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-top: 1px solid #ffffff08;
}
.power-bar-wrap { display: flex; align-items: center; gap: 8px; flex: 1; }
.power-bar-label { font-size: 0.72rem; color: var(--muted); white-space: nowrap; }
.power-bar { flex: 1; height: 6px; background: #ffffff10; border-radius: 999px; overflow: hidden; }
.power-bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent2), var(--accent)); }
.power-val { font-size: 0.72rem; font-weight: 700; color: var(--accent); }

/* MODAL */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.8); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal {
  background: var(--surface); border: 1px solid #ffffff15;
  border-radius: 24px; width: 100%; max-width: 640px;
  max-height: 90vh; overflow-y: auto;
  position: relative;
}
.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: #ffffff15; border: none; color: var(--text);
  width: 36px; height: 36px; border-radius: 50%;
  cursor: pointer; font-size: 1rem; z-index: 10;
}
.modal-content { padding: 32px; }

/* Animal Modal Content */
.m-img {
  width: 100%; height: 240px; object-fit: cover;
  border-radius: 16px; margin-bottom: 20px; background: var(--surface2);
  display: flex; align-items: center; justify-content: center; font-size: 5rem;
  overflow: hidden;
}
.m-img img { width: 100%; height: 100%; object-fit: cover; }
.m-badge { margin-bottom: 8px; }
.m-name { font-size: 2rem; font-weight: 900; margin-bottom: 4px; }
.m-lat { color: var(--muted); font-style: italic; margin-bottom: 20px; }
.m-desc { line-height: 1.7; color: #ccc; margin-bottom: 24px; }
.m-power { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.m-power-label { font-weight: 600; white-space: nowrap; }
.m-power-bar { flex: 1; height: 10px; background: #ffffff10; border-radius: 999px; overflow: hidden; }
.m-power-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent2), var(--accent)); }
.m-power-val { font-weight: 700; color: var(--accent); }
.m-notes { font-size: 0.85rem; color: var(--muted); font-style: italic; }

/* VS Modal */
.modal-vs { max-width: 760px; }
.vs-result { text-align: center; }
.vs-fighters {
  display: grid; grid-template-columns: 1fr auto 1fr;
  gap: 16px; align-items: center; margin: 24px 0;
}
.vs-fighter { background: var(--surface2); border-radius: 16px; padding: 20px; text-align: center; }
.vs-fighter.winner { border: 2px solid var(--accent); }
.vs-fighter-name { font-size: 1.3rem; font-weight: 700; margin-bottom: 4px; }
.vs-fighter-rating { font-size: 2rem; font-weight: 900; color: var(--accent); }
.vs-fighter-notes { font-size: 0.78rem; color: var(--muted); margin-top: 6px; }
.vs-center { font-size: 2rem; font-weight: 900; color: var(--accent2); }
.vs-verdict-box {
  background: var(--surface2); border-radius: 16px; padding: 20px;
  margin: 20px 0;
}
.vs-verdict-title { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.vs-verdict-text { font-size: 1.1rem; font-weight: 600; line-height: 1.5; }
.vs-winner-label { font-size: 1rem; color: var(--muted); margin-bottom: 4px; }
.vs-winner-name { font-size: 2.5rem; font-weight: 900; color: var(--accent); }
.vs-draw { font-size: 2rem; font-weight: 900; color: var(--muted); }
