:root {
    --sg-yellow: #f2d318;
    --sg-yellow-hover: #dfc000;
    --sg-red: #c8192e;
    --sg-red-hover: #a91426;
    --sg-black: #171717;
    --sg-dark: #242424;
    --sg-gray: #6b7280;
    --sg-light-gray: #f3f4f6;
    --sg-border: #dedede;
    --sg-white: #ffffff;
    --sg-ink: #111111;
    --sg-muted: #505762;
    --sg-panel: #fbfbfb;
    --sg-success: #0f7a46;
    --sg-warning: #9a6400;
    --sg-shadow: 0 14px 34px rgba(23, 23, 23, 0.10);
    --sg-shadow-soft: 0 8px 20px rgba(23, 23, 23, 0.08);
    --radius-lg: 8px;
    --radius-md: 8px;
    --radius-sm: 6px;
    --club-red: var(--sg-red);
    --club-red-dark: var(--sg-red-hover);
    --club-red-deep: #670d19;
    --club-green: var(--sg-success);
    --club-green-dark: #0b5d36;
    --danger: var(--sg-red);
    --background: var(--sg-light-gray);
    --surface: var(--sg-white);
    --surface-muted: var(--sg-panel);
    --border: var(--sg-border);
    --text: var(--sg-ink);
    --text-muted: var(--sg-gray);
    --shadow: var(--sg-shadow);
}

* {
    box-sizing: border-box;
    letter-spacing: 0;
}

[hidden] {
    display: none !important;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 104px;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--sg-ink);
    background:
        linear-gradient(180deg, rgba(23, 23, 23, 0.04), transparent 180px),
        repeating-linear-gradient(135deg, rgba(23, 23, 23, 0.035) 0 1px, transparent 1px 18px),
        var(--sg-light-gray);
    font-family: "Aptos", "Trebuchet MS", "Segoe UI", sans-serif;
    line-height: 1.5;
}

.public-page {
    background:
        linear-gradient(180deg, var(--sg-black) 0 92px, transparent 92px),
        repeating-linear-gradient(135deg, rgba(23, 23, 23, 0.035) 0 1px, transparent 1px 18px),
        var(--sg-light-gray);
}

.admin-page {
    background:
        linear-gradient(90deg, rgba(23, 23, 23, 0.05), transparent 420px),
        repeating-linear-gradient(135deg, rgba(23, 23, 23, 0.035) 0 1px, transparent 1px 20px),
        var(--sg-light-gray);
}

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

button {
    cursor: pointer;
}

img {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
}

h1,
h2,
h3,
.brand strong,
.public-brand strong,
.stat-card strong {
    font-family: "Bahnschrift", "Franklin Gothic Medium", "Trebuchet MS", sans-serif;
    font-weight: 800;
}

.app-shell {
    display: grid;
    grid-template-columns: 278px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 26px;
    min-height: 100vh;
    padding: 24px 18px;
    color: var(--sg-white);
    background:
        linear-gradient(180deg, rgba(23, 23, 23, 0.92), rgba(23, 23, 23, 0.98)),
        var(--sg-black);
    border-right: 6px solid var(--sg-yellow);
}

.sidebar::before {
    content: "";
    display: block;
    height: 5px;
    margin: -24px -18px 0;
    background: linear-gradient(90deg, var(--sg-yellow), var(--sg-red), var(--sg-yellow));
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 52px;
    color: inherit;
    text-decoration: none;
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-size: 1.18rem;
    line-height: 1.1;
}

.brand small {
    margin-top: 3px;
    color: rgba(255, 255, 255, 0.72);
    font-weight: 700;
}

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

.nav-button {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 11px 12px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.84);
    background: rgba(255, 255, 255, 0.04);
    font-weight: 800;
    text-align: left;
    transition: background 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.nav-button::before {
    content: "";
    flex: 0 0 auto;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--sg-yellow);
    opacity: 0.42;
}

.nav-button:hover,
.nav-button:focus-visible {
    color: var(--sg-white);
    background: rgba(242, 211, 24, 0.13);
    border-color: rgba(242, 211, 24, 0.42);
    outline: none;
    transform: translateX(2px);
}

.nav-button.is-active {
    color: var(--sg-black);
    background: var(--sg-yellow);
    border-color: var(--sg-yellow);
}

.nav-button.is-active::before {
    background: var(--sg-red);
    opacity: 1;
}

.sidebar-note {
    margin-top: auto;
    padding: 16px;
    border: 1px solid rgba(242, 211, 24, 0.34);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.06);
}

.sidebar-note strong,
.sidebar-note span {
    display: block;
}

.sidebar-note strong {
    color: var(--sg-yellow);
}

.sidebar-note span {
    margin-top: 6px;
    color: rgba(255, 255, 255, 0.78);
    line-height: 1.45;
}

.main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 24px 32px;
    border-bottom: 1px solid var(--sg-border);
    background:
        linear-gradient(90deg, var(--sg-white), #fffdf0 58%, #fff7f8),
        var(--sg-white);
}

.topbar h1 {
    margin: 3px 0 6px;
    font-size: 2rem;
    line-height: 1.1;
}

.topbar p {
    margin: 0;
}

.topbar-actions,
.button-row,
.form-row,
.table-actions,
.match-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.topbar-actions {
    justify-content: flex-end;
}

.topbar-select {
    min-height: 42px;
    max-width: 300px;
    padding: 9px 38px 9px 14px;
    border: 1px solid var(--sg-border);
    border-radius: var(--radius-sm);
    color: var(--sg-ink);
    background: var(--sg-white);
    font-weight: 800;
}

.topbar-select:focus {
    border-color: var(--sg-red);
    outline: 3px solid rgba(200, 25, 46, 0.16);
}

.content {
    padding: 28px 32px 42px;
}

.public-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    max-width: none;
    margin: 0;
    padding: 14px max(22px, calc((100vw - 1220px) / 2 + 22px));
    color: var(--sg-white);
    background: rgba(23, 23, 23, 0.98);
    border-bottom: 4px solid var(--sg-yellow);
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.22);
}

.public-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 1;
}

.public-nav a {
    min-height: 36px;
    padding: 7px 11px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.84);
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

.public-nav a:hover,
.public-nav a:focus-visible,
.public-nav a.is-active,
.public-nav a[aria-current="page"] {
    color: var(--sg-black);
    background: var(--sg-yellow);
    border-color: var(--sg-yellow);
    outline: none;
}

.public-admin-link {
    flex: 0 0 auto;
}

.public-brand {
    display: inline-flex;
    align-items: center;
    gap: 13px;
    min-width: 0;
    color: var(--sg-white);
    text-decoration: none;
}

.public-brand strong,
.public-brand small {
    display: block;
}

.public-brand strong {
    font-size: 1.16rem;
    line-height: 1.05;
}

.public-brand small {
    color: rgba(255, 255, 255, 0.72);
    font-weight: 700;
}

.public-main {
    max-width: 1220px;
    margin: 0 auto;
    padding: 26px 24px 46px;
}

.card.public-hero {
    position: relative;
    min-height: 250px;
    padding: 34px;
    color: var(--sg-white);
    background:
        linear-gradient(135deg, rgba(23, 23, 23, 0.96), rgba(36, 36, 36, 0.94) 58%, rgba(200, 25, 46, 0.86)),
        var(--sg-black);
    overflow: hidden;
}

.public-hero::after {
    content: "";
    position: absolute;
    right: 28px;
    bottom: -36px;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(242, 211, 24, 0.18), rgba(200, 25, 46, 0.06) 62%, transparent 68%);
    opacity: 0.85;
    pointer-events: none;
}

.public-hero .eyebrow,
.public-hero p {
    position: relative;
    z-index: 1;
    max-width: 700px;
    color: rgba(255, 255, 255, 0.78);
}

.public-hero .eyebrow {
    color: var(--sg-yellow);
}

.public-hero h1 {
    position: relative;
    z-index: 1;
    max-width: 760px;
    margin: 8px 0 10px;
    font-size: 3.25rem;
    line-height: 1.02;
}

.public-content {
    padding: 26px 0 0;
}

.public-view {
    scroll-margin-top: 132px;
}

.public-focus-panel {
    border-color: rgba(242, 211, 24, 0.65);
    box-shadow: var(--sg-shadow);
}

.eyebrow {
    margin: 0;
    color: var(--sg-red);
    font-size: 0.79rem;
    font-weight: 900;
    text-transform: uppercase;
}

.card {
    border: 1px solid var(--sg-border);
    border-radius: var(--radius-lg);
    background: var(--sg-white);
    box-shadow: var(--sg-shadow-soft);
    overflow: hidden;
}

.card::before {
    content: "";
    display: block;
    height: 4px;
    background: linear-gradient(90deg, var(--sg-yellow), var(--sg-red));
}

.public-hero::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 7px;
    height: auto;
    background: var(--sg-yellow);
}

.stat-card::before,
.setup-card::before,
.team-card::before,
.saved-item::before {
    display: none;
}

.panel {
    padding: 22px;
}

.section-stack {
    display: grid;
    gap: 22px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.setup-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px;
}

.setup-card {
    display: grid;
    gap: 8px;
    padding: 18px;
    border: 1px solid var(--sg-border);
    border-top: 5px solid var(--sg-yellow);
    border-radius: var(--radius-lg);
    background:
        linear-gradient(180deg, var(--sg-white), #fffdf0),
        var(--sg-white);
    color: var(--sg-ink);
    text-align: left;
    box-shadow: var(--sg-shadow-soft);
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.setup-card:hover,
.setup-card:focus-visible {
    border-color: var(--sg-red);
    outline: none;
    transform: translateY(-2px);
    box-shadow: var(--sg-shadow);
}

.setup-card span {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    color: var(--sg-black);
    background: var(--sg-yellow);
    font-weight: 900;
}

.setup-card strong {
    font-size: 1.05rem;
}

.setup-card small {
    color: var(--sg-muted);
    font-weight: 700;
}

.stat-card {
    position: relative;
    min-height: 118px;
    padding: 18px;
    border-left: 6px solid var(--sg-yellow);
    background:
        linear-gradient(135deg, var(--sg-white), #fffdf0),
        var(--sg-white);
}

.stat-card:nth-child(even) {
    border-left-color: var(--sg-red);
}

.stat-card strong {
    display: block;
    margin-top: 9px;
    color: var(--sg-black);
    font-size: 2.25rem;
    line-height: 1;
}

.stat-card span {
    color: var(--sg-muted);
    font-weight: 900;
    text-transform: uppercase;
}

.match-card-list {
    display: grid;
    gap: 12px;
}

.public-match-card {
    display: grid;
    grid-template-columns: minmax(116px, 0.68fr) minmax(0, 1.8fr) auto;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--sg-border);
    border-left: 5px solid var(--sg-yellow);
    border-radius: var(--radius-md);
    background: var(--sg-white);
}

.public-match-card.is-open {
    border-left-color: var(--sg-yellow);
    background: linear-gradient(90deg, var(--sg-white), #fffdf0);
}

.public-match-card.is-played {
    border-left-color: var(--sg-red);
    background: linear-gradient(90deg, var(--sg-white), #fff8f9);
}

.match-card-meta {
    display: grid;
    gap: 4px;
}

.match-card-meta span {
    color: var(--sg-muted);
    font-size: 0.84rem;
    font-weight: 800;
}

.match-card-meta strong {
    color: var(--sg-red);
}

.match-card-teams {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    font-weight: 900;
}

.match-card-teams span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.match-card-teams span:last-child {
    text-align: right;
}

.match-card-teams strong {
    min-width: 56px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    color: var(--sg-white);
    background: var(--sg-black);
    text-align: center;
    box-shadow: inset 0 -3px 0 rgba(242, 211, 24, 0.38);
}

.match-card-status {
    justify-self: end;
}

.split-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
    gap: 22px;
}

.empty-state {
    max-width: 760px;
    margin: 48px auto;
    padding: 36px;
    text-align: center;
}

.login-screen {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
    background:
        linear-gradient(135deg, rgba(23, 23, 23, 0.96), rgba(36, 36, 36, 0.94) 62%, rgba(200, 25, 46, 0.82)),
        var(--sg-black);
}

.login-card {
    width: min(100%, 452px);
    padding: 32px;
    border-top: 6px solid var(--sg-yellow);
}

.login-card img {
    width: 132px;
    margin-bottom: 20px;
}

.login-card h1 {
    margin: 8px 0 10px;
    font-size: 2.05rem;
    line-height: 1.05;
}

.login-card label {
    display: grid;
    gap: 8px;
    margin: 22px 0 14px;
    font-weight: 800;
}

.login-card input {
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid var(--sg-border);
    border-radius: var(--radius-sm);
    background: var(--sg-white);
}

.login-card input:focus {
    border-color: var(--sg-yellow);
    outline: 3px solid rgba(242, 211, 24, 0.32);
}

.login-card .button {
    width: 100%;
}

.form-message {
    min-height: 1.4em;
    color: var(--sg-red);
    font-weight: 800;
}

.code-box {
    margin: 18px 0 0;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    color: var(--sg-yellow);
    background: var(--sg-black);
    overflow-x: auto;
}

.empty-state img {
    width: 145px;
    margin: 0 auto 22px;
}

.empty-state h2 {
    max-width: 560px;
    margin: 8px auto 10px;
    font-size: 2.2rem;
    line-height: 1.08;
}

.empty-state p:not(.eyebrow) {
    max-width: 580px;
    margin: 0 auto 22px;
    color: var(--sg-muted);
    line-height: 1.6;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 15px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-weight: 900;
    text-decoration: none;
    white-space: nowrap;
    transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease, border-color 140ms ease;
}

.button:hover:not(:disabled),
.button:focus-visible:not(:disabled) {
    transform: translateY(-1px);
    outline: none;
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.48;
}

.button-primary {
    color: var(--sg-black);
    background: var(--sg-yellow);
    border-color: var(--sg-yellow);
    box-shadow: 0 10px 18px rgba(242, 211, 24, 0.22);
}

.button-primary:hover:not(:disabled),
.button-primary:focus-visible:not(:disabled) {
    background: var(--sg-yellow-hover);
    border-color: var(--sg-yellow-hover);
}

.button-secondary {
    color: var(--sg-white);
    background: var(--sg-black);
    border-color: var(--sg-black);
}

.button-secondary:hover:not(:disabled),
.button-secondary:focus-visible:not(:disabled) {
    background: var(--sg-dark);
    border-color: var(--sg-dark);
}

.button-ghost {
    color: var(--sg-black);
    background: var(--sg-white);
    border-color: var(--sg-border);
}

.public-header .button-ghost,
.sidebar .button-ghost {
    color: var(--sg-white);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
}

.button-ghost:hover:not(:disabled),
.button-ghost:focus-visible:not(:disabled) {
    border-color: var(--sg-yellow);
    box-shadow: 0 0 0 3px rgba(242, 211, 24, 0.18);
}

.button-danger {
    color: var(--sg-white);
    background: var(--sg-red);
    border-color: var(--sg-red);
}

.button-danger:hover:not(:disabled),
.button-danger:focus-visible:not(:disabled) {
    background: var(--sg-red-hover);
    border-color: var(--sg-red-hover);
}

.button-small {
    min-height: 34px;
    padding: 7px 11px;
    font-size: 0.9rem;
}

.section-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.section-title h2 {
    margin: 0;
    font-size: 1.36rem;
    line-height: 1.16;
}

.section-title p {
    margin: 5px 0 0;
    color: var(--sg-muted);
}

.form-row input,
.form-row select,
.score-input,
.bulk-form textarea {
    min-height: 42px;
    border: 1px solid var(--sg-border);
    border-radius: var(--radius-sm);
    color: var(--sg-ink);
    background: var(--sg-white);
}

.form-row input,
.form-row select {
    min-width: min(100%, 260px);
    padding: 9px 13px;
}

.form-row[aria-busy="true"] {
    opacity: 0.72;
}

.inline-form-message {
    flex-basis: 100%;
    margin: 2px 0 0;
    color: var(--sg-red);
    font-weight: 800;
}

.form-row input:focus,
.form-row select:focus,
.score-input:focus,
.bulk-form textarea:focus {
    border-color: var(--sg-yellow);
    outline: 3px solid rgba(242, 211, 24, 0.30);
}

.bulk-form {
    display: grid;
    gap: 12px;
    margin-top: 16px;
}

.bulk-form label {
    display: grid;
    gap: 8px;
    color: var(--sg-muted);
    font-weight: 800;
}

.bulk-form textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px 13px;
    border-radius: var(--radius-md);
    resize: vertical;
}

.team-list {
    display: grid;
    gap: 12px;
}

.public-team-list {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.team-card {
    padding: 15px;
    border: 1px solid var(--sg-border);
    border-left: 5px solid var(--sg-yellow);
    border-radius: var(--radius-md);
    background: var(--sg-panel);
}

.team-card.is-selected {
    border-color: var(--sg-yellow);
    border-left-color: var(--sg-red);
    background: #fffdf0;
    box-shadow: inset 0 0 0 1px rgba(242, 211, 24, 0.35);
}

.team-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.team-card h3 {
    margin: 0;
    line-height: 1.14;
}

.team-meta,
.muted {
    color: var(--sg-muted);
}

.team-meta {
    margin: 4px 0 0;
}

.player-list {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.player-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 11px;
    border: 1px solid var(--sg-border);
    border-radius: var(--radius-sm);
    background: var(--sg-white);
    font-weight: 800;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    border: 1px solid var(--sg-border);
    border-radius: var(--radius-md);
    background: var(--sg-white);
}

.table-scroll-hint {
    display: none;
}

table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
}

th,
td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--sg-border);
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--sg-white);
    background: var(--sg-black);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
}

tbody tr:nth-child(even) td {
    background: #fcfcfc;
}

tbody tr:hover td {
    background: #fffdf0;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.status {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 900;
}

.status-open {
    color: var(--sg-black);
    background: var(--sg-yellow);
}

.status-played {
    color: var(--sg-white);
    background: var(--sg-red);
}

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

.score-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.score-input {
    width: 64px;
    padding: 8px;
    text-align: center;
    font-weight: 900;
}

.phase-list {
    display: grid;
    gap: 18px;
}

.standings-stack {
    display: grid;
    gap: 18px;
}

.standings-mobile-list {
    display: none;
}

.phase-heading {
    margin: 8px 0 0;
    color: var(--sg-red);
}

.config-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
    margin: 6px 0 18px;
}

.config-summary span,
.config-check {
    display: grid;
    gap: 4px;
    padding: 12px;
    border: 1px solid var(--sg-border);
    border-left: 5px solid var(--sg-yellow);
    border-radius: var(--radius-md);
    background: var(--sg-panel);
}

.config-summary strong,
.config-check strong {
    color: var(--sg-black);
    font-size: 1.08rem;
}

.config-form {
    display: grid;
    gap: 16px;
}

.config-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.form-field {
    display: grid;
    gap: 7px;
    color: var(--sg-muted);
    font-weight: 900;
}

.form-field input,
.form-field select {
    min-height: 42px;
    width: 100%;
    padding: 9px 13px;
    border: 1px solid var(--sg-border);
    border-radius: var(--radius-sm);
    color: var(--sg-ink);
    background: var(--sg-white);
}

.form-field input:focus,
.form-field select:focus {
    border-color: var(--sg-yellow);
    outline: 3px solid rgba(242, 211, 24, 0.30);
}

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

.config-check.is-ok {
    border-left-color: var(--sg-success);
}

.config-check.is-warning {
    border-left-color: var(--sg-red);
    background: #fff8f9;
}

.data-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.saved-list {
    display: grid;
    gap: 10px;
}

.saved-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--sg-border);
    border-left: 5px solid var(--sg-yellow);
    border-radius: var(--radius-md);
    background: var(--sg-panel);
}

.toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 20;
    max-width: min(420px, calc(100vw - 40px));
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    color: var(--sg-white);
    background: var(--sg-black);
    box-shadow: var(--sg-shadow);
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

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

.card,
.public-match-card,
.setup-card,
.saved-item,
.team-card,
.table-wrap {
    animation: surface-in 220ms ease both;
}

@keyframes surface-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@media (max-width: 1440px), (hover: none) and (pointer: coarse) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        min-height: auto;
        gap: 16px;
        padding: 16px 20px;
        border-right: 0;
        border-bottom: 5px solid var(--sg-yellow);
    }

    .sidebar::before {
        margin: -16px -20px 0;
    }

    .brand {
        min-height: auto;
    }

    .main-nav {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 4px;
        scrollbar-width: thin;
    }

    .nav-button {
        flex: 0 0 auto;
        width: auto;
        justify-content: center;
        min-width: 124px;
        text-align: center;
    }

    .nav-button:hover,
    .nav-button:focus-visible {
        transform: translateY(-1px);
    }

    .sidebar-note {
        display: none;
    }

    .topbar {
        padding: 20px 24px;
    }

    .content {
        padding: 24px 24px 36px;
    }
}

@media (max-width: 1040px) {
    .public-header {
        flex-wrap: wrap;
        padding-inline: 18px;
    }

    .public-nav {
        order: 3;
        flex-basis: 100%;
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 4px;
        scrollbar-width: thin;
    }

    .public-nav a {
        flex: 0 0 auto;
    }

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

    .sidebar {
        position: static;
        min-height: auto;
        gap: 18px;
        border-right: 0;
        border-bottom: 5px solid var(--sg-yellow);
    }

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

    .nav-button {
        justify-content: center;
        text-align: center;
    }

    .nav-button:hover,
    .nav-button:focus-visible {
        transform: translateY(-1px);
    }

    .sidebar-note {
        display: none;
    }

    .topbar {
        flex-direction: column;
    }

    .topbar-actions {
        justify-content: flex-start;
    }

    .dashboard-grid,
    .setup-grid,
    .split-grid,
    .data-grid,
    .config-grid {
        grid-template-columns: 1fr;
    }

    .public-match-card {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .match-card-status {
        justify-self: start;
    }
}

@media (max-width: 700px) {
    body {
        font-size: 1rem;
    }

    .public-page {
        background:
            linear-gradient(180deg, var(--sg-black) 0 78px, transparent 78px),
            repeating-linear-gradient(135deg, rgba(23, 23, 23, 0.035) 0 1px, transparent 1px 18px),
            var(--sg-light-gray);
    }

    .public-header {
        gap: 10px;
        padding: 10px 12px;
        border-bottom-width: 3px;
    }

    .public-brand {
        gap: 10px;
    }

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

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

    .public-nav {
        gap: 8px;
        margin-inline: -12px;
        padding: 0 12px 3px;
    }

    .public-nav a {
        min-height: 42px;
        padding: 9px 13px;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.08);
        font-size: 0.92rem;
    }

    .public-main {
        padding: 14px 12px 28px;
    }

    .public-hero {
        min-height: auto;
        padding: 18px;
    }

    .public-hero::after {
        right: -28px;
        bottom: -50px;
        width: 190px;
        height: 190px;
    }

    .public-hero h1 {
        font-size: 1.92rem;
        line-height: 1.08;
    }

    .public-hero p {
        font-size: 0.95rem;
    }

    .public-content {
        padding-top: 16px;
    }

    .section-stack {
        gap: 16px;
    }

    .sidebar {
        padding: 18px;
    }

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

    .nav-button {
        justify-content: flex-start;
        text-align: left;
    }

    .topbar,
    .content {
        padding: 20px;
    }

    .topbar h1 {
        font-size: 1.62rem;
    }

    .panel {
        padding: 16px;
    }

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

    .stat-card {
        min-height: 104px;
        padding: 15px;
    }

    .stat-card strong {
        font-size: 1.74rem;
    }

    .section-title,
    .team-card-header,
    .saved-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        margin-bottom: 14px;
    }

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

    .public-focus-panel .section-title {
        flex-direction: row;
        align-items: flex-start;
    }

    .public-page .table-scroll-hint {
        display: block;
        margin: -2px 0 8px;
        color: var(--sg-muted);
        font-size: 0.86rem;
        font-weight: 800;
    }

    .public-page .table-wrap {
        width: calc(100% + 32px);
        margin-inline: -16px;
        border-right: 0;
        border-left: 0;
        border-radius: 0;
        box-shadow: inset -16px 0 18px -20px rgba(0, 0, 0, 0.45);
    }

    .public-page table {
        min-width: 620px;
        font-size: 0.9rem;
    }

    .public-page .standings-table {
        min-width: 680px;
    }

    .public-page th,
    .public-page td {
        padding: 10px 9px;
        white-space: nowrap;
    }

    .public-page .standings-table th:nth-child(2),
    .public-page .standings-table td:nth-child(2) {
        position: sticky;
        left: 0;
        min-width: 136px;
        max-width: 176px;
        white-space: normal;
        box-shadow: 8px 0 14px -13px rgba(0, 0, 0, 0.55);
    }

    .public-page .standings-table th:nth-child(2) {
        z-index: 3;
        background: var(--sg-black);
    }

    .public-page .standings-table td:nth-child(2) {
        z-index: 2;
        background: var(--sg-white);
        font-weight: 900;
    }

    .public-page .standings-table tbody tr:nth-child(even) td:nth-child(2) {
        background: #fcfcfc;
    }

    .public-page .standings-table tbody tr:hover td:nth-child(2) {
        background: #fffdf0;
    }

    .public-page .standings-table-block {
        display: none;
    }

    .public-page .standings-stack {
        gap: 22px;
    }

    .public-page .standings-mobile-list {
        display: grid;
        gap: 10px;
    }

    .standing-mobile-card {
        padding: 10px 11px;
        border: 1px solid var(--sg-border);
        border-left: 4px solid var(--sg-yellow);
        border-radius: var(--radius-md);
        background: linear-gradient(90deg, var(--sg-white), #fffdf0);
    }

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

    .standing-mobile-main strong {
        display: block;
        min-width: 0;
        font-size: 1rem;
        line-height: 1.18;
    }

    .standing-mobile-main p {
        margin: 3px 0 0;
        color: var(--sg-muted);
        font-size: 0.82rem;
        font-weight: 800;
        line-height: 1.25;
    }

    .standing-rank,
    .standing-points {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 32px;
        border-radius: var(--radius-sm);
        font-weight: 900;
    }

    .standing-rank {
        width: 32px;
        color: var(--sg-black);
        background: var(--sg-yellow);
    }

    .standing-points {
        padding: 5px 9px;
        color: var(--sg-white);
        background: var(--sg-black);
        white-space: nowrap;
    }

    .public-match-card {
        gap: 12px;
        padding: 13px;
        border-left-width: 6px;
    }

    .match-card-meta {
        grid-template-columns: 1fr auto;
        align-items: center;
        gap: 8px;
    }

    .match-card-meta strong {
        justify-self: end;
    }

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

    .button-row .button {
        width: auto;
    }

    .topbar-actions .button,
    .topbar-select {
        width: 100%;
        max-width: none;
    }

    .score-form {
        width: 100%;
        flex-wrap: wrap;
    }

    .match-card-teams {
        grid-template-columns: 1fr;
        gap: 8px;
        text-align: left;
    }

    .match-card-teams span,
    .match-card-teams span:last-child {
        text-align: left;
        white-space: normal;
        font-size: 1rem;
        line-height: 1.22;
    }

    .match-card-teams strong {
        justify-self: start;
        min-width: 76px;
    }

    .match-card-status {
        justify-self: start;
    }

    .public-team-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 440px) {
    .public-main {
        padding-inline: 10px;
    }

    .panel {
        padding: 14px;
    }

    .public-page .table-wrap {
        width: calc(100% + 28px);
        margin-inline: -14px;
    }

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

    .standing-points {
        grid-column: 2;
        justify-self: start;
        min-height: 28px;
    }

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

    .public-header .button {
        width: auto;
        min-height: 36px;
        padding: 7px 10px;
    }

    .public-brand span {
        max-width: 174px;
    }
}
