:root {
    --bg: #101218;
    --surface: #1a1d27;
    --surface-2: #232733;
    --line: #313646;
    --text: #e8ebf2;
    --muted: #9aa3b8;
    --accent: #8eb4ff;
    --accent-ink: #0e1424;
    --danger: #ffb4b4;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font: 16px/1.5 "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { width: min(1080px, calc(100% - 32px)); margin: 0 auto; }

.top {
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(16, 18, 24, 0.94);
    border-bottom: 1px solid var(--line);
}

.top-row { display: flex; align-items: center; gap: 20px; min-height: 64px; }
.brand { color: var(--text); font-weight: 700; letter-spacing: 0.02em; }
.nav { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.nav a { color: var(--muted); font-size: 0.95rem; }
.nav a.active { color: var(--text); }
.nav a.quiet { margin-left: auto; }
.nav-toggle { display: none; }

main { padding: 28px 0 64px; }

h1, h2 { line-height: 1.2; margin: 0 0 8px; }
h2 { font-size: 1.05rem; }
.page-head { margin-bottom: 18px; }
.page-head p, .note, .lead, .meta-line { color: var(--muted); }
.kicker { margin: 0 0 4px; color: var(--muted); font-size: 0.85rem; letter-spacing: 0.04em; text-transform: uppercase; }

.filters, .panel, .sheet, .card, .entry, .subcard {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
}

.filters { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; margin-bottom: 14px; }
.filters input:not([type="checkbox"]):not([type="radio"]),
.filters select,
.button,
.filters button {
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--text);
    border-radius: 8px;
    padding: 8px 10px;
    font: inherit;
}
.filters input:not([type="checkbox"]):not([type="radio"]) { min-width: 220px; flex: 1; }
.button, .filters button { background: var(--accent); color: var(--accent-ink); border-color: transparent; cursor: pointer; font-weight: 650; }
.button { display: inline-block; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.card { display: flex; flex-direction: column; gap: 8px; padding: 16px; color: var(--text); }
.card b { font-size: 1.6rem; }

.entries { display: flex; flex-direction: column; gap: 8px; }
.entry { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; color: var(--text); }
.entry:hover { border-color: var(--accent); text-decoration: none; }
.entry-media:empty { display: none; }
.entry-copy { display: flex; flex-direction: column; min-width: 0; }
.entry-title { font-weight: 650; }
.entry-meta { color: var(--muted); font-size: 0.85rem; }
.entry-side, .icon-row { display: flex; gap: 4px; align-items: center; }
.entry--species {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px;
}
.entry--species:hover { border-color: var(--accent); }
.entry-main {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: center;
    color: var(--text);
    text-decoration: none;
}
.entry-main:hover { text-decoration: none; }
.species-forms {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.species-form-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 4px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--text);
    text-decoration: none;
    font-size: 0.82rem;
}
.species-form-chip:hover { border-color: var(--accent); text-decoration: none; }
.species-form-chip .type-icon { height: 14px; }
.home-search {
    display: flex;
    gap: 8px;
    margin: 8px 0 24px;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
}
.home-search input {
    flex: 1;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--text);
    border-radius: 8px;
    padding: 12px 14px;
    font: inherit;
    font-size: 1.05rem;
}
.panel-subhead {
    margin: 16px 0 8px;
    font-size: 0.95rem;
    color: var(--muted);
}
.mega-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.mega-row {
    display: grid;
    grid-template-columns: 1.4fr 110px 1.4fr auto;
    gap: 8px;
    align-items: start;
}

.sprite {
    display: inline-block;
    background-repeat: no-repeat;
    background-position: 0 0;
    image-rendering: pixelated;
}
.item-icon { object-fit: contain; }
.type-icon { height: 22px; width: auto; }
.status-icon {
    height: 22px;
    width: auto;
    max-width: 48px;
    object-fit: contain;
    image-rendering: pixelated;
}
.icon-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.col-icon {
    width: 56px;
    min-width: 56px;
    max-width: 56px;
    text-align: center;
    vertical-align: middle;
}
.col-icon .type-icon,
.col-icon .status-icon {
    display: inline-block;
    vertical-align: middle;
}
.category-icon { width: 50px; height: 22px; object-fit: cover; object-position: center top; }
.category-icon[data-cat="special"] { object-position: center center; }
.category-icon[data-cat="status"] { object-position: center bottom; }

.sheet { padding: 18px; }
.sheet-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.form-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.form-row a { padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.form-row a.active { color: var(--text); border-color: var(--accent); }

.block { margin-top: 18px; }
.fields { display: grid; grid-template-columns: 180px 1fr; gap: 8px 16px; margin: 0; }
.fields dt { color: var(--muted); }
.fields dd { margin: 0; }
.stats { display: flex; flex-direction: column; gap: 6px; }
.stat { display: grid; grid-template-columns: 80px 1fr 36px; gap: 8px; align-items: center; }
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid transparent;
}
a.chip { color: var(--text); text-decoration: none; }
a.chip:hover { text-decoration: none; filter: brightness(1.08); }
.chip--move {
    background: color-mix(in srgb, var(--type-color, #6B7280) 78%, #111 22%);
    border-color: color-mix(in srgb, var(--type-color, #6B7280) 70%, #fff 12%);
    color: #fff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
}
.chip--ability {
    background: var(--surface-2);
    border-color: var(--line);
}
.entry--typed,
.entry--move {
    background: color-mix(in srgb, var(--type-color, #6B7280) 22%, var(--surface));
    border-color: color-mix(in srgb, var(--type-color, #6B7280) 45%, var(--line));
}
.entry--move {
    border-radius: 12px;
}
.entry--move .entry-media .type-icon { height: 22px; }
.entry--move .entry-side .category-icon { width: 28px; height: 28px; }
.move-table .move-row {
    background: color-mix(in srgb, var(--type-color, #6B7280) 32%, var(--surface));
}
.move-table .move-row td {
    border-bottom-color: color-mix(in srgb, var(--type-color, #6B7280) 35%, var(--line));
    vertical-align: middle;
}
.move-table .move-row a { color: var(--text); font-weight: 650; }
.move-table .move-row a:hover { color: #fff; }
.moves-overview,
.dex-table {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
}
.moves-overview .move-table,
.dex-table .data-table { margin: 0; }
.moves-overview .move-table thead th,
.dex-table .data-table thead th {
    background: var(--surface-2);
    padding: 10px 12px;
}
.field-with-action {
    display: flex;
    gap: 8px;
    align-items: center;
}
.field-with-action input {
    flex: 1;
    min-width: 0;
}
.field-with-action .button {
    flex-shrink: 0;
    white-space: nowrap;
}
.sprite-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sprite-preview-wrap {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 72px;
    height: 72px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-2);
    box-sizing: border-box;
}
.sprite-preview {
    max-width: 100%;
    max-height: 100%;
    image-rendering: pixelated;
}
.item-sprite-pick {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.item-sprite-toggle {
    align-self: flex-start;
}
.item-sprite-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.item-sprite-panel[hidden] {
    display: none !important;
}
.item-sprite-filter {
    width: 100%;
}
.item-sprite-loading {
    margin: 8px;
    grid-column: 1 / -1;
}
.item-sprite-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 6px;
    max-height: 220px;
    overflow: auto;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-2);
}
.item-sprite-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 6px 4px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
}
.item-sprite-option[hidden] {
    display: none !important;
}
.item-sprite-option:hover {
    border-color: var(--line);
    background: color-mix(in srgb, var(--surface) 70%, transparent);
}
.item-sprite-option.is-selected {
    border-color: var(--accent, #6ea8fe);
    background: color-mix(in srgb, var(--accent, #6ea8fe) 18%, transparent);
}
.item-sprite-thumb {
    width: 32px;
    height: 32px;
    object-fit: contain;
    image-rendering: pixelated;
}
.item-sprite-none {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted, #9aa4b2);
    font-size: 0.9rem;
}
.item-sprite-name {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.65rem;
    line-height: 1.2;
    opacity: 0.85;
}
.field-hint {
    margin: 0;
    font-size: 0.82rem;
}
.poke-table-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-weight: 650;
    text-decoration: none;
}
.poke-table-link:hover { color: #fff; text-decoration: none; }
.dex-table .data-table td { vertical-align: middle; }
.poke-table .poke-row {
    background: color-mix(in srgb, var(--type-color, #6B7280) 32%, var(--surface));
}
.poke-table .poke-row--dual {
    background: linear-gradient(
        90deg,
        color-mix(in srgb, var(--type-color, #6B7280) 32%, var(--surface)) 0%,
        color-mix(in srgb, var(--type-color, #6B7280) 32%, var(--surface)) 28%,
        color-mix(in srgb, var(--type-color-2, #6B7280) 32%, var(--surface)) 72%,
        color-mix(in srgb, var(--type-color-2, #6B7280) 32%, var(--surface)) 100%
    );
}
.poke-table .poke-row td {
    border-bottom-color: color-mix(in srgb, var(--type-color, #6B7280) 35%, var(--line));
    background: transparent;
}
.sortable-table th[data-sort] {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.sortable-table th[data-sort]::after {
    content: ' ↕';
    opacity: 0.35;
    font-size: 0.8em;
}
.sortable-table th[data-sort].sort-asc::after { content: ' ↑'; opacity: 0.9; }
.sortable-table th[data-sort].sort-desc::after { content: ' ↓'; opacity: 0.9; }
.detail-battler {
    image-rendering: pixelated;
}

.dex-head { margin-bottom: 12px; }
.dex-head h1 { margin-bottom: 6px; }
.dex-lead { color: var(--muted); margin: 0; max-width: 62ch; }
.dex-toc {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin: 0 0 18px;
    padding: 10px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}
.dex-toc a { color: var(--muted); font-size: 0.92rem; }
.dex-toc a:hover { color: var(--accent); }
.dex-top {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    align-items: start;
}
.vital-card--wide {
    grid-column: 1 / span 2;
    min-width: 0;
}
.vitals-side {
    grid-column: 3;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}
.vital-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
}
.vital-card h3 {
    margin: 0;
    padding: 10px 12px;
    font-size: 0.95rem;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
}
.vital-card--typed {
    border-color: color-mix(in srgb, var(--type-color, #6B7280) 45%, var(--line));
}
.vital-card--typed > h3 {
    color: #fff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
    background: color-mix(in srgb, var(--type-color, #6B7280) 72%, #111 28%);
    border-bottom-color: color-mix(in srgb, var(--type-color, #6B7280) 55%, var(--line));
}
.vital-card--typed.vital-card--dual > h3 {
    background: linear-gradient(
        90deg,
        color-mix(in srgb, var(--type-color, #6B7280) 72%, #111 28%) 0%,
        color-mix(in srgb, var(--type-color, #6B7280) 72%, #111 28%) 28%,
        color-mix(in srgb, var(--type-color-2, #6B7280) 72%, #111 28%) 72%,
        color-mix(in srgb, var(--type-color-2, #6B7280) 72%, #111 28%) 100%
    );
}
.typed-section-body {
    padding: 12px;
}
.typed-section-body .dex-table,
.typed-section-body .moves-overview,
.typed-section-body .table-wrap.dex-table {
    border-radius: 8px;
}
.typed-section-body .dex-subhead:first-child { margin-top: 0; }
.typed-section-body .note { margin: 10px 0 0; }
.evo-table .poke-row a:hover { color: #fff; }
.vital-card-body {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    padding: 12px;
    align-items: start;
}
.vital-card-body .vital-table th,
.vital-card-body .vital-table td {
    padding-left: 0;
    padding-right: 8px;
}
.vital-card--stack-media .vital-card-body {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
}
.vital-card--stack-media .vital-card-body .vital-table th,
.vital-card--stack-media .vital-card-body .vital-table td {
    padding-left: 12px;
    padding-right: 12px;
}
.dex-artwork {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    min-width: 160px;
}
.vital-card--stack-media .dex-artwork {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    padding: 12px;
    border-bottom: 1px solid var(--line);
    box-sizing: border-box;
}
.vital-card--stack-media .dex-artwork .detail-battler,
.vital-card--stack-media .dex-artwork img,
.vital-card--stack-media .dex-artwork canvas,
.vital-card--stack-media .dex-artwork .sprite {
    display: block;
    margin-inline: auto;
}
.vital-table { width: 100%; border-collapse: collapse; }
.vital-table th,
.vital-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
    text-align: left;
}
.vital-table tr:last-child th,
.vital-table tr:last-child td { border-bottom: 0; }
.vital-table th {
    width: 38%;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.88rem;
}
.type-pill { display: inline-flex; margin-right: 4px; }
.dex-subhead {
    margin: 18px 0 8px;
    font-size: 1rem;
}
.dex-subhead:first-child { margin-top: 0; }
.ability-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    align-items: center;
}
.vital-card--battle .vital-table th {
    width: 8.5rem;
}
.vital-card--battle .vital-table th,
.vital-card--battle .vital-table td {
    padding: 10px 12px;
}
.vital-card--battle .battle-stats {
    padding: 0;
    border-top: 1px solid var(--line);
}
.vital-card--battle .stats--dex {
    max-width: 36rem;
    gap: 0;
}
.vital-card--battle .stats--dex .stat {
    grid-template-columns: 8.5rem 1fr 2.5rem;
    gap: 8px;
    padding: 10px 12px;
}
.dex-entry { margin: 0; max-width: 70ch; line-height: 1.55; }
.stats--dex .stat-total {
    margin-top: 0;
    padding-top: 8px;
    border-top: 1px solid var(--line);
}
.vital-card--battle .stats--dex .stat-total {
    padding: 10px 12px;
}
.stats--dex .stat-total b { font-size: 1.05rem; }
.evo-tree .evo-root { margin-bottom: 12px; }
.pokemon-sprites-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.pokemon-sprite-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 12px;
}
.pokemon-sprite-label {
    color: var(--muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.pokemon-egg-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.pokemon-sprite-grid-item,
.pokemon-egg-sprite-display {
    image-rendering: pixelated;
}
.entry--typed:hover,
.entry--move:hover {
    border-color: color-mix(in srgb, var(--type-color, #6B7280) 70%, var(--accent));
}
.typed-hero {
    padding: 12px 14px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--type-color, #6B7280) 28%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--type-color, #6B7280) 45%, var(--line));
}
.move-artwork {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 120px;
}
.vital-card--stack-media .move-artwork,
.vital-card--wide .move-artwork {
    margin: 0;
}
.stack { display: flex; flex-direction: column; gap: 10px; }
.subcard { padding: 12px; }
.party-head { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.grid { width: 100%; border-collapse: collapse; }
.grid td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.muted, .empty { color: var(--muted); }
.panel { padding: 16px; margin-bottom: 16px; }
.report { margin: 0 0 16px; padding-left: 18px; }
.report .fail { color: var(--danger); }
.back { margin-top: 0; }
code { font-family: Consolas, monospace; font-size: 0.9em; }
.codeblock {
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    overflow: auto;
    max-height: 320px;
}
.plain-list { margin: 0; padding-left: 18px; }
.detail-hero { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tabs a { padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.tabs a.active { color: var(--text); border-color: var(--accent); }

.form-switcher {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
    margin-bottom: 18px;
}
.form-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
}
.form-switch:hover { border-color: var(--accent); text-decoration: none; }
.form-switch.active {
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent);
}
.form-switch-copy { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.form-switch-name { font-weight: 650; font-size: 0.92rem; }
.form-switch-meta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--muted);
    font-size: 0.8rem;
}
.form-switch-meta .type-icon { height: 16px; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; margin-bottom: 14px; }
.toolbar .filters { flex: 1; margin-bottom: 0; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.data-table th { color: var(--muted); font-weight: 600; font-size: 0.85rem; }
.row-actions { white-space: nowrap; }
.linkish { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font: inherit; }
.linkish.danger { color: var(--danger); }
.button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.stack-gap > * + * { margin-top: 12px; }
.pager { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; align-items: center; }
.pager a, .pager span { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); color: var(--muted); }
.pager span:not(.pager-ellipsis) { color: var(--text); border-color: var(--accent); }
.pager-ellipsis {
    border: 0;
    padding: 6px 4px;
    color: var(--muted);
}

.drawer {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 40;
    display: flex;
    justify-content: flex-end;
}
.drawer[hidden] { display: none; }
.drawer-panel {
    width: min(480px, 100%);
    height: 100%;
    background: var(--surface);
    border-left: 1px solid var(--line);
    padding: 16px;
    overflow: auto;
}
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.drawer-head button { background: transparent; border: 0; color: var(--text); font-size: 1.4rem; cursor: pointer; }
.admin-form { display: flex; flex-direction: column; gap: 12px; }
.admin-form .field { display: flex; flex-direction: column; gap: 6px; }
.admin-form input[readonly] {
    opacity: 0.75;
    cursor: default;
}
.admin-form input, .admin-form textarea, .admin-form select {
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--text);
    border-radius: 8px;
    padding: 8px 10px;
    font: inherit;
}
.admin-form textarea { min-height: 90px; }
.form-actions { display: flex; gap: 8px; }
.sync-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 640px;
}
.sync-panel .field { width: 100%; }

.sprite-sheet-panel { margin-top: 16px; }
.sprite-sheet-panel h2 { margin: 0 0 12px; font-size: 1.05rem; }
.sprite-sheet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}
.sprite-sheet-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-2);
}
.sprite-sheet-form { display: flex; flex-direction: column; gap: 8px; }
.sprite-sheet-form input[type="file"] { font-size: 0.8rem; width: 100%; }
.sprite-sheet-form .form-actions { flex-wrap: wrap; }
.sprite-sheet-preview {
    display: grid;
    place-items: center;
    min-height: 120px;
    border-radius: 8px;
    background:
        linear-gradient(45deg, #2a2a2a 25%, transparent 25%),
        linear-gradient(-45deg, #2a2a2a 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #2a2a2a 75%),
        linear-gradient(-45deg, transparent 75%, #2a2a2a 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    background-color: #1a1a1a;
    overflow: auto;
}
.sprite-sheet-preview img {
    image-rendering: pixelated;
    max-width: 100%;
    height: auto;
}

.sprite-list-toolbar,
.sprite-review-toolbar { align-items: center; }
.sprite-list-toolbar .filters,
.sprite-review-toolbar .filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.filter-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 0.9rem;
    white-space: nowrap;
    line-height: 1.2;
    cursor: pointer;
    flex: 0 0 auto;
    min-width: 0;
}
.filter-check input[type="checkbox"] {
    appearance: auto;
    width: 1em;
    height: 1em;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    flex: 0 0 auto;
    min-width: 0;
    accent-color: var(--accent);
    vertical-align: middle;
}
.filter-check span {
    display: inline-block;
    line-height: 1.2;
}

.sprite-status-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: color-mix(in srgb, #9aa3b8 12%, var(--surface-2));
    color: #9aa3b8;
    font-size: 0.8rem;
    font-weight: 650;
    white-space: nowrap;
}
.sprite-status-pill.is-done {
    color: #6ddf8c;
    border-color: color-mix(in srgb, #6ddf8c 45%, var(--line));
    background: color-mix(in srgb, #6ddf8c 14%, var(--surface-2));
}
.sprite-status-pill.is-claimed {
    color: #8eb4ff;
    border-color: color-mix(in srgb, #8eb4ff 45%, var(--line));
    background: color-mix(in srgb, #8eb4ff 14%, var(--surface-2));
}
.sprite-status-pill.is-needs-work {
    color: #ff8e8e;
    border-color: color-mix(in srgb, #ff8e8e 45%, var(--line));
    background: color-mix(in srgb, #ff8e8e 14%, var(--surface-2));
}
.sprite-status-pill.is-none {
    color: #9aa3b8;
    border-color: color-mix(in srgb, #9aa3b8 35%, var(--line));
    background: color-mix(in srgb, #9aa3b8 10%, var(--surface-2));
}
.sprite-status-comment {
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.35;
    white-space: pre-wrap;
    max-width: 36ch;
}

.sprite-review-card {
    display: flex;
    flex-direction: column;
    gap: 18px;
    width: 100%;
    padding: 18px;
}

.sprite-review-head {
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    gap: 12px;
    align-items: center;
}
.sprite-review-arrow {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--text);
    font-size: 1.6rem;
    line-height: 1;
    text-decoration: none;
}
.sprite-review-arrow:hover { border-color: var(--accent); text-decoration: none; }
.sprite-review-arrow.is-disabled {
    opacity: 0.35;
    pointer-events: none;
}
.sprite-review-title { min-width: 0; text-align: center; }
.sprite-review-title h2 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
}
.sprite-review-title-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    align-items: center;
}
.sprite-review-meta {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}
.sprite-review-stage {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 16px;
    min-height: 320px;
    align-items: stretch;
}
.sprite-review-media {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    min-height: 100%;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface-2);
}
.sprite-review-media h3 {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 650;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.sprite-review-media-body {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    align-items: center;
    flex: 1;
    min-height: 220px;
}
.sprite-review-media {
    min-height: 280px;
}
.sprite-review-frame {
    position: relative;
    display: grid;
    place-items: center;
    margin: 0;
    min-width: 140px;
    min-height: 140px;
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    background:
        linear-gradient(45deg, #2a2a2a 25%, transparent 25%),
        linear-gradient(-45deg, #2a2a2a 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #2a2a2a 75%),
        linear-gradient(-45deg, transparent 75%, #2a2a2a 75%);
    background-size: 14px 14px;
    background-position: 0 0, 0 7px, 7px -7px, -7px 0;
    background-color: #151515;
    overflow: hidden;
}
.sprite-review-frame.is-empty {
    color: var(--muted);
    font-size: 0.85rem;
    width: 100%;
}
.sprite-review-frame figcaption {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 1;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 650;
}
.sprite-review-frame img {
    image-rendering: pixelated;
    max-width: 100%;
    max-height: 260px;
    height: auto;
}

.sprite-review-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 4px;
    border-top: 1px solid var(--line);
}
.sprite-review-section-label {
    font-size: 0.75rem;
    font-weight: 650;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.sprite-review-actions,
.sprite-review-status-actions,
.sprite-review-assign {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.sprite-review-upload-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sprite-review-upload {
    display: grid;
    grid-template-columns: minmax(110px, 160px) 1fr auto auto;
    gap: 8px;
    align-items: center;
    margin: 0;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--bg);
}
.sprite-review-upload-name {
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 600;
}
.sprite-review-upload input[type="file"] {
    width: 100%;
    min-width: 0;
    font-size: 0.8rem;
    color: var(--muted);
}

.sprite-status-btn {
    border: 1px solid var(--line);
    background: var(--bg);
    color: var(--text);
    border-radius: 999px;
    padding: 7px 12px;
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}
.sprite-status-btn:hover { border-color: var(--accent); }
.sprite-status-btn.is-active {
    background: color-mix(in srgb, var(--accent) 18%, var(--bg));
    border-color: var(--accent);
    color: var(--accent);
}

.sprite-review-assign input {
    border: 1px solid var(--line);
    background: var(--bg);
    color: var(--text);
    border-radius: 8px;
    padding: 8px 10px;
    font: inherit;
    min-width: min(240px, 100%);
    flex: 1;
}

.sprite-review-comment {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
}
.sprite-review-comment textarea {
    width: 100%;
    min-height: 72px;
    resize: vertical;
    border: 1px solid var(--line);
    background: var(--bg);
    color: var(--text);
    border-radius: 8px;
    padding: 8px 10px;
    font: inherit;
    line-height: 1.4;
}
.sprite-review-comment .button {
    align-self: flex-start;
}

.button.ghost[aria-disabled="true"] {
    opacity: 0.4;
    pointer-events: none;
}

@media (max-width: 720px) {
    .sprite-review-stage { grid-template-columns: 1fr; }
    .sprite-review-upload {
        grid-template-columns: 1fr;
    }
}

.sprite-slot-panel { margin-top: 16px; }
.sprite-slot-panel h2 { margin: 0 0 12px; font-size: 1.05rem; }
.sprite-slot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}
.sprite-slot-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-2);
}
.sprite-slot-preview {
    display: grid;
    place-items: center;
    min-height: 96px;
    border-radius: 8px;
    background:
        linear-gradient(45deg, #2a2a2a 25%, transparent 25%),
        linear-gradient(-45deg, #2a2a2a 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #2a2a2a 75%),
        linear-gradient(-45deg, transparent 75%, #2a2a2a 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    background-color: #1a1a1a;
    overflow: hidden;
}
.sprite-slot-preview.is-empty { color: var(--muted); font-size: 0.85rem; }
.sprite-slot-preview img {
    image-rendering: pixelated;
    max-width: 100%;
    height: auto;
}
.sprite-slot-form { display: flex; flex-direction: column; gap: 8px; }
.sprite-slot-form input[type="file"] { font-size: 0.8rem; width: 100%; }
.button.danger,
.button.ghost.danger {
    color: var(--danger, #f87171);
    border-color: color-mix(in srgb, var(--danger, #f87171) 45%, var(--line));
}
img.game-category-icon {
    object-fit: cover !important;
    object-position: var(--category-pos, center top) !important;
}

.level-moves { display: flex; flex-direction: column; gap: 8px; }
.level-move-row { display: grid; grid-template-columns: 88px 1fr; gap: 10px; align-items: start; }
.level-label { color: var(--muted); font-size: 0.9rem; padding-top: 4px; }
.toolbar-inline { margin: 0 0 16px; }
.evo-tree .entry { pointer-events: auto; }
.evo-table td a { display: inline-flex; align-items: center; gap: 8px; color: var(--text); }
.evo-table td a:hover { color: var(--accent); }
.evo-param {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    color: var(--muted);
}
.evo-param .sprite,
.evo-param .item-icon,
.evo-param .type-icon { flex-shrink: 0; }
.evo-param .item-icon { width: 24px; height: 24px; }
.evo-param a { color: var(--accent); }

.editor-grid, .field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.field-grid--stats { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.pokemon-editor .panel { margin-bottom: 16px; }
.pokemon-editor .field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.pokemon-editor .field-grid .field { margin-bottom: 0; }
.pokemon-editor input, .pokemon-editor textarea, .pokemon-editor select {
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--text);
    border-radius: 8px;
    padding: 8px 10px;
    font: inherit;
    width: 100%;
}
.pokemon-editor textarea { min-height: 90px; }
.learnset-stack { display: flex; flex-direction: column; gap: 14px; }
.learnset-stack .field { margin-bottom: 0; }
.tag-editor {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-2);
}
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; min-height: 28px; }
.tag-card {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px 5px 10px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--text);
    font-size: 0.9rem;
}
.tag-card--move {
    background: color-mix(in srgb, var(--type-color, #6B7280) 78%, #111 22%);
    border-color: color-mix(in srgb, var(--type-color, #6B7280) 70%, #fff 12%);
    color: #fff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
}
.tag-card--ability { background: #2a3142; }
.tag-remove {
    border: 0;
    background: transparent;
    color: inherit;
    opacity: 0.75;
    cursor: pointer;
    font-size: 1.05rem;
    line-height: 1;
    padding: 0 2px;
}
.tag-remove:hover { opacity: 1; }
.moveset-row .tag-card { width: 100%; justify-content: space-between; }
.checkbox-field { flex-direction: row !important; align-items: center; gap: 8px !important; margin: 12px 0; }
.sticky-actions {
    position: sticky;
    bottom: 0;
    background: rgba(16, 18, 24, 0.94);
    border-top: 1px solid var(--line);
    padding: 12px 0;
    margin-top: 8px;
    display: flex;
    gap: 8px;
    align-items: center;
}
.moveset-rows {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}
.evo-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.moveset-row, .evo-row {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) auto;
    gap: 8px;
    align-items: start;
}
.evo-row { grid-template-columns: 1fr 1fr 1fr auto; }
.ac-field { position: relative; }
.ac-dropdown {
    position: absolute;
    z-index: 20;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    max-height: 220px;
    overflow: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.ac-item {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--text);
    text-align: left;
    padding: 8px 10px;
    cursor: pointer;
    font: inherit;
}
.ac-item:hover { background: var(--surface-2); }
.ac-item small {
    color: var(--muted);
    font-size: 0.8rem;
    white-space: normal;
    text-align: right;
    max-width: 65%;
}
.ac-dropdown .ac-item[data-desc]:not([data-desc=""]) {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}
.ac-dropdown .ac-item[data-desc]:not([data-desc=""]) small {
    text-align: left;
    max-width: 100%;
}
.ac-item--typed {
    border-left: 4px solid var(--type-color, #6B7280);
}
.moveset-pick { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.moveset-preview { min-height: 32px; }
.tag-card--empty {
    opacity: 0.65;
    font-style: italic;
    border-style: dashed;
}

@media (max-width: 1100px) {
    .moveset-rows { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .field-grid--stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .nav-toggle { display: inline-block; margin-left: auto; background: transparent; color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
    .nav { display: none; position: absolute; top: 64px; left: 0; right: 0; padding: 12px 16px 16px; background: var(--bg); border-bottom: 1px solid var(--line); }
    .nav.open { display: flex; flex-direction: column; }
    .nav a.quiet { margin-left: 0; }
    .fields, .stat { grid-template-columns: 1fr; }
    .entry { grid-template-columns: auto 1fr; }
    .entry-side { grid-column: 2; }
    .level-move-row, .moveset-row, .evo-row, .mega-row { grid-template-columns: 1fr; }
    .moveset-rows { grid-template-columns: 1fr; }
    .field-grid--stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .home-search { flex-direction: column; }
    .pokemon-sprites-grid { grid-template-columns: 1fr; }
    .dex-top { grid-template-columns: 1fr; }
    .vital-card--wide,
    .vitals-side { grid-column: auto; }
    .vital-card-body { grid-template-columns: 1fr; justify-items: center; }
}

/* Auth (login / register) — matches browse chrome */
.auth-main {
    display: flex;
    justify-content: center;
    padding-top: 12px;
}
.auth-card {
    width: min(420px, 100%);
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.auth-card .page-head { margin-bottom: 0; }
.auth-card .page-head h1 { font-size: 1.55rem; margin-bottom: 0; }
.auth-card .page-head .kicker,
.auth-card .page-head > p { display: none; }
.auth-note {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.auth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.auth-field label {
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 650;
}
.auth-field input {
    width: 100%;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--text);
    border-radius: 8px;
    padding: 10px 12px;
    font: inherit;
}
.auth-field input:focus {
    outline: none;
    border-color: var(--accent);
}
.auth-field .hint {
    color: var(--muted);
    font-size: 0.78rem;
}
.auth-form .button {
    width: 100%;
    text-align: center;
    padding: 11px 14px;
    margin-top: 4px;
}
.auth-alert {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--line);
    font-size: 0.9rem;
}
.auth-alert.is-error {
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 40%, var(--line));
    background: color-mix(in srgb, var(--danger) 10%, var(--surface-2));
}
.auth-alert.is-success {
    color: #9be7b4;
    border-color: color-mix(in srgb, #6ddf8c 40%, var(--line));
    background: color-mix(in srgb, #6ddf8c 10%, var(--surface-2));
}
.auth-footer {
    padding-top: 4px;
    border-top: 1px solid var(--line);
    text-align: center;
    font-size: 0.9rem;
}
.auth-footer a { color: var(--accent); }
