:root {
    color-scheme: dark;
    --bg: #10131a;
    --panel: #191e28;
    --line: #303746;
    --text: #f2f3f5;
    --muted: #aeb7c7;
    --accent: #d9fa72;
    --error: #ff9c9c;
    font-family: Inter, system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
}
* {
    box-sizing: border-box;
}
body {
    margin: 0;
}
a {
    color: inherit;
    text-underline-offset: 4px;
}
button,
input,
select,
textarea {
    font: inherit;
}
button,
.button {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #252d3b;
    color: var(--text);
    padding: 0.65rem 0.95rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
button:hover,
.button:hover {
    border-color: var(--accent);
}
button:disabled {
    opacity: 0.5;
    cursor: wait;
}
.primary {
    background: var(--accent);
    color: #18200c;
    border-color: var(--accent);
    font-weight: 700;
}
.danger {
    color: var(--error);
}
.site-header {
    padding: 1.2rem max(5vw, 1rem);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid var(--line);
}
.brand {
    font-weight: 900;
    letter-spacing: 0.12em;
    text-decoration: none;
}
.brand span {
    color: var(--accent);
}
nav,
.actions {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}
#session {
    font-size: 0.85rem;
    color: var(--muted);
}
main {
    max-width: 1240px;
    margin: auto;
    padding: 2rem 1.2rem 5rem;
}
.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.13em;
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 700;
}
h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    letter-spacing: -0.04em;
    margin: 0.6rem 0;
}
h2 {
    font-size: 1.35rem;
    margin: 0 0 1rem;
}
h3 {
    font-size: 1rem;
}
p {
    line-height: 1.65;
}
.muted,
small {
    color: var(--muted);
}
.hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.hero p {
    max-width: 720px;
    color: var(--muted);
}
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: 1rem;
}
.card,
.panel,
details {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 1.3rem;
    margin-bottom: 1rem;
}
.card h2 {
    margin-top: 1rem;
}
.card a {
    text-decoration: none;
}
.card:hover {
    border-color: #687351;
}
.badge {
    display: inline-block;
    border: 1px solid var(--line);
    border-radius: 30px;
    padding: 0.25rem 0.65rem;
    font-size: 0.75rem;
    color: var(--muted);
}
.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
    gap: 1rem;
    margin: 1.3rem 0;
}
.metric {
    background: var(--panel);
    border: 1px solid var(--line);
    padding: 1rem;
    border-radius: 10px;
}
.metric strong {
    display: block;
    font-size: 1.8rem;
}
.metric span {
    font-size: 0.8rem;
    color: var(--muted);
}
.tabs {
    display: flex;
    gap: 1rem;
    overflow: auto;
    border-bottom: 1px solid var(--line);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
}
.tabs a {
    white-space: nowrap;
    color: var(--muted);
    text-decoration: none;
    padding: 0.3rem;
}
.tabs a[aria-current='page'] {
    color: var(--accent);
    border-bottom: 2px solid var(--accent);
}
label {
    display: block;
    color: var(--muted);
    font-size: 0.85rem;
    margin-bottom: 0.9rem;
}
input,
select,
textarea {
    display: block;
    width: 100%;
    margin-top: 0.4rem;
    padding: 0.7rem;
    border-radius: 7px;
    background: var(--bg);
    border: 1px solid var(--line);
    color: var(--text);
}
textarea {
    min-height: 240px;
    resize: vertical;
    font-family: ui-monospace, monospace;
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0 1rem;
}
form p {
    font-size: 0.85rem;
    color: var(--muted);
}
.table-wrap {
    overflow: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}
th {
    color: var(--muted);
    font-weight: 500;
    white-space: nowrap;
}
td,
th {
    padding: 0.85rem 0.65rem;
    border-bottom: 1px solid var(--line);
}
td:first-child,
th:first-child {
    padding-left: 0;
}
tr:last-child td {
    border-bottom: 0;
}
.empty {
    padding: 2rem;
    color: var(--muted);
    text-align: center;
}
.error {
    color: var(--error);
}
.bar {
    display: block;
    height: 5px;
    background: var(--accent);
    border-radius: 3px;
    margin-top: 6px;
}
.result {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}
.result select {
    width: 140px;
    margin: 0;
}
.result button {
    padding: 0.5rem;
}
.pairing td {
    vertical-align: middle;
}
summary {
    cursor: pointer;
    font-weight: 600;
}
.score-note {
    font-size: 0.85rem;
    color: var(--muted);
}
dialog {
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 12px;
    width: min(650px, 94vw);
    max-height: 90vh;
    padding: 1.8rem;
}
dialog::backdrop {
    background: #000b;
}
pre {
    white-space: pre-wrap;
    line-height: 1.65;
}
.close {
    float: right;
}
#notice {
    position: fixed;
    bottom: 1.2rem;
    left: 50%;
    transform: translateX(-50%);
    max-width: 90vw;
    background: var(--accent);
    color: #18200c;
    border-radius: 8px;
    padding: 0.8rem 1.2rem;
    display: none;
    z-index: 10;
}
#notice.error {
    background: #ffb3b3;
    color: #350606;
}
:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}
.split {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1rem;
}
.me {
    color: var(--accent);
}
.link-button {
    border: 0;
    background: none;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 4px;
    color: var(--accent);
}
@media (max-width: 700px) {
    .site-header,
    .hero {
        flex-direction: column;
    }
    .split {
        grid-template-columns: 1fr;
    }
    .result {
        flex-wrap: wrap;
    }
    .site-header nav {
        gap: 0.7rem;
    }
    main {
        padding-top: 1.3rem;
    }
    td,
    th {
        padding: 0.7rem 0.5rem;
    }
}

[hidden] {
    display: none !important;
}
#account-modes {
    margin: 1rem 0;
}
#account-modes [aria-pressed='true'] {
    border-color: var(--accent);
    color: var(--accent);
}
#join-dialog h2 {
    padding-right: 2rem;
}
.round-clock {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 1.2rem 0;
}
.round-clock strong {
    font-size: clamp(2.5rem, 8vw, 5rem);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.04em;
}
.round-clock span {
    color: var(--muted);
}
.round-clock .expired {
    color: var(--error);
}
.my-match {
    margin-top: 1.5rem;
    border-top: 1px solid var(--line);
    padding-top: 1rem;
}
.tournament-live {
    border-color: #687351;
}

.player-report {
    border-top: 1px solid var(--line);
    padding-top: 1rem;
    margin-top: 1rem;
}
.player-report .result {
    align-items: flex-end;
}
.player-report label {
    margin-bottom: 0;
}

.dashboard-heading,
.notification-settings,
.round-alert {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.dashboard-heading {
    margin-top: 1.5rem;
}
.dashboard-heading p {
    margin: 0.4rem 0;
}
.dashboard-heading [aria-current='page'] {
    border-color: var(--accent);
    color: var(--accent);
}
.dashboard-tabs {
    margin: 1rem 0;
}
.notification-settings {
    justify-content: flex-start;
    margin-bottom: 1.4rem;
    font-size: 0.85rem;
}
.notification-settings span {
    max-width: 38rem;
}
.round-alert {
    max-width: 1160px;
    margin: 1rem auto 0;
    padding: 1rem 1.4rem;
    border: 1px solid var(--accent);
    border-radius: 12px;
    background: var(--panel, #20241e);
}
.round-alert p {
    flex: 1 1 15rem;
    margin: 0;
}
@media (max-width: 600px) {
    .round-alert {
        margin: 1rem;
    }
}

.tournament-context {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
