:root {
    color-scheme: light;
    --ink: #132a25;
    --paper: #f3f0e7;
    --paper-deep: #e7e2d4;
    --lime: #d8f251;
    --coral: #f36c4f;
    --muted: #68746d;
    --line: rgba(19, 42, 37, 0.18);
    --shadow: 0 24px 70px rgba(19, 42, 37, 0.12);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--paper);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        linear-gradient(rgba(19, 42, 37, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(19, 42, 37, 0.035) 1px, transparent 1px),
        var(--paper);
    background-size: 32px 32px;
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
    font: inherit;
}

.site-header,
.site-footer,
.page-shell {
    width: min(1180px, calc(100% - 48px));
    margin-inline: auto;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 108px;
    border-bottom: 1px solid var(--line);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    color: inherit;
    font-size: 1.05rem;
    font-weight: 850;
    letter-spacing: 0.14em;
    text-decoration: none;
    text-transform: uppercase;
}

.brand-mark {
    width: 42px;
    height: auto;
    overflow: visible;
}

.brand-mark path {
    fill: var(--ink);
}

.brand-mark text {
    fill: var(--lime);
    font-size: 9px;
    font-weight: 850;
    text-anchor: middle;
}

.tagline,
.site-footer {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.page-shell {
    min-height: calc(100vh - 204px);
    padding-block: clamp(56px, 8vw, 110px);
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
    column-gap: clamp(32px, 8vw, 110px);
    align-items: end;
    margin-bottom: clamp(48px, 7vw, 88px);
}

.eyebrow,
.card-label {
    margin: 0 0 20px;
    color: var(--coral);
    font-size: 0.74rem;
    font-weight: 850;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.hero .eyebrow {
    grid-column: 1 / -1;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(3.6rem, 8vw, 7.5rem);
    font-weight: 500;
    letter-spacing: -0.065em;
    line-height: 0.85;
}

h2 {
    margin-bottom: 14px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2rem, 3.2vw, 3.3rem);
    font-weight: 500;
    letter-spacing: -0.045em;
    line-height: 1;
}

.intro {
    max-width: 39rem;
    margin-bottom: 0;
    color: var(--muted);
    font-size: clamp(1.05rem, 1.5vw, 1.25rem);
    line-height: 1.65;
}

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

.choice-card {
    position: relative;
    display: flex;
    min-height: 390px;
    padding: clamp(28px, 4vw, 48px);
    overflow: hidden;
    border: 1px solid var(--line);
    flex-direction: column;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.42);
    box-shadow: var(--shadow);
}

.choice-card--create::after {
    position: absolute;
    right: -66px;
    bottom: -88px;
    width: 240px;
    height: 210px;
    background: var(--lime);
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
    content: "";
    opacity: 0.7;
    transform: rotate(-12deg);
    z-index: 0;
}

.choice-card > * {
    position: relative;
    z-index: 1;
}

.choice-card p:not(.card-label) {
    max-width: 29rem;
    color: var(--muted);
    line-height: 1.6;
}

.choice-number {
    align-self: flex-end;
    color: var(--muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
}

.player-form {
    display: grid;
    gap: 10px;
}

.field-label {
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.player-form input {
    width: 100%;
    min-height: 58px;
    padding: 0 18px;
    border: 1px solid var(--line);
    border-radius: 0;
    background: rgba(255, 255, 255, 0.58);
    color: var(--ink);
}

.player-form input[aria-invalid="true"] {
    border-color: var(--coral);
}

.player-form .button {
    margin-top: 4px;
}

.form-error,
.choice-card .form-error {
    margin: 0;
    color: var(--coral);
    font-size: 0.85rem;
    font-weight: 700;
}

.button {
    display: inline-flex;
    width: 100%;
    min-height: 58px;
    padding: 0 22px;
    border: 1px solid transparent;
    align-items: center;
    justify-content: space-between;
    color: var(--ink);
    font-weight: 800;
    text-decoration: none;
}

.button--primary {
    border-color: var(--ink);
    background: var(--ink);
    color: #fff;
    cursor: pointer;
    transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.button--primary:hover {
    background: var(--lime);
    color: var(--ink);
    transform: translateY(-2px);
}

.button--secondary {
    width: auto;
    border-color: var(--ink);
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    gap: 18px;
    transition: background 160ms ease, color 160ms ease;
}

.button--secondary:hover {
    background: var(--ink);
    color: #fff;
}

.button:focus-visible,
input:focus-visible,
.brand:focus-visible,
.text-link:focus-visible {
    outline: 3px solid var(--coral);
    outline-offset: 4px;
}

.choice-card--join {
    background: rgba(231, 226, 212, 0.72);
    box-shadow: none;
}

.join-controls {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 8px;
}

.join-controls input {
    min-width: 0;
    min-height: 58px;
    padding: 0 18px;
    border: 1px solid var(--line);
    border-radius: 0;
    background: rgba(255, 255, 255, 0.45);
    color: var(--muted);
}

.join-controls input[aria-invalid="true"] {
    border-color: var(--coral);
}

.join-controls .form-error {
    grid-column: 1 / -1;
}

.button--disabled {
    width: auto;
    border-color: var(--line);
    background: transparent;
    color: var(--muted);
}

.game-created {
    display: grid;
    grid-template-columns: minmax(320px, 0.8fr) minmax(400px, 1.2fr);
    gap: clamp(48px, 9vw, 120px);
    align-items: center;
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 8px;
    border-radius: 50%;
    background: #58a867;
    box-shadow: 0 0 0 5px rgba(88, 168, 103, 0.15);
}

.status-dot--started {
    background: var(--coral);
    box-shadow: 0 0 0 5px rgba(243, 108, 79, 0.15);
}

.game-created .intro {
    margin-top: 32px;
}

.game-identifiers {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 28px;
    margin-block: 40px 28px;
}

.game-code {
    padding-block: 20px;
    border-block: 1px solid var(--line);
}

.game-reference {
    margin-block: 40px 28px;
}

.player-form--join {
    max-width: 34rem;
    margin-bottom: 28px;
}

.game-code span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.game-code code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    letter-spacing: 0.08em;
}

.lobby-roster {
    margin-bottom: 30px;
    padding: 24px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.38);
}

.lobby-roster__heading {
    display: flex;
    margin-bottom: 18px;
    align-items: baseline;
    justify-content: space-between;
}

.lobby-roster__heading h2 {
    margin: 0;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 850;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.lobby-roster__heading > span {
    display: grid;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    place-items: center;
    background: var(--lime);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.75rem;
    font-weight: 800;
}

.player-list {
    display: grid;
    gap: 1px;
    margin: 0 0 20px;
    padding: 0;
    list-style: none;
}

.player-list li {
    display: flex;
    min-height: 46px;
    padding: 0 14px;
    align-items: center;
    justify-content: space-between;
    background: rgba(19, 42, 37, 0.055);
    font-weight: 750;
}

.player-list small {
    color: var(--muted);
    font-size: 0.65rem;
    font-weight: 850;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.lobby-note {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.text-link {
    color: inherit;
    font-weight: 750;
    text-underline-offset: 4px;
}

.board-placeholder {
    width: 100%;
    padding: 8%;
    background: var(--ink);
    box-shadow: var(--shadow);
}

.board-placeholder svg {
    display: block;
    width: 100%;
    height: auto;
}

.board-lines {
    fill: none;
    stroke: rgba(216, 242, 81, 0.33);
    stroke-width: 1.5;
}

.board-placeholder text {
    fill: var(--paper);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-anchor: middle;
    text-transform: uppercase;
}

.board-placeholder--started .board-lines {
    stroke: rgba(216, 242, 81, 0.65);
}

.error-panel {
    max-width: 720px;
}

.error-panel .intro {
    margin-block: 34px;
}

.error-panel .button {
    max-width: 260px;
}

.site-footer {
    display: flex;
    min-height: 96px;
    border-top: 1px solid var(--line);
    align-items: center;
    justify-content: space-between;
}

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

@media (max-width: 760px) {
    .site-header,
    .site-footer,
    .page-shell {
        width: min(100% - 28px, 1180px);
    }

    .site-header {
        min-height: 84px;
    }

    .tagline {
        display: none;
    }

    .page-shell {
        min-height: calc(100vh - 164px);
        padding-block: 48px 64px;
    }

    .hero,
    .choice-grid,
    .game-created {
        grid-template-columns: 1fr;
    }

    .hero {
        gap: 30px;
    }

    .hero .eyebrow {
        grid-column: auto;
    }

    h1 {
        font-size: clamp(3.2rem, 17vw, 5.2rem);
    }

    .choice-card {
        min-height: 350px;
    }

    .join-controls {
        grid-template-columns: 1fr;
    }

    .button--disabled,
    .button--secondary {
        width: 100%;
    }

    .game-created {
        gap: 52px;
    }

    .game-identifiers {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .game-code + .game-code {
        border-top: 0;
    }

    .board-placeholder {
        order: -1;
    }

    .site-footer {
        min-height: 80px;
    }

    .site-footer span:last-child {
        display: none;
    }
}

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