body {
    font-family: 'Press Start 2P', cursive;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    margin: 0;
    padding: 2rem;
    background: #3a2a1a;
    background-image:
        linear-gradient(rgba(255,255,255,.05) 2px, transparent 2px),
        linear-gradient(90deg, rgba(255,255,255,.05) 2px, transparent 2px),
        linear-gradient(rgba(0,0,0,.4) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,.4) 1px, transparent 1px),
        linear-gradient(to bottom, #4e342e, #6d4c41 80%);
    background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px, 100% 100%;
    box-sizing: border-box;
}

.main-container {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    width: 100%;
    max-width: 1200px;
    justify-content: center;
    align-items: flex-start;
}

.machine-body {
    background: #3e2723;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 
        inset 0 0 15px rgba(0,0,0,0.7), 
        0 10px 20px rgba(0,0,0,0.5),
        0 0 0 10px #211512;
    border: 5px solid #1b100e;
    flex: 1 1 450px;
    max-width: 500px;
}

h1 {
    font-family: 'Bungee', cursive;
    color: #ffe0b2;
    margin: 0 0 2rem 0;
    text-align: center;
    font-size: 3rem;
    letter-spacing: 2px;
    text-shadow: 
        0 0 5px #fff,
        0 0 10px #ffc107,
        0 0 20px #ff9800,
        0 0 30px #ff5722,
        -2px -2px 5px rgba(0,0,0,0.8);
}

#controls-panel {
    background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
    border-radius: 10px;
    padding: 1.5rem;
    border: 3px solid #111;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.8);
}

#controls {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    width: 100%;
}

.sound-btn, #stop-btn {
    padding: 1rem;
    font-size: 0.8rem;
    cursor: pointer;
    border: 2px solid #111;
    border-radius: 8px;
    background-color: #e0e0e0;
    color: #333;
    transition: all 0.1s ease-in-out;
    box-shadow: 0 4px 0 #9e9e9e, 0 5px 5px rgba(0,0,0,0.4);
    text-transform: uppercase;
    font-family: 'Press Start 2P', cursive;
    text-align: center;
}

.sound-btn:hover {
    background-color: #f5f5f5;
}

.sound-btn:active, .sound-btn.active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #9e9e9e, 0 3px 3px rgba(0,0,0,0.5);
}

.sound-btn.active {
    background-color: #ffd54f;
    color: #3e2723;
    box-shadow: 0 2px 0 #c7a53d, inset 0 0 5px rgba(0,0,0,0.3);
}

.sound-btn .emoji {
    display: none;
}

#stop-btn {
    grid-column: 1 / -1;
    background-color: #d32f2f;
    color: white;
    box-shadow: 0 4px 0 #9a0007, 0 5px 5px rgba(0,0,0,0.4);
    margin-top: 1rem;
}

#stop-btn:hover {
    background-color: #f44336;
}

#stop-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #9a0007, 0 3px 3px rgba(0,0,0,0.5);
}

#vocabulary-panel {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #1a1a1a;
    border-radius: 8px;
    border: 2px solid #111;
    box-shadow: inset 0 0 8px rgba(0,0,0,0.7);
    color: #ffe0b2;
    min-height: 220px;
}

.vocab-box h3 {
    font-size: 0.9rem;
    text-align: center;
    margin: 0 0 1rem 0;
    color: #ffd54f;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.vocab-content {
    display: flex;
    justify-content: space-around;
    gap: 1rem;
}

.vocab-content h4 {
    font-size: 0.8rem;
    margin: 0 0 0.5rem 0;
    border-bottom: 1px solid #4e342e;
    padding-bottom: 0.3rem;
}

.vocab-content ul {
    margin: 0;
    padding-left: 1rem;
    list-style-type: square;
}

.vocab-content li {
    font-size: 0.7rem;
    margin-bottom: 0.3rem;
    font-family: monospace;
    text-transform: lowercase;
}

.hidden {
    display: none;
}

.notebook-container {
    flex: 1 1 500px;
    background: #fffdf6;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    padding: 2rem 2rem 2rem 2rem;
    position: relative;
    border-left: 1px solid #ddd;
    min-width: 300px;
}

.notebook-container.notebook-2 {
    background: #f0f8ff; /* Alice Blue */
}

.notebook-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 4.5rem;
    bottom: 0;
    width: 2px;
    background-color: #ff8a80; /* A soft red */
}

.notebook-container.notebook-2::before {
    background-color: #60a5fa; /* A pleasant blue */
}

.notebook-header h2 {
    font-family: 'Press Start 2P', cursive;
    font-size: 1.1rem;
    color: #444;
    text-shadow: none;
    letter-spacing: 0;
    text-align: left;
    margin: 0 0 0.5rem 2.5rem;
}

.notebook-header p {
    font-family: sans-serif;
    font-size: 0.9rem;
    color: #555;
    line-height: 1.5;
    margin: 0 0 1.5rem 0;
}

.notebook-paper {
    position: relative;
    display: flex;
}

.line-numbers {
    width: 2rem;
    padding-right: 0.5rem;
    text-align: right;
    font-family: 'Homemade Apple', cursive;
    font-size: 1rem;
    line-height: 24px;
    color: #9aadc1;
    user-select: none;
    padding-top: 1px;
    overflow: hidden; /* Hide scrollbar for the numbers div */
}

.notebook-lines {
    flex: 1;
    border: none;
    background-color: transparent;
    background-image: repeating-linear-gradient(to bottom, 
        transparent 0, 
        transparent 23px, 
        #d3e3fd 24px);
    line-height: 24px;
    padding: 0;
    font-family: 'Homemade Apple', cursive;
    font-size: 1.2rem;
    color: #1a237e;
    resize: vertical;
    outline: none;
    min-height: calc(30 * 24px);
}

.notebook-container.notebook-2 .notebook-lines {
    background-image: repeating-linear-gradient(to bottom, 
        transparent 0, 
        transparent 23px, 
        #cce7ff 24px);
    color: #0b2c4d;
}

.notebook-lines:focus {
    outline: none;
}

.pdf-container {
    width: 100%;
    max-width: 1200px;
    margin-top: 2rem;
    background: #fffdf6;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    padding: 2rem;
    box-sizing: border-box;
}

.pdf-container h2 {
    font-family: 'Press Start 2P', cursive;
    font-size: 1.1rem;
    color: #444;
    text-shadow: none;
    letter-spacing: 0;
    text-align: left;
    margin: 0 0 1rem 0;
}

.pdf-container iframe {
    width: 100%;
    height: 800px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

#activities-content {
    font-family: sans-serif;
    color: #333;
    line-height: 1.6;
}

#activities-content h3 {
    font-family: 'Press Start 2P', cursive;
    font-size: 1rem;
    color: #444;
    border-bottom: 2px solid #eee;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

#activities-content p {
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.matching-game {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 2rem;
    padding-left: 1rem;
}

.matching-list {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
}

.matching-list li {
    margin-bottom: 0.5rem;
}

.activity-title {
    margin-top: 2rem;
}

.sentences-list {
    padding-left: 2rem;
}

.sentences-list li {
    margin-bottom: 1rem;
}

.activity-textarea {
    width: 100%;
    padding: 0.5rem;
    font-family: 'Homemade Apple', cursive;
    font-size: 1.1rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    resize: vertical;
    min-height: 120px;
    background-color: #fafafa;
}

.print-content {
    display: none;
}

.print-container {
    width: 100%;
    max-width: 1200px;
    margin-top: 2rem;
    text-align: center;
}

#print-btn {
    padding: 1rem 2rem;
    font-size: 1rem;
    cursor: pointer;
    border: 2px solid #111;
    border-radius: 8px;
    background-color: #4caf50;
    color: white;
    transition: all 0.1s ease-in-out;
    box-shadow: 0 4px 0 #388e3c, 0 5px 5px rgba(0,0,0,0.4);
    text-transform: uppercase;
    font-family: 'Press Start 2P', cursive;
}

#print-btn:hover {
    background-color: #66bb6a;
}

#print-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #388e3c, 0 3px 3px rgba(0,0,0,0.5);
}

@media print {
    body {
        background: none;
        padding: 1cm;
        margin: 0;
        font-family: 'Times New Roman', Times, serif;
    }

    .machine-body, .print-container, .pdf-container {
        display: none;
    }

    .main-container {
        display: block;
        width: 100%;
        max-width: 100%;
        gap: 0;
        box-shadow: none;
    }

    .notebook-container {
        display: block;
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
        page-break-after: always;
        margin-bottom: 1cm;
        padding: 1cm;
        width: auto;
        min-width: unset;
        background: #fff;
    }

    .notebook-container:last-child {
        margin-bottom: 0;
        page-break-after: auto;
    }

    .notebook-header h2 {
        color: #000;
        font-size: 14pt;
        font-family: 'Press Start 2P', cursive;
        margin-left: 0;
        padding-left: 2.5rem;
    }
    
    .notebook-header p {
        color: #000;
        font-size: 10pt;
        font-family: sans-serif;
        margin-left: 0;
        padding-left: 0;
    }
    
    .notebook-container::before {
        left: calc(1cm + 2rem);
    }

    .notebook-lines {
        display: none;
    }

    .print-content {
        display: block;
        white-space: pre-wrap;
        word-wrap: break-word;
        font-family: 'Homemade Apple', cursive;
        font-size: 1.2rem;
        color: #1a237e;
        background-image: repeating-linear-gradient(to bottom, 
            transparent 0, 
            transparent 23px, 
            #d3e3fd 24px);
        line-height: 24px;
        min-height: calc(30 * 24px);
        padding-top: 1px;
    }

    .notebook-container.notebook-2 .print-content {
        background-image: repeating-linear-gradient(to bottom, 
            transparent 0, 
            transparent 23px, 
            #cce7ff 24px);
        color: #0b2c4d;
    }

    .line-numbers {
        color: #999;
    }
}