/* Deductive Test Styles */

/* Main Container */
.deductive-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Fade Animations */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

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

.hidden {
    display: none !important;
}

/* CTA Section (Intro) */
.deductive-hero {
    background: linear-gradient(to right, #1e293b, #0f172a);
    border-radius: 1rem;
    padding: 2rem;
    color: white;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    margin-bottom: 3rem;
}

@media (min-width: 768px) {
    .deductive-hero {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.hero-content h2 {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: white;
}

.hero-content p {
    color: #cbd5e1;
    max-width: 36rem;
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 200px;
}

.timer-input-group {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.timer-label {
    display: block;
    font-size: 0.75rem;
    color: #cbd5e1;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.timer-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.timer-input {
    background: transparent;
    border: none;
    color: white;
    font-weight: 700;
    font-size: 1.25rem;
    width: 100%;
    outline: none;
}

select.timer-input option {
    background: #1e293b;
    color: white;
}

.start-btn {
    width: 100%;
    background-color: #6366f1;
    color: white;
    font-weight: 700;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.3);
}

.start-btn:hover {
    background-color: #4f46e5;
    transform: translateY(-1px);
}

/* Tabs */
.tabs-nav {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.tabs-container {
    display: flex;
    gap: 0.25rem;
    background-color: white;
    padding: 0.25rem;
    border-radius: 0.75rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

.tab-btn {
    padding: 0.5rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #64748b;
    background: transparent;
}

.tab-btn.active {
    background-color: #f1f5f9;
    color: #0f172a;
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
}

/* Tutorial Layout */
.tutorial-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 1024px) {
    .tutorial-layout {
        grid-template-columns: 3fr 9fr;
    }
}

/* Level Selector */
.level-list {
    background-color: white;
    border-radius: 0.75rem;
    padding: 1rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.level-btn {
    width: 100%;
    text-align: left;
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
    color: #475569;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.level-btn:hover {
    background-color: #f8fafc;
    color: #1e293b;
}

.level-btn.active {
    background-color: #fef2f2;
    color: #b91c1c;
    font-weight: 600;
    box-shadow: 0 0 0 1px #fecaca;
}

.level-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Controls Bar */
.controls-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: white;
    padding: 1rem;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.play-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.5rem;
    border-radius: 9999px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.play-btn.start {
    background-color: #0f172a;
    color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.play-btn.stop {
    background-color: #fee2e2;
    color: #b91c1c;
}

.reset-btn {
    padding: 0.5rem;
    color: #94a3b8;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 0.375rem;
}

.reset-btn:hover {
    color: #475569;
    background-color: #f1f5f9;
}

.voice-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
}

.voice-toggle.on {
    background-color: #e0e7ff;
    color: #4338ca;
}

.voice-toggle.off {
    background-color: #f1f5f9;
    color: #64748b;
}

/* Message Box */
.message-box {
    background-color: white;
    border-left: 4px solid #ef4444;
    padding: 1.5rem;
    border-top-right-radius: 0.75rem;
    border-bottom-right-radius: 0.75rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    min-height: 100px;
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
}

.message-text {
    font-size: 1.125rem;
    color: #334155;
    font-weight: 500;
    line-height: 1.6;
}

/* Grid System */
.grid-container {
    display: inline-grid;
    gap: 0.5rem;
    padding: 1rem;
    background-color: white;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
}

.grid-cell {
    width: 4rem;
    height: 4rem;
    border-radius: 0.5rem;
    border: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background-color: #f8fafc;
    transition: all 0.3s;
}

@media (min-width: 640px) {
    .grid-cell {
        width: 5rem;
        height: 5rem;
    }
}

.grid-cell.highlight {
    border-color: #f59e0b;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.3);
    transform: scale(1.05);
    z-index: 10;
}

.grid-cell.target {
    background-color: #fff7ed;
    border-color: #fdba74;
}

.grid-cell.valid {
    background-color: #dcfce7;
    border-color: #22c55e;
}

.grid-cell.invalid {
    background-color: #fee2e2;
    border-color: #ef4444;
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* Shape Icons */
.shape-icon {
    width: 60%;
    height: 60%;
}

.shape-circle { color: #9333ea; }
.shape-triangle { color: #16a34a; }
.shape-square { color: #dc2626; }
.shape-star { color: #2563eb; }
.shape-cross { color: #ea580c; }
.shape-question { color: #f97316; }

/* Options Row */
.options-row {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    justify-content: center;
    opacity: 0.5;
    filter: grayscale(100%);
}

.option-preview {
    width: 3rem;
    height: 3rem;
    background-color: white;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Test Mode Styles */
.test-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: white;
    padding: 1rem;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    margin-bottom: 2rem;
    position: sticky;
    top: 1rem;
    z-index: 50;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}

.question-badge {
    background-color: #e0e7ff;
    color: #4338ca;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 700;
}

.difficulty-label {
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    font-weight: 600;
}

.difficulty-value {
    font-weight: 700;
}

.timer-display {
    font-family: monospace;
    font-size: 1.25rem;
    font-weight: 700;
    color: #334155;
}

.progress-bar {
    width: 100%;
    height: 0.5rem;
    background-color: #e2e8f0;
    border-radius: 9999px;
    margin-bottom: 2rem;
    overflow: hidden;
}

/* ==========================================================================
   DARK MODE OVERRIDES
   ========================================================================== */
html[data-theme="dark"] .tabs-container {
    background-color: #1e1e32;
    border-color: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .tab-btn {
    color: #94a3b8;
}

html[data-theme="dark"] .tab-btn.active {
    background-color: #2a2a45;
    color: #f1f5f9;
}

html[data-theme="dark"] .level-list {
    background-color: #1e1e32;
    border-color: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .level-btn {
    color: #cbd5e1;
}

html[data-theme="dark"] .level-btn:hover {
    background-color: #2a2a45;
    color: #f1f5f9;
}

html[data-theme="dark"] .level-btn.active {
    background-color: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.3);
}

html[data-theme="dark"] .controls-bar {
    background-color: #1e1e32;
    border-color: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .reset-btn {
    color: #94a3b8;
}

html[data-theme="dark"] .reset-btn:hover {
    color: #f1f5f9;
    background-color: #2a2a45;
}

html[data-theme="dark"] .voice-toggle.off {
    background-color: #2a2a45;
    color: #94a3b8;
}

html[data-theme="dark"] .voice-toggle.on {
    background-color: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
}

html[data-theme="dark"] .message-box {
    background-color: #1e1e32;
}

html[data-theme="dark"] .message-text {
    color: #e2e8f0;
}

html[data-theme="dark"] .grid-container {
    background-color: #1e1e32;
    border-color: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .grid-cell {
    background-color: #13131f;
    border-color: rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] .grid-cell.target {
    background-color: rgba(251, 146, 60, 0.1);
    border-color: rgba(251, 146, 60, 0.4);
}

html[data-theme="dark"] .grid-cell.valid {
    background-color: rgba(34, 197, 94, 0.1);
    border-color: #22c55e;
}

html[data-theme="dark"] .grid-cell.invalid {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
}

html[data-theme="dark"] .option-preview {
    background-color: #1e1e32;
    border-color: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .test-header {
    background-color: #1e1e32;
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

html[data-theme="dark"] .question-badge {
    background-color: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
}

html[data-theme="dark"] .difficulty-label {
    color: #94a3b8;
}

html[data-theme="dark"] .timer-display {
    color: #f1f5f9;
}

html[data-theme="dark"] .progress-bar {
    background-color: #2a2a45;
}

html[data-theme="dark"] .answer-btn {
    background-color: #1e1e32;
    border-color: rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] .answer-btn:hover {
    border-color: #6366f1;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

html[data-theme="dark"] .results-card {
    background-color: #1e1e32;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
}

html[data-theme="dark"] .score-circle {
    border-color: #2a2a45;
}

html[data-theme="dark"] .score-value {
    color: #f1f5f9;
}

html[data-theme="dark"] .score-label {
    color: #94a3b8;
}

html[data-theme="dark"] .results-card h2 {
    color: #f1f5f9;
}

html[data-theme="dark"] .results-card p {
    color: #94a3b8 !important;
}

/* Results Summary Classes */
.results-summary-card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px 0 rgba(0,0,0,0.06);
    border: 1px solid #e2e8f0;
    padding: 2rem;
    margin-bottom: 3rem;
    text-align: center;
}

.results-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.results-subtitle {
    color: #64748b;
    margin-bottom: 2rem;
}

.stat-card {
    padding: 1rem;
    background: #f8fafc;
    border-radius: 0.75rem;
}

.stat-label {
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.875rem;
    font-weight: 700;
}

/* Review Section Classes */
.review-heading {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.review-card {
    background: white;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
}

.review-card-header {
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: background 0.2s;
}

.review-card-header:hover {
    background: #f8fafc;
}

.review-question-title {
    font-weight: 700;
    color: #334155;
}

.review-question-subtitle {
    font-size: 0.75rem;
    color: #64748b;
}

.review-answer-label {
    font-size: 0.75rem;
    color: #cbd5e1;
}

.review-arrow {
    color: #cbd5e1;
}

.review-detail {
    border-top: 1px solid #f1f5f9;
    background: #f8fafc;
    padding: 1.5rem;
}

.review-explanation-title {
    font-weight: 700;
    color: #1e293b;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 0.5rem;
}

.review-step {
    font-size: 0.875rem;
    color: #475569;
    display: flex;
    gap: 0.75rem;
}

.review-step-num {
    font-family: monospace;
    color: #94a3b8;
    flex-shrink: 0;
}

/* Step-by-step explanation blocks */
.explanation-steps-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 600px;
    overflow-y: auto;
    padding-right: 0.5rem;
    scrollbar-width: thin;
}

.explanation-step-block {
    border-left: 3px solid #e2e8f0;
    padding-left: 1rem;
    padding-bottom: 0.5rem;
}

.explanation-step-text {
    font-size: 0.875rem;
    color: #475569;
    display: flex;
    gap: 0.5rem;
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.explanation-step-grid {
    margin-top: 0.5rem;
    margin-bottom: 0.25rem;
}

.mini-grid-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e2e8f0;
    border-radius: 3px;
    background: #f8fafc;
    font-size: 0.7rem;
    color: #94a3b8;
}

.mini-cell-filled {
    background: #eff6ff;
    border-color: #93c5fd;
}

.mini-cell-just-filled {
    background: #dcfce7;
    border-color: #4ade80;
    box-shadow: 0 0 0 1px #4ade80;
}

.mini-cell-target {
    background: #fef3c7;
    border-color: #f59e0b;
}

.mini-cell-highlight {
    border-color: #a78bfa;
    background: #f5f3ff;
}

/* Dark mode for results/review */
html[data-theme="dark"] .results-summary-card {
    background: #1e1e32;
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 1px 3px 0 rgba(0,0,0,0.4);
}

html[data-theme="dark"] .results-title {
    color: #f1f5f9;
}

html[data-theme="dark"] .results-subtitle {
    color: #94a3b8;
}

html[data-theme="dark"] .stat-card {
    background: #13131f;
}

html[data-theme="dark"] .stat-label {
    color: #94a3b8;
}

html[data-theme="dark"] .review-heading {
    color: #f1f5f9;
}

html[data-theme="dark"] .review-card {
    background: #1e1e32;
    border-color: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .review-card-header:hover {
    background: #2a2a45;
}

html[data-theme="dark"] .review-question-title {
    color: #f1f5f9;
}

html[data-theme="dark"] .review-question-subtitle {
    color: #94a3b8;
}

html[data-theme="dark"] .review-answer-label {
    color: #94a3b8;
}

html[data-theme="dark"] .review-arrow {
    color: #94a3b8;
}

html[data-theme="dark"] .review-detail {
    border-top-color: rgba(255, 255, 255, 0.1);
    background: #13131f;
}

html[data-theme="dark"] .review-explanation-title {
    color: #f1f5f9;
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .review-step {
    color: #cbd5e1;
}

html[data-theme="dark"] .review-step-num {
    color: #64748b;
}

html[data-theme="dark"] .explanation-step-block {
    border-left-color: #334155;
}

html[data-theme="dark"] .explanation-step-text {
    color: #cbd5e1;
}

html[data-theme="dark"] .mini-grid-cell {
    background: #1a1a2e;
    border-color: #334155;
    color: #64748b;
}

html[data-theme="dark"] .mini-cell-filled {
    background: #1e293b;
    border-color: #3b82f6;
}

html[data-theme="dark"] .mini-cell-just-filled {
    background: #14532d;
    border-color: #22c55e;
    box-shadow: 0 0 0 1px #22c55e;
}

html[data-theme="dark"] .mini-cell-target {
    background: #422006;
    border-color: #d97706;
}

html[data-theme="dark"] .mini-cell-highlight {
    background: #2e1065;
    border-color: #8b5cf6;
}

/* Secondary button */
.btn-secondary {
    background-color: white;
    color: #6366f1;
    border: 1px solid #6366f1;
}

html[data-theme="dark"] .btn-secondary {
    background-color: transparent;
    color: #a5b4fc;
    border-color: #6366f1;
}

.progress-fill {
    height: 100%;
    background-color: #6366f1;
    transition: width 1s linear;
}

.answer-options {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

.answer-btn {
    width: 5rem;
    height: 5rem;
    background-color: white;
    border: 2px solid #e2e8f0;
    border-radius: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.answer-btn:hover {
    border-color: #6366f1;
    transform: scale(1.05);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Results */
.results-card {
    background-color: white;
    border-radius: 1rem;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.score-circle {
    width: 12rem;
    height: 12rem;
    border-radius: 50%;
    border: 8px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto 2rem;
}

.score-value {
    font-size: 3rem;
    font-weight: 800;
    color: #0f172a;
}

.score-label {
    color: #64748b;
    font-weight: 500;
}

