:root {
    --ink: #0c111b;
    --muted: #6b7486;
    --ice: #f4f7fb;
    --blue: #1f4ad5;
    --blue-dark: #132568;
    --surface: #ffffff;
    --shadow: 0 22px 40px rgba(10, 18, 32, 0.12);
    --radius: 22px;
    --accent: #f4a24a;
    --accent-dark: #c97722;
    --line: #e3e9f3;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "IBM Plex Mono", "SFMono-Regular", "Menlo", "Consolas", "Liberation Mono", "Courier New", monospace;
    color: var(--ink);
    background:
        radial-gradient(circle at 10% 0%, rgba(31, 74, 213, 0.18), transparent 42%),
        radial-gradient(circle at 80% 8%, rgba(244, 162, 74, 0.25), transparent 46%),
        linear-gradient(180deg, #f8f9fc 0%, #edf2f8 100%);
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 28px;
    background: linear-gradient(90deg, #0b3c8c 0%, #1d4ed8 45%, #c4162c 100%);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar h1 {
    margin: 0;
    font-size: clamp(22px, 3vw, 34px);
    letter-spacing: 0.5px;
}

.sub {
    margin: 4px 0 0;
    color: var(--muted);
}

.topbar .sub {
    color: rgba(255, 255, 255, 0.8);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.16);
    display: grid;
    place-items: center;
    font-weight: 800;
    letter-spacing: 0.08em;
}

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

.button {
    padding: 10px 16px;
    border-radius: 999px;
    border: none;
    background: #ffffff;
    color: #0b1a3a;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 12px 24px rgba(9, 18, 43, 0.2);
}

.button.ghost {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: none;
}

.button.danger {
    background: rgba(215, 38, 56, 0.12);
    color: #b3192a;
    border: 1px solid rgba(215, 38, 56, 0.35);
    box-shadow: none;
}

.app {
    min-height: 100vh;
}

.app-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: calc(100vh - 72px);
}

.sidebar {
    background: #ffffff;
    border-right: 1px solid var(--line);
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    box-shadow: 0 18px 35px rgba(10, 18, 32, 0.06);
}

.nav-section {
    display: grid;
    gap: 8px;
}

.nav-section + .nav-section {
    padding-top: 16px;
    border-top: 1px solid #edf1f7;
}

.nav-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--muted);
    margin: 6px 8px 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--ink);
    font-weight: 700;
    border: 1px solid transparent;
}

.nav-icon {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: #eef2ff;
    color: #20378a;
    flex: 0 0 auto;
}

.nav-icon svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.nav-link:hover {
    background: #f3f6ff;
    border-color: #dfe6f2;
}

.nav-link.active {
    background: #eef2ff;
    border-color: #cbd7ff;
}

.content-area {
    padding: 24px clamp(20px, 4vw, 40px) 60px;
    overflow-x: hidden;
}

.manage-body {
    padding: 20px clamp(20px, 4vw, 48px) 60px;
    display: grid;
    gap: 20px;
}

.manage-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.manage-filter {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.manage-card {
    background: #fff;
    border-radius: 22px;
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(219, 228, 244, 0.8);
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 10px;
}

.page-grid {
    display: grid;
    grid-template-columns: minmax(280px, 360px) 1fr;
    gap: 20px;
    align-items: start;
}

.clubs-panel {
    grid-column: 1 / -1;
}

.panel {
    background: #fff;
    border-radius: 20px;
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(219, 228, 244, 0.8);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.panel-header .title-stack {
    display: flex;
    align-items: center;
    gap: 10px;
}

.season-badge {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.panel-stack {
    display: grid;
    gap: 20px;
}

.collapsible {
    border: 1px solid #e3e9f3;
    border-radius: 16px;
    padding: 0;
    background: #fff;
}

.collapsible > summary {
    list-style: none;
    cursor: pointer;
    padding: 14px 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 16px;
    background: #f7f9ff;
}

.collapsible > summary::-webkit-details-marker {
    display: none;
}

.collapsible > summary::after {
    content: "Open";
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
}

.collapsible[open] > summary::after {
    content: "Close";
}

.collapsible-content {
    padding: 16px;
    border-top: 1px solid #e9eef7;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

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

.table-scroll .data-table {
    min-width: 900px;
}

.data-table th {
    text-align: left;
    color: #3f4a5c;
    font-weight: 800;
    padding: 8px 10px;
    border-bottom: 1px solid #e3e7f1;
    background: #f6f8fc;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.7rem;
}

.data-table td {
    padding: 10px 10px;
    border-bottom: 1px solid #edf1f7;
}

.drag-handle-cell {
    width: 28px;
    text-align: center;
    color: #9aa7bf;
    cursor: grab;
}

.drag-handle {
    display: inline-block;
    font-size: 1rem;
    letter-spacing: -2px;
    user-select: none;
}

.data-table tbody tr:nth-child(odd) {
    background: #fbfcff;
}

.data-table tbody tr:nth-child(odd) td {
    background: transparent;
}

.data-table tr:hover {
    background: #f8faff;
}

.data-table tr:hover td {
    background: transparent;
}

.data-table tbody tr.zone-child-row {
    background: #f8f9fe;
}

.data-table tbody tr.zone-child-row td {
    color: #5a657a;
    font-size: 0.86rem;
    padding-top: 7px;
    padding-bottom: 7px;
}

.zone-child-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding-left: 14px;
}

.zone-child-label-save {
    padding-left: 12px;
}

.zone-child-label-goal {
    padding-left: 30px;
}

.data-table tbody tr.zone-child-row-save td {
    border-top: 1px dashed #dde5f3;
}

.zone-kind-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 0.68rem;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.zone-kind-pill-save {
    background: #e6f7ed;
    color: #0f6d33;
}

.zone-kind-pill-goal {
    background: #ffecef;
    color: #9a1f2e;
}

.data-table tbody tr.row-clickable {
    cursor: pointer;
}

.data-table tbody tr.row-clickable td:last-child,
.data-table tbody tr.row-clickable .table-actions {
    cursor: default;
}

.table-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.scheduled-load-actions {
    flex-wrap: wrap;
}

.scheduled-load-actions form {
    margin: 0;
}

.associated-cell {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.associated-display {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    min-height: 32px;
    gap: 8px;
}

.associated-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.associated-item {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.associated-club-icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
    cursor: pointer;
}

.associated-club-text {
    cursor: pointer;
    padding-right: 16px;
}

.associated-remove-form {
    position: absolute;
    top: -6px;
    right: -6px;
}

.associated-remove-btn {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid rgba(215, 38, 56, 0.3);
    background: rgba(215, 38, 56, 0.08);
    color: #b3192a;
    font-size: 0;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    display: grid;
    place-items: center;
}

.associated-remove-btn svg {
    width: 12px;
    height: 12px;
    fill: currentColor;
}

.associated-add-btn {
    padding: 2px 8px;
    min-height: 24px;
    font-size: 0.75rem;
}

.inline-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(80px, 1fr));
    gap: 6px;
}

.color-form input[type="color"] {
    width: 44px;
    height: 36px;
    padding: 0;
    border: 1px solid #d7dde8;
    border-radius: 10px;
    background: #fff;
}

.color-form input[type="file"] {
    max-width: 200px;
}

.color-form input[type="text"] {
    min-width: 200px;
}

.color-select {
    min-width: 140px;
}

.roster-table td.name-cell {
    min-width: 220px;
    white-space: nowrap;
}

.name-link {
    color: inherit;
    text-decoration: none;
    font-weight: 600;
}

.name-link:hover {
    text-decoration: underline;
}

.color-preview {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.team-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--swatch-color, #d72638);
    margin-right: 6px;
    border: 1px solid #fff;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.15);
    vertical-align: middle;
}

.palette-preview {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.subtle {
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 6px;
}

.metric-abbr {
    text-decoration: underline dotted rgba(71, 85, 105, 0.65);
    text-underline-offset: 2px;
    cursor: help;
    border-bottom: none;
}

.metric-abbr-tooltip {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 11000;
    display: none;
    max-width: 280px;
    background: rgba(15, 23, 42, 0.96);
    color: #f8fafc;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 0.75rem;
    line-height: 1.35;
    white-space: normal;
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
    box-shadow: 0 8px 20px rgba(2, 6, 23, 0.28);
    pointer-events: none;
}

.icon-preview {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.icon-preview img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid #d7dde8;
    background: #fff;
}

.icon-preview img.hidden {
    display: none;
}

.modal-divider {
    height: 1px;
    background: #e3e9f3;
    margin: 16px 0;
}

.icon-btn {
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid #d7dde8;
    background: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.panel-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    margin-bottom: 16px;
}

.inline-form {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.inline-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.inline-label input[type="url"] {
    min-width: 260px;
}

.inline-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--muted);
}

.icon-btn.danger {
    border-color: rgba(215, 38, 56, 0.3);
    background: rgba(215, 38, 56, 0.08);
    color: #b3192a;
}

.icon-btn svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.sort-btn.active {
    border-color: #b8c9f4;
    background: #eef3ff;
    color: #1e3b94;
}

.sort-indicator {
    font-size: 0.7rem;
    color: #2a4bd7;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.filter-actions {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.filter-actions .pill {
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 1rem;
}

.pill.ghost {
    background: transparent;
    border: 1px solid #d7dde8;
    color: var(--ink);
}

.quick-toggle {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.quick-toggle button {
    border: 1px solid #d7dde8;
    background: #f8faff;
    padding: 6px 10px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
}

.quick-toggle button.active {
    background: #1f4ad5;
    color: #fff;
    border-color: #1f4ad5;
    box-shadow: 0 8px 16px rgba(31, 74, 213, 0.18);
}

.toast {
    background: #111827;
    color: #fff;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    font-weight: 700;
}

.toast-stack {
    position: fixed;
    top: 90px;
    right: 28px;
    display: grid;
    gap: 12px;
    z-index: 40;
}

.toast.success {
    background: #0f766e;
}

.toast.warning {
    background: #b45309;
}

.toast.error {
    background: #b91c1c;
}

.player-avatar {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    overflow: visible;
    background: #f1f4fb;
    display: grid;
    place-items: center;
    font-weight: 700;
    color: var(--blue-dark);
    --badge-color: #d72638;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.player-avatar-xl {
    width: 220px;
    height: 220px;
}

.player-card {
    display: grid;
    grid-template-columns: 260px 1fr;
    align-items: center;
    gap: 24px;
}

.profile-name,
.profile-position {
    display: none;
}

.player-card-info h1 {
    margin: 0;
    font-size: clamp(28px, 4vw, 40px);
    letter-spacing: 0.08em;
}

.player-card-info {
    position: relative;
    padding-right: 320px;
}

.player-card-crest {
    position: absolute;
    top: 50%;
    right: 0;
    width: 280px;
    height: 280px;
    transform: translateY(-50%);
    display: block;
}

.player-card-crest img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.player-card-info h2 {
    margin: 0 0 6px;
    font-size: clamp(18px, 3vw, 26px);
    letter-spacing: 0.2em;
    color: var(--muted);
}

.player-position {
    font-weight: 800;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin: 12px 0;
    font-size: 1.25rem;
}

.player-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.player-avatar .avatar-fallback {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #eef2fb;
}

.badge-number {
    position: absolute;
    right: -6px;
    bottom: -6px;
    background: var(--badge-color);
    color: #fff;
    font-weight: 800;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 0.75rem;
    border: 2px solid #fff;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.25);
}

.player-avatar-xl .badge-number {
    right: -10px;
    bottom: -14px;
    padding: 14px 18px;
    font-size: 1.35rem;
    border-width: 4px;
}

.upload-avatar {
    cursor: pointer;
}

.upload-avatar:hover {
    box-shadow: 0 0 0 4px rgba(31, 74, 213, 0.2);
    transform: translateY(-1px);
}

.avatar-stack {
    display: grid;
    justify-items: center;
    gap: 6px;
}

.avatar-meta {
    font-weight: 800;
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #2a2f45;
}

.avatar-edit {
    display: flex;
    justify-content: center;
}

.avatar-upload-trigger {
    border: none;
    cursor: pointer;
}

.auth-shell {
    min-height: calc(100vh - 72px);
    display: grid;
    place-items: center;
}

.auth-card {
    background: #fff;
    padding: 32px;
    border-radius: 24px;
    box-shadow: var(--shadow);
    width: min(420px, 92vw);
    border: 1px solid #e3e9f3;
}

.auth-card h2 {
    margin: 0 0 8px;
}

.auth-card form {
    margin-top: 16px;
    display: grid;
    gap: 16px;
}

.auth-local-form {
    margin-top: 14px;
    display: grid;
    gap: 12px;
}

.auth-trust-toggle {
    display: flex;
    gap: 8px;
    align-items: center;
    font-weight: 600;
    color: #334155;
}

.auth-trusted-list {
    margin-top: 10px;
    display: grid;
    gap: 8px;
}

.auth-trusted-form {
    margin: 0;
    display: flex;
    gap: 8px;
    align-items: center;
}

.auth-trusted-btn {
    width: 100%;
}

.auth-trusted-untrust-btn {
    white-space: nowrap;
    border-color: #fecaca;
    color: #b91c1c;
    background: #fff1f2;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.dashboard-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    background: linear-gradient(135deg, #ffffff 0%, #eef3ff 100%);
    border-radius: 24px;
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid #dfe6f2;
}

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

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 0.7rem;
    color: var(--muted);
    margin: 0 0 6px;
}

.dashboard-card {
    text-decoration: none;
    color: #111;
    background: linear-gradient(145deg, #ffffff 0%, #f2f6ff 100%);
    border-radius: 18px;
    padding: 18px;
    box-shadow: var(--shadow);
    border: 1px solid #e3e8f4;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 30px rgba(0, 0, 0, 0.15);
}

.dashboard-card h3 {
    margin: 0 0 8px;
}

.dashboard-card p {
    margin: 0;
    color: var(--muted);
}

.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-top: 12px;
}

.team-card {
    background: #fff;
    border-radius: 18px;
    padding: 16px;
    border: 1px solid #e3e8f4;
    box-shadow: var(--shadow);
    display: grid;
    gap: 8px;
}

.team-title {
    font-weight: 700;
}

.team-sub {
    color: var(--muted);
    font-size: 0.9rem;
}

.team-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pill {
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 999px;
    background: #f0f4ff;
    color: var(--blue-dark);
    font-weight: 600;
    font-size: 0.85rem;
}

.pill.danger {
    background: #fde7ea;
    color: #b21a2f;
}

.result-badge {
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.8rem;
    background: #eef2ff;
    color: #1d2f75;
}

.result-badge.w,
.result-badge.otw,
.result-badge.sow {
    background: #e7f6ee;
    color: #1f7e4d;
}

.result-badge.l,
.result-badge.otl,
.result-badge.sol {
    background: #fde7ea;
    color: #b21a2f;
}

.result-badge.ott,
.result-badge.sot {
    background: #fff4d8;
    color: #8a5a00;
}

.profile-hero {
    display: flex;
    gap: 20px;
    align-items: center;
}

.avatar {
    width: 92px;
    height: 92px;
    border-radius: 50%;
    overflow: hidden;
    background: #f1f4fb;
    display: grid;
    place-items: center;
    border: 3px solid #fff;
    box-shadow: var(--shadow);
}

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

.avatar-fallback {
    font-weight: 700;
    color: var(--blue-dark);
}

.stat-badges {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.badge-group {
    display: inline-flex;
}

.badge {
    background: #eef2ff;
    color: var(--blue-dark);
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.badge-action {
    margin-left: 4px;
}

.badge-icon {
    width: 20px;
    height: 20px;
    padding: 0;
    border-radius: 999px;
    border: 1px solid rgba(31, 48, 117, 0.2);
    background: transparent;
    color: var(--blue-dark);
    display: grid;
    place-items: center;
}

.badge-icon.danger {
    border-color: rgba(215, 38, 56, 0.35);
    background: rgba(215, 38, 56, 0.14);
    color: #b3192a;
}

.badge-icon svg {
    width: 12px;
    height: 12px;
}

.badge-icon-img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: contain;
}

.tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.tooltip-text {
    padding-right: 4px;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%) translateY(6px);
    background: #101a3a;
    color: #eef2ff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 10px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    box-shadow: 0 10px 24px rgba(17, 24, 39, 0.18);
    z-index: 20;
}

.tooltip::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: calc(100% + 2px);
    transform: translateX(-50%) translateY(6px);
    border-width: 6px 6px 0 6px;
    border-style: solid;
    border-color: #101a3a transparent transparent transparent;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 19;
}

.tooltip:hover::after,
.tooltip:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.player-card .stat-badges {
    margin-top: 16px;
    gap: 10px;
}

.leader-row {
    display: inline-flex;
    gap: 12px;
    align-items: center;
    text-decoration: none;
    color: inherit;
}

.leader-avatar {
    position: relative;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    flex: 0 0 44px;
    border-radius: 50%;
    overflow: hidden;
    background: #f1f4fb;
    display: grid;
    place-items: center;
    font-weight: 700;
    color: var(--blue-dark);
}

.leader-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.stat-avatar {
    position: relative;
    width: 72px;
    height: 72px;
    min-width: 72px;
    min-height: 72px;
    flex: 0 0 72px;
    overflow: visible;
}

.stat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.stat-avatar-number {
    right: -5px;
    bottom: -5px;
    font-size: 0.62rem;
    padding: 2px 6px;
    line-height: 1;
    z-index: 2;
}

.stat-avatar .avatar-fallback {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #eef2fb;
}

.leader-name {
    font-weight: 700;
}

.leader-team {
    color: var(--muted);
}

.leader-stat {
    font-weight: 600;
    text-align: right;
}

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.tab {
    border: 1px solid #dfe6f2;
    background: #fff;
    padding: 8px 14px;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
}

.tab.active {
    background: var(--blue);
    color: #fff;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.stat-card {
    background: #f7f9ff;
    border-radius: 14px;
    padding: 12px;
    border: 1px solid #e3e8f4;
}

.stat-card h4 {
    margin: 0 0 6px;
    color: var(--muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.stat-card p {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
}

.trend-line {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    height: 140px;
    padding: 12px;
    border-radius: 16px;
    background: #f7f9ff;
    border: 1px solid #e3e8f4;
}

.trend-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.trend-header h3 {
    margin: 0;
}

.trend-summary {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.trend-summary-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    border: 1px solid #d7dde8;
    background: #f7f9ff;
    color: #334155;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    padding: 4px 10px;
}

.trend-summary-pill-above {
    background: #e6f7ed;
    border-color: #99d6ad;
    color: #0f6d33;
}

.trend-summary-pill-average {
    background: #fff9e6;
    border-color: #e9d18c;
    color: #7a661a;
}

.trend-summary-pill-below {
    background: #ffecef;
    border-color: #efb4be;
    color: #9a1f2e;
}

.trend-summary-pill-neutral {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #64748b;
}

.trend-chart-wrap {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 10px;
    align-items: stretch;
}

.trend-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-end;
    color: #64748b;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    padding: 6px 0;
}

.trend-plot {
    position: relative;
    aspect-ratio: 2 / 1;
    height: auto;
    min-height: 300px;
    max-height: 500px;
    padding: 12px;
    border-radius: 16px;
    background: #f7f9ff;
    border: 1px solid #e3e8f4;
    overflow: hidden;
}

.trend-plot-line {
    padding: 12px;
    width: min(100%, 1080px);
    justify-self: center;
}

.trend-plot-sv {
    background: linear-gradient(180deg, #fffaf0 0%, #ffffff 100%);
}

.trend-plot-gaa {
    background: linear-gradient(180deg, #f4f8ff 0%, #ffffff 100%);
}

.trend-plot-gqa {
    background: linear-gradient(180deg, #f2fff8 0%, #ffffff 100%);
}

.trend-line-svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

.trend-gridline-svg {
    stroke: #dbe4f4;
    stroke-width: 0.5;
}

.trend-peer-baseline-svg {
    stroke: #6d5ce8;
    stroke-width: 0.8;
    stroke-dasharray: 2.8 2.0;
}

.trend-series {
    fill: none;
    stroke-width: 0.95;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.trend-area {
    stroke: none;
    opacity: 0.16;
}

.trend-dot {
    stroke-width: 0.5;
    vector-effect: non-scaling-stroke;
}

.trend-dot-latest {
    stroke-width: 0.8;
}

.trend-plot-sv .trend-series {
    stroke: #d08a34;
}

.trend-plot-sv .trend-area {
    fill: #f4c184;
}

.trend-plot-sv .trend-dot {
    fill: #fff6e7;
    stroke: #d08a34;
}

.trend-plot-sv .trend-dot-latest {
    fill: #b87422;
    stroke: #ffffff;
}

.trend-plot-gaa .trend-series {
    stroke: #2b54d6;
}

.trend-plot-gaa .trend-area {
    fill: #a6bfff;
}

.trend-plot-gaa .trend-dot {
    fill: #eef3ff;
    stroke: #2b54d6;
}

.trend-plot-gaa .trend-dot-latest {
    fill: #2447b2;
    stroke: #ffffff;
}

.trend-plot-gqa .trend-series {
    stroke: #1e9d65;
}

.trend-plot-gqa .trend-area {
    fill: #9be4c1;
}

.trend-plot-gqa .trend-dot {
    fill: #ebfbf3;
    stroke: #1e9d65;
}

.trend-plot-gqa .trend-dot-latest {
    fill: #177a4f;
    stroke: #ffffff;
}

.trend-footnote {
    margin-top: 8px;
}

@media (max-width: 780px) {
    .trend-chart-wrap {
        grid-template-columns: 44px minmax(0, 1fr);
    }

    .trend-plot {
        aspect-ratio: 1.7 / 1;
        min-height: 220px;
        max-height: 340px;
    }

    .trend-plot-line {
        width: 100%;
    }
}

.trend-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.trend-icon {
    line-height: 1;
    font-weight: 800;
}

.trend-chip-up {
    color: #0f6d33;
    background: #e6f7ed;
    border-color: #99d6ad;
}

.trend-chip-up .trend-icon {
    color: #b42318;
}

.trend-chip-flat {
    color: #7a661a;
    background: #fff9e6;
    border-color: #e9d18c;
}

.trend-chip-down {
    color: #9a1f2e;
    background: #ffecef;
    border-color: #efb4be;
}

.trend-chip-down .trend-icon {
    color: #b42318;
}

.peers-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.peers-chip-above {
    color: #0f6d33;
    background: #e6f7ed;
    border-color: #99d6ad;
}

.peers-chip-average {
    color: #7a661a;
    background: #fff9e6;
    border-color: #e9d18c;
}

.peers-chip-below {
    color: #9a1f2e;
    background: #ffecef;
    border-color: #efb4be;
}

.peers-chip-neutral {
    color: #64748b;
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.compare-card {
    margin-top: 12px;
    padding: 12px;
    border-radius: 14px;
    background: #fff8e6;
    border: 1px solid #f2d7a6;
    color: #5a3b00;
}
.manage-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 10px;
}

.manage-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: #f8f9fc;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #e3e7f1;
}
.game-card {
    margin: 0;
    padding: 20px 24px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(219, 228, 244, 0.8);
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: stretch;
}

.game-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 16px;
    flex: 1 1 100%;
}

.goalie-mode-fields {
    display: grid;
    gap: 8px;
}

.two-goalie-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 12px;
    grid-column: 1 / -1;
}

label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 600;
}

input, select, textarea {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #d6deea;
    font-size: 0.95rem;
    background: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

select[multiple] {
    min-height: 140px;
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid rgba(31, 74, 213, 0.2);
    border-color: rgba(31, 74, 213, 0.5);
}

.game-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.game-actions button {
    border-radius: 10px;
    padding: 10px 16px;
    border: none;
    background: #111;
    color: #fff;
    cursor: pointer;
}

.game-actions .status {
    flex: 1 1 100%;
    order: -1;
}

.game-actions .ghost {
    background: #eef2ff;
    color: #1c2b6e;
    border: 1px solid #c9d6f8;
}

#startGameBtn {
    background: #1f4ad5;
    color: #fff;
}

#startGameBtn:disabled {
    background: #9fb3ef;
    color: #f4f7ff;
    cursor: not-allowed;
}

.game-badge {
    background: #0f766e;
    color: #fff;
    border-radius: 999px;
    padding: 6px 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.7rem;
}

.game-badge.is-actionable {
    cursor: pointer;
    box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.15);
}

.game-badge.is-actionable:focus {
    outline: 2px solid rgba(255, 255, 255, 0.9);
    outline-offset: 2px;
}

.hidden {
    display: none !important;
}

.game-complete {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    width: 100%;
}

.status {
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.4;
}

.toolbar {
    margin: 24px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.goalie-control {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #fff;
    border-radius: 999px;
    box-shadow: var(--shadow);
    border: 1px solid #e3e8f4;
}

#twoGoalieToolbar {
    align-items: flex-start;
    flex-direction: column;
    border-radius: 20px;
}

.rink-flip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #fff;
    border-radius: 999px;
    box-shadow: var(--shadow);
    border: 1px solid #e3e8f4;
}

.rink-flip .label {
    font-weight: 600;
    color: var(--muted);
}

.goalie-control .label {
    font-weight: 600;
    color: var(--muted);
}

.goalie-control .inline-form {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.goalie-badge-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 6px 8px;
    width: 100%;
}

.goalie-control .button.ghost,
.rink-flip .button.ghost {
    background: #eef2ff;
    color: #1c2b6e;
    border: 1px solid #c9d6f8;
    box-shadow: none;
}

.period-controls button {
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid #c7d6ff;
    background: #fff;
    cursor: pointer;
}

.legend {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-size: 0.9rem;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    display: inline-block;
}

.dot.rink { background: #ff7d00; }
.dot.net { background: #2c6bed; }
.dot.miss { background: #d72638; }
.dot.trap { background: #2e7d32; }
.dot.control { background: #7bc96f; }
.dot.lost { background: #f6c343; }
.dot.goal { background: #d72638; }

#periods {
    display: grid;
    gap: 24px;
    padding: 24px 0 60px;
}

.period-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 24px;
}

.sync-card {
    margin: 16px 0 0;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 20px;
    display: grid;
    gap: 10px;
}

.sync-meta {
    font-weight: 600;
}

.sync-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.sync-actions .button.ghost {
    background: #eef2ff;
    color: #1f4ad5;
    border: 1px solid rgba(31, 74, 213, 0.16);
}

.scoring-debug-panel {
    gap: 16px;
}

.scoring-debug-output {
    margin: 0;
    padding: 16px 18px;
    border-radius: 16px;
    border: 1px solid rgba(31, 74, 213, 0.18);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(244, 247, 251, 0.94) 100%);
    color: #102244;
    font-size: 0.84rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.period-card header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.period-header-main {
    display: grid;
    gap: 6px;
}

.period-card h2 {
    margin: 0;
}

.period-meta-row {
    display: flex;
    align-items: baseline;
    gap: 14px;
    flex-wrap: wrap;
}

.period-meta {
    margin: 0;
    color: var(--muted);
}

.period-summary {
    display: flex;
    gap: 12px;
    font-weight: 600;
    align-items: center;
    flex-wrap: wrap;
}

.period-penalty-btn {
    padding: 8px 13px;
    font-size: 0.82rem;
    background: var(--blue);
    color: #fff;
    border: 1px solid var(--blue);
    box-shadow: none;
    margin-left: 18px;
    transform: translateY(-4px);
}

.period-body {
    display: grid;
    grid-template-columns: minmax(320px, 1.2fr) minmax(260px, 1fr);
    grid-auto-rows: auto;
    gap: 20px;
    align-items: start;
}

.surface {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.period-body .surface:nth-of-type(1) {
    grid-column: 1;
}

.period-body .surface:nth-of-type(2) {
    grid-column: 2;
}

.period-body .shot-list {
    grid-column: 1 / -1;
    grid-row: 2;
    align-self: stretch;
}

.surface-title {
    font-weight: 600;
}

.dual-net-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.dual-rink-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.period-card.two-goalie-mode .dual-net-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
}

.period-card.two-goalie-mode .dual-rink-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
}

.period-card:not(.two-goalie-mode) .period-body {
    grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr);
    gap: 12px;
}

.period-card:not(.two-goalie-mode) .period-body .surface:nth-of-type(1),
.period-card:not(.two-goalie-mode) .period-body .surface:nth-of-type(2) {
    grid-row: 1;
}

.period-card:not(.two-goalie-mode) .period-body .surface:nth-of-type(1) {
    grid-column: 1;
}

.period-card:not(.two-goalie-mode) .period-body .surface:nth-of-type(2) {
    grid-column: 2;
}

.period-card:not(.two-goalie-mode) .period-body .shot-list {
    grid-column: 1 / -1;
    grid-row: 2;
}

.period-card:not(.two-goalie-mode) .period-body .surface {
    align-items: stretch;
}

.period-card:not(.two-goalie-mode) .dual-net-grid {
    width: 100%;
    max-width: none;
    margin-inline: 0;
}

.period-card:not(.two-goalie-mode) .dual-rink-grid {
    width: 100%;
    max-width: none;
    margin-inline: 0;
}

.net-lane {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rink-lane {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.net-panel-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rink-panel-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.net-panel {
    border: 1px solid #dce5ff;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
}

.net-panel > summary {
    list-style: none;
    cursor: pointer;
    padding: 9px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: #eef3ff;
    border-bottom: 1px solid #dce5ff;
}

.net-panel > summary::-webkit-details-marker {
    display: none;
}

.net-panel-title {
    font-size: 0.78rem;
    font-weight: 800;
    color: #1f2f57;
}

.net-panel-status {
    font-size: 0.67rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 700;
}

.net-panel-status.active {
    color: #0f766e;
}

.net-panel-status.inactive {
    color: var(--muted);
}

.net-panel.inactive > summary {
    background: #f7f9ff;
}

.net-panel .surface-frame.net-frame {
    border: 0;
    border-top: 1px solid #dce5ff;
    border-radius: 0;
    min-height: 190px;
    height: 190px;
    margin: 0;
}

.net-panel.inactive .surface-frame.net-frame {
    pointer-events: none;
    opacity: 0.66;
    filter: saturate(0.9);
}

.net-lane-label {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--muted);
}

.rink-lane-label {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--muted);
}

.surface-frame {
    background: var(--ice);
    border-radius: 16px;
    border: 1px solid #dce5ff;
    min-height: 380px;
    height: 380px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    --surface-scale: 1;
    --surface-shift-x: 0%;
    --surface-shift-y: 0%;
}

.surface-frame .surface-svg {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.surface-frame svg {
    width: 100%;
    height: 100%;
    display: block;
    transform: translate(var(--surface-shift-x), var(--surface-shift-y)) scale(var(--surface-scale));
    transform-origin: center;
}

.surface-frame svg text,
.surface-frame svg tspan {
    pointer-events: none;
    user-select: none;
}

.surface-frame.is-flipped svg {
    transform: translate(var(--surface-shift-x), var(--surface-shift-y)) scale(var(--surface-scale)) scaleY(-1);
}

.surface-frame.is-flipped svg text {
    transform-box: fill-box;
    transform-origin: center;
    transform: scaleY(-1);
}

.surface-frame[data-surface="rink"],
.surface-frame[data-surface="rink-away"] {
    --surface-scale: 1.12;
}

.surface-frame.single-half-scoring {
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: 300px;
    aspect-ratio: 170 / 176.45;
    margin-inline: 0;
    --surface-scale: 1.01;
}

.surface-frame.single-half-scoring svg {
    transform: translate(var(--surface-shift-x), var(--surface-shift-y)) scale(var(--surface-scale)) rotate(-90deg);
}

.surface-frame.single-half-scoring.is-flipped svg {
    transform: translate(var(--surface-shift-x), var(--surface-shift-y)) scale(var(--surface-scale)) scaleX(-1) rotate(-90deg);
}

.surface-frame.single-half-scoring.is-flipped svg text {
    transform-box: fill-box;
    transform-origin: center;
    transform: scaleX(-1);
}

.surface-frame[data-surface="net"] {
    --surface-scale: 1.2;
    --surface-shift-y: 4%;
}

.surface-frame.net-frame {
    min-height: 260px;
    height: 260px;
    --surface-scale: 1.2;
    --surface-shift-y: 4%;
}

.period-card:not(.two-goalie-mode) .net-lane-label {
    display: none;
}

.period-card:not(.two-goalie-mode) .rink-lane-label {
    display: none;
}

.period-card:not(.two-goalie-mode) .surface-frame.net-frame {
    width: 100%;
    max-width: 100%;
    min-height: 300px;
    height: auto;
    aspect-ratio: 11 / 9;
    background: var(--ice);
    border-color: #dce5ff;
    --surface-scale: 1.3;
    --surface-shift-y: 1%;
    margin-inline: 0;
}

.period-card:not(.two-goalie-mode) .net-panel .surface-frame.net-frame,
.period-card:not(.two-goalie-mode) .rink-panel .surface-frame {
    width: 100%;
    max-width: 100%;
    min-height: 320px;
    height: auto;
    aspect-ratio: 11 / 9;
    margin-inline: 0;
}

.period-card:not(.two-goalie-mode) .net-panel .surface-frame.net-frame {
    --surface-scale: 1.3;
    --surface-shift-y: 1%;
}

.period-card:not(.two-goalie-mode) .rink-panel .surface-frame {
    --surface-scale: 0.92;
    --surface-shift-y: 0%;
    --surface-shift-x: 0%;
}

.profile-heatmap-grid {
    grid-template-columns: minmax(340px, 1fr) minmax(340px, 1fr);
    gap: 14px;
}

.profile-heatmap-grid .surface {
    min-width: 0;
}

.profile-heatmap-frame {
    width: 100%;
    min-height: 500px;
    height: 500px;
    max-height: 500px;
    margin-inline: 0;
}

.profile-heatmap-frame.profile-heatmap-rink.single-half-scoring {
    min-height: 500px;
    height: 500px;
    max-height: 500px;
    aspect-ratio: auto;
    --surface-scale: 1.02;
    --surface-shift-x: 0%;
    --surface-shift-y: 4.2%;
}

.profile-heatmap-frame.profile-heatmap-net {
    --surface-scale: 1.46;
    --surface-shift-y: 3.4%;
}

.period-card.two-goalie-mode .surface-frame.net-frame {
    min-height: 205px;
    height: 205px;
}

.period-card.two-goalie-mode .rink-panel .surface-frame {
    min-height: 205px;
    height: 205px;
    --surface-scale: 0.96;
    --surface-shift-x: 0%;
    --surface-shift-y: 0%;
}

.period-card.two-goalie-mode [data-surface="net-home"],
.period-card.two-goalie-mode [data-surface="net-away"] {
    display: none;
}

.goalie-net-label {
    position: absolute;
    background: rgba(31, 74, 213, 0.92);
    color: #fff;
    border-radius: 999px;
    padding: 4px 9px;
    font-weight: 800;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 6px 14px rgba(9, 18, 43, 0.18);
    pointer-events: none;
    z-index: 8;
}

.goalie-net-label.left {
    left: 14px;
    top: 50%;
    transform: translate(-50%, -50%);
}

.goalie-net-label.right {
    right: 14px;
    top: 50%;
    transform: translate(50%, -50%);
}

.goalie-net-label.single-half {
    left: 50%;
    top: 5.5%;
    transform: translate(-50%, -50%);
}

.surface-frame.single-half-scoring.is-flipped .goalie-net-label.single-half {
    top: auto;
    bottom: 5.5%;
    transform: translate(-50%, 50%);
}

.marker {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 999px;
    transform: translate(-50%, -50%);
    border: 2px solid #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.marker.rink { background: #ff7d00; }
.marker.net { background: #2c6bed; }
.marker.miss { border-color: #d72638; }
.marker.outcome-TRAP { background: #2e7d32; }
.marker.outcome-CONTROL { background: #7bc96f; }
.marker.outcome-LOST { background: #f6c343; }
.marker.outcome-GOAL { background: #d72638; }

.shot-list {
    background: var(--ice);
    border-radius: 16px;
    padding: 12px;
    border: 1px solid #dce5ff;
    min-height: 380px;
    margin-top: 0;
}

.shot-list h3 {
    margin: 0 0 8px;
}

.shots {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 6px;
    max-height: 320px;
    overflow: auto;
}

.pending-shots {
    max-height: 220px;
    margin-top: 8px;
}

.sync-card .pending-shots li {
    border: 1px solid #e3e9f3;
}

.shots li {
    background: #fff;
    border-radius: 10px;
    padding: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.penalties {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 6px;
    max-height: 220px;
    overflow: auto;
}

.penalties li {
    background: #fff;
    border-radius: 10px;
    padding: 8px;
    border: 1px solid #e3e9f3;
    cursor: pointer;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 10, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-card {
    background: #fff;
    border-radius: 20px;
    padding: 20px;
    width: min(680px, 90vw);
    box-shadow: var(--shadow);
}

.manage-users-filter-form {
    margin: 10px 0 18px;
}

.manage-users-filter-form .filter-actions .primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.manage-users-clear-btn {
    background: #fff;
    color: var(--ink);
    border: 1px solid #d7dde8;
    box-shadow: none;
}

.manage-users-revoke-btn {
    background: #fff;
    color: var(--ink);
    border: 1px solid #d7dde8;
    box-shadow: none;
    padding: 8px 12px;
    border-radius: 10px;
}

.manage-users-panel .table-actions {
    white-space: nowrap;
}

.manage-users-panel .table-actions form {
    display: inline-flex;
}

.manage-users-panel .table-actions .icon-btn {
    text-decoration: none;
    color: inherit;
}

.manage-users-panel .data-table td {
    vertical-align: middle;
}

.manage-users-panel .data-table td[title] {
    max-width: 260px;
    overflow-wrap: anywhere;
}

.manage-users-modal-card {
    width: min(1400px, 96vw);
    max-height: 92vh;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.manage-users-modal-header {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fff;
    border-bottom: 1px solid #e6e9f2;
    padding: 18px 24px;
}

.manage-users-modal-body {
    overflow: auto;
    padding: 18px 24px 20px;
    display: grid;
    gap: 16px;
}

.manage-users-section {
    border: 1px solid #e6e9f2;
    border-radius: 12px;
    padding: 14px;
    background: #fbfcff;
}

.manage-users-section h4 {
    margin: 0 0 10px;
}

.manage-users-edit-form {
    display: grid;
    gap: 14px;
}

.manage-users-team-filters {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
    padding: 8px 10px;
    background: #f3f5fb;
    border-radius: 8px;
    border: 1px solid #e0e4f0;
}

.manage-users-team-filters label {
    font-size: 0.82rem;
    gap: 4px;
}

.manage-users-team-filters select {
    font-size: 0.82rem;
    padding: 5px 8px;
}

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

.manage-users-modal-actions {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding: 12px 0 2px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    border-top: 1px solid #e6e9f2;
}

.manage-users-inline-form {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    align-items: end;
}

.manage-users-inline-actions {
    display: flex;
    justify-content: flex-end;
}

.manage-users-invite-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
    align-items: center;
}

.manage-users-invite-actions .primary {
    width: auto;
    min-width: 168px;
}

.manage-users-parent-picker {
    grid-column: 1 / -1;
    display: grid;
    gap: 8px;
    border: 1px solid #e6e9f2;
    border-radius: 12px;
    padding: 12px;
    background: #ffffff;
}

.manage-users-parent-picker h4 {
    margin: 0;
}

.manage-users-parent-search-row {
    display: flex;
    gap: 8px;
}

.manage-users-parent-results {
    display: grid;
    gap: 6px;
    max-height: 220px;
    overflow: auto;
    padding: 8px;
    border: 1px solid #d7dde8;
    border-radius: 10px;
    background: #f9fbff;
}

.manage-users-parent-result {
    width: 100%;
    text-align: left;
    border: 1px solid #d7dde8;
    border-radius: 8px;
    padding: 8px 10px;
    background: #fff;
    cursor: pointer;
}

.manage-users-parent-result.create {
    border-style: dashed;
    color: #1e3b94;
}

.manage-users-parent-selected {
    display: grid;
    gap: 6px;
}

.manage-users-parent-chip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    border: 1px solid #d7dde8;
    border-radius: 10px;
    padding: 8px 10px;
    background: #fff;
}

.manage-users-parent-chip .icon-btn {
    margin-left: auto;
}

#penaltyShotModal .penalty-shot-modal-card {
    width: min(980px, 94vw);
}

#reboundCaptureModal .rebound-capture-modal-card {
    width: min(980px, 94vw);
}

.penalty-shot-surfaces {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 10px;
}

.rebound-capture-surfaces {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 10px;
}

.penalty-shot-rink-frame {
    min-height: 320px;
    height: 320px;
    --surface-scale: 1.12;
}

.penalty-shot-rink-frame.single-half-scoring {
    height: auto;
    min-height: 320px;
}

.penalty-shot-net-frame {
    min-height: 320px;
    height: 320px;
    --surface-scale: 1.2;
    --surface-shift-y: 4%;
}

.rebound-capture-rink-frame {
    min-height: 320px;
    height: 320px;
    --surface-scale: 1.12;
}

.rebound-capture-rink-frame.single-half-scoring {
    height: auto;
    min-height: 320px;
}

.rebound-capture-net-frame {
    min-height: 320px;
    height: 320px;
    --surface-scale: 1.2;
    --surface-shift-y: 4%;
}

.rebound-capture-marker {
    z-index: 4;
}

.rebound-capture-marker.reference {
    background: rgba(31, 74, 167, 0.28);
    border-color: #1f4aa7;
    width: 16px;
    height: 16px;
}

.shots li.rebound-shot-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.shots li.rebound-shot-row.rebound-depth-1,
.shots li.rebound-shot-row.rebound-depth-2,
.shots li.rebound-shot-row.rebound-depth-3,
.shots li.rebound-shot-row.rebound-depth-4 {
    padding-left: 12px;
}

.shots .rebound-shot-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid #d4def6;
    background: #eef4ff;
    color: #1f4aa7;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.shots .rebound-shot-text {
    flex: 1;
    min-width: 0;
}

.shots li.rebound-parent-lock {
    opacity: 0.9;
}

.shots li.rebound-chain-root .rebound-shot-text::after {
    content: " (chain root)";
    color: var(--muted);
    font-size: 0.8em;
}

.modal-card header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-card header button {
    border: none;
    background: transparent;
    font-weight: 600;
    cursor: pointer;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 12px;
}

.form-section-heading {
    grid-column: 1 / -1;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 10px 0 2px;
}

.form-grid label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-weight: 600;
}

.form-grid .checkbox-row {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.form-grid .checkbox-row input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.form-grid .situation-fieldset {
    border: 0;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.form-grid .situation-fieldset legend {
    width: 100%;
    font-weight: 800;
    padding: 0;
    margin-bottom: 2px;
}

.form-grid .situation-option {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid #d7dde8;
    background: #ffffff;
    font-weight: 700;
    font-family: "IBM Plex Mono", "Menlo", "Consolas", monospace;
    font-size: 13px;
    cursor: pointer;
    transition: border-color 120ms ease, background-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
    box-shadow: 0 10px 24px rgba(10, 18, 32, 0.06);
}

.form-grid .situation-option input[type="radio"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
}

.form-grid .situation-option span {
    position: relative;
    z-index: 1;
}

.form-grid .situation-option:has(input[type="radio"]:checked) {
    border-color: #2f5bdf;
    background: #eef2ff;
    color: #2f5bdf;
}

.form-grid .situation-option:has(input[type="radio"]:focus-visible) {
    outline: 2px solid rgba(47, 91, 223, 0.28);
    outline-offset: 2px;
}

.form-grid .situation-option.is-disabled {
    opacity: 0.55;
}

.form-grid input,
.form-grid select {
    width: 100%;
}

.clock-adjust-row {
    display: flex;
    gap: 8px;
}

.clock-adjust-btn,
.clock-quick-btn {
    border: 1px solid #d7dde8;
    border-radius: 999px;
    background: #fff;
    color: #1f2937;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 6px 12px;
    cursor: pointer;
}

.clock-adjust-btn:hover,
.clock-quick-btn:hover {
    border-color: #2f5bdf;
    color: #2f5bdf;
}

.clock-quick-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hidden-opponent-select {
    display: none;
}

.time-spinner-wrap {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid #d6deea;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.time-spinner-select {
    flex: 1;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    padding: 12px 8px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.time-spinner-select:focus {
    outline: none;
    background: rgba(31, 74, 213, 0.05);
}

.time-spinner-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.time-spinner-sep {
    font-size: 1.2rem;
    font-weight: 800;
    color: #1f2937;
    padding: 0 2px;
    pointer-events: none;
    user-select: none;
}

.form-grid .time-spinner-wrap {
    width: 100%;
}

#loadScheduledModal .load-scheduled-modal-card {
    width: min(840px, 92vw);
}

#scheduleGameModal .modal-card {
    width: min(980px, 94vw);
}

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

#scheduleGameModal .form-grid .modal-actions,
#scheduleGameModal .form-grid .form-section-heading,
#scheduleGameModal .form-grid .schedule-full-width {
    grid-column: 1 / -1;
}

#loadScheduledModal .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    column-gap: 18px;
}

#loadScheduledModal .load-scheduled-game-field {
    grid-column: 1;
}

#loadScheduledModal .load-scheduled-team-field {
    grid-column: 2;
}

#loadScheduledModal .load-scheduled-game-field select,
#loadScheduledModal .load-scheduled-team-field select {
    min-width: 0;
    width: 100%;
}

#loadScheduledModal .load-scheduled-team-field .sub {
    margin-top: 6px;
    min-height: 2.6em;
    line-height: 1.2;
}

#loadScheduledModal #scheduledGameMeta {
    font-size: 0.98rem;
}

@media (max-width: 880px) {
    .player-card-info {
        padding-right: 0;
    }

    .player-card-crest {
        position: static;
        margin: 0 0 8px auto;
        width: 150px;
        height: 150px;
        transform: none;
    }

    #loadScheduledModal .form-grid {
        grid-template-columns: 1fr;
    }

    #loadScheduledModal .load-scheduled-game-field,
    #loadScheduledModal .load-scheduled-team-field {
        grid-column: 1;
    }

    .penalty-shot-surfaces {
        grid-template-columns: 1fr;
    }

    .penalty-shot-rink-frame,
    .penalty-shot-net-frame {
        min-height: 260px;
        height: 260px;
    }

    .manage-users-form-grid {
        grid-template-columns: 1fr;
    }

    .manage-users-inline-form {
        grid-template-columns: 1fr;
    }

    .manage-users-modal-actions {
        flex-direction: column;
    }
}

.color-input-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
}

.color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid #d7dde8;
    background: var(--swatch-color, transparent);
    padding: 0;
    cursor: pointer;
}

.color-swatch.is-empty {
    background: transparent;
}

.native-color-picker {
    display: none;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 16px;
}

.primary {
    display: inline-block;
    background: var(--blue);
    color: #fff;
    text-decoration: none;
    border: none;
    padding: 12px 18px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    box-shadow: 0 14px 28px rgba(31, 74, 213, 0.2);
}

.auth-google-btn {
    margin-top: 12px;
}

.danger {
    background: #d72638;
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
}

.secondary {
    background: #ffffff;
    color: var(--blue-dark);
    border: 1px solid #d7dde8;
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
}

.stacked-form {
    display: grid;
    gap: 18px;
}

.form-section {
    padding: 16px;
    border-radius: 16px;
    background: #f9fbff;
    border: 1px solid #e2e8f4;
}

.form-section h3 {
    margin: 0 0 8px;
    font-size: 1rem;
}

.stacked-form p {
    margin: 0 0 12px;
}

.stacked-form p label {
    font-weight: 600;
}

.form-actions {
    display: flex;
    justify-content: flex-start;
}

.manage-list li {
    background: #f8f9fc;
    border: 1px solid #e3e7f1;
}

@media (max-width: 980px) {
    .period-body {
        grid-template-columns: 1fr;
    }

    .period-body .surface:nth-of-type(1) {
        grid-column: 1;
    }

    .period-body .surface:nth-of-type(2) {
        grid-column: 1;
    }

    .period-body .shot-list {
        grid-column: 1;
        grid-row: auto;
    }

    .profile-heatmap-frame,
    .profile-heatmap-frame.profile-heatmap-rink.single-half-scoring {
        min-height: 380px;
        height: 380px;
        max-height: 380px;
    }

    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: sticky;
        top: 72px;
        z-index: 10;
        border-right: none;
        border-bottom: 1px solid var(--line);
        flex-direction: row;
        overflow-x: auto;
    }

    .nav-section {
        grid-auto-flow: column;
        grid-auto-columns: max-content;
        gap: 10px;
    }

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