/* CISA multiplayer game hub */

.game-shell {
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
}

.game-hero {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(180px, 0.3fr);
    gap: clamp(1.25rem, 4vw, 3.5rem);
    align-items: center;
    min-height: 410px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    padding: clamp(1.6rem, 5vw, 4.5rem);
    border: 1px solid rgba(255, 255, 255, 0.24);
    color: #fff;
    background:
        radial-gradient(circle at 87% 16%, rgba(219, 187, 91, 0.35), transparent 24rem),
        linear-gradient(135deg, #171d2b 0%, #3a1720 58%, #7a1611 100%);
    box-shadow: 10px 10px 0 rgba(28, 25, 23, 0.09);
}

.game-hero::before,
.game-hero::after {
    position: absolute;
    z-index: -1;
    content: "";
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;
}

.game-hero::before {
    width: 31rem;
    height: 31rem;
    right: -14rem;
    bottom: -22rem;
}

.game-hero::after {
    width: 17rem;
    height: 17rem;
    right: 7rem;
    top: -11rem;
}

.game-hero-copy {
    position: relative;
    z-index: 1;
}

.game-eyebrow,
.game-section-kicker,
.game-gate-kicker,
.game-card-kicker {
    margin: 0;
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 800;
    line-height: 1.4;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.game-eyebrow {
    color: #f1d67c;
}

.game-title {
    max-width: 780px;
    margin: 0.7rem 0 1rem;
    font-size: clamp(2.25rem, 6vw, 5rem);
    line-height: 1.02;
    color: #fff;
    text-wrap: balance;
}

.game-lead {
    max-width: 760px;
    margin: 0;
    color: rgba(255, 255, 255, 0.82);
    font-size: clamp(1rem, 2vw, 1.2rem);
    line-height: 1.75;
}

.privacy-note {
    display: inline-flex;
    align-items: flex-start;
    gap: 0.65rem;
    max-width: 720px;
    margin-top: 1.4rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.09);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.88rem;
    line-height: 1.55;
    backdrop-filter: blur(5px);
}

.privacy-note-icon {
    flex: 0 0 auto;
}

.game-hero-art {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(3, 3rem);
    justify-content: center;
    gap: 0.45rem;
    width: 100%;
    color: #241b19;
}

.game-hero-art span {
    display: grid;
    width: 3rem;
    height: 4.7rem;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 0.35rem;
    background: linear-gradient(155deg, #fffdf7, #e9dcae);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
    font-weight: 900;
    transform: rotate(-7deg);
}

.game-hero-art span:nth-child(2) {
    transform: translateY(-0.8rem);
}

.game-hero-art span:nth-child(3) {
    transform: rotate(7deg);
}

.game-hero-art strong {
    grid-column: 1 / -1;
    padding-top: 0.65rem;
    color: #f1d67c;
    font-size: 0.72rem;
    letter-spacing: 0.28em;
    text-align: center;
}

/* Authentication gate */

.game-gate {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 1.1rem;
    align-items: center;
    margin: 1.5rem 0 3rem;
    padding: 1.15rem 1.25rem;
    border: 1px solid #c6a544;
    border-left: 5px solid var(--gold);
    background: linear-gradient(120deg, #fffaf0, #f5edda);
    box-shadow: 5px 5px 0 rgba(122, 87, 18, 0.08);
}

.game-gate.hidden,
.game-gate[hidden] {
    display: none !important;
}

.game-gate-icon {
    display: grid;
    width: 3.5rem;
    height: 3.5rem;
    place-items: center;
    border-radius: 50%;
    background: #fff;
    font-size: 1.7rem;
    box-shadow: inset 0 0 0 1px var(--line);
}

.game-gate-kicker {
    margin-bottom: 0.18rem;
    color: var(--maroon);
}

.game-gate h2 {
    margin: 0 0 0.2rem;
    color: var(--ink);
    font-size: clamp(1.35rem, 3vw, 1.85rem);
    line-height: 1.25;
}

.game-gate p:not(.game-gate-kicker) {
    margin: 0;
    color: var(--ink-muted);
    font-size: 0.95rem;
    line-height: 1.55;
}

.game-gate-actions,
.game-toolbar-actions,
.room-actions,
.setup-actions,
.inline-actions,
.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

/* Picker */

.game-picker-section {
    scroll-margin-top: 7.5rem;
}

.game-section-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.52fr);
    gap: 1.5rem;
    align-items: end;
    margin: 0 0 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--line);
}

.game-section-heading.compact {
    margin-bottom: 0;
}

.game-section-kicker {
    color: var(--maroon);
}

.game-section-heading h2 {
    margin: 0.25rem 0 0;
    font-size: clamp(1.8rem, 4vw, 2.65rem);
    line-height: 1.2;
}

.game-section-heading > p,
.game-section-aside > p {
    margin: 0;
    color: var(--ink-muted);
    line-height: 1.6;
}

.game-section-aside {
    display: grid;
    justify-items: start;
    gap: 0.5rem;
}

.join-room-shortcut {
    min-height: 44px;
    padding: 0.35rem 0;
    border-bottom: 1px solid currentColor;
    color: var(--maroon);
    font-weight: 800;
    text-align: left;
}

.join-room-shortcut:hover {
    color: #5e0c08;
}

.game-picker {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.15rem;
}

.game-card {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 380px;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    padding: clamp(1.35rem, 3vw, 2.2rem);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    box-shadow: 8px 8px 0 rgba(28, 25, 23, 0.09);
}

.game-card::after {
    position: absolute;
    right: -7rem;
    bottom: -8rem;
    width: 17rem;
    height: 17rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 50%;
    content: "";
}

.game-card.avalon {
    background: linear-gradient(145deg, #13213a 0%, #2b416a 60%, #94702b 100%);
}

.game-card.werewolf {
    background: linear-gradient(145deg, #20171a 0%, #55232a 60%, #861712 100%);
}

.game-card.valorant {
    background: linear-gradient(145deg, #101820 0%, #273a45 58%, #c3424d 100%);
}

.game-card.honor-kings {
    background: linear-gradient(145deg, #24160a 0%, #744116 58%, #c7983e 100%);
}

.game-card.league {
    background: linear-gradient(145deg, #071c2c 0%, #123a52 58%, #8d7026 100%);
}

.game-card.delta-force {
    background: linear-gradient(145deg, #111b17 0%, #21443a 58%, #7a8d35 100%);
}

.game-icon {
    font-size: 3.1rem;
    line-height: 1;
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.28));
}

.game-card-kicker {
    margin-top: 1.15rem;
    color: rgba(255, 255, 255, 0.6);
}

.game-card h3 {
    margin: 0.18rem 0 0.55rem;
    color: #fff;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    line-height: 1.2;
}

.game-card p:not(.game-card-kicker) {
    margin: 0;
    color: rgba(255, 255, 255, 0.82);
    line-height: 1.65;
}

.game-meta,
.member-badges,
.phase-progress,
.step-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.game-meta {
    margin-top: 1rem;
}

.game-tag {
    padding: 0.28rem 0.52rem;
    border: 1px solid rgba(255, 255, 255, 0.34);
    background: rgba(0, 0, 0, 0.13);
    font-size: 0.76rem;
    line-height: 1.4;
}

.game-start {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    min-height: 48px;
    margin-top: 1.4rem;
    padding: 0.78rem 1rem;
    border: 1px solid #fff;
    background: #fff;
    color: #68120f;
    font-weight: 850;
    line-height: 1.35;
    text-align: center;
    transition: transform 160ms ease, background-color 160ms ease;
}

.game-start:hover {
    background: #f8e6ae;
    transform: translateY(-2px);
}

/* Dynamic multiplayer workspace */

.game-workspace {
    scroll-margin-top: 7.5rem;
    margin-top: 2.4rem;
}

.game-workspace:has(#game-app:empty) {
    margin-top: 0;
}

.game-status:empty,
#game-app:empty {
    display: none;
}

.game-status:not(:empty) {
    margin-bottom: 0.8rem;
}

.game-status.error {
    padding: 0.85rem 1rem;
    border: 1px solid #d9b9b4;
    border-left: 4px solid #a62018;
    background: #fff0ee;
    color: #76110d;
    font-weight: 700;
    line-height: 1.55;
}

.choice-group {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.game-alert,
.status-message,
.error-message,
.success-message {
    padding: 0.85rem 1rem;
    border: 1px solid var(--line);
    border-left: 4px solid var(--gold);
    background: #fff8df;
    line-height: 1.55;
}

.game-alert.error,
.status-message.error,
.error-message {
    border-left-color: #a62018;
    background: #fff0ee;
    color: #76110d;
}

.game-alert.success,
.status-message.success,
.success-message {
    border-left-color: #34725b;
    background: #eff8f3;
    color: #205640;
}

.game-board,
.room-shell,
.room-entry,
.room-card,
.game-panel {
    border: 1px solid var(--line);
    background: var(--white);
    box-shadow: 8px 8px 0 rgba(28, 25, 23, 0.07);
}

.game-toolbar,
.room-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.2rem;
    border-bottom: 1px solid var(--line);
    background: var(--paper-dark);
}

.game-toolbar-title,
.room-title {
    margin: 0;
    color: var(--maroon);
    font-size: clamp(1.2rem, 3vw, 1.55rem);
    font-weight: 850;
    line-height: 1.3;
}

.game-body,
.room-body,
.game-panel-body {
    padding: clamp(1rem, 4vw, 2.2rem);
}

.game-heading,
.room-heading,
.panel-heading {
    margin: 0 0 0.35rem;
    font-size: clamp(1.6rem, 4vw, 2.3rem);
    line-height: 1.25;
}

.game-subtext,
.room-subtext,
.panel-copy {
    margin: 0 0 1.3rem;
    color: var(--ink-muted);
    line-height: 1.65;
}

.game-btn,
.room-btn,
.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 46px;
    padding: 0.68rem 1rem;
    border: 1px solid var(--maroon);
    background: var(--maroon);
    color: #fff;
    font-weight: 800;
    line-height: 1.35;
    text-align: center;
}

.game-btn:hover,
.room-btn:hover,
.action-btn:hover {
    background: #650c08;
}

.game-btn.secondary,
.room-btn.secondary,
.action-btn.secondary,
.game-btn.outline {
    background: transparent;
    color: var(--maroon);
}

.game-btn.secondary:hover,
.room-btn.secondary:hover,
.action-btn.secondary:hover,
.game-btn.outline:hover {
    background: #fff0ec;
}

.game-btn.gold,
.room-btn.gold,
.action-btn.gold {
    border-color: #b88a1f;
    background: #d7b343;
    color: #261d09;
}

.game-btn.danger,
.room-btn.danger,
.action-btn.danger {
    border-color: #461417;
    background: #461417;
    color: #fff;
}

.game-btn.small,
.room-btn.small,
.action-btn.small {
    min-height: 44px;
    padding: 0.52rem 0.75rem;
    font-size: 0.88rem;
}

.game-btn:disabled,
.room-btn:disabled,
.action-btn:disabled,
.game-start:disabled {
    opacity: 0.48;
    cursor: not-allowed;
    transform: none;
}

/* Create / join */

.room-entry {
    overflow: hidden;
}

.room-entry-grid,
.room-choice-grid,
.create-join-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.room-choice,
.entry-option {
    display: flex;
    min-height: 210px;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1.2rem;
    border: 1px solid var(--line);
    background: #faf7f2;
}

.room-choice:hover,
.entry-option:hover {
    border-color: #af8f34;
    box-shadow: inset 0 0 0 1px #af8f34;
}

.room-choice-icon,
.entry-option-icon {
    font-size: 2rem;
}

.room-choice h3,
.entry-option h3 {
    margin: 0.45rem 0 0.25rem;
    color: var(--maroon);
    font-size: 1.55rem;
}

.room-choice p,
.entry-option p {
    margin: 0;
    color: var(--ink-muted);
    line-height: 1.55;
}

.room-form,
.game-form,
.setup-form {
    display: grid;
    gap: 1rem;
}

.form-grid,
.setup-grid,
.rule-config-grid,
.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.form-field,
.room-field,
.setup-field {
    min-width: 0;
}

.form-field.full,
.room-field.full,
.setup-field.full,
.span-full {
    grid-column: 1 / -1;
}

.field-label,
.room-label,
.game-label {
    display: block;
    margin-bottom: 0.42rem;
    color: var(--ink);
    font-weight: 850;
    line-height: 1.4;
}

.field-help,
.room-help,
.game-help {
    display: block;
    margin-top: 0.38rem;
    color: var(--ink-muted);
    font-size: 0.84rem;
    line-height: 1.48;
}

.game-input,
.game-select,
.game-textarea,
.room-input,
.room-select,
.room-code-input,
.player-input,
.setup-input,
.settings-input,
.settings-select {
    width: 100%;
    min-height: 48px;
    padding: 0.68rem 0.75rem;
    border: 1px solid #ada292;
    border-radius: 0;
    outline: none;
    background: #fff;
    color: var(--ink);
    font: inherit;
    line-height: 1.35;
}

.game-textarea,
textarea.game-input,
textarea.room-input {
    min-height: 120px;
    resize: vertical;
}

.game-input:focus,
.game-select:focus,
.game-textarea:focus,
.room-input:focus,
.room-select:focus,
.room-code-input:focus,
.player-input:focus,
.setup-input:focus,
.settings-input:focus,
.settings-select:focus {
    border-color: var(--maroon);
    box-shadow: 0 0 0 3px rgba(138, 16, 11, 0.14);
}

.room-code-input,
input[data-room-code] {
    min-height: 58px;
    font-size: clamp(1.25rem, 5vw, 2rem);
    font-weight: 900;
    letter-spacing: 0.22em;
    text-align: center;
    text-transform: uppercase;
}

/* Lobby */

.room-summary,
.lobby-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.2rem;
    padding: 1rem;
    border: 1px solid var(--line);
    background: #faf7f2;
}

.room-code-display {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    align-items: center;
}

.room-code-label {
    color: var(--ink-muted);
    font-size: 0.86rem;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.room-code-digits {
    color: var(--maroon);
    font-size: clamp(1.45rem, 5vw, 2.3rem);
    font-weight: 950;
    letter-spacing: 0.16em;
    line-height: 1;
}

.room-copy-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--maroon);
    font-weight: 800;
}

.room-copy-button:hover {
    border-color: var(--maroon);
}

.lobby-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(320px, 1.08fr);
    gap: 1.2rem;
}

.lobby-panel,
.settings-panel,
.members-panel,
.setup-box {
    min-width: 0;
    padding: 1.1rem;
    border: 1px solid var(--line);
    background: #faf7f2;
}

.panel-title,
.lobby-panel h3,
.settings-panel h3,
.members-panel h3 {
    margin: 0 0 0.75rem;
    color: var(--maroon);
    font-size: 1.45rem;
    line-height: 1.3;
}

.member-list,
.lobby-member-list,
.player-list {
    display: grid;
    gap: 0.58rem;
}

.member-row,
.lobby-member,
.player-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.7rem;
    align-items: center;
    min-height: 60px;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--line);
    background: #fff;
}

.member-seat,
.player-seat,
.seat-number {
    display: grid;
    width: 2.25rem;
    height: 2.25rem;
    flex: 0 0 2.25rem;
    place-items: center;
    border-radius: 50%;
    background: var(--paper-dark);
    color: var(--maroon);
    font-weight: 900;
}

.member-details,
.player-details {
    min-width: 0;
}

.member-name,
.player-name {
    display: block;
    overflow: hidden;
    font-weight: 850;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.member-email,
.player-meta {
    display: block;
    overflow: hidden;
    color: var(--ink-muted);
    font-size: 0.82rem;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.member-status,
.member-badge,
.player-status {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0.18rem 0.48rem;
    border: 1px solid var(--line);
    background: #f2eee7;
    color: var(--ink-muted);
    font-size: 0.72rem;
    font-weight: 850;
    line-height: 1.25;
}

.member-status.ready,
.member-badge.ready,
.player-status.ready {
    border-color: #6f9b85;
    background: #eaf5ef;
    color: #245a43;
}

.member-status.host,
.member-badge.host,
.player-status.host {
    border-color: #b99532;
    background: #fff5cf;
    color: #72540d;
}

.member-status.offline,
.member-badge.offline,
.player-status.offline {
    border-color: #c6beb2;
    background: #eeeae4;
    color: #6f6860;
}

/* Configurable rule cards */

.rule-config-grid,
.settings-grid {
    margin-top: 0.8rem;
}

.rule-option,
.setting-option {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.65rem;
    align-items: flex-start;
    min-height: 76px;
    padding: 0.75rem;
    border: 1px solid var(--line);
    background: #fff;
    cursor: pointer;
}

.rule-option:has(input:checked),
.setting-option:has(input:checked) {
    border-color: var(--maroon);
    box-shadow: inset 0 0 0 1px var(--maroon);
    background: #fff7f4;
}

.rule-option input,
.setting-option input,
.choice-card input,
.target-card input {
    width: 21px;
    height: 21px;
    margin-top: 0.08rem;
    accent-color: var(--maroon);
}

.rule-option-title,
.setting-option-title {
    display: block;
    font-weight: 850;
    line-height: 1.35;
}

.rule-option-copy,
.setting-option-copy {
    display: block;
    margin-top: 0.12rem;
    color: var(--ink-muted);
    font-size: 0.8rem;
    line-height: 1.4;
}

.settings-review,
.rule-summary {
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    border-left: 4px solid var(--gold);
    background: #fff8df;
}

/* In-game states */

.step-strip,
.phase-progress {
    margin-bottom: 1rem;
}

.step-pill,
.phase-pill,
.phase-dot {
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    padding: 0.26rem 0.58rem;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink-muted);
    font-size: 0.78rem;
    font-weight: 750;
}

.step-pill.active,
.phase-pill.active,
.phase-dot.active {
    border-color: var(--maroon);
    background: var(--maroon);
    color: #fff;
}

.public-status {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.65rem;
    margin-bottom: 1.2rem;
}

.status-box {
    min-width: 0;
    padding: 0.75rem;
    border: 1px solid var(--line);
    background: #faf7f2;
    text-align: center;
}

.status-value {
    display: block;
    margin-top: 0.12rem;
    color: var(--maroon);
    font-size: 1.22rem;
    font-weight: 900;
    line-height: 1.25;
}

.mission-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin: 0 0 1.15rem;
}

.mission-dot {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border: 2px solid #b7aa99;
    border-radius: 50%;
    background: #fff;
    font-weight: 900;
}

.mission-dot.current {
    border-color: #9c751d;
    box-shadow: 0 0 0 4px #eedb9e;
}

.mission-dot.success {
    border-color: #256b4c;
    background: #256b4c;
    color: #fff;
}

.mission-dot.fail {
    border-color: #8a100b;
    background: #8a100b;
    color: #fff;
}

.private-card,
.role-card,
.action-card,
.wait-card {
    max-width: 720px;
    margin: 0 auto;
    padding: clamp(1.25rem, 5vw, 2.5rem);
    border: 1px solid var(--line);
    background: linear-gradient(150deg, #fff, #f5eee3);
    box-shadow: 7px 7px 0 rgba(28, 25, 23, 0.07);
    text-align: center;
}

.private-card {
    border-top: 5px solid var(--maroon);
}

.role-card.evil,
.private-card.evil {
    background: linear-gradient(150deg, #fff6f3, #ead8d6);
}

.role-card.good,
.private-card.good {
    background: linear-gradient(150deg, #f7fcff, #e5edf3);
}

.role-mark,
.private-card-icon,
.action-card-icon {
    font-size: 3.2rem;
    line-height: 1;
}

.role-name,
.private-card-title,
.action-card-title,
.wait-card h2 {
    margin: 0.55rem 0 0.3rem;
    color: var(--maroon);
    font-size: clamp(1.9rem, 6vw, 3.1rem);
    line-height: 1.2;
}

.role-team,
.private-card-team {
    display: inline-block;
    margin: 0.35rem 0 0.8rem;
    padding: 0.28rem 0.58rem;
    border: 1px solid currentColor;
    font-weight: 850;
}

.role-info,
.private-card-copy,
.action-card-copy,
.wait-card p {
    margin: 0.8rem 0 0;
    color: var(--ink-muted);
    line-height: 1.65;
}

.role-info {
    padding-top: 0.9rem;
    border-top: 1px solid var(--line);
}

.wait-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    min-height: 240px;
    text-align: left;
}

.wait-card h2 {
    margin: 0;
    font-size: clamp(1.5rem, 4vw, 2rem);
}

.wait-card p {
    margin-top: 0.25rem;
}

.wait-spinner,
.loading-spinner {
    width: 2.4rem;
    height: 2.4rem;
    flex: 0 0 2.4rem;
    border: 4px solid #dfd5c7;
    border-top-color: var(--maroon);
    border-radius: 50%;
    animation: game-spin 850ms linear infinite;
}

@keyframes game-spin {
    to { transform: rotate(360deg); }
}

.choice-grid,
.target-grid,
.vote-grid,
.action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
    margin: 1rem 0;
}

.choice-card,
.target-card,
.vote-card,
.action-choice {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.65rem;
    align-items: center;
    min-height: 56px;
    padding: 0.72rem;
    border: 1px solid var(--line);
    background: #fff;
    cursor: pointer;
    text-align: left;
}

.choice-card:has(input:checked),
.target-card:has(input:checked),
.vote-card:has(input:checked),
.action-choice:has(input:checked),
.target-card.selected,
.vote-card.selected {
    border-color: var(--maroon);
    box-shadow: inset 0 0 0 1px var(--maroon);
    background: #fff7f4;
}

.choice-name,
.target-name,
.vote-name {
    min-width: 0;
    overflow: hidden;
    font-weight: 800;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.action-duo {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    max-width: 640px;
    margin: 1.15rem auto 0;
}

.vote-btn {
    min-height: 76px;
    font-size: 1.05rem;
}

.result-banner,
.winner-banner {
    margin: 1rem 0;
    padding: 1.15rem;
    border: 1px solid var(--line);
    background: #faf7f2;
    text-align: center;
}

.result-banner.good,
.winner-banner.good {
    border-color: #3e755f;
    background: #eff7f2;
}

.result-banner.evil,
.winner-banner.evil {
    border-color: #9f4a43;
    background: #fff1ef;
}

.result-big,
.winner-title {
    margin-bottom: 0.3rem;
    font-size: clamp(1.85rem, 5vw, 2.9rem);
    line-height: 1.2;
}

.alive-grid,
.role-reveal-grid,
.end-roles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.62rem;
    margin: 1rem 0;
}

.alive-chip,
.role-reveal-card,
.end-role {
    min-width: 0;
    padding: 0.72rem;
    border: 1px solid var(--line);
    background: #fff;
    text-align: center;
}

.alive-chip.dead {
    background: var(--paper-dark);
    opacity: 0.55;
    text-decoration: line-through;
}

.alive-chip.leader {
    border-color: #b88b21;
    box-shadow: inset 0 0 0 1px #b88b21;
}

.role-reveal-name,
.end-role strong {
    display: block;
    overflow: hidden;
    font-weight: 850;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.role-reveal-role,
.end-role span {
    color: var(--maroon);
    font-size: 0.88rem;
    font-weight: 750;
}

/* Rules */

.rules-area {
    scroll-margin-top: 7.5rem;
    margin-top: 3.2rem;
}

.rules-area details {
    border-top: 1px solid var(--line);
    background: #fff;
}

.rules-area details:last-child {
    border-bottom: 1px solid var(--line);
}

.rules-area details.server-security-details {
    border-left: 4px solid var(--gold);
    background: #fffaf0;
}

.rules-area details.server-security-details summary:hover {
    background: #fff5dc;
}

.rules-area summary {
    min-height: 56px;
    padding: 0.95rem 2.4rem 0.95rem 0.85rem;
    color: var(--maroon);
    font-weight: 850;
    line-height: 1.5;
    cursor: pointer;
}

.rules-area summary:hover {
    background: #faf7f2;
}

.rules-copy {
    padding: 0 1rem 1.2rem;
    color: var(--ink-muted);
    line-height: 1.72;
}

.rules-copy ul {
    margin: 0;
    padding-left: 1.25rem;
    list-style: disc;
}

.rules-copy li + li {
    margin-top: 0.35rem;
}

/* Shared interaction states */

.game-shell button,
.game-shell a,
.game-shell input,
.game-shell select,
.game-shell textarea,
.game-shell summary {
    -webkit-tap-highlight-color: transparent;
}

.game-shell button:focus-visible,
.game-shell a:focus-visible,
.game-shell input:focus-visible,
.game-shell select:focus-visible,
.game-shell textarea:focus-visible,
.game-shell summary:focus-visible {
    outline: 3px solid #7a0019;
    outline-offset: 3px;
    box-shadow: 0 0 0 5px #fff;
}

.hidden,
[hidden] {
    display: none !important;
}

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

@media (max-width: 1020px) {
    .game-picker {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .lobby-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 820px) {
    .game-hero {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .game-hero-art {
        display: none;
    }

    .game-gate {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .game-gate-actions {
        grid-column: 1 / -1;
        padding-left: 4.6rem;
    }

    .game-section-heading {
        grid-template-columns: 1fr;
        gap: 0.65rem;
        align-items: start;
    }

    .form-grid,
    .setup-grid,
    .rule-config-grid,
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .form-field.full,
    .room-field.full,
    .setup-field.full,
    .span-full {
        grid-column: auto;
    }
}

@media (max-width: 680px) {
    .game-shell {
        width: min(100% - 1rem, 1180px);
    }

    .game-hero {
        margin-bottom: 1rem;
        padding: 1.35rem 1rem 1.5rem;
        box-shadow: 5px 5px 0 rgba(28, 25, 23, 0.08);
    }

    .game-title {
        font-size: clamp(2rem, 11vw, 3.2rem);
    }

    .privacy-note {
        width: 100%;
    }

    .game-gate {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        margin: 1rem 0 2.35rem;
        padding: 1rem;
    }

    .game-gate-icon {
        width: 3rem;
        height: 3rem;
    }

    .game-gate-actions {
        grid-column: auto;
        padding-left: 0;
    }

    .game-picker,
    .room-entry-grid,
    .room-choice-grid,
    .create-join-grid,
    .choice-grid,
    .target-grid,
    .vote-grid,
    .action-grid,
    .action-duo,
    .alive-grid,
    .role-reveal-grid,
    .end-roles {
        grid-template-columns: 1fr;
    }

    .game-card,
    .game-card.valorant {
        grid-column: auto;
        min-height: 330px;
        padding: 1.25rem;
    }

    .game-start {
        width: 100%;
        align-self: stretch;
    }

    .game-toolbar,
    .room-header {
        align-items: flex-start;
        flex-direction: column;
        padding: 0.85rem;
    }

    .game-toolbar-actions,
    .room-header .room-actions {
        width: 100%;
    }

    .room-summary,
    .lobby-summary {
        grid-template-columns: 1fr;
    }

    .member-row,
    .lobby-member,
    .player-row {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .member-status,
    .member-badges,
    .player-status {
        grid-column: 2;
        justify-self: start;
    }

    .public-status {
        gap: 0.35rem;
        font-size: 0.8rem;
    }

    .status-box {
        padding: 0.55rem 0.3rem;
    }

    .status-value {
        font-size: 1rem;
    }

    .wait-card {
        min-height: 210px;
        flex-direction: column;
        text-align: center;
    }

    .game-body,
    .room-body,
    .game-panel-body {
        padding: 1rem;
    }

    .rules-area {
        margin-top: 2.4rem;
    }
}

@media (max-width: 430px) {
    .game-gate-actions,
    .setup-actions,
    .inline-actions,
    .action-row,
    .room-actions {
        flex-direction: column;
    }

    .game-gate-actions > *,
    .setup-actions > *,
    .inline-actions > *,
    .action-row > *,
    .room-actions > *,
    .game-btn,
    .room-btn,
    .action-btn {
        width: 100%;
    }

    .game-toolbar-actions .game-btn,
    .room-header .room-btn {
        width: 100%;
    }

    .room-code-digits {
        font-size: 1.55rem;
    }

    .game-card {
        min-height: 315px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wait-spinner,
    .loading-spinner {
        animation: none;
    }

    .game-start {
        transition: none;
    }
}

/* Dynamic multiplayer room components */

.member-game-gate {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    width: 100%;
}

.gate-lock {
    display: grid;
    width: 3.5rem;
    height: 3.5rem;
    place-items: center;
    border-radius: 50%;
    background: #fff;
    font-size: 1.6rem;
    box-shadow: inset 0 0 0 1px var(--line);
}

.multiplayer-panel {
    min-width: 0;
    margin: 1.5rem 0;
    border: 1px solid var(--line);
    background: var(--white);
    box-shadow: 8px 8px 0 rgba(28, 25, 23, 0.07);
}

.active-room,
.werewolf-config,
.rule-options {
    min-width: 0;
}

.compact-panel {
    max-width: 760px;
    margin-right: auto;
    margin-left: auto;
}

.night-action {
    border-color: #6e607f;
    background: #f8f5fb;
}

.potion-grid {
    align-items: stretch;
}

.room-form-panel {
    padding: clamp(1rem, 4vw, 2rem);
}

.panel-heading-row,
.section-mini-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.panel-heading-row {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--line);
}

.panel-heading-row h2,
.section-mini-heading h3,
.compact-player-panel h3,
.action-panel h3 {
    margin: 0;
    color: var(--maroon);
    line-height: 1.3;
}

.room-form-grid,
.config-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.form-field > span {
    display: block;
    margin-bottom: 0.42rem;
    color: var(--ink);
    font-weight: 850;
    line-height: 1.4;
}

.form-field > input,
.form-field > select {
    width: 100%;
    min-height: 48px;
    padding: 0.68rem 0.75rem;
    border: 1px solid #ada292;
    border-radius: 0;
    outline: none;
    background: #fff;
    color: var(--ink);
    font: inherit;
}

.form-field > input:focus,
.form-field > select:focus {
    border-color: var(--maroon);
    box-shadow: 0 0 0 3px rgba(138, 16, 11, 0.14);
}

.room-code-field input {
    min-height: 60px;
    font-size: clamp(1.4rem, 6vw, 2.15rem);
    font-weight: 900;
    letter-spacing: 0.2em;
    text-align: center;
    text-transform: uppercase;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.25rem;
}

.form-error {
    min-height: 1.4rem;
    color: #8a100b;
    font-weight: 750;
    line-height: 1.45;
}

.config-section,
.advanced-rules,
.rules-preview {
    min-width: 0;
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid var(--line);
    background: #faf7f2;
}

.config-section h3 {
    margin: 0 0 0.8rem;
    color: var(--maroon);
}

.toggle-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.65rem;
    align-items: center;
    min-height: 52px;
    padding: 0.68rem 0.75rem;
    border: 1px solid var(--line);
    background: #fff;
    cursor: pointer;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.toggle-card:has(input:checked) {
    border-color: var(--maroon);
    box-shadow: inset 0 0 0 1px var(--maroon);
    background: #fff7f4;
}

.toggle-card input {
    width: 22px;
    height: 22px;
    accent-color: var(--maroon);
}

.computed-card {
    display: flex;
    min-height: 52px;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.68rem 0.75rem;
    border: 1px dashed #b8aa96;
    background: #fff8df;
}

.computed-card strong {
    color: var(--maroon);
    font-size: 1.35rem;
}

.advanced-rules {
    padding: 0;
}

.advanced-rules > summary {
    display: flex;
    min-height: 50px;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--maroon);
    cursor: pointer;
    font-weight: 850;
}

.advanced-rules > .config-grid {
    padding: 0 1rem 1rem;
}

.rules-preview p {
    margin: 0.5rem 0 0;
    line-height: 1.55;
}

.rules-preview-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.rules-preview-stats span {
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--line);
    background: #fff;
}

.rules-preview.is-error {
    border-color: #a62018;
    background: #fff0ee;
}

.privacy-explainer {
    margin: 1rem 0;
    padding: 0.78rem 0.9rem;
    border-left: 4px solid #b88a1f;
    background: #fff8df;
    color: #5e4c1d;
    line-height: 1.55;
}

.persistent-privacy {
    margin: 1rem;
}

.room-share-note,
.discussion-card {
    margin: 1rem;
    padding: 0.85rem 1rem;
    border-left: 4px solid var(--gold);
    background: #fff8df;
    line-height: 1.55;
}

.room-lobby .lobby-grid {
    padding: 0 1rem 1rem;
}

.room-lobby .lobby-grid > section,
.compact-player-panel,
.public-card {
    min-width: 0;
    padding: 1rem;
    border: 1px solid var(--line);
    background: #faf7f2;
}

.section-mini-heading {
    margin-bottom: 0.75rem;
}

.section-mini-heading > span {
    color: var(--ink-muted);
    font-weight: 850;
}

.room-player-list {
    display: grid;
    gap: 0.55rem;
}

.room-player {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    gap: 0.55rem;
    align-items: center;
    min-width: 0;
    min-height: 58px;
    padding: 0.58rem 0.68rem;
    border: 1px solid var(--line);
    background: #fff;
}

.room-player.is-me {
    border-color: #b88a1f;
    background: #fffaf0;
}

.player-badge {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    padding: 0.18rem 0.48rem;
    border: 1px solid var(--line);
    background: #f2eee7;
    color: var(--ink-muted);
    font-size: 0.72rem;
    font-weight: 850;
}

.player-badge.is-ready {
    border-color: #6f9b85;
    background: #eaf5ef;
    color: #245a43;
}

.host-badge {
    border-color: #b99532;
    background: #fff5cf;
    color: #72540d;
}

.room-lobby > .room-actions,
.room-waiting-copy {
    margin-right: 1rem;
    margin-left: 1rem;
}

.room-lobby > .room-actions {
    margin-top: 0.25rem;
}

.room-waiting-copy {
    margin-bottom: 1rem;
}

.active-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(270px, 0.75fr);
    gap: 1rem;
    padding: 0 1rem 1rem;
}

.active-main,
.active-layout aside {
    display: grid;
    min-width: 0;
    align-content: start;
    gap: 1rem;
}

.private-role-card,
.action-panel,
.waiting-panel {
    min-width: 0;
    padding: 1rem;
    border: 1px solid var(--line);
    background: #fff;
    box-shadow: 4px 4px 0 rgba(28, 25, 23, 0.05);
}

.private-role-card {
    border-top: 5px solid var(--maroon);
}

.private-role-cover {
    display: grid;
    gap: 0.8rem;
    justify-items: center;
    text-align: center;
}

.private-role-cover > span,
.role-symbol {
    font-size: 2.65rem;
    line-height: 1;
}

.private-role-cover p,
.private-role-content > p {
    margin: 0.35rem 0 0;
    color: var(--ink-muted);
    line-height: 1.55;
}

.private-role-content {
    text-align: center;
}

.private-role-content h2 {
    margin: 0.35rem 0;
    color: var(--maroon);
    font-size: clamp(1.7rem, 5vw, 2.5rem);
}

.known-information {
    margin: 0.9rem 0;
    padding: 0.7rem;
    border: 1px solid var(--line);
    background: #faf7f2;
    line-height: 1.5;
    text-align: left;
}

.known-information strong,
.known-information span {
    display: block;
}

.seer-history ul,
.public-vote-list {
    display: grid;
    gap: 0.42rem;
    margin: 0.55rem 0 0;
    padding: 0;
    list-style: none;
}

.seer-history li,
.public-vote-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--line);
    background: #fff;
}

.action-panel > p {
    color: var(--ink-muted);
    line-height: 1.55;
}

.waiting-panel {
    display: flex;
    min-height: 116px;
    align-items: center;
    gap: 0.85rem;
}

.waiting-panel.is-done {
    border-color: #6f9b85;
    background: #eff8f3;
}

.waiting-panel > span:not(.waiting-pulse) {
    color: #256b4c;
    font-size: 2rem;
}

.waiting-pulse {
    width: 2rem;
    height: 2rem;
    flex: 0 0 2rem;
    border: 4px solid #dfd5c7;
    border-top-color: var(--maroon);
    border-radius: 50%;
    animation: game-spin 850ms linear infinite;
}

.public-game-state {
    min-width: 0;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
    margin-bottom: 1rem;
}

.status-grid > div {
    min-width: 0;
    padding: 0.65rem;
    border: 1px solid var(--line);
    background: #fff;
    text-align: center;
}

.status-grid span,
.status-grid strong {
    display: block;
    overflow-wrap: anywhere;
}

.status-grid span {
    color: var(--ink-muted);
    font-size: 0.78rem;
}

.status-grid strong {
    margin-top: 0.15rem;
    color: var(--maroon);
}

.quest-track {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin: 0 0 1rem;
}

.quest-node {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border: 2px solid #b7aa99;
    border-radius: 50%;
    background: #fff;
    font-weight: 900;
}

.quest-node.current {
    border-color: #9c751d;
    box-shadow: 0 0 0 4px #eedb9e;
}

.quest-node.success {
    border-color: #256b4c;
    background: #256b4c;
    color: #fff;
}

.quest-node.fail {
    border-color: #8a100b;
    background: #8a100b;
    color: #fff;
}

.alive-player-grid,
.revealed-role-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
    margin: 1rem 0;
}

.alive-player,
.revealed-role {
    min-width: 0;
    padding: 0.62rem;
    border: 1px solid var(--line);
    background: #fff;
    overflow-wrap: anywhere;
    text-align: center;
}

.alive-player.is-dead {
    opacity: 0.52;
    background: var(--paper-dark);
    text-decoration: line-through;
}

.revealed-role strong,
.revealed-role span {
    display: block;
}

.revealed-role span {
    margin-top: 0.3rem;
    color: var(--maroon);
}

.host-control,
.room-danger-zone {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 1rem;
    padding: 1rem;
    border: 1px solid var(--line);
}

.host-control {
    background: #fff8df;
}

.active-main > .host-control {
    margin: 0;
}

.active-room-error {
    margin: 0 1rem 1rem;
}

.room-danger-zone {
    justify-content: flex-end;
    border-color: #d8b8b4;
    background: #fff5f3;
}

.game-over-panel {
    min-width: 0;
}

@media (max-width: 820px) {
    .member-game-gate,
    .active-layout {
        grid-template-columns: 1fr;
    }

    .member-game-gate .gate-lock {
        display: none;
    }

    .active-layout {
        display: flex;
        flex-direction: column;
    }

    .active-main,
    .active-layout aside {
        display: contents;
    }

    .private-role-card {
        order: 1;
    }

    .host-control,
    .action-panel,
    .waiting-panel {
        order: 2;
    }

    .public-card {
        order: 3;
    }

    .compact-player-panel {
        order: 4;
    }

    .private-role-card {
        max-width: 620px;
        width: 100%;
        margin: 0 auto;
    }
}

@media (max-width: 680px) {
    .room-form-grid,
    .config-grid,
    .alive-player-grid,
    .revealed-role-grid {
        grid-template-columns: 1fr;
    }

    .panel-heading-row,
    .host-control,
    .room-danger-zone {
        align-items: stretch;
        flex-direction: column;
    }

    .room-player {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .room-player .player-badge {
        grid-column: 2;
        justify-self: start;
    }

    .status-grid {
        gap: 0.35rem;
    }

    .status-grid > div {
        padding: 0.5rem 0.25rem;
        font-size: 0.82rem;
    }

    .private-role-cover .game-btn,
    .private-role-content .game-btn,
    .action-panel > .game-btn,
    .form-actions > .game-btn,
    .host-control .game-btn,
    .room-danger-zone .game-btn {
        width: 100%;
    }
}

@media (max-width: 430px) {
    .room-form-panel,
    .room-lobby .lobby-grid,
    .active-layout {
        padding-right: 0.75rem;
        padding-left: 0.75rem;
    }

    .persistent-privacy,
    .room-share-note,
    .host-control,
    .room-danger-zone {
        margin-right: 0.75rem;
        margin-left: 0.75rem;
    }

    .room-header .game-btn,
    .panel-heading-row .game-btn,
    .member-game-gate .game-btn {
        width: 100%;
    }

    .room-code-display {
        font-size: 1.25rem;
        letter-spacing: 0.1em;
        overflow-wrap: normal;
        white-space: nowrap;
    }

    .action-duo {
        grid-template-columns: 1fr;
    }
}
