:root {
    --bg-color: #000000;
    --text-primary: #ffffff;
    --text-secondary: #cccccc; /* Lighter text for more lift */
    --accent-red: #8B0000;
    --accent-red-hover: #a30000;
    --accent-red-glow: rgba(139, 0, 0, 0.4);
    --glass-bg: rgba(255, 255, 255, 0.05); /* slightly lighter */
    --glass-border: rgba(255, 255, 255, 0.2); /* more contrast outline */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-family);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

/* Typography */
h1 {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #fff;
    text-shadow: 0 0 30px rgba(255,255,255,0.4), 0 0 10px rgba(255,255,255,0.2);
    margin-bottom: 0.2rem;
}

h2 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--accent-red);
    margin-bottom: 0.5rem;
    margin-top: 1.5rem;
}

.subtitle {
    font-size: 1.25rem;
    color: var(--text-primary);
    font-weight: 400;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(255,255,255,0.1);
}

/* Layout */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), 
                transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), 
                visibility 0.6s;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.screen.hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    pointer-events: none;
}

/* Header */
header {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto 50px auto;
    padding-bottom: 50px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.header-text {
    display: flex;
    flex-direction: column;
}

/* Buttons */
button {
    cursor: pointer;
    font-family: inherit;
    border: none;
    background: none;
    outline: none;
}

.icon-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    transition: all 0.3s ease;
}

.icon-btn:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
    background: rgba(255,255,255,0.1);
}

.close-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    padding: 0.5rem;
    border-radius: 50%;
}

.primary-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background-color: var(--accent-red);
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 1rem 2rem;
    border-radius: 8px;
    width: 100%;
    margin-top: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px var(--accent-red-glow);
}

.primary-btn:hover {
    background-color: var(--accent-red-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(163, 0, 0, 0.5);
}

.primary-btn:active {
    transform: translateY(0);
}

/* Setup Container */
.setup-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: flex-start; /* align items to top */
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

@media (max-width: 768px) {
    .setup-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

.instructions p {
    color: var(--text-primary);
    font-size: 1.15rem;
    font-weight: 400;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    margin-bottom: 2rem;
}

.science-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: fit-content;
}

/* Forms & Inputs */
.glass-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 2.5rem;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 8px 32px rgba(255, 255, 255, 0.05), inset 0 0 0 1px rgba(255, 255, 255, 0.05); /* subtle lift */
}

.input-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.5rem;
}

.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.slider-group {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.number-input {
    width: 90px;
    padding: 0.5rem;
    text-align: right;
}

.range-slider {
    width: 100%;
    cursor: pointer;
    accent-color: var(--accent-red);
}

label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

input, textarea {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 1rem;
    transition: all 0.3s ease;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-red);
    box-shadow: 0 0 0 2px var(--accent-red-glow);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

/* Modal */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(5px);
    transition: opacity 0.3s ease, visibility 0.3s;
    opacity: 1;
    visibility: visible;
}

.modal-backdrop.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.modal {
    position: relative;
    max-width: 600px;
    width: 90%;
    transform: translateY(0);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-backdrop.hidden .modal {
    transform: translateY(20px);
}

.highlight-red {
    color: var(--accent-red);
    font-weight: 700;
}

.modal-content p {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Reading Screen */
#reading-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--bg-color); /* fully black for focus */
    position: fixed; /* tightly lock the viewport for mobile */
    overflow: hidden;
    z-index: 10;
}

.reading-container {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
}

.rsvp-display {
    font-size: 4rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    position: relative;
    height: 120px;
}

/* The RSVP centering trick */
.rsvp-left {
    text-align: right;
    flex: 1;
    color: var(--text-primary);
}

.rsvp-center {
    color: var(--accent-red);
    font-weight: 600;
}

.rsvp-right {
    text-align: left;
    flex: 1;
    color: var(--text-primary);
}

.controls {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background: var(--glass-border);
    overflow: hidden;
}

.screen-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: var(--accent-red);
    transition: width 0.1s linear;
}

#current-wpm-display {
    color: var(--text-secondary);
    font-size: 0.9rem;
    letter-spacing: 0.1em;
}

/* Teacher's Corner */
.teachers-corner {
    margin-bottom: 1.5rem;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    overflow: hidden;
}

.block-btn {
    width: 100%;
    justify-content: flex-start;
    border-radius: 0;
    border: none;
    background: rgba(255, 255, 255, 0.05);
}

.tc-header {
    width: 100%;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-primary);
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: background 0.3s ease;
}

.tc-header:hover {
    background: rgba(255, 255, 255, 0.1);
}

.tc-header svg {
    transition: transform 0.3s ease;
}

.teachers-corner.active .tc-header svg {
    transform: rotate(180deg);
}

.tc-content {
    background: rgba(0, 0, 0, 0.3);
    padding: 0 1.5rem;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s ease-in-out;
}

.teachers-corner.active .tc-content {
    padding: 1.5rem;
    border-top: 1px solid var(--glass-border);
    max-height: 600px;
    opacity: 1;
}

.small-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.question-block {
    margin-bottom: 1rem;
}

.question-block:last-child {
    margin-bottom: 0;
}

/* Recap Screen */
#recap-screen {
    background-color: var(--bg-color);
    align-items: center;
    overflow-y: auto;
}

.recap-container {
    max-width: 800px;
    width: 100%;
    margin: 2rem auto;
}

.report-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

.chart-container {
    margin-bottom: 3rem;
    padding: 2rem;
    background: rgba(255,255,255,0.02);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.timeline-chart {
    position: relative;
    height: 40px;
    margin-top: 2rem;
    margin-bottom: 1rem;
    width: 100%;
}

.timeline-line {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(to right, #4CAF50, var(--accent-red));
    border-radius: 2px;
    transform: translateY(-50%);
}

.timeline-marker {
    position: absolute;
    top: 50%;
    width: 12px;
    height: 12px;
    background-color: #ffa500;
    border: 2px solid var(--bg-color);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.timeline-marker::after {
    content: "X";
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    color: #ffa500;
    font-weight: bold;
}

.quiz-section {
    margin-bottom: 3rem;
    background: rgba(255,255,255,0.02);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.quiz-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.quiz-item p {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.recap-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.print-btn {
    width: 100%;
    justify-content: center;
}

/* Print Styles */
@media print {
    body {
        background-color: white !important;
        color: black !important;
    }
    
    .screen {
        position: relative;
        min-height: auto;
    }
    
    .no-print, header, .glass-panel {
        display: none !important;
        box-shadow: none !important;
        border: none !important;
        background: transparent !important;
    }
    
    .print-friendly {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
    
    .report-card {
        display: block !important;
        background: white !important;
        color: black !important;
        border: 2px solid #ccc !important;
        padding: 2rem !important;
    }
    
    h2, h3, .stat-value {
        color: black !important;
    }
    
    .stat-card {
        border-color: #ccc !important;
    }
    
    .highlight-red {
        color: #8B0000 !important;
    }
}

/* Mobile & Tablet Optimizations */
@media (max-width: 768px) {
    h1 {
        font-size: 2.2rem;
    }

    h2 {
        font-size: 1.4rem;
    }

    .screen {
        padding: 1rem;
    }

    header {
        margin-bottom: 2rem;
        padding-bottom: 1rem;
    }

    .glass-panel {
        padding: 1.5rem;
    }

    .input-row {
        grid-template-columns: 1fr;
    }

    .rsvp-display {
        font-size: 2.5rem;
        height: 80px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }
}
