body {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    font-family: 'Open Sans', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    padding: 40px 20px;
    color: #2c3e50;
}

.toolbar {
    margin-bottom: 30px;
    position: sticky;
    top: 20px;
    z-index: 100;
}

#download-btn {
    padding: 12px 28px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    background-color: #2ecc71;
    color: white;
    border: none;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-family: 'Montserrat', sans-serif;
}

#download-btn:hover {
    background-color: #27ae60;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46, 204, 113, 0.4);
}

#download-btn:active {
    transform: translateY(0);
}

.page-container {
    background-color: white;
    width: 240mm;
    min-height: 297mm;
    padding: 25mm 30mm;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
    border-radius: 12px;
}

header h1 {
    font-family: 'Montserrat', sans-serif;
    text-align: center;
    color: #1a1a1a;
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 40px;
    position: relative;
    padding-bottom: 15px;
}

header h1::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: #3498db;
    border-radius: 2px;
}

h2 {
    font-family: 'Montserrat', sans-serif;
    color: #2c3e50;
    margin-top: 0;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
}

ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

li {
    margin-bottom: 12px;
    line-height: 1.6;
    font-size: 15px;
}

.phrase-with-speech {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 8px;
    background-color: rgba(0,0,0,0.03);
    border: 1px solid transparent;
}

.phrase-with-speech:hover {
    background-color: #fff;
    border-color: #3498db;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.15);
    color: #3498db;
    transform: translateX(5px);
}

.phrase-with-speech::after {
    content: '🔊';
    font-size: 14px;
    opacity: 0.4;
    transition: all 0.2s;
}

.phrase-with-speech:hover::after {
    opacity: 1;
    transform: scale(1.2);
}

.phrase-with-speech.playing {
    background-color: #3498db;
    color: white;
}

.phrase-with-speech.playing::after {
    content: '🎵';
    opacity: 1;
    filter: brightness(0) invert(1);
}

.phrase-with-speech.loading::after {
    content: '⏳';
    opacity: 1;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 0.5; }
}

section {
    margin-bottom: 40px;
    padding: 30px;
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 40px;
    border: 1px solid rgba(0,0,0,0.05);
}

.section-content {
    flex: 1.2;
}

.section-image {
    flex: 0.8;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-image img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.section-image img:hover {
    transform: scale(1.03);
}

.section-wait { background-color: #f0f9ff; border-left: 6px solid #3498db; }
.section-okay { background-color: #f0fff4; border-left: 6px solid #2ecc71; }
.section-greeting { background-color: #fffaf0; border-left: 6px solid #f39c12; }
.section-agreement { background-color: #fdf2f8; border-left: 6px solid #9b59b6; }
.section-goodbye { background-color: #fff5f5; border-left: 6px solid #e74c3c; }

.section-dialogues { 
    background-color: #f8fafc; 
    display: block; 
    border-left: 6px solid #64748b;
}

.section-exercise { 
    background-color: #faf5ff; 
    display: block; 
    border-left: 6px solid #8b5cf6;
}

.section-dialogues h3, .section-exercise h3 {
    font-family: 'Montserrat', sans-serif;
    margin-top: 30px;
    margin-bottom: 20px;
    color: #1e293b;
    font-size: 18px;
    font-weight: 700;
}

.dialogue, .exercise-item {
    margin-bottom: 15px;
    padding: 20px;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    border: 1px solid #edf2f7;
}

.dialogue p, .exercise-item p {
    margin: 6px 0;
    line-height: 1.6;
}

.dialogue p strong {
    color: #3498db;
}

.section-exercise .instructions {
    margin-bottom: 30px;
    padding: 20px;
    background-color: #fff;
    border: 2px dashed #d8b4fe;
    border-radius: 12px;
    font-size: 15px;
    color: #5b21b6;
    line-height: 1.6;
}

.answer-key {
    margin-top: 50px;
    padding: 30px;
    background-color: #1e293b;
    color: #f8fafc;
    border-radius: 16px;
    font-family: 'Special Elite', monospace;
}

.answer-key h3 {
    color: #38bdf8;
    margin-top: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 10px;
}

.answer-key ol {
    padding-left: 20px;
}

.answer-key li {
    margin-bottom: 8px;
    color: #e2e8f0;
    opacity: 0.9;
}

@media print {
    body {
        background: white;
        padding: 0;
    }
    .toolbar {
        display: none;
    }
    .page-container {
        box-shadow: none;
        width: 100%;
        padding: 0;
        margin: 0;
    }
    section {
        break-inside: avoid;
        page-break-inside: avoid;
        margin-bottom: 20px;
    }
    .phrase-with-speech {
        background: none !important;
        border: none !important;
        padding-left: 0;
    }
    .phrase-with-speech::after {
        display: none;
    }
    .answer-key {
        background: #f1f5f9 !important;
        color: #1e293b !important;
        border: 1px solid #cbd5e1;
    }
    .answer-key h3 {
        color: #1e293b !important;
    }
    .answer-key li {
        color: #1e293b !important;
    }
}


@media (max-width: 850px) {
    body {
        padding: 10px;
    }
    .page-container {
        width: 100%;
        min-height: auto;
        padding: 20px;
        height: auto;
    }
}

@media (max-width: 600px) {
    section {
        flex-direction: column-reverse;
    }
}