* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

.animated-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

#particles-canvas {
    width: 100%;
    height: 100%;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2em;
    margin-bottom: 10px;
}

header h2 {
    font-size: 1.5em;
    font-weight: 300;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 0.9em;
    opacity: 0.9;
    margin-top: 10px;
}

#progress {
    padding: 20px 30px;
    background: #f5f7fa;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

#progress-text {
    color: #666;
    font-size: 0.9em;
}

.timer-display {
    font-size: 1.2em;
    font-weight: 600;
    color: #667eea;
    font-family: 'Courier New', monospace;
}

.timer-display.warning {
    color: #ff9800;
}

.timer-display.danger {
    color: #f44336;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

#progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
    width: 0%;
}

#test-container {
    padding: 40px;
}

.question-container {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#question-number {
    color: #ffffff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 10px 20px;
    border-radius: 8px;
    display: inline-block;
    font-size: 1.1em;
    margin-bottom: 20px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

#question-text {
    font-size: 1.2em;
    line-height: 1.6;
    margin-bottom: 30px;
    color: #ffffff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px 24px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.answers-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
}

.answer-btn {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 18px 24px;
    font-size: 1em;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    color: #333;
    min-height: 70px;
    display: flex;
    align-items: center;
    word-wrap: break-word;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    animation: slideIn 0.3s ease forwards;
    opacity: 0;
    transform: translateX(-20px);
}

@keyframes slideIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.answer-btn:hover {
    background: #e8eaf6;
    border-color: #667eea;
    transform: translateX(5px);
}

.answer-btn:active {
    transform: scale(0.98);
}

.answer-btn.correct {
    background: #4caf50;
    color: white;
    border-color: #4caf50;
    animation: correctPulse 0.6s ease;
}

.answer-btn.incorrect {
    background: #f44336;
    color: white;
    border-color: #f44336;
    animation: incorrectShake 0.6s ease;
}

@keyframes correctPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); box-shadow: 0 0 20px rgba(76, 175, 80, 0.6); }
}

@keyframes incorrectShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.answer-btn.disabled {
    pointer-events: none;
    opacity: 0.6;
}

.results-container {
    text-align: center;
    padding: 20px;
}

.results-container.hidden {
    display: none;
}

.score-circle {
    width: 200px;
    height: 200px;
    margin: 30px auto;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
    animation: scaleIn 1s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes scaleIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.score-value {
    font-size: 3em;
    font-weight: bold;
    line-height: 1;
}

.score-label {
    font-size: 1em;
    opacity: 0.9;
    margin-top: 5px;
}

.result-percentage {
    font-size: 2em;
    color: #667eea;
    font-weight: bold;
    margin: 20px 0;
}

.result-text {
    font-size: 1.1em;
    color: #666;
    margin-bottom: 30px;
}

.results-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.btn-secondary {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(255, 107, 107, 0.4);
}

.wrong-questions-container {
    margin: 20px 0;
    padding: 20px;
    background: #fff3cd;
    border-radius: 10px;
    border-left: 4px solid #ff9800;
}

.wrong-questions-container h3 {
    color: #ff9800;
    margin-bottom: 15px;
}

.wrong-question-item {
    padding: 10px;
    margin-bottom: 10px;
    background: white;
    border-radius: 5px;
    border-left: 3px solid #f44336;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.wrong-question-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.wrong-question-item p {
    margin: 5px 0;
    color: #666;
}

.wrong-question-item .wrong-answer {
    color: #f44336;
    font-weight: 600;
}

.wrong-question-item .correct-answer {
    color: #4caf50;
    font-weight: 600;
}

.btn {
    padding: 15px 40px;
    font-size: 1em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

.btn-primary:active {
    transform: translateY(-1px) scale(0.98);
}

.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loader.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hidden {
    display: none !important;
}

/* Login Screen */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.login-container {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
}

.login-container h2 {
    color: #667eea;
    margin-bottom: 20px;
    text-align: center;
}

.login-container input,
.login-container select {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    font-family: inherit;
}

.login-container input:focus,
.login-container select:focus {
    outline: none;
    border-color: #667eea;
}

.login-hint {
    font-size: 0.85em;
    color: #666;
    text-align: center;
    margin-top: 10px;
}

/* Main Container */
.main-container {
    min-height: 100vh;
}

/* Header Top */
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background: rgba(255, 255, 255, 0.1);
    margin-bottom: 10px;
}

.user-info {
    color: white;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.user-info span {
    font-size: 0.9em;
}

.main-nav {
    display: flex;
    gap: 10px;
}

.nav-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9em;
    font-family: inherit;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.nav-btn.logout {
    background: rgba(244, 67, 54, 0.3);
    border-color: rgba(244, 67, 54, 0.5);
}

.nav-btn.logout:hover {
    background: rgba(244, 67, 54, 0.5);
    border-color: rgba(244, 67, 54, 0.7);
}

/* Modal */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #667eea;
}

#results-list {
    margin-top: 20px;
}

.result-item {
    padding: 15px;
    margin-bottom: 10px;
    background: #f5f7fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.result-item h3 {
    margin: 0 0 10px 0;
    color: #667eea;
    font-size: 1.1em;
}

.result-item p {
    margin: 5px 0;
    color: #666;
}

.result-item .score {
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
}

/* Tab Navigation */
.tabs-container {
    display: flex;
    gap: 10px;
    padding: 20px 30px;
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 2px solid #e0e0e0;
}

.tab-btn {
    flex: 1;
    padding: 15px 20px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    color: #666;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.tab-btn:hover {
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.tab-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.tab-icon {
    font-size: 1.3em;
}

.tab-content {
    display: none;
    padding: 30px;
    min-height: 60vh;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Feature Sections */
.feature-section {
    margin-bottom: 50px;
}

.section-title {
    font-size: 1.8em;
    color: #1e3c72;
    margin-bottom: 30px;
    text-align: center;
}

.scenario-grid,
.scheme-grid,
.role-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.scenario-card,
.scheme-card,
.role-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.scenario-card::before,
.scheme-card::before,
.role-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.scenario-card:hover::before,
.scheme-card:hover::before,
.role-card:hover::before {
    transform: scaleX(1);
}

.scenario-card:hover,
.scheme-card:hover,
.role-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.card-icon {
    font-size: 3.5em;
    text-align: center;
    margin-bottom: 20px;
}

.scenario-card h3,
.scheme-card h3,
.role-card h3 {
    color: #1e3c72;
    font-size: 1.3em;
    margin-bottom: 15px;
    text-align: center;
}

.scenario-card p,
.scheme-card p,
.role-card p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 20px;
    text-align: center;
}

.btn-start {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-start::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-start:hover::before {
    width: 300px;
    height: 300px;
}

.btn-start:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-start:active {
    transform: translateY(0);
}

/* Responsive adjustments for learning section */
@media (max-width: 768px) {
    .tabs-container {
        padding: 15px 20px;
        flex-direction: column;
    }
    
    .tab-btn {
        padding: 12px 15px;
    }
    
    .tab-icon {
        font-size: 1.2em;
    }
    
    .tab-text {
        font-size: 0.9em;
    }
    
    .tab-content {
        padding: 20px 15px;
    }
    
    .section-title {
        font-size: 1.5em;
    }
    
    .scenario-grid,
    .scheme-grid,
    .role-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .scenario-card,
    .scheme-card,
    .role-card {
        padding: 20px;
    }
    
    .card-icon {
        font-size: 2.5em;
    }
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        border-radius: 15px;
        margin: 0;
        max-width: 100%;
    }
    
    header {
        padding: 20px 15px;
    }
    
    header h1 {
        font-size: 1.3em;
    }
    
    header h2 {
        font-size: 1.1em;
    }
    
    .subtitle {
        font-size: 0.8em;
    }
    
    #progress {
        padding: 15px;
    }
    
    #test-container {
        padding: 20px 15px;
    }
    
    #question-text {
        font-size: 1em;
        line-height: 1.5;
        margin-bottom: 20px;
    }
    
    #question-number {
        font-size: 0.95em;
        padding: 8px 15px;
        margin-bottom: 15px;
    }
    
    .answer-btn {
        padding: 15px;
        font-size: 0.9em;
        min-height: 60px;
    }
    
    .answers-container {
        gap: 15px;
    }

    .header-top {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
        padding: 15px;
    }

    .user-info {
        width: 100%;
    }
    
    .user-info span {
        font-size: 0.85em;
    }

    .main-nav {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }

    .nav-btn {
        flex: 1;
        min-width: calc(50% - 4px);
        font-size: 0.85em;
        padding: 8px 12px;
    }
    
    .nav-btn.logout {
        width: 100%;
    }

    .login-container {
        padding: 25px 20px;
        margin: 10px;
    }
    
    .login-container h2 {
        font-size: 1.3em;
    }
    
    .login-container input,
    .login-container select {
        font-size: 0.95em;
    }
    
    .score-circle {
        width: 150px;
        height: 150px;
    }
    
    .score-value {
        font-size: 2.5em;
    }
    
    .result-percentage {
        font-size: 1.5em;
    }
    
    .result-text {
        font-size: 1em;
    }
    
    .btn {
        padding: 12px 30px;
        font-size: 0.95em;
        width: 100%;
    }
    
    .modal-content {
        padding: 20px;
        max-height: 90vh;
    }
    
    .result-item h3 {
        font-size: 1em;
    }
    
    .result-item p {
        font-size: 0.9em;
    }
}

@media (max-width: 480px) {
    body {
        padding: 5px;
    }
    
    header {
        padding: 15px 10px;
    }
    
    header h1 {
        font-size: 1.1em;
    }
    
    header h2 {
        font-size: 1em;
    }
    
    #test-container {
        padding: 15px 10px;
    }
    
    #question-number {
        font-size: 0.85em;
        padding: 6px 12px;
    }
    
    #question-text {
        font-size: 0.9em;
    }
    
    .answer-btn {
        padding: 12px;
        font-size: 0.85em;
        min-height: 55px;
    }
    
    .nav-btn {
        font-size: 0.8em;
        padding: 6px 10px;
    }
    
    .score-circle {
        width: 120px;
        height: 120px;
    }
    
    .score-value {
        font-size: 2em;
    }
    
    .score-label {
        font-size: 0.9em;
    }
    
    .results-buttons {
        flex-direction: column;
    }
    
    .timer-display {
        font-size: 1em;
    }
    
    .progress-info {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }
}

/* Safety Group Selection */
.safety-groups {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 30px;
    flex-wrap: wrap;
}

.safety-group-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 15px;
    padding: 30px 40px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 150px;
}

.safety-group-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.group-number {
    font-size: 3em;
    font-weight: bold;
    margin-bottom: 10px;
}

.group-text {
    font-size: 1.1em;
    font-weight: 500;
}

#safety-group-modal .modal-content {
    text-align: center;
}

#safety-group-modal h2 {
    color: #667eea;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .safety-groups {
        flex-direction: column;
        gap: 15px;
    }
    
    .safety-group-btn {
        width: 100%;
        padding: 25px 30px;
    }
    
    .group-number {
        font-size: 2.5em;
    }
    
    .group-text {
        font-size: 1em;
    }
}

/* Permission Quest Modal Styles */
.permission-quest-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.quest-modal-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.quest-modal-content h2 {
    color: #1e3c72;
    margin-bottom: 20px;
    text-align: center;
}

.quest-progress {
    margin-bottom: 30px;
}

.quest-step-indicator {
    text-align: center;
    color: #666;
    font-weight: 600;
    margin-bottom: 10px;
}

.quest-progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.quest-progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
    border-radius: 4px;
}

.quest-modal-content h3 {
    color: #1e3c72;
    margin-bottom: 15px;
}

.quest-question {
    font-size: 1.1em;
    color: #333;
    margin-bottom: 25px;
    line-height: 1.6;
}

.quest-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.quest-option-btn {
    padding: 15px 20px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    color: #333;
}

.quest-option-btn:hover {
    border-color: #667eea;
    background: #f8f9ff;
    transform: translateX(5px);
}

.quest-option-btn:active {
    transform: translateX(5px) scale(0.98);
}

.quest-close-btn {
    width: 100%;
    padding: 12px;
    background: #e0e0e0;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quest-close-btn:hover {
    background: #d0d0d0;
}

/* Switching Sequence Modal Styles */
.switching-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.switching-modal-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease;
}

.switching-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.switching-header h2 {
    color: #1e3c72;
    margin: 0;
}

.switching-close-btn {
    font-size: 1.5em;
    cursor: pointer;
    color: #999;
    transition: color 0.3s ease;
}

.switching-close-btn:hover {
    color: #333;
}

.switching-progress {
    margin-bottom: 30px;
}

.switching-step-indicator {
    text-align: center;
    color: #666;
    font-weight: 600;
    margin-bottom: 10px;
}

.switching-progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.switching-progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
    border-radius: 4px;
}

.switching-modal-content h3 {
    color: #1e3c72;
    margin-bottom: 10px;
}

.switching-description {
    color: #666;
    margin-bottom: 30px;
    line-height: 1.6;
}

/* Switching Diagram */
.switching-diagram {
    background: linear-gradient(to bottom, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 15px;
    padding: 40px 20px;
    margin-bottom: 20px;
    position: relative;
}

.power-line, .load-line {
    height: 4px;
    background: #333;
    margin: 20px 0;
}

.switches-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin: 40px 0;
    flex-wrap: wrap;
    gap: 30px;
}

.switch-element,
.voltmeter-element,
.ground-element,
.sign-element {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 15px;
    border-radius: 10px;
    position: relative;
}

.switch-element:hover,
.voltmeter-element:hover,
.ground-element:hover,
.sign-element:hover {
    transform: translateY(-5px);
}

.switch-element[data-clickable="true"],
.voltmeter-element[data-clickable="true"],
.ground-element[data-clickable="true"],
.sign-element[data-clickable="true"] {
    background: rgba(102, 126, 234, 0.1);
    border: 2px dashed #667eea;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(102, 126, 234, 0);
    }
}

.switch-element.switch-activating {
    animation: shake 0.6s ease;
    transform: scale(1.1);
}

@keyframes shake {
    0%, 100% { transform: translateX(0) scale(1.1); }
    25% { transform: translateX(-10px) scale(1.1); }
    75% { transform: translateX(10px) scale(1.1); }
}

.switch-element.switch-activated,
.voltmeter-element.switch-activated,
.ground-element.switch-activated,
.sign-element.switch-activated {
    background: rgba(76, 175, 80, 0.2);
    border: 2px solid #4caf50;
}

/* Switch body */
.switch-body {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.switch-handle {
    width: 40px;
    height: 4px;
    background: white;
    transition: transform 0.3s ease;
}

.switch-handle.switch-off {
    transform: rotate(90deg);
}

.voltmeter-icon,
.ground-icon,
.sign-icon {
    font-size: 3em;
    margin-bottom: 10px;
}

.switch-label {
    margin-top: 10px;
    color: #333;
    font-weight: 600;
    text-align: center;
}

.switch-hint {
    position: absolute;
    top: -30px;
    background: #667eea;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.9em;
    white-space: nowrap;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.switching-info {
    background: #e3f2fd;
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #2196f3;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-icon {
    font-size: 1.2em;
}

/* Complete screen */
.switching-complete {
    text-align: center;
}

.complete-icon {
    font-size: 4em;
    margin-bottom: 20px;
}

.switching-complete h2 {
    color: #1e3c72;
    margin-bottom: 15px;
}

.complete-list {
    text-align: left;
    display: inline-block;
    margin: 20px 0;
    list-style: none;
    padding: 0;
}

.complete-list li {
    padding: 8px 0;
    color: #666;
}

.complete-message {
    color: #4caf50;
    font-weight: 600;
    margin: 20px 0;
    font-size: 1.1em;
}

.complete-close-btn {
    padding: 12px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.complete-close-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

/* Responsive adjustments for quest modal */
@media (max-width: 768px) {
    .quest-modal-content {
        padding: 30px 20px;
    }
    
    .quest-modal-content h2 {
        font-size: 1.5em;
    }
    
    .quest-question {
        font-size: 1em;
    }
}

/* Responsive adjustments for switching modal */
@media (max-width: 768px) {
    .switching-modal-content {
        padding: 20px;
    }
    
    .switches-container {
        gap: 20px;
    }
    
    .switch-body {
        width: 60px;
        height: 60px;
    }
    
    .voltmeter-icon,
    .ground-icon,
    .sign-icon {
        font-size: 2em;
    }
}

/* TP Diagram Modal Styles */
.tp-diagram-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.tp-modal-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease;
}

.tp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.tp-header h2 {
    color: #1e3c72;
    margin: 0;
}

.tp-close-btn {
    font-size: 1.5em;
    cursor: pointer;
    color: #999;
    transition: color 0.3s ease;
}

.tp-close-btn:hover {
    color: #333;
}

.tp-description {
    color: #666;
    margin-bottom: 30px;
    text-align: center;
}

.tp-diagram-layout {
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 50%, #ecf0f1 50%, #bdc3c7 100%);
    border-radius: 15px;
    padding: 60px 40px;
    margin-bottom: 30px;
    position: relative;
    min-height: 500px;
}

.tp-high-voltage,
.tp-low-voltage {
    text-align: center;
    padding: 20px;
}

.tp-voltage-label {
    background: rgba(231, 76, 60, 0.9);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 700;
    display: inline-block;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.tp-low-voltage .tp-voltage-label {
    background: rgba(46, 204, 113, 0.9);
}

.tp-transformers,
.tp-switches {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.tp-transformer,
.tp-switch {
    background: rgba(255, 255, 255, 0.95);
    border: 3px solid #34495e;
    border-radius: 50%;
    width: 120px;
    height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.tp-transformer:hover,
.tp-switch:hover {
    transform: translateY(-10px) scale(1.1);
    border-color: #667eea;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.5);
}

.tp-transformer.element-activating,
.tp-switch.element-activating {
    animation: pulse-click 0.6s ease;
}

.tp-transformer.element-activated,
.tp-switch.element-activated {
    border-color: #4caf50;
    background: rgba(76, 175, 80, 0.1);
}

@keyframes pulse-click {
    0%, 100% { transform: scale(1.1); }
    50% { transform: scale(0.95); }
}

.transformer-icon,
.switch-icon {
    font-size: 3em;
    margin-bottom: 5px;
}

.transformer-label,
.switch-label {
    color: #333;
    font-weight: 700;
    text-align: center;
}

.transformer-hint,
.switch-hint {
    position: absolute;
    top: -35px;
    background: #667eea;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.8em;
    white-space: nowrap;
    animation: bounce 1s infinite;
}

.tp-info-panel {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    min-height: 150px;
}

.info-placeholder {
    text-align: center;
    color: #999;
    padding: 40px;
}

.info-active {
    animation: fadeIn 0.3s ease;
}

.info-active h3 {
    color: #1e3c72;
    margin-bottom: 20px;
    text-align: center;
}

.info-grid {
    display: grid;
    gap: 15px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.info-label {
    font-weight: 600;
    color: #666;
}

.info-value {
    color: #1e3c72;
    font-weight: 700;
}

.info-value.status-active {
    color: #4caf50;
}

/* Responsive adjustments for TP diagram modal */
@media (max-width: 768px) {
    .tp-modal-content {
        padding: 20px;
    }
    
    .tp-diagram-layout {
        padding: 30px 20px;
        min-height: 400px;
    }
    
    .tp-transformers,
    .tp-switches {
        gap: 20px;
    }
    
    .tp-transformer,
    .tp-switch {
        width: 100px;
        height: 100px;
    }
    
    .transformer-icon,
    .switch-icon {
        font-size: 2em;
    }
}

/* Workplace Designer Modal Styles */
.workplace-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.workplace-modal-content {
    background: white;
    border-radius: 20px;
    width: 95%;
    max-width: 1400px;
    max-height: 95vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.workplace-header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.workplace-header h2 {
    margin: 0;
    font-size: 1.5em;
}

.workplace-close-btn {
    cursor: pointer;
    font-size: 24px;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.2);
}

.workplace-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.workplace-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    height: calc(95vh - 80px);
    overflow: hidden;
}

.workplace-canvas {
    background: #f5f7fa;
    padding: 30px;
    overflow: auto;
}

.workplace-canvas h3 {
    text-align: center;
    color: #1e3c72;
    margin-bottom: 20px;
}

.workplace-svg {
    width: 100%;
    height: auto;
    max-height: calc(95vh - 120px);
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.placed-item {
    cursor: move;
    transition: all 0.3s ease;
}

.placed-item:hover {
    transform: scale(1.1);
}

.workplace-inventory {
    background: #f8f9fa;
    padding: 20px;
    overflow-y: auto;
    border-left: 2px solid #e0e0e0;
}

.workplace-inventory h3 {
    color: #1e3c72;
    margin-bottom: 15px;
    text-align: center;
}

.inventory-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.inventory-item {
    background: white;
    padding: 10px;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
    cursor: grab;
    transition: all 0.3s ease;
}

.inventory-item.correct {
    border-color: #4caf50;
}

.inventory-item.wrong {
    border-color: #f44336;
    opacity: 0.7;
}

.inventory-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.inventory-item.correct:hover {
    border-color: #45a049;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.inventory-item.wrong:hover {
    border-color: #d32f2f;
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.3);
}

.inventory-item:active {
    cursor: grabbing;
}

.item-icon {
    font-size: 1.8em;
    text-align: center;
    margin-bottom: 5px;
}

.item-name {
    font-weight: 600;
    color: #1e3c72;
    font-size: 0.9em;
    text-align: center;
}

.workplace-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.btn-check,
.btn-clear {
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1em;
}

.btn-check {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
}

.btn-check:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.btn-clear {
    background: #f44336;
    color: white;
}

.btn-clear:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.4);
}

.workplace-feedback {
    background: white;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
}

.workplace-feedback h4 {
    color: #1e3c72;
    margin-bottom: 15px;
}

.workplace-feedback ul {
    list-style: none;
    padding: 0;
    margin: 0 0 15px 0;
}

.workplace-feedback li {
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
}

.workplace-score {
    text-align: center;
    font-size: 1.5em;
    font-weight: 700;
    color: #1e3c72;
    padding: 15px;
    background: #f0f4ff;
    border-radius: 8px;
    margin: 15px 0;
}

.score-excellent {
    text-align: center;
    padding: 15px;
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
    border-radius: 8px;
    font-weight: 600;
}

.score-good {
    text-align: center;
    padding: 15px;
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
    border-radius: 8px;
    font-weight: 600;
}

.score-poor {
    text-align: center;
    padding: 15px;
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    color: white;
    border-radius: 8px;
    font-weight: 600;
}

/* Responsive adjustments for workplace modal */
@media (max-width: 1024px) {
    .workplace-layout {
        grid-template-columns: 1fr;
    }
    
    .workplace-inventory {
        border-left: none;
        border-top: 2px solid #e0e0e0;
    }
    
    .inventory-items {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .workplace-modal-content {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
    
    .workplace-layout {
        height: calc(100vh - 80px);
    }
    
    .workplace-canvas {
        padding: 15px;
    }
    
    .workplace-inventory {
        padding: 15px;
    }
    
    .inventory-items {
        grid-template-columns: 1fr;
    }
}

/* Wrong item message styles */
.wrong-item-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10001;
    animation: fadeInSlide 0.3s ease;
}

.wrong-item-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(244, 67, 54, 0.4);
    border: 3px solid #f44336;
    min-width: 350px;
    text-align: center;
}

.wrong-icon {
    font-size: 60px;
    margin-bottom: 15px;
    animation: shake 0.5s ease;
}

.wrong-title {
    font-size: 1.5em;
    font-weight: 700;
    color: #f44336;
    margin-bottom: 15px;
}

.wrong-reason {
    font-size: 1em;
    color: #666;
    line-height: 1.5;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* Rescue Simulator Modal Styles */
.rescue-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.rescue-modal-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 800px;
    width: 90%;
    max-height: 95vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease;
}

.rescue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.rescue-header h2 {
    color: #f44336;
    margin: 0;
    font-size: 1.8em;
}

.rescue-timer {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    color: white;
    padding: 10px 25px;
    border-radius: 50px;
    font-size: 1.5em;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.4);
}

.rescue-close-btn {
    font-size: 1.5em;
    cursor: pointer;
    color: #999;
    transition: color 0.3s ease;
    background: rgba(244, 67, 54, 0.1);
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.rescue-close-btn:hover {
    color: #f44336;
    background: rgba(244, 67, 54, 0.2);
}

.rescue-info {
    margin-bottom: 25px;
}

.patient-status {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    color: white;
    padding: 20px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
}

.patient-status.severe {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
}

.patient-status.success {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
}

.patient-status.death {
    background: linear-gradient(135deg, #424242 0%, #212121 100%);
    animation: shake 0.5s ease infinite;
}

.status-icon {
    font-size: 3em;
}

.status-text {
    font-size: 1.3em;
    font-weight: 700;
}

.rescue-scenario {
    background: #fff3cd;
    border-left: 5px solid #ff9800;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 25px;
}

.rescue-scenario h3 {
    color: #f44336;
    margin-bottom: 10px;
}

.scenario-description {
    color: #666;
    line-height: 1.6;
}

.rescue-step-info {
    margin-bottom: 20px;
}

.step-number {
    text-align: center;
    color: #666;
    font-weight: 600;
    margin-bottom: 10px;
}

.rescue-progress-bar {
    width: 100%;
    height: 10px;
    background: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
}

.rescue-progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    transition: width 0.3s ease;
    border-radius: 5px;
}

.rescue-modal-content h3 {
    color: #1e3c72;
    margin-bottom: 15px;
}

.rescue-description {
    color: #666;
    margin-bottom: 25px;
    line-height: 1.6;
    font-size: 1.05em;
}

.rescue-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.rescue-option-btn {
    padding: 18px 25px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    color: #333;
    position: relative;
}

.rescue-option-btn:hover {
    border-color: #f44336;
    background: #fff5f5;
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.2);
}

.rescue-option-btn:active {
    transform: translateX(5px) scale(0.98);
}

.rescue-option-btn.correct {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
    border-color: #4caf50;
    animation: correctPulse 0.6s ease;
}

.rescue-option-btn.incorrect {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    color: white;
    border-color: #f44336;
    animation: shake 0.6s ease;
}

.rescue-option-btn.disabled {
    pointer-events: none;
    opacity: 0.7;
}

.rescue-result {
    text-align: center;
    padding: 30px;
}

.rescue-result.success {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-radius: 15px;
    border: 3px solid #4caf50;
}

.rescue-result.death,
.rescue-result.timeout {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    border-radius: 15px;
    border: 3px solid #f44336;
}

.result-icon {
    font-size: 5em;
    margin-bottom: 20px;
    animation: bounce 1s ease infinite;
}

.rescue-result h2 {
    color: #1e3c72;
    margin-bottom: 15px;
    font-size: 2em;
}

.result-message {
    font-size: 1.2em;
    color: #333;
    margin-bottom: 30px;
    font-weight: 600;
}

.rescue-summary {
    background: white;
    padding: 25px;
    border-radius: 15px;
    margin: 25px 0;
    text-align: left;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.rescue-summary h3 {
    color: #1e3c72;
    margin-bottom: 15px;
    text-align: center;
}

.action-list {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
}

.action-list li {
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 8px;
    border-left: 4px solid;
}

.action-correct {
    background: #e8f5e9;
    border-color: #4caf50;
    color: #2e7d32;
}

.action-incorrect {
    background: #ffebee;
    border-color: #f44336;
    color: #c62828;
}

.score-summary {
    text-align: center;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

.score-summary p {
    margin: 8px 0;
    font-weight: 600;
    color: #666;
}

/* Responsive adjustments for rescue modal */
@media (max-width: 768px) {
    .rescue-modal-content {
        padding: 25px 20px;
    }
    
    .rescue-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .rescue-header h2 {
        font-size: 1.5em;
    }
    
    .rescue-timer {
        font-size: 1.2em;
        padding: 8px 20px;
    }
    
    .status-icon {
        font-size: 2.5em;
    }
    
    .status-text {
        font-size: 1.1em;
    }
    
    .result-icon {
        font-size: 4em;
    }
    
    .rescue-result h2 {
        font-size: 1.5em;
    }
    
    .result-message {
        font-size: 1em;
    }
}

/* Investigator Simulator Modal Styles */
.investigator-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.investigator-modal-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 900px;
    width: 90%;
    max-height: 95vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease;
}

.investigator-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.investigator-header h2 {
    color: #1e3c72;
    margin: 0;
    font-size: 1.8em;
}

.investigator-timer {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 10px 25px;
    border-radius: 50px;
    font-size: 1.5em;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    box-shadow: 0 4px 15px rgba(30, 60, 114, 0.4);
}

.investigator-close-btn {
    font-size: 1.5em;
    cursor: pointer;
    color: #999;
    transition: color 0.3s ease;
    background: rgba(30, 60, 114, 0.1);
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.investigator-close-btn:hover {
    color: #1e3c72;
    background: rgba(30, 60, 114, 0.2);
}

.investigation-scenario {
    background: #e3f2fd;
    border-left: 5px solid #1e3c72;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 25px;
}

.investigation-scenario h3 {
    color: #1e3c72;
    margin-bottom: 10px;
}

.scenario-description {
    color: #666;
    line-height: 1.6;
}

.investigation-step-info {
    margin-bottom: 20px;
}

.investigation-progress-bar {
    width: 100%;
    height: 10px;
    background: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
}

.investigation-progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    transition: width 0.3s ease;
    border-radius: 5px;
}

.investigator-modal-content h3 {
    color: #1e3c72;
    margin-bottom: 15px;
}

.investigation-description {
    color: #666;
    margin-bottom: 25px;
    line-height: 1.6;
    font-size: 1.05em;
}

.investigation-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.investigation-option-btn {
    padding: 18px 25px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    color: #333;
    position: relative;
}

.investigation-option-btn:hover {
    border-color: #1e3c72;
    background: #f0f4ff;
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(30, 60, 114, 0.2);
}

.investigation-option-btn:active {
    transform: translateX(5px) scale(0.98);
}

.investigation-option-btn.correct {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
    border-color: #4caf50;
    animation: correctPulse 0.6s ease;
}

.investigation-option-btn.incorrect {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    color: white;
    border-color: #f44336;
    animation: shake 0.6s ease;
}

.investigation-option-btn.disabled {
    pointer-events: none;
    opacity: 0.7;
}

.investigation-result {
    text-align: center;
    padding: 30px;
}

.investigation-result.success {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-radius: 15px;
    border: 3px solid #4caf50;
}

.investigation-result.failure,
.investigation-result.death,
.investigation-result.timeout {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-radius: 15px;
    border: 3px solid #ff9800;
}

.investigation-summary {
    background: white;
    padding: 25px;
    border-radius: 15px;
    margin: 25px 0;
    text-align: left;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.investigation-summary h3 {
    color: #1e3c72;
    margin-bottom: 15px;
    text-align: center;
}

.cause-box {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    border-left: 5px solid #1e3c72;
    margin-bottom: 20px;
    text-align: center;
}

.cause-box p {
    margin: 0;
    color: #1e3c72;
    font-size: 1.1em;
    line-height: 1.6;
}

/* Responsive adjustments for investigator modal */
@media (max-width: 768px) {
    .investigator-modal-content {
        padding: 25px 20px;
    }
    
    .investigator-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .investigator-header h2 {
        font-size: 1.5em;
    }
    
    .investigator-timer {
        font-size: 1.2em;
        padding: 8px 20px;
    }
    
    .result-icon {
        font-size: 4em;
    }
    
    .investigation-result h2 {
        font-size: 1.5em;
    }
    
    .result-message {
        font-size: 1em;
    }
}

/* Mobile bottom-sheet tweaks */
@media (max-width: 640px) {
	/* Общая оболочка модалок к нижнему краю */
	.switching-modal,
	.tp-diagram-modal,
	.workplace-modal,
	.rescue-modal,
	.investigator-modal {
		display: flex;
		align-items: flex-end;
	}

	/* Контент — как шторка */
	.switching-modal .switching-modal-content,
	.tp-diagram-modal .tp-modal-content,
	.workplace-modal .workplace-modal-content,
	.rescue-modal .rescue-modal-content,
	.investigator-modal .investigator-modal-content {
		width: 100%;
		max-height: 88vh;
		border-top-left-radius: 16px;
		border-top-right-radius: 16px;
		position: relative;
		animation: slideIn .2s ease;
	}

	/* Хэндл для перетаскивания */
	.switching-modal .switching-modal-content::before,
	.tp-diagram-modal .tp-modal-content::before,
	.workplace-modal .workplace-modal-content::before,
	.rescue-modal .rescue-modal-content::before,
	.investigator-modal .investigator-modal-content::before {
		content: '';
		display: block;
		width: 44px;
		height: 5px;
		border-radius: 3px;
		background: rgba(0,0,0,.2);
		margin: 8px auto;
	}

	/* Крупнее тапы */
	.investigation-option-btn,
	.rescue-option-btn,
	.btn-check,
	.btn-clear,
	.switch-element,
	.voltmeter-element,
	.ground-element,
	.sign-element {
		padding: 14px 16px;
	}
}
