:root {
      --bg: #090b12;
      --bg-2: #111520;
      --surface: rgba(20, 24, 34, 0.72);
      --surface-strong: rgba(28, 34, 48, 0.9);
      --ink: #f6f7fb;
      --muted: #a8b0c2;
      --line: rgba(255, 255, 255, 0.12);
      --line-strong: rgba(255, 255, 255, 0.22);
      --gold: #f6cd6a;
      --accent: #69d7ff;
      --success: #71e8a6;
      --danger: #ff6d8f;
      --shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
      --soft-shadow: 0 18px 44px rgba(0, 0, 0, 0.25);
      --radius-xl: 30px;
      --radius-lg: 24px;
      --radius-md: 16px;
      --radius-sm: 12px;
      --header-h: 76px;
      --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    }

    body.light {
      --bg: #f5f7fb;
      --bg-2: #e8edf6;
      --surface: rgba(255, 255, 255, 0.76);
      --surface-strong: rgba(255, 255, 255, 0.94);
      --ink: #141822;
      --muted: #657084;
      --line: rgba(20, 24, 34, 0.12);
      --line-strong: rgba(20, 24, 34, 0.22);
      --shadow: 0 28px 86px rgba(47, 58, 80, 0.18);
      --soft-shadow: 0 18px 42px rgba(47, 58, 80, 0.12);
    }

    * { box-sizing: border-box; }
    html { scroll-behavior: smooth; }

    body {
      margin: 0;
      min-height: 100vh;
      color: var(--ink);
      font-family: var(--font);
      background:
        radial-gradient(circle at 16% -8%, rgba(105, 215, 255, 0.22), transparent 28rem),
        radial-gradient(circle at 86% 6%, rgba(246, 205, 106, 0.16), transparent 26rem),
        linear-gradient(145deg, var(--bg), var(--bg-2));
    }

    body::before {
      content: "";
      position: fixed;
      inset: 0;
      z-index: -1;
      pointer-events: none;
      opacity: 0.5;
      background-image:
        linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
      background-size: 72px 72px;
      mask-image: linear-gradient(to bottom, black, transparent 72%);
    }

    button, input, select { font: inherit; }

    button {
      border: 1px solid var(--line);
      border-radius: 14px;
      color: var(--ink);
      background: rgba(255, 255, 255, 0.07);
      cursor: pointer;
      transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
    }

    button:hover { transform: translateY(-1px); border-color: var(--line-strong); }
    button:active { transform: translateY(0) scale(0.98); }
    button:focus-visible,
    a:focus-visible,
    input:focus-visible,
    select:focus-visible {
      outline: 3px solid color-mix(in srgb, var(--accent) 76%, white);
      outline-offset: 3px;
    }

    .site-header {
      position: sticky;
      top: 0;
      z-index: 50;
      min-height: var(--header-h);
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 18px;
      padding: 14px clamp(16px, 4vw, 46px);
      border-bottom: 1px solid var(--line);
      background: color-mix(in srgb, var(--surface-strong) 78%, transparent);
      backdrop-filter: blur(22px) saturate(145%);
    }

    .brand {
      display: inline-flex;
      align-items: center;
      gap: 12px;
      color: inherit;
      text-decoration: none;
      min-width: 0;
    }

    .brand-mark {
      width: 46px;
      height: 46px;
      flex: 0 0 auto;
      border: 1px solid rgba(246, 205, 106, 0.5);
      border-radius: 16px;
      background:
        radial-gradient(circle at 52% 52%, #fff 0 10%, transparent 11%),
        linear-gradient(#f15f65 0 46%, #202634 46% 54%, #f6f7fb 54%);
      box-shadow: inset 0 0 18px rgba(255, 255, 255, 0.2), 0 12px 30px rgba(0,0,0,0.18);
    }

    .brand strong, .brand span { display: block; }
    .brand strong { font-size: 1rem; letter-spacing: 0.01em; }
    .brand span { color: var(--muted); font-size: 0.78rem; font-weight: 750; }

    .header-actions {
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .nav-search {
      position: relative;
      display: grid;
      grid-template-columns: 42px 0 0;
      align-items: center;
      gap: 0;
      min-height: 42px;
      overflow: hidden;
      border: 1px solid var(--line);
      border-radius: 14px;
      background: rgba(255,255,255,0.06);
      transition: grid-template-columns 220ms ease, border-color 180ms ease, background 180ms ease;
    }

    body.light .nav-search { background: rgba(20,24,34,0.04); }

    .nav-search.open {
      grid-template-columns: 42px minmax(160px, 280px) 38px;
      border-color: var(--line-strong);
      background: var(--surface);
    }

    .search-toggle,
    .search-clear {
      width: 42px;
      height: 42px;
      border: 0;
      border-radius: 13px;
      background: transparent;
      box-shadow: none;
      color: var(--muted);
      font-size: 1.12rem;
    }

    .search-clear {
      width: 38px;
      opacity: 0;
      pointer-events: none;
      transition: opacity 160ms ease;
    }

    .nav-search.open .search-clear {
      opacity: 1;
      pointer-events: auto;
    }

    .nav-search input {
      min-width: 0;
      height: 42px;
      min-height: 42px;
      border: 0;
      border-radius: 0;
      padding: 0;
      opacity: 0;
      background: transparent;
      box-shadow: none;
      transition: opacity 160ms ease, padding 160ms ease;
    }

    .nav-search.open input {
      padding: 0 8px 0 0;
      opacity: 1;
    }

    .nav-search input:focus {
      border-color: transparent;
      box-shadow: none;
    }

    .nav-link, .theme-toggle {
      min-height: 42px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 0 14px;
      color: var(--muted);
      text-decoration: none;
      border-radius: 14px;
      font-weight: 800;
    }

    .nav-link:hover, .theme-toggle:hover { color: var(--ink); background: rgba(255,255,255,0.08); }
    body.light .nav-link:hover, body.light .theme-toggle:hover { background: rgba(20,24,34,0.06); }

    .battle-nav {
      color: #10131b;
      background: linear-gradient(135deg, #f6cd6a, #69d7ff);
      border: 1px solid rgba(255,255,255,0.18);
    }

    main {
      width: min(1500px, 100%);
      margin: 0 auto;
      padding: 26px clamp(14px, 3vw, 38px) 48px;
    }

    .hero {
      min-height: calc(100vh - var(--header-h) - 24px);
      display: grid;
      grid-template-columns: minmax(0, 1fr) minmax(310px, 430px);
      align-items: center;
      gap: clamp(24px, 5vw, 72px);
      padding: clamp(22px, 5vw, 56px) 0;
    }

    .eyebrow {
      margin: 0 0 12px;
      color: var(--gold);
      font-size: 0.78rem;
      font-weight: 900;
      letter-spacing: 0.16em;
      text-transform: uppercase;
    }

    h1 {
      max-width: 900px;
      margin: 0;
      font-size: clamp(2.7rem, 7vw, 7.2rem);
      line-height: 0.88;
      letter-spacing: 0;
    }

    .hero-copy {
      max-width: 690px;
      margin: 24px 0 0;
      color: var(--muted);
      font-size: clamp(1rem, 1.7vw, 1.22rem);
      line-height: 1.7;
    }

    .hero-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 12px;
      margin-top: 28px;
    }

    .primary-btn, .ghost-btn {
      min-height: 48px;
      padding: 0 18px;
      font-weight: 900;
    }

    .button-link {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: 14px;
      text-decoration: none;
    }

    .primary-btn {
      color: #10131b;
      background: linear-gradient(135deg, #f6cd6a, #69d7ff);
      border-color: rgba(255,255,255,0.3);
      box-shadow: 0 18px 42px rgba(105, 215, 255, 0.18);
    }

    .ghost-btn { background: var(--surface); }

    .featured-card {
      position: relative;
      isolation: isolate;
      min-height: 590px;
      overflow: hidden;
      border: 1px solid var(--line-strong);
      border-radius: var(--radius-xl);
      padding: 22px;
      background:
        radial-gradient(circle at 50% 24%, rgba(255,255,255,0.26), transparent 18rem),
        linear-gradient(155deg, rgba(255, 123, 68, 0.42), rgba(31, 36, 51, 0.92) 52%, rgba(105, 215, 255, 0.28));
      box-shadow: var(--shadow);
    }

    .featured-card::before, .pokemon-card::before {
      content: "";
      position: absolute;
      inset: -45%;
      z-index: -1;
      background: linear-gradient(115deg, transparent 38%, rgba(255,255,255,0.32), transparent 58%);
      transform: translateX(-35%) rotate(8deg);
      transition: transform 550ms ease;
    }

    .featured-card:hover::before, .pokemon-card:hover::before { transform: translateX(35%) rotate(8deg); }

    .featured-head, .card-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }

    .dex-no, .rarity-badge, .hp-badge {
      min-height: 34px;
      display: inline-flex;
      align-items: center;
      border: 1px solid rgba(255,255,255,0.18);
      border-radius: 999px;
      padding: 0 11px;
      background: rgba(255,255,255,0.1);
      color: rgba(255,255,255,0.9);
      font-size: 0.76rem;
      font-weight: 900;
      letter-spacing: 0.06em;
      text-transform: uppercase;
    }

    body.light .featured-card .dex-no,
    body.light .featured-card .rarity-badge,
    body.light .featured-card .hp-badge { color: #fff; }

    .featured-art {
      min-height: 318px;
      display: grid;
      place-items: center;
      margin: 22px 0 8px;
    }

    .featured-art img {
      width: min(330px, 78vw);
      filter: drop-shadow(0 32px 34px rgba(0,0,0,0.38));
      animation: floatCard 5s ease-in-out infinite;
    }

    @keyframes floatCard {
      50% { transform: translateY(-12px) rotate(1deg); }
    }

    .featured-card h2 {
      margin: 0;
      color: #fff;
      font-size: clamp(2rem, 4vw, 3.2rem);
      line-height: 1;
    }

    .featured-card p {
      color: rgba(255,255,255,0.76);
      line-height: 1.6;
    }

    .stats-strip {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
      gap: 12px;
      margin: 10px 0 34px;
    }

    .vault-stat, .toolbar, .empty-state {
      border: 1px solid var(--line);
      border-radius: var(--radius-lg);
      background: var(--surface);
      box-shadow: var(--soft-shadow);
      backdrop-filter: blur(18px);
    }

    .vault-stat {
      padding: 18px;
    }

    .vault-stat strong {
      display: block;
      font-size: clamp(1.6rem, 3vw, 2.6rem);
      line-height: 1;
    }

    .vault-stat span {
      display: block;
      margin-top: 8px;
      color: var(--muted);
      font-weight: 800;
      font-size: 0.82rem;
      text-transform: uppercase;
      letter-spacing: 0.08em;
    }

    .section-head {
      display: flex;
      align-items: end;
      justify-content: space-between;
      gap: 18px;
      margin: 0 0 18px;
    }

    .section-head h2 {
      margin: 0;
      font-size: clamp(2rem, 4vw, 3.4rem);
      line-height: 1;
    }

    .section-head p {
      max-width: 560px;
      margin: 10px 0 0;
      color: var(--muted);
      line-height: 1.6;
    }

    .count-pill {
      white-space: nowrap;
      border: 1px solid var(--line);
      border-radius: 999px;
      padding: 10px 14px;
      color: var(--muted);
      background: var(--surface);
      font-weight: 850;
    }

    .toolbar {
      position: sticky;
      top: calc(var(--header-h) + 10px);
      z-index: 20;
      display: grid;
      grid-template-columns: repeat(4, minmax(140px, 1fr));
      gap: 12px;
      margin-bottom: 22px;
      padding: 12px;
    }

    .field {
      display: grid;
      gap: 7px;
      min-width: 0;
    }

    .field span {
      color: var(--muted);
      font-size: 0.72rem;
      font-weight: 900;
      letter-spacing: 0.1em;
      text-transform: uppercase;
    }

    input, select {
      width: 100%;
      min-height: 46px;
      border: 1px solid var(--line);
      border-radius: 14px;
      outline: none;
      color: var(--ink);
      background: rgba(255,255,255,0.08);
      padding: 0 13px;
    }

    body.light input, body.light select { background: rgba(20,24,34,0.04); }
    body.light .nav-search input { background: transparent; }
    input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(105,215,255,0.13); }

    .pokemon-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(282px, 1fr));
      gap: 20px;
    }

    .pokemon-card {
      --type: #69d7ff;
      position: relative;
      isolation: isolate;
      min-height: 520px;
      overflow: hidden;
      display: flex;
      flex-direction: column;
      border: 1px solid color-mix(in srgb, var(--type) 38%, var(--line));
      border-radius: var(--radius-xl);
      padding: 18px;
      background:
        radial-gradient(circle at 50% 22%, color-mix(in srgb, var(--type) 32%, transparent), transparent 13rem),
        linear-gradient(180deg, rgba(255,255,255,0.1), rgba(255,255,255,0.025)),
        var(--surface-strong);
      box-shadow: 0 0 0 1px rgba(255,255,255,0.03), 0 24px 70px rgba(0,0,0,0.28);
      transition: transform 210ms ease, box-shadow 210ms ease, border-color 210ms ease;
    }

    .pokemon-card::after {
      content: "";
      position: absolute;
      inset: 0;
      z-index: -2;
      opacity: 0.2;
      background:
        linear-gradient(135deg, transparent 0 28%, rgba(255,255,255,0.5) 29%, transparent 30% 52%, rgba(255,255,255,0.26) 53%, transparent 54%),
        radial-gradient(circle at 20% 16%, var(--type), transparent 16rem);
      background-size: 150% 150%, auto;
      mix-blend-mode: screen;
    }

    .pokemon-card:hover {
      transform: translateY(-8px);
      border-color: color-mix(in srgb, var(--type) 72%, white);
      box-shadow: 0 32px 86px color-mix(in srgb, var(--type) 18%, rgba(0,0,0,0.38));
    }

    .card-art {
      flex: 1;
      min-height: 210px;
      display: grid;
      place-items: center;
      margin: 10px 0 2px;
      border-radius: 24px;
      background:
        radial-gradient(circle at 50% 52%, rgba(255,255,255,0.15), transparent 44%),
        linear-gradient(180deg, rgba(255,255,255,0.1), rgba(255,255,255,0.02));
    }

    .card-art img {
      width: min(78%, 230px);
      max-height: 230px;
      object-fit: contain;
      filter: drop-shadow(0 22px 24px rgba(0,0,0,0.34));
      transition: transform 220ms ease;
    }

    .pokemon-card:hover .card-art img { transform: scale(1.05); }

    .pokemon-card h3 {
      margin: 10px 0 9px;
      font-size: 1.62rem;
      letter-spacing: 0;
    }

    .type-row {
      display: flex;
      flex-wrap: wrap;
      gap: 7px;
    }

    .type-chip {
      min-height: 30px;
      display: inline-flex;
      align-items: center;
      border: 1px solid rgba(255,255,255,0.16);
      border-radius: 999px;
      padding: 0 10px;
      color: #fff;
      background: color-mix(in srgb, var(--chip) 72%, #202432);
      font-size: 0.76rem;
      font-weight: 900;
      letter-spacing: 0.05em;
      text-transform: uppercase;
    }

    button.type-chip {
      cursor: pointer;
      box-shadow: none;
    }

    button.type-chip:hover {
      transform: translateY(-1px);
      border-color: rgba(255,255,255,0.38);
    }

    .card-copy {
      min-height: 66px;
      margin: 12px 0;
      color: var(--muted);
      font-size: 0.93rem;
      line-height: 1.55;
    }

    .stat-chips {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 8px;
      margin-top: auto;
    }

    .stat-chip {
      min-width: 0;
      border: 1px solid var(--line);
      border-radius: 16px;
      padding: 9px 8px;
      background: rgba(255,255,255,0.07);
    }

    .stat-chip span {
      display: block;
      color: var(--muted);
      font-size: 0.68rem;
      font-weight: 900;
      letter-spacing: 0.08em;
      text-transform: uppercase;
    }

    .stat-chip strong {
      display: block;
      margin-top: 3px;
      font-size: 1rem;
    }

    .card-actions {
      display: grid;
      grid-template-columns: 48px 1fr;
      gap: 9px;
      margin-top: 12px;
    }

    .favorite-btn, .details-btn {
      min-height: 48px;
      font-weight: 950;
      background: rgba(255,255,255,0.08);
    }

    .favorite-btn {
      font-size: 1.2rem;
      color: var(--gold);
    }

    .favorite-btn.active {
      background: rgba(246,205,106,0.16);
      border-color: rgba(246,205,106,0.5);
      box-shadow: 0 0 32px rgba(246,205,106,0.15);
    }

    .details-btn {
      color: #10131b;
      border-color: transparent;
      background: linear-gradient(135deg, color-mix(in srgb, var(--type) 74%, white), #f6cd6a);
    }

    .empty-state {
      grid-column: 1 / -1;
      min-height: 260px;
      display: grid;
      place-items: center;
      padding: 34px;
      color: var(--muted);
      font-weight: 850;
      text-align: center;
    }

    .modal {
      width: min(980px, calc(100vw - 28px));
      border: 1px solid var(--line-strong);
      border-radius: var(--radius-xl);
      padding: 0;
      color: var(--ink);
      background: var(--surface-strong);
      box-shadow: var(--shadow);
      backdrop-filter: blur(24px);
    }

    .modal::backdrop { background: rgba(0,0,0,0.68); backdrop-filter: blur(8px); }

    .modal-layout {
      display: grid;
      grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.1fr);
      gap: 0;
      overflow: hidden;
    }

    .modal-art {
      display: grid;
      place-items: center;
      min-height: 560px;
      padding: 28px;
      background:
        radial-gradient(circle at 50% 35%, rgba(255,255,255,0.24), transparent 13rem),
        linear-gradient(145deg, color-mix(in srgb, var(--type) 46%, #161a25), rgba(18,22,31,0.94));
    }

    .modal-art img {
      width: min(360px, 82%);
      filter: drop-shadow(0 34px 36px rgba(0,0,0,0.42));
    }

    .modal-body {
      padding: 30px;
    }

    .modal-body h2 {
      margin: 0 0 10px;
      font-size: clamp(2.2rem, 5vw, 4rem);
      line-height: 0.95;
    }

    .meta-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 10px;
      margin: 20px 0;
    }

    .meta-card {
      border: 1px solid var(--line);
      border-radius: 18px;
      padding: 12px;
      background: rgba(255,255,255,0.07);
    }

    .meta-card span {
      display: block;
      color: var(--muted);
      font-size: 0.72rem;
      font-weight: 900;
      letter-spacing: 0.08em;
      text-transform: uppercase;
    }

    .meta-card strong {
      display: block;
      margin-top: 5px;
      overflow-wrap: anywhere;
    }

    .modal-description {
      color: var(--muted);
      line-height: 1.7;
    }

    .close-modal {
      position: absolute;
      top: 14px;
      right: 14px;
      width: 44px;
      height: 44px;
      border-radius: 50%;
      font-size: 1.4rem;
      background: rgba(0,0,0,0.28);
      color: #fff;
    }

    .grass { --type: #64d96f; }
    .poison { --type: #b56bdb; }
    .fire { --type: #ff784f; }
    .flying { --type: #8aa8ff; }
    .water { --type: #57b7ff; }
    .bug { --type: #b9d957; }
    .normal { --type: #c8c1b4; }
    .electric { --type: #f8d84e; }
    .ground { --type: #d5aa62; }
    .psychic { --type: #ff79b5; }
    .fighting { --type: #dc705b; }
    .rock { --type: #bba466; }
    .steel { --type: #a9b7c9; }
    .ghost { --type: #8270c7; }
    .ice { --type: #82dbe8; }
    .dragon { --type: #8068ff; }
    .dark { --type: #756b65; }
    .fairy { --type: #ff9ad1; }

    @media (max-width: 980px) {
      .hero { grid-template-columns: 1fr; min-height: auto; }
      .featured-card { min-height: 520px; }
      .stats-strip { grid-template-columns: repeat(2, 1fr); }
      .toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .modal-layout { grid-template-columns: 1fr; }
      .modal-art { min-height: 330px; }
    }

    @media (max-width: 640px) {
      .site-header { align-items: flex-start; }
      .brand span { display: none; }
      .header-actions { gap: 6px; }
      .nav-link:not(.battle-nav) { display: none; }
      .nav-search.open {
        grid-template-columns: 42px minmax(106px, 42vw) 38px;
      }
      main { padding-inline: 12px; }
      h1 { font-size: clamp(2.55rem, 15vw, 4.5rem); }
      .stats-strip, .toolbar, .meta-grid { grid-template-columns: 1fr; }
      .section-head { display: block; }
      .count-pill { display: inline-flex; margin-top: 14px; }
      .pokemon-grid { grid-template-columns: minmax(0, 1fr); }
      .pokemon-card { min-height: 500px; border-radius: 26px; }
      .featured-card { border-radius: 26px; }
    }

/* Battle Ground page */
.battle-page * { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body.battle-page {
      margin: 0;
      min-height: 100vh;
      color: var(--ink);
      font-family: var(--font);
      background:
        radial-gradient(circle at 16% -8%, rgba(105, 215, 255, 0.22), transparent 28rem),
        radial-gradient(circle at 86% 6%, rgba(246, 205, 106, 0.16), transparent 26rem),
        linear-gradient(145deg, var(--bg), var(--bg-2));
    }

body.battle-page::before {
      content: "";
      position: fixed;
      inset: 0;
      z-index: -1;
      pointer-events: none;
      opacity: 0.45;
      background-image:
        linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
      background-size: 72px 72px;
      mask-image: linear-gradient(to bottom, black, transparent 72%);
    }

.battle-page button,
.battle-page a { font: inherit; }

.battle-page button,
.battle-page .nav-link,
.battle-page .button-link {
      min-height: 44px;
      border: 1px solid var(--line);
      border-radius: 14px;
      color: var(--ink);
      background: rgba(255, 255, 255, 0.07);
      cursor: pointer;
      text-decoration: none;
      font-weight: 900;
      transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
    }

.battle-page button:hover:not(:disabled),
.battle-page .nav-link:hover,
.battle-page .button-link:hover {
      transform: translateY(-1px);
      border-color: var(--line-strong);
    }

.battle-page button:focus-visible,
.battle-page a:focus-visible {
      outline: 3px solid color-mix(in srgb, var(--accent) 76%, white);
      outline-offset: 3px;
    }

.battle-page button:disabled {
      cursor: not-allowed;
      opacity: 0.45;
      transform: none;
      box-shadow: none;
    }

.battle-page .site-header {
      position: sticky;
      top: 0;
      z-index: 50;
      min-height: var(--header-h);
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 18px;
      padding: 14px clamp(16px, 4vw, 46px);
      border-bottom: 1px solid var(--line);
      background: color-mix(in srgb, var(--surface-strong) 78%, transparent);
      backdrop-filter: blur(22px) saturate(145%);
    }

.battle-page .brand,
.battle-page .header-actions,
.battle-page .nav-link,
.battle-page .button-link {
      display: inline-flex;
      align-items: center;
    }

.battle-page .brand {
      min-width: 0;
      gap: 12px;
      color: inherit;
      text-decoration: none;
    }

.battle-page .brand-mark {
      width: 46px;
      height: 46px;
      flex: 0 0 auto;
      border: 1px solid rgba(246, 205, 106, 0.5);
      border-radius: 16px;
      background:
        radial-gradient(circle at 52% 52%, #fff 0 10%, transparent 11%),
        linear-gradient(#f15f65 0 46%, #202634 46% 54%, #f6f7fb 54%);
      box-shadow: inset 0 0 18px rgba(255, 255, 255, 0.2), 0 12px 30px rgba(0,0,0,0.18);
    }

.battle-page .brand strong,
.battle-page .brand span { display: block; }

.battle-page .brand span { color: var(--muted); font-size: 0.78rem; font-weight: 750; }

.battle-page .header-actions { gap: 10px; }

.battle-page .nav-link,
.battle-page .button-link { justify-content: center; padding: 0 14px; color: var(--muted); }

.battle-page .battle-nav,
.battle-page .primary-btn {
      color: #10131b;
      background: linear-gradient(135deg, #f6cd6a, #69d7ff);
      border-color: rgba(255,255,255,0.18);
      box-shadow: 0 18px 42px rgba(105, 215, 255, 0.16);
    }

.battle-page main {
      width: min(1480px, 100%);
      margin: 0 auto;
      padding: 30px clamp(14px, 3vw, 38px) 48px;
      animation: pageIn 420ms ease both;
    }

@keyframes pageIn {
      from { opacity: 0; transform: translateY(12px); }
      to { opacity: 1; transform: translateY(0); }
    }

.battle-page .hero {
      margin-bottom: 22px;
    }

.battle-page .eyebrow {
      margin: 0 0 12px;
      color: var(--gold);
      font-size: 0.78rem;
      font-weight: 900;
      letter-spacing: 0.16em;
      text-transform: uppercase;
    }

.battle-page h1 {
      margin: 0;
      font-size: clamp(3rem, 7vw, 6.6rem);
      line-height: 0.9;
      letter-spacing: 0;
    }

.battle-page .subtitle {
      max-width: 720px;
      color: var(--muted);
      font-size: 1.05rem;
      line-height: 1.7;
    }

.battle-page .arena-panel {
      border: 1px solid var(--line);
      border-radius: 24px;
      background: var(--surface);
      box-shadow: var(--soft-shadow);
      backdrop-filter: blur(18px);
    }

.battle-page .battle-shell {
      display: grid;
      grid-template-columns: 78px minmax(0, 1fr);
      gap: 16px;
      align-items: start;
    }

.battle-page .sidebar-controls {
      position: sticky;
      top: calc(var(--header-h) + 18px);
      display: grid;
      gap: 10px;
      border: 1px solid var(--line);
      border-radius: 24px;
      padding: 10px;
      background: var(--surface);
      box-shadow: var(--soft-shadow);
      backdrop-filter: blur(18px);
    }

.battle-page .icon-button {
      position: relative;
      width: 56px;
      min-height: 56px;
      display: grid;
      place-items: center;
      border-radius: 18px;
      font-size: 1.28rem;
      line-height: 1;
    }

.battle-page .icon-button::after {
      content: attr(data-label);
      position: absolute;
      left: calc(100% + 10px);
      top: 50%;
      z-index: 20;
      min-width: max-content;
      transform: translate(-6px, -50%);
      opacity: 0;
      pointer-events: none;
      border: 1px solid var(--line-strong);
      border-radius: 999px;
      padding: 8px 11px;
      color: var(--ink);
      background: rgba(15, 18, 26, 0.94);
      box-shadow: 0 16px 36px rgba(0,0,0,0.28);
      font-size: 0.75rem;
      font-weight: 900;
      letter-spacing: 0.04em;
      text-transform: uppercase;
      transition: opacity 160ms ease, transform 160ms ease;
    }

.battle-page .icon-button:focus-visible::after,
.battle-page .icon-button.reveal::after {
      opacity: 1;
      transform: translate(0, -50%);
    }

.battle-page .arena-panel {
      position: relative;
      overflow: hidden;
      padding: clamp(14px, 2.2vw, 24px);
    }

.battle-page .arena-panel.impact {
      animation: arenaImpact 260ms ease;
    }

.battle-page .arena-panel::after {
      content: "";
      position: absolute;
      inset: auto -10% -42% -10%;
      height: 50%;
      pointer-events: none;
      background: radial-gradient(ellipse at center, rgba(105, 215, 255, 0.12), transparent 62%);
    }

.battle-page .winner-banner {
      position: relative;
      z-index: 2;
      min-height: 54px;
      display: grid;
      place-items: center;
      margin-bottom: 18px;
      border: 1px solid var(--line);
      border-radius: 18px;
      color: var(--muted);
      background: rgba(255,255,255,0.06);
      text-align: center;
      font-weight: 950;
    }

.battle-page .winner-banner.win {
      color: var(--success);
      border-color: rgba(113, 232, 166, 0.42);
      background:
        radial-gradient(circle at 50% 50%, rgba(113, 232, 166, 0.22), transparent 56%),
        linear-gradient(135deg, rgba(113, 232, 166, 0.16), rgba(105, 215, 255, 0.12));
      box-shadow: 0 0 44px rgba(113, 232, 166, 0.24), 0 0 120px rgba(105, 215, 255, 0.16);
      animation: winnerGrand 1500ms ease-in-out infinite alternate, winnerPop 620ms cubic-bezier(.2, .9, .2, 1) both;
    }

.battle-page .winner-banner.loss {
      color: var(--danger);
      border-color: rgba(255, 109, 143, 0.42);
      background:
        radial-gradient(circle at 50% 50%, rgba(255, 109, 143, 0.22), transparent 56%),
        linear-gradient(135deg, rgba(255, 109, 143, 0.16), rgba(246, 205, 106, 0.12));
      box-shadow: 0 0 44px rgba(255, 109, 143, 0.24), 0 0 120px rgba(246, 205, 106, 0.16);
      animation: winnerGrand 1500ms ease-in-out infinite alternate, winnerPop 620ms cubic-bezier(.2, .9, .2, 1) both;
    }

@keyframes winnerGrand {
      from { filter: brightness(1) saturate(1); transform: translateY(0) scale(1); }
      to { filter: brightness(1.35) saturate(1.3); transform: translateY(-2px) scale(1.018); }
    }

@keyframes winnerPop {
      from { opacity: 0; transform: scale(0.86); }
      70% { opacity: 1; transform: scale(1.04); }
      to { opacity: 1; transform: scale(1); }
    }

@keyframes arenaImpact {
      20% { transform: translateX(-5px); filter: brightness(1.15); }
      48% { transform: translateX(5px); }
      100% { transform: translateX(0); filter: brightness(1); }
    }

.battle-page .arena-board {
      display: grid;
      grid-template-columns: minmax(280px, 1fr) auto minmax(280px, 1fr);
      align-items: center;
      gap: clamp(14px, 2vw, 24px);
    }

.battle-page .fighter-zone {
      position: relative;
      min-width: 0;
    }

.battle-page .zone-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 12px;
      color: var(--muted);
      font-weight: 900;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      font-size: 0.74rem;
    }

.battle-page .health-shell {
      height: 13px;
      overflow: hidden;
      border: 1px solid var(--line);
      border-radius: 999px;
      background: rgba(255,255,255,0.08);
      margin-bottom: 14px;
    }

.battle-page .health-shell.hit {
      animation: healthHit 360ms ease;
    }

.battle-page .health-bar {
      display: block;
      width: 0%;
      height: 100%;
      border-radius: inherit;
      background: linear-gradient(90deg, var(--success), #f6cd6a);
      transition: width 420ms ease;
    }

.battle-page .health-bar.low { background: linear-gradient(90deg, var(--danger), #f6cd6a); }

@keyframes healthHit {
      35% { box-shadow: 0 0 0 5px rgba(255, 109, 143, 0.18), 0 0 28px rgba(255, 109, 143, 0.28); }
      100% { box-shadow: none; }
    }

.battle-page .battle-card {
      --type: #69d7ff;
      position: relative;
      isolation: isolate;
      min-height: 560px;
      overflow: hidden;
      display: flex;
      flex-direction: column;
      border: 1px solid color-mix(in srgb, var(--type) 38%, var(--line));
      border-radius: 30px;
      padding: 18px;
      background:
        radial-gradient(circle at 50% 22%, color-mix(in srgb, var(--type) 32%, transparent), transparent 13rem),
        linear-gradient(180deg, rgba(255,255,255,0.1), rgba(255,255,255,0.025)),
        var(--surface-strong);
      box-shadow: 0 0 0 1px rgba(255,255,255,0.03), 0 24px 70px rgba(0,0,0,0.28);
      animation: cardEnter 360ms ease both;
      transition: transform 200ms ease, box-shadow 200ms ease;
    }

.battle-page .battle-card::before {
      content: "";
      position: absolute;
      inset: -45%;
      z-index: -1;
      background: linear-gradient(115deg, transparent 38%, rgba(255,255,255,0.32), transparent 58%);
      transform: translateX(-35%) rotate(8deg);
      transition: transform 550ms ease;
    }

.battle-page .battle-card:hover::before { transform: translateX(35%) rotate(8deg); }

.battle-page .battle-card:hover { transform: translateY(-5px); box-shadow: 0 32px 86px color-mix(in srgb, var(--type) 18%, rgba(0,0,0,0.38)); }

.battle-page .battle-card.shake { animation: attackShake 300ms ease; }

.battle-page .battle-card.hit { animation: cardHit 430ms ease; }

@keyframes cardEnter {
      from { opacity: 0; transform: translateY(16px) scale(0.98); }
      to { opacity: 1; transform: translateY(0) scale(1); }
    }

@keyframes attackShake {
      20% { transform: translateX(-8px) rotate(-1deg); }
      45% { transform: translateX(8px) rotate(1deg); }
      70% { transform: translateX(-5px); }
      100% { transform: translateX(0); }
    }

@keyframes cardHit {
      18% { transform: translateY(8px) scale(0.985); filter: brightness(1.35) saturate(1.35); }
      42% { transform: translateY(-4px) scale(1.01); }
      100% { transform: translateY(0) scale(1); filter: brightness(1) saturate(1); }
    }

.battle-page .card-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }

.battle-page .dex-no,
.battle-page .rarity-badge,
.battle-page .hp-badge {
      min-height: 34px;
      display: inline-flex;
      align-items: center;
      border: 1px solid rgba(255,255,255,0.18);
      border-radius: 999px;
      padding: 0 11px;
      background: rgba(255,255,255,0.1);
      color: rgba(255,255,255,0.9);
      font-size: 0.76rem;
      font-weight: 900;
      letter-spacing: 0.06em;
      text-transform: uppercase;
    }

.battle-page .card-art {
      flex: 1;
      min-height: 230px;
      display: grid;
      place-items: center;
      margin: 12px 0 4px;
      border-radius: 24px;
      background: radial-gradient(circle at 50% 52%, rgba(255,255,255,0.15), transparent 44%);
    }

.battle-page .card-art img {
      width: min(78%, 250px);
      max-height: 250px;
      object-fit: contain;
      filter: drop-shadow(0 22px 24px rgba(0,0,0,0.34));
    }

.battle-page .battle-card h2 {
      margin: 10px 0 9px;
      font-size: clamp(1.8rem, 3vw, 2.25rem);
      line-height: 1;
    }

.battle-page .type-row { display: flex; flex-wrap: wrap; gap: 7px; }

.battle-page .type-chip {
      min-height: 30px;
      display: inline-flex;
      align-items: center;
      border: 1px solid rgba(255,255,255,0.16);
      border-radius: 999px;
      padding: 0 10px;
      color: #fff;
      background: color-mix(in srgb, var(--chip) 72%, #202432);
      font-size: 0.76rem;
      font-weight: 900;
      letter-spacing: 0.05em;
      text-transform: uppercase;
    }

.battle-page .ability {
      min-height: 48px;
      margin: 12px 0;
      color: var(--muted);
      line-height: 1.5;
    }

.battle-page .stat-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 8px;
      margin-top: auto;
    }

.battle-page .mini-stat {
      border: 1px solid var(--line);
      border-radius: 16px;
      padding: 9px 8px;
      background: rgba(255,255,255,0.07);
    }

.battle-page .mini-stat span {
      display: block;
      color: var(--muted);
      font-size: 0.68rem;
      font-weight: 900;
      letter-spacing: 0.08em;
      text-transform: uppercase;
    }

.battle-page .mini-stat strong { display: block; margin-top: 3px; }

.battle-page .empty-slot {
      min-height: 560px;
      display: grid;
      place-items: center;
      border: 1px dashed var(--line-strong);
      border-radius: 30px;
      color: var(--muted);
      background: rgba(255,255,255,0.045);
      text-align: center;
      padding: 24px;
      font-weight: 900;
    }

.battle-page .vs-badge {
      width: clamp(62px, 8vw, 92px);
      aspect-ratio: 1;
      display: grid;
      place-items: center;
      border: 1px solid rgba(246, 205, 106, 0.46);
      border-radius: 50%;
      color: #10131b;
      background: linear-gradient(135deg, #f6cd6a, #69d7ff);
      font-weight: 1000;
      font-size: clamp(1.1rem, 2vw, 1.55rem);
      box-shadow: 0 0 48px rgba(246, 205, 106, 0.18);
    }

.battle-page .damage-popup {
      position: absolute;
      top: 96px;
      right: 28px;
      z-index: 5;
      color: #fff;
      border: 1px solid rgba(255,255,255,0.2);
      border-radius: 999px;
      padding: 8px 12px;
      background: rgba(255, 109, 143, 0.9);
      box-shadow: 0 16px 34px rgba(255, 109, 143, 0.25);
      font-weight: 1000;
      animation: damageFloat 820ms ease forwards;
    }

@keyframes damageFloat {
      from { opacity: 0; transform: translateY(18px) scale(0.88); }
      25% { opacity: 1; }
      to { opacity: 0; transform: translateY(-28px) scale(1.05); }
    }

.battle-page .winner-popup {
      position: fixed;
      inset: 0;
      z-index: 100;
      display: grid;
      place-items: center;
      padding: 20px;
      background: rgba(5, 7, 12, 0.74);
      backdrop-filter: blur(10px);
      opacity: 1;
      pointer-events: auto;
      transition: opacity 220ms ease;
    }

.battle-page .winner-popup.hidden {
      opacity: 0;
      pointer-events: none;
    }

.battle-page .winner-popup-card {
      width: min(520px, 100%);
      border: 1px solid rgba(246, 205, 106, 0.48);
      border-radius: 28px;
      padding: clamp(26px, 5vw, 44px);
      text-align: center;
      background:
        radial-gradient(circle at 50% 0%, rgba(255,255,255,0.16), transparent 15rem),
        linear-gradient(145deg, rgba(28, 34, 48, 0.98), rgba(12, 15, 24, 0.98));
      box-shadow: 0 34px 110px rgba(0,0,0,0.55), 0 0 80px rgba(246,205,106,0.16);
      animation: winnerModalPop 520ms cubic-bezier(.2, .9, .2, 1) both;
    }

.battle-page .winner-popup-card p {
      margin: 0 0 10px;
      color: var(--gold);
      font-size: 0.78rem;
      font-weight: 950;
      letter-spacing: 0.16em;
      text-transform: uppercase;
    }

.battle-page .winner-popup-card h2 {
      margin: 0;
      font-size: clamp(2.6rem, 8vw, 4.8rem);
      line-height: 0.92;
    }

.battle-page .winner-popup-card strong {
      display: block;
      margin-top: 16px;
      color: var(--muted);
      font-size: 1rem;
    }

@keyframes winnerModalPop {
      from { opacity: 0; transform: translateY(18px) scale(0.9); }
      to { opacity: 1; transform: translateY(0) scale(1); }
    }

.battle-page .grass { --type: #64d96f; }

.battle-page .poison { --type: #b56bdb; }

.battle-page .fire { --type: #ff784f; }

.battle-page .flying { --type: #8aa8ff; }

.battle-page .water { --type: #57b7ff; }

.battle-page .bug { --type: #b9d957; }

.battle-page .normal { --type: #c8c1b4; }

.battle-page .electric { --type: #f8d84e; }

.battle-page .ground { --type: #d5aa62; }

.battle-page .psychic { --type: #ff79b5; }

.battle-page .fighting { --type: #dc705b; }

.battle-page .rock { --type: #bba466; }

.battle-page .steel { --type: #a9b7c9; }

.battle-page .ghost { --type: #8270c7; }

.battle-page .ice { --type: #82dbe8; }

.battle-page .dragon { --type: #8068ff; }

.battle-page .dark { --type: #756b65; }

.battle-page .fairy { --type: #ff9ad1; }

@media (prefers-reduced-motion: reduce) {
.battle-page *,
.battle-page *::before,
.battle-page *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
      }
}

@media (max-width: 1080px) {
.battle-page .battle-shell { grid-template-columns: 1fr; }

.battle-page .sidebar-controls {
        position: static;
        grid-template-columns: repeat(6, 56px);
        justify-content: center;
      }

.battle-page .icon-button::after {
        left: 50%;
        top: auto;
        bottom: calc(100% + 8px);
        transform: translate(-50%, 6px);
      }

.battle-page .icon-button:focus-visible::after,
.battle-page .icon-button.reveal::after {
        transform: translate(-50%, 0);
      }

.battle-page .arena-board { grid-template-columns: 1fr; }

.battle-page .vs-badge { margin: 0 auto; }
}

@media (max-width: 680px) {
.battle-page .site-header { align-items: flex-start; }

.battle-page .brand span { display: none; }

.battle-page .header-actions { gap: 6px; }

.battle-page .nav-link { padding: 0 10px; }

.battle-page .hero { grid-template-columns: 1fr; }

.battle-page .sidebar-controls { grid-template-columns: repeat(3, 56px); }

.battle-page .battle-card,
.battle-page .empty-slot { min-height: 500px; border-radius: 26px; }

.battle-page .stat-grid { grid-template-columns: 1fr 1fr; }
}
