:root {
    --gold-primary: #c5a059;
    --gold-light: #f4efe2;
    --bg-wood: #2a110b;
    --paper-bg: #e6dfcc;
    --card-dark: rgba(26, 17, 14, 0.6);
    --shadow-neon: rgba(184, 15, 20, 0.4);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Georgia', 'Times New Roman', serif;
}

body {
    background: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.6)),
                radial-gradient(circle at center, #3d1c13 0%, #160a07 100%);
    background-color: var(--bg-wood);
    background-attachment: fixed;
    color: var(--gold-light);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    margin: 0;
    width: 100%;
    overflow-x: hidden;
}

body.vk-mini-app {
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
}

body.vk-mini-app.vk-platform-desktop .app-container,
body.vk-mini-app.vk-platform-web .app-container {
    max-width: 100%;
    width: 100%;
}

body.vk-mini-app.vk-platform-desktop .bottom-nav,
body.vk-mini-app.vk-platform-web .bottom-nav {
    max-width: 100%;
    left: 0;
    transform: none;
}

.app-container {
    width: 100%;
    max-width: 480px;
    min-height: 100vh;
    padding: 16px 16px 80px 16px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
    text-align: center;
}

.club-logo-wrap {
    width: 108px;
    height: 108px;
    border-radius: 50%;
    border: 2px solid var(--gold-primary);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
    margin-bottom: 10px;
    background: #f4efe2;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.club-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.app-title {
    font-size: 16px;
    letter-spacing: 1px;
    line-height: 1.35;
    color: var(--gold-primary);
    text-transform: uppercase;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
    max-width: 100%;
    text-align: center;
}

.profile-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 0 4px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.vk-avatar-styled {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 2px solid var(--gold-primary);
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    filter: sepia(0.85) contrast(1.1) brightness(0.9);
    transition: filter 0.3s ease;
}

.role-card:active .vk-avatar-styled {
    filter: sepia(0.3) contrast(1.1) brightness(1);
}

.user-name {
    font-size: 16px;
    font-weight: bold;
    color: var(--gold-light);
}

.user-status {
    font-size: 12px;
    color: var(--gold-primary);
    font-style: italic;
}

.badge-premium {
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--gold-primary);
    border: 1px solid var(--gold-primary);
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.btn-finish-game {
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 0.2px;
    color: #f4efe2;
    background: linear-gradient(180deg, #c42838 0%, #8b1018 100%);
    border: 1px solid #b80f14;
    padding: 7px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(184, 15, 20, 0.4);
    flex-shrink: 0;
}

.btn-finish-game:active {
    transform: scale(0.98);
}

.current-game-card {
    background-color: var(--paper-bg);
    background-image: linear-gradient(rgba(0,0,0,0.03) 1px, transparent 1px);
    background-size: 100% 24px;
    color: #1a110e;
    border-radius: 8px;
    padding: 20px;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.15), 0 10px 25px rgba(0,0,0,0.5);
    border: 1px solid #c2b9a3;
    margin-bottom: 24px;
}

.card-label {
    font-size: 13px;
    text-transform: uppercase;
    color: #5a5043;
    margin-bottom: 4px;
}

.game-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 16px;
    border-bottom: 2px solid #1a110e;
    padding-bottom: 4px;
}

.game-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.stat-box h3 {
    font-size: 28px;
    font-weight: normal;
}

.phase-badge {
    display: inline-block;
    margin-bottom: 12px;
    padding: 4px 10px;
    background: #1a110e;
    color: var(--gold-primary);
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-radius: 4px;
}

.btn-host {
    display: block;
    width: 100%;
    background: linear-gradient(180deg, #b09156 0%, #876a33 100%);
    border: 1px solid #5a441b;
    color: #1a110e;
    padding: 12px;
    font-size: 16px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 0 15px var(--shadow-neon), 0 4px 6px rgba(0,0,0,0.4);
    transition: all 0.2s ease;
    text-align: center;
}

.btn-host:active {
    transform: scale(0.98);
    box-shadow: 0 0 5px var(--shadow-neon);
}

.btn-host.hidden {
    display: none;
}

.section-title {
    font-size: 14px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--gold-primary);
    margin: 0 0 12px;
    padding-left: 4px;
    border-left: 2px solid var(--gold-primary);
}

.grid-roles {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.role-card {
    background: linear-gradient(135deg, rgba(244,239,226,0.92) 0%, rgba(218,210,188,0.92) 100%);
    border: 1px solid var(--gold-primary);
    border-radius: 6px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    color: #1a110e;
}

.role-card.dead {
    opacity: 0.55;
    filter: grayscale(0.4);
}

.role-card-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.role-card-info h4 {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 2px;
}

.role-card-info p {
    font-size: 12px;
    color: #5a5043;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-badge {
    font-size: 11px;
    background-color: #1a110e;
    color: var(--gold-primary);
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: bold;
    white-space: nowrap;
}

.role-card-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.role-icon-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--gold-primary);
    background: linear-gradient(145deg, #2a1812 0%, #1a110e 100%);
    color: var(--gold-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(197, 160, 89, 0.15);
    flex-shrink: 0;
}

.role-icon-circle svg {
    width: 20px;
    height: 20px;
}

.role-icon-don { box-shadow: 0 0 8px rgba(184, 15, 20, 0.35), inset 0 1px 0 rgba(197, 160, 89, 0.15); }
.role-icon-mafia { box-shadow: 0 0 6px rgba(80, 20, 20, 0.4), inset 0 1px 0 rgba(197, 160, 89, 0.12); }
.role-icon-beauty { color: #e8c4a8; border-color: #d4a574; }
.role-icon-maniac { color: #c5a059; box-shadow: 0 0 8px rgba(184, 15, 20, 0.5), inset 0 1px 0 rgba(197, 160, 89, 0.1); }
.role-icon-doctor { color: #a8c4b8; border-color: #8aab9a; }
.role-icon-priest { color: #d4c896; }
.role-icon-dead { opacity: 0.7; filter: grayscale(0.6); }

.role-card.dead .role-icon-circle {
    opacity: 0.65;
}

.empty-state {
    text-align: center;
    padding: 24px 12px;
    color: #8a7a6e;
    font-style: italic;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background-color: #110705;
    border-top: 1px solid rgba(197, 160, 89, 0.3);
    display: flex;
    justify-content: flex-start;
    gap: 2px;
    overflow-x: auto;
    padding: 10px 6px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    z-index: 100;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

body.vk-mini-app .app-container {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}

.bottom-nav::-webkit-scrollbar {
    display: none;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: #8a7a6e;
    font-size: 9px;
    text-transform: uppercase;
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    flex: 0 0 auto;
    min-width: 56px;
    padding: 0 4px;
}

.nav-item.active {
    color: var(--gold-primary);
}

.nav-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.hidden {
    display: none !important;
}

/* ── Host panel ── */
.host-panel-header {
    margin-bottom: 16px;
}

.host-panel-title {
    font-size: 20px;
    color: var(--gold-primary);
    letter-spacing: 1px;
    margin: 0 0 6px;
    text-transform: uppercase;
}

.host-panel-sub {
    font-size: 13px;
    color: #8a7a6e;
    font-style: italic;
}

.btn-back {
    background: none;
    border: 1px solid rgba(197, 160, 89, 0.4);
    color: var(--gold-primary);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    margin-bottom: 14px;
    display: inline-block;
}

.host-card {
    background-color: var(--paper-bg);
    border: 1px solid #c2b9a3;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    color: #1a110e;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.host-card-title {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    color: #5a5043;
}

.form-row {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.form-label {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    color: #5a5043;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}

.host-input {
    flex: 1;
    min-width: 80px;
    padding: 10px 12px;
    border: 1px solid #c2b9a3;
    border-radius: 4px;
    background: #f4efe2;
    color: #1a110e;
    font-family: inherit;
    font-size: 15px;
}

.host-input-sm {
    flex: 0 0 72px;
    min-width: 72px;
}

.host-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #c2b9a3;
    border-radius: 4px;
    background: #f4efe2;
    color: #1a110e;
    font-family: inherit;
    font-size: 15px;
}

.btn-secondary {
    background: linear-gradient(180deg, #d4c4a0 0%, #b8a480 100%);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    margin-top: 8px;
}

.btn-danger {
    background: linear-gradient(180deg, #8b2030 0%, #5a1018 100%);
    color: var(--gold-light);
    border-color: #3a0810;
    margin-top: 12px;
}

.role-assign-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.role-assign-row:last-child {
    border-bottom: none;
}

.role-assign-name {
    font-size: 14px;
    font-weight: bold;
}

.successor-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 12px 0;
    padding: 10px 12px;
    border: 1px solid rgba(197, 160, 89, 0.45);
    border-radius: 8px;
    background: rgba(244, 239, 226, 0.6);
    font-size: 12px;
    color: #1a110e;
    line-height: 1.4;
}

.successor-check input {
    margin-top: 2px;
    flex-shrink: 0;
}

.successor-pick-card {
    border-color: #b80f14;
    box-shadow: 0 0 0 1px rgba(184, 15, 20, 0.25);
}

.successor-toggle {
    display: inline-block;
    margin-top: 6px;
    padding: 5px 10px;
    border: 1px solid #9a8868;
    border-radius: 14px;
    background: #f4efe2;
    color: #1a110e;
    font-size: 11px;
    font-weight: bold;
    font-family: inherit;
    cursor: pointer;
}

.successor-toggle.active {
    border-color: #b80f14;
    background: linear-gradient(180deg, #c42838 0%, #8b1018 100%);
    color: #f4efe2;
}

.successor-badge {
    display: inline-block;
    margin-top: 6px;
    font-size: 11px;
    font-weight: bold;
    color: #b80f14;
}

.role-card-successor {
    border-color: rgba(184, 15, 20, 0.55);
}

.record-hint-sm {
    font-size: 12px;
    margin: 8px 0 0;
}

.record-hint-ok {
    color: #2d5a3a;
    font-weight: 600;
}

.record-error {
    color: #b80f14;
    font-size: 13px;
    font-weight: 600;
    margin: 10px 0;
    line-height: 1.4;
}

.role-card-record {
    cursor: pointer;
}

.role-card-record.role-card-active {
    box-shadow: 0 0 0 2px rgba(197, 160, 89, 0.65);
}

.role-card-record:focus-visible {
    outline: 2px solid var(--gold-primary);
    outline-offset: 2px;
}

#record-role-btn {
    margin-top: 12px;
}

.wizard-steps {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 16px;
}

.wizard-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #3d2a20;
    border: 1px solid rgba(197, 160, 89, 0.3);
}

.wizard-dot.active {
    background: var(--gold-primary);
    box-shadow: 0 0 8px rgba(197, 160, 89, 0.6);
}

.wizard-dot.done {
    background: #6a5030;
}

.priest-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.toggle-btn {
    flex: 1;
    padding: 8px;
    border: 1px solid #c2b9a3;
    background: #f4efe2;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
}

.toggle-btn.active {
    background: #1a110e;
    color: var(--gold-primary);
    border-color: var(--gold-primary);
}

.reveal-box {
    margin-top: 12px;
    padding: 10px;
    background: #1a110e;
    color: var(--gold-primary);
    border-radius: 4px;
    font-size: 14px;
}

.host-actions-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.host-actions-row .btn-host {
    flex: 1;
}

.vote-row {
    display: grid;
    grid-template-columns: 1fr 64px 64px;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.vote-voter {
    font-size: 13px;
    font-weight: bold;
}

.tally-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 0;
}

.tally-chip {
    background: #1a110e;
    color: var(--gold-primary);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
}

.vote-tally-panel {
    margin-top: 14px;
    padding: 14px;
    border: 1px solid #c2b9a3;
    border-radius: 8px;
    background: #f4efe2;
}

.vote-tally-panel.empty {
    text-align: center;
}

.vote-tally-title {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #5a5043;
    margin: 0 0 4px;
}

.vote-tally-sub {
    font-size: 12px;
    color: #5a5043;
    margin: 0 0 12px;
}

.tally-chip-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 10px;
    background: linear-gradient(135deg, rgba(244, 239, 226, 0.95) 0%, rgba(218, 210, 188, 0.95) 100%);
    border: 2px solid var(--gold-primary);
    border-radius: 8px;
    min-width: 56px;
}

button.tally-chip-pick {
    cursor: pointer;
    font-family: inherit;
    color: inherit;
}

button.tally-chip-pick.tally-chip-selected {
    border-color: #b80f14;
    box-shadow: 0 0 0 2px rgba(184, 15, 20, 0.35);
    background: linear-gradient(135deg, rgba(255, 240, 240, 0.98) 0%, rgba(244, 220, 220, 0.98) 100%);
}

.tally-pick-hint {
    margin: 10px 0 0;
    font-size: 11px;
    color: #5a5043;
    text-align: center;
}

.night-dead-hint {
    font-size: 12px;
    color: #5a5043;
    margin: 0 0 10px;
    line-height: 1.4;
}

.night-brief-card {
    border-color: rgba(107, 20, 32, 0.35);
}

.night-brief-list {
    margin: 0 0 12px;
    padding-left: 18px;
    font-size: 14px;
    color: #1a110e;
    line-height: 1.55;
}

.night-brief-actor {
    font-weight: bold;
    color: #6b1420;
}

.night-brief-deaths-title {
    margin: 12px 0 6px;
    font-size: 13px;
    font-weight: bold;
    text-transform: uppercase;
    color: #6b1420;
}

.night-brief-deaths li {
    color: #6b1420;
}

.night-brief-notes {
    margin: 0 0 12px;
    padding: 10px 12px 10px 28px;
    background: rgba(197, 160, 89, 0.12);
    border-radius: 6px;
    font-size: 13px;
    color: #3d342c;
    line-height: 1.45;
}

.night-brief-ok {
    margin-top: 8px;
}

.night-blocked-card {
    padding: 14px;
    border-radius: 8px;
    background: rgba(184, 15, 20, 0.08);
    border: 1px dashed rgba(184, 15, 20, 0.45);
}

.night-blocked-title {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: bold;
    color: #6b1420;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.night-blocked-card {
    padding: 14px;
    border-radius: 8px;
    background: rgba(184, 15, 20, 0.08);
    border: 1px dashed rgba(184, 15, 20, 0.45);
}

.night-blocked-title {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: bold;
    color: #6b1420;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.tally-chip-visual .avatar-chip {
    padding: 4px;
    box-shadow: none;
}

.tally-count {
    font-size: 22px;
    font-weight: bold;
    color: #6b1420;
    line-height: 1;
}

.tally-count-label {
    font-size: 10px;
    color: #5a5043;
    text-transform: lowercase;
}

.tally-tie {
    color: #b80f14;
    font-weight: bold;
    font-size: 13px;
}

.winner-picker {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.loading-state {
    text-align: center;
    padding: 32px;
    color: #8a7a6e;
    font-style: italic;
}

.toast {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 420px;
    width: calc(100% - 32px);
    padding: 12px 16px;
    background: #1a110e;
    color: var(--gold-primary);
    border: 1px solid var(--gold-primary);
    border-radius: 6px;
    font-size: 13px;
    z-index: 200;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.toast-error {
    border-color: #b80f14;
    color: #f4a0a0;
}

/* ── Dev preview toggle (temporary) ── */
.dev-view-toggle {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 300;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    background: rgba(17, 7, 5, 0.92);
    border: 1px solid rgba(197, 160, 89, 0.45);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.dev-view-label {
    font-size: 9px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #8a7a6e;
    padding: 0 6px;
}

.dev-view-btn {
    border: 1px solid rgba(197, 160, 89, 0.35);
    background: transparent;
    color: #8a7a6e;
    font-family: inherit;
    font-size: 11px;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dev-view-btn.active {
    background: var(--gold-primary);
    color: #1a110e;
    border-color: var(--gold-primary);
    font-weight: bold;
}

.dev-reset-btn {
    font-size: 16px;
    padding: 5px 8px;
    line-height: 1;
    color: #b80f14;
    border-color: rgba(184, 15, 20, 0.5);
}

.dev-reset-btn:hover {
    background: rgba(184, 15, 20, 0.2);
}

body.player-preview .profile-bar .badge-premium {
    border-color: #8aab9a;
    color: #a8c4b8;
}
.avatar-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 12px 0;
}

.avatar-grid-compact {
    gap: 6px;
}

.avatar-chip {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--gold-primary);
    border-radius: 6px;
    background: linear-gradient(135deg, rgba(244, 239, 226, 0.95) 0%, rgba(218, 210, 188, 0.95) 100%);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    font-family: inherit;
}

.avatar-portrait {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-chip-img,
.avatar-chip .vk-avatar-styled {
    width: 48px;
    height: 48px;
    display: block;
}

.avatar-chip-sm .avatar-chip-img,
.avatar-chip-sm .vk-avatar-styled {
    width: 44px;
    height: 44px;
}

.avatar-chip-xs .avatar-chip-img,
.avatar-chip-xs .vk-avatar-styled {
    width: 32px;
    height: 32px;
}

.avatar-chip-lg .avatar-chip-img,
.avatar-chip-lg .vk-avatar-styled {
    width: 64px;
    height: 64px;
}

.avatar-chip img {
    border-radius: 50%;
    object-fit: cover;
}

.avatar-chip.selected {
    border-color: var(--gold-primary);
    box-shadow: 0 0 14px rgba(197, 160, 89, 0.45);
}

.avatar-chip.disabled,
.avatar-chip:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.avatar-chip-num {
    position: absolute;
    top: 4px;
    left: 4px;
    z-index: 2;
    font-size: 11px;
    font-weight: bold;
    color: var(--gold-primary);
    background: #1a110e;
    border: 1px solid var(--gold-primary);
    border-radius: 4px;
    padding: 2px 6px;
    line-height: 1;
}

.avatar-chip-name {
    font-size: 11px;
    color: #1a110e;
    font-weight: bold;
    max-width: 72px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.role-pick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 10px;
    margin: 12px 0;
}

.role-pick-grid-sm {
    grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
}

.role-pick-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 6px 8px;
    border: 1px solid #9a8868;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(244, 239, 226, 0.95) 0%, rgba(218, 210, 188, 0.95) 100%);
    cursor: pointer;
    position: relative;
    box-shadow: 0 2px 6px rgba(26, 17, 14, 0.18);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    font-family: inherit;
}

.role-pick-card.selected,
.role-pick-btn.selected {
    border: 1px solid var(--gold-primary);
    background: linear-gradient(145deg, #d8c88a 0%, #b89a4a 52%, #8a6f32 100%);
    box-shadow:
        0 0 0 2px rgba(197, 160, 89, 0.8),
        0 0 18px rgba(197, 160, 89, 0.55),
        inset 0 1px 0 rgba(244, 239, 226, 0.35);
}

.role-pick-card.selected::after,
.role-pick-btn.selected::after {
    content: '✓';
    position: absolute;
    top: 4px;
    left: 4px;
    z-index: 3;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: #1a110e;
    background: var(--gold-primary);
    border: 1px solid #7a5c28;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(26, 17, 14, 0.35);
    pointer-events: none;
}

.role-pick-card.selected .role-pick-label,
.role-pick-btn.selected .role-pick-label {
    color: #1a110e;
    font-weight: 700;
}

.role-pick-card:focus-visible,
.role-pick-btn:focus-visible {
    outline: 2px solid var(--gold-primary);
    outline-offset: 2px;
}

.role-pick-card.disabled {
    opacity: 0.45;
    pointer-events: none;
}

.role-pick-label {
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    color: #1a110e;
    line-height: 1.2;
}

.role-pick-count {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: #1a110e;
    background: var(--gold-primary);
    border: 1px solid #7a5c28;
    border-radius: 11px;
    box-shadow: 0 1px 2px rgba(26, 17, 14, 0.25);
}

.role-setup-summary {
    font-size: 14px;
    font-weight: bold;
    color: #1a110e;
    margin-bottom: 8px;
}

.role-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.role-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px 4px 6px;
    border: 1px solid #9a8868;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: #1a110e;
    background: #f4efe2;
    cursor: pointer;
}

.role-chip .role-icon-circle {
    width: 24px;
    height: 24px;
}

.empty-hint {
    color: #5a5043;
    font-size: 13px;
    margin: 8px 0;
}

/* Светлая карточка — всё текстовое читаемо на бежевом фоне */
.host-card .record-hint,
.host-card .record-meta,
.host-card .intro-text {
    color: #3d2f20;
}

.record-current {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
}

.record-hint,
.record-meta,
.intro-text,
.player-sub {
    font-size: 13px;
    color: #9a8a7a;
    line-height: 1.5;
}

.intro-queue {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.intro-queue-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border: 1px solid rgba(197, 160, 89, 0.2);
    border-radius: 8px;
}

.intro-order {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(197, 160, 89, 0.15);
    color: var(--gold-primary);
    font-weight: bold;
    font-size: 13px;
}

/* ── Voting board ── */
.vote-voter-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 8px;
    border: 1px solid var(--gold-primary);
    border-radius: 6px;
    background: linear-gradient(135deg, rgba(244, 239, 226, 0.95) 0%, rgba(218, 210, 188, 0.95) 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.vote-voter-slot {
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #5a5043;
}

.vote-voter-avatar {
    width: 46px;
    height: 46px;
}

.vote-voter-name {
    font-size: 12px;
    font-weight: bold;
    color: #1a110e;
    text-align: center;
}

.vote-voter-role {
    font-size: 10px;
    font-weight: bold;
    color: #6b1420;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    line-height: 1.2;
    width: 100%;
}

.vote-target-chip {
    min-width: 58px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
    border-width: 1px;
}

.vote-target-chip .avatar-portrait,
.vote-target-chip .avatar-chip-num,
.vote-target-chip .avatar-chip-img,
.vote-target-chip .vk-avatar-styled,
.vote-target-chip .vote-hit-overlay,
.vote-target-chip .vote-hit-mark,
.vote-target-chip .vote-hit-multi,
.pick-chip .avatar-portrait,
.pick-chip .avatar-chip-num,
.pick-chip .avatar-chip-img,
.pick-chip .vk-avatar-styled,
.pick-chip .avatar-chip-name,
.pick-chip .vote-hit-overlay,
.pick-chip .vote-hit-mark,
.pick-chip .vote-voter-role {
    pointer-events: none;
}

.pick-grid {
    margin: 10px 0 14px;
}

.vote-target-chip.vote-hit {
    background: linear-gradient(145deg, #a82838 0%, #6b1420 55%, #3a0810 100%);
    border: 1px solid var(--gold-primary);
    box-shadow:
        0 0 0 2px rgba(184, 15, 20, 0.35),
        0 0 16px rgba(184, 15, 20, 0.5),
        inset 0 1px 0 rgba(244, 239, 226, 0.15);
}

.vote-target-chip.vote-hit-double {
    border: 1px solid #f4efe2;
    box-shadow:
        0 0 0 2px rgba(197, 160, 89, 0.6),
        0 0 18px rgba(184, 15, 20, 0.55);
}

.vote-hit-overlay {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(184, 15, 20, 0.42);
    pointer-events: none;
}

.vote-hit-mark {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: bold;
    color: #f4efe2;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

.vote-hit-multi {
    position: absolute;
    bottom: 2px;
    right: 2px;
    z-index: 3;
    font-size: 10px;
    font-weight: bold;
    color: #1a110e;
    background: var(--gold-primary);
    border: 1px solid #7a5c28;
    border-radius: 10px;
    padding: 1px 6px;
}

.vote-target-chip.vote-hit .avatar-chip-num {
    background: #f4efe2;
    color: #6b1420;
    border-color: #f4efe2;
}

.vote-target-chip.read-only {
    cursor: default;
    pointer-events: none;
}

.vote-picker-row {
    display: contents;
}

#live-vote-board {
    display: grid;
    grid-template-columns: max-content auto 1fr;
    column-gap: 10px;
    align-items: center;
}

#live-vote-board .vote-picker-voter,
#live-vote-board .vote-picker-arrow,
#live-vote-board .vote-picker-targets {
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(90, 80, 67, 0.25);
}

#live-vote-board .vote-picker-voter:last-of-type,
#live-vote-board .vote-picker-arrow:last-of-type,
#live-vote-board .vote-picker-targets:last-of-type {
    padding-bottom: 0;
    margin-bottom: 0;
    border-bottom: none;
}

.vote-picker-voter {
    min-width: 0;
}

.vote-picker-arrow {
    color: #5a5043;
    font-size: 22px;
    font-weight: bold;
}

.vote-picker-targets {
    flex: 1;
    margin: 0;
}

.voting-live-card {
    overflow: hidden;
}

.intro-queue .avatar-chip {
    background: linear-gradient(135deg, rgba(244, 239, 226, 0.12) 0%, rgba(218, 210, 188, 0.08) 100%);
    border-color: rgba(197, 160, 89, 0.55);
}

.intro-queue .avatar-chip-name {
    color: #f4efe2;
}
.vote-history-arrow {
    color: #8a7a6e;
    font-size: 18px;
}

.vote-history-panel {
    margin-top: 8px;
}

.vote-history-block {
    border: 1px solid rgba(197, 160, 89, 0.2);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    background: rgba(0, 0, 0, 0.15);
}

.vote-history-title {
    font-size: 13px;
    color: var(--gold-primary);
    margin: 0 0 10px;
}

.vote-history-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.vote-history-targets {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.vote-plus {
    color: #6a5a4a;
    font-size: 12px;
}

.role-card.pending {
    opacity: 0.7;
    border-style: dashed;
}

.player-panel {
    padding: 8px 0 24px;
}

.vote-live-hint {
    color: #3d2f20;
    font-size: 12px;
    margin-bottom: 10px;
    line-height: 1.4;
}

.vote-live-meta {
    color: #5a5043;
    font-size: 12px;
    font-style: italic;
    margin: -4px 0 8px;
    line-height: 1.35;
}

.title-saved-hint {
    color: #2d5a3a;
    font-size: 12px;
    margin-top: 8px;
    font-weight: 600;
}

.dead-row {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #1a110e;
    margin-bottom: 4px;
}

.tally-row .tally-chip {
    color: #1a110e;
}

.tally-row .tally-chip strong {
    color: #1a110e;
}

/* ── История голосований ── */
.vote-history-panel {
    background: #f4efe2;
    border: 1px solid #c2b9a3;
    border-radius: 10px;
    padding: 12px 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    box-sizing: border-box;
    width: 100%;
}

.vote-day-section + .vote-day-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 2px solid var(--gold-primary);
}

.vote-day-section .vote-day-header {
    text-align: left;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px dashed rgba(90, 80, 67, 0.35);
}

.vote-day-columns {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 10px;
    align-items: flex-start;
}

.vote-day-rows {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.vote-voter-avatar-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vote-voter-card--absent .vote-voter-name,
.vote-voter-card--absent .vote-voter-role {
    opacity: 0.75;
}

.vote-history-day-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 108px;
}

.vote-history-day-col--empty {
    min-height: 108px;
    border-radius: 6px;
    background: rgba(90, 80, 67, 0.06);
}

.vote-day-targets-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    margin-top: 0;
    width: 100%;
}

.vote-history-panel--matrix {
    overflow-x: auto;
}

.vote-history-matrix {
    --vote-voter-col: 94px;
    --vote-day-col: 60px;
    min-width: min(100%, calc(var(--vote-voter-col) + var(--vote-days) * var(--vote-day-col) + (var(--vote-days) - 1) * 8px));
}

.vote-history-matrix-head,
.vote-history-matrix-row {
    display: grid;
    grid-template-columns: var(--vote-voter-col) repeat(var(--vote-days), var(--vote-day-col));
    gap: 8px;
    align-items: start;
}

.vote-history-matrix-head {
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px dashed rgba(90, 80, 67, 0.35);
}

.vote-history-matrix-row + .vote-history-matrix-row {
    margin-top: 8px;
}

.vote-history-matrix-corner {
    min-width: var(--vote-voter-col);
}

.vote-history-matrix-day-head {
    text-align: center;
    padding: 0 2px;
    width: 100%;
    box-sizing: border-box;
}

.vote-history-matrix-day-num {
    display: block;
    font-size: 13px;
    font-weight: bold;
    color: #1a110e;
    line-height: 1.2;
}

.vote-history-matrix-day-sub {
    display: block;
    font-size: 9px;
    text-transform: uppercase;
    color: #5a5043;
    margin-top: 2px;
    line-height: 1.2;
}

.vote-history-matrix-voter .vote-voter-card {
    width: 100%;
}

.vote-history-target-chip {
    width: 56px;
    min-width: 56px;
    padding: 4px 3px 3px;
    gap: 0;
}

.vote-history-target-chip .avatar-portrait {
    width: 40px;
    height: 40px;
}

.vote-history-target-chip .avatar-chip-img,
.vote-history-target-chip .vk-avatar-styled {
    width: 40px;
    height: 40px;
}

.vote-history-target-chip .avatar-chip-num {
    font-size: 14px;
    font-weight: bold;
    padding: 2px 6px;
    top: 2px;
    left: 2px;
    min-width: 22px;
    text-align: center;
}

.vote-history-target-chip .vote-hit-mark {
    font-size: 17px;
}

.vote-history-target-chip .vote-hit-multi {
    font-size: 9px;
    padding: 1px 5px;
}

.vote-day-title {
    font-size: 18px;
    font-weight: bold;
    color: #1a110e;
    margin: 0;
    letter-spacing: 0.5px;
}

.vote-day-sub {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    color: #5a5043;
    margin-top: 2px;
}

.vote-day-tie {
    display: inline-block;
    margin-top: 4px;
    font-size: 11px;
    color: #b80f14;
    font-weight: bold;
}

.vote-day-tally {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed rgba(90, 80, 67, 0.35);
}

.vote-day-tally .vote-tally-panel {
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
}

.vote-day-tally .vote-tally-title,
.vote-day-tally .vote-tally-sub {
    display: none;
}

.vote-absent-chip {
    cursor: default;
    opacity: 0.85;
}

.vote-absent-overlay {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(26, 17, 14, 0.55);
    pointer-events: none;
}

.vote-absent-mark {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: bold;
    color: #1a110e;
    text-shadow: 0 0 4px rgba(244, 239, 226, 0.8);
    pointer-events: none;
}

.player-panel > .vote-history-panel {
    color: #1a110e;
}

/* ——— Statistics & archive ——— */
.stats-page {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.stats-profile-card .stats-profile-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 8px;
}

.stats-profile-stat {
    text-align: center;
    padding: 10px 6px;
    border-radius: 10px;
    background: rgba(244, 239, 226, 0.55);
    border: 1px solid rgba(90, 80, 67, 0.2);
}

.stats-profile-stat span {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    color: #5a5043;
    margin-bottom: 4px;
}

.stats-profile-stat strong {
    font-size: 20px;
    color: #1a110e;
}

.stats-archive-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stats-archive-card {
    width: 100%;
    text-align: left;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid rgba(90, 80, 67, 0.28);
    background: rgba(244, 239, 226, 0.7);
    cursor: pointer;
    color: #1a110e;
}

.stats-archive-card:active {
    transform: scale(0.99);
}

.stats-archive-card-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}

.stats-archive-card-top strong {
    font-size: 16px;
}

.stats-archive-date {
    font-size: 12px;
    color: #5a5043;
    white-space: nowrap;
}

.stats-archive-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-top: 8px;
    font-size: 13px;
    color: #3d342c;
}

.stats-archive-my {
    display: block;
    margin-top: 8px;
    font-size: 13px;
    font-weight: bold;
    color: #b80f14;
}

.stats-last-card {
    margin-bottom: 14px;
}

.stats-winner-card .stats-winner-line {
    font-size: 18px;
    margin: 6px 0 4px;
    color: #1a110e;
}

.stats-my-card .stats-my-total {
    font-size: 36px;
    font-weight: bold;
    color: #b80f14;
    margin: 4px 0;
    line-height: 1.1;
}

.stats-my-meta {
    font-size: 14px;
    color: #5a5043;
    margin-bottom: 10px;
}

.stats-breakdown {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stats-breakdown-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    padding: 6px 0;
    border-bottom: 1px dashed rgba(90, 80, 67, 0.2);
}

.stats-breakdown-row:last-child {
    border-bottom: none;
}

.stats-ratings-table {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stats-rating-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(244, 239, 226, 0.45);
}

.stats-rating-row--me {
    border: 2px solid #b80f14;
    background: rgba(184, 15, 20, 0.08);
}

.stats-rating-player {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.stats-rating-avatar {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.stats-rating-meta {
    display: block;
    font-size: 12px;
    color: #5a5043;
    margin-top: 2px;
}

.stats-rating-points {
    font-size: 18px;
    font-weight: bold;
    color: #b80f14;
    white-space: nowrap;
}

.stats-ach-row {
    padding: 8px 0;
    border-bottom: 1px dashed rgba(90, 80, 67, 0.2);
}

.stats-ach-row:last-child {
    border-bottom: none;
}

.stats-ach-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.stats-ach-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    background: rgba(26, 17, 14, 0.08);
    color: #1a110e;
}

.stats-night-round {
    margin-bottom: 12px;
}

.stats-night-round:last-child {
    margin-bottom: 0;
}

.stats-night-round-title {
    font-size: 14px;
    font-weight: bold;
    color: #1a110e;
    margin: 0 0 6px;
}

.stats-night-list {
    margin: 0;
    padding-left: 18px;
    font-size: 13px;
    color: #3d342c;
    line-height: 1.5;
}

.stats-night-actor {
    font-weight: bold;
    color: #1a110e;
}

.empty-hint {
    font-size: 14px;
    color: #5a5043;
    margin: 0;
}
