:root {
  color-scheme: light;
  --ink: #18202a;
  --muted: #617080;
  --line: #d9e0e7;
  --bg: #f6f8fb;
  --panel: #ffffff;
  --accent: #d94343;
  --accent-dark: #b92f36;
  --accent-2: #2774c9;
  --ok: #18785d;
  --shadow: 0 12px 30px rgba(24, 32, 42, 0.08);
  --shadow-soft: 0 6px 16px rgba(24, 32, 42, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(217, 67, 67, 0.12), transparent 28%),
    radial-gradient(circle at 88% 6%, rgba(39, 116, 201, 0.12), transparent 30%),
    linear-gradient(180deg, #f9fbfd 0%, var(--bg) 38%, #eef3f8 100%);
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px clamp(18px, 4vw, 48px);
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}

h1, h2, p {
  margin: 0;
}

h1 {
  font-size: 30px;
  letter-spacing: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

h1::before {
  content: "";
  width: 18px;
  height: 18px;
  border: 5px solid var(--accent);
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 3px var(--accent-2);
}

h2 {
  font-size: 18px;
  margin-bottom: 14px;
}

.topbar p, .muted {
  color: var(--muted);
}

nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

a {
  color: var(--accent-2);
  font-weight: 700;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 0.8fr);
  gap: 18px;
  padding: 18px clamp(18px, 4vw, 48px) 42px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow-soft);
}

.account-panel {
  align-self: start;
}

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

.account-header h2 {
  margin-bottom: 0;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 12px;
  padding: 4px;
  border-radius: 8px;
  background: #edf1f5;
}

.auth-tabs button {
  min-height: 34px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
}

.auth-tabs button.active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 1px 2px rgba(24, 32, 42, 0.12);
}

.role-pill {
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--ok);
  background: #e8f5f1;
  font-size: 12px;
  font-weight: 700;
}

.account-summary {
  display: grid;
  grid-template-columns: 46px 1fr;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfd;
}

.account-summary strong {
  display: block;
}

.avatar {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  color: #fff;
  background: var(--accent-2);
  font-weight: 800;
}

.account-favorites {
  margin-top: 18px;
}

.account-favorites h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.search-panel {
  min-height: 420px;
}

.search, .stack {
  display: flex;
  gap: 10px;
}

.stack {
  flex-direction: column;
}

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  font: inherit;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  font: inherit;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus {
  outline: 0;
  border-color: rgba(39, 116, 201, 0.65);
  box-shadow: 0 0 0 3px rgba(39, 116, 201, 0.14);
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  font: inherit;
  font-weight: 700;
  color: white;
  background: var(--accent);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  box-shadow: 0 5px 12px rgba(217, 67, 67, 0.18);
}

button:hover:not(:disabled) {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: none;
}

button.ghost {
  color: var(--ink);
  background: #edf1f5;
  box-shadow: none;
}

button.ghost:hover:not(:disabled) {
  color: var(--accent-2);
  background: #e3eef8;
}

.hidden {
  display: none;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.result-meta {
  margin-top: 12px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
}

.pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.card, .row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  box-shadow: 0 1px 0 rgba(24, 32, 42, 0.03);
}

.card {
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.card button {
  cursor: pointer;
}

.card:hover {
  border-color: rgba(39, 116, 201, 0.35);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.card img {
  width: 92px;
  height: 92px;
  image-rendering: pixelated;
}

.card h3 {
  margin: 0 0 8px;
  text-transform: capitalize;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.chip {
  border-radius: 999px;
  background: #e9f2fb;
  color: #1d5f9f;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
}

.type-normal { background: #eef0f2; color: #59626b; }
.type-fire { background: #ffe7db; color: #b24718; }
.type-water { background: #dff0ff; color: #1b64a5; }
.type-electric { background: #fff3bf; color: #946800; }
.type-grass { background: #dff5df; color: #287336; }
.type-ice { background: #e1fbff; color: #167483; }
.type-fighting { background: #f7dedc; color: #982f2b; }
.type-poison { background: #f0e0ff; color: #7139a6; }
.type-ground { background: #f2e5c4; color: #7b5b19; }
.type-flying { background: #e7ecff; color: #5267ad; }
.type-psychic { background: #ffe2ef; color: #b43568; }
.type-bug { background: #eef5c9; color: #667a10; }
.type-rock { background: #ebe2cd; color: #70602f; }
.type-ghost { background: #e7e1f3; color: #554386; }
.type-dragon { background: #e0e7ff; color: #3656b3; }
.type-dark { background: #e4e0dc; color: #4c4037; }
.type-steel { background: #e5eef3; color: #526d7d; }

.stats {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.card-guide {
  margin-left: 6px;
  color: var(--accent-2);
  background: #e9f2fb;
}

.guide-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfcfd;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(24, 32, 42, 0.58);
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(1060px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(24, 32, 42, 0.28);
}

.guide-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.guide-identity {
  display: grid;
  grid-template-columns: 96px 1fr;
  align-items: center;
  gap: 12px;
}

.guide-identity img {
  width: 96px;
  height: 96px;
  image-rendering: pixelated;
}

.guide-head h2 {
  margin-bottom: 8px;
  text-transform: capitalize;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.guide-grid section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.guide-grid h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.guide-grid p {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.nature-list,
.encounters ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nature-list li,
.encounters li {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 13px;
}

.nature-list strong,
.encounters strong {
  color: var(--ink);
  text-transform: capitalize;
}

.compare, .list {
  display: grid;
  gap: 10px;
}

.compare {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin-top: 14px;
}

.compact-head {
  align-items: flex-start;
}

.quick-compare {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.quick-compare button {
  min-height: 32px;
  color: var(--accent-2);
  background: #e9f2fb;
  font-size: 13px;
}

.compare-form {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 42px minmax(160px, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.compare-form label {
  display: grid;
  gap: 6px;
}

.compare-input-wrap {
  position: relative;
}

.compare-form label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.suggestions {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  z-index: 30;
  display: grid;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 0 0 6px 6px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.suggestions.hidden {
  display: none;
}

.suggestion {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  border-radius: 0;
  border-bottom: 1px solid #eef2f6;
  padding: 7px 10px;
  color: var(--ink);
  background: #fff;
  box-shadow: none;
  cursor: pointer;
  text-align: left;
  transform: none;
}

.suggestion:last-child {
  border-bottom: 0;
}

.suggestion:hover,
.suggestion:focus {
  color: var(--ink);
  background: #eef5fb;
  box-shadow: none;
  outline: 0;
  transform: none;
}

.suggestion span {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  text-transform: capitalize;
}

.suggestion small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.swap-btn {
  min-width: 42px;
  padding: 0;
  color: var(--accent-2);
  background: #e9f2fb;
  font-size: 18px;
}

.compare-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.type-advantage {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfd;
}

.type-advantage h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.type-advantage p {
  color: var(--muted);
}

.type-advantage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.type-advantage-side {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.type-advantage-side strong {
  text-transform: capitalize;
}

.type-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.type-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px 3px 3px;
  background: #fff;
}

.type-option b {
  color: var(--muted);
  font-size: 13px;
}

.type-option.strong {
  border-color: rgba(24, 120, 93, 0.4);
  background: #eaf7f2;
}

.type-option.strong b {
  color: var(--ok);
}

.type-option.weak {
  border-color: rgba(217, 67, 67, 0.28);
  background: #fff2f2;
}

.type-option.weak b {
  color: var(--accent);
}

.compare-title {
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.compare-title img {
  width: 70px;
  height: 70px;
  image-rendering: pixelated;
}

.compare-title strong {
  display: block;
  text-transform: capitalize;
}

.stat-bars {
  display: grid;
  gap: 8px;
}

.stat-row {
  display: grid;
  grid-template-columns: 70px 1fr 34px;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1f5;
}

.bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-2), var(--ok));
}

.favorite-row {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  transition: border-color 0.12s ease, transform 0.12s ease;
}

.favorite-row:hover {
  border-color: rgba(39, 116, 201, 0.35);
  transform: translateY(-1px);
}

.favorite-row img {
  width: 46px;
  height: 46px;
  image-rendering: pixelated;
}

.favorite-row strong {
  display: block;
  text-transform: capitalize;
}

.favorite-row span {
  color: var(--muted);
  font-size: 13px;
}

.favorite-types {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.remove-fav {
  min-height: 34px;
  padding: 0 10px;
  color: var(--accent);
  background: #fdecec;
  font-size: 13px;
}

.team-panel {
  grid-column: 1 / -1;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-head h2 {
  margin-bottom: 0;
}

.team {
  display: grid;
  gap: 14px;
}

.team-members {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
}

.team-member {
  display: grid;
  justify-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  text-align: center;
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.team-member:hover {
  border-color: rgba(39, 116, 201, 0.35);
  transform: translateY(-1px);
}

.team-member img {
  width: 72px;
  height: 72px;
  image-rendering: pixelated;
}

.team-member strong {
  text-transform: capitalize;
}

.team-analysis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.team-analysis section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.team-analysis h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.team-analysis ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.team-analysis li {
  display: grid;
  grid-template-columns: auto 24px 1fr;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.team-analysis li strong {
  color: var(--ink);
}

.row strong {
  text-transform: capitalize;
}

@media (max-width: 820px) {
  .topbar, .search {
    align-items: stretch;
    flex-direction: column;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .filters, .team-members, .team-analysis {
    grid-template-columns: 1fr;
  }

  .guide-grid, .type-advantage-grid {
    grid-template-columns: 1fr;
  }

  .compare-form {
    grid-template-columns: 1fr;
  }

  .swap-btn {
    width: 42px;
    justify-self: center;
  }
}
