/* ═══════════════════════════════════════════════════════════════
   KoHs Bedrock — MCTiers-Inspired Dark Purple Design
   ═══════════════════════════════════════════════════════════════ */

:root {
    --bg-0: #05020b;
    --bg-1: #0d0618;
    --bg-2: #150a26;
    --surface: rgba(22, 10, 38, 0.88);
    --surface-soft: rgba(30, 14, 52, 0.72);
    --surface-hard: rgba(14, 6, 26, 0.94);
    --card: rgba(18, 8, 32, 0.92);
    --card-hover: rgba(28, 14, 48, 0.96);
    --line: rgba(180, 140, 240, 0.12);
    --line-hover: rgba(200, 160, 255, 0.28);
    --text: #f4eeff;
    --text-secondary: #c5b3de;
    --muted: #9b89b3;
    --accent: #be84ff;
    --accent-dim: #8e54e9;
    --accent-glow: rgba(190, 132, 255, 0.15);
    --good: #84f7bf;
    --warn: #ffc488;
    --danger: #ff9bbf;
    --gold: #ffd98c;
    --silver: #e0d4f0;
    --bronze: #d4a574;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
    --radius-xl: 20px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --radius-pill: 999px;
    --topbar-height: 64px;
    --content-max: 1200px;
    --rankings-cols: 48px 56px minmax(220px, 1fr) 96px 110px minmax(240px, 1fr);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }

body {
    color: var(--text);
    font-family: "Manrope", sans-serif;
    font-size: 15px;
    line-height: 1.6;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(140, 80, 240, 0.18), transparent 50%),
        radial-gradient(ellipse at 80% 10%, rgba(100, 50, 200, 0.14), transparent 40%),
        radial-gradient(ellipse at 60% 80%, rgba(180, 120, 255, 0.06), transparent 40%),
        linear-gradient(180deg, var(--bg-0), var(--bg-1));
    background-attachment: fixed;
    overflow-x: hidden;
}

button, input, select { font: inherit; }
a { color: var(--accent); text-decoration: none; }

/* ═══ BOOT LOADER (preserved) ═══ */
.boot-loader {
    position: fixed; inset: 0; z-index: 300;
    display: grid; place-items: center;
    background:
        radial-gradient(circle at 30% 20%, rgba(157, 89, 255, 0.32), transparent 46%),
        radial-gradient(circle at 76% 84%, rgba(89, 53, 192, 0.26), transparent 48%),
        linear-gradient(180deg, rgba(12, 5, 24, 0.96), rgba(4, 2, 8, 0.98)),
        url("/static/assets/background-global.png");
    background-size: auto, auto, auto, cover;
    background-position: center;
    transition: opacity 0.55s ease, visibility 0.55s ease;
}
.boot-loader.is-complete { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-loader-panel { width: min(92vw, 440px); display: grid; justify-items: center; gap: 18px; padding: 16px; }
.boot-loader-core {
    --orbit-radius: 128px; --orbit-duration: 7.2s;
    position: relative; width: 320px; height: 320px;
    display: grid; place-items: center;
}
.boot-orbit { position: absolute; inset: 0; }
.boot-orbit-item {
    --orbit-start: 0deg;
    position: absolute; left: 50%; top: 50%;
    width: 76px; height: 76px;
    display: flex; align-items: center; justify-content: center;
    margin-left: -38px; margin-top: -38px;
    animation: orbit-track var(--orbit-duration) linear infinite;
}
.boot-orbit-item img {
    width: 100%; height: 100%; object-fit: contain; display: block;
    animation: orbit-counter var(--orbit-duration) linear infinite;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.5));
}
.boot-orbit-item.item-1 { --orbit-start: 0deg; }
.boot-orbit-item.item-2 { --orbit-start: 90deg; }
.boot-orbit-item.item-3 { --orbit-start: 180deg; }
.boot-orbit-item.item-4 { --orbit-start: 270deg; }
.boot-mascot-wrap {
    width: 116px; height: 116px;
    display: flex; align-items: center; justify-content: center;
    animation: loader-pulse 2.2s ease-in-out infinite;
}
.boot-mascot-wrap img { width: 100%; height: 100%; object-fit: contain; display: block; filter: drop-shadow(0 14px 22px rgba(0, 0, 0, 0.45)); }
.boot-loader-text {
    margin: 0; font-family: "Orbitron", sans-serif;
    font-size: 0.88rem; font-weight: 700;
    letter-spacing: 0.12em; text-transform: uppercase; color: #e7d4ff;
}

/* ═══ PAGE SHELL ═══ */
.page-shell {
    position: relative; min-height: 100vh;
    padding: calc(var(--topbar-height) + 24px) 24px 80px;
    isolation: isolate; opacity: 0; transition: opacity 0.58s ease;
}
.page-shell.app-visible { opacity: 1; }

.ambient {
    position: fixed; border-radius: 999px; filter: blur(80px);
    opacity: 0.35; pointer-events: none; z-index: -3;
    animation: drift 20s ease-in-out infinite;
}
.ambient-a { top: 5vh; left: 5vw; width: min(30vw, 400px); height: min(30vw, 400px); background: rgba(140, 80, 240, 0.3); }
.ambient-b { top: 30vh; right: 8vw; width: min(22vw, 300px); height: min(22vw, 300px); background: rgba(80, 40, 180, 0.25); animation-delay: -7s; }
.ambient-c { bottom: 10vh; left: 40vw; width: min(18vw, 240px); height: min(18vw, 240px); background: rgba(200, 150, 255, 0.15); animation-delay: -12s; }

.grid-overlay {
    position: fixed; inset: 0; pointer-events: none; z-index: -4;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: linear-gradient(180deg, rgba(0,0,0,0.6), transparent 80%);
}

/* ═══ TOPBAR ═══ */
.topbar {
    display: flex; align-items: center; gap: 16px;
    position: fixed; top: 0; left: 0; right: 0; z-index: 120;
    height: var(--topbar-height);
    padding: 0 clamp(16px, 3vw, 40px);
    background: rgba(8, 4, 16, 0.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
}
.topbar.reveal {
    opacity: 0; transform: translateY(-8px);
    animation: topbar-reveal 0.6s cubic-bezier(.2,.7,.2,1) forwards;
}
.topbar.is-hidden {
    opacity: 0; transform: translateY(calc(-100%));
    pointer-events: none;
}

.topbar-brand { display: flex; align-items: center; flex-shrink: 0; }
.site-logo { display: block; height: 34px; width: auto; object-fit: contain; }

.topbar-tabs { display: flex; gap: 4px; margin-left: 24px; }
.topbar-tab {
    border: 1px solid transparent; border-radius: var(--radius-pill);
    background: transparent; color: var(--muted); cursor: pointer;
    padding: 8px 16px; font-size: 0.82rem; font-weight: 600;
    letter-spacing: 0.02em; transition: all 0.2s ease;
}
.topbar-tab:hover { color: var(--text); background: rgba(190, 132, 255, 0.08); }
.topbar-tab.active {
    color: #fff; background: rgba(190, 132, 255, 0.18);
    border-color: rgba(190, 132, 255, 0.25);
}
.topbar-tab.tab-tiers-vs {
    position: relative;
    overflow: hidden;
    border-color: rgba(190, 132, 255, 0.24);
    background: rgba(18, 8, 32, 0.45);
}
.topbar-tab.tab-tiers-vs::before {
    content: "";
    position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(12, 6, 22, 0.78), rgba(10, 5, 18, 0.64));
    opacity: 0.62;
    transition: opacity 0.2s ease;
}
body.tab-assets-ready-tiers-vs .topbar-tab.tab-tiers-vs::before {
    background:
        linear-gradient(180deg, rgba(7, 4, 16, 0.66), rgba(7, 4, 16, 0.48)),
        url("/static/assets/background-jugadores-testers.gif");
    background-size: cover;
    background-position: center;
}
.topbar-tab.tab-tiers-vs > span {
    position: relative;
    z-index: 1;
}
.topbar-tab.tab-tiers-vs:hover::before,
.topbar-tab.tab-tiers-vs.active::before {
    opacity: 0.9;
}

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.status-pill {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 12px; border-radius: var(--radius-pill);
    background: rgba(190, 132, 255, 0.06);
    border: 1px solid var(--line); font-size: 0.76rem; color: var(--muted);
}
.status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--warn); flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(255, 196, 136, 0.15);
}
.status-pill.online .status-dot { background: var(--good); box-shadow: 0 0 0 3px rgba(132, 247, 191, 0.15); }
.status-pill.offline .status-dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(255, 155, 191, 0.15); }
.status-text { white-space: nowrap; }

/* ═══ MAIN CONTENT ═══ */
.main-content { width: min(var(--content-max), 100%); margin: 0 auto; }

/* ═══ TABS ═══ */
.tab-panel { display: none; opacity: 0; }
.tab-panel.active { display: block; animation: tab-fade-in 0.35s ease both; }
.tab-panel.is-fading-out { display: block; pointer-events: none; animation: tab-fade-out 0.28s ease both; }

/* ═══ TYPOGRAPHY ═══ */
.eyebrow {
    margin: 0 0 6px; text-transform: uppercase;
    letter-spacing: 0.14em; font-size: 0.72rem;
    font-weight: 800; color: var(--accent);
}
h1, h2, h3 {
    margin: 0; font-family: "Orbitron", sans-serif;
    line-height: 1.25; letter-spacing: 0.02em; text-transform: uppercase;
}
h2 { font-size: clamp(1.1rem, 2vw, 1.5rem); font-weight: 700; }
h3 { font-size: clamp(0.82rem, 1vw, 0.96rem); font-weight: 700; }

/* ═══ RANKINGS TAB ═══ */
.rankings-header {
    display: flex; align-items: flex-end;
    justify-content: space-between; gap: 16px;
    margin-bottom: 20px;
}
.rankings-header-left { display: grid; gap: 4px; }

.rankings-search {
    position: relative; min-width: min(100%, 340px);
}
.search-icon {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    width: 18px; height: 18px; color: var(--muted); pointer-events: none;
}
.rankings-search input {
    width: 100%; border-radius: var(--radius-pill);
    padding: 12px 16px 12px 42px;
    background: var(--surface-hard); color: var(--text);
    border: 1px solid var(--line); outline: none;
    font-size: 0.88rem; transition: border-color 0.2s ease;
}
.rankings-search input::placeholder { color: rgba(200, 180, 230, 0.45); }
.rankings-search input:focus { border-color: rgba(190, 132, 255, 0.4); }

/* Rankings table header */
.rankings-table-head {
    display: grid;
    grid-template-columns: var(--rankings-cols);
    gap: 12px; align-items: center;
    padding: 10px 20px; margin-bottom: 6px;
    font-size: 0.7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--muted); border-bottom: 1px solid var(--line);
}
.rankings-table-head .col-region { justify-self: center; text-align: center; }
.rankings-table-head .col-points { justify-self: end; text-align: right; }
.rankings-table-head .col-tiers { justify-self: end; text-align: right; }

/* Rankings list */
.rankings-list {
    display: grid; gap: 4px;
    content-visibility: auto; contain-intrinsic-size: 800px;
}

/* â•â•â• TIERS VS TAB â•â•â• */
.tab-panel[data-panel="tiers-vs"] {
    position: relative;
    overflow: visible;
    min-height: calc(100vh - var(--topbar-height) - 28px);
}
.tiers-vs-particles-outer {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}
.tiers-vs-board {
    position: relative;
    z-index: 1;
    min-height: min(68vh, 600px);
    border-radius: var(--radius-xl);
    border: 1px solid var(--line);
    overflow: hidden;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 30% 30%, rgba(190, 132, 255, 0.2), transparent 55%),
        radial-gradient(circle at 80% 70%, rgba(90, 50, 190, 0.2), transparent 50%),
        linear-gradient(180deg, rgba(12, 5, 22, 0.92), rgba(5, 2, 10, 0.95));
}
.tiers-vs-arena {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}
.tiers-vs-particles {
    position: absolute;
    inset: 0;
    z-index: 1;
}
.vs-particle {
    position: absolute;
    left: 0;
    top: 0;
    width: var(--size, 56px);
    height: var(--size, 56px);
    object-fit: contain;
    opacity: var(--alpha, 0.84);
    filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.48));
    will-change: transform;
    pointer-events: none;
}
.tiers-vs-arena-glow {
    position: absolute;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(circle at 30% 30%, rgba(190, 132, 255, 0.12), transparent 45%),
        radial-gradient(circle at 70% 65%, rgba(120, 70, 220, 0.1), transparent 45%);
    mix-blend-mode: screen;
    opacity: 0.66;
    animation: vs-glow-pulse 4.5s ease-in-out infinite;
}
.tiers-vs-copy {
    position: relative;
    z-index: 3;
    width: min(92%, 860px);
    text-align: center;
    padding: 30px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(190, 132, 255, 0.24);
    background: rgba(12, 6, 24, 0.58);
    backdrop-filter: blur(8px);
}
.tiers-vs-copy h2 {
    margin-bottom: 10px;
    font-size: clamp(1.6rem, 3.2vw, 2.8rem);
    letter-spacing: 0.08em;
}
.tiers-vs-copy p {
    margin: 0;
    color: var(--text-secondary);
    font-size: clamp(0.96rem, 1.8vw, 1.2rem);
    line-height: 1.75;
}
.tiers-vs-particles-outer .vs-particle {
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.42));
}

/* ═══ PLAYER ROW ═══ */
.player-row {
    display: grid;
    grid-template-columns: var(--rankings-cols);
    gap: 12px; align-items: center;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    background: var(--card);
    cursor: pointer;
    transition: all 0.22s ease;
    contain: layout style paint;
    opacity: 0; transform: translateY(6px);
    animation: row-in 0.5s cubic-bezier(.2,.7,.2,1) forwards;
}
.player-row:hover, .player-row:focus-visible {
    background: var(--card-hover);
    border-color: var(--line-hover);
    transform: translateX(-4px);
    outline: none;
    box-shadow: 4px 0 0 var(--accent), var(--shadow);
}

/* Top 3 rows */
.player-row.top-1 { border-left: 3px solid var(--gold); }
.player-row.top-1 .row-rank { color: var(--gold); }
.player-row.top-2 { border-left: 3px solid var(--silver); }
.player-row.top-2 .row-rank { color: var(--silver); }
.player-row.top-3 { border-left: 3px solid var(--bronze); }
.player-row.top-3 .row-rank { color: var(--bronze); }

.row-rank {
    font-family: "Orbitron", sans-serif;
    font-size: 1.1rem; font-weight: 900;
    color: var(--muted); text-align: center;
}

.row-skin { display: flex; align-items: center; justify-content: center; }

.skin-stage, .modal-skin-stage {
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background:
        linear-gradient(180deg, rgba(80, 40, 140, 0.12), rgba(6, 3, 12, 0.8)),
        url("/static/assets/background-jugadores-testers.gif");
    background-size: cover; background-position: center;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.skin-stage { width: 48px; height: 48px; }
.modal-skin-stage { width: 160px; height: 160px; }

.skin-doll {
    --pixel: 5px;
    position: relative;
    width: calc(9 * var(--pixel)); height: calc(9 * var(--pixel));
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}
.skin-head {
    position: absolute; inset: 0; margin: auto;
    width: calc(8 * var(--pixel)); height: calc(8 * var(--pixel));
}
.skin-head-layer {
    position: absolute; inset: 0;
    background-repeat: no-repeat;
    background-size: calc(64 * var(--pixel)) calc(64 * var(--pixel));
    image-rendering: pixelated;
}
.skin-head-overlay { transform: scale(1.08); transform-origin: center; }
.modal-skin-stage .skin-doll { --pixel: 10px; }

.row-player-info { display: grid; gap: 2px; min-width: 0; }
.player-name {
    margin: 0; font-family: "Orbitron", sans-serif;
    font-size: 0.82rem; font-weight: 700;
    letter-spacing: 0.03em; text-transform: uppercase;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.player-tag {
    margin: 0; color: var(--muted); font-size: 0.78rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.region-badge {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 4px 10px; border-radius: var(--radius-pill);
    background: rgba(190, 132, 255, 0.1);
    border: 1px solid rgba(190, 132, 255, 0.2);
    font-family: "Orbitron", sans-serif;
    font-size: 0.62rem; font-weight: 700;
    letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--accent); white-space: nowrap;
}
.player-region { justify-self: center; }

.row-points {
    font-family: "Orbitron", sans-serif;
    font-size: 0.88rem; font-weight: 700;
    color: var(--text); text-align: right;
    justify-self: end;
}

.row-tiers { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }

/* ═══ MODALITY / TIER PILLS ═══ */
.modality-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 8px; border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: rgba(190, 132, 255, 0.06);
    min-width: 0;
}
.modality-head { display: flex; align-items: center; gap: 6px; }
.modality-identity {
    width: 24px; height: 24px;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.modality-gif { width: 100%; height: 100%; object-fit: contain; display: block; }
.modality-fallback {
    font-family: "Orbitron", sans-serif;
    font-size: 0.56rem; letter-spacing: 0.06em;
    font-weight: 700; color: var(--accent);
}

.tier-label {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 36px; min-height: 22px;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(190, 132, 255, 0.2);
    background: rgba(190, 132, 255, 0.12);
    font-family: "Orbitron", sans-serif;
    font-size: 0.6rem; letter-spacing: 0.04em; font-weight: 700;
    color: var(--text);
}
.status-label { color: var(--text-secondary); }

/* Large modality pills (modal) */
.modal-current-ranks { display: flex; flex-wrap: wrap; gap: 8px; }
.modal-current-ranks .modality-pill {
    padding: 8px 12px; gap: 8px;
}
.modal-current-ranks .modality-identity { width: 36px; height: 36px; }
.modal-current-ranks .tier-label { font-size: 0.68rem; min-width: 44px; min-height: 26px; }

/* Rank pill */
.rank-pill {
    display: inline-flex; align-items: center;
    padding: 6px 14px; border-radius: var(--radius-pill);
    border: 1px solid rgba(190, 132, 255, 0.25);
    background: rgba(190, 132, 255, 0.12);
    font-family: "Orbitron", sans-serif;
    font-size: 0.8rem; font-weight: 700; color: var(--accent);
}

.modality-count { color: var(--muted); font-size: 0.84rem; }

/* ═══ TESTER CARD ═══ */
.tester-card {
    padding: 16px; display: grid; gap: 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: var(--card);
    transition: border-color 0.2s ease;
}
.tester-card:hover { border-color: var(--line-hover); }
.tester-badge {
    display: inline-block;
    padding: 4px 10px; border-radius: var(--radius-pill);
    background: rgba(190, 132, 255, 0.15);
    border: 1px solid rgba(190, 132, 255, 0.25);
    font-family: "Orbitron", sans-serif;
    font-size: 0.58rem; font-weight: 700;
    letter-spacing: 0.08em; color: var(--accent);
    width: fit-content;
}
.tester-copy, .tester-meta { display: grid; gap: 4px; }
.tester-name {
    margin: 0; font-family: "Orbitron", sans-serif;
    font-size: 0.8rem; font-weight: 700; text-transform: uppercase;
}
.tester-tag { margin: 0; color: var(--muted); font-size: 0.82rem; }
.tester-count { color: var(--muted); font-size: 0.82rem; }
.tester-modalities { display: flex; flex-wrap: wrap; gap: 6px; }
.testers-grid { display: grid; gap: 8px; }

/* ═══ EMPTY STATE ═══ */
.empty-state { padding-top: 20px; }
.empty-box {
    border-radius: var(--radius-lg); padding: 32px;
    background: var(--surface-hard);
    border: 1px solid var(--line);
    text-align: center;
}
.empty-box h3 { margin-bottom: 8px; }
.empty-box p:last-child { margin: 0; color: var(--muted); line-height: 1.7; }

/* ═══ INFO TAB ═══ */
.info-hero {
    display: grid;
    grid-template-columns: 1fr minmax(240px, 400px);
    gap: clamp(20px, 3vw, 48px); align-items: center;
    padding: clamp(24px, 4vw, 48px);
    border-radius: var(--radius-xl);
    border: 1px solid var(--line);
    background: var(--surface-hard);
    overflow: hidden; position: relative;
}
.info-hero::after {
    content: "";
    position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(135deg, rgba(190, 132, 255, 0.04), transparent 40%);
}
.info-hero-copy { position: relative; z-index: 1; display: grid; gap: 12px; }
.info-desc { margin: 0; color: var(--text-secondary); line-height: 1.8; }
.info-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.info-tag {
    padding: 6px 12px; border-radius: var(--radius-pill);
    border: 1px solid rgba(190, 132, 255, 0.2);
    background: rgba(190, 132, 255, 0.08);
    font-size: 0.66rem; letter-spacing: 0.06em;
    text-transform: uppercase; font-family: "Orbitron", sans-serif;
    color: var(--accent);
}
.info-credits { margin-top: 8px; display: grid; gap: 4px; }
.info-credits h3 { margin-bottom: 2px; }
.info-credits p { margin: 0; color: var(--text-secondary); font-size: 0.92rem; }

.info-hero-art {
    position: relative; z-index: 1;
    display: flex; justify-content: center; align-items: center;
}
.info-hero-art img {
    width: min(100%, 380px); height: auto; object-fit: contain;
    display: block; opacity: 0.92;
    filter: drop-shadow(0 16px 28px rgba(0, 0, 0, 0.4));
    animation: info-float 8s ease-in-out infinite;
}

/* ═══ MECANICA TAB ═══ */
.mechanics-board {
    border-radius: var(--radius-xl);
    border: 1px solid var(--line);
    background: var(--surface-hard);
    padding: clamp(20px, 3vw, 36px); display: grid; gap: 20px;
}
.mechanics-head { display: grid; gap: 8px; }
.mechanics-lead { margin: 0; color: var(--text-secondary); line-height: 1.7; }

.mechanics-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.mechanic-card {
    border: 1px solid var(--line); border-radius: var(--radius-md);
    padding: 16px; background: var(--card);
    transition: border-color 0.2s ease;
}
.mechanic-card:hover { border-color: var(--line-hover); }
.mechanic-card p { margin: 8px 0 0; color: var(--text-secondary); line-height: 1.6; }
.mechanic-mode { display: inline-flex; align-items: center; gap: 12px; }
.mechanic-mode img { width: 48px; height: 32px; object-fit: contain; display: block; }

.mechanics-rules {
    border: 1px solid var(--line); border-radius: var(--radius-md);
    padding: 16px; background: var(--card);
}
.mechanics-rules h3 { margin-bottom: 8px; }
.mechanics-rules p { margin: 4px 0 0; color: var(--text-secondary); line-height: 1.6; }

/* ═══ MODAL ═══ */
.modal-shell {
    position: fixed; inset: 0; z-index: 200;
    display: grid; place-items: center; padding: 16px;
}
.modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(3, 1, 8, 0.82);
    backdrop-filter: blur(12px);
}
.modal-card {
    position: relative;
    width: min(800px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    overflow-y: auto; border-radius: var(--radius-xl);
    padding: 32px; background: var(--surface-hard);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
}
.modal-card::before {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, rgba(190, 132, 255, 0.04), transparent 30%);
}
.modal-close {
    position: absolute; top: 16px; right: 16px;
    width: 36px; height: 36px;
    border-radius: 50%; border: 1px solid var(--line);
    background: rgba(190, 132, 255, 0.08);
    color: var(--text); cursor: pointer;
    display: grid; place-items: center;
    transition: all 0.2s ease;
}
.modal-close:hover { background: rgba(190, 132, 255, 0.18); border-color: var(--line-hover); }
.modal-close svg { width: 16px; height: 16px; }

.modal-hero { display: flex; gap: 24px; align-items: center; margin-bottom: 28px; }
.modal-copy { display: grid; gap: 8px; }
.modal-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.modal-region-badge { font-size: 0.68rem; }
.modal-subtitle { margin: 0; color: var(--muted); font-size: 0.88rem; }
.modal-rank-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.modal-section { margin-top: 24px; display: grid; gap: 12px; }
.modal-section-head { display: flex; align-items: center; justify-content: space-between; }

/* History */
.history-list { display: grid; gap: 8px; }
.history-pagination {
    display: flex; align-items: center; gap: 12px;
    justify-content: center; margin-top: 8px;
}
.history-item {
    border-radius: var(--radius-md);
    border: 1px solid var(--line); background: var(--card);
    padding: 14px 16px; display: grid; gap: 6px;
}
.history-topline {
    display: flex; align-items: center;
    justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.history-rank { display: inline-flex; align-items: center; gap: 8px; }
.history-rank strong {
    font-family: "Orbitron", sans-serif;
    font-size: 0.8rem; letter-spacing: 0.04em;
}
.history-meta { color: var(--muted); font-size: 0.8rem; }

/* ═══ ADMIN (preserved structure) ═══ */
.admin-card { width: min(860px, calc(100vw - 32px)); }
.admin-head { display: grid; gap: 8px; margin-bottom: 12px; }
.admin-subtitle { margin: 0; color: var(--muted); line-height: 1.6; }
.admin-view { display: block; }
.admin-form { display: grid; gap: 14px; }
.admin-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.admin-grid-player { grid-template-columns: 1fr auto; align-items: end; }
.admin-field { display: grid; gap: 6px; }
.admin-field span { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.admin-input {
    width: 100%; border: 1px solid var(--line); border-radius: var(--radius-md);
    padding: 10px 12px; background: var(--surface-hard);
    color: var(--text); outline: none; transition: border-color 0.2s ease;
}
.admin-input:focus-visible { border-color: rgba(190, 132, 255, 0.4); }
.admin-button {
    min-height: 40px; border: 1px solid rgba(190, 132, 255, 0.3);
    border-radius: var(--radius-md); padding: 0 16px;
    font-family: "Orbitron", sans-serif; font-size: 0.64rem;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: #fff; cursor: pointer;
    background: rgba(190, 132, 255, 0.18);
    transition: all 0.2s ease;
}
.admin-button:hover { background: rgba(190, 132, 255, 0.28); }
.admin-button:disabled { opacity: 0.38; cursor: not-allowed; }
.admin-button.secondary { background: rgba(190, 132, 255, 0.08); }
.admin-section-title {
    margin: 0 0 8px; font-size: 0.78rem; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--muted); font-weight: 700;
}
.admin-modalities-editor { display: grid; gap: 8px; }
.admin-modality-row {
    display: grid; grid-template-columns: 1fr 130px 120px;
    gap: 10px; align-items: center;
    border: 1px solid var(--line); border-radius: var(--radius-md);
    padding: 10px; background: var(--card);
}
.admin-modality-name { font-size: 0.83rem; font-weight: 700; color: var(--text); }
.admin-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.admin-status-message { min-height: 22px; margin: 12px 0 0; font-size: 0.88rem; color: var(--muted); }
.admin-status-message.error { color: var(--danger); }
.admin-status-message.success { color: var(--good); }

/* ═══ MASCOT ═══ */
.mascot-button {
    position: fixed; z-index: 32;
    width: 56px; height: 56px;
    padding: 0; border: 0; background: transparent;
    cursor: pointer;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.4));
    transition: transform 0.2s ease;
}
.mascot-button img { width: 100%; height: 100%; object-fit: contain; display: block; }
.mascot-button:hover { transform: scale(1.1); outline: none; }
.mascot-top-left { top: 80px; left: 16px; }
.mascot-top-right { top: 80px; right: 16px; }
.mascot-bottom-left { left: 16px; bottom: 16px; }
.mascot-bottom-right { right: 16px; bottom: 16px; }

/* ═══ UTILITIES ═══ */
.hidden { display: none !important; }
.visually-hidden {
    position: absolute !important; width: 1px; height: 1px;
    margin: -1px; border: 0; padding: 0;
    white-space: nowrap; clip-path: inset(50%); clip: rect(0 0 0 0); overflow: hidden;
}

/* ═══ PERFORMANCE MODE ═══ */
body.performance-lite { background-attachment: scroll; }
body.performance-lite .ambient, body.performance-lite .grid-overlay { display: none; }
body.performance-lite .topbar,
body.performance-lite .modal-card { backdrop-filter: none !important; }
body.performance-lite .player-row,
body.performance-lite .tester-card,
body.performance-lite .tab-panel.active,
body.performance-lite .tab-panel.is-fading-out,
body.performance-lite .info-hero-art img,
body.performance-lite .tiers-vs-arena-glow { animation: none !important; }
body.performance-lite .player-row,
body.performance-lite .tester-card,
body.performance-lite .tab-panel { opacity: 1 !important; transform: none !important; }
body.performance-lite .player-row:hover,
body.performance-lite .player-row:focus-visible { transform: none !important; }

/* ═══ REVEAL ═══ */
.reveal { opacity: 0; transform: translateY(14px); animation: reveal 0.6s cubic-bezier(.2,.7,.2,1) forwards; }
.delay-1 { animation-delay: 0.08s; }
.delay-2 { animation-delay: 0.16s; }

/* ═══ KEYFRAMES ═══ */
@keyframes reveal { to { opacity: 1; transform: translateY(0); } }
@keyframes row-in { to { opacity: 1; transform: translateY(0); } }
@keyframes drift { 0%, 100% { transform: translate3d(0,0,0) scale(1); } 50% { transform: translate3d(0,-14px,0) scale(1.04); } }
@keyframes orbit-track {
    from { transform: rotate(var(--orbit-start)) translateY(calc(-1 * var(--orbit-radius))); }
    to { transform: rotate(calc(var(--orbit-start) + 360deg)) translateY(calc(-1 * var(--orbit-radius))); }
}
@keyframes orbit-counter { from { transform: rotate(0deg); } to { transform: rotate(-360deg); } }
@keyframes loader-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes topbar-reveal { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes tab-fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes tab-fade-out { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(6px); } }
@keyframes info-float { 0%, 100% { transform: translate3d(0,0,0); } 50% { transform: translate3d(0,-12px,0); } }
@keyframes vs-glow-pulse {
    0%, 100% { opacity: 0.52; }
    50% { opacity: 0.8; }
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 960px) {
    .rankings-table-head { display: none; }
    .player-row {
        grid-template-columns: 40px 48px 1fr;
        grid-template-rows: auto auto;
        gap: 8px 10px;
        padding: 12px 14px;
    }
    .row-rank { grid-row: 1 / 3; }
    .row-skin { grid-row: 1 / 3; }
    .row-player-info { grid-column: 3; grid-row: 1; }
    .player-region { grid-column: 3; grid-row: 2; justify-self: start; }
    .row-points {
        grid-column: 3; grid-row: 2; justify-self: end;
        text-align: right; font-size: 0.8rem;
    }
    .row-tiers {
        grid-column: 1 / -1; grid-row: 3;
        justify-content: flex-start;
    }
    .rankings-header { flex-direction: column; align-items: stretch; }
    .info-hero { grid-template-columns: 1fr; }
    .info-hero-art { justify-content: center; }
    .info-hero-art img { max-width: 320px; }
    .tiers-vs-board { min-height: 430px; }
}

@media (max-width: 720px) {
    :root { --topbar-height: 56px; }
    .page-shell { padding: calc(var(--topbar-height) + 16px) 12px 60px; }
    .topbar { gap: 8px; padding: 0 12px; }
    .topbar-tabs { gap: 2px; margin-left: 8px; }
    .topbar-tab { padding: 6px 10px; font-size: 0.72rem; }
    .site-logo { height: 28px; }
    .status-pill { display: none; }
    .mechanics-grid { grid-template-columns: 1fr; }
    .modal-hero { flex-direction: column; align-items: stretch; }
    .modal-skin-stage { width: 100%; height: 140px; }
    .admin-grid, .admin-grid-player, .admin-modality-row { grid-template-columns: 1fr; }
    .admin-button { width: 100%; }
}

@media (max-width: 480px) {
    :root { --topbar-height: 96px; }
    .topbar {
        height: var(--topbar-height);
        align-items: flex-start;
        flex-wrap: wrap;
        padding-top: 8px;
        padding-bottom: 8px;
        gap: 6px;
    }
    .topbar-brand { height: 28px; display: flex; align-items: center; }
    .site-logo { height: 24px; }
    .topbar-tabs {
        display: flex;
        width: 100%;
        margin-left: 0;
        gap: 6px;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .topbar-tabs::-webkit-scrollbar { display: none; }
    .topbar-tab {
        flex: 0 0 auto;
        white-space: nowrap;
        padding: 6px 12px;
        font-size: 0.72rem;
    }
    .topbar::after { content: none; }
    .page-shell { padding-top: calc(var(--topbar-height) + 16px); }
    .boot-loader-core { --orbit-radius: 96px; width: 250px; height: 250px; }
    .boot-orbit-item { width: 62px; height: 62px; margin-left: -31px; margin-top: -31px; }
    .boot-mascot-wrap { width: 92px; height: 92px; }
}

@media (prefers-reduced-motion: reduce) {
    .ambient, .reveal, .player-row, .tester-card, .info-hero-art img { animation: none !important; }
    .topbar.reveal { opacity: 1 !important; transform: none !important; }
    .topbar { transition: none !important; }
    .reveal, .player-row, .tester-card { opacity: 1 !important; transform: none !important; }
}
