:root {
    --bg-top: #f5efe4;
    --bg-bottom: #e3ecf1;
    --ink: #1f2f2d;
    --muted: #6d675e;
    --panel: rgba(255, 250, 242, 0.86);
    --panel-strong: rgba(255, 251, 246, 0.96);
    --line: rgba(81, 69, 53, 0.16);
    --accent: #c85d31;
    --accent-strong: #9e4620;
    --teal: #216b67;
    --shadow: 0 20px 50px rgba(57, 42, 29, 0.14);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(200, 93, 49, 0.18), transparent 32%),
        radial-gradient(circle at top right, rgba(33, 107, 103, 0.16), transparent 28%),
        linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: linear-gradient(rgba(255, 255, 255, 0.18) 1px, transparent 1px);
    background-size: 100% 36px;
    pointer-events: none;
    opacity: 0.45;
}

a {
    color: inherit;
}

.page-shell {
    position: relative;
    max-width: 1500px;
    margin: 0 auto;
    padding: 28px;
}

.topbar,
.table-card {
    background: var(--panel);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--shadow);
    animation: rise 0.45s ease-out both;
}

.topbar {
    display: grid;
    gap: 14px;
    padding: 18px 20px;
    border-radius: 24px;
}

.topbar-main {
    display: flex;
    align-items: baseline;
    justify-content: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}

.topbar h1 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.8rem, 3.4vw, 2.8rem);
    line-height: 1;
}

.controls-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px 14px;
    align-items: center;
}

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

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 104px;
    padding: 10px 16px;
    border-radius: 999px;
    background: var(--accent);
    color: #fffaf5;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 10px 24px rgba(200, 93, 49, 0.28);
}

.button:hover {
    background: var(--accent-strong);
}

.button-secondary {
    background: rgba(33, 107, 103, 0.12);
    color: var(--teal);
    box-shadow: none;
}

.button-secondary:hover {
    background: rgba(33, 107, 103, 0.18);
}

.button-disabled {
    background: rgba(93, 88, 82, 0.12);
    color: rgba(31, 47, 45, 0.45);
    box-shadow: none;
    cursor: not-allowed;
}

.week-range {
    margin: 0;
    padding: 0 4px;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 700;
    text-align: center;
}

.group-form {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: nowrap;
}

.group-form label {
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.group-form input {
    width: 140px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 251, 246, 0.92);
    color: var(--ink);
    font: inherit;
}

.button-small {
    min-width: 0;
    padding: 9px 12px;
    border: 0;
    font: inherit;
    cursor: pointer;
}

.table-card {
    margin-top: 14px;
    border-radius: 30px;
    overflow: hidden;
}

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

.scoreboard {
    width: 100%;
    min-width: 1080px;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
}

.player-col {
    width: 210px;
}

.day-col {
    width: 124px;
}

.scoreboard thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 16px 14px;
    background: var(--panel-strong);
    border-bottom: 1px solid var(--line);
}

.player-heading {
    left: 0;
    z-index: 4;
    min-width: 210px;
    text-align: left;
}

.day-card {
    display: grid;
    gap: 4px;
    text-align: left;
}

.day-name {
    color: var(--accent-strong);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.day-date {
    font-size: 1.05rem;
    font-weight: 700;
}

.day-puzzle {
    color: var(--muted);
    font-size: 0.84rem;
}

.scoreboard tbody th,
.scoreboard tbody td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

.player-cell {
    position: sticky;
    left: 0;
    z-index: 3;
    min-width: 210px;
    background: rgba(250, 244, 234, 0.96);
    text-align: left;
}

.player-name {
    display: block;
    font-size: 1rem;
    font-weight: 800;
}

.player-meta {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 600;
}

.result-cell {
    background: rgba(255, 255, 255, 0.58);
}

.result-cell pre {
    margin: 0;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 0.94rem;
    line-height: 1.12;
    white-space: pre;
}

.result-empty {
    background: rgba(127, 144, 145, 0.08);
}

.empty-pill {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.empty-pill {
    color: rgba(31, 47, 45, 0.48);
    background: rgba(93, 88, 82, 0.09);
}

.empty-state {
    padding: 56px 28px;
    text-align: center;
}

.empty-state h2 {
    margin: 0 0 10px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2rem;
}

.empty-state p {
    margin: 0;
    color: var(--muted);
    font-size: 1rem;
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1100px) {
    .controls-row {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .week-range {
        text-align: left;
        padding: 0;
    }

    .group-form {
        justify-content: flex-start;
    }
}

@media (max-width: 720px) {
    .page-shell {
        padding: 16px;
    }

    .topbar {
        padding: 16px;
        border-radius: 24px;
    }

    .button {
        width: 100%;
        min-width: 0;
        padding: 10px 12px;
    }

    .hero-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .week-range {
        font-size: 0.84rem;
        line-height: 1.3;
        text-align: left;
    }

    .group-form {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        align-items: center;
    }

    .group-form input {
        width: 100%;
    }

    .player-heading,
    .player-cell {
        min-width: 156px;
    }

    .player-col {
        width: 156px;
    }

    .scoreboard {
        min-width: 1020px;
    }

    .day-col {
        width: 124px;
    }

    .scoreboard thead th {
        padding: 12px 10px;
    }

    .scoreboard tbody th,
    .scoreboard tbody td {
        padding: 12px 10px;
    }

    .day-name {
        font-size: 0.72rem;
    }

    .day-date {
        font-size: 0.92rem;
    }

    .day-puzzle {
        font-size: 0.76rem;
    }

    .player-name {
        font-size: 0.92rem;
    }

    .player-meta {
        font-size: 0.78rem;
    }

    .result-cell pre {
        font-size: 0.86rem;
    }
}
