/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f7fa;
}

/* Screen Management */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* Home Screen */
.home-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.home-header {
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 20px;
    border-radius: 12px;
    margin-bottom: 30px;
}

.home-header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.2em;
    margin-bottom: 5px;
    opacity: 0.95;
}

.audience {
    font-size: 1em;
    opacity: 0.9;
}

/* Version Choice */
.version-choice {
    background: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.version-choice h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #667eea;
}

.version-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 15px;
}

.version-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px 20px;
    border: 3px solid #e0e0e0;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1em;
}

.version-btn:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.version-icon {
    font-size: 3em;
    margin-bottom: 10px;
}

.version-label {
    font-weight: bold;
    font-size: 1.3em;
    margin-bottom: 5px;
    color: #333;
}

.version-desc {
    font-size: 0.9em;
    color: #666;
}

.version-note {
    text-align: center;
    color: #666;
    font-size: 0.9em;
}

/* Course Map */
.course-map {
    background: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.course-map h2 {
    margin-bottom: 20px;
    color: #667eea;
}

.course-map-list {
    display: grid;
    gap: 10px;
}

.course-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #fafafa;
    transition: all 0.2s ease;
}

.course-item:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.course-item.completed {
    border-color: #4caf50;
    background: #f1f8f4;
}

.course-item-check {
    font-size: 1.5em;
    margin-right: 15px;
    width: 30px;
    text-align: center;
}

.course-item-info {
    flex: 1;
}

.course-item-title {
    font-weight: bold;
    font-size: 1.1em;
    color: #333;
}

.course-item-desc {
    font-size: 0.9em;
    color: #666;
}

/* Resources */
.resources {
    background: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.resources h2 {
    margin-bottom: 20px;
    color: #667eea;
}

.resource-btn {
    display: block;
    width: 100%;
    padding: 15px;
    margin-bottom: 10px;
    border: 2px solid #667eea;
    border-radius: 8px;
    background: white;
    color: #667eea;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.resource-btn:hover {
    background: #667eea;
    color: white;
}

/* Disclaimer */
.disclaimer {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 0.85em;
    line-height: 1.5;
}

.copyright {
    margin-top: 10px;
    font-size: 0.9em;
}

/* PC Layout */
.pc-layout {
    display: none;
    grid-template-columns: 300px 1fr;
    height: 100vh;
}

.pc-layout.active {
    display: grid;
}

.pc-sidebar {
    background: #2c3e50;
    color: white;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    background: #1a252f;
    border-bottom: 1px solid #34495e;
}

.sidebar-header h2 {
    margin-bottom: 10px;
    font-size: 1.3em;
}

.back-btn {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 6px;
    background: #667eea;
    color: white;
    cursor: pointer;
    font-size: 0.95em;
    transition: background 0.2s ease;
}

.back-btn:hover {
    background: #5568d3;
}

.sidebar-nav {
    flex: 1;
    padding: 10px;
    overflow-y: auto;
}

.nav-item {
    margin-bottom: 5px;
}

.nav-btn {
    width: 100%;
    padding: 12px 15px;
    border: none;
    border-radius: 6px;
    background: #34495e;
    color: white;
    text-align: left;
    cursor: pointer;
    font-size: 0.95em;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.nav-btn:hover {
    background: #3d566e;
}

.nav-btn.active {
    background: #667eea;
}

.nav-btn.completed::before {
    content: '✓ ';
    margin-right: 5px;
    color: #4caf50;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid #34495e;
}

.teacher-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.9em;
}

.teacher-toggle input {
    margin-right: 8px;
    cursor: pointer;
}

.pc-content {
    background: white;
    overflow-y: auto;
    padding: 40px;
}

/* Phone Layout */
.phone-layout {
    display: none;
    flex-direction: column;
    height: 100vh;
}

.phone-layout.active {
    display: flex;
}

.phone-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: #667eea;
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.phone-title {
    font-size: 1.2em;
    flex: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.icon-btn {
    min-width: 44px;
    min-height: 44px;
    border: none;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 1.3em;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:active {
    background: rgba(255,255,255,0.3);
}

.phone-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 85%;
    max-width: 350px;
    height: 100vh;
    background: white;
    box-shadow: 2px 0 8px rgba(0,0,0,0.2);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 200;
    overflow-y: auto;
}

.phone-menu.open {
    transform: translateX(0);
}

.phone-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    background: #667eea;
    color: white;
}

.close-btn {
    min-width: 44px;
    min-height: 44px;
    border: none;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 1.5em;
    border-radius: 6px;
    cursor: pointer;
}

.phone-nav-list {
    padding: 10px;
}

.phone-nav-list .nav-btn {
    margin-bottom: 8px;
    min-height: 48px;
    background: #f5f7fa;
    color: #333;
}

.phone-nav-list .nav-btn:hover {
    background: #e8edf5;
}

.phone-nav-list .nav-btn.active {
    background: #667eea;
    color: white;
}

.phone-menu .teacher-toggle {
    margin: 20px;
    padding: 15px;
    background: #f5f7fa;
    border-radius: 8px;
}

.phone-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 15px;
}

/* Content Sections */
.content-section {
    margin-bottom: 40px;
}

.content-section h2 {
    color: #667eea;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

.content-section h3 {
    color: #555;
    margin-top: 20px;
    margin-bottom: 10px;
}

.warmup-list, .vocab-list, .checklist-list {
    list-style: none;
}

.warmup-list li, .checklist-item {
    padding: 12px;
    margin-bottom: 8px;
    background: #f8f9ff;
    border-left: 4px solid #667eea;
    border-radius: 4px;
}

.vocab-item {
    padding: 12px;
    margin-bottom: 8px;
    background: #f8f9ff;
    border-radius: 4px;
}

.vocab-word {
    font-weight: bold;
    color: #667eea;
}

.vocab-meaning {
    color: #555;
    margin-top: 3px;
}

/* Questions */
.question {
    padding: 15px;
    margin-bottom: 15px;
    background: #fafafa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
}

.question.correct {
    border-color: #4caf50;
    background: #f1f8f4;
}

.question.incorrect {
    border-color: #f44336;
    background: #fef1f0;
}

.question-prompt {
    font-weight: 500;
    margin-bottom: 10px;
    color: #333;
}

.question-options {
    margin: 10px 0;
}

.option-btn, .option-label {
    display: block;
    width: 100%;
    padding: 12px;
    margin-bottom: 8px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    background: white;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1em;
}

.option-btn:hover, .option-label:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.option-btn.selected, .option-label.selected {
    border-color: #667eea;
    background: #e8f0ff;
}

.question-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1em;
}

.question-feedback {
    margin-top: 10px;
    padding: 12px;
    border-radius: 6px;
    font-size: 0.95em;
}

.question-feedback.correct {
    background: #e8f5e9;
    color: #2e7d32;
}

.question-feedback.incorrect {
    background: #ffebee;
    color: #c62828;
}

.explanation {
    margin-top: 8px;
    font-style: italic;
    color: #555;
}

/* Audio Player */
.audio-player {
    padding: 20px;
    margin: 20px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
}

.audio-player h3 {
    color: white;
    margin-bottom: 15px;
}

.audio-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.play-btn {
    min-width: 60px;
    min-height: 60px;
    border: none;
    border-radius: 50%;
    background: white;
    color: #667eea;
    font-size: 1.8em;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.audio-time {
    flex: 1;
    text-align: center;
    font-size: 1.1em;
}

.audio-progress {
    width: 100%;
    height: 8px;
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
}

.audio-progress-bar {
    height: 100%;
    background: white;
    border-radius: 4px;
    transition: width 0.1s linear;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    background: #667eea;
    color: white;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 10px;
    margin-bottom: 10px;
}

.btn:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #95a5a6;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-success {
    background: #4caf50;
}

.btn-success:hover {
    background: #43a047;
}

/* Writing Section */
.writing-textarea {
    width: 100%;
    min-height: 300px;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
}

.word-count {
    text-align: right;
    color: #666;
    font-size: 0.9em;
    margin-top: 5px;
}

.chart-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.chart-table th, .chart-table td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

.chart-table th {
    background: #667eea;
    color: white;
}

.chart-table caption {
    caption-side: top;
    padding: 10px;
    font-weight: bold;
    color: #333;
}

/* Transcript */
.transcript {
    padding: 20px;
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-top: 15px;
}

.transcript-segment {
    margin-bottom: 15px;
}

.transcript-speaker {
    font-weight: bold;
    color: #667eea;
    margin-bottom: 5px;
}

.transcript-text {
    color: #333;
    line-height: 1.6;
}

/* Model Answer */
.model-answer {
    padding: 20px;
    background: #e8f5e9;
    border: 2px solid #4caf50;
    border-radius: 8px;
    margin-top: 15px;
}

.model-answer h4 {
    color: #2e7d32;
    margin-bottom: 10px;
}

/* Speaking Recorder */
.recorder-section {
    padding: 20px;
    background: #f8f9ff;
    border: 2px solid #667eea;
    border-radius: 8px;
    margin: 20px 0;
}

.recorder-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.record-btn {
    min-width: 60px;
    min-height: 60px;
    border: none;
    border-radius: 50%;
    background: #f44336;
    color: white;
    font-size: 1.5em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.record-btn.recording {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.record-btn:hover {
    transform: scale(1.05);
}

.record-time {
    font-size: 1.2em;
    color: #667eea;
}

/* Checklist */
.checklist-item {
    display: flex;
    align-items: center;
}

.checklist-checkbox {
    min-width: 20px;
    min-height: 20px;
    margin-right: 10px;
    cursor: pointer;
}

/* Practice Score */
.practice-score {
    padding: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    text-align: center;
    margin: 30px 0;
}

.practice-score h3 {
    color: white;
    font-size: 2em;
    margin-bottom: 10px;
}

.practice-score-value {
    font-size: 3em;
    font-weight: bold;
    margin: 20px 0;
}

.practice-score-note {
    font-size: 0.95em;
    opacity: 0.9;
    margin-top: 15px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-body h3 {
    color: #667eea;
    margin-top: 20px;
    margin-bottom: 10px;
}

.modal-body ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.modal-body li {
    margin-bottom: 8px;
    line-height: 1.6;
}

/* Skill Tabs (Phone) */
.skill-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    background: #f5f7fa;
    padding: 5px;
    border-radius: 8px;
    overflow-x: auto;
}

.skill-tab {
    flex: 1;
    min-width: 80px;
    min-height: 48px;
    border: none;
    border-radius: 6px;
    background: white;
    color: #667eea;
    font-size: 0.95em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.skill-tab.active {
    background: #667eea;
    color: white;
}

.skill-content {
    display: none;
}

.skill-content.active {
    display: block;
}

/* Reading Passage */
.reading-passage {
    padding: 20px;
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 20px;
    line-height: 1.8;
}

.reading-passage p {
    margin-bottom: 15px;
}

/* Responsive */
@media (max-width: 768px) {
    .version-buttons {
        grid-template-columns: 1fr;
    }
    
    .home-header h1 {
        font-size: 2em;
    }
    
    .pc-layout {
        grid-template-columns: 250px 1fr;
    }
    
    .pc-content {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .home-header h1 {
        font-size: 1.7em;
    }
    
    .version-icon {
        font-size: 2.5em;
    }
    
    .version-label {
        font-size: 1.1em;
    }
}

/* Teacher Mode Styles */
.teacher-mode .answer-shown {
    background: #fff9e6;
    border: 2px solid #ffc107;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}


.site-copyright,
.phone-copyright-bar,
.modal-copyright {
    margin-top: 12px;
    font-size: 0.78em;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.75);
}

.modal-copyright,
.disclaimer .copyright,
.disclaimer .site-copyright {
    color: #555;
}

.phone-copyright-bar {
    margin-top: 0;
    padding: 8px 16px 12px;
    text-align: center;
    background: #1a252f;
    color: rgba(255, 255, 255, 0.8);
    flex-shrink: 0;
}

/* Printable workbook download chip */
#download-book{position:fixed;top:8px;right:8px;z-index:200;background:#ffd23f;color:#222;font-weight:bold;padding:10px 14px;border-radius:22px;text-decoration:none;box-shadow:0 2px 6px #0003;min-height:44px;display:flex;align-items:center;font-size:15px}
@media print{#download-book{display:none}}
body.phone-ui #download-book{top:64px;right:8px}

/* Practice test refinements */
button, input, textarea { font: inherit; }
button { min-height: 44px; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid #d07800; outline-offset: 3px; }
button:disabled { opacity: .65; cursor: not-allowed; }
.home-container { padding-top: 76px; }
.pc-content { padding-top: 76px; }
.sidebar-header h2 { font-size: 1.25rem; line-height: 1.4; }
.timer-panel { margin: 24px 0; padding: 16px; background: #eef5ff; border-radius: 10px; }
.timer-panel p { margin-bottom: 10px; }
.question-input { max-width: 100%; }
@media (max-width: 767px) { .phone-topbar { height: 64px; } .phone-title { font-size: .9rem; line-height: 1.2; } .phone-content { padding-top: 68px; } #download-book { font-size: 13px; padding: 8px 12px; } .home-container { padding-top: 75px; } }

.phone-topbar { flex-shrink: 0; }
.phone-title { min-width: 0; }
body.phone-ui .phone-content { padding-top: 68px; }
.course-item[role=button] { cursor: pointer; }
.course-item[role=button]:focus-visible { outline: 3px solid #d07800; }
