@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Crimson+Text:ital,wght@0,400;0,600;1,400&display=swap');

:root {
    --ides-primary: #8B0000;
    --ides-secondary: #D4AF37;
    --ides-accent: #1A1A2E;
    --ides-bg: #0F0F1A;
    --ides-surface: #16213E;
    --ides-text: #E8D5B7;
    --ides-text-secondary: #A69F8E;
    --ides-success: #2ECC71;
    --ides-danger: #E74C3C;
    --ides-seer: #9B59B6;
    --ides-conspirator: #2C3E50;
}

.ides-join-form,
.ides-lobby,
.ides-player-list,
.ides-chat,
.ides-voting,
.ides-admin {
    font-family: 'Crimson Text', serif;
    color: var(--ides-text);
    background: var(--ides-bg);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--ides-secondary);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.ides-title,
.ides-game-title {
    font-family: 'Cinzel', serif;
    color: var(--ides-secondary);
    text-align: center;
    margin-bottom: 8px;
    font-size: 2rem;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.ides-subtitle {
    text-align: center;
    color: var(--ides-text-secondary);
    margin-bottom: 24px;
    font-style: italic;
}

.ides-form-group {
    margin-bottom: 20px;
}

.ides-form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--ides-secondary);
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
}

.ides-input,
.ides-select {
    width: 100%;
    padding: 12px 16px;
    background: var(--ides-surface);
    border: 1px solid var(--ides-secondary);
    border-radius: 6px;
    color: var(--ides-text);
    font-family: 'Crimson Text', serif;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.ides-input:focus,
.ides-select:focus {
    outline: none;
    border-color: var(--ides-secondary);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

.ides-btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ides-btn-primary {
    background: linear-gradient(135deg, var(--ides-secondary) 0%, #B8860B 100%);
    color: var(--ides-bg);
}

.ides-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
}

.ides-btn-success {
    background: linear-gradient(135deg, var(--ides-success) 0%, #27AE60 100%);
    color: white;
}

.ides-btn-warning {
    background: linear-gradient(135deg, #F39C12 0%, #E67E22 100%);
    color: white;
}

.ides-btn-task {
    background: var(--ides-surface);
    border: 1px solid var(--ides-secondary);
    color: var(--ides-secondary);
    padding: 8px 16px;
    font-size: 0.8rem;
}

.ides-btn-task:hover {
    background: var(--ides-secondary);
    color: var(--ides-bg);
}

.ides-btn-danger {
    background: transparent;
    border: 1px solid #c0392b;
    color: #c0392b;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    letter-spacing: 1px;
    transition: background 0.2s, color 0.2s;
}
.ides-btn-danger:hover {
    background: #c0392b;
    color: #fff;
}

.ides-message {
    margin-top: 16px;
    padding: 12px;
    border-radius: 6px;
    text-align: center;
}

.ides-message.error {
    background: rgba(231, 76, 60, 0.2);
    border: 1px solid var(--ides-danger);
    color: var(--ides-danger);
}

.ides-message.success {
    background: rgba(46, 204, 113, 0.2);
    border: 1px solid var(--ides-success);
    color: var(--ides-success);
}

.ides-game-header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--ides-secondary);
}

.ides-game-status {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 12px;
}

.ides-phase,
.ides-round {
    background: var(--ides-surface);
    padding: 6px 16px;
    border-radius: 20px;
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    color: var(--ides-secondary);
}

.ides-player-card {
    background: var(--ides-surface);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    border-left: 4px solid var(--ides-secondary);
}

.ides-player-card h3 {
    font-family: 'Cinzel', serif;
    color: var(--ides-secondary);
    margin-bottom: 12px;
    font-size: 1.1rem;
}

.ides-player-name {
    font-size: 1.4rem;
    margin-bottom: 8px;
}

.ides-honorific {
    color: var(--ides-secondary);
    margin-right: 8px;
}

.ides-player-role {
    color: var(--ides-text-secondary);
}

.ides-role-value {
    color: var(--ides-text);
    font-weight: 600;
}

.ides-shield-indicator {
    margin-top: 12px;
    padding: 10px;
    background: rgba(212, 175, 55, 0.1);
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ides-shield-icon {
    font-size: 1.5rem;
}

.ides-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--ides-secondary);
}

.ides-tab {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: none;
    color: var(--ides-text-secondary);
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent;
}

.ides-tab:hover {
    color: var(--ides-text);
}

.ides-tab.active {
    color: var(--ides-secondary);
    border-bottom-color: var(--ides-secondary);
}

.ides-tab-content {
    min-height: 300px;
}

.ides-hidden {
    display: none;
}

.ides-player-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ides-player-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--ides-surface);
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.ides-player-list-header {
    margin-bottom: 16px;
}

.ides-player-list-header .ides-btn {
    font-size: 0.8rem;
    padding: 6px 12px;
}

.ides-player-item:hover {
    transform: translateX(4px);
    border-left: 3px solid var(--ides-secondary);
}

.ides-player-item.ides-dead,
.ides-player-item.ides-banished {
    opacity: 0.6;
}

.ides-player-avatar {
    width: 48px;
    height: 48px;
    background: var(--ides-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--ides-secondary);
}

.ides-avatar-icon {
    font-size: 1.5rem;
}

.ides-player-info {
    flex: 1;
}

.ides-player-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.ides-status {
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: 10px;
}

.ides-role-badge {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--ides-surface);
    border: 1px solid var(--ides-secondary);
    color: var(--ides-secondary);
    font-weight: bold;
}

.ides-role-badge.conspirator {
    background: rgba(231, 76, 60, 0.2);
    border-color: var(--ides-danger);
    color: var(--ides-danger);
}

.ides-role-badge.seer {
    background: rgba(155, 89, 182, 0.2);
    border-color: var(--ides-seer);
    color: var(--ides-seer);
}

.ides-role-badge.deity {
    background: rgba(212, 175, 55, 0.2);
    border-color: var(--ides-secondary);
    color: var(--ides-secondary);
}

.ides-status.alive {
    background: rgba(46, 204, 113, 0.2);
    color: var(--ides-success);
}

.ides-status.murdered {
    background: rgba(231, 76, 60, 0.2);
    color: var(--ides-danger);
}

.ides-status.banished {
    background: rgba(155, 89, 182, 0.2);
    color: var(--ides-seer);
}

.ides-tasks {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ides-tasks h3 {
    font-family: 'Cinzel', serif;
    color: var(--ides-secondary);
    margin-bottom: 4px;
}

.ides-task-info {
    color: var(--ides-text-secondary);
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.ides-task-card {
    background: var(--ides-surface);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.ides-task-card:hover {
    border-color: var(--ides-secondary);
}

.ides-task-card.ides-completed {
    border-color: var(--ides-success);
    opacity: 0.7;
}

.ides-task-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.ides-task-header h4 {
    font-family: 'Cinzel', serif;
    color: var(--ides-text);
    margin: 0;
    font-size: 1rem;
}

.ides-task-check {
    color: var(--ides-success);
    font-size: 1.2rem;
}

.ides-task-desc {
    color: var(--ides-text-secondary);
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.ides-chat {
    min-height: 400px;
}

.ides-chat-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.ides-chat-tab {
    padding: 8px 16px;
    background: var(--ides-surface);
    border: none;
    border-radius: 4px;
    color: var(--ides-text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.ides-chat-tab.active {
    background: var(--ides-secondary);
    color: var(--ides-bg);
}

.ides-chat-messages {
    height: 420px;
    overflow-y: auto;
    background: var(--ides-surface);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

/* DM panel is self-contained — don't clip it with the parent scroll box */
#ides-chat-direct {
    height: auto;
    overflow: visible;
    background: none;
    padding: 0;
    margin-bottom: 0;
}

.ides-chat-placeholder {
    color: var(--ides-text-secondary);
    text-align: center;
    padding: 40px;
    font-style: italic;
}

.ides-message-item {
    margin-bottom: 12px;
    padding: 8px 12px;
    background: var(--ides-bg);
    border-radius: 6px;
}

.ides-message-sender {
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    color: var(--ides-secondary);
    margin-bottom: 4px;
}

.ides-message-text {
    font-size: 0.95rem;
}

.ides-chat-input {
    display: flex;
    gap: 12px;
}

.ides-chat-input .ides-input {
    flex: 1;
}

.ides-btn-send {
    padding: 12px 20px;
}

.ides-voting h3 {
    font-family: 'Cinzel', serif;
    color: var(--ides-secondary);
    margin-bottom: 8px;
}

.ides-vote-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 20px 0;
}

.ides-vote-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--ides-surface);
    border-radius: 6px;
}

.ides-vote-name {
    font-size: 1rem;
}

.ides-btn-vote {
    padding: 6px 16px;
    background: var(--ides-primary);
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.ides-btn-vote:hover {
    background: #A50000;
}

.ides-vote-option .ides-btn-vote:disabled {
    background: var(--ides-success);
    cursor: default;
}

.ides-voting-closed {
    text-align: center;
    padding: 40px;
    color: var(--ides-text-secondary);
}

.ides-admin-section {
    background: var(--ides-surface);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.ides-admin-section h3 {
    font-family: 'Cinzel', serif;
    color: var(--ides-secondary);
    margin-bottom: 16px;
}

.ides-game-controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.ides-code-display {
    margin-top: 16px;
    padding: 16px;
    background: var(--ides-bg);
    border-radius: 6px;
    text-align: center;
    font-family: 'Cinzel', serif;
    font-size: 1.5rem;
    color: var(--ides-secondary);
    letter-spacing: 4px;
}

@media (max-width: 768px) {
    .ides-tabs {
        flex-wrap: wrap;
    }
    
    .ides-tab {
        flex: 1 1 45%;
    }
    
    .ides-game-controls {
        flex-direction: column;
    }
    
    .ides-game-controls .ides-btn {
        width: 100%;
    }
}

.ides-aka {
    color: var(--ides-text-secondary);
    font-size: 0.9em;
    font-style: italic;
}

/* AKA on its own line below the Roman name in Senate Members list */
.ides-aka-line {
    color: var(--ides-secondary);
    font-size: 0.85rem;
    font-style: italic;
    margin-top: 2px;
    line-height: 1.3;
}

/* DM recipient info block — two-line layout: Roman name + AKA */
.ides-dm-recipient-info {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.ides-dm-recipient-name {
    font-size: 0.95rem;
    color: var(--ides-text);
}

.ides-dm-recipient-aka {
    font-size: 0.8rem;
    color: var(--ides-secondary);
    font-style: italic;
}

.ides-player-item {
    cursor: pointer;
}

.ides-player-item:hover {
    border-left: 3px solid var(--ides-secondary);
}

.ides-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
}

.ides-modal-content {
    background-color: var(--ides-surface);
    margin: 10% auto;
    padding: 24px;
    border: 2px solid var(--ides-secondary);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    position: relative;
}

.ides-modal-close {
    position: absolute;
    right: 16px;
    top: 8px;
    font-size: 28px;
    font-weight: bold;
    color: var(--ides-secondary);
    cursor: pointer;
}

.ides-modal-close:hover {
    color: var(--ides-text);
}

.ides-modal-backstory {
    margin: 20px 0;
    padding: 16px;
    background: var(--ides-bg);
    border-radius: 8px;
}

.ides-modal-backstory h4 {
    color: var(--ides-secondary);
    margin-bottom: 8px;
    font-family: 'Cinzel', serif;
}

.ides-modal-backstory p {
    color: var(--ides-text);
    line-height: 1.6;
}

.ides-modal-actions {
    margin-top: 20px;
    text-align: center;
}

.ides-edit-backstory {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--ides-secondary);
}

.ides-edit-backstory textarea {
    width: 100%;
    padding: 12px;
    background: var(--ides-bg);
    border: 1px solid var(--ides-secondary);
    border-radius: 6px;
    color: var(--ides-text);
    font-family: 'Crimson Text', serif;
    min-height: 80px;
    resize: vertical;
    box-sizing: border-box;
}

.ides-edit-backstory input {
    width: 100%;
    padding: 12px;
    background: var(--ides-bg);
    border: 1px solid var(--ides-secondary);
    border-radius: 6px;
    color: var(--ides-text);
    font-family: 'Crimson Text', serif;
    margin-bottom: 12px;
    box-sizing: border-box;
}

.ides-alliance-section {
    margin-top: 20px;
    padding: 16px;
    background: var(--ides-bg);
    border-radius: 8px;
}

.ides-alliance-section h4 {
    color: var(--ides-secondary);
    margin-bottom: 12px;
    font-family: 'Cinzel', serif;
}

.ides-alliance-members {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.ides-alliance-member {
    padding: 6px 12px;
    background: var(--ides-surface);
    border-radius: 20px;
    font-size: 0.85rem;
}

.ides-invite-alliance {
    display: flex;
    gap: 8px;
}

.ides-invite-alliance select {
    flex: 1;
    padding: 8px;
    background: var(--ides-surface);
    border: 1px solid var(--ides-secondary);
    border-radius: 4px;
    color: var(--ides-text);
}

.ides-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    background: var(--ides-surface);
    border: 2px solid var(--ides-secondary);
    border-radius: 8px;
    color: var(--ides-text);
    z-index: 10000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease;
    max-width: 300px;
}

.ides-notification.success {
    border-color: var(--ides-success);
}

.ides-notification.error {
    border-color: var(--ides-danger);
}

/* ── Direct Message layout ── */
.ides-dm-container {
    display: flex;
    height: 380px;
    background: var(--ides-surface);
    border-radius: 8px;
    overflow: hidden;
}

.ides-dm-sidebar {
    width: 150px;
    min-width: 150px;
    border-right: 1px solid var(--ides-secondary);
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    overflow-y: auto;
}

.ides-dm-sidebar #ides-new-dm-btn {
    width: 100%;
    font-size: 0.75rem;
    padding: 6px 8px;
}

.ides-dm-thread-item {
    padding: 7px 8px;
    background: var(--ides-bg);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.78rem;
    border: 1px solid transparent;
    line-height: 1.3;
    word-break: break-word;
    color: var(--ides-text-secondary);
}

.ides-dm-thread-item:hover,
.ides-dm-thread-item.active {
    border-color: var(--ides-secondary);
    color: var(--ides-secondary);
}

.ides-dm-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ides-dm-active-header {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.3);
    font-family: 'Cinzel', serif;
    color: var(--ides-secondary);
    font-size: 0.8rem;
    min-height: 32px;
    display: flex;
    align-items: center;
}

.ides-dm-messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ides-dm-input-area is replaced by the unified bottom input — always hidden */
.ides-dm-input-area {
    display: none !important;
}

.ides-dm-input-area .ides-input {
    flex: 1;
}

.ides-dm-recipient-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
    margin-bottom: 8px;
}

.ides-dm-recipient-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--ides-surface);
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: border-color 0.2s;
}

.ides-dm-recipient-item:hover {
    border-color: var(--ides-secondary);
}

.ides-dm-recipient-item input[type="checkbox"] {
    width: auto;
    accent-color: var(--ides-secondary);
}

/* Citizen role badge (masked role for non-deity players) */
.ides-role-badge.citizen {
    background: var(--ides-surface);
    border-color: var(--ides-secondary);
    color: var(--ides-secondary);
}

/* Voted confirmation box */
.ides-voted-confirmation {
    background: rgba(46, 204, 113, 0.1);
    border: 1px solid var(--ides-success);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.ides-voted-confirmation p:first-child {
    color: var(--ides-success);
    font-size: 1.05rem;
    margin-bottom: 4px;
}

.ides-vote-option.ides-voted-for {
    border: 1px solid var(--ides-success);
    background: rgba(46, 204, 113, 0.06);
}

.ides-voted-check {
    color: var(--ides-success);
    font-weight: bold;
    font-size: 0.9rem;
    padding: 6px 16px;
}

.ides-voting-eliminated {
    color: var(--ides-text-secondary);
    font-style: italic;
    padding: 24px;
    text-align: center;
    background: var(--ides-surface);
    border-radius: 8px;
}

/* Admin game info banner with prominent code */
.ides-admin-game-info {
    border: 2px solid var(--ides-secondary) !important;
    background: var(--ides-surface) !important;
    text-align: center;
}

.ides-admin-game-code-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.ides-admin-code-label {
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    color: var(--ides-text-secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.ides-admin-code-value {
    font-family: 'Cinzel', serif;
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--ides-secondary);
    letter-spacing: 8px;
    line-height: 1.1;
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
}

.ides-admin-id-label {
    font-size: 0.85rem;
    color: var(--ides-text-secondary);
    margin-top: 4px;
}

/* Open Voting button — purple */
.ides-btn-seer {
    background: linear-gradient(135deg, #9B59B6 0%, #6C3483 100%);
    color: white;
}

.ides-btn-seer:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(155, 89, 182, 0.4);
}

/* Widen the lobby / admin container to use all available space */
.ides-lobby,
.ides-admin {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Make the tab content area taller for more screen real estate */
.ides-tab-content {
    min-height: 400px;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ── Mobile responsiveness ── */
@media (max-width: 600px) {
    /* Reduce outer padding */
    .ides-join-form,
    .ides-lobby,
    .ides-chat,
    .ides-voting,
    .ides-admin {
        padding: 12px;
    }

    /* Smaller title */
    .ides-title,
    .ides-game-title {
        font-size: 1.3rem;
        letter-spacing: 2px;
    }

    /* Phase/round badges */
    .ides-phase,
    .ides-round {
        font-size: 0.75rem;
        padding: 4px 10px;
    }

    /* Tabs: 2-per-row on narrow screens */
    .ides-tabs {
        flex-wrap: wrap;
    }
    .ides-tab {
        flex: 1 1 45%;
        font-size: 0.72rem;
        padding: 8px 4px;
        letter-spacing: 0;
    }

    /* Shorter chat messages window */
    .ides-chat-messages {
        height: 240px;
    }

    /* Chat input: tighter gap, smaller send button */
    .ides-chat-input {
        gap: 6px;
    }
    .ides-btn-send {
        padding: 10px 12px;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    /* Player items: tighter */
    .ides-player-item {
        padding: 10px 10px;
        gap: 10px;
    }
    .ides-player-avatar {
        width: 36px;
        height: 36px;
        min-width: 36px;
    }
    .ides-avatar-icon {
        font-size: 1rem;
    }

    /* Modal: full-width, less margin */
    .ides-modal-content {
        margin: 4% auto;
        padding: 16px;
        width: 95%;
    }

    /* Modal action buttons: stack vertically */
    .ides-modal-actions {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    .ides-modal-actions .ides-btn {
        width: 100%;
        text-align: center;
    }

    /* ── DM panel: stack sidebar above message area ── */
    .ides-dm-container {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }
    .ides-dm-sidebar {
        width: 100%;
        min-width: 0;
        max-height: 130px;
        border-right: none;
        border-bottom: 1px solid rgba(212, 175, 55, 0.3);
        overflow-y: auto;
    }
    .ides-dm-main {
        flex: none;
        height: auto;
        overflow: visible;
    }
    .ides-dm-messages-area {
        height: 200px;
        flex: none;
    }

    /* Mobile DM navigation: show back button, hide it on desktop */
    .ides-dm-sidebar.ides-dm-mobile-hidden {
        display: none;
    }
    .ides-dm-main.ides-dm-mobile-active {
        display: flex;
    }

    /* Back button — hidden on desktop, shown on mobile when in a thread */
    .ides-dm-back-btn {
        display: none;
        padding: 4px 10px;
        background: var(--ides-surface);
        border: 1px solid var(--ides-secondary);
        border-radius: 4px;
        color: var(--ides-secondary);
        font-size: 0.78rem;
        cursor: pointer;
        margin-right: 8px;
        flex-shrink: 0;
    }
    .ides-dm-back-btn.visible {
        display: inline-block;
    }

    /* Active DM header: flex row so back btn + name fit */
    .ides-dm-active-header {
        display: flex;
        align-items: center;
        flex-wrap: nowrap;
        gap: 4px;
        font-size: 0.75rem;
    }

    /* Admin game controls: single column */
    .ides-game-controls {
        flex-direction: column;
    }
    .ides-game-controls .ides-btn {
        width: 100%;
    }

    /* Notification: full width on mobile */
    .ides-notification {
        left: 10px;
        right: 10px;
        max-width: none;
        width: auto;
    }
}

/* ══════════════════════════════════════════════════════════════════════
   WESTERN THEME OVERRIDES
   Applied via .theme-western wrapper class on the lobby/join form
   ══════════════════════════════════════════════════════════════════════ */
.theme-western {
    --ides-primary: #8B4513;
    --ides-secondary: #DAA520;
    --ides-accent: #2F1B0C;
    --ides-bg: #1A0F06;
    --ides-surface: #3E2723;
    --ides-text: #F5DEB3;
    --ides-text-secondary: #D2B48C;
    --ides-success: #228B22;
    --ides-danger: #DC143C;
    --ides-seer: #9932CC;
    --ides-conspirator: #1C1C1C;
}

.theme-western .ides-title,
.theme-western .ides-game-title,
.theme-western .ides-tab,
.theme-western .ides-btn,
.theme-western .ides-form-group label,
.theme-western .ides-player-card h3,
.theme-western .ides-tasks h3,
.theme-western .ides-voting h3,
.theme-western .ides-admin-section h3,
.theme-western .ides-modal-backstory h4,
.theme-western .ides-message-sender,
.theme-western .ides-code-display,
.theme-western .ides-admin-code-label,
.theme-western .ides-admin-code-value,
.theme-western .ides-dm-active-header,
.theme-western .ides-phase,
.theme-western .ides-round,
.theme-western .ides-game-over-title,
.theme-western .ides-game-over-section h3 {
    font-family: 'Rye', serif;
}

.theme-western .ides-join-form,
.theme-western .ides-lobby,
.theme-western .ides-player-list,
.theme-western .ides-chat,
.theme-western .ides-voting,
.theme-western .ides-admin,
.theme-western .ides-input,
.theme-western .ides-select,
.theme-western .ides-message-text,
.theme-western .ides-edit-backstory textarea,
.theme-western .ides-edit-backstory input,
.theme-western .ides-modal-backstory p {
    font-family: 'Lora', serif;
}

/* ── Tab notification badge ──────────────────────────────────────────── */
.ides-tab-badge {
    display: inline-block;
    background: var(--ides-danger);
    color: white;
    border-radius: 50%;
    font-size: 0.7rem;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    padding: 0 4px;
    margin-left: 4px;
    vertical-align: middle;
    font-weight: 700;
}

/* ── Vote tally display ───────────────────────────────────────────────── */
.ides-vote-tally {
    margin-top: 20px;
    padding: 16px;
    background: var(--ides-surface);
    border-radius: 8px;
    border: 1px solid var(--ides-border);
}
.ides-vote-tally h4 {
    margin: 0 0 12px 0;
    color: var(--ides-secondary);
    font-size: 0.95rem;
    font-weight: 600;
}
.ides-tally-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ides-tally-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--ides-bg);
    border-radius: 6px;
}
.ides-tally-name {
    font-weight: 500;
}
.ides-tally-count {
    color: var(--ides-danger);
    font-weight: 600;
    font-size: 0.9rem;
}

/* ── Game Over Overlay ────────────────────────────────────────────────── */
.ides-game-over-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 1000;
    overflow-y: auto;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
}
.ides-game-over-content {
    background: var(--ides-surface);
    border-radius: 12px;
    border: 2px solid var(--ides-secondary);
    max-width: 680px;
    width: 100%;
    margin: auto;
    overflow: hidden;
}
.ides-game-over-header {
    text-align: center;
    padding: 32px 24px 20px;
    background: linear-gradient(180deg, rgba(212,175,55,0.15) 0%, transparent 100%);
    border-bottom: 1px solid var(--ides-border);
}
.ides-game-over-title {
    font-family: 'Cinzel', serif;
    font-size: 2.2rem;
    color: var(--ides-secondary);
    margin: 0 0 16px 0;
    letter-spacing: 0.05em;
}
.ides-winner-banner {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.ides-winner-citizens {
    background: rgba(212,175,55,0.2);
    border: 2px solid var(--ides-secondary);
    color: var(--ides-secondary);
}
.ides-winner-conspirators {
    background: rgba(220,53,69,0.2);
    border: 2px solid var(--ides-danger);
    color: #ff6b7a;
}
.ides-game-over-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}
.ides-game-over-section h3 {
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    color: var(--ides-secondary);
    margin: 0 0 14px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--ides-border);
}
.ides-banishment-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ides-banishment-entry {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--ides-bg);
    border-radius: 6px;
    flex-wrap: wrap;
}
.ides-banishment-round {
    font-size: 0.75rem;
    color: var(--ides-text-secondary);
    min-width: 52px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.ides-banishment-name {
    flex: 1;
    font-weight: 500;
    min-width: 120px;
}
.ides-banishment-votes {
    font-size: 0.8rem;
    color: var(--ides-danger);
    font-weight: 600;
    margin-left: auto;
}
.ides-reveal-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ides-reveal-entry {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--ides-bg);
    border-radius: 6px;
    flex-wrap: wrap;
}
.ides-reveal-name {
    flex: 1;
    font-weight: 500;
    min-width: 140px;
}
.ides-reveal-aka {
    font-size: 0.82rem;
    color: var(--ides-text-secondary);
    font-weight: 400;
}
.ides-game-over-empty {
    color: var(--ides-text-secondary);
    font-style: italic;
    font-size: 0.9rem;
}
@media (max-width: 600px) {
    .ides-game-over-title { font-size: 1.5rem; }
    .ides-game-over-header { padding: 20px 16px 16px; }
    .ides-game-over-body { padding: 16px; }
    .ides-winner-banner { font-size: 0.95rem; padding: 10px 16px; }
}

/* ── Mysterious Join Screen ── */
@keyframes ides-mystery-pulse {
    0%, 100% { text-shadow: 0 0 8px rgba(212, 175, 55, 0.4), 0 0 20px rgba(212, 175, 55, 0.1); }
    50%       { text-shadow: 0 0 16px rgba(212, 175, 55, 0.8), 0 0 40px rgba(212, 175, 55, 0.3); }
}

@keyframes ides-border-shimmer {
    0%, 100% { border-color: rgba(212, 175, 55, 0.3); box-shadow: 0 4px 20px rgba(0,0,0,0.4); }
    50%       { border-color: rgba(212, 175, 55, 0.7); box-shadow: 0 4px 30px rgba(212, 175, 55, 0.15); }
}

#ides-join-form {
    max-width: 480px;
    margin: 0 auto;
    background: #08080f;
    animation: ides-border-shimmer 4s ease-in-out infinite;
}

#ides-join-form .ides-title {
    animation: ides-mystery-pulse 3s ease-in-out infinite;
    font-size: 1.6rem;
    letter-spacing: 5px;
}

#ides-join-form .ides-subtitle {
    font-size: 1.05rem;
    color: var(--ides-text-secondary);
    letter-spacing: 1px;
}
