:root {
    color-scheme: dark;
    --bg: #120d0b;
    --bg-elevated: #1d1411;
    --bg-soft: #241915;
    --line: rgba(255, 219, 190, 0.12);
    --text: #f7ede2;
    --muted: #bfaa98;
    --accent: #e86a33;
    --accent-soft: #ffb36a;
    --success: #8cbf6a;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background:
        radial-gradient(circle at top, rgba(182, 72, 32, 0.28), transparent 42%),
        linear-gradient(180deg, #17100d 0%, #0c0908 100%);
    color: var(--text);
    font-family: "Segoe UI", "Noto Sans TC", sans-serif;
}

body.dragging-card {
    user-select: none;
    -webkit-user-select: none;
    cursor: grabbing;
}

a {
    color: inherit;
    text-decoration: none;
}

.shell {
    min-height: 100vh;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--line);
    background: rgba(12, 9, 8, 0.78);
    backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.9rem;
}

.brand strong,
.brand small {
    display: block;
}

.brand small,
.eyebrow,
.stat-label {
    color: var(--muted);
}

.nav {
    display: inline-flex;
    gap: 1rem;
}

.nav a {
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
}

.nav a:hover {
    background: rgba(255, 255, 255, 0.05);
}

.nav-leave-button {
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    border: none;
    background: transparent;
    color: var(--text);
    font: inherit;
    cursor: pointer;
}

.nav-leave-button:hover {
    background: rgba(255, 107, 107, 0.12);
    color: #ff6b6b;
}

.nav-settings-button {
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    border: none;
    background: transparent;
    color: var(--text);
    font: inherit;
    cursor: pointer;
}

.nav-settings-button:hover {
    background: rgba(255, 255, 255, 0.05);
}

.settings-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 1.25rem;
    background: rgba(5, 5, 6, 0.68);
    backdrop-filter: blur(8px);
}

.settings-overlay.hidden {
    display: none;
}

.notice-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: grid;
    place-items: center;
    padding: 1.25rem;
    background: rgba(5, 5, 6, 0.68);
    backdrop-filter: blur(8px);
}

.notice-overlay.hidden {
    display: none;
}

.notice-modal {
    width: min(100%, 26rem);
    padding: 1.4rem;
    border: 1px solid rgba(255, 219, 190, 0.16);
    border-radius: 0.75rem;
    background: rgba(18, 13, 11, 0.96);
    color: #f8efe6;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

.notice-modal h2 {
    margin: 0 0 0.55rem;
}

.notice-modal p {
    margin: 0 0 1rem;
    color: #d8c8ba;
}

.settings-modal {
    position: relative;
    width: min(28rem, calc(100% - 2rem));
    max-height: calc(100vh - 6rem);
    overflow: auto;
    border-radius: 1rem;
    padding: 1.5rem;
    display: grid;
    gap: 1rem;
    border: 1px solid rgba(255, 219, 190, 0.14);
    background: linear-gradient(180deg, rgba(25, 18, 15, 0.96), rgba(14, 11, 9, 0.98));
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
}

.settings-modal {
    border-color: rgba(172, 105, 59, 0.28);
    background: linear-gradient(180deg, #fffdf8 0%, #fff0dc 100%);
    color: #33231c;
    box-shadow: 0 24px 70px rgba(93, 47, 18, 0.28);
}

.settings-modal .eyebrow,
.settings-modal label,
.settings-modal .settings-toggle-row {
    color: #5f4032;
}

.settings-modal h2 {
    color: #241713;
}

.settings-modal .entry-form input:not([type="checkbox"]),
.settings-modal .entry-form select {
    background: #fffaf2;
    color: #2d1d17;
    border-color: rgba(157, 89, 47, 0.38);
}

.settings-modal .button.secondary {
    background: #fffaf2;
    color: #3f291f;
    border-color: rgba(157, 89, 47, 0.38);
}

.settings-modal .button.secondary:hover {
    background: #ffe7c7;
}

.settings-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 2.75rem;
    height: 1.5rem;
    flex-shrink: 0;
}

.toggle-switch input {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}

.toggle-track {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: rgba(255, 219, 190, 0.16);
    border: 1px solid rgba(255, 219, 190, 0.2);
    transition: background 0.15s ease;
}

.toggle-track::after {
    content: "";
    position: absolute;
    top: 0.15rem;
    left: 0.15rem;
    width: 1.05rem;
    height: 1.05rem;
    border-radius: 999px;
    background: var(--text);
    transition: transform 0.15s ease;
}

.toggle-switch input:checked + .toggle-track {
    background: var(--accent);
    border-color: var(--accent-soft);
}

.toggle-switch input:checked + .toggle-track::after {
    transform: translateX(1.25rem);
}

.settings-key-capture {
    width: 100%;
}

.settings-key-capture.listening {
    border-color: var(--accent-soft);
    color: var(--accent-soft);
}

.settings-modal input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
}

.settings-modal .toggle-track {
    background: #efe0cf;
    border-color: rgba(157, 89, 47, 0.35);
}

.settings-modal .toggle-track::after {
    background: #6b4a3b;
}

.settings-modal .toggle-switch input:checked + .toggle-track {
    background: #d8612f;
    border-color: #b9431f;
}

.settings-modal .toggle-switch input:checked + .toggle-track::after {
    background: #fffdf8;
}

.settings-modal .modal-close-button {
    background: rgba(74, 48, 37, 0.08);
    color: #3f291f;
    border-color: rgba(157, 89, 47, 0.28);
}

.settings-modal .modal-close-button:hover {
    background: rgba(216, 97, 47, 0.18);
}

.content {
    width: min(1200px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 2rem 0 4rem;
}

.content.full-bleed {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
}

.hero,
.page-header,
.section-heading,
.panel-grid,
.feature-grid,
.role-grid,
.blueprint-grid,
.stat-grid,
.info-list,
.plain-list {
    display: grid;
}

.hero {
    grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.8fr);
    gap: 1.5rem;
    align-items: stretch;
}

.hero.hero-immersive {
    position: relative;
    grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.9fr);
    overflow: hidden;
}

.hero-media {
    position: absolute;
    inset: 0;
    border-radius: 0.75rem;
    overflow: hidden;
}

.hero-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(0.95) brightness(0.5);
    transform: scale(1.03);
}

.hero-media-glow {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(12, 9, 8, 0.92) 0%, rgba(12, 9, 8, 0.68) 42%, rgba(12, 9, 8, 0.38) 100%),
        radial-gradient(circle at 82% 55%, rgba(255, 151, 73, 0.28), transparent 28%);
}

.hero-media-embers,
.room-atmosphere-embers {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        radial-gradient(circle at 12% 84%, rgba(255, 177, 92, 0.9) 0 2px, transparent 3px),
        radial-gradient(circle at 24% 72%, rgba(255, 119, 61, 0.85) 0 1.5px, transparent 3px),
        radial-gradient(circle at 70% 78%, rgba(255, 177, 92, 0.85) 0 2px, transparent 3px),
        radial-gradient(circle at 84% 68%, rgba(255, 119, 61, 0.8) 0 1.5px, transparent 3px);
    animation: emberFloat 11s linear infinite;
    opacity: 0.58;
}

.hero-copy,
.hero-panel,
.panel,
.role-card,
.blueprint-card {
    background: linear-gradient(180deg, rgba(44, 28, 21, 0.95), rgba(27, 18, 14, 0.98));
    border: 1px solid var(--line);
    border-radius: 0.75rem;
}

.hero-copy {
    padding: 2.25rem;
    position: relative;
    z-index: 1;
    background: linear-gradient(180deg, rgba(25, 18, 14, 0.86), rgba(18, 13, 11, 0.92));
}

.hero-copy h1,
.page-header h1,
.section-heading h2 {
    margin: 0;
    line-height: 1.08;
}

.hero-copy h1 {
    font-size: clamp(2rem, 4vw, 3.6rem);
    max-width: 12ch;
}

.lede {
    max-width: 60ch;
    color: #dcc9ba;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.625rem;
    border: 1px solid var(--line);
    cursor: pointer;
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.button.primary {
    background: linear-gradient(180deg, #f08a52 0%, #c34923 100%);
    color: #130d0a;
    border-color: rgba(255, 196, 149, 0.3);
}

.button.secondary {
    background: rgba(255, 255, 255, 0.03);
}

.hero-panel,
.panel {
    padding: 1.5rem;
}

.hero-panel.image-panel {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 1rem;
    background: linear-gradient(180deg, rgba(27, 18, 14, 0.86), rgba(18, 13, 11, 0.93));
}

.side-image-frame,
.visual-tile {
    position: relative;
    overflow: hidden;
    border-radius: 0.75rem;
    border: 1px solid var(--line);
    min-height: 220px;
    background: rgba(255, 255, 255, 0.03);
}

.side-image-frame img,
.visual-tile img,
.room-atmosphere img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.side-image-frame::after,
.visual-tile::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 25%, rgba(10, 8, 7, 0.88) 100%);
}

.image-label,
.visual-overlay {
    position: absolute;
    inset: auto 1rem 1rem 1rem;
    z-index: 1;
    display: grid;
    gap: 0.2rem;
}

.image-label span,
.visual-overlay p {
    color: #d0b7a3;
}

.avatar-uploader {
    display: grid;
    gap: 0.6rem;
    padding-top: 0.9rem;
    border-top: 1px dashed var(--line);
}

.avatar-uploader-row {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.avatar-uploader-preview {
    width: 70.8px;
    height: 72px;
    border-radius: 0.5rem;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--line);
    display: grid;
    place-items: center;
    overflow: hidden;
    color: var(--muted);
    font-size: 0.7rem;
    text-align: center;
}

.avatar-uploader-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.avatar-uploader-fields {
    display: grid;
    gap: 0.35rem;
    flex: 1;
}

.stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.stat-grid article,
.role-card ul,
.plain-list,
.info-list {
    margin: 0;
}

.stat-grid article {
    padding: 1rem;
    border-radius: 0.625rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.band {
    margin-top: 1.5rem;
    padding: 1.5rem 0;
}

.band.alt {
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.visual-band {
    position: relative;
}

.visual-strip {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
    gap: 1rem;
}

.visual-tile.tall {
    min-height: 420px;
}

.visual-tile {
    min-height: 320px;
}

.section-heading {
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.feature-grid,
.panel-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.panel-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.feature-grid article,
.panel,
.role-card,
.blueprint-card {
    padding: 1.25rem;
}

.feature-grid article {
    border: 1px solid var(--line);
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
}

.role-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.role-card-top,
.blueprint-card header,
.page-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
}

.badge {
    display: inline-flex;
    padding: 0.3rem 0.55rem;
    border-radius: 999px;
    background: rgba(232, 106, 51, 0.14);
    color: #ffd3b6;
    font-size: 0.8rem;
}

.badge.muted {
    background: rgba(255, 255, 255, 0.08);
    color: var(--muted);
}

.role-card ul {
    padding-left: 1rem;
    display: grid;
    gap: 0.5rem;
}

.role-card li span {
    display: block;
    color: #d6c0af;
    margin-top: 0.2rem;
}

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

.blueprint-card p {
    color: #d3bba9;
}

.page-header {
    margin-bottom: 1rem;
}

.panel h2,
.feature-grid h3,
.role-card h3,
.blueprint-card h3 {
    margin-top: 0;
}

.compact {
    margin-top: 0.35rem;
}

.stack {
    display: grid;
    gap: 0.6rem;
}

.entry-form input:not([type="checkbox"]),
.entry-form select,
.chat-form input,
.action-card select {
    width: 100%;
    min-height: 2.75rem;
    border-radius: 0.625rem;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    padding: 0.75rem 0.9rem;
}

.checkline {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    color: #dcc9ba;
}

.checkline input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--accent);
}

.error-text {
    color: #ff9a87;
    min-height: 1.5rem;
}

.muted-text {
    color: var(--muted);
}

.game-header-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.game-shell {
    display: grid;
    gap: 1.5rem;
    position: relative;
}

.room-atmosphere {
    position: absolute;
    inset: 0 0 auto 0;
    height: 360px;
    overflow: hidden;
    border-radius: 0.9rem;
    z-index: 0;
}

.room-atmosphere img {
    height: 100%;
    filter: brightness(0.35) saturate(1.05);
    transform: scale(1.05);
}

.room-atmosphere-gradient {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(12, 9, 8, 0.18) 0%, rgba(12, 9, 8, 0.74) 72%, rgba(12, 9, 8, 1) 100%),
        radial-gradient(circle at 65% 25%, rgba(255, 145, 82, 0.28), transparent 25%);
}

.game-shell > section,
.game-shell > .winner-banner {
    position: relative;
    z-index: 1;
}

.game-header,
.panel-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

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

.game-grid.lower {
    align-items: start;
}

.log-list,
.chat-log {
    display: grid;
    gap: 0.75rem;
    max-height: 20rem;
    overflow: auto;
}

.log-list p,
.chat-entry {
    margin: 0;
    padding: 0.85rem 1rem;
    border-radius: 0.625rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-entry.system {
    background: rgba(232, 106, 51, 0.08);
}

.chat-entry header {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    color: var(--muted);
}

.chat-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

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

.seat-card,
.identity-card,
.action-card {
    padding: 1rem;
    border-radius: 0.75rem;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(42, 29, 22, 0.88), rgba(20, 15, 12, 0.94));
}

.seat-card.self {
    border-color: rgba(255, 179, 106, 0.45);
    box-shadow: 0 0 0 1px rgba(255, 179, 106, 0.2) inset;
}

.seat-card.dead {
    opacity: 0.62;
}

.seat-card header,
.panel-header {
    margin-bottom: 0.6rem;
}

.seat-card h3,
.identity-card h3,
.action-card h3 {
    margin: 0;
}

.hero-actions.compact {
    margin-top: 0.75rem;
}

.winner-banner {
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 179, 106, 0.3);
    background: rgba(255, 179, 106, 0.08);
    font-weight: 600;
}

.badge[data-phase="night"] {
    background: rgba(255, 124, 72, 0.18);
    animation: phasePulse 1.8s ease-in-out infinite;
}

.badge[data-phase="discussion"] {
    background: rgba(255, 190, 120, 0.15);
}

.badge[data-phase="voting"] {
    background: rgba(226, 82, 53, 0.22);
}

.hidden {
    display: none;
}

.game-guide-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(8, 7, 6, 0.8);
    backdrop-filter: blur(8px);
}

.game-guide-overlay.hidden {
    display: none;
}

.game-guide-modal {
    position: relative;
    width: min(82rem, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    padding: 1.5rem;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 1rem;
    overflow: hidden;
    border: 1px solid rgba(255, 219, 190, 0.2);
    border-radius: 1rem;
    background: linear-gradient(180deg, rgba(44, 28, 21, 0.99), rgba(20, 15, 12, 0.99));
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.game-guide-header h2 {
    margin: 0;
    color: #ffb454;
}

.game-guide-header .eyebrow {
    margin: 0 0 0.3rem;
}

.game-guide-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-right: 2.5rem;
}

.game-guide-tab {
    padding: 0.55rem 0.9rem;
    border: 1px solid rgba(255, 219, 190, 0.16);
    border-radius: 0.55rem;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font: inherit;
    cursor: pointer;
}

.game-guide-tab:hover,
.game-guide-tab.active {
    border-color: rgba(255, 179, 106, 0.52);
    background: rgba(255, 139, 50, 0.14);
}

.game-guide-panels {
    min-height: 0;
    overflow-y: auto;
    padding-right: 0.35rem;
}

.game-guide-panel > .home-lore-card {
    margin: 0;
}

@media (max-width: 700px) {
    .game-guide-modal {
        width: calc(100vw - 1rem);
        max-height: calc(100vh - 1rem);
        padding: 1rem;
    }
}

.table-shell {
    display: grid;
    gap: 1.5rem;
    position: relative;
}

.table-shell > section,
.table-shell > .winner-banner,
.table-shell > .card-preview {
    position: relative;
    z-index: 1;
}

.table-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

.table-stage {
    position: relative;
}

.table-surface {
    position: relative;
    min-height: 58rem;
    border-radius: 1.25rem;
    overflow: hidden;
    border: 1px solid rgba(255, 205, 170, 0.16);
    background:
        radial-gradient(circle at 50% 48%, rgba(255, 146, 72, 0.08), transparent 20%),
        radial-gradient(circle at 50% 48%, rgba(0, 0, 0, 0.18), transparent 42%),
        linear-gradient(180deg, rgba(88, 51, 33, 0.82) 0%, rgba(53, 32, 22, 0.92) 100%);
    box-shadow:
        inset 0 0 0 1px rgba(255, 219, 190, 0.04),
        inset 0 0 90px rgba(0, 0, 0, 0.22);
}

.table-grain {
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(90deg, rgba(255,255,255,0.02) 0 2px, transparent 2px 13px),
        repeating-linear-gradient(180deg, rgba(45, 24, 15, 0.25) 0 3px, transparent 3px 18px);
    mix-blend-mode: soft-light;
    opacity: 0.55;
}

.table-center {
    position: absolute;
    inset: 24% 16% 4% 16%;
    border-radius: 999px;
    border: 1px solid rgba(255, 194, 140, 0.12);
    background: radial-gradient(circle, rgba(26, 15, 11, 0.6) 0%, rgba(18, 12, 10, 0.92) 68%);
    display: grid;
    justify-items: center;
    align-content: center;
    padding: 2.5rem;
    gap: 1.25rem;
}

.table-center-ring {
    position: absolute;
    inset: 8%;
    border-radius: 999px;
    border: 1px dashed rgba(255, 187, 132, 0.12);
    pointer-events: none;
}

.table-drop-zone {
    position: relative;
    width: min(24rem, 100%);
    min-height: 9rem;
    border-radius: 1rem;
    border: 1px dashed rgba(255, 196, 149, 0.28);
    background: rgba(255, 255, 255, 0.03);
    display: grid;
    place-items: center;
    text-align: center;
    transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

.table-drop-zone.ready {
    transform: scale(1.03);
    border-color: rgba(255, 186, 112, 0.7);
    background: rgba(255, 158, 84, 0.12);
}

.drop-inner {
    display: grid;
    gap: 0.35rem;
    padding: 1rem;
}

.drop-inner span {
    color: var(--muted);
}

.table-piles {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.pile {
    display: grid;
    gap: 0.75rem;
}

.pile header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.pile header h2 {
    margin: 0;
    font-size: 1rem;
}

.table-card-row {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
}

.table-card {
    min-width: 11rem;
    padding: 0.9rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 219, 190, 0.12);
    background: linear-gradient(180deg, rgba(45, 28, 22, 0.95), rgba(26, 18, 15, 0.98));
}

.table-card h3 {
    margin: 0.15rem 0 0.45rem;
    font-size: 1rem;
}

.table-card p {
    margin: 0;
}

.seat-edge {
    position: absolute;
    display: flex;
    gap: 0.85rem;
    padding: 1rem;
}

.seat-edge.top,
.seat-edge.bottom {
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 16rem);
    justify-content: center;
}

.seat-edge.top {
    top: 1rem;
}

.seat-edge.bottom {
    bottom: 1rem;
}

.seat-edge.left,
.seat-edge.right {
    top: 50%;
    transform: translateY(-50%);
    flex-direction: column;
}

.seat-edge.left {
    left: 1rem;
}

.seat-edge.right {
    right: 1rem;
}

.table-seat {
    width: 9.4rem;
    min-width: 0;
    flex-shrink: 1;
    padding: 0.45rem;
    border-radius: 0.9rem;
    border: 1px solid rgba(255, 219, 190, 0.12);
    background: linear-gradient(180deg, rgba(34, 24, 19, 0.96), rgba(20, 15, 12, 0.98));
    display: grid;
    gap: 0.4rem;
    justify-items: center;
    text-align: center;
    position: relative;
}

.table-seat.self {
    border-color: rgba(255, 179, 106, 0.5);
    box-shadow: 0 0 0 1px rgba(255, 179, 106, 0.22) inset, 0 0 24px rgba(255, 149, 71, 0.08);
}

.table-seat.active-turn {
    border-color: rgba(255, 215, 150, 0.86);
    box-shadow:
        0 0 0 1px rgba(255, 214, 148, 0.34) inset,
        0 0 28px rgba(255, 176, 86, 0.28);
}

.table-seat.active-turn .avatar-ring {
    box-shadow: 0 0 32px rgba(255, 173, 82, 0.48);
}

.table-seat.crystal-target {
    border-color: rgba(129, 217, 255, 0.68);
    box-shadow:
        0 0 0 1px rgba(129, 217, 255, 0.28) inset,
        0 0 28px rgba(72, 177, 255, 0.22);
}

.table-seat.dead {
    opacity: 0.58;
}

.table-seat.offline,
.lobby-seat.offline {
    opacity: 0.58;
    filter: grayscale(0.85);
}

.table-seat.offline .avatar-ring,
.lobby-seat.offline .avatar-ring {
    box-shadow: none;
}

.seat-status-icons {
    position: absolute;
    top: -0.65rem;
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
    justify-content: center;
    width: calc(100% - 1rem);
}

.turn-chip {
    position: absolute;
    right: 0.45rem;
    bottom: 0.45rem;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.45rem;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    background: rgba(15, 11, 9, 0.9);
    border: 1px solid rgba(255, 219, 190, 0.18);
    color: #f8eadc;
    font-size: 0.8rem;
    font-weight: 700;
}

.turn-bubble {
    position: absolute;
    top: -1.05rem;
    right: -0.35rem;
    min-width: 2.3rem;
    height: 2.3rem;
    padding: 0 0.55rem;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    background: rgba(255, 240, 228, 0.98);
    color: #24140f;
    font-size: 0.95rem;
    font-weight: 700;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.24);
}

.turn-bubble::after {
    content: "";
    position: absolute;
    right: 0.45rem;
    bottom: -0.3rem;
    width: 0.7rem;
    height: 0.7rem;
    background: rgba(255, 240, 228, 0.98);
    transform: rotate(45deg);
    border-radius: 0.12rem;
}

.status-icon {
    display: inline-grid;
    place-items: center;
    width: 1.45rem;
    height: 1.45rem;
    border-radius: 999px;
    background: rgba(20, 15, 12, 0.92);
    border: 1px solid rgba(255, 219, 190, 0.18);
    font-size: 0.78rem;
}

.avatar-ring {
    width: 2.85rem;
    height: 2.85rem;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, #f2a866 0%, #b94a20 100%);
    color: #180f0b;
    font-weight: 700;
    box-shadow: 0 0 24px rgba(255, 137, 62, 0.2);
    overflow: hidden;
}

.avatar-ring.speaking {
    box-shadow: 0 0 0 3px rgba(140, 191, 106, 0.55), 0 0 26px rgba(140, 191, 106, 0.55);
    animation: voiceSpeakingPulse 1.1s ease-in-out infinite;
}

@keyframes voiceSpeakingPulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(140, 191, 106, 0.45), 0 0 20px rgba(140, 191, 106, 0.4); }
    50% { box-shadow: 0 0 0 3px rgba(140, 191, 106, 0.75), 0 0 34px rgba(140, 191, 106, 0.7); }
}

.avatar-card {
    width: 118px;
    height: 120px;
    border-radius: 0.6rem;
    flex-shrink: 0;
}

.avatar-card.avatar-card-60 {
    width: 70.8px;
    height: 72px;
}

.avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.avatar-ring.avatar-dimmed {
    opacity: 0.5;
    filter: grayscale(0.4);
}

.avatar-stack {
    position: relative;
}

.avatar-picker-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 1.25rem;
    background: rgba(5, 5, 6, 0.68);
    backdrop-filter: blur(8px);
}

.avatar-picker-overlay.hidden {
    display: none;
}

.avatar-picker-modal {
    position: relative;
    width: min(42rem, calc(100% - 2rem));
    max-height: calc(100vh - 6rem);
    overflow: auto;
    border-radius: 1rem;
    padding: 1.5rem;
    display: grid;
    gap: 1rem;
    border: 1px solid rgba(255, 219, 190, 0.14);
    background: linear-gradient(180deg, rgba(25, 18, 15, 0.96), rgba(14, 11, 9, 0.98));
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
}

.avatar-picker-modal {
    border-color: rgba(172, 105, 59, 0.28);
    background: linear-gradient(180deg, #fffdf8 0%, #fff0dc 100%);
    color: #33231c;
    box-shadow: 0 24px 70px rgba(93, 47, 18, 0.28);
}

.avatar-picker-modal .eyebrow {
    color: #7b503b;
}

.avatar-picker-modal h2 {
    color: #241713;
}

.avatar-picker-modal .modal-close-button {
    background: rgba(74, 48, 37, 0.08);
    color: #3f291f;
    border-color: rgba(157, 89, 47, 0.28);
}

.avatar-picker-modal .modal-close-button:hover {
    background: rgba(216, 97, 47, 0.18);
}

.avatar-picker-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
    justify-items: center;
}

.avatar-picker-option {
    border: 3px solid transparent;
    border-radius: 0.6rem;
    padding: 0;
    background: rgba(78, 49, 34, 0.08);
    cursor: pointer;
    display: grid;
    place-items: center;
    overflow: hidden;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.avatar-picker-option img {
    width: 120px;
    height: 90px;
    display: block;
    object-fit: cover;
}

.avatar-picker-option:hover {
    border-color: rgba(157, 89, 47, 0.45);
}

.avatar-picker-option.selected {
    border-color: #c94f25;
    box-shadow: 0 0 0 3px rgba(201, 79, 37, 0.22), 0 12px 24px rgba(93, 47, 18, 0.18);
}

.crystal-badge {
    position: absolute;
    top: -0.4rem;
    right: -0.55rem;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 999px;
    border: 1px solid rgba(164, 230, 255, 0.72);
    background:
        radial-gradient(circle at 45% 40%, rgba(255, 255, 255, 0.95) 0 10%, transparent 20%),
        linear-gradient(180deg, #8be7ff 0%, #48a9ff 52%, #315dd3 100%);
    box-shadow: 0 0 18px rgba(114, 205, 255, 0.55);
}

.vote-badge {
    position: absolute;
    top: -0.55rem;
    left: -0.55rem;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    border: 1px solid rgba(255, 214, 148, 0.86);
    background: linear-gradient(180deg, #ffd88a 0%, #ff9a3d 52%, #d9601a 100%);
    box-shadow: 0 0 18px rgba(255, 173, 82, 0.55);
    color: #24140f;
    font-size: 0.78rem;
    font-weight: 800;
    z-index: 1;
}

.hand-count-tooltip {
    position: absolute;
    bottom: calc(100% + 0.6rem);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    padding: 0.3rem 0.65rem;
    border-radius: 0.5rem;
    background: rgba(15, 11, 9, 0.95);
    border: 1px solid rgba(255, 219, 190, 0.28);
    color: #f8eadc;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 5;
}

.hand-count-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    width: 0.55rem;
    height: 0.55rem;
    background: rgba(15, 11, 9, 0.95);
    border-right: 1px solid rgba(255, 219, 190, 0.28);
    border-bottom: 1px solid rgba(255, 219, 190, 0.28);
    transform: translate(-50%, -50%) rotate(45deg);
}

.avatar-stack:hover .hand-count-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.table-seat.votable {
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.table-seat.votable:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 215, 150, 0.7);
    box-shadow:
        0 0 0 1px rgba(255, 214, 148, 0.3) inset,
        0 0 24px rgba(255, 176, 86, 0.24);
}

.seat-body {
    display: grid;
    gap: 0.15rem;
}

.seat-body span {
    color: var(--muted);
    font-size: 0.88rem;
}

.seat-actions {
    display: flex;
    gap: 0.45rem;
}

.icon-button {
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    cursor: pointer;
}

.icon-button.primary {
    background: linear-gradient(180deg, #f08a52 0%, #c34923 100%);
    color: #160f0b;
}

.bottom-tray,
.lower-dashboard {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(22rem, 0.7fr);
    gap: 1rem;
}

.bottom-panel,
.side-panel {
    min-height: 20rem;
}

.hand-fan {
    position: relative;
    min-height: 13.5rem;
    display: flex;
    justify-content: center;
    align-items: end;
    padding-top: 1.5rem;
}

.hand-card {
    width: 8.4rem;
    height: 11.8rem;
    position: relative;
    margin-left: -2rem;
    transform-origin: center bottom;
    transform:
        translateY(var(--lift))
        rotate(calc(var(--offset) * 5deg));
    transition: transform 160ms ease, margin-top 160ms ease, box-shadow 160ms ease;
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.hand-card:first-child {
    margin-left: 0;
}

.hand-card:hover {
    transform:
        translateY(-1.25rem)
        rotate(calc((var(--index) - ((var(--count) - 1) / 2)) * 2deg))
        scale(1.03);
    z-index: 6;
}

.hand-card.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.hand-card.drag-source {
    opacity: 0.2;
}

.hand-card.dragging {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 120;
    pointer-events: none;
    margin-left: 0;
    transition: none;
    transform: rotate(0deg) scale(1.04);
    cursor: grabbing;
    filter: drop-shadow(0 20px 32px rgba(0, 0, 0, 0.34));
}

.hand-card-face,
.card-preview-face {
    width: 100%;
    height: 100%;
    border-radius: 0.9rem;
    padding: 1rem;
    border: 1px solid rgba(255, 220, 195, 0.16);
    background:
        linear-gradient(180deg, rgba(78, 46, 28, 0.96), rgba(31, 20, 15, 0.98)),
        radial-gradient(circle at top, rgba(255, 166, 97, 0.09), transparent 40%);
    display: grid;
    align-content: start;
    gap: 0.4rem;
    box-shadow: 0 18px 30px rgba(0, 0, 0, 0.24);
    user-select: none;
    -webkit-user-select: none;
    overflow: hidden;
}

.hand-card-face h3,
.card-preview-face h3 {
    margin: 0;
    font-size: 1rem;
    line-height: 1.2;
}

.hand-card-face p,
.card-preview-face p {
    margin: 0;
    font-size: 0.74rem;
    line-height: 1.28;
    color: #e8d4c2;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-type,
.card-tip {
    color: #d8b9a0;
    font-size: 0.82rem;
}

.card-preview {
    position: fixed;
    width: 16rem;
    transform: translate(-50%, -100%);
    z-index: 60;
    pointer-events: none;
}

.arena-shell {
    min-height: 100vh;
    position: relative;
    overflow: hidden;
}

.arena-board {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    padding: 1rem 1.25rem;
    display: grid;
}

.room-with-chat {
    grid-template-columns: minmax(0, 1fr) 20rem;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 1rem;
    align-items: stretch;
}

.room-with-chat .arena-topbar {
    grid-column: 1;
    grid-row: 1;
}

.room-with-chat .game-column {
    grid-column: 1;
    grid-row: 2;
}

.room-with-chat .room-chat {
    grid-column: 2;
    grid-row: 2;
}

.lobby-board {
    position: relative;
    z-index: 1;
    padding: 1rem 1.25rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 20rem;
    gap: 1rem;
    align-items: start;
}

.lobby-aside {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 1rem;
    max-height: calc(100vh - 6rem);
}

.lobby-board.hidden,
.arena-board.hidden {
    display: none;
}

.lobby-main {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 1rem;
    min-width: 0;
}

.lobby-seat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    align-content: start;
}

.lobby-seat {
    min-height: 13rem;
    border-radius: 1rem;
    border: 1px solid rgba(255, 219, 190, 0.12);
    background: linear-gradient(180deg, rgba(34, 24, 19, 0.82), rgba(16, 12, 10, 0.92));
    display: grid;
    place-items: center;
    gap: 0.7rem;
    padding: 1rem;
    position: relative;
    text-align: center;
    user-select: none;
    -webkit-user-select: none;
}

.lobby-seat.self {
    border-color: rgba(255, 179, 106, 0.55);
    box-shadow: 0 0 0 1px rgba(255, 179, 106, 0.22) inset;
}

.lobby-seat.empty {
    border-style: dashed;
    background: rgba(255, 255, 255, 0.025);
}

.lobby-seat.empty .lobby-ai-button {
    opacity: 0;
    transform: translateY(0.4rem);
    pointer-events: none;
    transition: opacity 160ms ease, transform 160ms ease;
}

.lobby-seat.empty:hover {
    border-color: rgba(255, 186, 112, 0.58);
    background: rgba(255, 145, 72, 0.07);
}

.lobby-seat.empty:hover .lobby-ai-button {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.lobby-seat small {
    position: absolute;
    top: 0.8rem;
    left: 0.85rem;
    color: var(--muted);
    font-weight: 700;
}

.lobby-kick-button {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    width: 1.7rem;
    height: 1.7rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid rgba(255, 107, 107, 0.35);
    background: rgba(255, 107, 107, 0.12);
    color: #ff6b6b;
    font-size: 0.8rem;
    line-height: 1;
    cursor: pointer;
}

.lobby-kick-button:hover {
    background: rgba(255, 107, 107, 0.28);
}

.lobby-seat strong,
.lobby-seat span {
    display: block;
}

.lobby-seat span {
    color: var(--muted);
    margin-top: 0.2rem;
}

.lobby-side {
    display: grid;
    align-content: start;
    gap: 1rem;
    padding: 1rem;
    border-radius: 1rem;
    border: 1px solid rgba(255, 219, 190, 0.1);
    background: rgba(16, 12, 10, 0.86);
    backdrop-filter: blur(14px);
}

.lobby-aside .room-chat {
    height: 100%;
    min-height: 24rem;
}

.lobby-code {
    display: block;
    padding: 0.9rem 1rem;
    border-radius: 0.8rem;
    border: 1px solid rgba(255, 219, 190, 0.12);
    background: rgba(255, 255, 255, 0.04);
    font-size: 2rem;
    letter-spacing: 0;
    text-align: center;
    user-select: all;
}

.lobby-code-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.65rem;
    align-items: stretch;
}

.lobby-code-copy {
    min-width: 4.25rem;
}

.game-column {
    position: relative;
    min-width: 0;
    display: grid;
    gap: 1rem;
}

.arena-topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.9rem 1rem;
    border: 1px solid rgba(255, 219, 190, 0.1);
    border-radius: 0.75rem;
    background: rgba(18, 13, 11, 0.64);
    backdrop-filter: blur(14px);
}

.arena-topbar h1,
.reveal-header h2,
.winner-card h2 {
    margin: 0;
}

.arena-meta {
    margin: 0.35rem 0 0;
    color: var(--muted);
}

.table-status-bar {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 3;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: flex-start;
    gap: 0.65rem;
    max-width: min(24rem, calc(100% - 1.5rem));
}

.skip-control {
    display: grid;
    justify-items: stretch;
    gap: 0.4rem;
    width: 100%;
    margin-top: 0.85rem;
}

.skip-control .button {
    width: 100%;
}

.skip-warning {
    margin: 0;
    max-width: 100%;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
    color: #ff6b6b;
}

.skip-warning.hidden {
    display: none;
}

.discussion-ack-bar {
    display: grid;
    justify-items: center;
    gap: 0.4rem;
    width: 100%;
    padding: 0.6rem 1rem;
    border-radius: 0.9rem;
    border: 1px solid rgba(255, 219, 190, 0.12);
    background: rgba(16, 12, 10, 0.5);
}

.discussion-ack-bar.hidden {
    display: none;
}

.discussion-ack-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
}

.discussion-ack-chip {
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    background: rgba(255, 176, 104, 0.14);
    color: #ffb068;
    font-size: 0.78rem;
    font-weight: 600;
}

.arena-table {
    min-height: 0;
    display: grid;
}

.arena-table .table-surface {
    min-height: calc(100vh - 7.5rem);
    border-radius: 1.2rem;
    width: 100%;
}

.room-chat {
    height: calc(100vh - 2rem);
    display: grid;
    grid-template-rows: minmax(0, 7fr) minmax(0, 3fr);
    gap: 0.6rem;
    padding: 0.75rem;
    border-radius: 1rem;
    border: 1px solid rgba(20, 15, 12, 0.12);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(14px);
    color: #241a14;
}

.room-chat .muted-text {
    color: rgba(36, 26, 20, 0.55);
}

.room-chat-column {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 0.6rem;
    min-width: 0;
    min-height: 0;
}

.room-log-column {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 0.6rem;
    min-width: 0;
    min-height: 0;
    padding-top: 0.6rem;
    border-top: 1px solid rgba(20, 15, 12, 0.12);
}

.room-log-column .log-list {
    max-height: none;
    gap: 0.45rem;
}

.room-chat .log-list p {
    background: rgba(20, 15, 12, 0.04);
    border-color: rgba(20, 15, 12, 0.08);
}

.room-log-column .log-list p {
    padding: 0.5rem 0.6rem;
    font-size: 0.78rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.room-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    min-height: 1.8rem;
}

.room-chat-header strong,
.chat-message p {
    margin: 0;
}

.chat-messages {
    overflow-y: auto;
    display: grid;
    align-content: start;
    gap: 0.35rem;
    padding-right: 0.25rem;
}

.chat-message {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 0.45rem;
    padding: 0.35rem 0.55rem;
    border-radius: 0.65rem;
    border: 1px solid rgba(20, 15, 12, 0.08);
    background: rgba(20, 15, 12, 0.04);
    min-height: 2rem;
    line-height: 1.35;
}

.chat-message.self {
    border-color: rgba(232, 106, 51, 0.28);
    background: rgba(232, 106, 51, 0.1);
}

.chat-message strong {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: #b5501f;
    font-size: 0.82rem;
    white-space: nowrap;
}

.chat-role-tag {
    padding: 0.12rem 0.35rem;
    border-radius: 999px;
    background: rgba(85, 65, 50, 0.14);
    color: #755b4d;
    font-size: 0.68rem;
    font-weight: 700;
}

.chat-message p {
    min-width: 0;
    overflow-wrap: anywhere;
    color: #241a14;
    font-size: 0.9rem;
}

.chat-message span {
    color: rgba(36, 26, 20, 0.55);
    font-size: 0.72rem;
    white-space: nowrap;
}

.chat-message .chat-role-tag {
    color: #755b4d;
    font-size: 0.68rem;
}

.chat-form-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.45rem;
    align-items: end;
}

.chat-form-panel textarea {
    width: 100%;
    resize: none;
    min-height: 2.6rem;
    max-height: 5rem;
    padding: 0.6rem 0.7rem;
    border-radius: 0.65rem;
    border: 1px solid rgba(20, 15, 12, 0.16);
    background: rgba(20, 15, 12, 0.04);
    color: #241a14;
    font: inherit;
}

.chat-form-panel .button {
    min-height: 2.6rem;
    padding-inline: 0.85rem;
}

.chat-form-panel textarea:focus {
    outline: 1px solid rgba(255, 176, 104, 0.45);
    border-color: rgba(255, 176, 104, 0.45);
}

.table-countdown {
    position: relative;
    z-index: 1;
    display: grid;
    justify-items: center;
    gap: 0.35rem;
    text-align: center;
    user-select: none;
    -webkit-user-select: none;
}

.countdown-value {
    font-size: clamp(3rem, 7vw, 5.5rem);
    line-height: 1;
    font-weight: 700;
    color: #fff2e7;
    text-shadow: 0 0 28px rgba(255, 139, 62, 0.18);
}

.countdown-copy {
    margin: 0;
    color: #ddc8b6;
}

.active-scroll-effect {
    margin: 0;
    max-width: min(80vw, 26rem);
    color: #ffb068;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 0 14px rgba(255, 139, 62, 0.2);
}

.round-indicator {
    position: relative;
    z-index: 1;
    margin: 0;
    font-size: 0.95rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #ffb068;
    text-shadow: 0 0 18px rgba(255, 139, 62, 0.25);
}

.center-emblem {
    position: absolute;
    width: min(30vw, 16rem);
    height: min(30vw, 16rem);
    border-radius: 999px;
    border: 1px solid rgba(255, 196, 149, 0.1);
    background:
        radial-gradient(circle, rgba(255, 167, 99, 0.14) 0%, rgba(255, 167, 99, 0.03) 40%, transparent 70%),
        radial-gradient(circle, rgba(0, 0, 0, 0.24) 0%, transparent 65%);
}

.reveal-area {
    position: relative;
    z-index: 1;
    width: min(44rem, 100%);
    display: grid;
    gap: 0.8rem;
    justify-items: center;
}

.reveal-header {
    width: 100%;
    text-align: center;
}

.revealed-cards {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 0.9rem;
    flex-wrap: wrap;
}

.reveal-card,
.pending-card,
.overlay-card,
.winner-card,
.round-result-modal {
    border: 1px solid rgba(255, 219, 190, 0.12);
    background: linear-gradient(180deg, rgba(44, 28, 21, 0.94), rgba(20, 15, 12, 0.98));
}

.faction-good {
    background:
        linear-gradient(180deg, rgba(255, 252, 247, 0.96), rgba(230, 224, 214, 0.94));
    border-color: rgba(255, 244, 226, 0.8);
    color: #241711;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
}

.faction-good .eyebrow,
.faction-good span,
.faction-good p {
    color: #5b4a40;
}

.faction-good h3,
.faction-good strong {
    color: #21140f;
}

.faction-bad {
    background:
        linear-gradient(180deg, rgba(122, 21, 27, 0.96), rgba(72, 11, 16, 0.96));
    border-color: rgba(255, 138, 138, 0.36);
    color: #fff0ef;
    box-shadow: inset 0 0 0 1px rgba(255, 162, 162, 0.14);
}

.faction-bad .eyebrow,
.faction-bad span,
.faction-bad p {
    color: #ffd8d6;
}

.faction-bad h3,
.faction-bad strong {
    color: #fff8f7;
}

.card-neutral {
    background:
        linear-gradient(180deg, rgba(255, 252, 247, 0.97), rgba(232, 226, 216, 0.95));
    border-color: rgba(255, 244, 226, 0.82);
    color: #231611;
}

.card-neutral .eyebrow,
.card-neutral .card-type,
.card-neutral p,
.card-neutral span {
    color: #5f4d43;
}

.card-neutral h3,
.card-neutral strong {
    color: #21140f;
}

.card-hostile {
    background:
        linear-gradient(180deg, rgba(122, 21, 27, 0.97), rgba(72, 11, 16, 0.97));
    border-color: rgba(255, 138, 138, 0.36);
    color: #fff0ef;
}

.card-hostile .eyebrow,
.card-hostile .card-type,
.card-hostile p,
.card-hostile span {
    color: #ffd8d6;
}

.card-hostile h3,
.card-hostile strong {
    color: #fff8f7;
}

.card-sage {
    background:
        linear-gradient(180deg, rgba(233, 248, 235, 0.97), rgba(193, 226, 198, 0.95));
    border-color: rgba(171, 222, 180, 0.82);
    color: #16301d;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.card-sage .eyebrow,
.card-sage .card-type,
.card-sage p,
.card-sage span {
    color: #45614d;
}

.card-sage h3,
.card-sage strong {
    color: #14281a;
}

.reveal-card {
    width: 11rem;
    min-height: 9rem;
    border-radius: 0.8rem;
    padding: 0.9rem;
    display: grid;
    gap: 0.35rem;
}

.reveal-card p,
.winner-card p,
.faction-player span {
    margin: 0;
}

.seat-band {
    position: absolute;
    display: flex;
    gap: 0.5rem;
    padding: 0.85rem;
}

.seat-band.top,
.seat-band.bottom {
    justify-content: center;
}

.seat-band.top {
    top: 0.75rem;
    left: 1rem;
    right: 12.5rem;
}

.seat-band.bottom {
    bottom: 1rem;
    left: 17rem;
    right: 24rem;
    flex-wrap: wrap-reverse;
    row-gap: 0.6rem;
}

.seat-band.left,
.seat-band.right {
    flex-direction: column;
    justify-content: center;
}

.seat-band.left {
    left: 1rem;
    top: 5rem;
    bottom: 6rem;
}

.seat-band.right {
    right: 1rem;
    top: 15rem;
    bottom: 15rem;
}

.identity-overlay {
    position: absolute;
    z-index: 2;
}

.identity-overlay {
    right: 1rem;
    top: 5.5rem;
    width: min(11.5rem, calc(100% - 2rem));
    max-height: calc(100vh - 30rem);
}

.overlay-card {
    border-radius: 0.8rem;
    padding: 0.9rem 1rem;
}

.identity-stack {
    display: grid;
    gap: 0.9rem;
}

.identity-divider {
    height: 1px;
    background: rgba(255, 219, 190, 0.12);
}

.overlay-card,
.pending-zone,
.pending-card,
.reveal-card,
.faction-player,
.identity-mini,
.status-icon,
.seat-body,
.hand-header,
.pending-zone-copy {
    user-select: none;
    -webkit-user-select: none;
}

.identity-mini {
    display: grid;
    gap: 0.35rem;
    max-height: calc(100vh - 30rem);
    overflow-y: auto;
    padding-right: 0.35rem;
}

.identity-mini p {
    margin: 0;
}

.identity-mini h3,
.faction-group h3 {
    margin: 0;
}

.pending-zone {
    z-index: 3;
    padding: 0.9rem;
    border-radius: 1rem;
    border: 1px dashed rgba(255, 196, 149, 0.3);
    background: rgba(20, 15, 12, 0.7);
    display: grid;
    gap: 0.8rem;
    transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.center-drop-zone {
    position: relative;
    min-width: min(26rem, calc(100vw - 4rem));
    min-height: 14rem;
    padding: 1.1rem 1.25rem 1rem;
    align-content: start;
    justify-items: center;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.28);
}

.pending-zone.ready {
    transform: scale(1.02);
    border-color: rgba(255, 186, 112, 0.78);
    background: rgba(255, 128, 66, 0.14);
}

.pending-zone-copy {
    display: grid;
    gap: 0.2rem;
}

.pending-zone-copy span {
    color: var(--muted);
    font-size: 0.88rem;
}

.center-drop-copy {
    justify-items: center;
    text-align: center;
}

.pending-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    justify-content: center;
}

.pending-card {
    min-width: 5.2rem;
    padding: 0.65rem 0.7rem;
    border-radius: 0.7rem;
    display: grid;
    gap: 0.2rem;
    text-align: center;
}

.pending-card.self {
    border-color: rgba(255, 179, 106, 0.45);
}

.pending-card-status {
    font-weight: 600;
}

.pending-card.played .pending-card-status {
    color: #5fd888;
}

.pending-card.skipped .pending-card-status {
    color: #ff6b6b;
}

.hand-zone {
    position: absolute;
    right: 1rem;
    z-index: 3;
    bottom: 1rem;
    width: min(22rem, calc(100% - 2rem));
    padding: 0.9rem 1rem 0.7rem;
    border-radius: 1rem;
    border: 1px solid rgba(255, 219, 190, 0.1);
    background: rgba(18, 13, 11, 0.76);
    backdrop-filter: blur(12px);
}

.hand-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}

.hand-header .eyebrow,
.pending-zone-copy strong {
    margin: 0;
}

.hand-fan {
    min-height: 12rem;
    justify-content: flex-start;
    padding-left: 1.5rem;
    padding-right: 0.75rem;
}

.winner-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    overflow: auto;
    background: rgba(10, 8, 7, 0.72);
    backdrop-filter: blur(10px);
}

.winner-overlay.hidden {
    display: none;
}

.night-overlay {
    position: absolute;
    inset: 0;
    z-index: 6;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(8px);
}

.night-overlay.hidden {
    display: none;
}

.phase-transition-overlay {
    position: absolute;
    inset: 0;
    z-index: 60;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background: rgba(8, 6, 5, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 550ms ease;
}

.phase-transition-overlay.is-visible {
    opacity: 1;
}

.phase-transition-overlay.hidden {
    display: none;
}

.phase-transition-frame {
    position: relative;
    display: grid;
    justify-items: center;
    gap: 0.6rem;
    padding: 2.4rem 4.5rem;
    background: linear-gradient(145deg, rgba(47, 25, 17, 0.55), rgba(10, 8, 8, 0.6));
    box-shadow: 0 0 70px rgba(240, 94, 47, 0.22), inset 0 0 36px rgba(240, 94, 47, 0.08);
    text-align: center;
    transform: scale(0.9);
    transition: transform 550ms ease;
}

.phase-transition-overlay.is-visible .phase-transition-frame {
    transform: scale(1);
}

.phase-transition-corner {
    position: absolute;
    width: 1.75rem;
    height: 1.75rem;
    border: 2px solid rgba(255, 197, 142, 0.8);
}

.phase-transition-corner.tl {
    top: 0;
    left: 0;
    border-right: none;
    border-bottom: none;
}

.phase-transition-corner.tr {
    top: 0;
    right: 0;
    border-left: none;
    border-bottom: none;
}

.phase-transition-corner.bl {
    bottom: 0;
    left: 0;
    border-right: none;
    border-top: none;
}

.phase-transition-corner.br {
    bottom: 0;
    right: 0;
    border-left: none;
    border-top: none;
}

.phase-transition-eyebrow {
    margin: 0;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    font-size: 0.75rem;
    color: rgba(255, 197, 142, 0.75);
}

.phase-transition-title {
    margin: 0;
    font-size: clamp(2.2rem, 7vw, 4rem);
    letter-spacing: 0.08em;
    background: linear-gradient(180deg, #ffe6c9, #ff9d5c);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 32px rgba(240, 94, 47, 0.45);
}

.opening-overlay {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background: #000;
}

.opening-overlay.hidden {
    display: none;
}

.opening-panel {
    width: min(36rem, calc(100% - 2rem));
    min-height: 17rem;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 0.9rem;
    padding: 2rem;
    border: 1px solid rgba(255, 197, 142, 0.28);
    border-radius: 1rem;
    background: linear-gradient(145deg, rgba(47, 25, 17, 0.98), rgba(10, 8, 8, 0.99));
    box-shadow: 0 0 54px rgba(240, 94, 47, 0.18);
    text-align: center;
    opacity: 0;
    transform: translateY(0.8rem) scale(0.98);
    transition: opacity 650ms ease, transform 650ms ease;
}

.opening-panel.scroll-reveal {
    border-color: rgba(176, 137, 255, 0.35);
    background: linear-gradient(145deg, rgba(33, 22, 55, 0.98), rgba(8, 7, 14, 0.99));
    box-shadow: 0 0 54px rgba(137, 99, 255, 0.2);
}

.opening-panel.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.opening-panel h2 {
    margin: 0;
    font-size: clamp(2.2rem, 7vw, 4rem);
}

.opening-meta,
.opening-summary {
    margin: 0;
}

.opening-meta {
    color: #ffc39b;
}

.scroll-reveal .opening-meta {
    color: #d8c5ff;
}

.opening-summary {
    max-width: 30rem;
    color: #e7d4c3;
    line-height: 1.7;
}

.scroll-announcement-overlay {
    position: absolute;
    inset: 0;
    z-index: 7;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
}

.scroll-announcement-overlay.hidden {
    display: none;
}

.scroll-announcement-panel {
    position: relative;
    width: min(34rem, calc(100% - 2rem));
    display: grid;
    justify-items: center;
    gap: 0.75rem;
    padding: 2rem;
    border: 1px solid rgba(176, 137, 255, 0.35);
    border-radius: 1rem;
    background: linear-gradient(145deg, rgba(33, 22, 55, 0.98), rgba(8, 7, 14, 0.99));
    box-shadow: 0 0 54px rgba(137, 99, 255, 0.2);
    text-align: center;
}

.scroll-announcement-panel h2 {
    margin: 0;
}

.scroll-announcement-description {
    margin: 0;
    color: #e7d4c3;
    line-height: 1.7;
}

.scroll-announcement-caster {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #d8c5ff;
}

.shadow-insight-overlay {
    position: absolute;
    inset: 0;
    z-index: 7;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
}

.shadow-insight-overlay.hidden {
    display: none;
}

.shadow-insight-panel {
    position: relative;
    width: min(34rem, calc(100% - 2rem));
    display: grid;
    justify-items: center;
    gap: 0.75rem;
    padding: 2rem;
    border: 1px solid rgba(190, 60, 60, 0.4);
    border-radius: 1rem;
    background: linear-gradient(145deg, rgba(50, 12, 12, 0.98), rgba(8, 7, 14, 0.99));
    box-shadow: 0 0 54px rgba(190, 60, 60, 0.25);
    text-align: center;
}

.shadow-insight-panel h2 {
    margin: 0;
}

.shadow-insight-description {
    margin: 0;
    color: #e7d4c3;
    line-height: 1.7;
}

.room-settings-overlay {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(8px);
}

.room-settings-overlay.hidden {
    display: none;
}

.room-settings-panel {
    position: relative;
    width: min(28rem, calc(100% - 2rem));
    max-height: calc(100vh - 3rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    display: grid;
    justify-items: center;
    gap: 0.9rem;
    padding: 2rem;
    border: 1px solid rgba(176, 137, 255, 0.35);
    border-radius: 1rem;
    background: linear-gradient(145deg, rgba(33, 22, 55, 0.98), rgba(8, 7, 14, 0.99));
    box-shadow: 0 0 54px rgba(137, 99, 255, 0.2);
    text-align: center;
}

.room-settings-panel h2 {
    margin: 0;
    color: #fff;
}

.room-settings-panel .entry-form {
    width: 100%;
}

.room-settings-panel .entry-form span {
    color: #fff;
}

.room-settings-panel .entry-form .room-role-settings > span {
    color: #ffd59e;
    font-weight: 700;
}

.card-reveal-overlay {
    position: absolute;
    inset: 0;
    z-index: 7;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
}

.card-reveal-overlay.hidden {
    display: none;
}

.card-reveal-panel {
    position: relative;
    width: min(30rem, calc(100% - 2rem));
    display: grid;
    justify-items: center;
    gap: 0.75rem;
    padding: 2rem;
    border: 1px solid rgba(255, 138, 138, 0.35);
    border-radius: 1rem;
    background: linear-gradient(145deg, rgba(55, 22, 26, 0.98), rgba(14, 8, 8, 0.99));
    box-shadow: 0 0 54px rgba(255, 107, 107, 0.18);
    text-align: center;
}

.card-reveal-panel h2 {
    margin: 0;
    line-height: 1.6;
}

.card-reveal-card {
    width: 10.5rem;
    height: 14.5rem;
}

.blank-card-overlay {
    position: absolute;
    inset: 0;
    z-index: 7;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
}

.blank-card-overlay.hidden {
    display: none;
}

.blank-card-panel {
    position: relative;
    width: min(28rem, calc(100% - 2rem));
    display: grid;
    justify-items: center;
    gap: 0.75rem;
    padding: 2rem;
    border: 1px solid rgba(200, 200, 210, 0.35);
    border-radius: 1rem;
    background: linear-gradient(145deg, rgba(42, 42, 48, 0.98), rgba(10, 10, 12, 0.99));
    box-shadow: 0 0 54px rgba(200, 200, 210, 0.16);
    text-align: center;
}

.blank-card-panel h2 {
    margin: 0;
    line-height: 1.6;
}

.modal-close-button {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 2rem;
    height: 2rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid rgba(255, 219, 190, 0.2);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
}

.modal-close-button:hover {
    background: rgba(255, 255, 255, 0.12);
}

.modal-close-button.hidden {
    display: none;
}

.action-overlay {
    position: absolute;
    inset: 0;
    z-index: 6;
    display: grid;
    place-items: center;
    padding: 1.25rem;
    background: rgba(5, 5, 6, 0.68);
    backdrop-filter: blur(8px);
}

.action-overlay.hidden {
    display: none;
}

.action-modal {
    position: relative;
    width: min(68rem, calc(100% - 2rem));
    max-height: calc(100vh - 6rem);
    overflow: auto;
    border-radius: 1rem;
    padding: 1.25rem;
    display: grid;
    gap: 1rem;
    border: 1px solid rgba(255, 219, 190, 0.14);
    background: linear-gradient(180deg, rgba(25, 18, 15, 0.96), rgba(14, 11, 9, 0.98));
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
}

.action-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

.action-header h2 {
    margin: 0;
}

.action-candidates {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.action-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: 0.9rem;
}

.action-card-pick {
    min-height: 7.5rem;
    border-radius: 0.85rem;
    border: 1px solid rgba(255, 219, 190, 0.16);
    padding: 1rem;
    background: linear-gradient(180deg, rgba(45, 28, 22, 0.95), rgba(20, 15, 12, 0.98));
    color: var(--text);
    font: inherit;
    cursor: pointer;
}

.action-card-pick.selected {
    transform: translateY(-2px);
    box-shadow: 0 0 0 1px rgba(255, 187, 132, 0.26) inset, 0 10px 24px rgba(0, 0, 0, 0.22);
}

.action-card-pick.card-back {
    background:
        linear-gradient(180deg, rgba(53, 38, 30, 0.96), rgba(24, 19, 16, 0.98)),
        repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0 8px, transparent 8px 16px);
}

.action-card-pick:disabled {
    cursor: default;
    opacity: 0.8;
}

.night-panel {
    width: min(56rem, calc(100% - 2rem));
    min-height: 20rem;
    border-radius: 1rem;
    padding: 1.5rem;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 0.9rem;
    border: 1px solid rgba(255, 219, 190, 0.14);
    background: rgba(19, 14, 12, 0.82);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
    text-align: center;
}

.night-panel h2,
.night-seat strong {
    margin: 0;
}

.night-timer {
    font-size: clamp(3rem, 8vw, 5.5rem);
    line-height: 1;
    font-weight: 700;
    color: #fff2e7;
}

.night-message {
    margin: 0;
    color: #e7d4c3;
}

.night-special-seats {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: 0.9rem;
    margin-top: 0.4rem;
}

.night-seat {
    border-radius: 0.85rem;
    padding: 1rem;
    display: grid;
    justify-items: center;
    gap: 0.35rem;
    border: 1px solid rgba(255, 219, 190, 0.12);
    background: linear-gradient(180deg, rgba(44, 28, 21, 0.94), rgba(20, 15, 12, 0.98));
}

.night-seat .avatar-ring {
    width: 118px;
    height: 120px;
    border-radius: 0.6rem;
}

.night-seat span {
    color: var(--muted);
}

.round-result-overlay {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: grid;
    place-items: center;
    padding: 1.25rem;
    background: rgba(8, 7, 6, 0.66);
    backdrop-filter: blur(6px);
}

.round-result-overlay.hidden {
    display: none;
}

.last-match-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 1.25rem;
    background: rgba(8, 7, 6, 0.76);
    backdrop-filter: blur(6px);
}

.last-match-overlay.hidden {
    display: none;
}

.last-match-modal {
    width: min(76rem, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    overflow: hidden;
    border: 1px solid rgba(255, 219, 190, 0.18);
    border-radius: 1rem;
    padding: 1.25rem;
    background: linear-gradient(180deg, rgba(44, 28, 21, 0.98), rgba(20, 15, 12, 0.99));
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 1rem;
}

.last-match-content {
    min-height: 0;
    overflow-y: auto;
    display: grid;
    gap: 1.25rem;
    padding-right: 0.35rem;
}

.last-match-section {
    display: grid;
    gap: 0.75rem;
    padding: 1rem;
    border: 1px solid rgba(255, 219, 190, 0.12);
    border-radius: 0.8rem;
    background: rgba(255, 242, 225, 0.035);
}

.last-match-section > h2,
.last-match-section > h3 {
    margin: 0;
}

.last-match-modal > .round-result-header h2,
.last-match-winner > h2,
.last-match-section > h3 {
    color: #ffb454;
    text-shadow: 0 0 14px rgba(255, 139, 50, 0.35);
}

.round-result-modal {
    width: min(72rem, calc(100% - 2rem));
    max-height: calc(100vh - 6rem);
    overflow: auto;
    border-radius: 1rem;
    padding: 1.25rem;
    display: grid;
    gap: 1rem;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
}

.round-result-header {
    position: relative;
    display: grid;
    gap: 0.3rem;
}

.round-result-header .modal-close-button {
    position: absolute;
    top: 0;
    right: 0;
}

.previous-round-result-button {
    position: absolute;
    z-index: 3;
    bottom: 1rem;
    left: 1rem;
}

.round-result-header h2 {
    margin: 0;
}

.round-result-status-group {
    display: grid;
    gap: 0.5rem;
}

.round-result-status-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.round-status-player {
    width: 7rem;
    border-radius: 0.75rem;
    padding: 0.6rem;
    display: grid;
    justify-items: center;
    gap: 0.25rem;
    text-align: center;
    border: 1px solid rgba(255, 219, 190, 0.1);
    background: rgba(255, 255, 255, 0.03);
}

.round-status-player.self {
    border-color: rgba(255, 179, 106, 0.45);
}

.round-status-player strong {
    font-size: 0.85rem;
    line-height: 1.2;
}

.round-status-tag {
    font-size: 0.78rem;
    font-weight: 700;
}

.round-status-player.skipped .round-status-tag {
    color: #ff6b6b;
}

.round-status-player.played .round-status-tag {
    color: #5fd888;
}

.round-result-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 0.9rem;
}

.modal-card {
    width: auto;
    min-height: 8rem;
}

.round-result-actions {
    display: flex;
    justify-content: flex-end;
}

.winner-card {
    width: min(48rem, calc(100% - 2rem));
    border-radius: 1rem;
    padding: 1.4rem;
    display: grid;
    justify-items: center;
    gap: 1rem;
    text-align: center;
    border-color: rgba(255, 205, 170, 0.2);
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.42);
}

.winner-reason-text {
    margin: -0.5rem 0 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.winner-side-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.9rem;
}

.winner-side-player {
    display: grid;
    justify-items: center;
    gap: 0.4rem;
}

.winner-side-player span {
    font-weight: 700;
    color: var(--muted);
    font-size: 0.85rem;
}

.winner-role-text.role-color-sage {
    color: #4ade80;
}

.winner-role-text.role-color-good {
    color: #ffffff;
}

.winner-role-text.role-color-bad {
    color: #f87171;
}

.winner-player-id {
    color: #ffffff;
}

.winner-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.avatar-ring.small {
    width: 2.4rem;
    height: 2.4rem;
    font-size: 0.85rem;
}

.note-stack {
    display: grid;
    gap: 0.75rem;
    margin-top: 1rem;
}

.note-stack p {
    margin: 0;
    padding: 0.85rem 1rem;
    border-radius: 0.7rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

@keyframes emberFloat {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0.25;
    }
    50% {
        transform: translateY(-12px) translateX(4px);
        opacity: 0.6;
    }
    100% {
        transform: translateY(-22px) translateX(-3px);
        opacity: 0.18;
    }
}

@keyframes phasePulse {
    0%,
    100% {
        box-shadow: 0 0 0 rgba(255, 140, 82, 0);
    }
    50% {
        box-shadow: 0 0 18px rgba(255, 140, 82, 0.28);
    }
}

.lobby-room-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
    gap: 1rem;
}

.lobby-room-card {
    min-height: 10rem;
    display: grid;
    align-content: space-between;
    justify-items: start;
    gap: 0.4rem;
    padding: 1rem;
    text-align: left;
    border-radius: 0.9rem;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(44, 28, 21, 0.95), rgba(27, 18, 14, 0.98));
    color: var(--text);
    font: inherit;
    cursor: default;
    transition: border-color 160ms ease, transform 160ms ease;
}

.lobby-room-actions {
    width: 100%;
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transform: translateY(0.25rem);
    transition: opacity 160ms ease, transform 160ms ease;
}

.lobby-room-card:hover .lobby-room-actions,
.lobby-room-card:focus-within .lobby-room-actions {
    opacity: 1;
    transform: translateY(0);
}

.lobby-room-actions .button {
    min-height: 2.35rem;
    padding: 0.45rem 0.75rem;
    flex: 1;
}

.lobby-room-card:hover {
    border-color: rgba(255, 179, 106, 0.45);
    transform: translateY(-2px);
}

.lobby-room-card strong {
    font-size: 1.05rem;
}

.lobby-room-card span {
    color: var(--muted);
    font-size: 0.85rem;
}

.public-lobby-shell {
    width: min(76rem, 100%);
    margin: 1.5rem auto 0;
}

.public-lobby-page {
    position: relative;
    overflow: hidden;
    margin: 0;
    padding: 1.5rem 1.75rem;
    border: 1px solid rgba(172, 105, 59, 0.2);
    border-radius: 1.4rem 1.4rem 0.65rem 0.65rem;
}

.public-lobby-page::after {
    content: '';
    position: absolute;
    right: 12%;
    bottom: -3rem;
    width: 16rem;
    height: 7rem;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(255, 169, 78, 0.22), transparent 68%);
    pointer-events: none;
}

.public-lobby-page > * {
    position: relative;
    z-index: 1;
}

.public-lobby-room-list {
    min-height: 13rem;
    margin: 0.7rem 0 0;
    padding: 1.5rem;
    border: 1px solid rgba(172, 105, 59, 0.15);
    border-radius: 0.65rem 0.65rem 1.4rem 1.4rem;
}

.public-lobby-empty {
    min-height: 9rem;
    margin: 0;
    display: grid;
    place-items: center;
    text-align: center;
    border: 1px dashed rgba(172, 105, 59, 0.3);
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.35);
}

.public-lobby-empty.hidden {
    display: none;
}

.lobby-room-card.unavailable {
    opacity: 0.45;
    cursor: default;
}

.lobby-room-card.unavailable:hover {
    border-color: var(--line);
    transform: none;
}

.action-modal.compact {
    width: min(26rem, calc(100% - 2rem));
}

.info-list,
.plain-list {
    gap: 0.75rem;
}

.info-list div {
    display: grid;
    gap: 0.15rem;
}

.info-list dt {
    color: var(--muted);
}

.home-lore-section {
    width: 100%;
    display: grid;
    gap: 1rem;
    margin-top: 1.5rem;
}

.home-lore-card {
    padding: 1.5rem;
    border: 1px solid var(--line);
    border-radius: 0.75rem;
    background: linear-gradient(180deg, rgba(44, 28, 21, 0.9), rgba(20, 15, 12, 0.96));
}

.home-lore-card h2,
.home-lore-card h3,
.home-lore-card h4,
.home-lore-card p,
.home-lore-card ul {
    margin-top: 0;
}

.home-lore-card h2 {
    margin-bottom: 0.75rem;
    line-height: 1.2;
}

.home-lore-heading {
    margin-bottom: 0.75rem;
    color: var(--text);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.home-lore-subheading {
    margin-bottom: 0.75rem;
}

.home-lore-card h3 {
    margin-bottom: 0.55rem;
    color: #ffd6b8;
    font-size: 1.05rem;
}

.home-lore-card h4 {
    margin-bottom: 0.45rem;
    color: #f3c9a8;
    font-size: 1rem;
}

.home-lore-card p,
.home-lore-card li,
.term-grid span,
.character-card-grid p {
    color: #e1ccba;
    line-height: 1.78;
}

.home-lore-card ul {
    padding-left: 1.2rem;
}

.home-lore-card li {
    margin-bottom: 0.45rem;
}

.home-lore-intro {
    border-color: rgba(255, 179, 106, 0.24);
    background:
        linear-gradient(180deg, rgba(48, 31, 22, 0.93), rgba(22, 15, 12, 0.97)),
        rgba(255, 255, 255, 0.03);
}

.home-rules-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    align-items: stretch;
}

.home-rule-card {
    display: grid;
    grid-template-rows: auto auto 1fr;
}

.home-rule-body {
    display: block;
}

.home-rule-body h3:not(:first-child),
.home-rule-body h4:not(:first-child) {
    margin-top: 1.15rem;
}

.official-news-card {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    gap: 0.85rem;
    height: 600px;
}

.official-news-card h2 {
    margin-bottom: 0;
}

.official-news-list {
    display: grid;
    align-content: start;
    gap: 0.65rem;
    min-height: 0;
    overflow: hidden;
}

.official-news-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(255, 219, 190, 0.12);
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.035);
    color: var(--text);
    text-decoration: none;
}

.official-news-item:hover {
    border-color: rgba(255, 179, 106, 0.32);
    background: rgba(255, 179, 106, 0.08);
}

.official-news-item span {
    overflow-wrap: anywhere;
    font-weight: 700;
}

.official-news-item time,
.news-detail-card time {
    color: #e1ccba;
    font-size: 0.92rem;
}

.official-news-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
    justify-content: center;
    padding-top: 0.35rem;
    border-top: 1px solid rgba(255, 219, 190, 0.12);
}

.official-news-pagination a,
.official-news-pagination span {
    min-width: 2.2rem;
    min-height: 2.2rem;
    padding: 0.45rem 0.65rem;
    border: 1px solid rgba(255, 219, 190, 0.14);
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    text-decoration: none;
    font-size: 0.92rem;
}

.official-news-pagination a:hover {
    border-color: rgba(255, 179, 106, 0.32);
    background: rgba(255, 179, 106, 0.08);
}

.official-news-pagination .active {
    background: #f08a52;
    border-color: #f08a52;
    color: #160f0b;
    font-weight: 700;
}

.official-news-pagination .disabled {
    color: rgba(225, 204, 186, 0.45);
}

.news-detail-section {
    width: min(920px, calc(100% - 2rem));
    margin: 2rem auto;
    display: grid;
    gap: 1rem;
}

.news-back-link {
    color: #ffd6b8;
    text-decoration: none;
}

.news-back-link:hover {
    color: var(--text);
}

.news-detail-card {
    display: grid;
    gap: 0.85rem;
}

.news-detail-card h1 {
    margin: 0;
    line-height: 1.2;
}

.news-content {
    display: grid;
    gap: 0.8rem;
    margin-top: 0.5rem;
}

.news-content p {
    margin: 0;
    white-space: pre-wrap;
}

.news-content h2 {
    margin: 0.75rem 0 0;
    color: #f4d9ba;
    font-size: 1.2rem;
}

.news-content ul,
.news-content ol {
    margin: 0;
    padding-left: 1.4rem;
}

.news-content a {
    color: #ffd08a;
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

.news-content a:hover {
    color: #fff0d5;
}

.scroll-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.scroll-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 34rem;
    color: #e1ccba;
}

.scroll-table th,
.scroll-table td {
    padding: 0.65rem 0.75rem;
    border: 1px solid rgba(255, 219, 190, 0.12);
    text-align: left;
}

.scroll-table th {
    color: #ffd6b8;
    background: rgba(255, 255, 255, 0.04);
}

.term-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.term-grid div,
.character-card-grid article {
    display: grid;
    gap: 0.35rem;
    padding: 1rem;
    border: 1px solid rgba(255, 219, 190, 0.1);
    border-radius: 0.65rem;
    background: rgba(255, 255, 255, 0.035);
}

.term-grid strong {
    color: #fff0e5;
}

.character-card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.9rem;
    margin-top: 1rem;
}

.character-card-grid h3 {
    margin: 0;
}

.character-card-grid p {
    margin: 0;
}

.badge.dragon {
    background: rgba(190, 60, 60, 0.18);
    color: #ffb3a4;
}

@media (max-width: 900px) {
    .room-with-chat,
    .lobby-board {
        grid-template-columns: 1fr;
    }

    .room-with-chat {
        grid-template-rows: auto auto auto;
    }

    .room-with-chat .arena-topbar,
    .room-with-chat .game-column,
    .room-with-chat .room-chat {
        grid-column: 1;
    }

    .room-with-chat .arena-topbar {
        grid-row: 1;
    }

    .room-with-chat .game-column {
        grid-row: 2;
    }

    .room-with-chat .room-chat {
        grid-row: 3;
    }

    .room-chat {
        min-height: 24rem;
    }

    .hero,
    .feature-grid,
    .home-rules-grid,
    .role-grid,
    .blueprint-grid,
    .panel-grid,
    .game-grid,
    .seat-grid,
    .visual-strip {
        grid-template-columns: 1fr;
    }

    .table-header,
    .bottom-tray,
    .lower-dashboard {
        grid-template-columns: 1fr;
    }

    .topbar,
    .page-header,
    .game-header,
    .panel-header,
    .arena-topbar,
    .hand-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .content {
        width: min(100% - 1rem, 1200px);
    }

    .chat-form {
        grid-template-columns: 1fr;
    }

    .hero.hero-immersive {
        grid-template-columns: 1fr;
    }

    .hero-media {
        position: absolute;
    }

    .visual-tile.tall,
    .visual-tile,
    .room-atmosphere {
        min-height: 260px;
        height: 260px;
    }

    .table-surface {
        min-height: 74rem;
    }

    .table-center {
        inset: 22% 8%;
    }

    .seat-edge.top,
    .seat-edge.bottom {
        width: calc(100% - 2rem);
        flex-wrap: wrap;
    }

    .seat-edge.left,
    .seat-edge.right {
        width: 7rem;
    }

    .arena-board {
        padding: 0.5rem;
    }

    .arena-table .table-surface {
        min-height: 92rem;
    }

    .seat-band.top,
    .seat-band.bottom {
        width: calc(100% - 1rem);
        flex-wrap: wrap;
        padding-right: 1rem;
    }

    .seat-band.left,
    .seat-band.right {
        position: static;
        transform: none;
        flex-direction: row;
        flex-wrap: wrap;
        width: 100%;
        justify-content: center;
    }

    .identity-overlay,
    .hand-zone {
        width: calc(100% - 1rem);
        left: 0.5rem;
        right: 0.5rem;
    }

    .identity-overlay {
        top: auto;
        bottom: 30rem;
    }

    .hand-zone {
        bottom: 0.5rem;
    }

    .hand-fan {
        justify-content: center;
        padding-left: 0.75rem;
    }
}

/* Only the in-room lobby uses the brighter pre-game theme. */
body.room-lobby-theme {
    background:
        radial-gradient(circle at top, rgba(255, 178, 102, 0.34), transparent 42%),
        linear-gradient(180deg, #fffdf8 0%, #fff3e1 100%);
    color: #3e2b23;
}

body.room-lobby-theme .topbar {
    background: rgba(255, 253, 248, 0.88);
    box-shadow: 0 2px 14px rgba(148, 91, 48, 0.08);
}

.arena-shell.lobby-theme .room-atmosphere {
    display: none;
}

.arena-shell.lobby-theme .lobby-seat,
.arena-shell.lobby-theme .lobby-side,
.arena-shell.lobby-theme .arena-topbar {
    background: linear-gradient(180deg, rgba(255, 254, 250, 0.97), rgba(255, 238, 216, 0.97));
    border-color: rgba(172, 105, 59, 0.2);
    box-shadow: 0 10px 28px rgba(148, 91, 48, 0.1);
}

.arena-shell.lobby-theme .lobby-seat.empty,
.arena-shell.lobby-theme .lobby-code,
.arena-shell.lobby-theme .log-list p,
.arena-shell.lobby-theme .chat-entry,
.arena-shell.lobby-theme .button.secondary {
    background: rgba(255, 255, 255, 0.72);
    border-color: rgba(157, 89, 47, 0.35);
    color: #4a3025;
}

.arena-shell.lobby-theme .lobby-seat.empty:hover,
.arena-shell.lobby-theme .button.secondary:hover {
    background: #ffe7c7;
}

body.room-lobby-theme input,
body.room-lobby-theme select,
body.room-lobby-theme textarea {
    background: #fffdf9;
    color: #3e2b23;
    border-color: rgba(157, 89, 47, 0.35);
}

body.room-lobby-theme .arena-meta,
body.room-lobby-theme .muted-text,
body.room-lobby-theme .lobby-seat span,
body.room-lobby-theme .lobby-seat small,
body.room-lobby-theme .chat-entry header {
    color: #755b4d;
}

/* The public room list shares the same light treatment as the in-room lobby. */
body.public-lobby-theme {
    background:
        radial-gradient(circle at top, rgba(255, 178, 102, 0.34), transparent 42%),
        linear-gradient(180deg, #fffdf8 0%, #fff3e1 100%);
    color: #3e2b23;
}

body.public-lobby-theme .topbar {
    background: rgba(255, 253, 248, 0.88);
    box-shadow: 0 2px 14px rgba(148, 91, 48, 0.08);
}

body.public-lobby-theme .page-header,
body.public-lobby-theme .band,
body.public-lobby-theme .lobby-room-card,
body.public-lobby-theme .action-modal {
    background: linear-gradient(180deg, rgba(255, 254, 250, 0.97), rgba(255, 238, 216, 0.97));
    border-color: rgba(172, 105, 59, 0.2);
    color: #3e2b23;
    box-shadow: 0 10px 28px rgba(148, 91, 48, 0.1);
}

body.public-lobby-theme .button.secondary,
body.public-lobby-theme input {
    background: #fffdf9;
    color: #4a3025;
    border-color: rgba(157, 89, 47, 0.35);
}

body.public-lobby-theme .lobby-room-card span,
body.public-lobby-theme .muted-text,
body.public-lobby-theme .eyebrow {
    color: #755b4d;
}

body.room-lobby-theme .topbar,
body.public-lobby-theme .topbar,
.topbar {
    background: rgba(12, 9, 8, 0.78);
    color: #f8efe6;
    border-bottom-color: rgba(255, 219, 190, 0.12);
    box-shadow: none;
}

.topbar .brand small {
    color: #b8a79b;
}

.topbar .nav a,
.topbar .nav-settings-button,
.topbar .nav-leave-button {
    color: #f8efe6;
}

.topbar .nav a:hover,
.topbar .nav-settings-button:hover {
    background: rgba(255, 255, 255, 0.05);
}

.topbar .nav-leave-button:hover {
    background: rgba(255, 107, 107, 0.12);
    color: #ff6b6b;
}

/* Keep the active game table at one consistent layout; smaller viewports scroll instead of reflowing it. */
.arena-shell:not(.lobby-theme) {
    overflow: auto;
}

.arena-board.room-with-chat {
    grid-template-columns: minmax(1280px, 1fr) 20rem;
    grid-template-rows: auto 58rem;
    min-width: calc(1280px + 20rem + 3.5rem);
}

.room-with-chat .arena-topbar {
    grid-column: 1;
    grid-row: 1;
}

.room-with-chat .game-column {
    grid-column: 1;
    grid-row: 2;
}

.room-with-chat .room-chat {
    grid-column: 2;
    grid-row: 2;
    height: 58rem;
}

.arena-table .table-surface {
    width: 100%;
    min-height: 58rem;
    height: 58rem;
}

.identity-overlay,
.identity-mini {
    max-height: 28rem;
}

    .center-drop-zone {
    min-width: 26rem;
}

@media (max-width: 700px) {
    .home-lore-card {
        padding: 1.1rem;
    }

    .term-grid,
    .character-card-grid {
        grid-template-columns: 1fr;
    }
}
