/* Base styles with mobile-first approach */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #8B4513 0%, #D2691E 50%, #F4A460 100%);
    color: #333;
    line-height: 1.4;
    overflow-x: hidden;
}

/* Container with responsive height */
.container {
    width: 100%;
    height: 450px; /* Default iframe height */
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

/* Responsive height for new tab */
@media (min-height: 600px) and (min-width: 800px) {
    .container {
        height: 90vh;
        padding: 12px;
        gap: 12px;
    }
}

/* Tooltip styles */
.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s;
    max-width: 250px;
    text-align: center;
}

.tooltip.show {
    opacity: 1;
}

/* Courtroom scene styling */
.courtroom-scene {
    background: linear-gradient(to bottom, #8B4513 0%, #A0522D 100%);
    border: 3px solid #654321;
    border-radius: 12px;
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
    position: relative;
}

/* Judge section */
.judge-section {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(139, 69, 19, 0.8);
    padding: 8px;
    border-radius: 8px;
    border: 2px solid #8B4513;
}

.judge-character {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

.judge-avatar {
    font-size: 24px;
    background: #FFD700;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #B8860B;
}

.judge-name {
    font-size: 10px;
    font-weight: bold;
    color: #FFD700;
    margin-top: 2px;
}

.judge-speech-bubble {
    flex: 1;
    background: white;
    padding: 8px;
    border-radius: 8px;
    border: 2px solid #ccc;
    position: relative;
    min-height: 40px;
}

.judge-speech-bubble::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-right-color: white;
}

.judge-speech-bubble p {
    margin: 0;
    font-size: 11px;
    color: #333;
}

/* Characters section */
.characters-section {
    display: flex;
    justify-content: space-around;
    gap: 8px;
    flex: 1;
}

.character {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px;
    border-radius: 8px;
    border: 2px solid #ddd;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    max-width: 80px;
}

.character:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border-color: #007bff;
}

.character-avatar {
    font-size: 20px;
    margin-bottom: 4px;
    transition: transform 0.3s ease;
}

.character-avatar.crying {
    animation: shake 1s infinite;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-1px); }
    75% { transform: translateX(1px); }
}

.character-name {
    font-size: 9px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 2px;
}

.character-status {
    font-size: 8px;
    color: #666;
    text-align: center;
}

/* Scenario panel */
.scenario-panel {
    background: rgba(255, 255, 255, 0.95);
    padding: 8px;
    border-radius: 8px;
    border: 2px solid #ddd;
}

.scenario-panel h3 {
    font-size: 12px;
    margin-bottom: 6px;
    color: #333;
}

.scenario-buttons {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.scenario-btn {
    flex: 1;
    min-width: 120px;
    padding: 6px 8px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 9px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scenario-btn:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.scenario-btn.active {
    background: linear-gradient(135deg, #28a745, #1e7e34);
}

/* Argument platform */
.argument-platform {
    background: rgba(255, 255, 255, 0.95);
    padding: 8px;
    border-radius: 8px;
    border: 2px solid #ddd;
}

.role-selection h3 {
    font-size: 12px;
    margin-bottom: 6px;
    color: #333;
}

.role-buttons {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.role-btn {
    flex: 1;
    min-width: 100px;
    padding: 6px 8px;
    background: linear-gradient(135deg, #6c757d, #495057);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 9px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.role-btn:hover {
    background: linear-gradient(135deg, #495057, #343a40);
    transform: translateY(-1px);
}

.role-btn.active {
    background: linear-gradient(135deg, #dc3545, #c82333);
}

/* Argument input */
.argument-input h3 {
    font-size: 12px;
    margin-bottom: 6px;
    color: #333;
}

#argument-text {
    width: 100%;
    height: 60px;
    padding: 6px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 10px;
    resize: vertical;
    font-family: inherit;
}

#argument-text:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.argument-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.argument-actions button {
    flex: 1;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#submit-argument {
    background: linear-gradient(135deg, #28a745, #1e7e34);
    color: white;
}

#submit-argument:hover {
    background: linear-gradient(135deg, #1e7e34, #155724);
    transform: translateY(-1px);
}

#reset-argument {
    background: linear-gradient(135deg, #6c757d, #495057);
    color: white;
}

#reset-argument:hover {
    background: linear-gradient(135deg, #495057, #343a40);
    transform: translateY(-1px);
}

/* Results panel */
.results-panel {
    background: rgba(255, 255, 255, 0.95);
    padding: 8px;
    border-radius: 8px;
    border: 2px solid #28a745;
    max-height: 120px;
    overflow-y: auto;
}

.results-panel h3 {
    font-size: 12px;
    margin-bottom: 6px;
    color: #28a745;
}

#consequences-display {
    font-size: 10px;
    line-height: 1.4;
    margin-bottom: 8px;
}

.final-conclusion h4 {
    font-size: 11px;
    color: #dc3545;
    margin-bottom: 4px;
}

#lawyer-conclusion {
    font-size: 10px;
    font-style: italic;
    color: #333;
    background: #f8f9fa;
    padding: 6px;
    border-radius: 4px;
    border-left: 3px solid #dc3545;
}

/* Progress bar */
.progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #20c997);
    width: 0%;
    transition: width 0.5s ease;
}

/* Touch-friendly sizing for mobile */
@media (max-width: 768px) {
    .scenario-btn, .role-btn {
        min-height: 44px;
        font-size: 10px;
    }
    
    .character {
        min-height: 60px;
        min-width: 60px;
    }
    
    .argument-actions button {
        min-height: 44px;
    }
}

/* Scrollbar styling */
.results-panel::-webkit-scrollbar {
    width: 4px;
}

.results-panel::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.results-panel::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 2px;
}

.results-panel::-webkit-scrollbar-thumb:hover {
    background: #555;
}