.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 250;
    pointer-events: auto;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: #1a1a2e;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#dialog-speaker {
    font-weight: 700;
    font-size: 16px;
    color: #ffd700;
}

.modal-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.modal-close:hover {
    opacity: 1;
}

.modal-body {
    padding: 20px;
    color: #fff;
    font-size: 15px;
    line-height: 1.6;
    min-height: 100px;
}

.modal-footer {
    padding: 16px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-modal {
    max-width: 640px;
    height: min(78vh, 640px);
    display: flex;
    flex-direction: column;
    z-index: 250;
}

.chat-modal .modal-header {
    align-items: flex-start;
}

#chat-title {
    font-weight: 700;
    font-size: 16px;
    color: #ffd700;
}

.chat-modal .modal-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding-bottom: 16px;
}

.chat-status {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.3;
    color: #ffffff;
}

.chat-status--muted {
    color: rgba(255, 255, 255, 0.65);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 4px;
}

.chat-footer {
    align-items: center;
}

.chat-input {
    flex: 1;
    min-width: 0;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 11px 14px;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
}

.chat-input::placeholder {
    color: rgba(255, 255, 255, 0.55);
}

.chat-input:focus {
    border-color: rgba(255, 215, 0, 0.5);
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.12);
}

.chat-message {
    max-width: 90%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 10px 14px;
    color: #fff;
    align-self: flex-start;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.14);
}

.chat-message.self {
    align-self: flex-end;
    background: linear-gradient(135deg, #ffd700, #f6bf45);
    color: #1a1a2e;
    border-color: rgba(255, 255, 255, 0.12);
}

.chat-message.system {
    align-self: center;
    max-width: 100%;
    text-align: center;
    font-style: italic;
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.72);
    border-style: dashed;
}

.chat-name {
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 4px;
    opacity: 0.9;
}

.chat-text {
    font-size: 14px;
    line-height: 1.45;
    word-break: break-word;
}

.chat-meta {
    margin-top: 5px;
    font-size: 11px;
    opacity: 0.65;
    text-align: right;
}

.chat-message.system .chat-meta,
.chat-message.system .chat-name {
    display: none;
}

.btn-primary {
    background: #ffd700;
    color: #1a1a2e;
    border: none;
    padding: 10px 24px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

.btn-primary:hover {
    background: #ffed4a;
    transform: scale(1.02);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 10px 24px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Victory Screen */
.victory-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 500;
    pointer-events: auto;
    animation: fadeIn 0.5s ease;
}

.victory-content {
    text-align: center;
    color: #fff;
    animation: scaleIn 0.5s ease;
}

.victory-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: bounce 1s ease infinite;
}

.victory-title {
    font-size: 48px;
    font-weight: 800;
    color: #ffd700;
    margin: 0 0 10px 0;
    text-shadow: 0 4px 20px rgba(255, 215, 0, 0.5);
}

.victory-subtitle {
    font-size: 18px;
    opacity: 0.9;
    margin: 0 0 40px 0;
}

.victory-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 40px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.stat-item .stat-icon {
    font-size: 32px;
}

.stat-item .stat-label {
    font-size: 14px;
    opacity: 0.7;
}

.stat-item .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #ffd700;
}

.victory-btn {
    padding: 16px 48px;
    font-size: 18px;
    border-radius: 8px;
}

.victory-fireworks {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.firework-spark {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: sparkle 1.5s ease forwards;
}

/* Pause Overlay */
.pause-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 150;
    pointer-events: none;
}

.pause-content {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.7);
    padding: 16px 32px;
    border-radius: 8px;
    animation: pulse 2s ease infinite;
}

.pause-icon {
    font-size: 24px;
}

.pause-text {
    color: #fff;
    font-size: 16px;
    font-weight: 600;
}

/* Character Selection */
.char-modal {
    padding: 30px 26px 32px;
}

.game-title {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: 1px;
    color: #ffd700;
    text-shadow: 0 2px 12px rgba(255, 215, 0, 0.25);
    margin-bottom: 8px;
}

.char-heading {
    font-size: 22px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 6px;
}

.char-subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.82);
    margin: 0 0 22px;
}

.char-options {
    display: flex;
    gap: 18px;
    justify-content: center;
    flex-wrap: wrap;
}

.char-card {
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 22px 26px;
    width: 180px;
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s, background 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.char-card:hover {
    transform: translateY(-4px);
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.12);
}

.char-emoji {
    font-size: 56px;
    line-height: 1;
}

.char-name {
    font-size: 22px;
    font-weight: 700;
    color: #ffd700;
}

.char-desc {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes sparkle {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(3);
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}
