html,
body {
    min-height: 100%;
    margin: 0;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    color: #f6e7c8;
    background: #080b12 url("../images/backgrounds/village-night.svg") center top / cover fixed no-repeat;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(7, 10, 20, 0.38), rgba(7, 10, 20, 0.92));
    z-index: -1;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    font-size: clamp(2.2rem, 9vw, 4.75rem);
    line-height: 0.95;
    font-weight: 900;
}

h2 {
    font-size: 1.25rem;
    font-weight: 800;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

label {
    display: grid;
    gap: 0.45rem;
    color: #d7c39f;
    font-weight: 700;
}

input {
    width: 100%;
    min-height: 3.25rem;
    border: 1px solid rgba(246, 231, 200, 0.24);
    border-radius: 8px;
    padding: 0.8rem 0.95rem;
    color: #fff8e9;
    background: rgba(9, 13, 25, 0.78);
    outline: none;
}

input:focus {
    border-color: #e2b663;
    box-shadow: 0 0 0 0.18rem rgba(226, 182, 99, 0.18);
}

.hero-page,
.game-page {
    width: min(1120px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 2rem 0 3rem;
}

.game-page {
    position: relative;
}

.game-play-page {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    overflow: hidden;
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.game-page > :not(.game-scene-backdrop) {
    position: relative;
    z-index: 1;
}

.game-scene-backdrop {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    background: #080b12;
}

.scene-layer,
.scene-shade {
    position: absolute;
    inset: 0;
}

.scene-layer {
    background-position: center top;
    background-size: cover;
    background-repeat: no-repeat;
    transition: opacity 5s ease;
}

.scene-night {
    opacity: 1;
    background-image: url("../images/backgrounds/village-night.svg");
}

.scene-day {
    opacity: 0;
    background-image: url("../images/backgrounds/village-day.svg");
}

.scene-shade {
    background: linear-gradient(180deg, rgba(7, 10, 20, 0.32), rgba(7, 10, 20, 0.9));
    transition: background 5s ease;
}

.game-scene-backdrop.is-day .scene-night {
    opacity: 0;
}

.game-scene-backdrop.is-day .scene-day {
    opacity: 1;
}

.game-scene-backdrop.is-day .scene-shade {
    background: linear-gradient(180deg, rgba(28, 35, 42, 0.16), rgba(8, 12, 18, 0.72));
}

.hero-page {
    display: grid;
    place-items: center;
    min-height: calc(100vh - 64px);
}

.home-panel,
.panel,
.lobby-hero,
.phase-banner,
.role-card {
    border: 1px solid rgba(246, 231, 200, 0.16);
    border-radius: 8px;
    background: rgba(12, 17, 31, 0.82);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
    backdrop-filter: blur(10px);
}

.home-panel {
    display: grid;
    gap: 1.15rem;
    width: min(480px, 100%);
    padding: clamp(1.2rem, 4vw, 2rem);
}

.auth-panel {
    display: grid;
    gap: 1rem;
    width: min(460px, 100%);
    border: 1px solid rgba(246, 231, 200, 0.16);
    border-radius: 8px;
    padding: clamp(1.2rem, 4vw, 2rem);
    background: rgba(12, 17, 31, 0.84);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
    backdrop-filter: blur(10px);
}

.auth-panel h1 {
    font-size: clamp(2.4rem, 9vw, 4rem);
}

.not-found-panel {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 1rem;
    align-items: center;
    width: min(780px, 100%);
    border: 1px solid rgba(246, 231, 200, 0.16);
    border-radius: 8px;
    padding: clamp(1rem, 4vw, 1.5rem);
    background: rgba(12, 17, 31, 0.86);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
    backdrop-filter: blur(10px);
}

.not-found-icon {
    display: grid;
    place-items: center;
    width: 92px;
    height: 92px;
    border: 1px solid rgba(246, 231, 200, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
}

.not-found-icon img {
    width: 68px;
    height: 68px;
}

.not-found-content {
    display: grid;
    gap: 0.65rem;
    min-width: 0;
}

.not-found-content h1 {
    font-size: clamp(2rem, 7vw, 3.2rem);
}

.not-found-content .lead {
    overflow-wrap: anywhere;
}

.not-found-content .primary-action {
    width: fit-content;
    margin-top: 0.25rem;
}

.lead {
    color: #d7c39f;
    font-size: 1.05rem;
}

.eyebrow {
    color: #e2b663;
    font-size: 0.75rem;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.divider {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.75rem;
    color: #9e8d71;
}

.divider::before,
.divider::after {
    content: "";
    height: 1px;
    background: rgba(246, 231, 200, 0.16);
}

.primary-action,
.secondary-action,
.target-grid button {
    min-height: 3.1rem;
    border: 0;
    border-radius: 8px;
    padding: 0.85rem 1rem;
    color: #1b1208;
    font-weight: 900;
    background: linear-gradient(180deg, #f1c86d, #b98132);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28);
}

.secondary-action,
.target-grid button {
    color: #f6e7c8;
    background: rgba(80, 99, 133, 0.55);
    border: 1px solid rgba(246, 231, 200, 0.18);
}

.as-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.code-input {
    text-transform: uppercase;
}

.alert-panel {
    border: 1px solid rgba(242, 103, 103, 0.38);
    border-radius: 8px;
    padding: 0.85rem 1rem;
    color: #ffd8d8;
    background: rgba(94, 22, 22, 0.48);
}

.profile-page {
    display: grid;
    gap: 1rem;
}

.profile-page-toolbar {
    display: flex;
    justify-content: flex-start;
}

.profile-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border: 1px solid rgba(246, 231, 200, 0.16);
    border-radius: 8px;
    padding: clamp(1rem, 3vw, 1.5rem);
    background: rgba(12, 17, 31, 0.82);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
    backdrop-filter: blur(10px);
}

.profile-hero h1 {
    font-size: clamp(2rem, 7vw, 3.8rem);
    overflow-wrap: anywhere;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(5rem, 1fr));
    gap: 0.65rem;
    min-width: min(100%, 22rem);
}

.profile-stats div {
    display: grid;
    gap: 0.15rem;
    border: 1px solid rgba(241, 200, 109, 0.26);
    border-radius: 8px;
    padding: 0.75rem;
    background: rgba(241, 200, 109, 0.08);
    text-align: center;
}

.profile-stats span {
    color: #f1c86d;
    font-size: 1.7rem;
    font-weight: 900;
    line-height: 1;
}

.profile-stats p {
    color: #d7c39f;
    font-size: 0.82rem;
    font-weight: 800;
}

.profile-account-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.profile-inline-action {
    width: fit-content;
    margin-top: 1rem;
}

.cosmetic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.cosmetic-card {
    display: grid;
    gap: 0.4rem;
    align-content: start;
    min-height: 9.5rem;
    border: 1px solid rgba(246, 231, 200, 0.13);
    border-radius: 8px;
    padding: 0.8rem;
    color: #f6e7c8;
    text-align: left;
    background: rgba(255, 255, 255, 0.04);
}

.cosmetic-card.is-selected {
    border-color: rgba(241, 200, 109, 0.72);
    background: rgba(241, 200, 109, 0.11);
}

.cosmetic-card:not(:disabled):hover,
.cosmetic-card:not(:disabled):focus-visible {
    border-color: rgba(241, 200, 109, 0.62);
    outline: none;
}

.cosmetic-card strong {
    font-size: 1rem;
}

.cosmetic-card small {
    color: #c9b58f;
    font-weight: 700;
    line-height: 1.35;
}

.cosmetic-type {
    color: #e2b663;
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
}

.history-list {
    display: grid;
    gap: 0.65rem;
}

.history-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border: 1px solid rgba(246, 231, 200, 0.13);
    border-radius: 8px;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.04);
}

.history-row h2 {
    margin-top: 0.15rem;
}

.history-result {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.4rem;
}

.info-panel {
    border: 1px solid rgba(96, 165, 250, 0.32);
    border-radius: 8px;
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    color: #dbeafe;
    background: rgba(30, 64, 175, 0.32);
}

.lobby-hero,
.phase-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: clamp(1rem, 3vw, 1.5rem);
}

.phase-banner {
    display: grid;
    align-items: stretch;
}

.phase-banner > div {
    display: grid;
    gap: 0.35rem;
    min-width: 0;
}

.game-status-row {
    position: sticky;
    top: 0.5rem;
    z-index: 5;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(180px, 0.42fr);
    gap: 0.75rem;
    align-items: stretch;
    margin-bottom: 1rem;
}

.game-fixed-header {
    flex: 0 0 auto;
    display: grid;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.game-fixed-header .game-status-row {
    position: static;
    top: auto;
    margin-bottom: 0;
}

.game-fixed-info-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
    align-items: stretch;
}

.role-result-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 0.75rem;
    align-items: stretch;
}

.fixed-info-stack {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    min-width: 0;
}

.pack-info-stack {
    grid-template-columns: minmax(0, 1fr);
}

.compact-info-panel {
    min-width: 0;
    padding: 0.75rem;
}

.compact-info-panel .panel-heading {
    margin-bottom: 0.55rem;
}

.compact-info-panel h2 {
    overflow-wrap: anywhere;
}

.game-scroll-area {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-right: 0.25rem;
    padding-bottom: 1rem;
}

.game-status-row .phase-banner {
    margin-bottom: 0;
    min-height: 100%;
}

.game-status-row .phase-banner h1 {
    font-size: clamp(1.45rem, 4vw, 2.4rem);
    line-height: 1.05;
}

.phase-timer-card {
    display: grid;
    align-content: center;
    gap: 0.25rem;
    border: 1px solid rgba(241, 200, 109, 0.32);
    border-radius: 8px;
    padding: clamp(0.75rem, 2.4vw, 1.1rem);
    background: rgba(12, 17, 31, 0.88);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
    backdrop-filter: blur(10px);
}

.phase-timer-card h2 {
    color: #f1c86d;
    font-size: clamp(1.6rem, 5vw, 2.4rem);
    line-height: 1;
}

.phase-timer-card.is-idle {
    border-color: rgba(246, 231, 200, 0.16);
    background: rgba(12, 17, 31, 0.78);
}

.phase-banner p:last-child,
.muted {
    color: #c9b58f;
}

.lobby-countdown {
    display: grid;
    gap: 0.15rem;
    min-width: 7rem;
    border: 1px solid rgba(241, 200, 109, 0.32);
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
    text-align: center;
    background: rgba(241, 200, 109, 0.1);
}

.lobby-countdown strong {
    color: #f1c86d;
    font-size: 1.8rem;
}

.lobby-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.bot-settings {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
    gap: 1rem;
    align-items: end;
    margin-bottom: 1rem;
}

.bot-control {
    display: grid;
    gap: 0.65rem;
}

.game-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
    gap: 1rem;
    align-items: start;
}

.main-column {
    display: grid;
    gap: 1rem;
}

.action-stack,
.chat-stack {
    display: grid;
    gap: 1rem;
}

.chat-stack:empty {
    display: none;
}

.village-column {
    display: grid;
    gap: 1rem;
}

.village-column .player-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.village-column .player-row {
    align-items: flex-start;
    min-height: 0;
    gap: 0.45rem;
    padding: 0.55rem;
}

.village-column .status-pill {
    align-self: flex-start;
}

.panel {
    padding: 1rem;
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.9rem;
}

.panel-heading span {
    color: #c9b58f;
    white-space: nowrap;
}

.panel-heading-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.player-list {
    display: grid;
    gap: 0.6rem;
}

.player-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 4.25rem;
    border: 1px solid rgba(246, 231, 200, 0.13);
    border-radius: 8px;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.04);
}

.player-row.is-current {
    border-color: rgba(226, 182, 99, 0.6);
}

.player-row.is-dead {
    opacity: 0.62;
}

.player-row.is-fled {
    border-color: rgba(195, 151, 255, 0.34);
    background: rgba(90, 63, 133, 0.16);
}

.player-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.3rem;
}

.player-tags span,
.role-meta span,
.status-pill,
.compact-list span {
    border-radius: 999px;
    padding: 0.18rem 0.5rem;
    color: #ead9b7;
    background: rgba(246, 231, 200, 0.12);
    font-size: 0.78rem;
    font-weight: 800;
}

.status-pill {
    flex: 0 0 auto;
}

.status-pill.alive {
    color: #d8f5c1;
    background: rgba(68, 129, 69, 0.32);
}

.status-pill.dead {
    color: #ffc5c5;
    background: rgba(145, 48, 48, 0.35);
}

.player-row.is-fled .status-pill.dead {
    color: #e6d4ff;
    background: rgba(102, 75, 154, 0.42);
}

.role-card {
    display: grid;
    grid-template-columns: 112px 1fr;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
}

.role-card img {
    width: 112px;
    height: 112px;
    border-radius: 8px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.04);
}

.game-fixed-info-grid .role-card {
    grid-template-columns: 76px minmax(0, 1fr);
    padding: 0.75rem;
}

.game-fixed-info-grid .role-card img {
    width: 76px;
    height: 76px;
}

.game-fixed-info-grid .role-card h2 {
    overflow-wrap: anywhere;
}

.role-card p:last-child {
    margin-top: 0.35rem;
    color: #d7c39f;
}

.role-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.55rem;
}

.role-overview-panel {
    margin-bottom: 1rem;
}

.role-overview-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.75rem;
}

.role-overview-item {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 0.75rem;
    align-items: start;
    border: 1px solid rgba(246, 231, 200, 0.13);
    border-radius: 8px;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.04);
}

.role-overview-item img {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.04);
}

.role-overview-item strong {
    display: block;
    margin-bottom: 0.25rem;
}

.role-overview-item p {
    color: #c9b58f;
    line-height: 1.35;
}

.action-panel {
    display: grid;
    gap: 0.85rem;
}

.target-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.65rem;
}

.compact-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.result-panel {
    display: grid;
    gap: 0.3rem;
}

.vote-summary-panel {
    display: grid;
    gap: 0.7rem;
}

.vote-majority-hint {
    border: 1px solid rgba(241, 200, 109, 0.26);
    border-radius: 8px;
    padding: 0.7rem 0.8rem;
    color: #f6e7c8;
    background: rgba(241, 200, 109, 0.08);
    font-weight: 800;
}

.vote-summary-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}

.vote-summary-row {
    display: grid;
    gap: 0.45rem;
    border: 1px solid rgba(246, 231, 200, 0.13);
    border-radius: 8px;
    padding: 0.6rem;
    background: rgba(255, 255, 255, 0.04);
}

.vote-summary-button {
    width: 100%;
    color: #f6e7c8;
    text-align: left;
}

.vote-summary-button:not(:disabled):hover,
.vote-summary-button:not(:disabled):focus-visible {
    border-color: rgba(241, 200, 109, 0.62);
    background: rgba(241, 200, 109, 0.12);
    outline: none;
}

.vote-summary-target {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.vote-summary-target strong,
.player-row strong {
    overflow-wrap: anywhere;
}

.vote-count-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.vote-count-wrap img {
    width: 2rem;
    height: 2rem;
    border-radius: 8px;
    background: rgba(214, 95, 95, 0.2);
    box-shadow: 0 0 0 1px rgba(246, 231, 200, 0.16);
}

.vote-summary-target span {
    display: inline-grid;
    place-items: center;
    min-width: 2rem;
    height: 2rem;
    border-radius: 8px;
    color: #1b1208;
    background: #f1c86d;
    font-weight: 900;
}

.voter-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.voter-chip-list span {
    border: 1px solid rgba(246, 231, 200, 0.18);
    border-radius: 6px;
    padding: 0.22rem 0.42rem;
    color: #f6e7c8;
    background: rgba(80, 99, 133, 0.42);
    font-size: 0.76rem;
    font-weight: 800;
}

.countdown-panel {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem;
    align-items: center;
}

.countdown-panel h2 {
    font-size: 2rem;
    color: #f1c86d;
}

.countdown-panel p:last-child {
    color: #d7c39f;
}

.witch-panel {
    display: grid;
    gap: 0.9rem;
}

.witch-victim {
    display: grid;
    gap: 0.25rem;
    border: 1px solid rgba(241, 200, 109, 0.28);
    border-radius: 8px;
    padding: 0.8rem;
    background: rgba(241, 200, 109, 0.08);
}

.witch-victim strong {
    font-size: 1.2rem;
}

.witch-action-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.witch-action-card {
    display: grid;
    gap: 0.55rem;
    align-content: start;
    min-height: 11rem;
    border: 1px solid rgba(246, 231, 200, 0.13);
    border-radius: 8px;
    padding: 0.8rem;
    color: #f6e7c8;
    text-align: left;
    background: rgba(255, 255, 255, 0.04);
}

button.witch-action-card:not(:disabled):hover,
button.witch-action-card:not(:disabled):focus-visible {
    border-color: rgba(241, 200, 109, 0.62);
    background: rgba(241, 200, 109, 0.12);
    outline: none;
}

.witch-action-card img {
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 8px;
}

.witch-action-card strong {
    font-size: 1rem;
}

.witch-action-card span {
    color: #c9b58f;
    font-size: 0.88rem;
    font-weight: 700;
}

.witch-target-list {
    display: grid;
    gap: 0.45rem;
    margin-top: 0.25rem;
}

.witch-target-list button {
    min-height: 2.4rem;
    border: 1px solid rgba(246, 231, 200, 0.18);
    border-radius: 8px;
    padding: 0.45rem 0.6rem;
    color: #f6e7c8;
    font-weight: 800;
    background: rgba(124, 45, 93, 0.45);
}

.witch-target-list button:not(:disabled):hover,
.witch-target-list button:not(:disabled):focus-visible {
    border-color: rgba(240, 171, 252, 0.72);
    background: rgba(124, 45, 93, 0.68);
    outline: none;
}

.seer-panel {
    display: grid;
    gap: 0.9rem;
}

.seer-callout,
.seer-reveal-card {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 0.85rem;
    align-items: center;
    border: 1px solid rgba(96, 165, 250, 0.3);
    border-radius: 8px;
    padding: 0.8rem;
    background: rgba(59, 130, 246, 0.1);
}

.seer-callout img,
.seer-reveal-card img {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.04);
}

.seer-callout strong,
.seer-reveal-card strong {
    display: block;
    line-height: 1.25;
}

.seer-target-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.65rem;
}

.seer-target-grid button {
    min-height: 3rem;
    border: 1px solid rgba(246, 231, 200, 0.18);
    border-radius: 8px;
    padding: 0.7rem;
    color: #f6e7c8;
    font-weight: 900;
    background: rgba(59, 130, 246, 0.34);
}

.seer-target-grid button:not(:disabled):hover,
.seer-target-grid button:not(:disabled):focus-visible {
    border-color: rgba(147, 197, 253, 0.75);
    background: rgba(59, 130, 246, 0.55);
    outline: none;
}

.armor-panel {
    display: grid;
    gap: 0.9rem;
}

.armor-callout {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 0.85rem;
    align-items: center;
    border: 1px solid rgba(244, 114, 182, 0.3);
    border-radius: 8px;
    padding: 0.8rem;
    background: rgba(190, 24, 93, 0.1);
}

.armor-callout img {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.04);
}

.armor-callout strong {
    display: block;
    line-height: 1.25;
}

.armor-target-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.65rem;
}

.armor-target-grid button {
    min-height: 3rem;
    border: 1px solid rgba(246, 231, 200, 0.18);
    border-radius: 8px;
    padding: 0.7rem;
    color: #f6e7c8;
    font-weight: 900;
    background: rgba(190, 24, 93, 0.34);
}

.armor-target-grid button.is-selected {
    border-color: rgba(244, 114, 182, 0.82);
    background: rgba(190, 24, 93, 0.72);
}

.armor-target-grid button:not(:disabled):hover,
.armor-target-grid button:not(:disabled):focus-visible {
    border-color: rgba(244, 114, 182, 0.75);
    background: rgba(190, 24, 93, 0.55);
    outline: none;
}

.hunter-panel {
    display: grid;
    gap: 0.9rem;
}

.hunter-callout {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 0.85rem;
    align-items: center;
    border: 1px solid rgba(214, 95, 95, 0.3);
    border-radius: 8px;
    padding: 0.8rem;
    background: rgba(214, 95, 95, 0.1);
}

.hunter-callout img {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.04);
}

.hunter-callout strong {
    display: block;
    line-height: 1.25;
}

.hunter-target-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.65rem;
}

.hunter-target-grid button {
    min-height: 3rem;
    border: 1px solid rgba(246, 231, 200, 0.18);
    border-radius: 8px;
    padding: 0.7rem;
    color: #f6e7c8;
    font-weight: 900;
    background: rgba(145, 48, 48, 0.42);
}

.hunter-target-grid button:not(:disabled):hover,
.hunter-target-grid button:not(:disabled):focus-visible {
    border-color: rgba(214, 95, 95, 0.75);
    background: rgba(145, 48, 48, 0.66);
    outline: none;
}

.chat-panel {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 0.85rem;
    max-height: calc(100dvh - 15rem);
    min-height: 0;
}

.chat-compact-preview {
    display: none;
}

.chat-message-list {
    display: grid;
    align-content: start;
    gap: 0.25rem;
    min-height: 0;
    max-height: 100%;
    overflow-y: auto;
}

.chat-message {
    border: 1px solid rgba(246, 231, 200, 0.12);
    border-radius: 6px;
    padding: 0.38rem 0.5rem;
    background: rgba(255, 255, 255, 0.04);
}

.chat-message.is-own {
    border-color: rgba(241, 200, 109, 0.38);
    background: rgba(241, 200, 109, 0.08);
}

.chat-message p {
    color: #f6e7c8;
    font-size: 0.88rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.chat-message strong {
    color: #efcc7f;
}

.chat-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.65rem;
    align-items: center;
}

.chat-form input {
    min-height: 3rem;
}

.admin-ai-page {
    display: grid;
    gap: 1rem;
}

.admin-login-panel {
    max-width: 48rem;
}

.admin-key-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
}

.admin-config-form {
    display: grid;
    gap: 0.85rem;
    max-width: 42rem;
}

.admin-config-form label {
    display: grid;
    gap: 0.35rem;
}

.toggle-row {
    display: flex !important;
    grid-template-columns: none;
    align-items: center;
    gap: 0.65rem !important;
    color: #f6e7c8;
    font-weight: 800;
}

.toggle-row input {
    width: 1.15rem;
    height: 1.15rem;
    accent-color: #efcc7f;
}

.admin-filter-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.admin-filter-grid select {
    width: 100%;
    min-height: 3.25rem;
    border: 1px solid rgba(246, 231, 200, 0.24);
    border-radius: 8px;
    padding: 0.8rem 0.95rem;
    color: #fff8e9;
    background: rgba(9, 13, 25, 0.78);
}

.admin-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin: -0.25rem 0 1rem;
}

.admin-toolbar span {
    color: #efcc7f;
    font-size: 0.82rem;
    font-weight: 800;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(3, 6, 13, 0.72);
    backdrop-filter: blur(8px);
}

.modal-panel {
    display: grid;
    gap: 0.8rem;
    width: min(100%, 28rem);
    border: 1px solid rgba(239, 204, 127, 0.28);
    border-radius: 8px;
    padding: 1.35rem;
    color: #f6e7c8;
    background: linear-gradient(180deg, rgba(29, 36, 57, 0.98), rgba(10, 14, 26, 0.98));
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.45);
}

.modal-panel h2 {
    margin: 0;
    color: #fff8e9;
    font-size: 1.35rem;
}

.modal-panel p {
    margin: 0;
    color: #d9c7a5;
    line-height: 1.45;
}

.admin-trace-grid {
    display: grid;
    grid-template-columns: minmax(18rem, 0.8fr) minmax(0, 1.5fr);
    gap: 1rem;
    align-items: start;
}

.admin-trace-list {
    display: grid;
    gap: 0.55rem;
    max-height: 70vh;
    overflow: auto;
}

.admin-trace-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.35rem 0.65rem;
    width: 100%;
    border: 1px solid rgba(246, 231, 200, 0.13);
    border-radius: 8px;
    padding: 0.7rem;
    color: #f6e7c8;
    background: rgba(255, 255, 255, 0.04);
    text-align: left;
}

.admin-trace-row.is-selected,
.admin-trace-row:hover,
.admin-trace-row:focus-visible {
    border-color: rgba(239, 204, 127, 0.62);
    background: rgba(239, 204, 127, 0.1);
    outline: none;
}

.admin-trace-row strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trace-bot-role {
    color: #efcc7f;
    font-size: 0.76rem;
    font-weight: 800;
    justify-self: end;
    white-space: nowrap;
}

.trace-session {
    grid-column: 1 / 3;
    color: #aeb7ce;
    font-size: 0.78rem;
}

.trace-time {
    color: #efcc7f;
    font-size: 0.78rem;
    font-weight: 800;
}

.admin-trace-detail {
    display: grid;
    gap: 1rem;
    min-width: 0;
}

.trace-meta-grid {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.35rem 0.85rem;
    border: 1px solid rgba(246, 231, 200, 0.13);
    border-radius: 8px;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.04);
}

.trace-meta-grid span {
    color: #aeb7ce;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.trace-code-block {
    min-width: 0;
}

.trace-code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.45rem;
}

.trace-code-block h3 {
    margin: 0;
    color: #efcc7f;
    font-size: 0.9rem;
}

.compact-button {
    min-height: 2.25rem;
    padding: 0.45rem 0.75rem;
    font-size: 0.78rem;
}

.trace-code-block pre {
    max-height: 24rem;
    overflow: auto;
    border: 1px solid rgba(246, 231, 200, 0.13);
    border-radius: 8px;
    margin: 0;
    padding: 0.8rem;
    color: #dbe5ff;
    background: rgba(2, 5, 12, 0.78);
    font-size: 0.78rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.trace-readable-context {
    display: grid;
    gap: 0.85rem;
    border: 1px solid rgba(246, 231, 200, 0.13);
    border-radius: 8px;
    padding: 0.85rem;
    background: rgba(255, 255, 255, 0.035);
}

.trace-context-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.trace-context-card {
    min-width: 0;
    border: 1px solid rgba(246, 231, 200, 0.13);
    border-radius: 8px;
    padding: 0.85rem;
    background: rgba(2, 5, 12, 0.38);
}

.trace-context-card h3 {
    margin: 0 0 0.6rem;
    color: #efcc7f;
    font-size: 0.92rem;
}

.trace-context-card p {
    margin: 0;
    color: #dbe5ff;
    line-height: 1.45;
}

.trace-context-list {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.35rem 0.75rem;
    margin: 0;
}

.trace-context-list dt {
    color: #aeb7ce;
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
}

.trace-context-list dd {
    margin: 0;
    color: #f6e7c8;
    word-break: break-word;
}

.trace-table-wrap {
    overflow-x: auto;
}

.trace-context-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 36rem;
}

.trace-context-table th,
.trace-context-table td {
    border-bottom: 1px solid rgba(246, 231, 200, 0.1);
    padding: 0.48rem 0.45rem;
    text-align: left;
}

.trace-context-table th {
    color: #aeb7ce;
    font-size: 0.76rem;
    text-transform: uppercase;
}

.trace-context-table td {
    color: #f6e7c8;
}

.trace-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.trace-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid rgba(239, 204, 127, 0.25);
    border-radius: 999px;
    padding: 0.35rem 0.55rem;
    color: #f6e7c8;
    background: rgba(239, 204, 127, 0.08);
    font-size: 0.82rem;
}

.trace-chip small {
    color: #aeb7ce;
}

.trace-vote-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 0.55rem;
}

.trace-vote-card {
    display: grid;
    gap: 0.25rem;
    border: 1px solid rgba(246, 231, 200, 0.12);
    border-radius: 8px;
    padding: 0.65rem;
    background: rgba(255, 255, 255, 0.04);
}

.trace-vote-card strong {
    color: #f6e7c8;
}

.trace-vote-card span {
    color: #efcc7f;
    font-weight: 800;
}

.trace-vote-card small {
    color: #aeb7ce;
    line-height: 1.35;
}

.trace-chat-list {
    display: grid;
    gap: 0.5rem;
}

.trace-chat-message {
    display: grid;
    gap: 0.2rem;
    border-left: 3px solid rgba(239, 204, 127, 0.45);
    padding: 0.35rem 0 0.35rem 0.6rem;
}

.trace-chat-message strong {
    color: #efcc7f;
    font-size: 0.82rem;
}

.trace-chat-message span {
    color: #dbe5ff;
}

#blazor-error-ui {
    color-scheme: light only;
    display: none;
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 1000;
    max-width: min(420px, calc(100% - 2rem));
    border-radius: 8px;
    padding: 1rem 3rem 1rem 1rem;
    color: white;
    background: #8f1f2a;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
}

#blazor-error-ui .dismiss {
    position: absolute;
    top: 0.65rem;
    right: 0.85rem;
    cursor: pointer;
}

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto;
}

.loading-progress circle {
    fill: none;
    stroke: rgba(246, 231, 200, 0.2);
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: #e2b663;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text::after {
    content: var(--blazor-load-percentage-text, "Loading");
}

@media (max-width: 820px) {
    .hero-page,
    .game-page {
        width: min(100% - 1rem, 1120px);
        padding-top: 1rem;
    }

    .game-play-page {
        padding-bottom: 5.75rem;
    }

    .lobby-hero,
    .phase-banner,
    .profile-hero,
    .history-row {
        display: grid;
    }

    .profile-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        min-width: 0;
    }

    .history-result {
        justify-content: flex-start;
    }

    .game-status-row {
        top: 0.35rem;
        grid-template-columns: minmax(0, 1fr) minmax(104px, 0.52fr);
        gap: 0.5rem;
    }

    .game-fixed-header {
        gap: 0.5rem;
        margin-bottom: 0.5rem;
    }

    .game-fixed-info-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .role-result-grid {
        grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
        gap: 0.5rem;
    }

    .fixed-info-stack {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
    }

    .compact-info-panel {
        padding: 0.65rem;
    }

    .compact-info-panel h2 {
        font-size: 1rem;
    }

    .game-status-row .phase-banner,
    .phase-timer-card {
        padding: 0.7rem;
    }

    .game-status-row .phase-banner h1 {
        font-size: clamp(1.15rem, 7vw, 1.55rem);
    }

    .phase-timer-card h2 {
        font-size: clamp(1.35rem, 8vw, 1.8rem);
    }

    .lobby-actions {
        display: grid;
    }

    .bot-settings {
        grid-template-columns: 1fr;
    }

    .game-grid {
        grid-template-columns: 1fr;
    }

    .village-column .player-list,
    .vote-summary-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.45rem;
    }

    .village-column .player-row {
        display: grid;
        gap: 0.35rem;
        padding: 0.48rem;
    }

    .player-row strong,
    .vote-summary-target strong {
        font-size: 0.9rem;
        line-height: 1.15;
    }

    .player-tags {
        gap: 0.2rem;
        margin-top: 0.25rem;
    }

    .player-tags span,
    .role-meta span,
    .status-pill,
    .compact-list span {
        padding: 0.14rem 0.36rem;
        font-size: 0.68rem;
    }

    .vote-summary-panel {
        gap: 0.5rem;
    }

    .vote-majority-hint {
        padding: 0.55rem 0.65rem;
        font-size: 0.84rem;
    }

    .vote-summary-row {
        padding: 0.5rem;
    }

    .vote-summary-target {
        gap: 0.45rem;
    }

    .vote-count-wrap {
        gap: 0.25rem;
    }

    .vote-count-wrap img {
        width: 1.5rem;
        height: 1.5rem;
    }

    .vote-summary-target span {
        min-width: 1.65rem;
        height: 1.65rem;
    }

    .voter-chip-list span {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .countdown-panel {
        grid-template-columns: 1fr;
    }

    .role-card {
        grid-template-columns: 84px 1fr;
    }

    .game-fixed-info-grid .role-card {
        grid-template-columns: 64px minmax(0, 1fr);
        padding: 0.65rem;
    }

    .role-card img {
        width: 84px;
        height: 84px;
    }

    .not-found-panel {
        grid-template-columns: 1fr;
    }

    .not-found-icon {
        width: 76px;
        height: 76px;
    }

    .not-found-icon img {
        width: 56px;
        height: 56px;
    }

    .game-fixed-info-grid .role-card img {
        width: 64px;
        height: 64px;
    }

    .witch-action-grid {
        grid-template-columns: 1fr;
    }

    .witch-action-card {
        min-height: auto;
    }

    .chat-form {
        grid-template-columns: 1fr;
    }

    .chat-stack {
        position: fixed;
        right: 0.5rem;
        bottom: max(0.5rem, env(safe-area-inset-bottom));
        left: 0.5rem;
        z-index: 20;
        margin-top: 0.25rem;
    }

    .chat-panel {
        gap: 0.45rem;
        grid-template-rows: auto auto auto;
        max-height: none;
        padding: 0.55rem;
        background: rgba(12, 17, 31, 0.95);
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.35);
    }

    .chat-panel .panel-heading {
        margin-bottom: 0.25rem;
    }

    .chat-panel .panel-heading h2 {
        font-size: 0.95rem;
    }

    .chat-panel .panel-heading span {
        font-size: 0.74rem;
    }

    .chat-message-list {
        display: none;
    }

    .chat-compact-preview {
        display: grid;
        gap: 0.15rem;
    }

    .chat-compact-preview p {
        overflow: hidden;
        color: #f6e7c8;
        font-size: 0.78rem;
        line-height: 1.25;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .chat-compact-preview strong {
        color: #efcc7f;
    }

    .chat-form {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 0.4rem;
    }

    .chat-form input {
        min-height: 2.35rem;
        padding: 0.45rem 0.55rem;
        font-size: 0.82rem;
    }

    .chat-form .secondary-action {
        min-height: 2.35rem;
        padding: 0.45rem 0.6rem;
        font-size: 0.78rem;
    }

    .admin-filter-grid,
    .admin-trace-grid,
    .trace-context-grid {
        grid-template-columns: 1fr;
    }

    .admin-key-form {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .role-result-grid {
        grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    }
}
