/* ...extracted CSS from original HTML <style> block ... */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', 'Noto Sans JP', sans-serif;
    /* Updated: earth / fresh gradient (ocean blues -> seafoam -> soft green) */
    background: linear-gradient(135deg, #2b5876 0%, #7db9b6 50%, #c7e9b0 100%);
    color: #1a4a47;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    width: 100%;
    height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.slide {
    width: 100%;
    max-width: 1400px;
    height: 90vh;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    display: none;
    flex-direction: column;
    padding: 30px;
    /* allow the slide content to scroll when it overflows */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: fadeIn 0.8s ease-in-out;
}

.slide.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.title-slide {
    justify-content: center;
    align-items: center;
    text-align: center;
}

.title-slide h1 {
    font-size: 4rem;
    margin-bottom: 20px;
    color: #ffffff;
    text-shadow: 3px 3px 8px rgba(0, 0, 0, 0.8), 0 0 15px rgba(0, 0, 0, 0.5);
    animation: pulse 2s infinite;
}

.title-slide h2 {
    font-size: 2rem;
    margin-bottom: 40px;
    color: #ffffff;
    text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.7);
    opacity: 0.95;
}

.title-slide .japanese {
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 1.5rem;
    margin-top: 20px;
    color: #ffffff;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.6);
    opacity: 0.9;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.start-button {
    /* Updated: fresh green/teal gradient */
    background: linear-gradient(45deg, #2ecc71, #16a085);
    border: none;
    color: white;
    padding: 15px 40px;
    font-size: 1.5rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(22, 160, 133, 0.18);
    margin-top: 30px;
}

.start-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(22, 160, 133, 0.22);
}

.question-slide {
    justify-content: space-between;
}

.question-header {
    text-align: center;
    margin-bottom: 20px;
}

.question-number {
    font-size: 1.2rem;
    color: #2c5f5c;
    font-weight: 600;
    margin-bottom: 10px;
}

.question-title {
    font-size: 2.5rem;
    margin-bottom: 15px;
    line-height: 1.2;
    color: #1a4a47;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.3);
}

.japanese-hint {
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 1.2rem;
    color: #2c5f5c;
    font-weight: 500;
}

.content-area {
    display: flex;
    flex-grow: 1;
    gap: 30px;
}

.question-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.image-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.05);
    position: relative;
}

.image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 15px;
    transition: transform 0.5s ease;
}

.image-container:hover img {
    transform: scale(1.05);
}

.resize-handle {
    position: absolute;
    left: -5px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 40px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 5px;
    cursor: ew-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
    user-select: none;
}

.image-container:hover .resize-handle {
    opacity: 1;
}

.resize-handle:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.resize-handle::before {
    content: "↔";
    color: rgba(0, 0, 0, 0.7);
    font-weight: bold;
}

/* Vertical resize handle */
.resize-handle-vertical {
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 10px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 5px;
    cursor: ns-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
    user-select: none;
}

.image-container:hover .resize-handle-vertical {
    opacity: 1;
}

.resize-handle-vertical:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateX(-50%) scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.resize-handle-vertical::before {
    content: "↕";
    color: rgba(0, 0, 0, 0.7);
    font-weight: bold;
}

/* Explanation highlighting styles */
.highlight-number {
    background: linear-gradient(45deg, #FFD700, #FFA500);
    color: #000;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    display: inline-block;
    box-shadow: 0 2px 4px rgba(255, 215, 0, 0.3);
}

.highlight-percentage {
    background: linear-gradient(45deg, #32CD32, #90EE90);
    color: #000;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    display: inline-block;
    box-shadow: 0 2px 4px rgba(50, 205, 50, 0.3);
}

.highlight-term {
    background: linear-gradient(45deg, #FF6B6B, #FF8E8E);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    display: inline-block;
    box-shadow: 0 2px 4px rgba(255, 107, 107, 0.3);
}

.highlight-superlative {
    background: linear-gradient(45deg, #9B59B6, #BB59B6);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    display: inline-block;
    box-shadow: 0 2px 4px rgba(155, 89, 182, 0.3);
}

/* Animation effects */
.animated-highlight {
    animation: slideInFromLeft 0.5s ease-out;
}

.pulse-highlight {
    animation: pulseGlow 2s infinite;
}

.glow-highlight {
    animation: glowEffect 1.5s ease-in-out infinite alternate;
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 2px 4px rgba(255, 107, 107, 0.3);
    }
    50% {
        box-shadow: 0 4px 12px rgba(255, 107, 107, 0.6), 0 0 8px rgba(255, 107, 107, 0.4);
        transform: scale(1.05);
    }
}

@keyframes glowEffect {
    from {
        box-shadow: 0 2px 4px rgba(155, 89, 182, 0.3);
    }
    to {
        box-shadow: 0 4px 16px rgba(155, 89, 182, 0.7), 0 0 12px rgba(155, 89, 182, 0.5);
        transform: scale(1.02);
    }
}

/* Question 9 Lake Images Grid */
.image-grid-container {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 15px;
    padding: 10px;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.05);
}

.lake-image-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.lake-image-item:hover {
    transform: scale(1.05);
    z-index: 2;
}

.lake-image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 120px;
}

.lake-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.lake-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    padding: 15px 10px 10px;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    border-radius: 0 0 10px 10px;
}

.country-label {
    font-size: 0.75rem;
    opacity: 0.9;
    font-weight: 400;
}

/* Highlight correct lake when answer is revealed */
.lake-image-item.correct-answer {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(46, 204, 113, 0.6);
    border: 3px solid #2ecc71;
}

.lake-image-item.correct-answer .lake-label {
    background: linear-gradient(transparent, rgba(46, 204, 113, 0.9));
}

/* Vocabulary Study Mode Styles */
.vocabulary-slide {
    justify-content: flex-start;
    padding: 20px;
    overflow-y: auto;
}

.vocabulary-slide h1 {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 10px;
    color: #ffffff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.vocabulary-slide h2 {
    font-size: 1.3rem;
    text-align: center;
    margin-bottom: 10px;
    color: #ffffff;
    opacity: 0.9;
}

.vocabulary-slide .japanese {
    text-align: center;
    font-size: 1.1rem;
    margin-bottom: 30px;
    color: #ffffff;
    opacity: 0.8;
}

.vocabulary-game-area {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.vocabulary-instructions {
    text-align: center;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 15px;
}

.vocabulary-instructions p {
    color: #ffffff;
    font-size: 1.1rem;
    margin: 5px 0;
}

.japanese-instruction {
    font-family: 'Noto Sans JP', sans-serif;
    opacity: 0.8;
}

.vocabulary-content {
    display: grid;
    grid-template-columns: 1fr 200px 1fr;
    gap: 20px;
    margin-bottom: 30px;
    min-height: 500px;
}

.english-words-column, .japanese-words-column {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
}

.english-words-column h3, .japanese-words-column h3 {
    text-align: center;
    color: #ffffff;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.word-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.word-card {
    background: rgba(0, 0, 0, 0.55); /* darker background for contrast */
    border: 2px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 12px 16px;
    color: #ffffff;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.22s ease;
    text-align: center;
    user-select: none;
}

.word-card:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.word-card.selected {
    background: linear-gradient(45deg, #3498db, #2980b9);
    border-color: #2980b9;
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.word-card.matched {
    background: linear-gradient(45deg, #2ecc71, #27ae60);
    border-color: #27ae60;
    cursor: default;
    animation: matchSuccess 0.6s ease;
}

.word-card.error {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    border-color: #c0392b;
    animation: errorShake 0.5s ease;
}

.japanese-word {
    font-family: 'Noto Sans JP', sans-serif;
}

/* Furigana / ruby styling for Japanese words */
.japanese-word ruby {
    ruby-position: over; /* modern browsers will show rt above */
}

.japanese-word rt {
    font-size: 0.6rem; /* smaller furigana */
    line-height: 1;
    color: #FFFBF0; /* high-contrast off-white */
    display: inline-block;
    margin-left: 4px;
    margin-right: 4px;
}

.japanese-word rb {
    font-size: 1.2rem; /* main kanji/kana size */
    color: #FFFDF5; /* slightly warmer off-white for high contrast */
    font-weight: 800;
}

/* Ensure ruby text wraps nicely and has enough spacing */
.japanese-word {
    padding-top: 6px; /* provide spacing so rt doesn't overlap */
}

.connection-area {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

#connectionSvg {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 1;
}

.connection-line {
    stroke: #3498db;
    stroke-width: 3;
    fill: none;
    opacity: 0.8;
}

.connection-line.matched {
    stroke: #2ecc71;
    stroke-width: 4;
    animation: connectionPulse 2s infinite;
}

.vocabulary-progress {
    text-align: center;
    margin-bottom: 20px;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(45deg, #2ecc71, #27ae60);
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 10px;
}

#progressText {
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 600;
}

.vocabulary-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.vocab-button {
    background: linear-gradient(45deg, #9b59b6, #8e44ad);
    border: none;
    color: white;
    padding: 12px 24px;
    font-size: 1rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.vocab-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(155, 89, 182, 0.3);
}

#proceedButton {
    background: linear-gradient(45deg, #2ecc71, #27ae60);
    font-size: 1.2rem;
    padding: 15px 30px;
    animation: pulseGlow 2s infinite;
}

/* Animations */
@keyframes matchSuccess {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1.05); }
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes connectionPulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; stroke-width: 5; }
}

/* Responsive design for vocabulary */
@media (max-width: 1000px) {
    .vocabulary-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .connection-area {
        display: none;
    }
}

.options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 20px;
}

.option {
    background: rgba(255, 255, 255, 0.25);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 15px;
    padding: 15px;
    font-size: 1.2rem;
    color: #1a4a47;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 80px;
}

.option:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(11, 78, 69, 0.25);
    color: #0d3330;
}

.option.correct {
    /* Softer positive green */
    background: rgba(46, 204, 113, 0.85);
    border-color: #27ae60;
    animation: correctPulse 0.6s ease;
}

.option.incorrect {
    /* Slightly muted red for contrast */
    background: rgba(231, 76, 60, 0.85);
    border-color: #c0392b;
    animation: shake 0.5s ease;
}

@keyframes correctPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.explanation-container {
    display: none;
    margin-top: 20px;
    flex-direction: column;
    gap: 20px;
}

.explanation-container.active {
    display: flex;
    animation: fadeIn 0.8s ease-in-out;
}

.explanation {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 20px;
    font-size: 1.1rem;
    line-height: 1.6;
    color: #1a4a47;
    font-weight: 500;
}

.chart-container {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    height: 300px;
    position: relative;
}

.next-button {
    /* Updated: teal -> green gradient to feel fresh and consistent */
    background: linear-gradient(45deg, #16a085, #2ecc71);
    border: none;
    color: white;
    padding: 12px 30px;
    font-size: 1.2rem;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
    align-self: center;
    display: none;
    opacity: 0;
    transform: translateY(20px);
}

.next-button.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
    animation: slideUp 0.5s ease forwards;
}

@keyframes slideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.next-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(22, 160, 133, 0.18);
}

.score-display {
    position: absolute;
    top: 20px;
    right: 20px;
    /* Updated: subtle dark-green translucent panel to match earth tones */
    background: rgba(7, 52, 44, 0.7);
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 1.2rem;
    color: #ffffff;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.final-slide {
    justify-content: center;
    align-items: center;
    text-align: center;
}

.final-slide h1 {
    font-size: 3rem;
    margin-bottom: 30px;
    color: #ffffff;
    text-shadow: 3px 3px 8px rgba(0, 0, 0, 0.8);
}

.final-score {
    font-size: 5rem;
    margin: 20px 0;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.final-message {
    font-size: 1.5rem;
    margin-bottom: 40px;
    max-width: 800px;
    line-height: 1.6;
    color: #ffffff;
    text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.7);
    font-weight: 500;
}

.restart-button {
    /* Updated: earthy olive to fresh green gradient */
    background: linear-gradient(45deg, #6A994E, #A7C957);
    border: none;
    color: white;
    padding: 15px 40px;
    font-size: 1.5rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(106, 153, 78, 0.18);
}

.restart-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 26px rgba(106, 153, 78, 0.22);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .content-area {
        flex-direction: column;
    }

    .image-container {
        height: 300px;
    }

    .question-title {
        font-size: 2rem;
    }
}
