/* Consistent header spacing for all page-title headers */
.header-title-text {
    margin-left: 12px;
}
/* User page header username spacing */
.user-header-name {
    margin-left: 12px;
}
/* =====================
   Reset & Base
   ===================== */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 16px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: #222;
    background-color: #f0f2f5;
}

body.modal-open {
    overflow: hidden;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

a {
    color: #0066cc;
}

.page-title {
    display: flex;
    align-items: center;
}
.page-title-main {
    display: flex;
    align-items: center;
    gap: 12px;
}
.page-title .brand-text {
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #1a1a2e;
    margin-right: 6px;
}
.page-title .brand-accent {
    color: #0066cc;
}
.page-title-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    flex: 0 0 auto;
}
a:hover {
    text-decoration: none;
}

/* =====================
   Site Footer
   ===================== */
.site-footer {
    margin-top: 48px;
    padding: 20px 20px 28px;
    border-top: 1px solid #e8eaf0;
    text-align: center;
}
.site-footer-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    max-width: 700px;
    margin: 0 auto 6px;
}
.site-footer-inner > div {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: nowrap;
}
.site-footer .brand-text {
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: -0.02em;
    color: #1a1a2e;
    text-decoration: none;
}
.site-footer .brand-accent {
    color: #0066cc;
}
.site-footer-copy {
    color: #aaa;
    font-size: 0.8rem;
    margin: 0;
}
.footer-logout {
    font-size: 0.73rem;
    color: #666;
    white-space: nowrap;
}

/* =====================
   Share page
   ===================== */
.share-qr-block {
    margin-top: 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px;
    background: #f7f9fc;
    border: 1px solid #dde;
    border-radius: 10px;
}

.share-qr-image {
    display: block;
    border-radius: 6px;
}

.share-qr-url {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0;
    letter-spacing: 0.01em;
}

/* =====================
   Share CTA banner (compare pages)
   ===================== */
.share-cta-banner {
    max-width: 700px;
    margin: 28px auto 0;
    padding: 14px 20px;
    background: #eef4fb;
    border: 1px solid #c0d8f0;
    border-radius: 8px;
    text-align: center;
    font-size: 0.95rem;
    color: #1a3a5c;
}

.share-cta-banner p {
    margin: 0;
}

.share-cta-banner a {
    font-weight: 600;
}

/* =====================
   Typography
   ===================== */
h1 {
    font-size: 1.4rem;
    margin: 0 0 6px 0;
    color: #1a1a2e;
}

h2 {
    font-size: 1.15rem;
    margin: 24px 0 10px 0;
    color: #1a1a2e;
    border-bottom: 2px solid #dde;
    padding-bottom: 5px;
}

h3 {
    font-size: 1.05rem;
    margin: 16px 0 8px 0;
}

h4 {
    font-size: 1rem;
    margin: 12px 0 6px 0;
}

/* =====================
   Collapsible sections
   ===================== */
details {
    margin: 14px 0;
}

details > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 44px;
    padding: 11px 14px;
    border: 1px solid #ccd3e0;
    border-radius: 8px;
    background: #f8faff;
    color: #1a1a2e;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    list-style-position: inside;
}

details > summary::after {
    content: '+';
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1;
    color: #1a1a2e;
    margin-left: 12px;
}

details[open] > summary::after {
    content: '-';
}

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

details > summary::marker {
    content: '';
}

details > summary:focus {
    outline: 2px solid #0066cc;
    outline-offset: 1px;
}

details > summary:hover {
    background: #f0f5ff;
}

details[open] > summary {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

details[open] > *:not(summary) {
    background: transparent;
    padding: 8px 0 0 0;
}

.summary-link-button {
    appearance: none;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    min-height: 44px;
    padding: 11px 14px;
    margin: 14px 0;
    border: 1px solid #ccd3e0;
    border-radius: 8px;
    background: #f8faff;
    color: #1a1a2e;
    font: inherit;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    gap: 10px;
}

.summary-link-button:hover {
    background: #f0f5ff;
    text-decoration: none;
}

.summary-link-button:focus {
    outline: 2px solid #0066cc;
    outline-offset: 1px;
}

.summary-link-button-warning {
    border-color: #d64045;
    background: #fff1f2;
    color: #7f1d1d;
}

.summary-link-button-warning:hover {
    background: #ffe4e6;
}

.summary-link-button-primary {
    border-color: #0052a3;
    background: #0066cc;
    color: #fff;
}

.summary-link-button-primary:hover {
    background: #0052a3;
}

.summary-link-button[disabled],
.summary-link-button[aria-disabled="true"] {
    cursor: default;
    pointer-events: none;
}

.summary-link-button-primary[disabled],
.summary-link-button-primary[aria-disabled="true"] {
    background: #0066cc;
}

.summary-link-button-warning[disabled],
.summary-link-button-warning[aria-disabled="true"] {
    background: #fff1f2;
}

.app-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 23, 42, 0.48);
}

.app-modal[hidden] {
    display: none;
}

.app-modal-shell {
    width: min(100%, 460px);
    max-height: calc(100vh - 32px);
    overflow: auto;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.22);
    padding: 18px 18px 20px;
}

.app-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.app-modal-title {
    margin: 0;
    padding: 0;
    border-bottom: 0;
}

.app-modal-description {
    margin: 0 0 16px;
    font-size: 0.9rem;
    color: #4a5a6b;
}

.app-modal-close {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid #bdc7d2;
    border-radius: 6px;
    background: #f2f4f7;
    color: #243447;
    font-size: 0;
    line-height: 0;
    cursor: pointer;
}

.app-modal-close::before,
.app-modal-close::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 2px;
    margin-left: -9px;
    margin-top: -1px;
    border-radius: 999px;
    background: currentColor;
}

.app-modal-close::before {
    transform: rotate(45deg);
}

.app-modal-close::after {
    transform: rotate(-45deg);
}

.app-modal-close:hover {
    background: #e7ecf1;
}

.app-modal-close:focus {
    outline: 2px solid #0066cc;
    outline-offset: 1px;
}

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

.app-modal-actions button[type="submit"] {
    margin-top: 0;
}

.app-modal .supporting-note:last-child,
.app-modal .limit-note:last-child {
    margin-bottom: 0;
}

.app-modal form + form {
    margin-top: 10px;
}

.welcome-modal-shell {
    width: min(100%, 520px);
}

.welcome-modal-title .brand-text {
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #1a1a2e;
}

.welcome-modal-title .brand-accent {
    color: #0066cc;
}

.welcome-modal-intro {
    margin: 0 0 14px;
}

.welcome-modal-list {
    margin: 0;
    padding-left: 20px;
}

.welcome-modal-item + .welcome-modal-item {
    margin-top: 18px;
}

.welcome-modal-item h3 {
    margin-top: 0;
}

.welcome-modal-item p {
    margin-bottom: 10px;
}

.welcome-modal-button-cue {
    margin-bottom: 0;
}

.league-top-actions {
    display: flex;
    justify-content: flex-end;
    margin: 14px 0 20px;
}

.league-top-actions details {
    width: 100%;
    margin: 0;
}

.league-section-group {
    margin-top: 28px;
}

.league-section-group h2 {
    margin-bottom: 14px;
}

.compare-section-heading {
    margin-bottom: 14px;
}

.compare-section-heading h2 {
    margin: 0;
}

.print-download-overlay {
    align-items: center;
    background: rgba(23, 32, 51, 0.45);
    display: none;
    inset: 0;
    justify-content: center;
    padding: 20px;
    position: fixed;
    z-index: 1000;
}

.print-download-overlay.is-visible {
    display: flex;
}

.print-download-panel {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(23, 32, 51, 0.18);
    max-width: 420px;
    padding: 24px;
    text-align: center;
    width: 100%;
}

.print-download-spinner {
    animation: print-download-spin 0.8s linear infinite;
    border: 4px solid #d7e0ec;
    border-top-color: #2563eb;
    border-radius: 50%;
    height: 40px;
    margin: 0 auto 14px;
    width: 40px;
}

.print-download-panel p {
    margin: 0;
    color: #516075;
}

@keyframes print-download-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* =====================
   Navigation
   ===================== */
.page-nav {
    margin-bottom: 16px;
    font-size: 0.9rem;
    color: #555;
    line-height: 1.8;
}

.page-nav a {
    color: #0066cc;
    text-decoration: none;
}

.page-nav a:hover {
    text-decoration: underline;
}

/* =====================
   Status Messages
   ===================== */
.msg-error {
    color: #cc0000;
    margin: 8px 0;
}

.msg-success {
    color: #006600;
    margin: 8px 0;
}

/* =====================
   Tables
   ===================== */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

table {
    border-collapse: collapse;
    width: 100%;
    background: #fff;
    font-size: 0.9rem;
}

th, td {
    border: 1px solid #ccc;
    padding: 8px 12px;
    text-align: left;
    white-space: nowrap;
}

thead th {
    background-color: #eef0f4;
    font-weight: 600;
}

tbody tr:nth-child(even) {
    background-color: #fafafa;
}

/* 2-col stats table: allow the label column to wrap */
.stats-table th {
    white-space: normal;
    width: 65%;
}

/* Sticky first column for wide multi-column stat tables */
.sticky-first-col th:first-child,
.sticky-first-col td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
}

.sticky-first-col thead th:first-child {
    background: #eef0f4;
}

.sticky-first-col tbody tr:nth-child(odd) th:first-child {
    background: #fff;
}

.sticky-first-col tbody tr:nth-child(even) th:first-child {
    background: #fafafa;
}

/* Keep detailed-stats headers on one line now that abbreviations are capped at 5 chars. */
.detailed-stats-table thead th:not(:first-child),
.detailed-stats-table thead th:not(:first-child) .stat-label-with-info,
.detailed-stats-table thead th:not(:first-child) span {
    white-space: nowrap !important;
    line-height: 1.2;
}

/* Opponent table: cap first column width and wrap long group labels. */
.opponent-stats-table th:first-child,
.opponent-stats-table td:first-child {
    max-width: 40%;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
}

.comparison-table {
    width: max-content;
    min-width: 100%;
}

.comparison-table thead th {
    min-width: 76px;
}

.comparison-table th:first-child,
.comparison-table td:first-child {
    width: 1%;
    min-width: 0;
    white-space: nowrap !important;
}

.comparison-table th:first-child .stat-label-with-info,
.comparison-table th:first-child span,
.comparison-table th:first-child {
    white-space: nowrap !important;
}

.comparison-table--compact-first-column th:first-child,
.comparison-table--compact-first-column td:first-child {
    width: min(35vw, 12rem);
    min-width: 7.5rem;
    max-width: min(35vw, 12rem);
    white-space: normal !important;
}

.comparison-table--compact-first-column th:first-child .stat-label-with-info,
.comparison-table--compact-first-column th:first-child span,
.comparison-table--compact-first-column th:first-child {
    white-space: normal !important;
}

.compare-row-label {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
    align-items: start;
}

.compare-row-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    min-height: 1.5rem;
    padding: 0 6px;
    border-radius: 999px;
    background: #e8f1ff;
    color: #1f4f8f;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
}

.compare-row-text {
    min-width: 0;
}

.compare-row-title {
    display: block;
    color: #1f2933;
    font-weight: 700;
    line-height: 1.15;
}

.compare-row-meta {
    display: block;
    margin-top: 3px;
    color: #5d6671;
    font-size: 0.74rem;
    font-weight: 500;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.records-table {
    width: max-content;
    min-width: 100%;
}

.records-table th:first-child,
.records-table td:first-child {
    width: 35vw;
    min-width: 12rem;
    max-width: 35vw;
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
}

.records-table th:first-child,
.records-table th:first-child .stat-label-with-info,
.records-table th:first-child span {
    white-space: normal !important;
    overflow-wrap: normal;
    word-break: normal;
}

.cell-best {
    background-color: #d4f5e2 !important;
}

.cell-worst {
    background-color: #fde8e8 !important;
}

/* =====================
   Forms
   ===================== */
form label {
    display: block;
    margin-bottom: 16px;
    font-weight: 500;
}

.label-with-action {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.inline-link-action {
    font-size: 0.85rem;
    font-weight: 500;
    color: #0066cc;
    text-decoration: underline;
    white-space: nowrap;
}

.inline-link-action:hover {
    text-decoration: none;
}

input[type="text"]:not(.ball),
input[type="email"],
input[type="password"],
input[type="date"],
input[type="datetime-local"],
select {
    display: block;
    width: 100%;
    max-width: 360px;
    font-size: 16px; /* prevent iOS auto-zoom on focus */
    padding: 10px 12px;
    border: 1px solid #bbb;
    border-radius: 6px;
    margin-top: 4px;
    background: #fff;
    color: #222;
}

input[type="text"]:not(.ball):focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
input[type="datetime-local"]:focus,
select:focus {
    outline: 2px solid #0066cc;
    outline-offset: 1px;
    border-color: #0066cc;
}

textarea {
    display: block;
    width: 100%;
    max-width: 100%;
    font-size: 16px;
    padding: 10px 12px;
    border: 1px solid #bbb;
    border-radius: 6px;
    margin-top: 4px;
    background: #fff;
    color: #222;
    font-family: inherit;
    resize: vertical;
}

textarea:focus {
    outline: 2px solid #0066cc;
    outline-offset: 1px;
    border-color: #0066cc;
}

button[type="submit"] {
    display: inline-block;
    font-size: 16px;
    padding: 12px 28px;
    background: #0066cc;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 8px;
}

button[type="submit"]:hover {
    background: #0052a3;
}

button[type="submit"]:disabled {
    background: #8fa8c4;
    cursor: not-allowed;
}

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

.button-secondary {
    display: inline-block;
    font-size: 16px;
    padding: 12px 28px;
    background: #f2f4f7;
    color: #243447;
    border: 1px solid #bdc7d2;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 8px;
}

.button-secondary:hover {
    background: #e7ecf1;
}

.button-primary {
    display: inline-block;
    font-size: 16px;
    padding: 12px 28px;
    background: #0066cc;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 8px;
}

.button-primary:hover {
    background: #0052a3;
}

button.button-danger,
.button-danger[type="submit"] {
    display: inline-block;
    font-size: 16px;
    padding: 12px 28px;
    background: #c62828;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 8px;
}

button.button-danger:hover,
.button-danger[type="submit"]:hover {
    background: #a61f1f;
}

/* =====================
   Stat Tooltips
   ===================== */
.stat-label-with-info {
    white-space: normal;
    color: #5d6671;
    border-bottom: 1px dotted #9aa6b2;
    cursor: pointer;
    user-select: none;
    transition: color 0.15s ease, border-color 0.15s ease;
}

/* Ensure interactive labels can wrap inside compact table headers on mobile. */
.sticky-first-col thead th .stat-label-with-info {
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
}

.stat-label-with-info:hover {
    color: #3f4854;
    border-bottom-color: #707c89;
}

.stat-label-with-info:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
    border-bottom-color: #707c89;
}

.stat-tooltip {
    position: fixed;
    background: #13263a;
    color: #fff;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    line-height: 1.4;
    max-width: 280px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 10000;
    pointer-events: none;
}

/* =====================
   Login page
   ===================== */
.login-box {
    max-width: 360px;
    margin: 32px auto;
    background: #fff;
    border: 1px solid #dde;
    border-radius: 10px;
    padding: 28px 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

.login-box h1 {
    margin-bottom: 4px;
}

/* =====================
   Leagues list
   ===================== */
.leagues-list {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
}

.leagues-list li {
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #dde;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 1rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.compare-league-option {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 8px 10px;
}

.compare-league-option.is-selected {
    border-color: #b8ddbf;
    box-shadow: 0 0 0 1px #d4ecd8;
}

.league-item-summary {
    min-width: 0;
}

.league-item-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.league-item-inline-name {
    color: #1f2933;
    font-weight: 700;
}

.league-item-inline-meta {
    color: #5d6671;
    font-size: 0.83rem;
    line-height: 1.2;
}

.compare-select-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 5px 10px;
    border: 1px solid #b7cae8;
    border-radius: 999px;
    background: #f3f8ff;
    color: #1f4f8f;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
}

.compare-select-button:hover {
    background: #e8f1ff;
    border-color: #8fb1df;
    text-decoration: none;
}

.compare-select-button:focus {
    outline: 2px solid #0066cc;
    outline-offset: 1px;
}

.compare-selection-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 5px 10px;
    border: 1px solid #b8ddbf;
    border-radius: 999px;
    background: #eaf5ec;
    color: #1a5c2a;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1;
}

.compare-selection-list {
    list-style: none;
    padding: 0;
    margin: 0 0 10px;
}

.compare-selection-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 6px;
    align-items: center;
    padding: 6px 8px;
    background: #fff;
    border: 1px solid #dde;
    border-radius: 7px;
    margin-bottom: 4px;
    box-shadow: 0 1px 1px rgba(0,0,0,0.04);
}

.compare-available-item {
    grid-template-columns: minmax(0, 1fr) auto;
}

.compare-selection-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.6rem;
    min-height: 1.6rem;
    padding: 0 6px;
    border-radius: 999px;
    background: #eff4f8;
    color: #243447;
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1;
}

.compare-selection-details {
    min-width: 0;
}

.compare-available-item .compare-selection-details {
    display: block;
}

.compare-selection-title {
    display: inline;
    color: #1f2933;
    font-weight: 700;
    line-height: 1.1;
}

.compare-selection-meta {
    display: inline;
    margin-top: 0;
    color: #5d6671;
    font-size: 0.75rem;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.compare-remove-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 4px 9px;
    border: 1px solid #dfb1b1;
    border-radius: 999px;
    background: #fff5f5;
    color: #8f1f1f;
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
}

.compare-remove-button:hover {
    background: #ffeaea;
    border-color: #d58f8f;
    text-decoration: none;
}

.compare-remove-button:focus {
    outline: 2px solid #c62828;
    outline-offset: 1px;
}

.compare-step-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.compare-step-actions form,
.compare-step-actions .inline-link-action {
    margin: 0;
}

.compare-async-shell {
    position: relative;
}

.compare-async-overlay[hidden] {
    display: none !important;
}

.compare-async-overlay {
    position: absolute;
    top: 8px;
    right: 8px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid #d9e3ef;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 2px 10px rgba(31, 41, 51, 0.08);
    z-index: 3;
}

.compare-async-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #c8d7e8;
    border-top-color: #0066cc;
    border-radius: 50%;
    animation: compare-async-spin 0.8s linear infinite;
}

.compare-async-status-text {
    color: #334e68;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1;
}

.league-section-group > h2 {
    margin-bottom: 10px;
}

.league-section-group > .supporting-note,
.league-section-group > p {
    margin-bottom: 10px;
}

@keyframes compare-async-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.bowling-style-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border: 1px solid #c7d8f6;
    border-radius: 999px;
    background: #ebf3ff;
    color: #204a8a;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.bowling-style-pill[data-style="duckpin"] {
    background: #eaf5ec;
    color: #1a5c2a;
    border-color: #b8ddbf;
}
.bowling-style-pill[data-style="candlepin"] {
    background: #f3eeff;
    color: #5a2d8a;
    border-color: #d4bbf5;
}
.bowling-style-pill[data-style="rubberband_ducks"] {
    background: #fff4e6;
    color: #7a3e00;
    border-color: #f5d09a;
}

.league-style-note {
    margin: 0 0 8px;
    font-size: 0.9rem;
    color: #4a5663;
}

.league-summary-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.game-scores-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.league-item-stats {
    grid-area: stats;
    margin-top: 4px;
    font-size: 0.84rem;
    color: #666;
}

.league-item-style {
    grid-area: style;
    margin-top: 0;
}

@media (max-width: 640px) {
    .comparison-table--compact-first-column th:first-child,
    .comparison-table--compact-first-column td:first-child {
        width: 35vw;
        min-width: 7.25rem;
        max-width: 35vw;
    }

    .compare-league-option {
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
    }

    .league-item-actions {
        justify-content: flex-start;
    }

    .compare-select-button,
    .compare-selection-badge {
        width: auto;
        max-width: 100%;
    }

    .compare-selection-item {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }

    .compare-available-item {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .compare-remove-button {
        grid-column: auto;
        justify-self: auto;
    }

    .compare-async-overlay {
        top: -4px;
        right: 0;
        padding: 7px 9px;
    }

    .league-item-inline-meta {
        display: block;
        margin-top: 1px;
    }
}

.supporting-note {
    margin: 4px 0 12px;
    color: #4a5663;
    font-size: 0.92rem;
}

.admin-section-actions {
    display: flex;
    justify-content: flex-start;
    margin: 12px 0 0;
}

.admin-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin: 14px 0 20px;
}

.admin-summary-card {
    padding: 14px 16px;
    border: 1px solid #dde;
    border-radius: 10px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.admin-summary-card-label {
    display: block;
    margin-bottom: 6px;
    color: #51606f;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.admin-summary-card-value {
    display: block;
    color: #13263a;
    font-size: 1.7rem;
    font-weight: 800;
    line-height: 1.1;
}

.admin-summary-card-note {
    margin: 6px 0 0;
    color: #51606f;
    font-size: 0.88rem;
}

.admin-toolbar,
.admin-log-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}

.admin-toolbar {
    margin: 14px 0 18px;
}

.admin-toolbar label {
    flex: 1 1 180px;
    min-width: 150px;
    margin-bottom: 0;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.status-pill--new,
.status-pill--warning {
    background: #fff4d6;
    color: #8a5a00;
}

.status-pill--reviewed,
.status-pill--info {
    background: #dff1ff;
    color: #005b99;
}

.status-pill--resolved {
    background: #e2f7e8;
    color: #1d6b35;
}

.status-pill--error {
    background: #ffe3e3;
    color: #b42318;
}

.status-pill--critical {
    background: #2b1b26;
    color: #ffd8eb;
}

.admin-log-context {
    margin: 0;
    padding: 14px 16px;
    border-radius: 10px;
    background: #13263a;
    color: #e6edf5;
    font-size: 0.9rem;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.admin-log-empty {
    margin: 10px 0 0;
}

.editor-form-shell,
.news-page-shell {
    max-width: 900px;
    margin: 32px auto;
    background: #fff;
    border: 1px solid #dde;
    border-radius: 10px;
    padding: 28px 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

.code-textarea {
    min-height: 320px;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
    line-height: 1.5;
}

.news-list {
    display: grid;
    gap: 18px;
    margin-top: 20px;
}

.news-page-title-text {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    margin-left: 12px;
}

.news-page-title-text .brand-text {
    margin-right: 0;
}

.news-post-card {
    padding: 22px 24px;
    border: 1px solid #dde;
    border-radius: 10px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.news-post-card h2 {
    margin-top: 0;
    margin-bottom: 6px;
}

.news-post-meta {
    margin: 0 0 16px;
    color: #5d6671;
    font-size: 0.9rem;
}

.news-post-body {
    color: #1f2937;
}

.news-post-body > :first-child {
    margin-top: 0;
}

.news-post-body > :last-child {
    margin-bottom: 0;
}

.news-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    padding: 10px 16px;
    border: 1px solid #c8d5e6;
    border-radius: 999px;
    background: #f7fbff;
    color: #1f4f8f;
    text-decoration: none;
    font-weight: 600;
}

.pagination-link:hover {
    background: #edf5ff;
    text-decoration: none;
}

.pagination-status {
    margin: 0;
    color: #5d6671;
    font-size: 0.92rem;
}

.news-table-title {
    white-space: normal;
}

@media (max-width: 700px) {
    .editor-form-shell,
    .news-page-shell {
        padding: 22px 18px;
        margin: 20px auto;
    }

    .news-pagination {
        flex-direction: column;
        align-items: flex-start;
    }
}

.payment-prompt {
    margin: 10px 0 16px;
    padding: 12px 14px;
    border: 1px solid #e5c46b;
    border-radius: 8px;
    background: #fff8e5;
    color: #5d4400;
}

.usage-meter {
    margin: 10px 0 18px;
    padding: 14px;
    border: 1px solid #d8e2ee;
    border-radius: 8px;
    background: #f7fbff;
}

.plan-details[open] > *:not(summary) {
    padding: 10px 8px 0;
}

.plan-details .usage-meter {
    margin: 10px 0 4px;
    padding: 16px 16px 20px;
}

.plan-details .usage-meter .supporting-note {
    margin: 0 0 14px;
}

.plan-details .usage-meter-grid {
    gap: 12px;
    margin-bottom: 10px;
}

.usage-meter h2 {
    margin: 0 0 8px;
    border-bottom: 0;
    padding-bottom: 0;
}

.usage-meter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.usage-meter-card {
    background: #fff;
    border: 1px solid #dde;
    border-radius: 8px;
    padding: 10px 12px;
}

.usage-meter-label {
    font-size: 0.84rem;
    color: #5d6671;
}

.usage-meter-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a1a2e;
}

.limit-note {
    margin: 4px 0 12px;
    padding: 8px 10px;
    border-left: 4px solid #7ea3cb;
    background: #f2f8ff;
    color: #23476e;
    font-size: 0.9rem;
}

.limit-note-warning {
    border-left-color: #d97706;
    background: #fff8eb;
    color: #7a3e05;
}

.missing-required-info > summary {
    border-color: #d64045;
    background: #fff1f2;
    color: #7f1d1d;
}

.missing-required-info > summary::after {
    color: #7f1d1d;
}

.missing-required-info > summary:hover {
    background: #ffe4e6;
}

/* =====================
   Trend chart (summary.php)
   ===================== */
.trend-chart-wrap {
    background: #fff;
    border: 1px solid #dde;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    padding: 12px 12px 8px;
    margin-bottom: 18px;
}

.trend-chart-wrap h3 {
    margin: 4px 0 4px;
}

.trend-chart-note {
    margin: 0 0 10px;
    color: #555;
    font-size: 0.88rem;
}

.trend-chart-scroll {
    overflow: hidden;
}

.trend-chart {
    display: block;
    width: 100%;
    min-width: 0;
    height: auto;
}

.trend-chart-grid-line {
    stroke: #e6ebf2;
    stroke-width: 1;
}

.trend-chart-axis {
    stroke: #9aa8bc;
    stroke-width: 1;
}

.trend-chart-line {
    fill: none;
    stroke: #0066cc;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.trend-chart-point {
    fill: #0066cc;
    stroke: #fff;
    stroke-width: 1;
}

.trend-chart-axis-label {
    fill: #556477;
    font-size: 12px;
}

/* =====================
   Detailed charts
   ===================== */
.chart-grid {
    display: grid;
    gap: 20px;
}

.chart-card {
    background: #fff;
    border: 1px solid #dde;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    padding: 14px 14px 10px;
}

.chart-card h2 {
    margin: 0 0 6px;
    padding-bottom: 0;
    border-bottom: none;
}

.bar-chart-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.bar-chart {
    display: block;
    width: 100%;
    min-width: 0;
    height: auto;
}

.bar-chart-grid-line {
    stroke: #e6ebf2;
    stroke-width: 1;
}

.bar-chart-axis {
    stroke: #9aa8bc;
    stroke-width: 1;
}

.bar-chart-bar {
    fill: #0066cc;
}

.bar-chart-value-label {
    fill: #1a1a2e;
    font-size: 13px;
    font-weight: 700;
}

.bar-chart-value-badge {
    fill: rgba(255, 255, 255, 0.96);
    stroke: #d4dceb;
    stroke-width: 1;
}

.bar-chart-axis-label,
.bar-chart-y-label {
    fill: #556477;
    font-size: 12px;
}

.trend-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin: 4px 0 10px;
    color: #445266;
    font-size: 0.9rem;
}

.trend-chart-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.trend-chart-legend-swatch {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    flex: 0 0 auto;
}

.trend-chart-legend-line {
    width: 16px;
    height: 0;
    border-top: 3px solid currentColor;
    border-radius: 999px;
    flex: 0 0 auto;
}

.trend-chart-area {
    stroke: none;
}

.chart-card .supporting-note {
    margin-top: 0;
}

/* =====================
   Sets card list (mobile)
   ===================== */
.sets-cards-list {
    display: none;
}

.set-card {
    background: #fff;
    border: 1px solid #dde;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.set-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3px;
}

.set-card-date {
    font-weight: 600;
    font-size: 0.95rem;
}

.set-card-detail {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 10px;
}

.set-card-scores {
    display: flex;
    flex-direction: column;
    border-top: 1px solid #eee;
    padding-top: 10px;
    text-align: center;
    gap: 8px;
}

.set-card-score-row {
    display: flex;
}

.set-card-score-row > div {
    flex: 1;
    border-right: 1px solid #eee;
}

.set-card-score-row > div:last-child {
    border-right: none;
}

.set-card-scores-multirow .set-card-score-row + .set-card-score-row {
    border-top: 1px solid #f1f1f1;
    padding-top: 8px;
}

.set-card-score-label {
    font-size: 0.72rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
}

.set-card-score-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1a1a2e;
}

.set-card-score-value.game-score {
    font-weight: 400;
    font-size: 1rem;
}

/* =====================
   Scorecard (set.php)
   ===================== */
.scorecard {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 10px;
    margin: 12px 0;
    background: #fff;
}

.frames {
    display: flex;
    gap: 5px;
    width: max-content;
}

.frame {
    border: 1px solid #999;
    padding: 4px 3px;
    text-align: center;
    min-width: 52px;
}

@media (max-width: 600px) {
    .scorecard {
        overflow-x: visible;
        padding: 6px;
    }

    .frames {
        width: 100%;
        flex-wrap: wrap;
        gap: 3px;
    }

    .frame {
        flex: 1 1 calc(20% - 3px);
        min-width: 0;
        padding: 3px 2px;
        overflow: hidden;
    }

    .balls {
        gap: 1px;
    }

    .ball {
        width: auto;
        flex: 1;
        min-width: 0;
        max-width: 24px;
    }
}

.frame-number {
    font-weight: bold;
    margin-bottom: 3px;
    font-size: 0.75rem;
    color: #888;
}

.balls {
    display: flex;
    gap: 2px;
    justify-content: center;
}

.ball {
    display: inline-block;
    width: 20px;
    height: 24px;
    text-align: center;
    border: 1px solid #aaa;
    font-size: 12px;
    font-weight: 600;
    padding: 0;
    border-radius: 2px;
    background: #fff;
    line-height: 24px;
    color: #222;
}

.two-ball-style .frame:not([data-frame="10"]) .ball3 {
    display: none;
}

.ball:disabled {
    background-color: #f0f0f0;
    cursor: not-allowed;
}

.ball:focus,
.ball.ball-active {
    outline: 2px solid #3b82f6;
    outline-offset: 1px;
    background: #eef5ff;
}

.frame-score {
    margin-top: 5px;
    font-size: 1rem;
    font-weight: 700;
    color: #1a1a2e;
    min-height: 1.2em;
}

.game-total {
    margin-top: 10px;
    padding: 8px 12px;
    background: #f0f2f5;
    border-radius: 4px;
    font-size: 1rem;
}

.set-total {
    margin-top: 16px;
    padding: 14px;
    background: #e0e4ec;
    border-radius: 6px;
    font-size: 1.1rem;
    text-align: center;
}

.game-section {
    margin-bottom: 28px;
}

/* =====================
   Responsive: 425px and smaller
   ===================== */
@media (max-width: 425px) {
    body {
        padding: 12px;
    }

    h1 {
        font-size: 1.2rem;
    }

    h2 {
        font-size: 1.05rem;
    }

    details > summary {
        padding: 12px 14px;
        font-size: 1rem;
    }

    /* Show card view, hide wide table for sets list */
    .sets-cards-list {
        display: block;
    }

    .sets-table-wrap {
        display: none;
    }

    .trend-chart-axis-label {
        font-size: 18px;
        font-weight: 600;
    }

    .bar-chart-value-label,
    .bar-chart-axis-label,
    .bar-chart-y-label {
        font-size: 14px;
        font-weight: 600;
    }
}
