/* Theme and palette tokens live in tokens.css, shared with the server-rendered pages. Importing it here keeps index.html (compiled into the server) unchanged. */
@import url("tokens.css");
    *, *::before, *::after { box-sizing: border-box; }
    :root {
      font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
      font-size: 100%;
      line-height: 1.5;
      -webkit-font-smoothing: antialiased;
    }
    * { box-sizing: border-box; }
    body { margin: 0; background: var(--hero-glow) no-repeat, var(--bg); color: var(--ink); font-size: .9375rem; }
    h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -.01em; font-weight: 650; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.125rem; }
    h4 { font-size: 1rem; }
    button, input, select, textarea { font: inherit; font-size: .875rem; }
    button, select, input, textarea {
      border: 1px solid var(--line);
      border-radius: var(--radius);
      background: var(--panel-raised);
      color: inherit;
      padding: .5rem .75rem;
    }
    input, select, textarea { background: var(--field); }
    input::placeholder, textarea::placeholder { color: var(--muted); }
    button { cursor: pointer; font-weight: 500; transition: background-color .12s ease, border-color .12s ease, color .12s ease; }
    button:hover { background: var(--panel-hover); border-color: var(--line-strong); }
    button:disabled { cursor: not-allowed; opacity: .55; }
    :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
    input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 0; border-color: var(--accent); }
    a { color: var(--link); text-underline-offset: .18em; text-decoration-thickness: 1px; }
    a:hover { text-decoration-thickness: 2px; }
    /* ---------- Site header ---------- */
    .site-header {
      position: sticky;
      top: 0;
      z-index: 20;
      background: var(--header-bg);
      border-bottom: 1px solid var(--line);
    }
    .header-inner :focus-visible { outline-color: var(--header-focus); }
    .header-inner, .header-selectors, main, .site-footer, .global-status {
      width: 100%;
      max-width: 1640px;
      margin-inline: auto;
      padding-inline: var(--page-gutter);
    }
    .header-inner { display: flex; align-items: center; gap: 1.5rem; min-height: 3.75rem; padding-block: .5rem; }
    .brand { flex: none; min-width: 0; }
    .brand-link { display: block; color: inherit; text-decoration: none; }
    .brand h1 { margin: 0; color: var(--header-ink); font-size: 1.0625rem; font-weight: 700; letter-spacing: -.015em; white-space: nowrap; }
    /* The wordmark takes Ho-Oh's ember-to-gold plumage. Forced-colors mode falls back to plain text. */
    .brand h1 .brand-accent { color: var(--header-accent); background: var(--wordmark); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
    @media (forced-colors: active) { .brand h1 .brand-accent { background: none; -webkit-text-fill-color: currentColor; } }
    .search-wrap { position: relative; flex: 1 1 auto; min-width: 0; max-width: 30rem; }
    #globalSearch {
      width: 100%;
      height: 2.25rem;
      padding-left: 2.25rem;
      background: var(--field) var(--icon-search) no-repeat .75rem 50%;
    }
    .search-suggestions { position: absolute; top: calc(100% + .375rem); left: 0; right: 0; z-index: 30; display: none; padding: .25rem; border-radius: var(--radius-lg); background: var(--panel-raised); box-shadow: var(--shadow-pop); overflow: hidden; }
    .search-suggestions.active { display: block; }
    .search-suggestion { display: block; width: 100%; min-height: 0; padding: .5rem .625rem; border: 0; border-radius: var(--radius-sm); background: transparent; color: inherit; text-align: left; }
    .search-suggestion:hover, .search-suggestion:focus-visible { background: var(--panel-hover); }
    .muted { color: var(--muted); }

    /* Filter bar: regulation, format and data source */
    /* Ho-Oh's crimson, gold and emerald as a horizon line under the masthead. Decorative only. */
    .header-filters { background: var(--brand-stripe) top / 100% var(--stripe-height) no-repeat, var(--bg); }
    .header-selectors {
      display: grid;
      grid-template-columns: minmax(11rem, 15rem) minmax(7rem, 9rem) minmax(8rem, 10rem) minmax(0, 1fr);
      align-items: end;
      gap: .5rem .75rem;
      padding-block: .5rem .625rem;
    }
    .filter-field { display: grid; gap: .25rem; min-width: 0; }
    .filter-label { color: var(--muted); font-size: .6875rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
    .header-selectors select {
      width: 100%;
      height: 2.125rem;
      padding: 0 2rem 0 .625rem;
      -webkit-appearance: none;
      appearance: none;
      background: var(--field) var(--icon-chevron) no-repeat right .625rem center;
      text-overflow: ellipsis;
      white-space: nowrap;
      cursor: pointer;
    }
    .header-meta { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: .125rem 1rem; min-width: 0; margin: 0; padding-bottom: .5rem; color: var(--muted); font-size: .8125rem; text-align: right; }
    .header-meta span:empty { display: none; }
    #period { flex: 0 1 14rem; min-width: 10rem; }
    main { padding-block: 2rem 3rem; text-align: left; }

    /* Section tabs */
    .tabs { display: flex; gap: .25rem; margin: 0 0 1.25rem; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
    .tabs::-webkit-scrollbar { display: none; }
    .tab { flex: none; min-height: 0; margin-bottom: -1px; padding: .625rem 1rem; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--muted); font-weight: 500; }
    .tab:hover { background: transparent; color: var(--ink); }
    .tab.active { border-bottom-color: var(--accent-strong); background: transparent; color: var(--ink); -webkit-text-stroke: .03em currentColor; }
    /* The stroke thickens the active label without changing its width, so neighboring tabs never shift. High Contrast turns transparent borders visible, which would underline every tab, so both states get explicit system colors. */
    @media (forced-colors: active) {
      .tab { border-bottom-color: Canvas; }
      .tab.active { border-bottom-color: Highlight; }
    }

    /* Primary navigation */
    .site-nav { display: flex; align-items: center; gap: .125rem; margin-left: auto; }
    .site-nav-regulation { position: relative; }
    /* While open, extend the dropdown down to its menu so the pointer never crosses a gap outside it. */
    .site-nav-regulation[open] { padding-bottom: .375rem; margin-bottom: -.375rem; }
    .site-nav-regulation > summary {
      display: flex;
      align-items: center;
      gap: .375rem;
      height: 2.25rem;
      padding: 0 .75rem;
      border-radius: var(--radius);
      color: var(--header-ink-muted);
      font-size: .875rem;
      font-weight: 500;
      list-style: none;
      white-space: nowrap;
      cursor: pointer;
      user-select: none;
    }
    .site-nav-regulation > summary::-webkit-details-marker { display: none; }
    .site-nav-regulation > summary::after { content: ''; width: .375rem; height: .375rem; margin-top: -.2rem; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; opacity: .7; transform: rotate(45deg); transition: transform .15s ease; }
    .site-nav-regulation[open] > summary::after { margin-top: .2rem; transform: rotate(-135deg); }
    .site-nav-regulation > summary:hover, .site-nav-regulation[open] > summary { background: var(--header-hover); color: var(--header-ink); }
    .site-nav-regulation-menu { position: absolute; top: 100%; right: 0; z-index: 30; display: grid; gap: 1px; min-width: 13rem; padding: .25rem; border-radius: var(--radius-lg); background: var(--panel-raised); box-shadow: var(--shadow-pop); }
    .site-nav-regulation-menu button, .site-nav-regulation-menu a, .site-nav-mobile-content button, .site-nav-mobile-content a {
      display: flex;
      align-items: center;
      width: 100%;
      min-height: 2.25rem;
      padding: .375rem .625rem;
      border: 0;
      border-radius: var(--radius-sm);
      background: transparent;
      color: var(--ink);
      font-size: .875rem;
      font-weight: 400;
      text-align: left;
      text-decoration: none;
      cursor: pointer;
    }
    .site-nav-regulation-menu button:hover, .site-nav-regulation-menu a:hover,
    .site-nav-mobile-content button:hover, .site-nav-mobile-content a:hover,
    .site-nav-regulation-menu button:focus-visible, .site-nav-regulation-menu a:focus-visible,
    .site-nav-mobile-content button:focus-visible, .site-nav-mobile-content a:focus-visible { background: var(--panel-hover); }
    .site-nav-regulation-menu .active, .site-nav-mobile-content .active { color: var(--accent-strong); font-weight: 600; }
    .site-nav-regulation-menu .active::after, .site-nav-mobile-content .active::after { content: ''; flex: none; width: .55rem; height: .3rem; margin: -.15rem .125rem 0 auto; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); }
    .site-nav-mobile-menu { display: none; }
    .site-nav-mobile-menu > summary { gap: .5rem; border: 1px solid var(--header-line); }
    .site-nav-mobile-menu > summary::after { display: none; }
    .site-nav-mobile-menu > summary::before {
      content: '';
      order: 2;
      width: 1rem;
      height: .75rem;
      background: linear-gradient(currentColor 0 0) top / 100% 1.5px no-repeat, linear-gradient(currentColor 0 0) center / 100% 1.5px no-repeat, linear-gradient(currentColor 0 0) bottom / 100% 1.5px no-repeat;
    }
    .site-nav-mobile-content { position: absolute; top: 100%; right: 0; z-index: 30; display: grid; gap: 1px; width: min(18rem, calc(100vw - 2rem)); max-height: calc(100vh - 5rem); overflow-y: auto; padding: .375rem; border-radius: var(--radius-lg); background: var(--panel-raised); box-shadow: var(--shadow-pop); }
    .site-nav-mobile-content h3 { margin: .625rem .625rem .25rem; color: var(--muted); font-size: .6875rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
    .site-nav-mobile-content h3:first-child { margin-top: .25rem; }
    .display-group { display: grid; gap: 1px; min-width: 0; margin: 0; padding: .25rem .375rem .375rem; border: 0; }
    .display-group + .display-group { border-top: 1px solid var(--line); }
    .display-group legend { margin: 0 0 .125rem; padding: 0; color: var(--muted); font-size: .6875rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
    .display-group input[type="radio"] { appearance: none; flex: none; display: grid; place-content: center; width: 1rem; height: 1rem; margin: 0; padding: 0; border: 1.5px solid var(--muted); border-radius: 50%; background: var(--field); }
    .display-group input[type="radio"]:checked { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 3px var(--panel); }
    .display-group input[type="radio"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
    .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
    .entry-card { max-width: 42rem; margin: 3rem auto; }
    .panel { display: none; }
    .panel.active { display: block; }
    #regulationDataView { display: none; }
    .detail-page { display: none; }
    .detail-page.active { display: flex; flex-direction: column; align-items: center; margin-top: 2rem; text-align: center; }
    .detail-back { display: block; position: static; margin: 0 auto .75rem; }
    .detail-page > .detail-card > .detail-back { margin: 0 0 .75rem; }
    #tournamentPlayerPage > .detail-card > .detail-back { margin: 0 0 .75rem; }
    .detail-title-row { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; margin-bottom: .5rem; }
    .detail-title-row .detail-back { position: absolute; top: 50%; left: 0; transform: translateY(-50%); }
    .detail-title-row h3 { min-width: 0; margin: 0; }
    .tournament-team-sprites { display: flex; justify-content: center; align-items: center; gap: .15rem; min-height: 2.5rem; }
    .tournament-team-sprites img { width: 2.5rem; height: 2.5rem; object-fit: contain; }
    .detail-card { width: 100%; box-sizing: border-box; padding: 1.25rem; border: 1px solid var(--card-border); border-radius: 9px; background: var(--panel); box-shadow: var(--card-shadow); }
    .detail-card h3 { margin-top: 0; color: var(--accent-strong); }
    .detail-card h4 { margin: 1.5rem auto .65rem; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--accent); }
    .detail-card h4:first-of-type { margin-top: .5rem; padding-top: 0; border-top: 0; }
    .detail-card.detail-unavailable { box-shadow: 0 0 0 3px var(--danger); }
    .detail-unavailable-note { margin: -.25rem auto 1rem; color: var(--danger); font-weight: bold; }
    .detail-pokemon-sprite { display: block; width: 128px; height: 128px; object-fit: contain; margin: 0 auto .5rem; }
    .detail-pokemon-forms { display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem; margin: 0 auto 1rem; }
    .detail-pokemon-form { padding: .35rem .6rem; border: 1px solid var(--line); border-radius: 999px; background: var(--panel-raised); color: var(--ink); }
    .detail-pokemon-form.active { border-color: var(--accent-strong); color: var(--accent-strong); }
    .detail-stat-bars { display: grid; gap: .35rem; text-align: left; }
    .detail-stat-graph { position: relative; margin: 0 auto 1rem; max-width: 38rem; }
    .detail-stat-graph h4 { margin: .5rem auto .35rem; padding: 0; border: 0; color: var(--muted); font-size: 1rem; font-weight: normal; }
    .detail-stat-options { position: relative; z-index: 1; display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem .75rem; margin-bottom: .35rem; }
    .detail-stat-option { display: inline-flex; align-items: center; gap: .25rem; color: var(--muted); cursor: pointer; }
    .detail-stat-tooltip { position: absolute; z-index: 2; display: none; min-width: max-content; padding: .35rem .5rem; border: 1px solid var(--line); border-radius: 5px; background: var(--panel-raised); color: var(--ink); box-shadow: 0 4px 12px var(--scrim); font-size: .8rem; white-space: pre; pointer-events: none; }
    .detail-stat-summary-hit { pointer-events: all; }
    .detail-stat-summary-target { pointer-events: stroke; }
    .detail-stat-option input { accent-color: var(--accent); }
    .detail-stat-chart { display: block; width: 100%; height: 11rem; overflow: visible; }
    .detail-stat-axis { stroke: var(--line); stroke-width: 1; }
    .detail-stat-distribution { opacity: .85; }
    .detail-stat-distribution-hit { pointer-events: stroke; }
    .detail-stat-nature-line { stroke-width: 2.5; }
    .detail-stat-base-marker { pointer-events: all; }
    .detail-stat-nature-marker { cursor: grab; pointer-events: all; touch-action: none; }
    .detail-stat-nature-marker:active { cursor: grabbing; }
    .detail-stat-bar { display: grid; grid-template-columns: 3.5rem minmax(8rem, 1fr) 2.5rem; align-items: center; gap: .45rem; }
    .detail-stat-track { height: .65rem; overflow: hidden; border-radius: 999px; background: var(--line); }
    .detail-stat-fill { position: relative; display: block; height: 100%; overflow: hidden; border-radius: inherit; background: linear-gradient(90deg, var(--nature-down) 0%, var(--stat-mid) 50%, var(--nature-up) 100%); transition: width .35s ease; }
    .detail-stat-fill.stat-max-shimmer::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 20%, var(--shimmer) 50%, transparent 80%); transform: translateX(-100%); animation: stat-max-shimmer 1.8s ease-in-out infinite; }
    @keyframes stat-max-shimmer { to { transform: translateX(100%); } }
    .detail-ability-list { display: grid; gap: .3rem; text-align: left; }
    .detail-ability-entry { display: grid; grid-template-columns: minmax(7rem, auto) 1fr; gap: .5rem; align-items: baseline; }
    .detail-ability-entry a { color: var(--accent); }
    .detail-type-effects { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; }
    .detail-type-effect-group { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .25rem; }
    .detail-type-effect-group + .detail-type-effect-group { padding-left: .75rem; }
    .detail-type-effect-entry { display: inline-flex; align-items: center; justify-content: center; gap: .25rem; width: 7rem; min-width: 7rem; max-width: 7rem; padding-left: 0; }
    .detail-type-effect-multiplier { width: 1.5rem; text-align: right; }
    .detail-moves-table { width: 100%; min-width: 0; table-layout: fixed; font-size: .82rem; }
    .detail-moves-table th, .detail-moves-table td { padding: .35rem .25rem; }
    .detail-moves-table th { white-space: normal; overflow-wrap: anywhere; line-height: 1.15; }
    .detail-moves-table th:first-child, .detail-moves-table td:first-child { width: 16%; text-align: left; }
    .detail-moves-table th:nth-child(2), .detail-moves-table td:nth-child(2) { width: 11%; }
    .detail-moves-table th:nth-child(3), .detail-moves-table td:nth-child(3) { width: 14%; }
    .detail-moves-table th:nth-child(4), .detail-moves-table td:nth-child(4) { width: 9%; }
    .detail-moves-table th:nth-child(5), .detail-moves-table td:nth-child(5) { width: 11%; }
    .detail-moves-table th:nth-child(6), .detail-moves-table td:nth-child(6) { width: 9%; }
    .detail-moves-table th:nth-child(7), .detail-moves-table td:nth-child(7),
    .detail-moves-table th:nth-child(8), .detail-moves-table td:nth-child(8) { width: 15%; font-size: .76rem; }
    .detail-moves-table .sort-button { white-space: normal; line-height: 1.15; }
    .detail-move-header-short { display: none; }
    .detail-moves-table .detail-move-filter { margin-left: .1rem; }
    .detail-usage-note { margin: .75rem auto 0; max-width: 900px; color: var(--muted); font-size: .82rem; text-align: center; }
    .detail-table { width: 100%; min-width: 0; max-width: 100%; margin: 0 auto 1rem; border-collapse: collapse; }
    .detail-table th, .detail-table td { text-align: center; }
    .detail-table th, .detail-table td, .detail-moves-table th, .detail-moves-table td { border-bottom: 0; }
    .detail-table th { width: 10rem; }
    .detail-table a, .move-effect a { color: var(--accent); }
    .tournament-history-table { min-width: 0; }
    .tournament-history-table th, .tournament-history-table td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
    .tournament-history-table th:last-child, .tournament-history-table td:last-child { border-right: 0; }
    .tournament-history-table tr:last-child td { border-bottom: 0; }
    .tournament-history-row { cursor: pointer; }
    .tournament-history-row:hover td, .tournament-history-row:focus td { background: var(--row-hover); }
    .tournament-history-table td::before { display: none; }
    @media (max-width: 700px) {
      #pokemonResults, #itemResults, #moveResults, #abilityResults {
        overflow: visible;
        border: 0;
      }
      #pokemonResults table, #itemResults table, #moveResults table, #abilityResults table {
        display: block;
        min-width: 0;
      }
      #pokemonResults thead, #itemResults thead, #moveResults thead, #abilityResults thead {
        display: none;
      }
      #pokemonResults tbody, #itemResults tbody, #moveResults tbody, #abilityResults tbody {
        display: grid;
        gap: .5rem;
      }
      #pokemonResults tr, #itemResults tr, #moveResults tr, #abilityResults tr {
        display: grid;
        width: 100%;
        min-width: 0;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: var(--panel);
        overflow: hidden;
      }
      #pokemonResults td, #itemResults td, #moveResults td, #abilityResults td {
        min-width: 0;
        border: 0;
        padding: .4rem .5rem;
      }
      #pokemonResults tr { grid-template-columns: 4rem minmax(0, 1fr) 4.5rem; }
      #pokemonResults td:first-child { display: none; }
      #pokemonResults td:nth-child(2) {
        grid-column: 1 / span 2;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        text-align: left;
      }
      #pokemonResults td:nth-child(3) {
        display: flex;
        grid-column: 3;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: .05rem;
        padding-inline: .25rem;
      }
      #pokemonResults td:nth-child(2)::before,
      #pokemonResults td:nth-child(3)::before {
        display: none;
        content: none;
      }
      #pokemonResults td:nth-child(n+4) {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        gap: .2rem;
        align-items: center;
        border-top: 1px solid var(--line);
        font-variant-numeric: tabular-nums;
        text-align: right;
        min-width: 0;
        overflow: hidden;
        white-space: nowrap;
      }
      #pokemonResults td:nth-child(n+4)::before {
        color: var(--accent-strong);
        font-size: .7rem;
        text-align: left;
      }
      #pokemonResults td:nth-child(4)::before { content: 'HP'; }
      #pokemonResults td:nth-child(5)::before { content: 'Atk'; }
      #pokemonResults td:nth-child(6)::before { content: 'Def'; }
      #pokemonResults td:nth-child(7)::before { content: 'SpA'; }
      #pokemonResults td:nth-child(8)::before { content: 'SpD'; }
      #pokemonResults td:nth-child(9)::before { content: 'Spe'; }
      #pokemonResults .pokemon-name {
        display: flex;
        align-items: center;
        gap: .25rem;
        width: 100%;
        min-width: 0;
        margin: 0;
        transform: none;
        overflow: hidden;
      }
      #pokemonResults .pokemon-name-text {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      #pokemonResults .sprite, #pokemonResults .sprite-placeholder {
        width: 3.5rem;
        height: 3.5rem;
      }
      #pokemonResults .type-icon { margin: 0; line-height: 0; }
      #pokemonResults .type-sprite { width: 2.5rem; height: 1.1rem; margin: 0; }

      #itemResults tr { grid-template-columns: minmax(0, 1fr) auto; }
      #itemResults td:first-child, #itemResults td:last-child { display: none; }
      #itemResults td:nth-child(2) {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        text-align: left;
        font-weight: 600;
      }
      #itemResults td:nth-child(3) {
        display: flex;
        align-items: center;
        justify-content: flex-end;
      }

      #moveResults tr { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      #moveResults td:nth-child(3), #moveResults td:last-child { display: none; }
      #moveResults td:nth-child(1) {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        text-align: left;
        font-weight: 600;
      }
      #moveResults td:nth-child(2) {
        display: flex;
        align-items: center;
        justify-content: flex-end;
      }
      #moveResults td:nth-child(n+4) {
        display: grid;
        grid-template-columns: auto 1fr;
        gap: .2rem;
        align-items: center;
        border-top: 1px solid var(--line);
        text-align: right;
      }
      #moveResults td:nth-child(4)::before { content: 'Category'; }
      #moveResults td:nth-child(5)::before { content: 'Power'; }
      #moveResults td:nth-child(6)::before { content: 'Accuracy'; }
      #moveResults td:nth-child(7)::before { content: 'PP'; }
      #moveResults td:nth-child(8)::before { content: 'Priority'; }
      #moveResults td:nth-child(n+4)::before {
        color: var(--accent-strong);
        font-size: .7rem;
        text-align: left;
      }

      #abilityResults tr { grid-template-columns: 1fr; }
      #abilityResults td:first-child {
        padding-bottom: .2rem;
        color: var(--accent-strong);
        font-weight: 600;
        text-align: left;
      }
      #abilityResults td:last-child {
        padding-top: .2rem;
        color: var(--muted);
        font-size: .82rem;
        line-height: 1.3;
        text-align: left;
      }
      .tournament-history-table { display: block; width: 100%; min-width: 0; }
      .tournament-history-table thead { display: none; }
      .tournament-history-table tbody { display: grid; width: 100%; gap: .75rem; }
      .tournament-history-table tr { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; gap: .35rem; padding: .75rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); text-align: center; }
      .player-profile-table tr { width: 100%; box-sizing: border-box; }
      .player-profile-table td { width: 100%; min-width: 0; box-sizing: border-box; }
      .player-profile-table tbody, .player-profile-table tr { display: block; width: 100%; }
      .tournament-history-table tr:last-child td { border-bottom: 0; }
      .tournament-history-table td { display: flex; grid-column: 1 / -1; flex: 1 1 100%; flex-direction: column; align-items: center; justify-self: stretch; width: 100%; min-width: 0; gap: .15rem; padding: .35rem; border: 0; text-align: center; }
      .tournament-history-table td::before { display: block; content: attr(data-label); color: var(--accent-strong); font-size: .78rem; font-weight: 600; }
      .player-profile-table td { display: flex; width: 100% !important; min-width: 100% !important; max-width: 100%; box-sizing: border-box; }
      .tournament-detail-player-table tr { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
      .tournament-detail-player-table td, .tournament-detail-player-table td:nth-child(n) { width: 100%; box-sizing: border-box; justify-content: center; }
      .tournament-detail-player-table td:last-child { grid-column: 1 / -1; }
    }
    .tournament-history-pagination { display: flex; justify-content: center; align-items: center; gap: .75rem; margin-top: .75rem; }
    .pagination-controls { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: .75rem; margin-top: .75rem; }
    .pagination-controls label { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted); }
    .pagination-controls select { padding: .2rem .35rem; }
    .pagination-go { display: inline-flex; align-items: center; gap: .35rem; margin: 0; }
    .pagination-go input { width: 4.5rem; }
    .pagination-go input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
    .pagination-go input[type="number"]::-webkit-inner-spin-button, .pagination-go input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
    .pagination-empty { color: var(--muted); text-align: center; }
    .player-list-table { width: 100%; min-width: 0; table-layout: fixed; font-size: .85rem; }
    .player-list-table th, .player-list-table td { padding: .45rem .35rem; overflow-wrap: anywhere; }
    .player-list-table th { overflow-wrap: normal; word-break: normal; hyphens: none; }
    .tournament-detail-player-table th:nth-child(1), .tournament-detail-player-table td:nth-child(1) { width: 19%; }
    .tournament-detail-player-table th:nth-child(2), .tournament-detail-player-table td:nth-child(2) { width: 18%; }
    .tournament-detail-player-table th:nth-child(3), .tournament-detail-player-table td:nth-child(3) { width: 14%; }
    .tournament-detail-player-table th:nth-child(4), .tournament-detail-player-table td:nth-child(4) { width: 14%; }
    .tournament-detail-player-table th:nth-child(5), .tournament-detail-player-table td:nth-child(5) { width: 13%; }
    .tournament-detail-player-table th:nth-child(6), .tournament-detail-player-table td:nth-child(6) { width: 22%; }
    .tournament-team-sprites { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(2, 2rem); align-items: center; justify-items: center; gap: .1rem; width: 100%; min-height: 4.1rem; }
    .tournament-team-sprites img { width: min(2.25rem, 100%); height: 2rem; object-fit: contain; }
    /* The Team header is plain text; it matches the size of the sort buttons beside it. */
    .tournament-detail-player-table th { font-size: .875rem; }
    .tournament-detail-player-table th .sort-button { box-sizing: border-box; display: block; width: 100%; max-width: 100%; padding: 0 .15rem; overflow-wrap: normal; word-break: normal; white-space: normal; line-height: 1.15; }
    .tournament-player-team-table { width: 100%; min-width: 0; table-layout: fixed; }
    .tournament-player-team-table th, .tournament-player-team-table td { min-width: 0; overflow-wrap: normal; word-break: keep-all; white-space: normal; }
    .tournament-player-team-table th { white-space: normal; overflow-wrap: normal; word-break: keep-all; line-height: 1.1; }
    .tournament-player-team-table th:nth-child(1), .tournament-player-team-table td:nth-child(1) { width: 12%; }
    .tournament-player-team-table th:nth-child(2), .tournament-player-team-table td:nth-child(2) { width: 12%; }
    .tournament-player-team-table th:nth-child(3), .tournament-player-team-table td:nth-child(3) { width: 13%; }
    .tournament-player-team-table th:nth-child(4), .tournament-player-team-table td:nth-child(4) { width: 15%; }
    .tournament-player-team-table th:nth-child(5), .tournament-player-team-table td:nth-child(5) { width: 16%; }
    .tournament-player-team-table th:nth-child(6), .tournament-player-team-table td:nth-child(6) { width: 32%; }
    .tournament-player-pokemon-sprite { display: block; width: 4rem; height: 4rem; margin: 0 auto; object-fit: contain; }
    .tournament-player-types { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: .15rem; }
    .tournament-player-types .type-icon { margin: 0; }
    .tournament-player-types .type-sprite { width: 3.5rem; height: 1.4rem; }
    .tournament-player-moves { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; width: 100%; }
    .tournament-player-move { position: relative; min-width: 0; min-height: 2.5rem; padding: .35rem .25rem; box-sizing: border-box; overflow-wrap: normal; word-break: keep-all; text-align: center; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
    .tournament-player-move:nth-child(2n) { border-right: 0; }
    .tournament-player-move:nth-child(n+3) { border-bottom: 0; }
    /* Whole-cell links: the link covers its cell, and its text stays in place */
    .tournament-player-team-table td.linked-cell { position: relative; }
    .tournament-round-results-table td.linked-cell { position: relative; }
    .tournament-player-team-table td.linked-cell > .entity-link::after,
    .tournament-round-results-table td.linked-cell > a::after,
    .tournament-player-move > .entity-link::after { content: ""; position: absolute; inset: 0; }
    .tournament-round-results-table { width: 100%; min-width: 0; table-layout: fixed; }
    .tournament-round-results-table th, .tournament-round-results-table td { min-width: 0; overflow-wrap: anywhere; word-break: normal; white-space: normal; }
    .tournament-round-results-table th { font-size: .8rem; line-height: 1.15; }
    .tournament-round-results-table th:nth-child(1), .tournament-round-results-table td:nth-child(1),
    .tournament-round-results-table th:nth-child(6), .tournament-round-results-table td:nth-child(6) { width: 18%; white-space: nowrap; overflow-wrap: normal; }
    .tournament-round-results-table th:nth-child(2), .tournament-round-results-table td:nth-child(2),
    .tournament-round-results-table th:nth-child(5), .tournament-round-results-table td:nth-child(5) { width: 18%; }
    .tournament-round-results-table th:nth-child(3), .tournament-round-results-table td:nth-child(3),
    .tournament-round-results-table th:nth-child(4), .tournament-round-results-table td:nth-child(4) { width: 14%; }
    /* Tournament table headers wrap only between words, never inside one. */
    :is(.tournament-history-table, .player-profile-table, .tournament-round-results-table, .tournament-player-team-table) th,
    :is(.tournament-history-table, .player-profile-table, .tournament-round-results-table, .tournament-player-team-table) th .sort-button { white-space: normal; overflow-wrap: normal; word-break: normal; hyphens: none; }
    @media (max-width: 700px) {
      .tournament-detail-player-table td, .tournament-detail-player-table td:nth-child(n) { width: 100%; }
      .tournament-player-team-table td, .tournament-player-team-table td:nth-child(n) { width: 100%; }
      .tournament-player-team-table tr { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
      .tournament-player-team-table td:nth-child(6) { grid-column: 1 / -1; }
      .tournament-round-results-table tr { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
      .tournament-round-results-table td, .tournament-round-results-table td:nth-child(n) { width: 100%; }
      .tournament-round-results-table td:nth-child(1), .tournament-round-results-table td:nth-child(6) { white-space: nowrap; }
      .tournament-round-results-table td:nth-child(2), .tournament-round-results-table td:nth-child(5) { grid-column: span 1; }
    }
    .player-profile-section { margin-top: 1.25rem; }
    .player-profile-table { width: 100%; table-layout: fixed; font-size: .85rem; margin-bottom: 1.25rem; }
    .player-profile-table th, .player-profile-table td { padding: .45rem .35rem; overflow-wrap: anywhere; }
    .player-profile-results-table th:nth-child(1), .player-profile-results-table td:nth-child(1) { width: 24%; }
    .player-profile-results-table th:nth-child(2), .player-profile-results-table td:nth-child(2) { width: 18%; }
    .player-profile-results-table th:nth-child(3), .player-profile-results-table td:nth-child(3) { width: 15%; }
    .player-profile-results-table th:nth-child(4), .player-profile-results-table td:nth-child(4) { width: 14%; }
    .player-profile-results-table th:nth-child(5), .player-profile-results-table td:nth-child(5) { width: 12%; }
    .player-profile-results-table th:nth-child(6), .player-profile-results-table td:nth-child(6) { width: 17%; }
    .player-placement-chart { margin: 1.25rem 0; padding: .75rem; border: 1px solid var(--line); background: var(--panel); }
    .player-placement-chart-controls { display: flex; align-items: center; gap: .5rem; margin-top: .75rem; }
    .player-placement-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
    .player-placement-chart .chart-axis, .player-placement-chart .chart-grid { stroke: var(--line); stroke-width: 1; }
    .player-placement-chart .chart-grid { stroke-dasharray: 3 3; }
    .player-placement-chart .chart-label { fill: var(--muted); font-size: 11px; }
    .player-placement-chart .chart-line { fill: none; stroke: var(--accent-strong); stroke-width: 2; opacity: .7; }
    .player-placement-chart .chart-point { fill: var(--accent-strong); stroke: var(--ink); stroke-width: 1.5; cursor: pointer; }
    .player-placement-chart .chart-point:focus, .player-placement-chart .chart-point:hover { fill: var(--ink); }
    .player-placement-chart .chart-point:focus-visible { stroke: var(--accent); stroke-width: 3; }
    .player-placement-chart-empty { margin: .5rem 0; }
    .player-profile-table th:nth-child(1), .player-profile-table td:nth-child(1) { width: 30%; }
    .player-profile-table th:nth-child(2), .player-profile-table td:nth-child(2) { width: 17%; }
    .player-profile-table th:nth-child(3), .player-profile-table td:nth-child(3) { width: 17%; }
    .player-profile-table th:nth-child(4), .player-profile-table td:nth-child(4) { width: 15%; }
    .player-profile-table th:nth-child(5), .player-profile-table td:nth-child(5) { width: 21%; }
    .player-profile-sprite { width: 2rem; height: 2rem; object-fit: contain; }
    .player-profile-sprites { display: grid; grid-template-columns: repeat(3, 2rem); grid-template-rows: repeat(2, 2rem); justify-content: center; gap: .1rem; }
    .player-profile-usage-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; width: 100%; margin: 0 auto 1rem; }
    .player-profile-usage-entry.player-profile-usage-entry-text { grid-template-columns: minmax(0, 1fr); padding-inline: .35rem; }
    @media (max-width: 1100px) { .player-profile-usage-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
    .player-profile-usage-note { font-size: .85rem; margin: 0; }
    .player-profile-usage-card { min-width: 0; padding: .75rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
    .player-profile-usage-card h4 { margin: 0 0 .6rem; padding: 0; border: 0; color: var(--accent-strong); }
    .player-profile-usage-list { display: grid; gap: .5rem; }
    .player-profile-usage-entry { display: grid; grid-template-columns: 2.5rem minmax(0, max-content); grid-template-rows: auto auto; align-content: center; align-items: center; justify-content: center; column-gap: .5rem; min-width: 0; text-align: center; }
    .player-profile-usage-entry > img, .player-profile-usage-entry > span[aria-hidden="true"] { grid-row: 1 / 3; }
    .player-profile-usage-entry-name { min-width: 0; overflow-wrap: anywhere; line-height: 1.2; }
    .player-profile-usage-entry-percentage { min-width: 0; overflow: hidden; color: var(--muted); font-size: .75rem; line-height: 1.2; white-space: nowrap; text-overflow: ellipsis; }
    .player-profile-usage-table { table-layout: fixed; }
    .player-profile-usage-table th, .player-profile-usage-table td { width: 16.666%; padding: .4rem .25rem; }
    .player-profile-usage-table .usage-value { overflow-wrap: anywhere; }
    .player-profile-usage-sprite { width: 2.5rem; height: 2.5rem; object-fit: contain; display: block; margin: 0 auto; }
    .move-attributes-table th, .move-attributes-table td { width: 16.666%; padding: .45rem .3rem; font-size: .8rem; }
    .move-effect { width: min(100%, 900px); margin: 0 auto 1rem; text-align: center; }
    .detail-item-sprite { width: 80px; height: 80px; object-fit: contain; margin: 0 auto .5rem; display: block; }
    .move-tags-table { width: 100%; min-width: 0; max-width: 100%; margin: 0 auto 1rem; table-layout: fixed; }
    .move-tags-table td { width: 16.666%; padding: .35rem .2rem; }
    .move-tag-name { display: block; overflow-wrap: anywhere; font-size: .68rem; line-height: 1.1; }
    .move-tag-status { display: block; margin-top: .12rem; font-size: 1rem; font-weight: bold; line-height: 1; }
    .move-tag-status.active { color: var(--status-on); }
    .move-tag-status.inactive { color: var(--status-off); }
    .detail-abilities-table th:first-child, .detail-abilities-table td:first-child { width: 25%; text-align: left; }
    .detail-abilities-table th:nth-child(2), .detail-abilities-table td:nth-child(2) { width: 45%; text-align: left; font-size: .76rem; }
    .detail-abilities-table th:nth-child(3), .detail-abilities-table td:nth-child(3),
    .detail-abilities-table th:nth-child(4), .detail-abilities-table td:nth-child(4) { width: 15%; font-size: .76rem; }
    [data-entity-type] { cursor: pointer; }
    [data-entity-type]:hover td { background: var(--row-hover); }
    .toolbar { display: flex; justify-content: center; gap: .75rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
    .pokemon-toolbar { justify-content: space-between; }
    .pokemon-toolbar-filters { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
    .table-count { margin-left: auto; }
    .table-filter { display: inline-flex; align-items: center; gap: .35rem; }
    .table-filter input[type="checkbox"] { min-width: 1rem; width: 1rem; height: 1rem; padding: 0; margin: 0; transform: translateY(1px); }
    .toolbar input { min-width: min(100%, 300px); }
    .notice { padding: .8rem 1rem; border-left: 3px solid var(--accent-strong); background: var(--notice-bg); color: var(--muted); }
    .cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .75rem; }
    .card { padding: 1rem; border: 1px solid var(--card-border); border-radius: 9px; background: var(--panel); box-shadow: var(--card-shadow); }
    .card strong { display: block; font-size: 1.4rem; color: var(--accent-strong); }
    .table-wrap {
      max-width: 100%;
      min-width: 0;
      overflow-x: auto;
      overscroll-behavior-x: contain;
      -webkit-overflow-scrolling: touch;
      border: 1px solid var(--line);
      border-radius: 8px;
    }
    .table-wrap:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 2px; }
    .table-scroll-top {
      max-width: 100%;
      min-width: 0;
      margin-bottom: .25rem;
      overflow-x: auto;
      overscroll-behavior-x: contain;
      -webkit-overflow-scrolling: touch;
      border: 1px solid var(--line);
      border-radius: 8px;
    }
    .table-scroll-top > div { height: 1px; min-width: 720px; }
    #pokemonScrollTop > div { min-width: 65.5rem; }
    table { width: 100%; border-collapse: collapse; min-width: 720px; }
    table th, table td { overflow-wrap: normal; word-break: normal; }
    #pokemonResults table { table-layout: fixed; min-width: 65.5rem; }
    #itemResults table { table-layout: fixed; min-width: 40rem; }
    #abilityResults table { min-width: 0; }
    #itemResults th:nth-child(1), #itemResults td:nth-child(1) { width: 5.5rem; }
    #itemResults th:nth-child(2), #itemResults td:nth-child(2) { width: 10rem; }
    #itemResults th:nth-child(3), #itemResults td:nth-child(3) { width: 8rem; }
    #itemResults .item-type-list { display: flex; flex-direction: column; align-items: center; gap: .15rem; }
    #pokemonResults th:nth-child(1), #pokemonResults td:nth-child(1) { width: 6rem; }
    #pokemonResults th:nth-child(2), #pokemonResults td:nth-child(2) { width: 16.75rem; }
    #pokemonResults th:nth-child(3), #pokemonResults td:nth-child(3) { width: 11.25rem; }
    #pokemonResults th:nth-child(n+4), #pokemonResults td:nth-child(n+4) { width: 5.25rem; padding-inline: .25rem; box-sizing: border-box; }
    th, td { padding: .65rem .75rem; border-bottom: 1px solid var(--line); text-align: center; vertical-align: middle; }
    th { color: var(--accent-strong); font-weight: normal; white-space: nowrap; }
    .sort-button { padding: 0; border: 0; background: transparent; color: inherit; }
    .sort-button:hover, .sort-button:focus-visible { color: var(--ink); }
    .type-filter { display: inline-block; position: relative; margin-left: .25rem; color: var(--ink); vertical-align: middle; }
    .type-filter summary { display: inline-flex; align-items: center; cursor: pointer; list-style: none; }
    .type-filter summary::-webkit-details-marker { display: none; }
    .filter-icon { width: 1rem; height: 1rem; display: block; fill: currentColor; }
    .type-filter-menu { position: fixed; z-index: 30; box-sizing: border-box; width: max-content; max-width: calc(100vw - 1rem); max-height: calc(100vh - 1rem); overflow-y: auto; min-width: 13rem; padding: .6rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .15rem .5rem; border: 1px solid var(--line); border-radius: 7px; background: var(--panel-raised); text-align: left; box-shadow: 0 5px 15px var(--scrim); }
    .item-type-filter-menu { width: min(20rem, calc(100vw - 1rem)); min-width: 0; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); box-sizing: border-box; }
    .item-type-filter-column { display: grid; align-content: start; gap: .15rem; }
    .type-filter-menu label { display: block; padding: .2rem; color: var(--ink); white-space: normal; }
    tr:last-child td { border-bottom: 0; }
    .sprite { width: 64px; height: 64px; object-fit: contain; image-rendering: auto; }
    .dex-number { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
    #pokemonResults th:first-child, #pokemonResults td:first-child { padding-left: .4rem; padding-right: .4rem; }
    #pokemonResults th:first-child .sort-button { white-space: normal; }
    #pokemonResults td .type-icon:last-child, #moveResults td .type-icon:last-child { margin-right: 0; }
    #moveResults th:nth-child(4) { min-width: 7rem; }
    .pokemon-name { display: grid; grid-template-columns: 64px max-content; align-items: center; gap: .7rem; width: var(--pokemon-content-width, max-content); margin: 0 auto; text-align: left; font-size: 1rem; }
    .pokemon-name-text, .species-line { white-space: nowrap; }
    .prefix-line { display: block; white-space: nowrap; }
    .variant-line { display: block; white-space: nowrap; }
    .form-prefix { display: inline; color: var(--muted); font-size: .78em; line-height: 1; }
    .mega-prefix {
      background: linear-gradient(90deg, #ff4d6d 0%, #ffd166 10%, #70e000 20%, #00bbf9 30%, #8338ec 40%, #ff4d6d 50%, #ffd166 60%, #70e000 70%, #00bbf9 80%, #8338ec 90%, #ff4d6d 100%);
      background-size: 200% 100%;
      background-clip: text;
      -webkit-background-clip: text;
      color: transparent;
      animation: mega-rainbow-shimmer 4s linear infinite;
    }
    @keyframes mega-rainbow-shimmer {
      from { background-position: 0% 0%; }
      to { background-position: 100% 0%; }
    }
    .species-line { display: block; }
    .sprite-placeholder { width: 64px; height: 64px; }
    .type { display: inline-block; padding: .25rem .35rem; margin: .1rem; border-radius: 5px; background: var(--chip); }
    .type-icon { display: inline-block; margin: .1rem .2rem .1rem 0; }
    .type-sprite { display: block; width: 76px; height: 30px; background-image: var(--type-icon-normal); background-size: contain; background-position: center; background-repeat: no-repeat; }
    .type-sprite.type-fire { background-image: var(--type-icon-fire); }
    .type-sprite.type-water { background-image: var(--type-icon-water); }
    .type-sprite.type-electric { background-image: var(--type-icon-electric); }
    .type-sprite.type-grass { background-image: var(--type-icon-grass); }
    .type-sprite.type-ice { background-image: var(--type-icon-ice); }
    .type-sprite.type-fighting { background-image: var(--type-icon-fighting); }
    .type-sprite.type-poison { background-image: var(--type-icon-poison); }
    .type-sprite.type-ground { background-image: var(--type-icon-ground); }
    .type-sprite.type-flying { background-image: var(--type-icon-flying); }
    .type-sprite.type-psychic { background-image: var(--type-icon-psychic); }
    .type-sprite.type-bug { background-image: var(--type-icon-bug); }
    .type-sprite.type-rock { background-image: var(--type-icon-rock); }
    .type-sprite.type-ghost { background-image: var(--type-icon-ghost); }
    .type-sprite.type-dragon { background-image: var(--type-icon-dragon); }
    .type-sprite.type-dark { background-image: var(--type-icon-dark); }
    .type-sprite.type-steel { background-image: var(--type-icon-steel); }
    .type-sprite.type-fairy { background-image: var(--type-icon-fairy); }
    .item-effect { min-width: 22rem; text-align: center; white-space: normal; overflow-wrap: anywhere; word-break: normal; line-height: 1.35; }
    .empty, .error { padding: 1rem; color: var(--muted); }
    .error { color: var(--danger); }
    .team-slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(2, auto); gap: .75rem; }
    .team-toolbar { justify-content: flex-start; margin-top: 2rem; }
    .team-toolbar-actions { display: flex; flex-wrap: wrap; gap: .35rem; }
    .team-format-options { display: flex; gap: .35rem; width: 100%; margin-top: .35rem; }
    .team-format-options[hidden] { display: none; }
    .team-import-panel { display: grid; gap: .35rem; width: 100%; margin-top: .5rem; }
    .team-import-panel[hidden] { display: none; }
    .team-import-panel textarea { width: 100%; min-height: 14rem; resize: vertical; font-family: monospace; }
    .team-import-actions { display: flex; gap: .35rem; }
    .team-slot { min-height: 130px; min-width: 0; border: 1px dashed var(--line); border-radius: 8px; display: grid; place-items: center; color: var(--muted); overflow: hidden; }
    .team-slot.team-slot-invalid { border: 3px solid var(--danger); }
    .team-slot-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; height: 100%; }
    .team-illegal { color: var(--danger) !important; }
    .team-slot strong { color: var(--ink); }
    .team-slot-content { display: grid; grid-template-columns: 56px minmax(0, 1fr); align-items: center; gap: .45rem; width: 100%; padding: .5rem; text-align: left; }
    .team-slot-sprite { width: 56px; height: 56px; object-fit: contain; grid-row: 1 / span 2; }
    .team-slot-details { display: grid; gap: .15rem; min-width: 0; }
    .team-slot-content strong { font-size: .82rem; overflow-wrap: anywhere; }
    .team-slot-name { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .3rem; min-width: 0; }
    .team-slot .role-badge { min-height: 1rem; max-width: 100%; margin: 0; padding: .05rem .35rem; font-size: .55rem; white-space: normal; text-align: center; border-radius: 6px; }
    .team-slot-summary { color: var(--muted); font-size: .64rem; line-height: 1.15; overflow-wrap: anywhere; }
    .team-slot-actions { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .2rem; }
    .team-slot-actions button { padding: .2rem .35rem; font-size: .62rem; }
    .team-speed-tiers { margin-top: 1rem; }
    .team-speed-tiers > details > summary { cursor: pointer; font-weight: 600; margin-bottom: .6rem; }
    .team-speed-tiers > details:not([open]) > summary { margin-bottom: 0; }
    .team-speed-tier-options { display: flex; flex-wrap: nowrap; gap: .7rem; margin-bottom: .75rem; color: var(--muted); font-size: .72rem; white-space: nowrap; overflow-x: auto; }
    .team-speed-tier-row { display: grid; grid-template-columns: 3rem minmax(7rem, 1fr) repeat(3, minmax(5rem, 1fr)) minmax(3.5rem, auto); align-items: center; gap: .45rem; margin-bottom: .45rem; }
    .team-speed-tier-pokemon { width: 2.8rem; height: 2.8rem; object-fit: contain; }
    .team-speed-tier-track { height: .75rem; overflow: hidden; border-radius: 999px; background: var(--line); }
    .team-speed-tier-fill { position: relative; display: block; height: 100%; overflow: hidden; border-radius: inherit; background: linear-gradient(90deg, var(--danger), var(--stat-mid), var(--nature-up)); }
    .team-speed-tier-fill.team-speed-tier-shimmer::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 20%, var(--shimmer) 50%, transparent 80%); transform: translateX(-100%); animation: stat-max-shimmer 1.8s ease-in-out infinite; }
    .team-speed-tier-neighbor-group { min-width: 0; text-align: center; }
    .team-speed-tier-neighbor-group strong { display: block; margin-bottom: .1rem; font-size: .6rem; }
    .team-speed-tier-faster-count { display: grid; justify-items: center; color: var(--muted); font-size: .62rem; line-height: 1.1; text-align: center; }
    .team-speed-tier-faster-count strong { color: var(--ink); font-size: .85rem; }
    .team-speed-tier-sprites { display: flex; flex-wrap: wrap; justify-content: center; gap: .15rem; align-items: center; min-height: 2.2rem; }
    .team-speed-tier-sprites img { width: 2.2rem; height: 2.2rem; object-fit: contain; }
    @media (max-width: 550px) { .team-speed-tier-row { grid-template-columns: 2.5rem minmax(5rem, 1fr) repeat(3, minmax(4rem, 1fr)) minmax(3rem, auto); gap: .25rem; } .team-speed-tier-pokemon { width: 2.3rem; height: 2.3rem; } .team-speed-tier-sprites img { width: 1.8rem; height: 1.8rem; } }
    .team-coverage { margin-top: 1rem; }
    .team-coverage > details > summary { cursor: pointer; font-weight: 600; margin-bottom: .6rem; }
    .team-coverage > details:not([open]) > summary { margin-bottom: 0; }
    .team-coverage-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; }
    .team-coverage-card { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: .45rem; padding: .45rem; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
    .team-coverage-warning-yellow { border: 2px solid var(--warning); background: var(--panel); }
    .team-coverage-warning-red { border: 2px solid var(--danger); background: var(--panel); }
    .team-coverage-card .type-icon, .team-coverage-card .type-sprite { margin: 0; }
    .team-coverage-counts { display: grid; gap: .1rem; min-width: 0; color: var(--muted); font-size: .66rem; line-height: 1.15; }
    .team-coverage-counts span { overflow-wrap: anywhere; }
    @media (max-width: 700px) {
      .player-profile-usage-cards { grid-template-columns: 1fr; }
      .player-profile-usage-card { width: 100%; box-sizing: border-box; } .team-coverage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
    @media (max-width: 450px) { .team-coverage-grid { grid-template-columns: 1fr; } }
    .team-meta { margin-top: 1rem; }
    .team-meta > details > summary { cursor: pointer; font-weight: 600; margin-bottom: .6rem; }
    .team-meta > details:not([open]) > summary { margin-bottom: 0; }
    .team-meta-grid { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: .4rem; }
    .team-meta-pokemon { display: grid; place-items: center; min-width: 0; padding: .15rem; border: 3px solid white; border-radius: 8px; background: var(--panel); }
    .team-meta-pokemon img { width: 100%; max-width: 72px; aspect-ratio: 1; object-fit: contain; }
    .team-meta-pokemon strong { max-width: 100%; overflow: hidden; color: var(--muted); font-size: .56rem; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
    .team-meta-double-resisted { border-color: red; }
    .team-meta-resisted { border-color: yellow; }
    .team-meta-neutral { border-color: var(--ink); }
    .team-meta-super-effective { border-color: blue; }
    .team-meta-double-effective { border-color: green; }
    .team-meta-legend { display: flex; flex-wrap: wrap; gap: .35rem .7rem; margin-bottom: .5rem; color: var(--muted); font-size: .65rem; }
    .team-meta-legend span::before { content: ''; display: inline-block; width: .6rem; height: .6rem; margin-right: .2rem; border: 2px solid currentColor; border-radius: 3px; vertical-align: -.1rem; }
    .team-meta-legend .double-resisted::before { color: red; }
    .team-meta-legend .resisted::before { color: yellow; }
    .team-meta-legend .neutral::before { color: var(--ink); }
    .team-meta-legend .super-effective::before { color: blue; }
    .team-meta-legend .double-effective::before { color: green; }
    @media (max-width: 700px) { .team-meta-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
    .team-add-form { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; gap: .65rem; margin: 2rem auto 0; text-align: left; }
    .add-pokemon-heading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem; text-align: center; }
    .add-pokemon-heading h2 { margin: 0; }
    .current-team-section { margin: 1rem 0 .25rem; text-align: left; }
    .current-team-section h3 { margin: 0 0 .45rem; color: var(--accent); }
    .current-team-slots { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .45rem; }
    .current-team-slot { min-height: 5.5rem; display: grid; place-items: center; padding: .3rem; border: 1px dashed var(--line); border-radius: 6px; color: var(--muted); font-size: .72rem; text-align: center; }
    .current-team-slot img { width: 72px; height: 72px; object-fit: contain; }
    .current-team-slot-content { display: grid; justify-items: center; gap: 0; width: 100%; }
    .current-team-slot-types { display: flex; justify-content: center; gap: .1rem; width: 100%; }
    .current-team-slot-types .type-icon { margin: 0; }
    .current-team-slot-types .type-sprite { width: 38px; height: 15px; object-fit: contain; }
    .team-add-section { min-width: 0; max-width: 100%; padding: .35rem 0; border: 0; border-radius: 0; background: transparent; overflow: visible; }
    .team-add-section h4 { margin: 0 0 .5rem; padding: 0; border: 0; }
    .team-add-section > details > summary { display: flex; align-items: center; margin: 0 0 .5rem; padding: 0; color: var(--ink); font-size: 1.1rem; font-weight: 700; cursor: pointer; list-style: none; }
    .team-add-section > details > summary::-webkit-details-marker { display: none; }
    .team-add-section > details > summary::after { content: '▾'; margin-left: auto; color: var(--muted); font-size: .9em; }
    .team-add-section > details:not([open]) > summary::after { content: '▸'; }
    .team-stat-points-header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
    .team-stat-points-header h4 { margin-bottom: .5rem; }
    .team-stat-points-header p { margin: 0 0 .5rem; }
    .team-add-fields.team-stat-points-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; }
    .team-stat-points-fields label { display: grid; grid-template-columns: 1fr auto; gap: .25rem; align-items: center; }
    .team-stat-points-fields label input { grid-column: 1 / -1; }
    .team-stat-points-tracker { margin: .35rem 0 0; text-align: right; font-size: .78rem; }
    .team-stat-nature { margin-left: .2rem; font-size: .9rem; font-weight: 700; }
    .team-stat-nature.negative { color: var(--nature-down); }
    .team-stat-nature.neutral { color: var(--nature-neutral); }
    .team-stat-nature.positive { color: var(--nature-up); }
    .team-nature-selector { display: flex; align-items: flex-start; gap: .75rem; margin-bottom: .85rem; }
    .team-nature-selector > .team-autocomplete,
    .team-ev-suggestion { flex: 1 1 0; min-width: 0; }
    .team-nature-selector > .team-autocomplete { flex: 0 1 calc((100% - .75rem) / 2); }
    .team-ev-suggestion { overflow: hidden; }
    .team-ev-suggestion select { width: max-content; min-width: 100%; max-width: 100%; box-sizing: border-box; direction: rtl; text-align: left; }
    .team-ev-suggestion select option { direction: ltr; text-align: left; }
    .team-ev-suggestion-message { min-height: 2.2rem; padding: .55rem .65rem; border: 1px solid var(--border); border-radius: .25rem; color: var(--muted); font-size: .82rem; line-height: 1.25; text-align: right; white-space: normal; overflow-wrap: anywhere; }
    .team-nature-change { margin-left: .5rem; font-size: .78rem; font-weight: 600; }
    .team-nature-change.negative { color: var(--nature-down); }
    .team-nature-change.positive { color: var(--nature-up); }
    .team-nature-change.neutral { color: var(--nature-neutral); }
    .team-pokemon-overview { display: grid; grid-template-columns: minmax(0, 1fr) minmax(10rem, 1fr) minmax(0, 1fr); align-items: start; }
    .team-pokemon-selector { max-width: var(--team-selector-width); margin: .75rem 0 0; text-align: left; }
    .team-pokemon-identity { grid-column: 2; min-height: 8rem; text-align: center; }
    .team-pokemon-mega { grid-column: 3; min-height: 8rem; text-align: center; }
    .team-pokemon-sprite { display: block; width: 110px; height: 110px; margin: 0 auto .15rem; object-fit: contain; }
    .team-pokemon-form { min-width: 7rem; text-align: center; }
    .team-pokemon-form-label { display: block; margin-bottom: .15rem; color: var(--muted); font-size: .78rem; }
    .team-item-details { display: flex; align-items: center; gap: .5rem; margin-top: .45rem; }
    .team-item-effect { min-width: 0; color: var(--muted); font-size: .78rem; line-height: 1.3; }
    .team-control-with-details { display: flex; align-items: center; gap: .75rem; }
    .team-control-with-details > :first-child { flex: 0 1 calc((100% - .75rem) / 2); }
    .team-control-description { min-width: 0; flex: 1; }
    .team-item-control-with-details { display: grid; grid-template-columns: minmax(0, calc((100% - .75rem) / 2)) 40px minmax(0, 1fr); align-items: center; gap: .75rem; }
    .team-item-sprite { width: 40px; height: 40px; object-fit: contain; }
    .team-ability-details { display: grid; gap: .35rem; margin-top: .45rem; }
    .team-ability-detail { color: var(--muted); font-size: .78rem; line-height: 1.3; }
    .team-ability-detail strong { color: var(--ink); }
    .team-mega-summary { margin-top: .75rem; }
    .team-mega-summary[hidden] { display: none; }
    .team-mega-summary h4 { margin: 0 .65rem .45rem; color: var(--accent); }
    .team-form-title { margin: .55rem 0 .35rem; color: var(--accent); font-weight: 600; text-align: center; }
    .team-type-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem; width: 100%; margin-left: 0; }
    .team-type-summary-section { min-width: 0; min-height: 4.5rem; padding: .65rem; text-align: center; }
    .team-type-summary-section + .team-type-summary-section { border-left: 1px solid var(--line); }
    .team-type-summary-section h4 { margin-bottom: .45rem; color: var(--accent); }
    .team-type-summary-content { display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem .75rem; }
    .team-type-summary .type-sprite, .team-pokemon-type .type-sprite, .team-pokemon-mega .type-sprite { width: 48px; height: 19px; }
    .team-pokemon-type .team-type-summary-content { display: flex; justify-content: center; gap: .1rem; }
    .team-type-summary .detail-type-effect-entry { width: auto; min-width: 0; max-width: none; gap: .3rem; padding-left: 0; border-left: 0; }
    .team-type-summary .detail-type-effect-multiplier { flex: 0 0 1.85rem; width: 1.85rem; font-size: .6875rem; white-space: nowrap; }
    .team-type-summary-empty { display: block; width: 100%; text-align: center; }
    /* Large screens have room for full-size type icons. */
    @media (min-width: 1200px) {
      .team-type-summary-content { gap: .5rem 1rem; }
      .team-type-summary .type-sprite { width: 76px; height: 30px; }
      .team-type-summary .detail-type-effect-multiplier { flex-basis: 2.5rem; width: 2.5rem; font-size: .875rem; }
    }
    @media (max-width: 700px) {
      .team-pokemon-overview { grid-template-columns: 1fr; }
      .team-pokemon-selector { margin: .25rem 0 .75rem; }
      .team-pokemon-identity { grid-column: 1; grid-row: 2; justify-self: center; }
      .team-pokemon-mega { grid-column: 1; grid-row: 3; justify-self: center; }
      .team-control-with-details, .team-item-control-with-details { align-items: stretch; flex-direction: column; }
      .team-item-control-with-details { display: flex; }
      .team-move-grid { grid-template-columns: 1fr; }
      .team-type-summary { grid-template-columns: 1fr; width: min(100%, 28rem); margin-inline: auto; }
      .team-type-summary-section + .team-type-summary-section { border-left: 0; }
      .team-type-summary-content { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); justify-items: center; }
      .team-type-summary .detail-type-effect-entry { width: 7rem; min-width: 7rem; max-width: 7rem; justify-content: center; }
      .team-type-summary .detail-type-effect-multiplier { flex: 0 0 1.55rem; }
      .team-type-summary .type-icon { display: inline-flex; align-items: center; justify-content: center; width: 60px; height: 24px; margin: 0; }
      .team-type-summary .type-sprite, .team-pokemon-type .type-sprite, .team-pokemon-mega .type-sprite { width: 60px; height: 24px; }
      .team-pokemon-type .team-type-summary-content { display: flex; justify-content: center; gap: .25rem; }
      .team-type-summary-content > .detail-type-effect-entry:last-child:nth-child(odd) { width: 7rem; justify-self: center; }
      .current-team-slots { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    }
    @media (max-width: 450px) { .team-slots { gap: .35rem; } .team-slot-content { grid-template-columns: 42px minmax(0, 1fr); padding: .35rem; } .team-slot-sprite { width: 42px; height: 42px; } .team-slot-summary { font-size: .56rem; } .team-slot-content strong { font-size: .68rem; } .team-slot-actions button { font-size: .54rem; padding: .15rem .25rem; } .current-team-slots { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
    .team-autocomplete { position: relative; width: 100%; min-width: 0; }
    .team-autocomplete > input { width: 100%; min-width: 0; }
    .team-autocomplete-options { position: absolute; top: calc(100% + .2rem); left: 0; right: auto; z-index: 20; display: none; width: 100%; min-width: 100%; max-width: 100%; box-sizing: border-box; max-height: 12rem; overflow: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-raised); box-shadow: 0 5px 15px var(--scrim); }
    .team-autocomplete-options.active { display: block; }
    .team-autocomplete-option { display: block; width: 100%; max-width: 100%; box-sizing: border-box; padding: .5rem .65rem; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left; white-space: normal; overflow-wrap: anywhere; }
    .team-item-option { display: block; }
    .team-autocomplete-option:last-child { border-bottom: 0; }
    .team-autocomplete-option:hover, .team-autocomplete-option:focus-visible { background: var(--panel); }
    .team-option-usage { margin-left: .5rem; color: var(--muted); font-size: .75rem; }
    #teamNatureSuggestions .team-autocomplete-option { font-size: .75rem; }
    .team-ko-bars { display: grid; gap: .65rem; margin-top: .75rem; min-width: 0; }
    .team-ko-bars details, .team-ko-group { width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; }
    .team-ko-group { display: grid; gap: .45rem; }
    .team-ko-heading { margin: 0; color: var(--accent); }
    .team-ko-form-toggle { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
    .team-ko-form-toggle label { display: flex; align-items: center; gap: .4rem; font-size: .82rem; color: var(--ink-muted); }
    .team-ko-buttons { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; }
    .team-ko-button { min-width: 0; padding: .45rem .35rem; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); color: var(--ink); cursor: pointer; }
    .team-ko-details > summary::after { content: none !important; }
    .team-ko-button.active { position: relative; padding-right: 1.2rem; }
    .team-ko-button.active::after { content: '▾'; position: absolute; top: 50%; right: .35rem; color: currentColor; transform: translateY(-50%); }
    .team-ko-button.active[aria-expanded="false"]::after { content: '▸'; }
    .team-ko-button:hover, .team-ko-button:focus-visible { border-color: var(--accent); }
    .team-ko-button.active { border-color: var(--accent); background: var(--accent); color: var(--panel-raised); }
    .team-ko-button-count { display: block; font-weight: 600; }
    .team-ko-button-label { display: block; font-size: .72rem; }
    .team-ko-sprites { display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem; min-height: 4rem; padding: .45rem; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); }
    .team-ko-sprite { width: 56px; height: 56px; object-fit: contain; }
    .team-ko-sprite-button { position: relative; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; background: transparent; color: var(--ink); }
    .team-ko-sprite-label { position: absolute; bottom: calc(100% + .25rem); left: 50%; z-index: 2; display: none; width: max-content; max-width: min(16rem, 80vw); padding: .3rem .45rem; border: 1px solid var(--line); border-radius: 4px; background: var(--panel-raised); color: var(--ink); font-size: .68rem; line-height: 1.15; text-align: left; transform: translateX(-50%); pointer-events: none; }
    .team-ko-sprite-button:hover .team-ko-sprite-label, .team-ko-sprite-button:focus-visible .team-ko-sprite-label, .team-ko-sprite-button.tooltip-visible .team-ko-sprite-label { display: block; }
    .team-speed-options { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .35rem; margin: .6rem 0; min-width: 0; }
    .team-speed-options label { display: flex; align-items: center; gap: .2rem; min-width: 0; font-size: .68rem; line-height: 1.15; color: var(--ink-muted); overflow-wrap: anywhere; }
    .team-speed-options input { flex: 0 0 auto; margin-top: .05rem; }
    @media (max-width: 900px) { .team-speed-options { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
    @media (max-width: 450px) { .team-speed-options { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
    @media (max-width: 450px) { .team-ko-buttons { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
    .team-add-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .65rem; }
    .team-move-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
    .team-move-control { display: grid; gap: .35rem; }
    .team-move-details { min-width: 0; color: var(--muted); font-size: .75rem; line-height: 1.3; }
    .team-move-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .35rem; text-align: center; }
    .team-move-stat { display: grid; gap: .15rem; }
    .team-move-stat-label { color: var(--ink); font-weight: 600; }
    .team-move-stat-value { min-height: 1.75rem; display: flex; align-items: center; justify-content: center; }
    .team-move-stat-value .type-icon { margin: 0; }
    .team-move-stat-value .type-sprite { width: 48px; height: 19px; }
    .team-add-actions { display: flex; justify-content: center; gap: .75rem; margin-top: 1rem; }
    .team-top-actions { margin: .65rem 0 0; }
    .confirm-tooltip { position: relative; display: inline-flex; }
    .confirm-tooltip[data-tooltip]:hover::after, .confirm-tooltip[data-tooltip]:focus-within::after { content: attr(data-tooltip); position: absolute; z-index: 30; left: 50%; top: calc(100% + .4rem); width: max-content; max-width: 20rem; padding: .4rem .55rem; border: 1px solid var(--line); border-radius: 5px; background: var(--panel-raised); color: var(--ink); font-size: .75rem; text-align: left; transform: translateX(-50%); box-shadow: 0 4px 12px var(--scrim); pointer-events: none; }
    .team-stat-graph { display: grid; gap: .55rem; }
    /* ---------- Footer ---------- */
    .site-footer { margin-top: 1rem; padding-block: 2.5rem 2rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .875rem; }
    .site-footer-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.5rem; }
    .site-footer h2 { margin: 0 0 .75rem; color: var(--ink); font-size: .75rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
    .site-footer ul { display: grid; gap: .5rem; margin: 0; padding: 0; list-style: none; }
    .site-footer a { color: var(--ink-muted); text-decoration: none; }
    .site-footer a:hover { color: var(--ink); text-decoration: underline; }
    .footer-display { margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
    .footer-display h2 { margin: 0 0 .5rem; color: var(--ink); font-size: .75rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
    .footer-display-options { display: flex; flex-wrap: wrap; gap: .5rem 3rem; }
    .footer-display .display-group { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1.25rem; padding: 0; }
    .footer-display .display-group + .display-group { border-top: 0; }
    .footer-display .display-group legend { width: 100%; margin-bottom: .375rem; }
    .footer-display .display-group label { display: flex; align-items: center; gap: .5rem; min-height: 2rem; color: var(--ink-muted); cursor: pointer; }
    .footer-display .display-group label:hover { color: var(--ink); }
    .site-footer-meta { display: grid; gap: .375rem; margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--line); font-size: .75rem; line-height: 1.55; }
    .site-footer-meta p { margin: 0; max-width: 60rem; }
    .skip-link { position: absolute; left: .75rem; top: -4rem; z-index: 100; padding: .5rem .75rem; background: var(--panel-raised); color: var(--ink); border: 1px solid var(--accent); border-radius: var(--radius); }
    .skip-link:focus { top: .75rem; }
    .global-status { color: var(--danger); }
    .global-status:not(:empty) { margin-block: 1rem -1rem; }

    /* ---------- Landing and text pages ---------- */
    .landing { display: grid; gap: 1.25rem; min-width: 0; }
    .landing-hero { position: relative; overflow: hidden; padding: clamp(1.25rem, 3vw, 2.25rem); border: 1px solid var(--card-border); border-radius: var(--radius-lg); background: radial-gradient(60rem 28rem at 88% -10%, color-mix(in srgb, var(--accent-strong) 13%, transparent), transparent 70%), var(--panel); box-shadow: var(--card-shadow); }
    .landing-hero-text { min-width: 0; max-width: 46rem; margin-bottom: 1.5rem; }
    /* The site description: in the accent colour and larger than a caption, so it is seen, but well below the heading. */
    .landing-eyebrow { margin: 0 0 .625rem; color: var(--accent-strong); font-size: clamp(1rem, .95rem + .3vw, 1.1875rem); font-weight: 600; line-height: 1.35; }
    .landing-hero-text h2 { margin: 0 0 .5rem; color: var(--ink); font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.75rem); font-weight: 700; letter-spacing: -.025em; line-height: 1.1; }
    .landing-hero-text > p:last-child { margin: 0; color: var(--ink-muted); font-size: 1.0625rem; }

    .landing-top { display: grid; grid-template-columns: minmax(0, 1.25fr) repeat(2, minmax(0, 1fr)); gap: .75rem; margin: 0; padding: 0; list-style: none; }
    .landing-top > li { min-width: 0; }
    .landing-top > li:first-child { grid-row: span 2; }
    .landing-pokemon { position: relative; display: grid; grid-template-columns: clamp(5rem, 9vw, 8rem) minmax(0, 1fr); align-items: center; gap: 1rem; box-sizing: border-box; height: 100%; min-height: 9.5rem; padding: 1rem; border: 1px solid var(--card-border); border-radius: var(--radius-lg); background: var(--panel-raised); color: inherit; text-decoration: none; transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease; }
    a.landing-pokemon:hover { border-color: var(--line-strong); box-shadow: var(--card-shadow-hover); text-decoration: none; transform: translateY(-2px); }
    .landing-pokemon.featured { grid-template-columns: minmax(0, 1fr); justify-items: center; min-height: 20rem; text-align: center; background: radial-gradient(22rem 16rem at 50% 30%, color-mix(in srgb, var(--accent-strong) 22%, transparent), transparent 75%), var(--panel-raised); }
    .landing-skeleton { display: block; opacity: .6; }
    .landing-rank { position: absolute; top: .625rem; left: .75rem; color: var(--muted); font-size: .8125rem; font-weight: 700; font-variant-numeric: tabular-nums; }
    .landing-pokemon.featured .landing-rank { color: var(--accent-strong); font-size: 1.125rem; }
    .landing-art { display: block; width: 100%; aspect-ratio: 1; }
    .landing-pokemon.featured .landing-art { width: min(100%, 15rem); }
    .landing-art img { display: block; width: 100%; height: 100%; object-fit: contain; }
    .landing-pokemon-body { display: grid; gap: .3rem; min-width: 0; width: 100%; }
    .landing-pokemon-body strong { color: var(--ink); font-size: 1.0625rem; font-weight: 650; }
    .landing-pokemon.featured .landing-pokemon-body strong { font-size: 1.625rem; letter-spacing: -.015em; }
    .landing-types { display: flex; flex-wrap: wrap; gap: .25rem; }
    .landing-pokemon.featured .landing-types { justify-content: center; }
    .landing-types .type-icon { margin: 0; }
    .landing-types .type-sprite { width: 56px; height: 22px; }
    .landing-pokemon.featured .landing-types .type-sprite { width: 76px; height: 30px; }
    .landing-usage { color: var(--ink); font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; }
    .landing-pokemon.featured .landing-usage { font-size: 2.5rem; }
    .landing-bar { display: block; height: .5rem; overflow: hidden; border-radius: 999px; background: var(--line); }
    .landing-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--accent-strong); transform-origin: left; animation: landing-bar 1.2s cubic-bezier(.33, 1, .68, 1) both; }
    @keyframes landing-bar { from { transform: scaleX(0); } }
    .landing-sample { min-height: 1.25rem; margin: 1rem 0 0; color: var(--muted); font-size: .8125rem; }
    .landing-empty { margin: 0; padding: 1rem 0; color: var(--muted); }
    .landing-empty p { margin: 0 0 .75rem; }

    .landing-insights { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: 1.25rem; }
    .landing-panel { display: flex; flex-direction: column; container-type: inline-size; min-width: 0; padding: clamp(1rem, 2vw, 1.5rem); border: 1px solid var(--card-border); border-radius: var(--radius-lg); background: var(--panel); box-shadow: var(--card-shadow); }
    /* The two cards share a height, so their contents spread out to fill it. */
    #landingMovers, #landingWinners { display: flex; flex: 1; flex-direction: column; justify-content: space-between; }
    #entry .landing-section-title { margin: 0; color: var(--ink); font-size: .75rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
    .landing-caption { margin: .5rem 0 0; color: var(--muted); font-size: .8125rem; }
    .landing-mover-group { margin-top: 1rem; }
    #entry .landing-mover-group h4 { margin: 0 0 .25rem; padding: 0; border: 0; color: var(--muted); font-size: .75rem; font-weight: 600; }
    .landing-mover { display: grid; grid-template-columns: 2.75rem minmax(0, 1fr) auto; align-items: center; gap: .625rem; padding: .25rem .375rem; border-radius: var(--radius); color: inherit; text-decoration: none; }
    .landing-mover:hover { background: var(--panel-hover); text-decoration: none; }
    .landing-mover-art { display: block; width: 2.75rem; height: 2.75rem; }
    .landing-mover-art img { display: block; width: 100%; height: 100%; object-fit: contain; }
    .landing-mover-name { display: grid; min-width: 0; }
    .landing-mover-name strong { color: var(--ink); font-weight: 600; }
    .landing-mover-name small { color: var(--muted); font-size: .75rem; font-variant-numeric: tabular-nums; }
    .landing-change { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
    .landing-up { color: var(--nature-up); }
    .landing-down { color: var(--nature-down); }
    .landing-new { color: var(--ink); }

    .landing-winner { display: grid; flex: 1; grid-template-columns: minmax(0, 1fr) auto; align-content: center; align-items: center; gap: .75rem 1.25rem; padding: 1rem 0; border-top: 1px solid var(--line); }
    .landing-winner:first-child { border-top: 0; }
    .landing-winner:last-child { padding-bottom: 0; }
    .landing-winner-text { display: grid; justify-items: start; gap: .2rem; min-width: 0; }
    .landing-winner-event { color: var(--ink); font-weight: 650; }
    .landing-winner-text small { color: var(--muted); font-size: .8125rem; }
    .landing-winner-text p { margin: 0; color: var(--ink-muted); }
    .landing-team { display: grid; grid-template-columns: repeat(6, 3.5rem); gap: .125rem; }
    .landing-team-member { display: block; aspect-ratio: 1; }
    .landing-team-member img { display: block; width: 100%; height: 100%; object-fit: contain; }
    .landing-winner-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; grid-column: 1 / -1; }
    @container (max-width: 38rem) {
      .landing-winner { grid-template-columns: minmax(0, 1fr); }
      .landing-team { grid-template-columns: repeat(6, minmax(0, 3.5rem)); }
    }

    .landing-spotlight { display: grid; gap: 1rem; padding: clamp(1rem, 2vw, 1.5rem); border: 1px solid var(--card-border); border-radius: var(--radius-lg); background: radial-gradient(40rem 22rem at 8% 40%, color-mix(in srgb, var(--accent-strong) 12%, transparent), transparent 70%), var(--panel); box-shadow: var(--card-shadow); }
    .landing-spotlight[hidden] { display: none; }
    .landing-spotlight-body { display: grid; grid-template-columns: minmax(9rem, 15rem) minmax(0, 1fr); align-items: center; gap: 1.5rem; }
    .landing-spotlight-art { aspect-ratio: 1; }
    .landing-spotlight-art img { display: block; width: 100%; height: 100%; object-fit: contain; }
    .landing-spotlight-main { display: grid; gap: 1rem; min-width: 0; }
    .landing-spotlight-heading { display: flex; flex-wrap: wrap; align-items: center; gap: .375rem 1rem; }
    .landing-spotlight-name { color: var(--ink); font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem); font-weight: 700; letter-spacing: -.02em; }
    .landing-spotlight-heading .type-sprite { width: 76px; height: 30px; }
    .landing-spotlight-usage { margin: 0; color: var(--ink-muted); }
    .landing-spotlight-usage strong { color: var(--ink); font-size: 1.25rem; font-variant-numeric: tabular-nums; }
    .landing-spotlight-details { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: 1rem 1.5rem; }
    #entry .landing-spotlight-detail h4 { margin: 0 0 .5rem; padding: 0; border: 0; color: var(--muted); font-size: .75rem; font-weight: 600; }
    .landing-spotlight-item { display: flex; align-items: center; gap: .625rem; }
    .landing-spotlight-item img { width: 2.5rem; height: 2.5rem; object-fit: contain; }
    .landing-spotlight-item span { display: grid; min-width: 0; }
    .landing-spotlight-item strong { color: var(--ink); font-weight: 600; }
    .landing-spotlight-item small, .landing-spotlight-moves small { color: var(--muted); font-size: .8125rem; font-variant-numeric: tabular-nums; }
    .landing-spotlight-moves { display: grid; gap: .5rem; margin: 0; padding: 0; list-style: none; }
    .landing-spotlight-moves li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .125rem .5rem; color: var(--ink); }
    .landing-spotlight-moves .landing-bar { grid-column: 1 / -1; height: .375rem; }
    .landing-spotlight-link { justify-self: start; font-weight: 500; }

    .landing-regulations { display: grid; gap: .75rem; }
    .landing-regulations-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem 1rem; }
    #landingDemoToggle[hidden] { display: none; }
    #landingDemoToggle { min-height: 0; padding: .25rem .75rem; font-size: .8125rem; }
    .landing-demo { display: grid; container-type: inline-size; gap: .5rem; margin-top: .5rem; min-width: 0; }
    .landing-demo-stage { position: relative; height: 17rem; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-raised); }
    .landing-demo-scene { position: absolute; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr); align-content: center; gap: .625rem; padding: .75rem; opacity: 0; transform: translateY(.5rem); visibility: hidden; transition: opacity .4s ease, transform .4s ease, visibility .4s; }
    .landing-demo-scene.active { opacity: 1; transform: none; visibility: visible; }
    .landing-demo-main { display: flex; align-items: center; gap: .75rem; min-width: 0; }
    .landing-demo-art { flex: 0 0 auto; width: clamp(4.5rem, 30cqw, 7rem); aspect-ratio: 1; }
    .landing-demo-art.landing-demo-item { width: 3rem; }
    .landing-demo-art img { display: block; width: 100%; height: 100%; object-fit: contain; }
    .landing-demo-body { display: grid; flex: 1; align-content: center; gap: .25rem; min-width: 0; }
    .landing-demo-body strong { color: var(--ink); font-size: 1rem; font-weight: 650; }
    .landing-demo-body p { display: -webkit-box; margin: 0; overflow: hidden; color: var(--ink-muted); font-size: .8125rem; line-height: 1.4; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
    .landing-demo-body .landing-types { align-items: center; }
    .landing-demo-body .landing-types small { color: var(--muted); font-size: .8125rem; }
    .landing-demo-tag { font-size: .6875rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
    .landing-demo-most_used, .landing-demo-legal { color: var(--accent-strong); }
    .landing-demo-added { color: var(--nature-up); }
    .landing-demo-removed { color: var(--nature-down); }
    .landing-demo-usage { color: var(--ink-muted); font-size: .8125rem; line-height: 1.35; }
    .landing-demo-usage b { color: var(--ink); font-variant-numeric: tabular-nums; }
    .landing-demo-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr)); gap: .125rem .75rem; margin-top: .125rem; }
    .landing-demo-stat { display: grid; grid-template-columns: 1.625rem minmax(0, 1fr) 1.5rem; align-items: center; gap: .25rem; color: var(--muted); font-size: .6875rem; font-variant-numeric: tabular-nums; line-height: 1.2; }
    .landing-demo-stat > :last-child { color: var(--ink); text-align: right; }
    .landing-demo-stat .landing-bar { height: .3125rem; }
    .landing-demo-scene .landing-bar > span { animation: none; }
    .landing-demo-scene.active .landing-bar > span { animation: landing-bar .8s cubic-bezier(.33, 1, .68, 1) both; }
    .landing-demo-figures { display: flex; flex-wrap: wrap; gap: .125rem 1.25rem; }
    .landing-demo-figures ~ p { -webkit-line-clamp: 2; }
    .landing-demo-figure { display: grid; }
    .landing-demo-figure b { color: var(--ink); font-size: 1.125rem; font-variant-numeric: tabular-nums; line-height: 1.2; }
    .landing-demo-figure small { color: var(--muted); font-size: .6875rem; }
    .landing-demo-users { display: grid; align-content: center; gap: .25rem; min-width: 0; }
    .landing-demo-label { color: var(--muted); font-size: .6875rem; font-weight: 600; line-height: 1.25; }
    .landing-demo-label small { display: block; font-size: .625rem; font-weight: 400; }
    .landing-demo-users ul { display: flex; flex-wrap: wrap; gap: .25rem .75rem; margin: 0; padding: 0; list-style: none; }
    .landing-demo-users li { display: flex; align-items: center; gap: .25rem; min-width: 0; color: var(--ink); font-size: .75rem; }
    .landing-demo-user-art { flex: none; width: 1.875rem; height: 1.875rem; }
    .landing-demo-user-art img { display: block; width: 100%; height: 100%; object-fit: contain; }
    .landing-demo-user-name { display: none; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .landing-demo-user-share { flex: none; font-weight: 600; font-variant-numeric: tabular-nums; }
    /* Above the card's whole-card link, so these stay clickable. */
    .landing-demo-tabs { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .25rem; }
    @container (min-width: 23rem) {
      .landing-demo-stage { height: 13.5rem; }
      .landing-demo-scene:has(.landing-demo-users) { grid-template-columns: minmax(0, 1fr) minmax(8.5rem, 34%); align-items: center; gap: .875rem; }
      .landing-demo-users ul { display: grid; gap: .125rem; }
      .landing-demo-user-name { display: block; }
      .landing-demo-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    }
    .landing-demo-tabs button { min-height: 0; padding: .25rem .375rem; border: 1px solid var(--line); border-radius: var(--radius); background: transparent; color: var(--ink-muted); font-size: .75rem; white-space: nowrap; }
    .landing-demo-tabs b { color: var(--ink); font-variant-numeric: tabular-nums; }
    .landing-demo-tabs button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--panel); }
    .landing-demo-tabs button[aria-pressed="true"] b { color: var(--panel); }
    @media (max-width: 700px) {
      .landing-spotlight-body { grid-template-columns: minmax(0, 1fr); }
      .landing-spotlight-art { width: min(60%, 11rem); justify-self: center; }
      .landing-spotlight-heading { justify-content: center; text-align: center; }
    }
    .landing-timeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: .75rem; margin: 0; padding: 0; list-style: none; }
    .landing-timeline > li { display: grid; min-width: 0; }
    @media (max-width: 1100px) {
      .landing-insights { grid-template-columns: minmax(0, 1fr); }
      .landing-top { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .landing-top > li:first-child { grid-column: 1 / -1; grid-row: auto; }
      .landing-pokemon.featured { min-height: 0; }
    }
    @media (max-width: 620px) {
      .landing-top { grid-template-columns: minmax(0, 1fr); }
      .landing-pokemon { min-height: 7rem; }
      .landing-pokemon.featured .landing-art { width: min(55%, 10rem); }
      .landing-pokemon.featured .landing-usage { font-size: 2rem; }
    }
    .landing-regulation-card { position: relative; display: grid; align-content: start; gap: .375rem; padding: 1.25rem; border: 1px solid var(--card-border); border-radius: var(--radius-lg); background: var(--panel); box-shadow: var(--card-shadow); transition: border-color .12s ease, background-color .12s ease, box-shadow .12s ease; }
    .landing-regulation-card:hover { border-color: var(--line-strong); background: var(--panel-raised); box-shadow: var(--card-shadow-hover); }
    .landing-regulation-card > strong { color: var(--ink); font-size: 1.0625rem; font-weight: 650; }
    .landing-regulation-card > small { color: var(--muted); font-size: .8125rem; }
    .landing-regulation-card > :not(strong):not(small):not(a) { color: var(--ink-muted); font-size: .875rem; }
    .landing-regulation-card a { margin-top: .5rem; font-size: .875rem; font-weight: 500; text-decoration: none; }
    .landing-regulation-card a::after { content: ''; position: absolute; inset: 0; border-radius: inherit; }
    .landing-regulation-card:has(a:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
    .landing-regulation-card.current::before { content: ''; position: absolute; inset: -1px -1px auto; height: 3px; border-radius: var(--radius-lg) var(--radius-lg) 0 0; background: var(--accent-strong); }
    .landing-regulation-card.current > strong::after { content: 'Current'; display: inline-block; margin-left: .5rem; padding: .0625rem .5rem; border-radius: 999px; background: color-mix(in srgb, var(--accent-strong) 16%, transparent); color: var(--accent-strong); font-size: .6875rem; font-weight: 600; letter-spacing: .03em; vertical-align: .15em; }
    .about-source-list { display: grid; gap: .75rem; margin-top: 1.5rem; }
    .about-source-card { display: grid; gap: .25rem; padding: 1rem 1.125rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel); }
    .about-source-card strong a { color: var(--ink); font-weight: 600; }
    .about-source-card span { color: var(--ink-muted); }
    .about-source-card small { color: var(--muted); font-size: .8125rem; }
    .about-criteria { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--line); text-align: center; color: var(--ink-muted); }
    .about-criteria h2 { margin: 0 0 .75rem; color: var(--ink); font-size: 1.25rem; }
    .about-criteria h3 { margin: 0 0 .5rem; color: var(--ink); font-size: 1rem; }
    .about-criteria dl { display: grid; grid-template-columns: minmax(10rem, 14rem) minmax(0, 1fr); gap: .5rem 1rem; margin: 0; }
    .about-criteria dt { color: var(--ink); font-weight: 600; }
    .about-criteria dd { margin: 0; }
    @media (max-width: 560px) { .about-criteria dl { grid-template-columns: minmax(0, 1fr); gap: .15rem; } .about-criteria dt { margin-top: .5rem; } }

    /* ---------- Layout primitives ---------- */
    :root {
      --space-1: .25rem;
      --space-2: .5rem;
      --space-3: .75rem;
      --space-4: 1rem;
      --space-5: 1.5rem;
      --page-gutter: clamp(1rem, 3vw, 2rem);
    }
    body { overflow-wrap: anywhere; }
    img, svg, canvas, video { max-width: 100%; }
    input, select, textarea, button { max-width: 100%; }
    .hero { grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-4); }
    .detail-card, .panel, .toolbar, .hero, .site-footer-grid { min-width: 0; }
    .toolbar > *, .pokemon-toolbar-filters > * { min-width: 0; }
    .item-effect { min-width: 0; }
    textarea { width: 100%; min-height: 7rem; resize: vertical; }
    @media (pointer: coarse) {
      button:not(.sort-button):not(.tab):not(.help-toggle):not(.role-badge), select, input:not([type="checkbox"]):not([type="radio"]) { min-height: 2.75rem; }
      .site-nav-regulation > summary, .site-nav-regulation-menu a, .site-nav-regulation-menu button,
      .site-nav-mobile-content a, .site-nav-mobile-content button { min-height: 2.75rem; }
      .header-selectors select, #globalSearch { height: 2.75rem; }
    }

    /* ---------- Header: tablet and phone ---------- */
    @media (max-width: 960px) {
      .site-nav > .site-nav-regulation:not(.site-nav-mobile-menu) { display: none; }
      .site-nav-mobile-menu { display: block; }
      .header-selectors { grid-template-columns: repeat(3, minmax(0, 1fr)); }
      .header-meta { grid-column: 1 / -1; justify-content: space-between; padding: 0; text-align: left; font-size: .75rem; }
    }
    @media (max-width: 720px) {
      .site-header { position: relative; }
      .header-inner { flex-wrap: wrap; gap: .625rem .75rem; padding-block: .625rem; }
      .brand { order: 1; }
      .site-nav { order: 2; }
      .search-wrap { order: 3; flex: 1 1 100%; max-width: none; }
      .header-selectors { gap: .5rem; padding-block: .5rem .625rem; }
      main { padding-block: 1.25rem 2rem; }
    }
    @media (max-width: 480px) {
      .header-selectors { column-gap: .375rem; }
      .header-selectors select { padding: 0 1.5rem 0 .5rem; background-position: right .5rem center; font-size: .8125rem; }
      .filter-label { font-size: .625rem; }
    }

    @media (max-width: 650px) {
      .site-footer-grid { grid-template-columns: 1fr 1fr; gap: 1.5rem 1rem; }
      .hero { grid-template-columns: 1fr; align-items: start; justify-items: stretch; text-align: center; }
      .hero > div { justify-self: center; text-align: center; }
      .entry-card, .detail-card { padding: 1rem; }
      .toolbar, .pokemon-toolbar {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: flex-start;
        gap: var(--space-2) var(--space-4);
      }
      .pokemon-toolbar-filters { gap: var(--space-2) var(--space-4); }
      .table-filter { white-space: nowrap; }
      .table-count { margin-left: auto; white-space: nowrap; }
      .team-type-summary { grid-template-columns: 1fr; }
      .team-type-summary-section + .team-type-summary-section { border-top: 1px solid var(--line); border-left: 0; }
      .team-add-fields.team-stat-points-fields { grid-template-columns: 1fr; }
      .team-nature-selector, .team-control-with-details { flex-direction: column; }
      .team-nature-selector > .team-autocomplete { width: 100%; }
      .team-nature-selector > .team-ev-suggestion { flex: 0 1 auto; width: 100%; }
      .team-item-control-with-details { grid-template-columns: 1fr; }
      .team-item-sprite { justify-self: center; }
      .detail-ability-entry { grid-template-columns: 1fr; gap: .15rem; }
    }
    @media (max-width: 700px) {
      .detail-stat-chart text { font-size: 20px; }
      .detail-stat-nature-marker-label { font-size: 14px !important; }
      .detail-stat-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem .35rem; }
      .detail-stat-option { min-width: 0; white-space: nowrap; }
      .detail-stat-bar { grid-template-columns: 4.75rem minmax(6rem, 1fr) 2.5rem; font-size: .9rem; }
      .detail-stat-bar > :first-child { white-space: nowrap; }
      .detail-moves-table:not(.detail-abilities-table) { table-layout: fixed; font-size: .68rem; }
      .detail-moves-table:not(.detail-abilities-table) th,
      .detail-moves-table:not(.detail-abilities-table) td {
        padding: .3rem .1rem;
        overflow-wrap: normal;
        word-break: normal;
        white-space: normal;
        line-height: 1.15;
      }
      .detail-moves-table:not(.detail-abilities-table) th {
        padding-top: .25rem;
        padding-bottom: .45rem;
        font-size: .6rem;
        line-height: 1.1;
        vertical-align: middle;
        white-space: nowrap;
      }
      .detail-moves-table:not(.detail-abilities-table) th .sort-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: .1rem;
        width: 100%;
        padding: 0;
        font-size: inherit;
        line-height: inherit;
        white-space: nowrap;
      }
      .detail-moves-table:not(.detail-abilities-table) .detail-move-filter {
        display: inline-block;
        width: auto;
        margin: 0 0 0 .1rem;
        line-height: 1;
        vertical-align: middle;
      }
      .detail-moves-table:not(.detail-abilities-table) .detail-move-filter summary {
        display: inline-flex;
        align-items: center;
        height: 1rem;
        line-height: 1;
      }
      .detail-moves-table:not(.detail-abilities-table) .detail-move-filter .filter-icon {
        width: .65rem;
        height: .65rem;
      }
      .detail-moves-table:not(.detail-abilities-table) .detail-move-header-full { display: none; }
      .detail-moves-table:not(.detail-abilities-table) .detail-move-header-short { display: inline; }
      .detail-moves-table:not(.detail-abilities-table) th:first-child,
      .detail-moves-table:not(.detail-abilities-table) td:first-child { width: 22%; }
      .detail-moves-table:not(.detail-abilities-table) th:nth-child(2),
      .detail-moves-table:not(.detail-abilities-table) td:nth-child(2) { width: 11%; }
      .detail-moves-table:not(.detail-abilities-table) th:nth-child(3),
      .detail-moves-table:not(.detail-abilities-table) td:nth-child(3) { width: 17%; }
      .detail-moves-table:not(.detail-abilities-table) th:nth-child(4),
      .detail-moves-table:not(.detail-abilities-table) td:nth-child(4) { width: 9%; }
      .detail-moves-table:not(.detail-abilities-table) th:nth-child(5),
      .detail-moves-table:not(.detail-abilities-table) td:nth-child(5) { width: 12%; }
      .detail-moves-table:not(.detail-abilities-table) th:nth-child(6),
      .detail-moves-table:not(.detail-abilities-table) td:nth-child(6) { width: 12%; }
      .detail-moves-table:not(.detail-abilities-table) th:nth-child(7),
      .detail-moves-table:not(.detail-abilities-table) td:nth-child(7) { width: 17%; }
      .detail-moves-table:not(.detail-abilities-table) .sort-button {
        overflow-wrap: normal;
        word-break: normal;
        white-space: normal;
      }
      .table-scroll-top { display: none; }
      .table-wrap { border: 0; overflow: visible; }
      .table-wrap table,
      #pokemonResults table,
      #itemResults table { display: block; min-width: 0; }
      .table-wrap thead { display: none; }
      .table-wrap tbody { display: grid; gap: .75rem; }
      .table-wrap tbody tr {
        display: grid;
        gap: .35rem;
        padding: .75rem;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: var(--panel);
        cursor: pointer;
      }
      .table-wrap tbody td {
        display: grid;
        grid-template-columns: minmax(5.5rem, 36%) minmax(0, 1fr);
        gap: .5rem;
        width: 100%;
        min-width: 0;
        padding: .25rem 0;
        border-bottom: 1px solid var(--line);
        text-align: left;
        overflow-wrap: anywhere;
      }
      #pokemonResults tbody td:nth-child(n),
      #itemResults tbody td:nth-child(n) {
        width: 100%;
        min-width: 0;
        max-width: none;
      }
      .table-wrap tbody td:has(.type-icon) {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: .5rem;
      }
      .table-wrap tbody td:has(.type-icon)::before {
        flex: 0 0 36%;
      }
      .table-wrap tbody td .type-icon {
        flex: 0 0 76px;
        width: 76px;
        height: 30px;
        margin: 0;
      }
      .table-wrap tbody td .type-sprite {
        width: 76px;
        height: 30px;
      }
      #itemResults tbody td {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
      }
      #itemResults tbody td::before { width: 100%; text-align: center; }
      #itemResults tbody td .item-type-list { align-items: center; }
      #itemResults tbody td .item-effect { text-align: center; }
      .table-wrap tbody td:last-child { border-bottom: 0; }
      .table-wrap tbody td:nth-child(n+4) { overflow-wrap: normal; }
      .table-wrap tbody td:nth-child(n+4) > * { white-space: nowrap; }
      .table-wrap tbody td::before {
        color: var(--muted);
        font-size: .78rem;
        font-weight: 600;
      }
      #pokemonResults tbody td:nth-child(1)::before { content: 'Dex'; }
      #pokemonResults tbody td:nth-child(2)::before { content: 'Pokémon'; }
      #pokemonResults tbody td:nth-child(3)::before { content: 'Type'; }
      #pokemonResults tbody td:nth-child(4)::before { content: 'HP'; }
      #pokemonResults tbody td:nth-child(5)::before { content: 'Atk'; }
      #pokemonResults tbody td:nth-child(6)::before { content: 'Def'; }
      #pokemonResults tbody td:nth-child(7)::before { content: 'SpA'; }
      #pokemonResults tbody td:nth-child(8)::before { content: 'SpD'; }
      #pokemonResults tbody td:nth-child(9)::before { content: 'Spe'; }
      #itemResults tbody td:nth-child(1)::before { content: 'Sprite'; }
      #itemResults tbody td:nth-child(2)::before { content: 'Item'; }
      #itemResults tbody td:nth-child(3)::before { content: 'Type'; }
      #itemResults tbody td:nth-child(4)::before { content: 'Effect'; }
      #moveResults tbody td:nth-child(1)::before { content: 'Move'; }
      #moveResults tbody td:nth-child(2)::before { content: 'Type'; }
      #moveResults tbody td:nth-child(3)::before { content: 'Target'; }
      #moveResults tbody td:nth-child(4)::before { content: 'Category'; }
      #moveResults tbody td:nth-child(5)::before { content: 'Power'; }
      #moveResults tbody td:nth-child(6)::before { content: 'Accuracy'; }
      #moveResults tbody td:nth-child(7)::before { content: 'PP'; }
      #moveResults tbody td:nth-child(8)::before { content: 'Priority'; }
      #moveResults tbody td:nth-child(9)::before { content: 'Effect'; }
      #abilityResults tbody td:nth-child(1)::before { content: 'Ability'; }
      #abilityResults tbody td:nth-child(2)::before { content: 'Effect'; }
      .pokemon-name { width: 100%; }
      .pokemon-name-text, .species-line, .prefix-line { white-space: normal; }
      .table-wrap .sprite { width: 48px; height: 48px; }
      .table-wrap .item-effect { min-width: 0; }
      .table-wrap tbody td:first-child:has(.sprite:only-child) { align-items: center; }
      #pokemonResults tbody tr { grid-template-columns: 4rem minmax(0, 1fr) 4.5rem; }
      #pokemonResults tbody td:first-child { display: none; }
      #pokemonResults tbody td:nth-child(2) {
        display: flex;
        grid-column: 1 / span 2;
        align-items: center;
        justify-content: flex-start;
        text-align: left;
      }
      #pokemonResults tbody td:nth-child(3) {
        display: flex;
        grid-column: 3;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: .05rem;
        padding-inline: .25rem;
      }
      #pokemonResults tbody td:nth-child(2)::before,
      #pokemonResults tbody td:nth-child(3)::before {
        display: none;
        content: none;
      }
      #pokemonResults tbody td:nth-child(n+4) {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        gap: .2rem;
        align-items: center;
        border-top: 1px solid var(--line);
        border-bottom: 0;
        text-align: right;
        min-width: 0;
        overflow: hidden;
        white-space: nowrap;
      }
      #pokemonResults tbody td:nth-child(n+4)::before {
        flex: none;
        color: var(--accent-strong);
        font-size: .7rem;
        text-align: left;
      }
      #pokemonResults tbody .pokemon-name {
        display: flex;
        align-items: center;
        gap: .25rem;
        width: 100%;
        min-width: 0;
        margin: 0;
        transform: none;
        overflow: hidden;
      }
      #pokemonResults tbody .pokemon-name-text {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      #pokemonResults tbody .species-line,
      #pokemonResults tbody .prefix-line,
      #pokemonResults tbody .variant-line {
        display: block;
        white-space: nowrap;
      }
      #pokemonResults tbody .sprite,
      #pokemonResults tbody .sprite-placeholder {
        width: 3.5rem;
        height: 3.5rem;
      }
      #pokemonResults tbody .type-sprite {
        width: 2.5rem;
        height: 1.1rem;
        margin: 0;
      }
      #pokemonResults tbody .type-icon {
        margin: 0;
        line-height: 0;
      }
    }
    @media (min-width: 701px) {
      .table-wrap table th,
      .table-wrap table td,
      .detail-moves-table th,
      .detail-moves-table td,
      .detail-moves-table .sort-button {
        overflow-wrap: normal;
        word-break: normal;
      }
    }

    /* ==========================================================
       Component refinements
       ========================================================== */

    /* Text pages (about, privacy, terms, notices) */
    #aboutPage .entry-card, #privacyPage .entry-card, #termsPage .entry-card, #underConstructionPage .entry-card { width: min(100%, 46rem); margin: 0; padding: clamp(1.25rem, 3vw, 2rem); text-align: left; }
    /* About, Privacy and Terms fill the content column, with their text in one centred column. */
    #aboutPage .entry-card, #privacyPage .entry-card, #termsPage .entry-card { width: 100%; max-width: none; text-align: center; }
    #aboutPage.active, #privacyPage.active, #termsPage.active, #underConstructionPage.active { align-items: flex-start; margin-top: 0; text-align: left; }
    /* About, Privacy and Terms text is centred, headings included. */
    #aboutPage.active, #privacyPage.active, #termsPage.active, #aboutPage .entry-card > h2, #privacyPage .entry-card > h2, #termsPage .entry-card > h2 { text-align: center; }
    #privacyPage .entry-card h3, #termsPage .entry-card h3 { margin: 0 0 .5rem; color: var(--ink); font-size: 1rem; }
    #privacyPage .entry-card p, #termsPage .entry-card p, #aboutPage .entry-card > p { color: var(--ink-muted); }
    /* One column at most 46rem wide keeps lines short enough to read comfortably. */
    #aboutPage .entry-card > *, #privacyPage .entry-card > *, #termsPage .entry-card > * { max-width: 46rem; margin-inline: auto; }
    .page-columns { margin-top: 1.75rem; }
    .page-columns > section { padding-bottom: 1.5rem; }
    .entry-card > h2 { margin-top: 0; }

    /* Cards and detail pages */
    .detail-page.active { margin-top: 0; }
    .detail-card { border-radius: var(--radius-lg); background: var(--panel); }
    .detail-card h3 { color: var(--ink); font-size: 1.375rem; }
    .detail-card > h2 { margin: 0 0 1.25rem; font-size: 1.375rem; text-align: left; }
    .detail-card h4 { margin: 2rem auto .75rem; padding-top: 1.5rem; color: var(--ink); font-size: .8125rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
    .detail-card h4:first-of-type { margin-top: .75rem; }
    .detail-card .detail-stat-graph h4 { color: var(--muted); font-size: .875rem; font-weight: 400; letter-spacing: 0; text-transform: none; }
    .detail-back { min-height: 0; padding: .375rem .75rem; font-size: .8125rem; }
    .detail-back::before { content: ''; display: inline-block; width: .375rem; height: .375rem; margin-right: .5rem; border-left: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-1px) rotate(45deg); }
    .detail-pokemon-form { min-height: 0; padding: .25rem .75rem; font-size: .8125rem; }
    .detail-pokemon-form.active { border-color: var(--accent-strong); background: color-mix(in srgb, var(--accent-strong) 12%, transparent); color: var(--ink); }
    .card { border-radius: var(--radius-lg); }
    .card strong { color: var(--ink); }
    .notice { border-left-color: var(--accent); border-radius: 0 var(--radius) var(--radius) 0; background: var(--panel); color: var(--ink-muted); font-size: .875rem; }

    /* Toolbars and filters */
    .toolbar { justify-content: flex-start; gap: .5rem 1.25rem; margin-bottom: 1rem; }
    .pokemon-toolbar { justify-content: space-between; }
    .table-filter { gap: .5rem; color: var(--ink-muted); font-size: .875rem; cursor: pointer; }
    .table-filter input[type="checkbox"], .detail-stat-option input, .team-speed-options input { accent-color: var(--accent-strong); }
    .table-filter input[type="checkbox"] { min-height: 0; width: 1rem; height: 1rem; }
    .table-count { color: var(--muted); font-size: .8125rem; font-variant-numeric: tabular-nums; }

    /* Data tables */
    .table-wrap { border-color: var(--card-border); border-radius: var(--radius-lg); background: var(--panel); box-shadow: var(--card-shadow); scrollbar-color: var(--line-strong) transparent; }
    .table-scroll-top { border: 0; scrollbar-color: var(--line-strong) transparent; }
    th, td { padding: .625rem .75rem; border-bottom-color: var(--line); font-variant-numeric: tabular-nums; }
    th { border-bottom-color: var(--table-head-line); background: var(--table-head-bg); color: var(--table-head-ink); font-size: .75rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
    /* Zebra rows (light theme only; dark keeps rows flat). Narrow screens render rows as cards, so they skip it. */
    @media (min-width: 701px) { tbody tr:nth-child(even) td { background: var(--table-stripe); } }
    th .sort-button { font-weight: 600; letter-spacing: inherit; text-transform: inherit; }
    .sort-button { min-height: 0; }
    .sort-button:hover { background: transparent; color: var(--ink); }
    [data-entity-type]:hover td, .tournament-history-row:hover td, .tournament-history-row:focus td { background: var(--panel-hover); }
    .type-filter { color: var(--muted); }
    .type-filter-menu { padding: .5rem; border: 0; border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); text-transform: none; letter-spacing: 0; font-size: .8125rem; font-weight: 400; }
    .type-filter-menu label { padding: .25rem .375rem; border-radius: var(--radius-sm); }
    .type-filter-menu label:hover { background: var(--panel-hover); }
    .dex-number { font-size: .8125rem; }
    .type { padding: .125rem .5rem; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--panel-raised); color: var(--ink-muted); font-size: .75rem; white-space: nowrap; }
    .form-prefix { font-size: .75em; }
    .player-placement-chart { border-radius: var(--radius-lg); }
    .pagination-controls button, .tournament-history-pagination button { min-height: 0; padding: .375rem .75rem; }

    /* Popovers and menus share one elevation style */
    .team-autocomplete-options, .detail-stat-tooltip, .team-ko-sprite-label { border-color: var(--line); background: var(--panel-raised); box-shadow: var(--shadow-pop); }
    .confirm-tooltip[data-tooltip]:hover::after, .confirm-tooltip[data-tooltip]:focus-within::after { border-radius: var(--radius); box-shadow: var(--shadow-pop); }

    /* Team builder semantic colors */
    /* Meta highlights: every box takes a tint of its level's color; double steps add a thicker ring and a bold name, so they differ by more than hue. */
    .team-meta-pokemon { --meta-color: var(--line); border-width: 2px; border-color: var(--meta-color); background: color-mix(in srgb, var(--meta-color) 16%, var(--panel)); }
    .team-meta-double-resisted { --meta-color: var(--danger); }
    .team-meta-resisted { --meta-color: var(--warning); }
    .team-meta-super-effective { --meta-color: var(--info); }
    .team-meta-double-effective { --meta-color: var(--success); }
    :is(.team-meta-double-resisted, .team-meta-double-effective) { box-shadow: inset 0 0 0 2px var(--meta-color); }
    :is(.team-meta-double-resisted, .team-meta-double-effective) strong { color: var(--ink); font-weight: 600; }
    .team-meta-legend .double-resisted::before { color: var(--danger); }
    .team-meta-legend .resisted::before { color: var(--warning); }
    .team-meta-legend .neutral::before { color: var(--line); }
    .team-meta-legend .super-effective::before { color: var(--info); }
    .team-meta-legend .double-effective::before { color: var(--success); }
    .team-meta-legend :is(.double-resisted, .resisted, .neutral, .super-effective, .double-effective)::before { background: color-mix(in srgb, currentColor 30%, transparent); }
    .team-meta-legend :is(.double-resisted, .double-effective)::before { box-shadow: inset 0 0 0 1px currentColor; }
    .team-coverage-warning-yellow { border-color: var(--warning); }
    .team-coverage-warning-red { border-color: var(--danger); }
    .team-meta-legend .warning-red::before { color: var(--danger); }
    .team-meta-legend .warning-yellow::before { color: var(--warning); }
    .team-slot { border-radius: var(--radius-lg); }
    .team-slot.team-slot-invalid { border: 2px solid var(--danger); }
    .team-illegal { color: var(--danger) !important; }
    .team-ko-button.active { color: var(--bg); }
    .team-speed-tiers > details > summary, .team-coverage > details > summary, .team-meta > details > summary { font-size: .9375rem; }
    .current-team-section h3, .team-mega-summary h4, .team-form-title, .team-type-summary-section h4, .team-ko-heading { color: var(--ink); }

    /* Mobile: render result tables as compact cards */
    @media (max-width: 700px) {
      .table-wrap { background: none; box-shadow: none; }
      .table-wrap tbody tr { border-color: var(--card-border); border-radius: var(--radius-lg); box-shadow: var(--card-shadow); }
      .table-wrap tbody td::before { color: var(--muted); font-size: .6875rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
      .tournament-history-table td::before { color: var(--muted); font-size: .6875rem; letter-spacing: .04em; text-transform: uppercase; }

      #pokemonResults tbody tr { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; padding: 0; overflow: hidden; }
      #pokemonResults tbody td:nth-child(2) { grid-column: 1 / 5; padding: .625rem .75rem; border: 0; }
      #pokemonResults tbody td:nth-child(3) { grid-column: 5 / 7; flex-direction: column; align-items: flex-end; justify-content: center; gap: .25rem; padding: .625rem .75rem; border: 0; }
      #pokemonResults tbody td:nth-child(3) .type-icon { flex: none; width: auto; height: auto; }
      #pokemonResults tbody td:nth-child(3) .type-sprite { width: 3.75rem; height: 1.5rem; }
      #pokemonResults tbody td:nth-child(n+4) { display: flex; flex-direction: column; align-items: center; gap: .125rem; padding: .5rem 0; border-top: 1px solid var(--line); text-align: center; font-weight: 500; }
      #pokemonResults tbody td:nth-child(n+5) { border-left: 1px solid var(--line); }
      #pokemonResults tbody td:nth-child(n+4)::before { color: var(--muted); font-size: .625rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
      #pokemonResults tbody .pokemon-name { gap: .5rem; }
      #pokemonResults tbody .pokemon-name-text { font-weight: 600; }
      #pokemonResults tbody .sprite, #pokemonResults tbody .sprite-placeholder { width: 3rem; height: 3rem; flex: none; }

      #moveResults tbody td::before, #abilityResults tbody td::before { color: var(--muted); font-size: .6875rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
      #moveResults tbody td:nth-child(n+4)::before { color: var(--muted); font-size: .6875rem; }
      #abilityResults tbody td:first-child { color: var(--ink); }

      #itemResults tbody tr { grid-template-columns: 2.5rem minmax(0, 1fr) auto; align-items: center; column-gap: .75rem; row-gap: .375rem; padding: .75rem; }
      #itemResults tbody td, #itemResults tbody td:nth-child(n) { display: block; width: auto; padding: 0; border: 0; text-align: left; }
      #itemResults tbody td::before { content: none !important; display: none; }
      #itemResults tbody td:first-child { display: block; grid-column: 1; }
      #itemResults tbody td:first-child .sprite { width: 2.5rem; height: 2.5rem; }
      #itemResults tbody td:nth-child(2) { grid-column: 2; font-weight: 600; }
      #itemResults tbody td:nth-child(3) { grid-column: 3; white-space: nowrap; overflow-wrap: normal; }
      #itemResults tbody td:nth-child(3) .item-type-list { align-items: flex-end; }
      #itemResults tbody td:last-child { display: block; grid-column: 1 / -1; color: var(--ink-muted); font-size: .8125rem; line-height: 1.45; }
      #itemResults tbody td .item-effect { text-align: left; }

      .detail-page .detail-card:has(> .table-wrap) { padding: 0; border: 0; background: none; box-shadow: none; }
      .tabs { margin-top: 0; }
      .tab { flex: 1 0 auto; }
      .site-footer { padding-block: 2rem 1.5rem; }
    }

    @media (prefers-reduced-motion: reduce) {
      *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
    }
    /* Windows High Contrast drops box shadows and background fills, so these states also get a border or outline. */
    @media (forced-colors: active) {
      .detail-card.detail-unavailable { outline: 3px solid CanvasText; }
      .role-badge, .detail-stat-track, .stat-track { border: 1px solid CanvasText; }
    }

    /* ==========================================================
       Small screens: compact, readable layouts for every table
       ========================================================== */
    @media (max-width: 700px) {
      .detail-card { padding: .875rem; }
      .detail-card h4 { margin: 1.5rem 0 .625rem; padding-top: 1.25rem; }
      .detail-title-row { flex-direction: column; align-items: flex-start; gap: .625rem; }
      .detail-title-row .detail-back, .detail-back { position: static; margin: 0 0 .5rem; transform: none; }
      .detail-title-row h3 { align-self: center; text-align: center; }
      td[colspan] { white-space: normal !important; overflow-wrap: normal !important; text-align: center; }
      .move-effect, .detail-usage-note { line-height: 1.55; }

      /* Sort controls stay available as a row of chips */
      :is(#pokemonResults, #itemResults, #moveResults, #abilityResults, #detailContent, #tournamentHistoryResults, #tournamentPlayersResults, #tournamentDetailResults, #tournamentPlayerResults, #aggregatePlayerResults) thead:has(.sort-button) { display: block; margin-bottom: .75rem; }
      :is(#pokemonResults, #itemResults, #moveResults, #abilityResults, #detailContent, #tournamentHistoryResults, #tournamentPlayersResults, #tournamentDetailResults, #tournamentPlayerResults, #aggregatePlayerResults) thead:has(.sort-button) tr { display: flex; flex-wrap: wrap; align-items: center; gap: .375rem; padding: 0; border: 0; background: none; }
      :is(#pokemonResults, #itemResults, #moveResults, #abilityResults, #detailContent, #tournamentHistoryResults, #tournamentPlayersResults, #tournamentDetailResults, #tournamentPlayerResults, #aggregatePlayerResults) thead:has(.sort-button) tr::before { content: 'Sort'; margin-right: .125rem; color: var(--muted); font-size: .6875rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
      :is(#pokemonResults, #itemResults, #moveResults, #abilityResults, #detailContent, #tournamentHistoryResults, #tournamentPlayersResults, #tournamentDetailResults, #tournamentPlayerResults, #aggregatePlayerResults) thead:has(.sort-button) th {
        display: inline-flex;
        align-items: center;
        gap: .25rem;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        height: auto;
        padding: 0 !important;
        border: 0;
        background: none;
        color: var(--ink-muted);
        font-size: .75rem !important;
        letter-spacing: 0;
        text-transform: none;
        white-space: nowrap !important;
        transform: none !important;
      }
      :is(#pokemonResults, #itemResults, #moveResults, #abilityResults, #detailContent, #tournamentHistoryResults, #tournamentPlayersResults, #tournamentDetailResults, #tournamentPlayerResults, #aggregatePlayerResults) thead:has(.sort-button) th:empty { display: none; }
      :is(#pokemonResults, #itemResults, #moveResults, #abilityResults, #detailContent, #tournamentHistoryResults, #tournamentPlayersResults, #tournamentDetailResults, #tournamentPlayerResults, #aggregatePlayerResults) thead:has(.sort-button) th:has(> .sort-button):not(:has(.type-filter)) { display: contents !important; }
      :is(#pokemonResults, #itemResults, #moveResults, #abilityResults, #detailContent, #tournamentHistoryResults, #tournamentPlayersResults, #tournamentDetailResults, #tournamentPlayerResults, #aggregatePlayerResults) thead:has(.sort-button) th:not(:has(.sort-button)) { padding: .3125rem .625rem !important; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); }
      :is(#pokemonResults, #itemResults, #moveResults, #abilityResults, #detailContent, #tournamentHistoryResults, #tournamentPlayersResults, #tournamentDetailResults, #tournamentPlayerResults, #aggregatePlayerResults) thead:has(.sort-button) .sort-button {
        display: inline-flex !important;
        align-items: center;
        gap: .25rem;
        width: auto !important;
        min-height: 2.75rem;
        padding: .3125rem .625rem !important;
        border: 1px solid var(--line) !important;
        border-radius: 999px;
        background: var(--panel);
        color: var(--ink-muted);
        font-size: .75rem !important;
        font-weight: 500;
        line-height: 1.2 !important;
        letter-spacing: 0;
        text-transform: none;
        white-space: nowrap !important;
        transform: none !important;
      }
      :is(#detailContent) thead .detail-move-header-full { display: inline !important; }
      :is(#detailContent) thead .detail-move-header-short { display: none !important; }

      /* Pokémon detail: moves list as two-line rows */
      #detailContent .detail-moves-table:not(.detail-abilities-table) { display: block; font-size: .875rem; }
      #detailContent .detail-moves-table:not(.detail-abilities-table) tbody { display: grid; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel-raised); }
      #detailContent .detail-moves-table:not(.detail-abilities-table) tbody tr { display: grid; grid-template-columns: 4.25rem minmax(0, 1fr) auto auto auto; align-items: center; gap: .3125rem .75rem; padding: .5625rem .75rem; border-bottom: 1px solid var(--line); }
      #detailContent .detail-moves-table:not(.detail-abilities-table) tbody tr:last-child { border-bottom: 0; }
      #detailContent .detail-moves-table:not(.detail-abilities-table) td { display: block; width: auto !important; padding: 0 !important; border: 0; font-size: .8125rem !important; line-height: 1.3 !important; text-align: left; white-space: nowrap !important; }
      #detailContent .detail-moves-table:not(.detail-abilities-table) td:nth-child(1) { grid-column: 1 / 4; grid-row: 1; font-size: .9375rem !important; font-weight: 600; white-space: normal !important; }
      #detailContent .detail-moves-table:not(.detail-abilities-table) td:nth-child(2) { grid-column: 1; grid-row: 2; }
      #detailContent .detail-moves-table:not(.detail-abilities-table) td:nth-child(2) .type-icon { display: block; margin: 0; }
      #detailContent .detail-moves-table:not(.detail-abilities-table) td:nth-child(2) .type-sprite { width: 4.25rem; height: 1.375rem; }
      #detailContent .detail-moves-table:not(.detail-abilities-table) td:nth-child(3) { grid-column: 2; grid-row: 2; color: var(--ink-muted); }
      #detailContent .detail-moves-table:not(.detail-abilities-table) td:nth-child(4) { grid-column: 3; grid-row: 2; }
      #detailContent .detail-moves-table:not(.detail-abilities-table) td:nth-child(5) { grid-column: 4; grid-row: 2; }
      #detailContent .detail-moves-table:not(.detail-abilities-table) td:nth-child(6) { grid-column: 5; grid-row: 2; }
      #detailContent .detail-moves-table:not(.detail-abilities-table) td:nth-child(7) { grid-column: 4 / 6; grid-row: 1; justify-self: end; font-weight: 600; }
      #detailContent .detail-moves-table:not(.detail-abilities-table) td:nth-child(n+4)::before { margin-right: .25rem; color: var(--muted); font-size: .625rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
      #detailContent .detail-moves-table:not(.detail-abilities-table) td:nth-child(4)::before { content: 'Pwr'; }
      #detailContent .detail-moves-table:not(.detail-abilities-table) td:nth-child(5)::before { content: 'Acc'; }
      #detailContent .detail-moves-table:not(.detail-abilities-table) td:nth-child(6)::before { content: 'Pri'; }
      #detailContent .detail-moves-table:not(.detail-abilities-table) td:nth-child(7)::before { content: 'Use'; }

      /* Pokémon detail: abilities as cards with the full-width effect underneath */
      #detailContent .detail-abilities-table { display: block; }
      #detailContent .detail-abilities-table thead { display: none; }
      #detailContent .detail-abilities-table tbody { display: grid; gap: .5rem; }
      #detailContent .detail-abilities-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .25rem .75rem; padding: .75rem .875rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel-raised); }
      #detailContent .detail-abilities-table td { display: block; width: auto !important; padding: 0 !important; border: 0; font-size: .8125rem !important; text-align: left; }
      #detailContent .detail-abilities-table td:nth-child(1) { grid-column: 1; grid-row: 1; font-size: .9375rem !important; font-weight: 600; }
      #detailContent .detail-abilities-table td:nth-child(2) { grid-column: 1 / -1; grid-row: 2; color: var(--ink-muted); line-height: 1.45; }
      #detailContent .detail-abilities-table td:nth-child(3) { grid-column: 2; grid-row: 1; align-self: center; font-weight: 600; white-space: nowrap; }
      #detailContent .detail-abilities-table td:nth-child(3)::before { content: 'Use'; margin-right: .25rem; color: var(--muted); font-size: .625rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }

      /* Move, item and ability detail: Pokémon lists as single-line rows */
      #detailContent .detail-ability-pokemon-table { display: block; width: 100%; }
      #detailContent .detail-ability-pokemon-table tbody { display: grid; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel-raised); }
      #detailContent .detail-ability-pokemon-table tbody tr { display: grid; grid-template-columns: 2.5rem minmax(0, 1fr) auto; align-items: center; gap: .75rem; padding: .375rem .75rem; border-bottom: 1px solid var(--line); }
      #detailContent .detail-ability-pokemon-table tbody tr:last-child { border-bottom: 0; }
      #detailContent .detail-ability-pokemon-table td { display: block; width: auto; padding: 0; border: 0; text-align: left; }
      #detailContent .detail-ability-pokemon-table td:nth-child(2) { font-weight: 500; }
      #detailContent .detail-ability-pokemon-table td:nth-child(3) { font-weight: 600; text-align: right; }
      #detailContent .detail-ability-pokemon-table .sprite { display: block; width: 2.5rem; height: 2.5rem; }

      /* Move detail: attribute table as a 3 × 2 grid of tiles */
      #detailContent .move-attributes-table { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel-raised); }
      #detailContent .move-attributes-table :is(thead, tbody, tr) { display: contents; }
      #detailContent .move-attributes-table :is(th, td) { width: auto !important; padding: .5rem .5rem 0 !important; border: 0; background: none; font-size: .875rem !important; text-align: center; white-space: nowrap; }
      #detailContent .move-attributes-table th { padding-top: .75rem !important; font-size: .625rem !important; }
      #detailContent .move-attributes-table td { padding-bottom: .75rem !important; }
      #detailContent .move-attributes-table th:nth-child(-n+3) { grid-row: 1; }
      #detailContent .move-attributes-table td:nth-child(-n+3) { grid-row: 2; }
      #detailContent .move-attributes-table th:nth-child(n+4) { grid-row: 3; border-top: 1px solid var(--line); }
      #detailContent .move-attributes-table td:nth-child(n+4) { grid-row: 4; }
      #detailContent .move-attributes-table :is(th, td):is(:nth-child(1), :nth-child(4)) { grid-column: 1; }
      #detailContent .move-attributes-table :is(th, td):is(:nth-child(2), :nth-child(5)) { grid-column: 2; }
      #detailContent .move-attributes-table :is(th, td):is(:nth-child(3), :nth-child(6)) { grid-column: 3; }
      #detailContent .move-attributes-table .type-icon { display: inline-block; margin: 0; }
      #detailContent .move-attributes-table .type-sprite { width: 4.25rem; height: 1.375rem; }

      /* Move detail: tags in two readable columns */
      .move-tags-table { display: block; width: 100%; }
      .move-tags-table tbody { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--line); }
      .move-tags-table tr { display: contents; }
      .move-tags-table td { display: flex; align-items: center; justify-content: space-between; gap: .5rem; width: auto !important; padding: .5rem .75rem !important; border: 0; background: var(--panel-raised); text-align: left; }
      .move-tags-table td:empty { display: none; }
      .move-tag-name { font-size: .8125rem; line-height: 1.25; overflow-wrap: normal; }
      .move-tag-status { margin: 0; font-size: .875rem; }

      /* Type matchups: three compact columns instead of three stacked blocks */
      .team-type-summary, #addPokemonPage .team-type-summary { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 0; width: 100% !important; margin-inline: 0; }
      .team-type-summary .team-type-summary-section { min-width: 0; min-height: 0; padding: .5rem .25rem; border-top: 0 !important; }
      .team-type-summary .team-type-summary-section + .team-type-summary-section { border-left: 1px solid var(--line) !important; }
      .detail-card .team-type-summary-section h4, .team-type-summary-section h4 { margin: 0 0 .5rem; padding: 0; border: 0; font-size: .6875rem; }
      .team-type-summary .team-type-summary-content { grid-template-columns: 1fr !important; justify-items: center; row-gap: .25rem; }
      .team-type-summary .detail-type-effect-entry, .team-type-summary-content > .detail-type-effect-entry:last-child:nth-child(odd) { width: auto !important; min-width: 0 !important; max-width: none !important; justify-content: center !important; gap: .25rem; grid-column: auto; }
      .team-type-summary .detail-type-effect-multiplier { flex: 0 0 auto !important; width: auto !important; font-size: .6875rem !important; }
      .team-type-summary .type-icon { width: auto !important; height: auto !important; }
      .team-type-summary .type-sprite { width: 3.25rem !important; height: 1.25rem !important; }

      /* Stat chart: larger, legible labels on the narrow viewBox */
      .detail-stat-chart { height: auto; }
      .detail-stat-chart text { font-size: 13px; }
      .detail-stat-nature-marker-label { font-size: 12px !important; }
      .detail-stat-options { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
      .detail-stat-option { justify-content: center; padding: .375rem .25rem; border: 1px solid var(--line); border-radius: var(--radius); font-size: .8125rem; }
      .detail-stat-option:has(input:checked) { border-color: var(--accent-strong); color: var(--ink); background: color-mix(in srgb, var(--accent-strong) 12%, transparent); }
      .detail-stat-option input { position: absolute; opacity: 0; pointer-events: none; }
      .player-placement-chart .chart-label { font-size: 12px; }

      /* Moves list page: name and type, a stat line, then the effect */
      #moveResults tbody tr { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .5rem .375rem; padding: .75rem; }
      #moveResults tbody td, #moveResults tbody td:nth-child(n) { display: flex; flex-direction: column; align-items: center; gap: .125rem; width: auto; padding: 0; border: 0; text-align: center; font-size: .875rem; }
      #moveResults tbody td:nth-child(1) { grid-column: 1 / 4; grid-row: 1; align-items: flex-start; justify-content: center; font-size: .9375rem; font-weight: 600; text-align: left; }
      #moveResults tbody td:nth-child(2) { grid-column: 4 / 6; grid-row: 1; align-items: flex-end; justify-content: center; }
      #moveResults tbody td:nth-child(2) .type-icon { flex: none; width: auto; height: auto; }
      #moveResults tbody td:nth-child(2) .type-sprite { width: 4.25rem; height: 1.375rem; }
      #moveResults tbody td:nth-child(1)::before, #moveResults tbody td:nth-child(2)::before, #moveResults tbody td:nth-child(3) { display: none; content: none; }
      #moveResults tbody td:nth-child(4) { grid-column: 1; grid-row: 2; }
      #moveResults tbody td:nth-child(5) { grid-column: 2; grid-row: 2; }
      #moveResults tbody td:nth-child(6) { grid-column: 3; grid-row: 2; }
      #moveResults tbody td:nth-child(7) { grid-column: 4; grid-row: 2; }
      #moveResults tbody td:nth-child(8) { grid-column: 5; grid-row: 2; }
      #moveResults tbody td:nth-child(n+4):nth-child(-n+8) { padding: .375rem 0; border-top: 1px solid var(--line); }
      #moveResults tbody td:nth-child(n+4)::before { color: var(--muted); font-size: .5625rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
      #moveResults tbody td:nth-child(9) { display: -webkit-box; grid-column: 1 / -1; grid-row: 3; overflow: hidden; color: var(--ink-muted); font-size: .8125rem; line-height: 1.45; text-align: left; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
      #moveResults tbody td:nth-child(9)::before { display: none; content: none; }

      /* ---------- Tournament tables ---------- */
      :is(#tournamentHistoryResults, #tournamentPlayersResults, #tournamentDetailResults, #tournamentPlayerResults, #aggregatePlayerResults) .tournament-history-table tbody { gap: .5rem; }
      :is(#tournamentHistoryResults, #tournamentPlayersResults, #tournamentDetailResults, #tournamentPlayerResults, #aggregatePlayerResults) .tournament-history-table tr { gap: .375rem .75rem; padding: .75rem .875rem; border-radius: var(--radius-lg); text-align: left; }
      :is(#tournamentHistoryResults, #tournamentPlayersResults, #tournamentDetailResults, #tournamentPlayerResults, #aggregatePlayerResults) .tournament-history-table td {
        display: flex !important;
        flex-direction: column;
        grid-column: auto;
        align-items: flex-start;
        justify-content: flex-start;
        width: auto !important;
        min-width: 0 !important;
        max-width: none;
        padding: 0;
        gap: .125rem;
        font-size: .875rem;
        text-align: left;
        white-space: normal;
        font-variant-numeric: tabular-nums;
      }
      :is(#tournamentHistoryResults, #tournamentPlayersResults, #tournamentDetailResults, #tournamentPlayerResults, #aggregatePlayerResults) .tournament-history-table td::before { color: var(--muted); font-size: .625rem; font-weight: 600; letter-spacing: .04em; line-height: 1.3; text-transform: uppercase; }

      /* History: name, then date and player count */
      #tournamentHistoryResults .tournament-history-table tbody tr { grid-template-columns: minmax(0, 1fr) auto; }
      #tournamentHistoryResults .tournament-history-table td::before { display: none; }
      #tournamentHistoryResults .tournament-history-table td:nth-child(1) { grid-column: 1 / -1; font-size: .9375rem; font-weight: 600; }
      #tournamentHistoryResults .tournament-history-table td:nth-child(2) { color: var(--muted); font-size: .8125rem; }
      #tournamentHistoryResults .tournament-history-table td:nth-child(3) { flex-direction: row; justify-self: end; color: var(--muted); font-size: .8125rem; }
      #tournamentHistoryResults .tournament-history-table td:nth-child(3)::after { content: '\00a0players'; }

      /* Player list and profile summary: name, then a 3-column stat grid */
      #tournamentPlayersResults .player-list-table tbody tr, #aggregatePlayerResults .player-profile-table:not(.player-profile-results-table) tbody tr { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); }
      #aggregatePlayerResults .player-profile-table:not(.player-profile-results-table) tbody { display: block; }
      #tournamentPlayersResults .player-list-table td:nth-child(1) { grid-column: 1 / -1; font-size: .9375rem; font-weight: 600; }
      #tournamentPlayersResults .player-list-table td:nth-child(1)::before { display: none; }
      #aggregatePlayerResults .player-profile-table td { display: flex; }

      /* Tournament standings: place, name and country, record line, team strip */
      #tournamentDetailResults .tournament-detail-player-table tbody tr { grid-template-columns: 2.25rem minmax(0, 1fr) auto; align-items: center; }
      #tournamentDetailResults .tournament-detail-player-table td::before { display: inline; margin-right: .25rem; }
      #tournamentDetailResults .tournament-detail-player-table td { flex-direction: row; align-items: baseline; }
      #tournamentDetailResults .tournament-detail-player-table td:nth-child(1) { grid-column: 1; grid-row: 1 / 3; align-self: center; color: var(--accent-strong); font-size: 1.0625rem; font-weight: 700; }
      #tournamentDetailResults .tournament-detail-player-table td:nth-child(1)::before { content: '#'; margin: 0; color: inherit; font-size: inherit; letter-spacing: 0; }
      #tournamentDetailResults .tournament-detail-player-table td:nth-child(2) { grid-column: 2; grid-row: 1; font-size: .9375rem; font-weight: 600; }
      #tournamentDetailResults .tournament-detail-player-table td:nth-child(3) { grid-column: 3; grid-row: 1; justify-self: end; color: var(--muted); font-size: .8125rem; }
      #tournamentDetailResults .tournament-detail-player-table td:nth-child(2)::before, #tournamentDetailResults .tournament-detail-player-table td:nth-child(3)::before, #tournamentDetailResults .tournament-detail-player-table td:nth-child(6)::before { display: none; }
      #tournamentDetailResults .tournament-detail-player-table td:nth-child(4) { grid-column: 2; grid-row: 2; }
      #tournamentDetailResults .tournament-detail-player-table td:nth-child(5) { grid-column: 3; grid-row: 2; justify-self: end; }
      #tournamentDetailResults .tournament-detail-player-table td:nth-child(6) { grid-column: 1 / -1; grid-row: 3; padding-top: .25rem; }
      :is(#tournamentDetailResults, #aggregatePlayerResults) .tournament-team-sprites { grid-template-columns: repeat(6, minmax(0, 1fr)); grid-template-rows: auto; min-height: 0; }
      :is(#tournamentDetailResults, #aggregatePlayerResults) .tournament-team-sprites img, :is(#tournamentDetailResults, #aggregatePlayerResults) .player-profile-sprite { width: 2.5rem; height: 2.5rem; }
      #aggregatePlayerResults .player-profile-sprites { grid-template-columns: repeat(6, minmax(0, 1fr)); grid-template-rows: auto; width: 100%; }

      /* Player profile results: tournament, regulation, record line, team strip */
      #aggregatePlayerResults .player-profile-results-table tbody tr { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); }
      #aggregatePlayerResults .player-profile-results-table td:nth-child(1) { grid-column: 1 / -1; font-weight: 600; }
      #aggregatePlayerResults .player-profile-results-table td:nth-child(2) { grid-column: 1 / -1; color: var(--muted); font-size: .8125rem; }
      #aggregatePlayerResults .player-profile-results-table td:nth-child(1)::before, #aggregatePlayerResults .player-profile-results-table td:nth-child(2)::before, #aggregatePlayerResults .player-profile-results-table td:nth-child(6)::before { display: none; }
      #aggregatePlayerResults .player-profile-results-table td:nth-child(6) { grid-column: 1 / -1; padding-top: .25rem; }

      /* Tournament team sheet: sprite beside types, nature, ability and item; moves underneath */
      #tournamentPlayerResults .tournament-player-team-table tbody tr { grid-template-columns: 3.5rem minmax(0, .8fr) minmax(0, 1fr) minmax(0, 1.3fr); align-items: start; }
      #tournamentPlayerResults .tournament-player-team-table td:nth-child(1) { grid-column: 1; grid-row: 1 / 3; align-self: center; }
      #tournamentPlayerResults .tournament-player-team-table td:nth-child(1)::before, #tournamentPlayerResults .tournament-player-team-table td:nth-child(2)::before, #tournamentPlayerResults .tournament-player-team-table td:nth-child(6)::before { display: none; }
      #tournamentPlayerResults .tournament-player-team-table td:nth-child(2) { grid-column: 2 / -1; grid-row: 1; }
      #tournamentPlayerResults .tournament-player-team-table td:nth-child(3) { grid-column: 2; grid-row: 2; }
      #tournamentPlayerResults .tournament-player-team-table td:nth-child(4) { grid-column: 3; grid-row: 2; }
      #tournamentPlayerResults .tournament-player-team-table td:nth-child(5) { grid-column: 4; grid-row: 2; }
      #tournamentPlayerResults .tournament-player-team-table td:nth-child(6) { grid-column: 1 / -1; grid-row: 3; padding-top: .5rem; border-top: 1px solid var(--line); }
      #tournamentPlayerResults .tournament-player-pokemon-sprite { width: 3.5rem; height: 3.5rem; }
      #tournamentPlayerResults .tournament-player-types { justify-content: flex-start; }
      #tournamentPlayerResults .tournament-player-moves { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
      #tournamentPlayerResults .tournament-player-move { font-size: .8125rem; text-align: left; }

      /* Round results: player vs opponent with the score in the middle */
      #tournamentPlayerResults .tournament-round-results-table tbody tr { grid-template-columns: minmax(0, 1fr) auto auto minmax(0, 1fr); align-items: center; }
      #tournamentPlayerResults .tournament-round-results-table td { white-space: normal !important; }
      #tournamentPlayerResults .tournament-round-results-table td::before { display: none; }
      #tournamentPlayerResults .tournament-round-results-table td:nth-child(1) { grid-column: 1; grid-row: 1; font-weight: 600; }
      #tournamentPlayerResults .tournament-round-results-table td:nth-child(3) { grid-column: 2; grid-row: 1; font-size: 1rem; font-weight: 700; }
      #tournamentPlayerResults .tournament-round-results-table td:nth-child(4) { grid-column: 3; grid-row: 1; font-size: 1rem; font-weight: 700; }
      #tournamentPlayerResults .tournament-round-results-table td:nth-child(4)::before { display: inline; content: '–'; margin-right: .375rem; color: var(--muted); font-size: 1rem; }
      #tournamentPlayerResults .tournament-round-results-table td:nth-child(6) { grid-column: 4; grid-row: 1; align-items: flex-end; font-weight: 600; text-align: right; }
      #tournamentPlayerResults .tournament-round-results-table td:nth-child(2) { grid-column: 1 / 3; grid-row: 2; }
      #tournamentPlayerResults .tournament-round-results-table td:nth-child(5) { grid-column: 3 / 5; grid-row: 2; align-items: flex-end; }
      #tournamentPlayerResults .tournament-round-results-table td[colspan] { grid-column: 1 / -1; grid-row: 1; align-items: center; }

      /* ---------- Team builder ---------- */
      .current-team-slots { grid-template-columns: repeat(6, minmax(0, 1fr)) !important; gap: .25rem; }
      .current-team-slot { min-height: 3.5rem; padding: .125rem; font-size: .5625rem; line-height: 1.15; }
      .current-team-slot img { width: 2.75rem; height: 2.75rem; }
      .current-team-slot-types { display: none; }
      .team-pokemon-mega:empty, .team-pokemon-mega:not(:has(img)) { display: none; }
      .team-pokemon-identity, .team-pokemon-mega { min-height: 0; }
      .team-pokemon-sprite { width: 88px; height: 88px; }
      .add-pokemon-heading h2 { font-size: 1.25rem; }
      .team-add-form { gap: .25rem; margin-top: 1rem; }
      .team-add-section { padding: .5rem 0; }
      .team-add-section + .team-add-section { border-top: 1px solid var(--line); }
      .team-add-section h4 { font-size: .75rem; }
      .team-add-fields.team-stat-points-fields, #addPokemonPage .team-add-fields.team-stat-points-fields { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: .5rem; }
      .team-stat-points-fields label { gap: .25rem; font-size: .8125rem; }
      .team-stat-points-fields input { padding-inline: .5rem; }
      .team-move-stats { gap: .25rem; font-size: .75rem; }
      .team-speed-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .team-ko-buttons { grid-template-columns: none !important; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: .375rem; }
      .team-ko-button { padding: .375rem .25rem; }
      .team-ko-sprites { justify-content: flex-start; gap: .25rem; max-height: 13.5rem; overflow-y: auto; overscroll-behavior: contain; }
      .team-ko-sprite { width: 2.5rem; height: 2.5rem; }
      .team-slots { gap: .5rem; }
      .team-slot { min-height: 104px; }
    }
    @media (max-width: 380px) {
      .team-add-fields.team-stat-points-fields, #addPokemonPage .team-add-fields.team-stat-points-fields { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
      #detailContent .detail-moves-table:not(.detail-abilities-table) tbody tr { grid-template-columns: 4rem minmax(0, 1fr) auto auto auto; column-gap: .5rem; }
    }

    /* Speed Tiers page */
    .speed-tiers-card { text-align: left; }
    .speed-tiers-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .5rem 0 .75rem; }
    .speed-tiers-toggle[aria-pressed="true"] { border-color: var(--accent-strong); background: var(--panel-hover); color: var(--accent-strong); }
    /* Speed Stage: a short number box between − and + buttons, kept in the row of toggles. */
    .speed-stage-field { display: inline-flex; align-items: center; gap: .5rem; }
    .speed-stage-field label { color: var(--ink-muted); font-size: .875rem; }
    .speed-stage-stepper { display: inline-flex; align-items: stretch; }
    .speed-stage-stepper button { min-width: 2.25rem; padding: .375rem .5rem; font-size: 1rem; line-height: 1; }
    .speed-stage-stepper button:first-child { border-radius: var(--radius) 0 0 var(--radius); }
    .speed-stage-stepper button:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
    .speed-stage-stepper button:disabled { opacity: .45; cursor: not-allowed; }
    .speed-stage-stepper input { width: 3rem; margin: 0 -1px; border-radius: 0; text-align: center; font-variant-numeric: tabular-nums; }
    .team-speed-stages { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem; margin: .4rem 0 .75rem; }
    .team-speed-stages .speed-stage-field label { font-size: .75rem; }
    .speed-tiers-table { width: 100%; }
    .speed-tiers-table th, .speed-tiers-table td { text-align: left; vertical-align: middle; }
    .speed-tiers-table th:first-child, .speed-tiers-table td.speed-tiers-speed { width: 5rem; }
    .speed-tiers-table th:last-child { width: auto; }
    .speed-tiers-table td.speed-tiers-speed { font-weight: 700; color: var(--accent-strong); white-space: nowrap; }
    .speed-tiers-pokemon-list { display: flex; flex-wrap: wrap; gap: .25rem; width: 100%; }
    .speed-tiers-pokemon { position: relative; display: inline-flex; border-radius: var(--radius); }
    .speed-tiers-pokemon:hover, .speed-tiers-pokemon:focus-visible { text-decoration: none; background: var(--panel-hover); }
    .speed-tiers-pokemon img { width: 2.5rem; height: 2.5rem; object-fit: contain; }
    .speed-tiers-name { position: absolute; z-index: 3; bottom: calc(100% + .2rem); left: 50%; transform: translateX(calc(-50% + var(--speed-name-shift, 0px))); padding: .2rem .45rem; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--panel-raised); color: var(--ink); font-size: .75rem; white-space: nowrap; pointer-events: none; display: none; }
    .speed-tiers-pokemon:hover .speed-tiers-name, .speed-tiers-pokemon:focus-visible .speed-tiers-name, .speed-tiers-pokemon.is-revealed .speed-tiers-name, .speed-tiers-pokemon.is-highlighted .speed-tiers-name { display: block; }
    .speed-tiers-pokemon.is-highlighted { background: var(--panel-hover); box-shadow: 0 0 0 2px var(--accent-strong); }
    .speed-tiers-search { position: relative; width: min(100%, 20rem); margin: 0 0 .75rem; }
    .speed-tiers-search input { width: 100%; box-sizing: border-box; }
    /* A search box that filters the table under it. */
    .table-search { width: min(100%, 20rem); margin: 0 0 .75rem; }
    .table-search input { width: 100%; box-sizing: border-box; }
    .speed-tiers-suggestions { position: absolute; z-index: 6; top: calc(100% + .25rem); left: 0; right: 0; display: grid; max-height: 16rem; overflow-y: auto; padding: .25rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-raised); box-shadow: var(--shadow-pop); }
    .speed-tiers-suggestions[hidden] { display: none; }
    .speed-tiers-suggestions button { display: flex; align-items: center; gap: .5rem; border: 0; background: none; text-align: left; }
    .speed-tiers-suggestions button:hover, .speed-tiers-suggestions button:focus-visible { background: var(--panel-hover); }
    .speed-tiers-suggestions img { width: 1.75rem; height: 1.75rem; object-fit: contain; }
    /* Player usage cards */
    .player-profile-usage-list { grid-auto-rows: 2.75rem; }
    .player-profile-usage-entry { height: 2.75rem; color: inherit; text-decoration: none; border-radius: var(--radius-sm); }
    .player-profile-usage-entry:hover, .player-profile-usage-entry:focus-visible { background: var(--panel-hover); }
    .player-profile-usage-entry > span[aria-hidden="true"] { width: 2.5rem; height: 2.5rem; }
    .player-profile-usage-entry-name { overflow: hidden; overflow-wrap: normal; white-space: nowrap; text-overflow: ellipsis; }
    .entity-link { color: var(--link); text-decoration: none; }
    .entity-link:hover, .entity-link:focus-visible { text-decoration: underline; }
    .tournament-player-moves .entity-link { display: inline; }
    .tournament-round-results-table td a { white-space: normal; overflow-wrap: anywhere; }
    .player-other-names { margin: 0 0 .75rem; text-align: center; }
    /* Player history filters */
    .player-history-filters { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin: 0 0 .75rem; }
    /* The filters, placements graph, and table share one panel so the filters visibly apply to both. */
    .player-results-panel { margin: 0 0 1.25rem; padding: .75rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel); }
    .player-results-scope { margin-bottom: .5rem; }
    .player-results-scope p { margin: -.25rem 0 .5rem; font-size: .85rem; }
    .player-results-panel .player-placement-chart { border: 0; background: transparent; margin: .5rem 0; padding: 0; }
    .player-history-filters label { display: inline-flex; align-items: center; gap: .4rem; color: var(--ink-muted); font-size: .875rem; }
    /* Regulation Analysis */
    .analysis-card { text-align: left; }
    .analysis-controls { display: grid; gap: .6rem; margin: .5rem 0 1rem; }
    .analysis-control-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; }
    .analysis-control-row label { display: inline-flex; align-items: center; gap: .4rem; color: var(--ink-muted); font-size: .875rem; }
    .analysis-control-label { min-width: 6rem; color: var(--ink-muted); font-size: .875rem; }
    .analysis-chip-select, .analysis-chip { display: inline-flex; align-items: center; gap: .25rem; }
    .analysis-chip { padding: .3rem .3rem .3rem .65rem; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--panel-raised); }
    .analysis-remove { min-width: 0; min-height: 0; width: 1.75rem; height: 1.75rem; padding: 0; font-size: .75rem; }
    .analysis-search { position: relative; display: inline-block; width: min(100%, 16rem); }
    .analysis-search input { width: 100%; box-sizing: border-box; }
    .analysis-suggestions { position: absolute; z-index: 6; top: calc(100% + .25rem); left: 0; right: 0; display: grid; max-height: 16rem; overflow-y: auto; padding: .25rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-raised); box-shadow: var(--shadow-pop); }
    .analysis-suggestions[hidden] { display: none; }
    .analysis-suggestions button { display: flex; align-items: center; gap: .5rem; border: 0; background: none; text-align: left; }
    .analysis-suggestions button:hover, .analysis-suggestions button:focus-visible { background: var(--panel-hover); }
    .analysis-suggestions img { width: 1.75rem; height: 1.75rem; object-fit: contain; }
    .analysis-legend { display: flex; flex-wrap: wrap; gap: .35rem 1rem; margin: 0 0 .5rem; padding: 0; list-style: none; color: var(--ink-muted); font-size: .8125rem; }
    .analysis-legend li { display: inline-flex; align-items: center; gap: .4rem; }
    .analysis-swatch { display: inline-block; flex: none; width: .75rem; height: .75rem; margin-right: .35rem; border-radius: 2px; vertical-align: -1px; }
    .analysis-legend .analysis-swatch { margin-right: 0; }
    .analysis-plot { position: relative; padding: .5rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel); }
    .analysis-plot svg { display: block; width: 100%; height: auto; overflow: visible; }
    .analysis-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 3; }
    .analysis-axis { stroke: var(--line-strong); stroke-width: 1; }
    .analysis-axis-label { fill: var(--muted); font-size: 11px; }
    .analysis-direct-label { fill: var(--ink-muted); font-size: 12px; }
    .analysis-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
    .analysis-marker { stroke: var(--panel); stroke-width: 2; }
    .analysis-crosshair { stroke: var(--line-strong); stroke-width: 1; }
    .analysis-hit { fill: transparent; cursor: crosshair; }
    .analysis-scatter-point { fill: var(--accent); fill-opacity: .55; stroke: var(--accent); stroke-width: 1; }
    .analysis-scatter-point.keyboard-active { fill-opacity: 1; stroke: var(--ink); stroke-width: 2; }
    .analysis-hit.keyboard-active { fill: var(--accent); fill-opacity: .12; }
    .analysis-scatter-ref { stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 4 4; }
    .analysis-scatter-label { pointer-events: none; }
    .analysis-tooltip { position: absolute; top: .5rem; transform: translateX(-50%); display: grid; gap: .2rem; min-width: 11rem; padding: .5rem .65rem; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--panel-raised); box-shadow: var(--shadow-pop); color: var(--ink); font-size: .8125rem; pointer-events: none; }
    .analysis-tooltip[hidden] { display: none; }
    .analysis-tooltip span { display: flex; align-items: center; color: var(--ink-muted); }
    .analysis-table { width: 100%; margin-top: 1rem; }
    .analysis-table th[scope="row"] { text-align: left; white-space: nowrap; }
    .analysis-table-section { margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
    .analysis-table-section h3 { margin: 0 0 .25rem; }
    .analysis-tabs { display: flex; gap: .25rem; margin: .5rem 0 1.25rem; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
    .analysis-tabs::-webkit-scrollbar { display: none; }
    /* At phone width the tabs shrink and wrap their labels, so none is cut off
       behind the hidden scrollbar. */
    @media (max-width: 480px) { .analysis-tabs .tab { flex: 1 1 auto; padding-inline: .5rem; overflow-wrap: normal; word-break: normal; } }
    .analysis-panel[hidden] { display: none; }
    .analysis-panel > .analysis-table-section:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
    .analysis-winrate-table { width: 100%; }
    .analysis-winrate-table tbody th { text-align: left; font-weight: 500; }
    .analysis-winrate-name { display: inline-flex; align-items: center; gap: .5rem; }
    .analysis-winrate-name img { width: 1.4rem; height: 1.4rem; object-fit: contain; }
    .analysis-winrate-table th, .analysis-winrate-table td { padding: .35rem .5rem; line-height: 1.2; }
    .analysis-winrate-table tbody th { padding-top: .25rem; padding-bottom: .25rem; }
    .analysis-winrate-wins { display: block; font-size: .75rem; font-weight: 400; color: var(--muted); }
    /* The one-archetype matchup list replaces the grid on small screens only (see the 700px rules below). */
    .analysis-matchup-focus { display: none; }
    .analysis-winrate-table th .analysis-winrate-wins { display: inline; margin-left: .35rem; }
    .analysis-core-view { margin-top: 1.25rem; }
    .analysis-core-view > h4 { margin: 0 0 .25rem; padding: 0; border: 0; }
    .analysis-core-members { display: flex; flex-wrap: wrap; gap: .25rem .75rem; }
    .analysis-core-table tbody th { text-align: left; font-weight: 500; }
    .analysis-core-table td { white-space: nowrap; }
    .analysis-core-table tbody th, .analysis-core-table tbody td { border-bottom: 1px solid var(--line); }
    .analysis-core-table tbody tr:last-child > * { border-bottom: 0; }
    .core-add-button { min-width: 0; min-height: 0; width: 2rem; height: 2rem; padding: 0; border-radius: 50%; font-size: 1.25rem; line-height: 1; }
    /* Pokémon roles (feature 44) and team archetypes (features 38 and 45) */
    .pokemon-roles { display: flex; flex-wrap: wrap; gap: .3rem; margin: 0; }
    .role-badge { display: inline-flex; align-items: center; justify-content: center; min-height: 1.5rem; margin: .1rem .2rem .1rem 0; padding: .15rem .6rem; border-radius: 999px; color: var(--on-badge); font-size: .8125rem; font-weight: 600; line-height: 1.2; text-shadow: 0 1px 1px var(--scrim); white-space: nowrap; vertical-align: middle; }
    .role-badge.role-physical-sweeper { background: var(--role-physical-sweeper); }
    .role-badge.role-special-sweeper { background: var(--role-special-sweeper); }
    .role-badge.role-mixed-sweeper { background: var(--role-mixed-sweeper); }
    .role-badge.role-physical-wall { background: var(--role-physical-wall); }
    .role-badge.role-special-wall { background: var(--role-special-wall); }
    .role-badge.role-mixed-wall { background: var(--role-mixed-wall); }
    .role-badge.role-support-only { background: var(--role-support-only); }
    .role-badge.role-support { background: var(--role-support); }
    .role-badge.role-trick-room-setter { background: var(--role-trick-room-setter); }
    .role-badge.role-tailwind-setter { background: var(--role-tailwind-setter); }
    .role-badge.role-setup { background: var(--role-setup); }
    /* Role badges are buttons that open a short explanation (.role-help). */
    button.role-badge { border: 0; cursor: help; }
    button.role-badge:hover { filter: brightness(1.08); }
    .role-help { position: fixed; z-index: 60; width: max-content; text-transform: none; letter-spacing: normal; max-width: min(20rem, calc(100vw - 1rem)); padding: .625rem .75rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-raised); box-shadow: var(--shadow-pop); color: var(--ink); font-size: .8125rem; font-weight: 400; line-height: 1.45; text-align: left; white-space: normal; }
    .role-help p { margin: 0; }
    .role-help p + p { margin-top: .375rem; }
    #detailContent .pokemon-roles { justify-content: center; }
    .team-pokemon-roles:empty { display: none; }
    .team-pokemon-roles { margin: .75rem 0 0; }
    .team-pokemon-roles h4 { margin: 0 0 .4rem; padding: 0; border: 0; }
    .team-pokemon-roles-form { display: grid; gap: .25rem; margin: 0 0 .5rem; }
    .team-option-role { display: block; color: var(--ink-muted); font-size: .75rem; }
    .team-archetypes { margin: .75rem 0; padding: .75rem 1rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel); }
    .team-archetypes-head { display: flex; align-items: center; gap: .5rem; margin: 0 0 .5rem; }
    .team-archetypes h3 { margin: 0; font-size: 1rem; }
    /* Main and Secondary share one row, and wrap onto two when the row is too narrow. */
    .archetype-groups { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 2rem; }
    .archetype-group { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: .25rem 0; }
    .archetype-group-label { color: var(--ink-muted); font-size: .8125rem; }
    /* A round ? that opens a short explanation. Its touch area reaches 44 px around the 22 px circle. */
    .help-toggle { position: relative; display: inline-grid; place-items: center; flex: none; width: 1.375rem; height: 1.375rem; min-height: 0; padding: 0; border: 1.5px solid currentColor; border-radius: 50%; background: transparent; color: var(--ink-muted); font-size: .75rem; font-weight: 700; line-height: 1; }
    .help-toggle::before { content: ""; position: absolute; inset: -.6875rem; }
    .help-toggle:hover, .help-toggle[aria-expanded="true"] { border-color: var(--accent-strong); background: transparent; color: var(--accent-strong); }
    .heading-with-help .help-toggle { margin-left: .5rem; vertical-align: middle; letter-spacing: 0; text-transform: none; }
    .role-badge.archetype-hyper_offense { background: var(--archetype-hyper_offense); }
    .role-badge.archetype-balanced { background: var(--archetype-balanced); }
    .role-badge.archetype-trick_room { background: var(--archetype-trick_room); }
    .role-badge.archetype-tailroom { background: var(--archetype-tailroom); }
    .role-badge.archetype-set_up { background: var(--archetype-set_up); }
    .role-badge.archetype-rain { background: var(--archetype-rain); }
    .role-badge.archetype-sun { background: var(--archetype-sun); }
    .role-badge.archetype-sand { background: var(--archetype-sand); }
    .role-badge.archetype-snow { background: var(--archetype-snow); }
    .role-badge.archetype-electric_terrain { background: var(--archetype-electric_terrain); }
    .role-badge.archetype-grassy_terrain { background: var(--archetype-grassy_terrain); }
    .role-badge.archetype-misty_terrain { background: var(--archetype-misty_terrain); }
    .role-badge.archetype-psychic_terrain { background: var(--archetype-psychic_terrain); }
    .role-badge.archetype-perish_song { background: var(--archetype-perish_song); }
    .role-badge.archetype-unclassified { background: var(--archetype-unclassified); }
    @media (max-width: 700px) {
      .analysis-core-table td { white-space: normal; }
      .table-wrap .analysis-core-table tbody td::before { content: attr(data-label); }
      .analysis-control-row label { flex-direction: column; align-items: stretch; width: 100%; }
      .analysis-control-row label select { width: 100%; }
      .analysis-control-label { width: 100%; }
      .table-wrap .analysis-winrate-table tbody td::before { content: attr(data-label); }
      /* Small screens show one archetype's matchups as a list instead of the grid. */
      .analysis-matchup-grid { display: none; }
      .analysis-matchup-focus { display: grid; gap: .5rem; }
    }
    .analysis-matchup-focus > p { margin: 0; }
    .analysis-matchup-list { display: grid; gap: .25rem; margin: 0; padding: 0; list-style: none; }
    .analysis-matchup-list li { display: grid; grid-template-columns: minmax(0, 7rem) minmax(0, 1fr) auto; align-items: center; gap: .5rem; padding: .35rem 0; border-bottom: 1px solid var(--line); }
    .analysis-matchup-name { overflow-wrap: anywhere; }
    /* The bar grows left of the centre line below 50% and right of it above. */
    .analysis-matchup-bar { display: grid; grid-template-columns: 1fr 1fr; height: .875rem; }
    .analysis-matchup-half { display: flex; background: color-mix(in srgb, var(--line) 45%, transparent); }
    .analysis-matchup-half.is-below { justify-content: flex-end; border-right: 2px solid var(--ink-muted); }
    .analysis-matchup-half i { display: block; height: 100%; border-radius: 2px; }
    .analysis-matchup-value { text-align: right; font-variant-numeric: tabular-nums; }
    .analysis-matchup-value small { display: block; color: var(--muted); font-size: .75rem; }
    /* Player comparison */
    /* The name stays centred over the table; the comparison button sits to its right, clear of the table. */
    .player-name-row { position: relative; display: flex; align-items: center; justify-content: center; min-height: 2.25rem; margin-bottom: .75rem; }
    .player-name-row > :is(h2, h3) { margin: 0; }
    .player-name-row > :is(.comparison-toggle, .team-builder-add) { position: absolute; right: 0; top: 50%; transform: translateY(-50%); }
    @media (max-width: 700px) {
      .player-name-row { flex-direction: column; gap: .5rem; min-height: 0; }
      .player-name-row > :is(.comparison-toggle, .team-builder-add) { position: static; transform: none; }
    }
    .comparison-toggle[aria-pressed="true"] { border-color: var(--success); color: var(--success); }
    .comparison-heading { margin: 0 0 .5rem; color: var(--ink-muted); font-size: .875rem; }
    .comparison-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .75rem 0; }
    .comparison-wrap { max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
    .comparison-table { table-layout: fixed; border-collapse: collapse; margin: 0; }
    .comparison-table th, .comparison-table td { min-width: var(--comparison-column-min, 10rem); width: var(--comparison-column-min, 10rem); padding: .5rem; text-align: center; vertical-align: middle; }
    .comparison-table th:first-child, .comparison-table td:first-child { min-width: 11rem; width: 11rem; text-align: left; position: sticky; left: 0; background: var(--panel); z-index: 1; }
    .comparison-table .comparison-player-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .comparison-wrap .comparison-table tr > :first-child { overflow: hidden; white-space: normal; overflow-wrap: break-word; hyphens: auto; background: var(--panel-raised); box-shadow: 1px 0 0 var(--line); }
    .comparison-wrap .comparison-table tbody th { display: table-cell; }
    .comparison-label { display: flex; align-items: center; justify-content: space-between; gap: .35rem; min-width: 0; }
    .comparison-label > :first-child { min-width: 0; }
    .comparison-remove { flex: none; min-width: 0; min-height: 0; width: 1.75rem; height: 1.75rem; padding: 0; font-size: .75rem; }
    .comparison-unavailable { color: var(--muted); font-style: italic; }
    .comparison-sprites { display: flex; flex-wrap: wrap; justify-content: center; gap: .15rem; }
    .comparison-sprites img, .comparison-sprites .sprite-placeholder { width: 2rem; height: 2rem; object-fit: contain; }
    .comparison-name-list { margin: 0; padding: 0; list-style: none; font-size: .8125rem; line-height: 1.35; }
    .comparison-plus { position: relative; display: inline-block; }
    .comparison-plus > summary { list-style: none; }
    .comparison-plus > summary::-webkit-details-marker { display: none; }
    .comparison-plus-box { display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--panel-raised); color: var(--accent-strong); font-size: 1.25rem; font-weight: 700; line-height: 1; cursor: pointer; }
    .comparison-plus-box:hover, .comparison-plus-box:focus-visible, .comparison-plus[open] > .comparison-plus-box { border-style: solid; border-color: var(--accent-strong); }
    .comparison-plus-box[aria-disabled="true"] { opacity: .4; cursor: not-allowed; }
    .comparison-table .comparison-plus-row th, .comparison-table .comparison-plus-row td { text-align: center; }
    .comparison-menu { position: fixed; z-index: 30; display: grid; gap: .25rem; width: min(16rem, calc(100vw - 1rem)); padding: .35rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-raised); box-shadow: var(--shadow-pop); text-align: left; font-weight: 400; text-transform: none; letter-spacing: normal; }
    .comparison-menu input { width: 100%; box-sizing: border-box; }
    .comparison-menu-list { display: grid; max-height: 16rem; overflow-y: auto; }
    .comparison-menu-list button { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; border: 0; background: none; text-align: left; }
    .comparison-menu-list button small { flex: none; color: var(--muted); font-size: .75rem; }
    .comparison-menu-list button:hover, .comparison-menu-list button:focus-visible { background: var(--panel-hover); }
    .comparison-menu-list p { margin: .35rem .5rem; }
    /* Removed-this-regulation filter */
    .table-filter[hidden] { display: none; }
    [data-removed-entity] { cursor: pointer; }
    [data-removed-entity]:hover td { background: var(--panel-hover); }
    @media (max-width: 700px) {
      .comparison-table th:first-child, .comparison-table td:first-child { min-width: 8rem; width: 8rem; }
      .table-wrap .speed-tiers-table tbody td { grid-template-columns: minmax(0, 1fr); }
    }

    /* Touch screens: table controls and Team Builder section headers get full-size targets.
       The filter icon's target is invisible, so it does not widen narrow columns. */
    @media (pointer: coarse) {
      .sort-button { min-height: 2.75rem; }
      .type-filter summary { position: relative; }
      .type-filter summary::after { content: ''; position: absolute; inset: -.875rem; }
      .team-speed-tiers > details > summary, .team-coverage > details > summary, .team-meta > details > summary { padding-block: .7rem; }
    }

    /* The Pokédex list says its stats are Level 50 values (QA L17). */
    .pokedex-stat-caption { caption-side: top; padding: 0 0 .5rem; color: var(--muted); font-size: .82rem; text-align: left; }

    /* Tabs and the preview button are full-size touch targets on phones and touch screens (QA L7). */
    @media (max-width: 700px), (pointer: coarse) {
      .tab, #landingDemoToggle { min-height: 2.75rem; }
    }
