.game-app { display: flex; min-height: 100svh; flex-direction: column; background: var(--paper); }
.game-app__header { display: flex; min-height: 84px; align-items: center; justify-content: space-between; gap: 1.5rem; border-bottom: 1px solid var(--line); padding: 1rem 2.5rem; }
.game-app__brand, .game-app__navigation { display: flex; align-items: center; gap: 1.5rem; }
.game-app__brand .brand-lockup img { width: 36px; height: 36px; }
.game-app__brand .brand-wordmark { font-size: 2.25rem; }
.game-app__divider { width: 1px; height: 25px; background: var(--line-strong); }
.game-app__name { color: var(--ink); font-size: .88rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.game-app__exit { display: inline-flex; min-height: 44px; align-items: center; gap: .6rem; color: var(--muted); font-size: .76rem; text-decoration: none; }
.game-app__exit svg, .game-app__footer svg { width: 16px; height: 16px; }
.game-app .theme-toggle { width: 44px; height: 44px; }
.game-app__main { display: flex; flex: 1; flex-direction: column; }
.game-app__footer { display: flex; justify-content: space-between; gap: 1rem; border-top: 1px solid var(--line); padding: .8rem 2.5rem; color: var(--muted); font-size: .67rem; }
.game-app__footer a { display: inline-flex; align-items: center; gap: .4rem; color: inherit; text-decoration: none; }

.game-lobby { display: grid; width: min(100% - 6rem, 1080px); flex: 1; grid-template-columns: minmax(0, 1fr) 420px; align-items: center; gap: 6rem; margin: auto; padding-block: 2rem; }
.game-lobby__intro h1 { margin-top: 1.15rem; font-family: var(--font-display); font-size: clamp(4rem, 6.7vw, 6.3rem); font-weight: 400; letter-spacing: -.035em; line-height: .98; }
.game-lobby__description { max-width: 350px; margin-top: 1.5rem; color: var(--ink-soft); font-size: 1rem; line-height: 1.8; }
.game-lobby__illustration { display: flex; align-items: center; gap: 1.1rem; margin-top: 2.7rem; padding: .6rem .3rem; }
.game-preview-card { position: relative; display: flex; width: 144px; aspect-ratio: 1; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; border: 1px solid var(--line-strong); border-radius: 18px; box-shadow: 0 12px 25px #132e2110; }
.game-preview-card > span:last-child:not(.game-preview-card__check) { font-size: .58rem; letter-spacing: .14em; text-transform: uppercase; }
.game-preview-card--song { transform: rotate(-7deg); border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.game-preview-card__number { position: absolute; top: .7rem; left: .85rem; font-size: .6rem; opacity: .6; }
.game-preview-card--bird { transform: rotate(7deg); background: var(--wash); color: var(--accent); }
.game-preview-card--bird > svg { width: 50px; height: 50px; stroke-width: 1.2; }
.game-preview-card__check { position: absolute; right: .6rem; bottom: .6rem; display: grid; width: 20px; height: 20px; place-items: center; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: .65rem; }
.game-wave { display: flex; height: 38px; align-items: center; gap: 5px; }
.game-wave i { width: 3px; height: 25%; border-radius: 4px; background: currentColor; }
.game-wave i:nth-child(2), .game-wave i:nth-child(6) { height: 55%; }
.game-wave i:nth-child(3), .game-wave i:nth-child(5) { height: 80%; }
.game-wave i:nth-child(4) { height: 100%; }
.game-lobby__connection { color: var(--gold); font-family: var(--font-display); font-size: 2rem; }
.game-lobby__note { margin-top: 1.5rem; color: var(--muted); font-size: .72rem; }
.game-setup { border: 1px solid var(--line); border-radius: 20px; background: var(--surface); padding: 2rem; box-shadow: var(--shadow); }
.game-setup h2 { margin-top: .45rem; font-family: var(--font-display); font-size: 2.5rem; font-weight: 400; line-height: 1.15; }
.game-setup__field { margin-top: 1.8rem; }
.game-setup__field > label, .game-board-choice legend { display: block; margin-bottom: .6rem; font-size: .76rem; font-weight: 600; }
.game-setup__field > p { margin-top: .5rem; color: var(--muted); font-size: .68rem; line-height: 1.5; }
.game-board-choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-top: 1.6rem; }
.game-board-choice__option { position: relative; cursor: pointer; }
.game-board-choice__option input { position: absolute; top: 1rem; right: .85rem; width: 15px; height: 15px; accent-color: var(--accent); }
.game-board-choice__content { display: flex; height: 100%; flex-direction: column; align-items: start; border: 1px solid var(--line-strong); border-radius: 12px; padding: 1rem; transition: background .2s, border-color .2s; }
.game-board-choice__option:has(input:checked) .game-board-choice__content { border-color: var(--accent); background: var(--wash); box-shadow: inset 0 0 0 1px var(--accent); }
.game-board-choice__option:has(input:focus-visible) .game-board-choice__content { outline: 2px solid var(--accent); outline-offset: 4px; }
.game-board-choice__grid { display: grid; width: 43px; height: 43px; grid-template-columns: repeat(var(--preview-columns), 1fr); gap: 2px; margin-bottom: .8rem; }
.game-board-choice__grid i { border-radius: 1px; background: var(--muted); opacity: .5; }
.game-board-choice__option:has(input:checked) .game-board-choice__grid i { background: var(--accent); opacity: 1; }
.game-board-choice__content strong { font-size: .76rem; font-weight: 600; }
.game-board-choice__content small { margin-top: .2rem; color: var(--muted); font-size: .65rem; }
.game-setup__begin { width: 100%; min-height: 52px; justify-content: space-between; margin-top: 1.7rem; }
.game-setup__begin svg { width: 17px; height: 17px; }
.game-setup__hint { margin-top: .7rem; color: var(--muted); font-size: .68rem; text-align: center; }
.game-how-to { border-top: 1px solid var(--line); margin-top: 1.5rem; padding-top: 1rem; }
.game-how-to > summary { display: flex; min-height: 24px; align-items: center; justify-content: space-between; gap: 1rem; color: var(--ink-soft); font-size: .74rem; font-weight: 550; cursor: pointer; list-style: none; }
.game-how-to > summary::-webkit-details-marker { display: none; }
.game-how-to > summary > svg { width: 15px; height: 15px; transition: transform .2s; }
.game-how-to[open] > summary > svg { transform: rotate(180deg); }
.game-how-to > p, .game-how-to > ol, .game-how-to__more { margin-top: .85rem; color: var(--muted); font-size: .75rem; line-height: 1.8; }
.game-how-to > ol { padding-left: 1.1rem; list-style: decimal; }
.game-how-to__more > summary { cursor: pointer; }
.game-how-to__more .prose-content { margin-top: .75rem; font-size: .75rem; }

.game-session { display: grid; flex: 1; grid-template-columns: 286px minmax(0, 1fr); }
.game-rail { display: flex; flex-direction: column; border-right: 1px solid var(--line); padding: 2rem 2rem 1.5rem; }
.game-rail__heading h1 { margin-top: .8rem; font-family: var(--font-display); font-size: 2.5rem; font-weight: 400; letter-spacing: -.025em; line-height: 1.05; }
.game-rail__heading > p:last-child { margin-top: .9rem; color: var(--muted); font-size: .77rem; line-height: 1.8; }
.game-round { display: grid; gap: .25rem; border-block: 1px solid var(--line); margin-top: 1.4rem; padding-block: 1.2rem; }
.game-round__label { color: var(--muted); font-size: .6rem; letter-spacing: .1em; text-transform: uppercase; }
.game-round > strong { font-size: .92rem; font-weight: 600; }
.game-round > a { display: flex; width: fit-content; min-height: 30px; align-items: center; gap: .35rem; color: var(--muted); font-size: .68rem; text-decoration: none; }
.game-round > a svg { width: 13px; height: 13px; }
.game-progress { margin-top: 1.5rem; }
.game-progress__heading { display: flex; align-items: center; justify-content: space-between; color: var(--ink-soft); font-size: .75rem; }
.game-progress__heading svg { width: 20px; height: 20px; color: var(--muted); stroke-width: 1.3; }
.game-progress__count { display: flex; align-items: baseline; gap: .6rem; margin-top: .25rem; font-variant-numeric: tabular-nums; }
.game-progress__count strong { font-family: var(--font-display); font-size: 3.5rem; font-weight: 400; line-height: 1.2; }
.game-progress__count > span { color: var(--muted); font-size: 1.05rem; }
.game-progress progress { display: block; width: 100%; height: 5px; overflow: hidden; margin-top: .6rem; border: 0; border-radius: 5px; background: var(--line); color: var(--accent); appearance: none; }
.game-progress progress::-webkit-progress-bar { border-radius: 5px; background: var(--line); }
.game-progress progress::-webkit-progress-value { border-radius: 5px; background: var(--accent); transition: width .25s; }
.game-progress progress::-moz-progress-bar { border-radius: 5px; background: var(--accent); }
.game-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1.5rem; }
.game-stats dt { color: var(--muted); font-size: .66rem; }
.game-stats dd { margin-top: .25rem; font-size: 1.2rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.game-rail__bottom { margin-top: auto; padding-top: 1rem; }
.game-rail__bottom .game-how-to { margin-top: 1rem; }
.game-new-round { width: 100%; gap: .5rem; margin-top: 1rem; font-size: .74rem; }
.game-new-round svg { width: 16px; height: 16px; }
.game-stage { display: flex; min-width: 0; flex-direction: column; align-items: center; justify-content: center; background-color: var(--wash); background-image: radial-gradient(var(--line-strong) .65px, transparent .65px); background-size: 18px 18px; padding: 1.8rem 3rem 1.2rem; }
.game-stage__heading { display: flex; width: min(100%, 760px); align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; }
.game-stage__heading .eyebrow { font-size: .57rem; }
.game-stage__heading h2 { margin-top: .3rem; font-family: var(--font-display); font-size: 2rem; font-weight: 400; line-height: 1.15; }
.game-stage__size { border: 1px solid var(--line-strong); border-radius: 6px; background: var(--paper); padding: .3rem .65rem; color: var(--muted); font-size: .65rem; white-space: nowrap; }
.game-board { display: grid; width: min(100%, 760px); grid-template-columns: repeat(var(--columns), minmax(0, 1fr)); gap: clamp(6px, 1vw, 12px); padding: 0; list-style: none; }
.game-board > li { min-width: 0; }
.game-card { position: relative; display: block; width: 100%; aspect-ratio: 1; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 13px; background: var(--surface); padding: 0; color: var(--accent); box-shadow: 0 3px 0 color-mix(in srgb, var(--line-strong) 60%, var(--wash)); transition: border-color .2s, background .2s, transform .2s, box-shadow .2s; container-type: inline-size; }
.game-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 5px 0 color-mix(in srgb, var(--accent) 20%, var(--wash)); }
.game-card:active { transform: translateY(1px); box-shadow: none; }
.game-card-face { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8cqw; }
.game-card-number { position: absolute; top: 7cqw; left: 10cqw; color: var(--muted); font-size: clamp(9px, 9cqw, 12px); font-variant-numeric: tabular-nums; letter-spacing: .06em; }
.game-card-symbol { display: grid; width: 36cqw; height: 36cqw; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; }
.game-card-play { width: 15cqw; height: 15cqw; margin-left: 2cqw; stroke-width: 1.5; }
.game-card-caption { font-size: clamp(8px, 7cqw, 10px); letter-spacing: .17em; line-height: 1; text-transform: uppercase; }
.game-card-wave { display: none; height: 17cqw; align-items: center; gap: 3cqw; }
.game-card-wave i { width: 2cqw; height: 40%; border-radius: 2px; background: currentColor; }
.game-card-wave i:nth-child(2), .game-card-wave i:nth-child(4) { height: 70%; }
.game-card-wave i:nth-child(3) { height: 100%; }
.game-card-photo { display: none; width: 100%; height: 100%; object-fit: cover; }
.game-card-matched { position: absolute; right: 6cqw; bottom: 6cqw; display: none; width: 22cqw; height: 22cqw; max-width: 28px; max-height: 28px; align-items: center; justify-content: center; border-radius: 50%; background: var(--surface); color: var(--accent); font-size: clamp(10px, 13cqw, 16px); }
.game-card[data-status="1"] { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); box-shadow: 0 3px 0 var(--accent-hover); }
.game-card[data-status="1"] .game-card-number { color: inherit; opacity: .65; }
.game-card[data-status="1"] .game-card-symbol { border-color: currentColor; }
.game-card[data-status="1"] .game-card-play { display: none; }
.game-card[data-status="1"] .game-card-wave { display: flex; }
.game-card[data-status="1"] .game-card-wave i { animation: game-song-wave .6s ease-in-out infinite alternate; }
.game-card[data-status="1"] .game-card-wave i:nth-child(even) { animation-delay: -.3s; }
.game-card[data-status="2"] .game-card-face { display: none; }
.game-card[data-status="2"] .game-card-photo { display: block; }
.game-card[data-status="2"] .game-card-matched { display: flex; }
.game-status { min-height: 1.5em; max-width: 100%; margin-top: 1.3rem; color: var(--ink-soft); font-size: .76rem; text-align: center; }
.game-empty { display: grid; max-width: 400px; flex: 1; align-content: center; justify-items: center; padding-block: 3rem; text-align: center; }
.game-empty > svg { width: 60px; height: 60px; margin-bottom: 1rem; color: var(--muted); stroke-width: 1; }
.game-empty h3 { font-family: var(--font-display); font-size: 2rem; line-height: 1.2; }
.game-empty p { margin-block: .8rem 1.5rem; color: var(--muted); font-size: .85rem; }
.game-complete .modal-dialog { max-width: 520px; margin-top: 10svh; }
.game-complete .modal-content { padding: 2.5rem; text-align: center; }
.game-complete__mark { display: grid; width: 72px; height: 72px; place-items: center; margin: 0 auto 1.5rem; border-radius: 50%; background: var(--wash); color: var(--accent); }
.game-complete__mark svg { width: 38px; height: 38px; stroke-width: 1.3; }
.game-complete h2 { margin-block: .75rem 1rem; font-family: var(--font-display); font-size: 3rem; font-weight: 400; letter-spacing: -.02em; line-height: 1.05; }
.game-complete h2 + p { color: var(--muted); font-size: .88rem; line-height: 1.7; }
.game-complete__actions { display: grid; gap: .65rem; margin-top: 1.8rem; }
.game-complete__actions svg { width: 16px; height: 16px; }
.game-complete__change { display: inline-block; margin-top: 1.2rem; color: var(--muted); font-size: .75rem; }

@keyframes game-song-wave { from { transform: scaleY(.45); } to { transform: scaleY(1); } }
@container (max-width: 76px) {
    .game-card-caption { display: none; }
    .game-card-number { top: 5cqw; left: 8cqw; }
    .game-card-symbol { width: 40cqw; height: 40cqw; margin-top: 8cqw; }
}
@media (min-width: 961px) and (min-height: 650px) {
    .game-board { width: min(100%, 760px, calc(100svh - 320px)); }
    .game-stage__heading { width: min(100%, 760px, calc(100svh - 320px)); }
}
@media (max-width: 1100px) {
    .game-lobby { width: min(100% - 4rem, 1000px); grid-template-columns: minmax(0, 1fr) 390px; gap: 3rem; }
    .game-session { grid-template-columns: 250px minmax(0, 1fr); }
    .game-rail { padding-inline: 1.5rem; }
    .game-stage { padding-inline: 2rem; }
}
@media (max-width: 800px) {
    .game-app__header { min-height: 72px; padding: .8rem 1.5rem; }
    .game-app__footer { padding-inline: 1.5rem; }
    .game-lobby { grid-template-columns: minmax(0, 1fr) 340px; gap: 2rem; padding-block: 2.5rem; }
    .game-lobby__intro h1 { font-size: 4rem; }
    .game-lobby__illustration { gap: .75rem; }
    .game-preview-card { width: 110px; border-radius: 14px; }
    .game-setup { padding: 1.5rem; }
    .game-session { grid-template-columns: 1fr; }
    .game-rail { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.5rem; border-right: 0; border-bottom: 1px solid var(--line); padding: 1.4rem 1.5rem; }
    .game-rail__heading { grid-column: 1; }
    .game-rail__heading h1 { margin-top: .45rem; font-size: 2rem; }
    .game-rail__heading > p:last-child { display: none; }
    .game-round { grid-column: 1; gap: .1rem; border: 0; margin: 0; padding: 0; }
    .game-round__label { display: none; }
    .game-progress { grid-column: 2; grid-row: 1; margin: 0; }
    .game-progress__count strong { font-size: 2.75rem; }
    .game-stats { grid-column: 2; grid-row: 2; margin: 0; }
    .game-stats dd { font-size: 1rem; }
    .game-rail__bottom { display: flex; grid-column: 1 / -1; align-items: start; gap: 1.5rem; padding: 0; }
    .game-rail__bottom .game-how-to { flex: 1; border: 0; margin: 0; padding-top: .6rem; }
    .game-new-round { width: auto; min-height: 36px; margin: 0; padding: .35rem .8rem; }
    .game-stage { flex: 1; padding: 1.5rem; }
    .game-stage__heading h2 { font-size: 1.8rem; }
    .game-board { max-width: 560px; }
}
@media (max-width: 640px) {
    .game-app__header { gap: 1rem; padding-inline: 1rem; }
    .game-app__brand, .game-app__navigation { gap: .8rem; }
    .game-app__brand .brand-lockup { gap: .4rem; }
    .game-app__brand .brand-lockup img { width: 30px; height: 30px; }
    .game-app__brand .brand-wordmark { font-size: 1.9rem; }
    .game-app__name { font-size: .73rem; }
    .game-app__exit span { display: none; }
    .game-app__exit { width: 32px; justify-content: center; }
    .game-app__exit svg { width: 20px; height: 20px; }
    .game-app__footer { padding-inline: 1rem; font-size: .6rem; }
    .game-lobby { width: min(100% - 2rem, 440px); grid-template-columns: 1fr; gap: 2rem; padding-block: 2.2rem; }
    .game-lobby__intro h1 { font-size: 4.3rem; }
    .game-lobby__description { max-width: 320px; font-size: .9rem; }
    .game-lobby__illustration, .game-lobby__note { display: none; }
    .game-setup { border-radius: 16px; }
    .game-rail { padding-inline: 1rem; }
    .game-stage { padding: 1.4rem 1rem; }
    .game-stage__heading { margin-bottom: 1rem; }
    .game-stage__heading h2 { font-size: 1.6rem; }
    .game-stage__size { padding: .25rem .45rem; font-size: .6rem; }
    .game-card { border-radius: 8px; }
    .game-status { font-size: .7rem; }
    .game-complete .modal-content { padding: 2rem 1.5rem; }
    .game-complete h2 { font-size: 2.5rem; }
}
@media (prefers-reduced-motion: reduce) {
    .game-card, .game-board-choice__content, .game-how-to > summary > svg { transition: none; }
    .game-card[data-status="1"] .game-card-wave i { animation: none; }
    .game-card:hover { transform: none; }
}
@media (max-width: 380px) {
    .game-app__header { gap: .75rem; padding-inline: .75rem; }
    .game-app__brand { gap: .6rem; }
    .game-stage { padding-inline: .5rem; }
    .game-board { gap: 4px; }
    .game-lobby__intro h1 { font-size: 3.7rem; }
}
