@font-face {
    font-family: 'Canvas Sans';
    src: local('Canvas Sans'), local('CanvasSans');
    font-weight: normal;
    font-style: normal;
}

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

body {
    margin: 0;
    padding: 0;
    background-color: #000;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Canvas Sans', 'Assistant', 'Heebo', Arial, sans-serif;
    overflow: hidden;
}

/* Main container - 5760x1080 */
#game-container {
    position: relative;
    width: 5760px;
    height: 1080px;
    display: flex;
    flex-direction: row;
    background: #000;
    transform-origin: center center;
}

/* Three panels - each 1920x1080 */
.panel {
    width: 1920px;
    height: 1080px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.left-panel {
    background: transparent;
    position: relative;
    z-index: 0;
}

.left-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('https://drive.google.com/thumbnail?id=1wY9mA-dNhLNCI6o2iDaYGoyE3nkQVt5R&sz=w3000');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.4;
    pointer-events: none;
    z-index: -1;
}

.center-panel {
    background-image: url('https://drive.google.com/thumbnail?id=1wY9mA-dNhLNCI6o2iDaYGoyE3nkQVt5R&sz=w3000');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.right-panel {
    background: transparent;
    position: relative;
    z-index: 0;
}

.right-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('https://drive.google.com/thumbnail?id=1wY9mA-dNhLNCI6o2iDaYGoyE3nkQVt5R&sz=w3000');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.4;
    pointer-events: none;
    z-index: -1;
}

/* Back Button */
.btn-back {
    position: absolute;
    top: 180px;
    left: 15%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    padding: 30px 72px;
    border-radius: 90px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 24px;
    z-index: 1000;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    font-family: 'Canvas Sans', 'Assistant', 'Heebo', Arial, sans-serif;
}

.btn-back:hover {
    background: #ffffff;
    transform: translate(-50%, -50%) scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.btn-back:active {
    transform: translate(-50%, -50%) scale(0.98);
}

.btn-back-icon {
    width: 72px;
    height: 72px;
    color: #333;
}

.btn-back-text {
    font-size: 3.3rem;
    font-weight: 800;
    color: #333;
    letter-spacing: 0.5px;
}

.btn-back:disabled {
    opacity: 1;
    cursor: not-allowed;
    pointer-events: none;
}

/* Loader Styles */
.loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

.loader-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-spinner {
    width: 80px;
    height: 80px;
    border: 8px solid rgba(245, 166, 35, 0.3);
    border-radius: 50%;
    border-top: 8px solid #f5a623;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Frame container - holds all frames */
.frame-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 40px;
    gap: 60px;
}

.frame-container.active {
    display: flex;
}

/* Music decorations - colorful swirls with notes */
.music-decorations {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow: hidden;
}


/* Small floating music notes */
.floating-note {
    position: absolute;
    font-size: 3rem;
    animation: float 3s ease-in-out infinite;
}

.note-1 {
    top: 8%;
    left: 18%;
    color: #e74c3c;
    animation-delay: 0s;
}

.note-2 {
    top: 12%;
    right: 18%;
    color: #3498db;
    animation-delay: 0.5s;
}

.note-3 {
    top: 20%;
    left: 8%;
    color: #f1c40f;
    animation-delay: 1s;
}

.note-4 {
    top: 18%;
    right: 8%;
    color: #2ecc71;
    animation-delay: 1.5s;
}

.note-5 {
    bottom: 8%;
    left: 18%;
    color: #9b59b6;
    animation-delay: 0.3s;
}

.note-6 {
    bottom: 12%;
    right: 18%;
    color: #e67e22;
    animation-delay: 0.8s;
}

.note-7 {
    bottom: 20%;
    left: 8%;
    color: #1abc9c;
    animation-delay: 1.2s;
}

.note-8 {
    bottom: 18%;
    right: 8%;
    color: #e74c3c;
    animation-delay: 1.8s;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-10px) rotate(5deg);
    }
}

/* Frame 1 - Title Screen */
.frame-1 h1 {
    font-size: 6rem;
    font-weight: 900;
    color: white;
    color: white;
    /* margin-bottom: 36px; removed for gap */
    text-shadow: 0 2px 10px rgba(255, 255, 255, 0.3);
}

.frame-1 h2 {
    font-size: 3rem;
    font-weight: 700;
    font-weight: 700;
    color: white;
    /* margin-bottom: 72px; removed for gap */
}

/* Yellow/Orange button style */
.btn-primary {
    background-color: #bfd4af;
    color: #1a3c5a;
    font-family: 'Canvas Sans', 'Assistant', 'Heebo', Arial, sans-serif;
    font-size: 2.4rem;
    font-weight: 800;
    padding: 24px 96px;
    border-radius: 60px;
    border: none;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(191, 212, 175, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 35px rgba(191, 212, 175, 0.5);
}

.btn-primary:active {
    transform: scale(0.98);
}

/* Song Frames (Generic) */
.song-frame h1 {
    font-size: 4.8rem;
    font-weight: 900;
    color: white;
    color: white;
    /* margin-bottom: 48px; removed for gap */
    text-shadow: 0 2px 10px rgba(255, 255, 255, 0.3);
}

.video-lyrics-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 72px;
    width: 90%;
}

.video-wrapper {
    width: 840px;
    height: 473px;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.video-wrapper iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.lyrics-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
}

.lyrics-container p {
    font-size: 2.2rem;
    font-weight: 700;
    color: white;
    margin: 0;
    line-height: 1.5;
    text-align: right;
}

/* Buttons Container - Hidden until video ends */
.buttons-container {
    display: none;
    flex-direction: column;
    gap: 30px;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

.buttons-container.visible {
    display: flex;
}

/* Reset continue button specific positioning */
.btn-continue {
    display: block;
    position: static;
    transform: none;
}

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

.btn-continue:active {
    transform: scale(0.98);
}

.video-wrapper iframe.hidden {
    display: none;
}

/* Frame 3 - Ready Screen */
.ready-frame h2 {
    font-size: 3rem;
    font-weight: 700;
    color: white;
    /* margin-bottom: 24px; removed for gap */
    line-height: 1.5;
}

.ready-frame h1 {
    font-size: 5.4rem;
    font-weight: 900;
    color: white;
    /* margin-bottom: 60px; removed for gap */
}

/* Frame 4 & 9 - Countdown (Generic) */
.countdown-frame {
    background: linear-gradient(135deg, #e8e8e8, #d0d0d0);
}

.countdown-display {
    position: relative;
    width: 600px;
    height: 600px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.countdown-circle {
    position: absolute;
    width: 480px;
    height: 480px;
    border: 10px solid #333;
    border-radius: 50%;
    background: radial-gradient(circle, #fff, #e0e0e0);
}

.countdown-crosshair {
    position: absolute;
    width: 100%;
    height: 100%;
}

.countdown-crosshair::before,
.countdown-crosshair::after {
    content: '';
    position: absolute;
    background: #333;
}

.countdown-crosshair::before {
    top: 50%;
    left: 0;
    right: 0;
    height: 5px;
    transform: translateY(-50%);
}

.countdown-crosshair::after {
    left: 50%;
    top: 0;
    bottom: 0;
    width: 5px;
    transform: translateX(-50%);
}

.countdown-number {
    font-size: 18rem;
    font-weight: 900;
    color: #222;
    z-index: 10;
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);
}

/* Film grain scratches effect */
.film-scratches {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow: hidden;
}

.scratch {
    position: absolute;
    width: 2px;
    background: rgba(0, 0, 0, 0.3);
    animation: scratchMove 0.1s linear infinite;
}

@keyframes scratchMove {

    0%,
    100% {
        opacity: 0;
    }

    50% {
        opacity: 1;
    }
}

/* Frame 5 & 10 - Instructions (Generic) */
.instructions-frame {
    /* Transparent background to show center-panel background */
    background: transparent;
}

.instructions-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 60px;
    width: 100%;
    direction: ltr;
    /* Ensure Left Arrow is on Left side despite global RTL */
    /* margin-top: -150px; Removed to center arrows */
    /* Raise the arrows up to avoid covering nav buttons - REVERTED */
}

/* Ensure Hebrew text remains RTL */
.instructions-wrapper h2 {
    direction: rtl;
}

.instructions-frame h2 {
    font-size: 5rem;
    font-weight: 800;
    color: white;
    line-height: 1.3;
    text-align: center;
    text-shadow: 0 2px 10px rgba(255, 255, 255, 0.5);
}

.arrow-icon {
    width: 250px;
    height: 250px;
    color: white;
    filter: drop-shadow(0 5px 5px rgba(0, 0, 0, 0.2));
}

/* Arrow Animations */
.frame-container.active .arrow-left {
    animation: bounceLeft 1s ease-in-out 2 forwards;
    /* Runs twice then keeps state */
}

.frame-container.active .arrow-right {
    animation: bounceRight 1s ease-in-out 2 forwards;
    /* Runs twice then keeps state */
}

@keyframes bounceLeft {

    0%,
    100% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(-30px);
    }
}

@keyframes bounceRight {

    0%,
    100% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(30px);
    }
}

/* Global Hidden Class */
.hidden {
    display: none !important;
}

/* Side Game Panels */
.side-game-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    opacity: 0;
    transition: opacity 0.5s ease-in;
    background-image: url('https://drive.google.com/thumbnail?id=1wY9mA-dNhLNCI6o2iDaYGoyE3nkQVt5R&sz=w3000');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    z-index: 10;
}

.side-game-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: -1;
    pointer-events: none;
}

.side-game-container.visible {
    opacity: 1;
}

.game-question {
    font-size: 3.5rem;
    font-weight: 800;
    color: #1a3c5a;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 20px 60px;
    border-radius: 50px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    margin-bottom: 60px;
    text-align: center;
    display: inline-block;
    /* ensure it doesn't stretch */
}

.options-container {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 40px;
    width: 100%;
    padding: 0 40px;
}

.game-btn {
    width: auto;
    /* Allow auto width */
    min-width: 300px;
    padding: 24px 48px;
    border-radius: 50px;
    border: none;
    font-family: 'Canvas Sans', 'Assistant', 'Heebo', Arial, sans-serif;
    font-size: 2.2rem;
    font-weight: 800;
    color: white;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.game-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
}

.game-btn:active {
    transform: scale(0.98);
}

.btn-orange {
    background-color: #f5a623;
    box-shadow: 0 10px 0 #cc840e;
}

.btn-orange:hover {
    box-shadow: 0 12px 0 #cc840e;
}

.btn-orange:active {
    box-shadow: 0 5px 0 #cc840e;
    transform: translateY(5px);
}

.btn-green {
    background-color: #7ed321;
    box-shadow: 0 10px 0 #5b9e12;
}

.btn-green:hover {
    box-shadow: 0 12px 0 #5b9e12;
}

.btn-green:active {
    box-shadow: 0 5px 0 #5b9e12;
    transform: translateY(5px);
}

.btn-cyan {
    background-color: #00d2ff;
    color: white;
    /* Better contrast */
    box-shadow: 0 10px 0 #009ec0;
}

.btn-cyan:hover {
    box-shadow: 0 12px 0 #009ec0;
}

.btn-cyan:active {
    box-shadow: 0 5px 0 #009ec0;
    transform: translateY(5px);
}

.btn-blue {
    background-color: #ee65e7;
    color: white;
    box-shadow: 0 10px 0 #5A2476;
}

.btn-blue:hover {
    box-shadow: 0 12px 0 #5A2476;
}

.btn-blue:active {
    box-shadow: 0 5px 0 #5A2476;
    transform: translateY(5px);
}

.btn-purple {
    background-color: #9b59b6;
    color: white;
    box-shadow: 0 10px 0 #8e44ad;
}

.btn-purple:hover {
    box-shadow: 0 12px 0 #8e44ad;
}

.btn-purple:active {
    box-shadow: 0 5px 0 #8e44ad;
    transform: translateY(5px);
}

.btn-correct-found {
    background-color: #2ecc71 !important;
    box-shadow: 0 0 20px #2ecc71 !important;
    transform: scale(0.95);
    opacity: 1;
    border: 3px solid #fff;
}

/* Feedback Styling */
.feedback-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-top: 40px;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.feedback-icon {
    font-size: 8rem;
    margin-bottom: 20px;
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.3));
}

.feedback-text {
    font-size: 3rem;
    font-weight: 700;
    color: white;
    text-align: center;
    line-height: 1.4;
    max-width: 80%;
}

/* Result Frames (Generic) */
.result-frame h1 {
    font-size: 7rem;
    font-weight: 900;
    color: white;
    /* margin-bottom: 60px; removed for gap */
    text-shadow: 0 2px 10px rgba(255, 255, 255, 0.3);
}

.context-text {
    font-size: 3.5rem;
    font-weight: 700;
    color: white;
    text-align: center;
    max-width: 90%;
    /* margin-bottom: 40px; removed for gap */
    direction: rtl;
    line-height: 1.4;
}

.error-highlight {
    color: #d0021b;
    font-weight: 900;
    display: inline-block;
}

.comparison-container {
    display: flex;
    flex-direction: row;
    gap: 80px;
    align-items: center;
    align-items: center;
    justify-content: center;
    margin: 0;
    /* removed margins for gap */
}

.comparison-item {
    display: flex;
    flex-direction: row-reverse;
    /* To put checkmark/x next to text */
    align-items: center;
    gap: 20px;
    font-size: 3.5rem;
    font-weight: 800;
    padding: 20px 40px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.comparison-item.correct {
    color: #417505;
    border: 4px solid #7ed321;
}

.comparison-item.incorrect {
    color: #d0021b;
    border: 4px solid #d0021b;
    /* text-decoration: line-through; Optional */
}

.icon-check,
.icon-cross {
    font-size: 4rem;
}

.comparison-item.incorrect .icon-cross {
    filter: drop-shadow(0 2px 5px rgba(208, 2, 27, 0.3));
}


.comparison-item.correct .icon-check {
    filter: drop-shadow(0 2px 5px rgba(126, 211, 33, 0.3));
}


/* Waiting Screen */
.waiting-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1;
    pointer-events: none;
}

.waiting-title {
    font-size: 5rem;
    font-weight: 800;
    color: #ffffff;
    text-align: center;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.6);
    animation: scaleInOut 2s ease-in-out infinite;
    max-width: 80%;
    line-height: 1.2;
}

@keyframes scaleInOut {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.1);
        opacity: 1;
    }
}

/* Responsive scaling updates */
@media screen and (max-width: 5760px) {
    #game-container {
        transform: scale(calc(100vw / 5760));
    }
}

/* End Frame Styles */
.end-frame h1 {
    font-size: 7rem;
    font-weight: 900;
    color: white;
    /* margin-bottom: 24px; removed for gap */
    text-shadow: 0 4px 15px rgba(255, 255, 255, 0.5);
    z-index: 10;
}

.end-frame h2 {
    font-size: 3.5rem;
    font-weight: 700;
    color: white;
    /* margin-bottom: 60px; removed for gap */
    z-index: 10;
}

/* Confetti Animation */
.confetti-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 5;
}

.confetti {
    position: absolute;
    opacity: 0.8;
    z-index: 1;
    animation: fall linear forwards;
}

.confetti.square {
    border-radius: 0;
}

.confetti.circle {
    border-radius: 50%;
}

.confetti.triangle {
    width: 0 !important;
    height: 0 !important;
    background-color: transparent !important;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 16px solid;
    /* Color will be set inline via border-bottom-color in JS if possible, 
       but currently JS sets background-color. 
       Let's stick to square/circle for simplicity or use clip-path for triangle */
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    background-color: inherit;
    /* JS sets bg color */
    width: 15px !important;
    height: 15px !important;
    border: none;
}

.confetti-icon {
    position: absolute;
    font-size: 2rem;
    z-index: 2;
    animation: fall-spin 2.5s ease-out forwards;
    opacity: 0.9;
}

@keyframes fall {
    0% {
        transform: translateY(-100px) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(1100px) rotate(720deg);
        opacity: 0;
    }
}

@keyframes fall-spin {
    0% {
        transform: translateY(-100px) rotate(0deg) scale(0.5);
        opacity: 0;
    }

    10% {
        opacity: 1;
        transform: translateY(0) rotate(45deg) scale(1.2);
    }

    100% {
        transform: translateY(1100px) rotate(360deg) scale(1);
        opacity: 0;
    }
}

/* Party Poppers */
.party-popper {
    position: absolute;
    bottom: 50px;
    font-size: 10rem;
    z-index: 4;
    animation: bouncePopper 2s infinite ease-in-out;
}

.popper-left {
    left: 150px;
    transform: rotate(45deg);
}

.popper-right {
    right: 150px;
    transform: rotate(-45deg);
    /* Mirror it visually */
}

@keyframes bouncePopper {

    0%,
    100% {
        transform: translateY(0) rotate(var(--rot));
    }

    50% {
        transform: translateY(-20px) rotate(var(--rot));
    }
}

.popper-left {
    --rot: 45deg;
}

.popper-right {
    --rot: -45deg;
}

/* Play Again Button - Circular with Icon */
.btn-play-again {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background-color: #808080;
    /* Gray background */
    border: 4px solid rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    color: white;
    /* Icon color */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    margin-bottom: 20px;
    /* Space between this and Continue button */
}

.btn-play-again:hover {
    background-color: #666666;
    /* Darker gray on hover */
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.4);
}

.btn-play-again:active {
    transform: scale(0.95);
}

.btn-play-again svg {
    margin-left: 5px;
    /* Slight optical adjustment for play icon center */
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}