:root {
    color-scheme: light dark;
    --ink: #1d1f24;
    --muted: #555b66;
    --ground: #f6f4ef;
    --panel: #ffffff;
    --line: #cfcac0;
    --accent: #0b6e4f;
    --red: #b3261e;
    --tile: #fffdf7;
    --focus: #1a5fd0;
    font-family: system-ui, sans-serif;
    line-height: 1.5;
}

@media (prefers-color-scheme: dark) {
    :root {
        --ink: #eceae4;
        --muted: #b4b0a8;
        --ground: #17181b;
        --panel: #212327;
        --line: #3d4047;
        --accent: #5fd3a8;
        --red: #ff8a80;
        --tile: #2c2e33;
        --focus: #8ab4ff;
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0 auto;
    max-width: 60rem;
    padding: 1rem;
    color: var(--ink);
    background: var(--ground);
}

h1 {
    margin: 0 0 1rem;
    font-size: 1.5rem;
}

h2 {
    font-size: 1.25rem;
}

h3 {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

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

footer {
    margin-top: 2rem;
    color: var(--muted);
    font-size: 0.9rem;
}

button,
select {
    font: inherit;
    min-height: 2.75rem;
    padding: 0.4rem 1rem;
    color: var(--ink);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    cursor: pointer;
}

button[aria-pressed="true"] {
    color: var(--panel);
    background: var(--accent);
    border-color: var(--accent);
}

:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

fieldset {
    border: 1px solid var(--line);
    border-radius: 0.5rem;
}

fieldset label {
    display: block;
    padding: 0.25rem 0;
}

.seats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 0.75rem;
    padding: 0;
    list-style: none;
}

.seats li {
    padding: 0.75rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 0.5rem;
}

.seats p {
    margin: 0.25rem 0 0;
    color: var(--muted);
}

.hand,
.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tile {
    min-width: 2.75rem;
    padding: 0.5rem 0.6rem;
    font-size: 1rem;
    font-weight: 600;
    background: var(--tile);
}

.tile.red {
    color: var(--red);
}

.tile.drawn {
    margin-left: 1rem;
}

.tile[aria-disabled="true"] {
    cursor: default;
    opacity: 0.7;
}

.keys {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem 1rem;
}

.keys dd {
    margin: 0;
}

kbd {
    padding: 0 0.4rem;
    border: 1px solid var(--line);
    border-radius: 0.25rem;
}

dialog {
    max-width: 32rem;
    color: var(--ink);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 0.75rem;
}

dialog::backdrop {
    background: rgb(0 0 0 / 0.4);
}

table {
    border-collapse: collapse;
}

caption {
    text-align: start;
    font-weight: 600;
}

th,
td {
    padding: 0.4rem 1rem 0.4rem 0;
    text-align: start;
    border-bottom: 1px solid var(--line);
}

/* A flag sits in the line of the handle it follows, outlined so a white field shows. */
.flag {
    height: 0.9em;
    width: auto;
    vertical-align: -0.1em;
    outline: 1px solid var(--line);
}

.flag.neutral {
    width: 1.2em;
    outline: none;
    color: var(--muted);
}

.chart {
    display: block;
    width: 100%;
    max-width: 40rem;
    height: auto;
    margin-block: 1rem;
    color: var(--accent);
}

.hands {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0;
    list-style: none;
}

.code {
    font-family: ui-monospace, monospace;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.2em;
}

.invite {
    overflow-wrap: anywhere;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
}
