:root {
    color-scheme: dark;
    --color-primary: #7c3aed;
    --color-secondary: #a78bfa;
    --color-cta: #f43f5e;
    --color-background: #0f0f23;
    --color-text: #e2e8f0;
    --ink: #f8fbff;
    --muted: #9aa6c7;
    --muted-2: #647091;
    --panel: rgba(14, 16, 35, 0.82);
    --panel-strong: rgba(18, 20, 44, 0.94);
    --line: rgba(167, 139, 250, 0.18);
    --line-hot: rgba(244, 63, 94, 0.38);
    --good: #22c55e;
    --warn: #fbbf24;
    --bad: #fb7185;
    --radius-sm: 12px;
    --radius-md: 18px;
    --radius-lg: 20px;
    --radius-xl: 26px;
    --shadow-21: 0 16px 48px rgba(0, 0, 0, 0.36), 0 0 42px rgba(124, 58, 237, 0.1);
    --shadow-hot: 0 12px 34px rgba(244, 63, 94, 0.22), 0 0 24px rgba(124, 58, 237, 0.2);
    --sidebar-width: 260px;
    --ease: 180ms ease;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--color-text);
    font-family: 'Chakra Petch', system-ui, sans-serif;
    background:
        radial-gradient(circle at 12% 8%, rgba(244, 63, 94, 0.24), transparent 22rem),
        radial-gradient(circle at 88% 10%, rgba(124, 58, 237, 0.26), transparent 24rem),
        radial-gradient(circle at 50% 95%, rgba(14, 165, 233, 0.11), transparent 28rem),
        linear-gradient(180deg, #090913 0%, #0f0f23 54%, #090913 100%);
    overflow-x: hidden;
    font-size: 15px;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        linear-gradient(rgba(255, 255, 255, 0.026) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.028) 0 1px, transparent 1px 4px);
    background-size: 48px 48px, 48px 48px, 100% 4px;
    mask-image: radial-gradient(circle at center, black 0%, transparent 78%);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    border: 0;
}

h1,
h2,
h3,
.tf-brand-title,
.tf-stat-value,
.topbar-title {
    font-family: 'Russo One', 'Chakra Petch', sans-serif;
    letter-spacing: -0.025em;
}

img {
    max-width: 100%;
}

code {
    display: block;
    overflow-wrap: anywhere;
    color: #ffd6de;
    font-size: 0.9rem;
}

.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;
}

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    gap: 0.75rem;
    min-height: 100vh;
    padding: 0.65rem;
}

.main-shell,
.page-shell,
.public-shell,
.login-shell {
    min-width: 0;
}

.main-shell,
.page-shell {
    display: grid;
    gap: 0.75rem;
    align-content: start;
}

.login-shell,
.public-shell {
    min-height: 100vh;
    padding: clamp(0.75rem, 2vw, 1.25rem);
}

.login-shell {
    display: grid;
    place-items: center;
}

.public-shell {
    width: min(100%, 1220px);
    margin: 0 auto;
    display: grid;
    align-content: start;
    gap: 1rem;
}

.tf-card,
.card {
    position: relative;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 28%),
        linear-gradient(180deg, var(--panel-strong), rgba(10, 11, 24, 0.92));
    box-shadow: var(--shadow-21);
    backdrop-filter: blur(18px);
    overflow: hidden;
}

.tf-card::before,
.card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(90deg, transparent, rgba(167, 139, 250, 0.15), transparent);
    opacity: 0.42;
}

.tf-card-pad {
    padding: clamp(0.85rem, 1.6vw, 1.15rem);
}

.tf-button,
.primary-action,
.secondary-action,
.text-link,
.player-picker-trigger,
.player-picker-option,
.logout-button,
.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    min-height: 44px;
    border-radius: 999px;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: transform var(--ease), border-color var(--ease), background var(--ease), color var(--ease), box-shadow var(--ease);
}

.primary-action,
.tf-button-primary {
    padding: 0.68rem 1rem;
    color: white;
    background: linear-gradient(135deg, var(--color-cta), #ff7a3d 52%, var(--color-primary));
    box-shadow: var(--shadow-hot);
}

.secondary-action,
.tf-button-secondary,
.player-picker-trigger {
    padding: 0.62rem 0.92rem;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid var(--line);
}

.text-link {
    min-height: 34px;
    padding: 0.38rem 0.68rem;
    color: #d8ccff;
    background: rgba(124, 58, 237, 0.11);
    border: 1px solid rgba(167, 139, 250, 0.2);
}

.tf-button:hover,
.primary-action:hover,
.secondary-action:hover,
.text-link:hover,
.player-picker-trigger:hover,
.player-picker-option:hover,
.logout-button:hover,
.icon-button:hover {
    transform: translateY(-1px);
    border-color: var(--line-hot);
}

.primary-action:focus-visible,
.secondary-action:focus-visible,
.text-link:focus-visible,
.sidebar-link:focus-visible,
.player-picker-trigger:focus-visible,
.player-picker-option:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
    outline: 2px solid rgba(244, 63, 94, 0.9);
    outline-offset: 3px;
}

.brand-mark {
    position: relative;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    border-radius: 14px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.9), transparent 16%),
        conic-gradient(from 150deg, #f43f5e, #7c3aed, #06b6d4, #f43f5e);
    box-shadow: 0 0 34px rgba(124, 58, 237, 0.42), inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.brand-mark::after {
    content: '';
    position: absolute;
    inset: 10px;
    border: 2px solid rgba(15, 15, 35, 0.88);
    border-left-color: transparent;
    transform: rotate(45deg);
}

.brand-logo {
    overflow: hidden;
    background: rgba(255, 255, 255, 0.06);
}

.brand-logo::after {
    display: none;
}

.brand-logo img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.tf-brand,
.login-brand,
.public-brand,
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.tf-brand-title,
.login-brand strong,
.public-brand strong,
.sidebar-brand strong {
    display: block;
    color: var(--ink);
    font-size: 0.95rem;
}

.tf-brand-subtitle,
.login-brand small,
.public-brand small,
.sidebar-brand small {
    display: block;
    color: var(--muted);
    margin-top: 0.1rem;
}

.sidebar-backdrop {
    display: none;
}

.sidebar {
    position: sticky;
    top: 0.65rem;
    height: calc(100vh - 1.3rem);
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    padding: 0.75rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: linear-gradient(180deg, rgba(15, 15, 35, 0.96), rgba(8, 9, 20, 0.96));
    box-shadow: var(--shadow-21);
    backdrop-filter: blur(22px);
}

.sidebar-brand-wrap,
.sidebar-footer {
    padding: 0.25rem 0.15rem 0.75rem;
    border-bottom: 1px solid var(--line);
}

.sidebar-footer {
    margin-top: auto;
    padding: 0.75rem 0.15rem 0.15rem;
    border-top: 1px solid var(--line);
    border-bottom: 0;
    display: grid;
    gap: 0.85rem;
}

.sidebar-section,
.sidebar-nav,
.sidebar-admin-box,
.sidebar-note {
    display: grid;
    gap: 0.55rem;
}

.sidebar-label,
.overline,
.metric-label,
.field span,
.field-label,
.summary-cell span {
    color: var(--muted-2);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.66rem;
    font-weight: 700;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 40px;
    padding: 0.55rem 0.68rem;
    color: #cfd7ff;
    border-radius: 13px;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    transition: transform var(--ease), border-color var(--ease), background var(--ease), color var(--ease);
}

.sidebar-link:hover,
.sidebar-link.is-active {
    color: var(--ink);
    border-color: rgba(167, 139, 250, 0.26);
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.24), rgba(244, 63, 94, 0.1));
}

.nav-icon {
    width: 12px;
    height: 12px;
    border-radius: 5px;
    background: linear-gradient(135deg, #f43f5e, #a78bfa);
    box-shadow: 0 0 18px rgba(244, 63, 94, 0.38);
}

.sidebar-note,
.sidebar-admin-box {
    padding: 0.65rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.045);
}

.sidebar-note strong,
.sidebar-admin-box strong {
    color: var(--ink);
}

.sidebar-note small {
    color: var(--muted);
}

.logout-form {
    margin: 0;
}

.logout-button {
    width: 100%;
    padding: 0.55rem 0.75rem;
    color: var(--ink);
    background: rgba(244, 63, 94, 0.12);
    border: 1px solid rgba(244, 63, 94, 0.26);
}

.topbar {
    position: sticky;
    top: 0.65rem;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 58px;
    padding: 0.65rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: rgba(12, 13, 30, 0.78);
    box-shadow: var(--shadow-21);
    backdrop-filter: blur(20px);
}

.topbar-left,
.page-actions,
.form-actions,
.centered-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.topbar-context {
    display: grid;
    gap: 0.08rem;
}

.topbar-title {
    color: var(--ink);
    font-size: 0.95rem;
}

.topbar-context small,
.section-title-block p,
.page-header p,
.public-subtitle,
.soft-meta,
.player-row-identity p,
.entry-head p,
.history-row-card p,
.centered-copy p {
    color: var(--muted);
}

.mobile-only {
    display: none;
}

.icon-button {
    width: 46px;
    height: 46px;
    padding: 0;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.06);
}

.icon-button span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--ink);
    box-shadow: 0 6px 0 var(--ink), 0 -6px 0 var(--ink);
}

.page-header,
.public-leaderboard-header,
.public-player-hero {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    padding: clamp(0.9rem, 2vw, 1.3rem);
    border-radius: var(--radius-xl);
}

.page-header,
.public-player-hero {
    border: 1px solid var(--line);
    background:
        linear-gradient(135deg, rgba(124, 58, 237, 0.26), transparent 34%),
        linear-gradient(180deg, rgba(18, 20, 44, 0.84), rgba(10, 11, 24, 0.9));
}

.page-header h1,
.public-leaderboard-header h1,
.section-title-block h1,
.centered-copy h1 {
    margin: 0.25rem 0;
    color: var(--ink);
    font-size: clamp(1.45rem, 3.2vw, 2.8rem);
    line-height: 1;
    text-shadow: 0 0 34px rgba(124, 58, 237, 0.32);
}

.page-header p,
.public-leaderboard-header p,
.section-title-block p {
    max-width: 68ch;
    margin: 0;
    font-size: 0.95rem;
}

.compact-head {
    margin-bottom: 0.55rem;
}

.metrics-grid,
.dashboard-grid,
.split-grid,
.summary-grid,
.player-entry-grid,
.form-grid {
    display: grid;
    gap: 0.75rem;
}

.metrics-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dashboard-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
}

.span-8 {
    grid-column: span 8;
}

.span-4 {
    grid-column: span 4;
}

.split-grid {
    grid-template-columns: minmax(320px, 0.85fr) minmax(0, 1.15fr);
}

.single-column-layout {
    display: grid;
    align-content: start;
}

.metric-card,
.split-form,
.split-list,
.compact-card,
.wide-form,
.setup-card,
.player-summary-card,
.public-match-history-card,
.login-card {
    padding: clamp(0.8rem, 1.45vw, 1.1rem);
}

.wide-form {
    overflow: visible;
}

.page-matches .tf-card {
    overflow: visible;
}

.metric-card {
    min-height: 112px;
    display: grid;
    align-content: space-between;
    border-radius: var(--radius-lg);
}

.metric-card strong,
.tf-stat-value {
    color: var(--ink);
    font-size: clamp(1.55rem, 3vw, 2.45rem);
    line-height: 1;
}

.metric-card small {
    color: var(--muted);
}

.accent-card {
    border-color: var(--line-hot);
    background:
        linear-gradient(135deg, rgba(244, 63, 94, 0.22), rgba(124, 58, 237, 0.2)),
        linear-gradient(180deg, rgba(18, 20, 44, 0.94), rgba(10, 11, 24, 0.94));
}

.card-head,
.compact-head,
.centered-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.7rem;
}

.card-head h2,
.compact-head h2,
.centered-card-head h2 {
    margin: 0.15rem 0 0;
    color: var(--ink);
    font-size: clamp(1.05rem, 1.7vw, 1.45rem);
}

.centered-card-head,
.centered-copy,
.centered-actions {
    text-align: center;
    justify-content: center;
}

.soft-chip,
.status-pill,
.ranking-index,
.mobile-rank-meta span,
.history-row-metrics span,
.soft-meta {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: #d8ccff;
    background: rgba(124, 58, 237, 0.1);
    font-size: 0.8rem;
    font-weight: 700;
}

.status-pill.is-live {
    color: #c9ffe0;
    border-color: rgba(34, 197, 94, 0.3);
    background: rgba(34, 197, 94, 0.11);
}

.status-pill.is-muted {
    color: #c8cedf;
    background: rgba(100, 116, 139, 0.12);
}

.chart-wrap {
    height: 260px;
}

.empty-panel {
    display: grid;
    min-height: 96px;
    place-items: center;
    padding: 0.9rem;
    color: var(--muted);
    text-align: center;
    border: 1px dashed rgba(167, 139, 250, 0.24);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.035);
}

.ranking-list,
.player-list,
.history-list,
.form-stack {
    display: grid;
    gap: 0.65rem;
}

.ranking-row,
.player-row-card,
.history-row-card,
.mobile-rank-card,
.entry-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.68rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.045);
    transition: transform var(--ease), border-color var(--ease), background var(--ease);
}

.ranking-row:hover,
.player-row-card:hover,
.history-row-card:hover,
.mobile-rank-card:hover {
    transform: translateY(-1px);
    border-color: var(--line-hot);
    background: rgba(255, 255, 255, 0.07);
}

.ranking-meta,
.public-history-main {
    min-width: 0;
    flex: 1;
}

.ranking-meta strong,
.player-row-identity strong,
.entry-head strong,
.history-row-card strong,
.table-link strong,
.mobile-rank-top strong {
    color: var(--ink);
}

.ranking-meta small {
    display: block;
    color: var(--muted);
}

.ranking-score {
    color: #ffd6de;
    font-weight: 800;
}

.app-form,
.form-section,
.roster-picker {
    display: grid;
    gap: 0.75rem;
}

.form-grid.cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.cols-4,
.compact-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.form-grid.cols-5,
.match-stat-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.field,
.toggle-field,
.slim-field {
    display: grid;
    gap: 0.45rem;
}

.toggle-field {
    display: flex;
    align-items: center;
    width: fit-content;
    min-height: 44px;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.045);
    cursor: pointer;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    color: var(--ink);
    border: 1px solid rgba(167, 139, 250, 0.24);
    border-radius: 13px;
    background: rgba(3, 6, 23, 0.52);
    padding: 0.6rem 0.75rem;
    transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
}

input[type='file'] {
    padding: 0.52rem;
}

input[type='checkbox'] {
    width: 18px;
    min-height: 18px;
    accent-color: var(--color-cta);
}

input:hover,
select:hover,
textarea:hover,
input:focus,
select:focus,
textarea:focus {
    border-color: var(--line-hot);
    background: rgba(3, 6, 23, 0.72);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.12);
}

.player-row-identity,
.player-row-meta,
.row-links,
.entry-head,
.mobile-rank-top,
.history-row-metrics {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex-wrap: wrap;
}

.player-avatar {
    display: inline-grid;
    place-items: center;
    overflow: hidden;
    color: white;
    font-weight: 800;
    background: linear-gradient(135deg, var(--color-primary), var(--color-cta));
    box-shadow: 0 0 30px rgba(124, 58, 237, 0.22);
}

.player-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.small-avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
}

.hero-avatar {
    width: 96px;
    height: 96px;
    margin: 0 auto 0.75rem;
    border-radius: 26px;
}

.player-picker {
    position: relative;
    z-index: 120;
}

.player-picker-trigger {
    width: min(100%, 360px);
    justify-content: space-between;
}

.player-picker-menu {
    position: absolute;
    z-index: 140;
    top: calc(100% + 0.6rem);
    left: 0;
    width: min(100vw - 2rem, 440px);
    max-height: 420px;
    display: none;
    overflow: auto;
    padding: 0.7rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: rgba(10, 11, 24, 0.98);
    box-shadow: var(--shadow-21);
}

.player-picker.is-open .player-picker-menu {
    display: grid;
    gap: 0.5rem;
}

.player-picker-option {
    width: 100%;
    justify-content: space-between;
    min-height: 50px;
    padding: 0.58rem 0.65rem;
    color: var(--ink);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.045);
    text-align: left;
}

.player-picker-option small {
    display: block;
    color: var(--muted);
}

.player-picker-option.is-pending,
.player-picker-option.is-selected {
    border-color: var(--line-hot);
    background: rgba(244, 63, 94, 0.12);
}

.player-picker-option:disabled {
    cursor: not-allowed;
    opacity: 0.56;
}

.player-picker-actions {
    padding-top: 0.45rem;
}

.picker-action {
    width: 100%;
}

.entry-card {
    display: grid;
    align-items: stretch;
}

.match-entry-layout {
    gap: 0.65rem;
}

.match-form-card,
.recent-matches-card {
    padding: 0.75rem;
}

.match-form-card {
    position: relative;
    z-index: 90;
    overflow: visible;
}

.recent-matches-card {
    position: relative;
    z-index: 1;
}

.match-form {
    gap: 0.7rem;
}

.match-asset-grid {
    align-items: end;
}

.current-screenshot-link {
    display: inline-flex;
    width: fit-content;
    color: #ffd6de;
    font-weight: 800;
    font-size: 0.88rem;
}

.entry-card {
    gap: 0.65rem;
}

.entry-head {
    justify-content: space-between;
}

.entry-head p {
    margin: 0.18rem 0 0;
}

.recent-match-list {
    display: grid;
    gap: 0.55rem;
}

.recent-match-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.62rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.045);
}

.recent-match-row strong {
    color: var(--ink);
}

.recent-match-row p {
    margin: 0.2rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.hidden-card {
    display: none;
}

.entry-card > input[type='checkbox'] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    min-width: 680px;
    border-collapse: separate;
    border-spacing: 0 0.55rem;
}

.data-table th,
.data-table td {
    padding: 0.85rem 1rem;
    text-align: left;
}

.data-table th {
    color: var(--muted-2);
    text-transform: uppercase;
    letter-spacing: 0.13em;
    font-size: 0.72rem;
}

.data-table td {
    color: #dce4ff;
    background: rgba(255, 255, 255, 0.045);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.data-table td:first-child {
    border-left: 1px solid var(--line);
    border-radius: 16px 0 0 16px;
}

.data-table td:last-child {
    border-right: 1px solid var(--line);
    border-radius: 0 16px 16px 0;
}

.mobile-board {
    display: none;
}

.mobile-rank-card {
    color: inherit;
    display: grid;
    justify-content: stretch;
}

.mobile-rank-meta {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.public-filter {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    align-items: end;
    gap: 0.55rem;
    width: 100%;
}

.public-filter.is-custom {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
}

.range-control {
    min-width: 0;
}

.range-control-main {
    min-width: 210px;
}

.public-filter:not(.is-custom) .date-range-field {
    display: none;
}

.range-pill {
    align-self: end;
    justify-content: center;
    min-height: 38px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.public-filter.is-custom .range-pill {
    grid-column: 1 / -1;
    width: 100%;
    justify-self: stretch;
    min-height: 30px;
    padding-block: 0.24rem;
}

.public-filter.is-custom .range-control-main {
    grid-column: 1 / -1;
}

.no-data-panel {
    min-height: 190px;
    text-align: center;
}

.no-data-panel strong {
    display: block;
    margin: 0.35rem 0;
    color: var(--ink);
    font-size: clamp(1.15rem, 2vw, 1.55rem);
}

.no-data-panel p {
    margin: 0;
    color: var(--muted);
}

.public-link-card {
    display: grid;
    gap: 0.5rem;
}

.settings-grid {
    align-items: start;
}

.settings-card,
.settings-preview-card {
    padding: 0.9rem;
}

.brand-preview {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.85rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.045);
}

.brand-preview-logo {
    width: 58px;
    height: 58px;
    border-radius: 18px;
}

.brand-preview strong {
    display: block;
    color: var(--ink);
    font-size: 1.15rem;
}

.brand-preview small {
    color: var(--muted);
}

.summary-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.summary-cell {
    display: grid;
    gap: 0.45rem;
    padding: 0.75rem;
    text-align: center;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.045);
}

.summary-cell strong {
    color: var(--ink);
    font-size: clamp(1.15rem, 2vw, 1.65rem);
}

.public-history-card {
    align-items: stretch;
}

.history-screenshot {
    width: 180px;
    min-height: 108px;
    flex: 0 0 auto;
    overflow: hidden;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.06);
}

.history-screenshot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.login-card {
    width: min(100%, 540px);
}

.login-brand,
.public-brand {
    margin-bottom: 1.1rem;
}

.login-form {
    margin-top: 1rem;
}

.alert {
    padding: 0.9rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    color: var(--ink);
    background: rgba(255, 255, 255, 0.055);
}

.alert-success {
    border-color: rgba(34, 197, 94, 0.34);
    background: rgba(34, 197, 94, 0.11);
}

.alert-error {
    border-color: rgba(244, 63, 94, 0.38);
    background: rgba(244, 63, 94, 0.12);
}

/* Public leaderboard: responsive rank surface. */
.public-body .public-shell {
    width: min(100% - 2rem, 1180px);
    padding: 1rem 0;
}

.public-body .topbar {
    position: static;
    height: auto;
    min-height: 54px;
    padding: 0.5rem 0.75rem;
}

.public-body .public-brand {
    margin-bottom: 0;
}

.public-leaderboard-header {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(300px, 520px);
    align-items: center;
    padding: clamp(1rem, 2.4vw, 1.75rem);
    border-radius: 22px;
}

.public-leaderboard-header h1 {
    margin: 0.22rem 0 0.35rem;
    font-size: clamp(2.2rem, 5vw, 4.25rem);
    line-height: 0.92;
}

.public-leaderboard-header .public-subtitle {
    max-width: 44rem;
    font-size: clamp(0.95rem, 1.4vw, 1.08rem);
}

.public-filter {
    min-width: 0;
}

.public-filter .field {
    min-width: 0;
}

.public-leaderboard-panel {
    padding: clamp(0.75rem, 1.8vw, 1.2rem);
    border-radius: 22px;
}

.leaderboard-table {
    min-width: 760px;
    border-spacing: 0 0.65rem;
}

.leaderboard-table th {
    padding: 0.45rem 1rem 0.6rem;
}

.leaderboard-table td {
    padding: 0.95rem 1rem;
    vertical-align: middle;
}

.leaderboard-table tbody tr:first-child td {
    border-color: rgba(244, 63, 94, 0.34);
    background: linear-gradient(135deg, rgba(244, 63, 94, 0.13), rgba(124, 58, 237, 0.11));
}

.rank-cell,
.rank-badge {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 14px;
    color: #f4efff;
    border: 1px solid rgba(167, 139, 250, 0.3);
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.38), rgba(244, 63, 94, 0.18));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    font-weight: 800;
}

.player-cell {
    display: grid;
    gap: 0.15rem;
    width: fit-content;
}

.player-cell small {
    color: var(--muted-2);
    font-size: 0.78rem;
}

.damage-cell {
    color: #ffd6de;
}

.public-rank-list {
    gap: 0.65rem;
}

.mobile-rank-card {
    position: relative;
    overflow: hidden;
    padding: 0.8rem;
    border-radius: 18px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 45%),
        rgba(255, 255, 255, 0.045);
}

.mobile-rank-card.is-leader {
    border-color: rgba(244, 63, 94, 0.36);
    background:
        radial-gradient(circle at top right, rgba(244, 63, 94, 0.22), transparent 12rem),
        linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(255, 255, 255, 0.045));
}

.mobile-rank-main {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
}

.mobile-player {
    min-width: 0;
    display: grid;
    gap: 0.1rem;
}

.mobile-player strong {
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-player small,
.mobile-damage span,
.mobile-rank-stats small {
    color: var(--muted-2);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
}

.mobile-damage {
    display: grid;
    gap: 0.1rem;
    text-align: right;
}

.mobile-damage strong {
    color: #ffd6de;
    font-size: 1.08rem;
}

.mobile-rank-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.mobile-rank-stats span {
    display: grid;
    gap: 0.1rem;
    min-width: 0;
    padding: 0.55rem 0.6rem;
    border: 1px solid rgba(167, 139, 250, 0.2);
    border-radius: 14px;
    background: rgba(124, 58, 237, 0.1);
}

.mobile-rank-stats b {
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Public player profile: compact on mobile, rich on desktop. */
.public-profile-hero,
.public-profile-panel {
    padding: clamp(0.9rem, 2vw, 1.35rem);
    border-radius: 22px;
}

.public-profile-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background:
        radial-gradient(circle at 12% 18%, rgba(244, 63, 94, 0.2), transparent 13rem),
        linear-gradient(135deg, rgba(124, 58, 237, 0.18), rgba(255, 255, 255, 0.045));
}

.profile-identity {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.profile-avatar {
    width: clamp(76px, 9vw, 112px);
    height: clamp(76px, 9vw, 112px);
    border-radius: 28px;
    flex: 0 0 auto;
}

.profile-title {
    min-width: 0;
}

.profile-title h1 {
    margin: 0.18rem 0 0.25rem;
    color: var(--ink);
    font-size: clamp(2rem, 5vw, 4.1rem);
    line-height: 0.95;
    overflow-wrap: anywhere;
}

.profile-title p {
    margin: 0;
    color: var(--muted);
    font-size: clamp(0.95rem, 1.5vw, 1.1rem);
}

.profile-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.8rem;
}

.profile-section-title h2 {
    margin: 0.12rem 0 0;
    color: var(--ink);
    font-size: clamp(1.2rem, 2vw, 1.7rem);
}

.profile-stat-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.7rem;
}

.profile-stat {
    display: grid;
    gap: 0.28rem;
    min-height: 86px;
    align-content: center;
    padding: 0.85rem;
    border: 1px solid rgba(167, 139, 250, 0.2);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.045);
}

.profile-stat.is-primary {
    border-color: rgba(244, 63, 94, 0.34);
    background: linear-gradient(135deg, rgba(244, 63, 94, 0.13), rgba(124, 58, 237, 0.11));
}

.profile-stat span,
.profile-match-stats small {
    color: var(--muted-2);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.68rem;
    font-weight: 800;
}

.profile-stat strong {
    color: var(--ink);
    font-size: clamp(1.18rem, 2.2vw, 1.75rem);
    line-height: 1;
}

.profile-stat.is-primary strong {
    color: #ffd6de;
}

.profile-match-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
}

.profile-match-card {
    display: grid;
    gap: 0.75rem;
    padding: 0.8rem;
    border: 1px solid rgba(167, 139, 250, 0.22);
    border-radius: 20px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.07), transparent 40%),
        rgba(255, 255, 255, 0.045);
}

.profile-match-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 0.75rem;
}

.profile-match-head strong {
    color: var(--ink);
}

.profile-match-head p {
    margin: 0.25rem 0 0;
    color: var(--muted);
}

.profile-match-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
}

.profile-match-stats span {
    display: grid;
    gap: 0.1rem;
    padding: 0.55rem 0.6rem;
    border: 1px solid rgba(167, 139, 250, 0.2);
    border-radius: 14px;
    background: rgba(124, 58, 237, 0.1);
}

.profile-match-stats b {
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-screenshot {
    display: block;
    overflow: hidden;
    border: 1px solid rgba(167, 139, 250, 0.22);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.05);
    aspect-ratio: 16 / 9;
}

.profile-screenshot img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: transform var(--ease);
}

.profile-screenshot:hover img {
    transform: scale(1.025);
}

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

/* Dense admin layout: the app is a tool, not a landing page. */
.app-shell {
    gap: 0.5rem;
    padding: 0.5rem;
}

.main-shell,
.page-shell {
    gap: 0.5rem;
}

.topbar {
    height: 50px;
    min-height: 0;
    padding: 0.45rem 0.65rem;
    border-radius: 18px;
}

.topbar .secondary-action {
    min-height: 34px;
    padding: 0.45rem 0.75rem;
}

.page-header {
    min-height: 0;
    align-items: center;
    padding: 0.65rem 0.85rem;
    border-radius: 18px;
}

.page-header .overline,
.page-header p {
    display: none;
}

.page-header h1 {
    margin: 0;
    font-size: 1.35rem;
    line-height: 1.1;
    text-shadow: none;
}

.page-matches .page-header {
    display: none;
}

.wide-form,
.split-form,
.split-list,
.compact-card,
.leaderboard-table-card,
.player-summary-card,
.public-match-history-card {
    padding: 0.75rem;
    border-radius: 18px;
}

.form-stack,
.form-section,
.app-form,
.roster-picker,
.player-entry-grid,
.form-grid {
    gap: 0.55rem;
}

.card-head,
.compact-head,
.centered-card-head {
    margin-bottom: 0.45rem;
}

.card-head h2,
.compact-head h2,
.centered-card-head h2 {
    font-size: 1.05rem;
}

.compact-head .overline,
.form-section > .card-head .overline,
.form-section > .compact-head .overline {
    display: none;
}

.field,
.slim-field {
    gap: 0.28rem;
}

input,
select,
textarea {
    min-height: 38px;
    border-radius: 11px;
    padding: 0.48rem 0.65rem;
}

input[type='file'] {
    padding: 0.42rem 0.55rem;
}

.primary-action,
.secondary-action,
.player-picker-trigger,
.logout-button,
.text-link {
    min-height: 36px;
    padding: 0.48rem 0.75rem;
}

.player-picker-trigger {
    width: min(100%, 300px);
}

.player-picker-menu {
    max-height: 320px;
}

.entry-card,
.ranking-row,
.player-row-card,
.history-row-card,
.mobile-rank-card {
    padding: 0.55rem;
    border-radius: 14px;
}

.sidebar {
    border-radius: 20px;
}

.sidebar-note,
.sidebar-admin-box {
    padding: 0.55rem;
    border-radius: 14px;
}

.metrics-grid,
.dashboard-grid,
.split-grid,
.summary-grid,
.player-entry-grid,
.form-grid {
    gap: 0.55rem;
}

.chart-wrap {
    height: 220px;
}

@media (max-width: 1180px) {
    .metrics-grid,
    .summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .span-8,
    .span-4 {
        grid-column: 1 / -1;
    }

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

    .match-stat-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    .app-shell {
        grid-template-columns: 1fr;
        padding: 0.75rem;
    }

    .mobile-only {
        display: inline-flex;
    }

    .sidebar {
        position: fixed;
        z-index: 60;
        top: 0.75rem;
        left: 0.75rem;
        bottom: 0.75rem;
        width: min(88vw, 320px);
        height: auto;
        transform: translateX(calc(-100% - 1.5rem));
        transition: transform var(--ease);
    }

    body.is-sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 50;
        pointer-events: none;
        background: rgba(0, 0, 0, 0);
        transition: background var(--ease);
    }

    body.is-sidebar-open .sidebar-backdrop {
        pointer-events: auto;
        background: rgba(0, 0, 0, 0.62);
    }

    .page-header,
    .public-leaderboard-header,
    .public-player-hero {
        align-items: start;
        flex-direction: column;
    }

    .form-grid.cols-2,
    .form-grid.cols-4,
    .form-grid.cols-5,
    .compact-grid,
    .metrics-grid,
    .summary-grid {
        grid-template-columns: 1fr;
    }

    .match-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .recent-match-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .desktop-table {
        display: none;
    }

    .mobile-board {
        display: grid;
        gap: 0.75rem;
    }

    .player-row-card,
    .history-row-card,
    .ranking-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .history-screenshot {
        width: 100%;
        height: 180px;
    }

    .public-body .public-shell {
        width: 100%;
        padding: 0.75rem;
    }

    .public-leaderboard-header {
        grid-template-columns: 1fr;
        padding: 1rem;
        gap: 0.9rem;
    }

    .public-filter {
        width: 100%;
        grid-template-columns: 1fr 1fr;
        justify-content: stretch;
    }

    .public-filter.is-custom {
        width: 100%;
        grid-template-columns: 1fr 1fr;
    }

    .public-filter .field,
    .public-filter select,
    .public-filter input,
    .public-filter .soft-meta {
        width: 100%;
    }

    .range-control-main,
    .range-pill {
        grid-column: 1 / -1;
    }

    .public-filter.is-custom .range-pill {
        width: 100%;
        justify-self: stretch;
    }

    .public-filter .soft-meta {
        justify-content: center;
    }

    .public-leaderboard-panel {
        padding: 0.65rem;
    }

    .public-profile-hero {
        align-items: flex-start;
        flex-direction: column;
        padding: 1rem;
    }

    .profile-identity {
        width: 100%;
    }

    .public-profile-hero .secondary-action {
        width: 100%;
    }

    .profile-stat-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .profile-match-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .login-shell,
    .public-shell {
        padding: 0.75rem;
    }

    .topbar {
        top: 0.75rem;
        border-radius: var(--radius-lg);
    }

    .page-header h1,
    .public-leaderboard-header h1,
    .section-title-block h1,
    .centered-copy h1 {
        font-size: 2rem;
    }

    .public-body .public-shell {
        padding: 0.6rem;
        gap: 0.55rem;
    }

    .public-body .topbar {
        min-height: 48px;
        padding: 0.45rem 0.55rem;
        border-radius: 16px;
    }

    .public-body .brand-mark {
        width: 36px;
        height: 36px;
        border-radius: 12px;
    }

    .public-body .public-brand strong {
        font-size: 0.92rem;
    }

    .public-body .public-brand small {
        font-size: 0.78rem;
    }

    .public-leaderboard-header {
        border-radius: 18px;
    }

    .public-filter {
        grid-template-columns: 1fr;
        gap: 0.45rem;
    }

    .public-filter.is-custom {
        grid-template-columns: 1fr;
    }

    .range-control-main,
    .range-pill {
        grid-column: auto;
    }

    .public-leaderboard-header .overline {
        font-size: 0.62rem;
    }

    .public-leaderboard-header .public-subtitle {
        font-size: 0.92rem;
        line-height: 1.35;
    }

    .mobile-rank-main {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .mobile-damage {
        grid-column: 1 / -1;
        grid-row: 2;
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        padding-top: 0.2rem;
        text-align: left;
    }

    .mobile-rank-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.4rem;
        margin-top: 0.6rem;
    }

    .mobile-rank-stats span {
        padding: 0.48rem 0.45rem;
    }

    .mobile-rank-stats b {
        font-size: 0.88rem;
    }

    .mobile-rank-stats small {
        font-size: 0.62rem;
        letter-spacing: 0.06em;
    }

    .public-profile-hero,
    .public-profile-panel {
        padding: 0.75rem;
        border-radius: 18px;
    }

    .profile-identity {
        align-items: center;
        gap: 0.75rem;
    }

    .profile-avatar {
        width: 68px;
        height: 68px;
        border-radius: 20px;
    }

    .profile-title h1 {
        font-size: clamp(1.55rem, 8vw, 2.1rem);
        line-height: 1;
    }

    .profile-title p {
        font-size: 0.9rem;
    }

    .profile-section-title {
        margin-bottom: 0.6rem;
    }

    .profile-section-title h2 {
        font-size: 1.1rem;
    }

    .profile-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
    }

    .profile-stat {
        min-height: 72px;
        padding: 0.65rem;
        border-radius: 15px;
    }

    .profile-stat strong {
        font-size: 1.15rem;
    }

    .profile-match-card {
        padding: 0.65rem;
        border-radius: 16px;
    }

    .profile-match-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.45rem;
    }

    .profile-match-stats {
        gap: 0.4rem;
    }

    .profile-match-stats span {
        padding: 0.48rem 0.45rem;
    }

    .profile-match-stats b {
        font-size: 0.88rem;
    }

    .profile-match-stats small {
        font-size: 0.6rem;
        letter-spacing: 0.06em;
    }

    .profile-screenshot {
        border-radius: 14px;
    }

    .match-form-card,
    .recent-matches-card {
        padding: 0.65rem;
    }

    .match-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.45rem;
    }

    .match-stat-grid .field:last-child {
        grid-column: 1 / -1;
    }

    .entry-card {
        padding: 0.65rem;
    }

    .entry-head {
        align-items: center;
        flex-direction: row;
    }
}
