/* Debate Mode Styles */

/* Custom Scrollbar */
.debate-messages::-webkit-scrollbar {
    width: 6px;
}

.debate-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 3px;
}

.debate-messages::-webkit-scrollbar-thumb {
    background: rgba(249, 176, 40, 0.3);
    border-radius: 3px;
}

.debate-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(249, 176, 40, 0.5);
}

.debate-page {
    min-height: calc(100vh - 76px);
    background: radial-gradient(ellipse at top, #1a1510 0%, #0a0a0a 50%, #000 100%);
    padding: 40px 0;
    position: relative;
}

.debate-container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.debate-header {
    text-align: center;
    margin-bottom: 35px;
}

.debate-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.25);
    padding: 5px 14px;
    border-radius: 50px;
    font-size: 0.65rem;
    color: #4ade80;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 12px;
}

.debate-badge i {
    font-size: 0.75rem;
}

.debate-title {
    font-family: 'Fredoka', cursive;
    font-size: 2.4rem;
    background: linear-gradient(135deg, #fff 0%, #ccc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.debate-subtitle {
    color: #ccc;
    font-size: 0.95rem;
}

/* Character Selection Phase */
.selection-phase {
    display: block;
    max-width: 900px;
    margin: 0 auto;
}

.debate-phase {
    display: none;
}

.debate-phase.active {
    display: block;
}

.selection-phase.hidden {
    display: none;
}

.selection-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 30px;
    align-items: center;
    margin-bottom: 25px;
}

/* Character Selector Card with Video */
.character-selector {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: all 0.3s ease;
    position: relative;
}

.character-selector:hover {
    border-color: rgba(249, 176, 40, 0.25);
}

.character-selector.selected {
    border-color: rgba(249, 176, 40, 0.5);
    box-shadow: 0 0 40px rgba(249, 176, 40, 0.15);
}

.selector-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #666;
    padding: 14px 16px 10px;
    text-align: center;
}

/* Video Container for Selection */
.selector-video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 4/4;
    background: #0a0a0a;
    overflow: hidden;
}

.selector-video-container video,
.selector-video-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
}

.selector-video-container .placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #1a1a1a 0%, #0d0d0d 100%);
}

.selector-video-container .placeholder i {
    font-size: 3rem;
    color: #333;
}

/* Video Overlay Info */
.selector-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px 16px 16px;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.7) 50%, transparent 100%);
    pointer-events: none;
    z-index: 5;
}

.selector-name {
    font-family: 'Fredoka', cursive;
    font-size: 1.1rem;
    color: #f9b028;
    margin-bottom: 2px;
}

.selector-meta {
    font-size: 0.75rem;
    color: #888;
}

/* Dropdown */
.selector-dropdown-wrapper {
    padding: 12px 14px 14px;
    background: rgba(0, 0, 0, 0.4);
    position: relative;
    z-index: 10;
}

.selector-dropdown {
    width: 100%;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 11px 14px;
    color: #aaa;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.selector-dropdown:focus {
    outline: none;
    border-color: rgba(249, 176, 40, 0.4);
    color: #fff;
}

/* VS Badge */
.vs-badge {
    width: 55px;
    height: 55px;
    background: linear-gradient(135deg, #f9b028 0%, #e89f20 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Fredoka', cursive;
    font-size: 1.1rem;
    color: #000;
    font-weight: 700;
    box-shadow: 0 0 35px rgba(249, 176, 40, 0.35);
    flex-shrink: 0;
}

/* Topic Input */
.topic-section {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 20px;
}

.topic-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #666;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.topic-label i {
    color: #f9b028;
    font-size: 0.8rem;
}

.topic-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 14px 18px;
    color: #fff;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.topic-input:focus {
    outline: none;
    border-color: rgba(249, 176, 40, 0.4);
    background: rgba(0, 0, 0, 0.4);
}

.topic-input::placeholder {
    color: #444;
}

.topic-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.topic-chip {
    background: rgba(249, 176, 40, 0.08);
    border: 1px solid rgba(249, 176, 40, 0.15);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    color: rgba(249, 176, 40, 0.8);
    cursor: pointer;
    transition: all 0.2s ease;
}

.topic-chip:hover {
    background: rgba(249, 176, 40, 0.15);
    color: #f9b028;
}

/* Start Button */
.start-debate-btn {
    width: 100%;
    background: linear-gradient(135deg, #f9b028 0%, #e89f20 100%);
    border: none;
    border-radius: 12px;
    padding: 15px 30px;
    color: #000;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.start-debate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(249, 176, 40, 0.3);
}

.start-debate-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ==================== */
/* DEBATE ARENA PHASE   */
/* ==================== */

.debate-arena {
    display: grid;
    grid-template-columns: 256px 1fr 256px;
    gap: 20px;
    height: 600px;
}

/* Debater Panel with Video */
.debater-panel {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(249, 176, 40, 0.1);
    position: relative;
    height: 320px;
    width: 256px;
    transition: all 0.3s ease;
}

.debater-panel.speaking {
    border-color: rgba(249, 176, 40, 0.5);
    box-shadow: 0 0 30px rgba(249, 176, 40, 0.2);
}

/* Speaking Badge */
.speaking-badge {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: #f9b028;
    color: #000;
    font-size: 0.6rem;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.debater-panel.speaking .speaking-badge {
    opacity: 1;
}

/* Debater Video */
.debater-video-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.debater-video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
}

.debater-video-container .debater-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 50px 14px 14px;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.6) 60%, transparent 100%);
    text-align: center;
}

.debater-name {
    font-family: 'Fredoka', cursive;
    font-size: 0.95rem;
    color: #f9b028;
    margin-bottom: 3px;
}

.debater-era {
    font-size: 0.7rem;
    color: #777;
}

/* Chat Area */
.debate-chat {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
    height: 100%;
}

.debate-topic-bar {
    background: rgba(0, 0, 0, 0.3);
    padding: 12px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topic-text {
    font-size: 0.8rem;
    color: #666;
}

.topic-text strong {
    color: #f9b028;
}

.round-badge {
    background: rgba(249, 176, 40, 0.1);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    color: #f9b028;
}

.debate-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
}

.debate-message {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

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

.debate-message.left {
    align-self: flex-start;
}

.debate-message.right {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.debate-message.center {
    align-self: center;
    max-width: 70%;
}

.msg-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
    overflow: hidden;
    border: 1px solid rgba(249, 176, 40, 0.15);
}

.msg-avatar img,
.msg-avatar video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.msg-avatar.user {
    background: linear-gradient(135deg, #f9b028 0%, #e89f20 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
}

.msg-avatar.user i {
    color: #000;
    font-size: 0.85rem;
}

.msg-content {
    background: rgba(255, 255, 255, 0.04);
    padding: 12px 16px;
    border-radius: 14px;
    color: #bbb;
    font-size: 0.88rem;
    line-height: 1.55;
}

.debate-message.left .msg-content {
    border-bottom-left-radius: 4px;
    border-left: 2px solid rgba(249, 176, 40, 0.4);
}

.debate-message.right .msg-content {
    border-bottom-right-radius: 4px;
    border-right: 2px solid rgba(249, 176, 40, 0.4);
}

.debate-message.center .msg-content {
    background: rgba(249, 176, 40, 0.08);
    border: 1px solid rgba(249, 176, 40, 0.15);
    text-align: center;
    font-style: italic;
    color: #888;
}

.msg-name {
    font-size: 0.65rem;
    color: #f9b028;
    margin-bottom: 4px;
    font-weight: 600;
    opacity: 0.8;
}

.debate-message.right .msg-name {
    text-align: right;
}

/* Input Area */
.debate-input-area {
    padding: 14px 18px;
    background: rgba(0, 0, 0, 0.25);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.debate-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.action-btn {
    flex: 1;
    padding: 10px 15px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.action-btn.continue {
    background: linear-gradient(135deg, #f9b028 0%, #e89f20 100%);
    color: #000;
}

.action-btn.continue:hover {
    box-shadow: 0 5px 20px rgba(249, 176, 40, 0.3);
}

.action-btn.end {
    background: rgba(255, 255, 255, 0.06);
    color: #666;
}

.action-btn.end:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #999;
}

.debate-input-wrapper {
    display: flex;
    gap: 10px;
}

.debate-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 11px 15px;
    color: #fff;
    font-size: 0.88rem;
}

.debate-input:focus {
    outline: none;
    border-color: rgba(249, 176, 40, 0.3);
}

.debate-input::placeholder {
    color: #444;
}

.debate-send-btn {
    background: linear-gradient(135deg, #f9b028 0%, #e89f20 100%);
    border: none;
    border-radius: 10px;
    padding: 11px 18px;
    color: #000;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.debate-send-btn:hover {
    box-shadow: 0 5px 20px rgba(249, 176, 40, 0.3);
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
}

.typing-indicator span {
    width: 7px;
    height: 7px;
    background: #f9b028;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Responsive */
@media (max-width: 900px) {
    .selection-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .selector-video-container {
        aspect-ratio: 3/4;
        max-height: 200px;
    }
    
    .vs-badge {
        margin: 0 auto;
    }
    
    .debate-arena {
        grid-template-columns: 1fr 1fr;
        height: auto;
        max-height: none;
    }
    
    .debate-chat {
        grid-column: span 2;
        order: -1;
        height: 400px;
    }
    
    .debater-panel {
        height: 280px;
    }
}
