/**
 * Quiz Platform CSS
 * Complete styles for all screens — merged from preview HTML files
 */

/* ===== FONTS ===== */
@font-face {
    font-family: 'Birzia';
    src: url('../fonts/Birzia-Black.woff2') format('woff2'),
         url('../fonts/Birzia-Black.woff') format('woff'),
         url('../fonts/Birzia-Black.otf') format('opentype');
    font-weight: 900;
    font-style: normal;
}
@font-face {
    font-family: 'Birzia';
    src: url('../fonts/Birzia-Light.woff2') format('woff2'),
         url('../fonts/Birzia-Light.woff') format('woff'),
         url('../fonts/Birzia-Light.otf') format('opentype');
    font-weight: 300;
    font-style: normal;
}
@font-face {
    font-family: 'Birzia';
    src: url('../fonts/Birzia-Medium.woff2') format('woff2'),
         url('../fonts/Birzia-Medium.woff') format('woff'),
         url('../fonts/Birzia-Medium.otf') format('opentype');
    font-weight: 500;
    font-style: normal;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

button {
    font-family: 'Birzia', Arial, sans-serif;
}

/* ===== ROTATE OVERLAY (portrait mobile) ===== */
.rotate-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: #1a2535;
    z-index: 9999;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    color: #fff;
    font-family: 'Birzia', Arial, sans-serif;
    font-weight: 900;
    font-size: 22px;
    text-align: center;
    direction: rtl;
}
.rotate-overlay svg {
    width: 80px;
    height: 80px;
    fill: #fff;
    animation: rotate-hint 2s ease-in-out infinite;
}
@keyframes rotate-hint {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(90deg); }
}
@media (max-width: 768px) and (orientation: portrait) {
    .rotate-overlay { display: flex; }
}

/* ===== WELCOME / INTRO SCREEN ===== */
.intro-screen {
    position: relative;
    width: 100%;
    max-width: 1100px;
    aspect-ratio: 1100 / 680;
    background-color: #f26d5c;
    overflow: hidden;
    font-family: 'Birzia', Arial, sans-serif;
    direction: rtl;
}

/* פס שחור תחתון */
.intro-screen::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 22.06%;
    background: #000;
}

/* תמונת הרקע */
.intro-bg-illustration {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 80%;
    background-image: url('../images/quiz-design/welcome/welcome-bg.png');
    background-repeat: no-repeat;
    background-position: bottom center;
    background-size: 100% auto;
    z-index: 2;
}

/* אזור הטקסט — בתוך הקופסא השמאלית */
.intro-content {
    position: absolute;
    top: 25%;
    left: 15%;
    transform: none;
    z-index: 10;
    line-height: 1;
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* שורה ראשונה: h1 + כפתור */
.intro-title-line {
    display: flex;
    align-items: center;
    flex-direction: row;
    direction: ltr;
    gap: 0.45em;
}

.intro-title-line h1 {
    font-family: 'Birzia', Arial, sans-serif;
    font-weight: 900;
    font-size: clamp(24px, 6vw, 66px);
    color: #fff;
    white-space: nowrap;
    line-height: 1;
    direction: rtl;
}

/* כפתור הפעלה */
.start-btn-play {
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(26px, 4vw, 44px);
    height: clamp(26px, 4vw, 44px);
    background: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
}
.start-btn-play svg {
    width: 42%;
    height: 42%;
    fill: #2d3a8c;
    margin-left: 8%;
}

/* לוגו */
.intro-logo {
    position: absolute;
    top: 4%;
    right: 4%;
    width: clamp(80px, 13vw, 145px);
    z-index: 20;
}

/* כותרת משנה */
.intro-subtitle {
    font-family: 'Birzia', Arial, sans-serif;
    font-weight: 300;
    font-size: clamp(16px, 3vw, 33px);
    color: #fff;
    white-space: nowrap;
    line-height: 1.05;
    margin-top: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.4em;
    direction: rtl;
}

@media (max-width: 600px) {
    .intro-screen {
        aspect-ratio: unset;
        min-height: 100svh;
    }
    .intro-content {
        top: 14%;
        left: 7%;
        right: auto;
        transform: none;
    }
}

/* ===== INSTRUCTIONS SCREEN ===== */
.instructions-screen {
    position: relative;
    width: 100%;
    max-width: 1100px;
    aspect-ratio: 1100 / 680;
    background-color: #1a2535;
    overflow: hidden;
    font-family: 'Birzia', Arial, sans-serif;
    direction: rtl;
}

.instructions-screen::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 22.06%;
    background: #000;
    z-index: 1;
}

.instructions-bg {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    width: 100%;
    height: 80%;
    background-image: url('../images/quiz-design/instructions/instructions-bg.png');
    background-repeat: no-repeat;
    background-position: bottom center;
    background-size: 100% auto;
    z-index: 8;
}

.instructions-title {
    position: absolute;
    top: 4%;
    left: 0; right: 0;
    text-align: right;
    padding-right: 18%;
    font-family: 'Birzia', Arial, sans-serif;
    font-weight: 900;
    font-size: clamp(26px, 6.5vw, 72px);
    color: #fff;
    z-index: 20;
    line-height: 1;
}

.instructions-wrapper {
    position: absolute;
    top: 15%;
    left: 15%;
    right: 3%;
    bottom: 20%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    direction: ltr;
    z-index: 5;
}

.instructions-box {
    flex: 1;
    max-width: 85%;
    height: 100%;
    background: rgba(110, 120, 138, 0.6);
    border: 2.5px solid #fff;
    border-radius: 3px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;   /* הטקסט צמוד לראש הקופסא */
    gap: clamp(5px, 1.3vw, 15px);
    padding: clamp(12px, 2.2vw, 28px) clamp(18px, 3.5vw, 44px) clamp(10px, 2vw, 24px) clamp(50px, 10vw, 110px);
    direction: rtl;
    z-index: 5;
    overflow-y: auto;   /* בטיחות — אם גולש במסך קטן, גלילה במקום חריגה */
}

.instructions-box p {
    font-family: 'Birzia', Arial, sans-serif;
    font-weight: 500;
    font-size: clamp(10px, 1.75vw, 20px);
    color: #fff;
    line-height: 1.4;
    text-align: right;
    margin: 0;
}
.instructions-box p:last-child {
    margin-top: 0.6em;
}

.continue-btn {
    display: flex;
    align-items: center;
    flex-direction: row-reverse;
    direction: ltr;
    gap: 0.35em;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 0 0 3%;
    flex-shrink: 0;
}

.continue-btn span {
    font-family: 'Birzia', Arial, sans-serif;
    font-weight: 900;
    font-size: clamp(18px, 3vw, 34px);
    color: #fff;
    white-space: nowrap;
    direction: rtl;
}

.continue-btn .play-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(22px, 3.2vw, 36px);
    height: clamp(22px, 3.2vw, 36px);
    background: #fff;
    border-radius: 50%;
    flex-shrink: 0;
}
.continue-btn .play-icon svg {
    width: 42%;
    height: 42%;
    fill: #2d3a8c;
    margin-left: 8%;
}

/* ===== NAME SCREEN ===== */
.name-screen {
    position: relative;
    width: 100%;
    max-width: 1100px;
    aspect-ratio: 1100 / 680;
    background-color: #f26d5c;
    overflow: hidden;
    font-family: 'Birzia', Arial, sans-serif;
    direction: rtl;
}

.name-screen::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 22.06%;
    background: #000;
    z-index: 1;
}

.name-screen::before {
    content: '';
    position: absolute;
    bottom: 11%;
    left: 0; right: 0;
    height: 0;
    border-top: 3px dashed #fff;
    z-index: 2;
}

.name-bg {
    position: absolute;
    bottom: 0; left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../images/quiz-design/name-input/name-bg.png');
    background-repeat: no-repeat;
    background-position: bottom center;
    background-size: 100% auto;
    z-index: 2;
}

.name-content {
    position: absolute;
    top: 12%;
    right: 5%;
    width: 42%;
    z-index: 10;
    direction: rtl;
    display: flex;
    flex-direction: column;
}

.name-title {
    font-family: 'Birzia', Arial, sans-serif;
    font-weight: 900;
    font-size: clamp(14px, 2.8vw, 31px);
    color: #fff;
    line-height: 1;
    margin-bottom: 0.2em;
    text-align: right;
}

.name-input-field {
    width: 100%;
    height: clamp(36px, 6.5vw, 72px);
    background: rgba(242, 130, 110, 0.45);
    border: 2.5px solid #fff;
    border-radius: 3px;
    font-family: 'Birzia', Arial, sans-serif;
    font-weight: 300;
    font-size: clamp(14px, 2.2vw, 24px);
    color: #fff;
    text-align: right;
    padding: 0 clamp(10px, 2vw, 20px);
    outline: none;
    margin-bottom: 0.4em;
}

.name-input-field::placeholder {
    color: rgba(255,255,255,0.6);
}

.name-input-field:focus {
    background: rgba(242, 130, 110, 0.6);
}

.name-continue-btn {
    display: flex;
    align-items: center;
    flex-direction: row-reverse;
    direction: ltr;
    gap: 0.3em;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-top: 0.5em;
    align-self: flex-end; /* RTL: שמאל — מתחת לשדה */
}

.name-continue-btn span {
    font-family: 'Birzia', Arial, sans-serif;
    font-weight: 900;
    font-size: clamp(16px, 2.8vw, 30px);
    color: #fff;
    white-space: nowrap;
    direction: rtl;
}

.name-continue-btn .play-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(18px, 2.6vw, 28px);
    height: clamp(18px, 2.6vw, 28px);
    background: #fff;
    border-radius: 50%;
    flex-shrink: 0;
}
.name-continue-btn .play-icon svg {
    width: 42%;
    height: 42%;
    fill: #2d3a8c;
    margin-left: 8%;
}

/* ===== GAME SCREEN ===== */
.game-screen {
    position: relative;
    width: 100%;
    max-width: 1100px;
    aspect-ratio: 1100 / 680;
    background-color: #3ab8c0;
    overflow: hidden;
    font-family: 'Birzia', Arial, sans-serif;
    direction: rtl;
}

.game-screen::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 22.06%;
    background: #000;
    z-index: 1;
}

.game-screen::before {
    content: '';
    position: absolute;
    bottom: 11%; left: 0; right: 0;
    border-top: 3px dashed #fff;
    z-index: 2;
}

.game-bg {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    width: 100%; height: 100%;
    background-image: url('../images/quiz-design/game/game-bg.png');
    background-repeat: no-repeat;
    background-position: bottom center;
    background-size: contain;   /* כל התמרור נראה, בלי חיתוך */
    z-index: 8;
    pointer-events: none;
}

/* פאנל סטטיסטיקות ימין */
.stats-panel {
    position: absolute;
    top: 4%; right: 2%;
    width: 14%;
    z-index: 10;
    direction: rtl;
    display: flex;
    flex-direction: column;
    gap: 4%;
}

/* כפתור המשך — מרכז הפס השחור, מעל קו הכביש */
.game-screen > .game-continue-btn {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(13% + 10px);
    z-index: 20;
    margin-top: 0;
}

.stats-label {
    font-family: 'Birzia', Arial, sans-serif;
    font-weight: 900;
    font-size: clamp(10px, 1.4vw, 15px);
    color: #fff;
    margin-bottom: 2px;
}

.step-box {
    width: 100%;
    padding: 6px 4px;
    background: #1a2d3d;
    border: 2px solid #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 900;
    font-size: clamp(14px, 2.5vw, 28px);
    color: #fff;
    border-radius: 3px;
    letter-spacing: 1px;
    direction: ltr;
}

.score-box, .name-box {
    width: 100%;
    aspect-ratio: 2 / 1;
    border: 2px solid #fff;
    background: transparent;
    border-radius: 3px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 900;
    font-size: clamp(13px, 2vw, 22px);
    color: #fff;
}

/* טיימר — אדום, גדול יותר */
#quiz-timer {
    color: #e74c3c;
    border-color: #e74c3c;
    font-size: clamp(20px, 3.5vw, 42px);
    aspect-ratio: 1.5 / 1;
}

.game-continue-btn {
    display: flex;
    align-items: center;
    flex-direction: row-reverse;
    direction: ltr;
    gap: 0.3em;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-top: 4%;
}
.game-continue-btn span {
    font-family: 'Birzia', Arial, sans-serif;
    font-weight: 900;
    font-size: clamp(18px, 2.8vw, 32px);
    color: #fff; white-space: nowrap; direction: rtl;
}
.game-continue-btn .play-icon {
    display: flex; align-items: center; justify-content: center;
    width: clamp(22px, 3vw, 36px); height: clamp(22px, 3vw, 36px);
    background: #fff; border-radius: 50%; flex-shrink: 0;
}
.game-continue-btn .play-icon svg {
    width: 42%; height: 42%; fill: #2d3a8c; margin-left: 8%;
}

/* תיבת השאלות */
.quiz-box {
    position: absolute;
    top: 5%; left: 17%;
    right: 18%;
    bottom: 25%;
    border: 2.5px solid #fff;
    border-radius: 3px;
    display: flex;
    flex-direction: column;
    gap: 2%;
    padding: 2%;
    z-index: 5;
    background: transparent;
}

/* עטיפה inline לשאלות מילוי — מונע פיצול ב-flex */
.question-inline {
    display: inline;
    line-height: 1.6;
}

/* קו השלמה רציף בשאלות מילוי */
.blank-line {
    display: inline-block;
    border-bottom: 2px solid #fff;
    min-width: 80px;
    vertical-align: bottom;
    color: transparent;
    letter-spacing: -1px;
    margin: 0 3px;
}

.question-area {
    flex: 0 0 30%;
    background: rgba(100, 200, 210, 0.45);
    border: 2px solid rgba(255,255,255,0.6);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2% 4%;
    text-align: center;
    font-weight: 900;
    font-size: clamp(13px, 2vw, 22px);
    color: #fff;
    line-height: 1.4;
}

.options-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 2%;
}

.option-cell {
    background: rgba(100, 200, 210, 0.45);
    border: 2px solid rgba(255,255,255,0.6);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2% 4%;
    text-align: center;
    font-weight: 500;
    font-size: clamp(13px, 1.9vw, 22px);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
    font-family: 'Birzia', Arial, sans-serif;
    border: none;
}
.option-cell:hover  { background: rgba(100, 200, 210, 0.7); }
.option-cell.correct { background: #27ae60; border-color: #27ae60; }
.option-cell.wrong   { background: #e74c3c; border-color: #e74c3c; }
.option-cell.selected { background: #f1c40f; border-color: #f1c40f; color: #000; }
.option-cell:disabled { cursor: not-allowed; }

/* Question image area (for multiple_choice_pic) */
.question-image-area {
    text-align: center;
    margin-bottom: 1%;
}
.question-image-area img {
    max-height: 25%;
    max-width: 60%;
    object-fit: contain;
    border-radius: 3px;
}

/* Fig / debate area */
.fig-area {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.fig-debate {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    padding: 1% 3%;
    gap: 4%;
    overflow: hidden;
}
.fig-character {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    max-width: 44%;
    overflow: hidden;
}
.fig-char-name {
    font-family: 'Birzia', Arial, sans-serif;
    font-weight: 900;
    font-size: clamp(18px, 3vw, 34px);
    color: #fff;
    letter-spacing: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    flex-shrink: 0;
}
.speech-bubble {
    flex: 0 1 auto;
    position: relative;
    background: rgba(255,255,255,0.22);
    border: 2px solid rgba(255,255,255,0.9);
    border-radius: 18px 18px 18px 4px;
    padding: clamp(10px, 1.5vw, 20px) clamp(12px, 1.8vw, 24px);
    font-size: clamp(13px, 1.9vw, 22px);
    color: #fff;
    font-weight: 500;
    text-align: right;
    line-height: 1.4;
    align-self: center;
    overflow: visible;
}
/* זנב בועת הדיבור — מצביע כלפי מטה לכיוון הדמות */
.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -11px;
    right: 20px;
    width: 0; height: 0;
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
    border-top: 11px solid rgba(255,255,255,0.22);
}
.speech-bubble::before {
    content: '';
    position: absolute;
    bottom: -14px;
    right: 18px;
    width: 0; height: 0;
    border-left: 11px solid transparent;
    border-right: 11px solid transparent;
    border-top: 13px solid rgba(255,255,255,0.8);
}
/* כשהדמות נבחרה נכון — הזנב בצבע הגבול הירוק */
.fig-character.correct .speech-bubble::before { border-top-color: #27ae60; }
.fig-character.correct .speech-bubble::after  { border-top-color: #27ae60; }
/* כשהדמות שגויה — הזנב בצבע האדום */
.fig-character.wrong .speech-bubble::before { border-top-color: #e74c3c; }
.fig-character.wrong .speech-bubble::after  { border-top-color: #e74c3c; }
.fig-avatar svg {
    height: clamp(50px, 10vw, 100px);
    width: auto;
}
.fig-avatar-img {
    height: clamp(80px, 14vw, 150px);
    width: auto;
    object-fit: contain;
    object-position: top;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4));
    flex-shrink: 1;
}
.fig-buttons {
    display: flex;
    gap: 4%;
    justify-content: space-around;
    padding: 0 3% 2%;
}
.fig-btn {
    flex: 1;
    max-width: 44%;
    padding: 5px 8px;
    font-size: clamp(11px, 1.4vw, 15px);
    font-weight: 900;
    background: rgba(100, 200, 210, 0.45);
    border: 2px solid rgba(255,255,255,0.6);
    border-radius: 3px;
    color: #fff;
    cursor: pointer;
    font-family: 'Birzia', Arial, sans-serif;
}
.fig-btn.correct { background: #27ae60; border-color: #27ae60; }
.fig-btn.wrong   { background: #e74c3c; border-color: #e74c3c; }

/* הנחיית גרירה בשאלות התאמה */
.matching-instruction {
    text-align: center;
    font-family: 'Birzia', Arial, sans-serif;
    font-weight: 700;
    font-size: clamp(12px, 1.6vw, 18px);
    color: #fff;
    margin: 0 0 4px 0;
    flex-shrink: 0;
}

/* Matching area inside game screen */
.matching-area {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.matching-container {
    flex: 1;
    min-height: 0;
    display: flex;
    gap: 4%;
    justify-content: space-around;
}
.matching-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* מיכל הפריטים — ממלא את כל גובה העמודה */
#left-items, #right-items {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 0;
}
.matching-column h4 {
    text-align: center;
    margin-bottom: 4px;
    color: #fff;
    font-size: clamp(11px, 1.4vw, 16px);
    font-weight: 900;
    font-family: 'Birzia', Arial, sans-serif;
}
.matching-item {
    flex: 1;                 /* גובה שווה לכל הקוביות בשתי העמודות */
    min-height: 0;
    background: rgba(100, 200, 210, 0.45);
    border: 2px solid rgba(255,255,255,0.6);
    border-radius: 3px;
    padding: 4px 6px;
    cursor: pointer;
    transition: background 0.2s;
    text-align: center;
    color: #fff;
    font-size: clamp(10px, 1.3vw, 15px);
    font-weight: 500;
    font-family: 'Birzia', Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;  /* מרכוז אנכי */
    gap: 4px;
}
.matching-item-image {
    max-width: 88%;
    max-height: 100%;        /* התמונה ממלאת את הקובייה הגדולה */
    object-fit: contain;
}
.matching-item-text {
    font-weight: 500;
    color: #fff;
}
.matching-item:hover { background: rgba(100, 200, 210, 0.7); }
.matching-item.selected { background: rgba(241,196,15,0.6); border-color: #f1c40f; }
.matching-item.correct { background: #27ae60; border-color: #27ae60; }
.matching-item.wrong   { background: #e74c3c; border-color: #e74c3c; }
.matching-item.matched { cursor: pointer; } /* ניתן ללחוץ כדי לבטל התאמה שגויה */
.matching-item[draggable="true"] { cursor: grab; }
.matching-item.dragging { opacity: 0.5; }
.matching-item.drag-over { outline: 2px dashed #fff; outline-offset: 2px; background: rgba(255,255,255,0.15); }

/* Puzzle area */
.puzzle-area {
    flex: 1;
}
.puzzle-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    height: 100%;
}
.puzzle-instructions h4,
.puzzle-selection-area h4,
.puzzle-grid-container h4 {
    text-align: center;
    color: #fff;
    font-size: clamp(11px, 1.4vw, 16px);
    font-weight: 900;
    margin-bottom: 4px;
    font-family: 'Birzia', Arial, sans-serif;
}
.puzzle-pieces-pool {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    padding: 8px;
    background: rgba(255,255,255,0.05);
    border-radius: 6px;
}
.puzzle-container {
    display: grid;
    gap: 6px;
    max-width: 100%;
    margin: 0 auto;
    aspect-ratio: 1;
    background: rgba(255,255,255,0.05);
    padding: 6px;
    border-radius: 6px;
}
.puzzle-slot {
    background: rgba(255,255,255,0.1);
    border: 2px dashed rgba(255,255,255,0.3);
    border-radius: 4px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.2s;
    overflow: hidden;
}
.puzzle-slot.drag-over {
    background: rgba(100,200,210,0.3);
    border-color: #4ecdc4;
    border-style: solid;
}
.puzzle-piece {
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    cursor: grab;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    min-width: 60px;
    min-height: 60px;
    max-width: 100px;
    max-height: 100px;
}
.puzzle-piece.placed-in-slot {
    width: 100%; height: 100%;
    min-width: 100%; min-height: 100%;
    max-width: 100%; max-height: 100%;
    cursor: move;
}
.puzzle-piece.dragging { opacity: 0.5; cursor: grabbing; }
.puzzle-piece.placed { opacity: 0.3; cursor: not-allowed; pointer-events: none; }
.puzzle-piece img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; user-select: none; }
.puzzle-piece-text {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 3px 6px;
    font-size: 0.75rem;
    text-align: center;
    font-weight: 300;
}
.puzzle-remove-btn {
    position: absolute;
    top: 3px; right: 3px;
    background: rgba(244,67,54,0.9);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 20px; height: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}
.puzzle-piece:hover:not(.placed) { background: rgba(255,255,255,0.2); border-color: #4ecdc4; transform: scale(1.05); }
.puzzle-piece.selected { background: rgba(100,200,210,0.4); border-color: #4ecdc4; }
.puzzle-piece.correct { background: #27ae60; border-color: #27ae60; }
.puzzle-piece.wrong   { background: #e74c3c; border-color: #e74c3c; }

/* Explanation area */
.explanation-area {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 3px;
    padding: 6px 10px;
    font-size: clamp(13px, 1.8vw, 20px);
    color: #fff;
    font-weight: 300;
    text-align: right;
    line-height: 1.4;
}
.explanation-label {
    font-weight: 900;
    margin-left: 4px;
}

/* ===== RESULTS SCREEN ===== */
.results-screen {
    position: relative;
    width: 100%;
    max-width: 1100px;
    aspect-ratio: 1100 / 680;
    background-color: #f26d5c;
    overflow: hidden;
    font-family: 'Birzia', Arial, sans-serif;
    direction: rtl;
}

.results-screen::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 22.06%;
    background: #000;
    z-index: 1;
}

.results-bg {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    width: 100%; height: 70%;
    background-image: url('../images/quiz-design/results/results-bg.png');
    background-repeat: no-repeat;
    background-position: bottom center;
    background-size: 100% auto;
    z-index: 5;
}

.results-content {
    position: absolute;
    top: 2%;
    left: 0; right: 0;
    text-align: center;
    z-index: 10;
    padding: 0 5%;
}

.results-title {
    font-family: 'Birzia', Arial, sans-serif;
    font-weight: 900;
    font-size: clamp(32px, 8vw, 88px);
    color: #fff;
    line-height: 1;
    margin-bottom: 0.1em;
}

.results-subtitle {
    font-family: 'Birzia', Arial, sans-serif;
    font-weight: 700;
    font-size: clamp(16px, 2.8vw, 36px);
    color: #fff;
    line-height: 1.1;
    margin-bottom: 0.15em;
}

.results-score {
    font-family: 'Birzia', Arial, sans-serif;
    font-weight: 300;
    font-size: clamp(13px, 2.2vw, 26px);
    color: #fff;
    line-height: 1.3;
}

.results-score strong {
    font-weight: 900;
}

.results-topics {
    margin-top: clamp(8px, 1.5vw, 18px);
    text-align: center;
    direction: rtl;
    width: 100%;
}
.results-topics-label {
    font-family: 'Birzia', Arial, sans-serif;
    font-weight: 900;
    font-size: clamp(12px, 1.8vw, 20px);
    color: #fff;
    margin-bottom: 0.3em;
    text-align: center;
    display: block;
}
.results-topics-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}
.results-topics-list li {
    font-family: 'Birzia', Arial, sans-serif;
    font-weight: 500;
    font-size: clamp(10px, 1.4vw, 16px);
    color: #fff;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 20px;
    padding: 3px 12px;
    white-space: nowrap;
}
.results-topics-footer {
    font-family: 'Birzia', Arial, sans-serif;
    font-weight: 500;
    font-size: clamp(11px, 1.5vw, 17px);
    color: #fff;
    margin-top: 0.4em;
    text-align: center;
}
.results-good-luck {
    font-family: 'Birzia', Arial, sans-serif;
    font-weight: 900;
    font-size: clamp(16px, 2.5vw, 28px);
    color: #fff;
    margin-top: 0.3em;
    text-align: center;
}

.results-continue-btn {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 6%;
    z-index: 20;
    display: flex;
    align-items: center;
    flex-direction: row-reverse;
    direction: ltr;
    gap: 0.35em;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    white-space: nowrap;
}
.results-continue-btn span {
    font-family: 'Birzia', Arial, sans-serif;
    font-weight: 900;
    font-size: clamp(13px, 2vw, 24px);
    color: #fff;
    white-space: normal;
    direction: rtl;
    text-align: right;
    line-height: 1.25;
}
.results-continue-btn .play-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(22px, 3.2vw, 36px);
    height: clamp(22px, 3.2vw, 36px);
    background: #fff;
    border-radius: 50%;
    flex-shrink: 0;
}
.results-continue-btn .play-icon svg {
    width: 42%;
    height: 42%;
    fill: #f26d5c;
    margin-left: 8%;
}

/* ===== CHAMPIONSHIP / LEADERBOARD SCREEN ===== */
.championship-screen {
    position: relative;
    width: 100%;
    max-width: 1100px;
    aspect-ratio: 1100 / 680;
    background-color: #1a2535;
    overflow: hidden;
    font-family: 'Birzia', Arial, sans-serif;
    direction: rtl;
}

.championship-screen::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 22.06%;
    background: #000;
    z-index: 1;
}

.championship-bg {
    position: absolute;
    bottom: 0; left: 0;
    width: 100%; height: 85%;
    background-image: url('../images/quiz-design/championship/championship-bg.png');
    background-repeat: no-repeat;
    background-position: bottom -4% left -3%;
    background-size: auto 88%;
    z-index: 8;
    pointer-events: none;
}

.championship-title {
    position: absolute;
    top: 4%; right: 17%;
    font-family: 'Birzia', Arial, sans-serif;
    font-weight: 900;
    font-size: clamp(28px, 7vw, 77px);
    color: #fff;
    z-index: 20;
    line-height: 1;
}

.championship-wrapper {
    position: absolute;
    top: 16%; bottom: 28%;
    left: 20%; right: 2%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    direction: ltr;
    z-index: 5;
    gap: 3%;
}

.leaderboard-box {
    flex: 1;
    height: 100%;
    background: rgba(110, 120, 138, 0.6);
    border: 2.5px solid #fff;
    border-radius: 3px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    padding: 2% 4% 2% 3%;
    direction: rtl;
    overflow: hidden;
}

.leaderboard-row {
    display: flex;
    align-items: center;
    direction: rtl;
    gap: 0;
    font-size: clamp(9px, 1.35vw, 15px);
    font-weight: 500;
    color: rgba(255,255,255,0.85);
    line-height: 1;
    font-family: 'Birzia', Arial, sans-serif;
}

.leaderboard-row.current-user {
    color: #fff;
    font-weight: 900;
    background: rgba(255,255,255,0.12);
    border-radius: 3px;
    padding: 2px 4px;
    margin: 0 -4px;
}

.row-name {
    white-space: nowrap;
    direction: rtl;
    flex-shrink: 0;
}

.row-dots {
    flex: 1;
    overflow: hidden;
    letter-spacing: 2px;
    color: rgba(255,255,255,0.4);
    padding: 0 4px;
    font-size: 0.9em;
}

.row-score {
    white-space: nowrap;
    flex-shrink: 0;
    direction: ltr;
    font-weight: 900;
    color: #fff;
}

.row-step {
    white-space: nowrap;
    flex-shrink: 0;
    direction: rtl;
    margin-right: 6px;
    color: rgba(255,255,255,0.6);
    font-size: 0.85em;
}

.restart-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0 1%;
}

.restart-btn-text {
    font-family: 'Birzia', Arial, sans-serif;
    font-weight: 900;
    font-size: clamp(16px, 2.8vw, 30px);
    color: #fff;
    text-align: center;
    white-space: nowrap;
    line-height: 1.15;
}

.restart-btn .play-circle {
    display: flex; align-items: center; justify-content: center;
    width: clamp(36px, 6vw, 66px);
    height: clamp(36px, 6vw, 66px);
    background: #fff;
    border-radius: 50%;
    flex-shrink: 0;
}
.restart-btn .play-circle svg {
    width: 40%; height: 40%;
    fill: #2d3a8c;
    margin-left: 8%;
}

/* ===== RESPONSIVE — mobile portrait blocked by rotate-overlay ===== */
@media (max-width: 768px) and (orientation: landscape) {
    .intro-screen,
    .instructions-screen,
    .name-screen,
    .game-screen,
    .results-screen,
    .championship-screen {
        aspect-ratio: unset;
        min-height: 100svh;
    }
}

/* ============================================
   FIX: תמונות רקע לא יחסמו קליקים על כפתורים
   ============================================ */
.intro-bg-illustration,
.instructions-bg,
.name-bg,
.game-bg,
.results-bg,
.championship-bg {
    pointer-events: none;
}

/* ============================================
   מרכוז + מילוי פרופורציונלי של כל השטח הזמין
   ============================================ */
.quiz-platform-container,
#quiz-container {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
    max-width: none;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden;
}

/* כל מסך — שומר יחס 1100:680, גדל למלא את המקום, ממורכז */
.intro-screen,
.instructions-screen,
.name-screen,
.game-screen,
.results-screen,
.championship-screen {
    width: min(100%, calc(100dvh * 1100 / 680)) !important;
    max-width: none !important;
    max-height: 100dvh;
    margin: auto !important;
}

/* ============================================
   FIX: שאלת תמונה (תמרור) — שהתשובות לא יישפכו החוצה
   ============================================ */
.quiz-box { overflow: hidden; }

/* שורת השאלה — גובה גמיש עם תקרה */
.question-area {
    flex: 0 0 auto !important;
    max-height: 30%;
    min-height: 0;
}

/* אזור התמונה — גובה מוגבל, ממורכז */
.question-image-area {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 30%;
    min-height: 0;
    margin: 0;
}
.question-image-area img {
    max-height: 100% !important;
    max-width: 45% !important;
    width: auto;
    object-fit: contain;
}

/* גריד התשובות — תופס את שאר המקום ומתכווץ אם צריך */
.options-grid {
    flex: 1 1 0 !important;
    min-height: 0;
}
.options-grid .option-cell { min-height: 0; overflow: hidden; }

/* ============================================
   אנימציית מעבר בין מסכים — החלקה מימין (תחושת נסיעה)
   ============================================ */
/* אנימציית מעבר — החלקה מימין (תחושת נסיעה) */
@keyframes quizSlideIn {
    from { opacity: 0; transform: translateX(8%); }
    to   { opacity: 1; transform: translateX(0); }
}
.intro-screen,
.instructions-screen,
.name-screen,
.game-screen,
.results-screen,
.championship-screen {
    animation: quizSlideIn 0.5s cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ============================================
   שאלת "מי צודק" — לחיצה על כל הדמות + חיווי
   ============================================ */
.fig-character {
    cursor: pointer;
    border-radius: 12px;
    padding: 6px;
    transition: background 0.2s, transform 0.15s;
}
.fig-character:hover {
    background: rgba(255,255,255,0.12);
    transform: translateY(-3px);
}
.fig-character.correct .speech-bubble {
    background: #27ae60 !important;
    border-color: #27ae60 !important;
    color: #fff !important;
}
.fig-character.wrong .speech-bubble {
    background: #e74c3c !important;
    border-color: #e74c3c !important;
    color: #fff !important;
}
.fig-character.correct .fig-char-name { color: #27ae60; }
.fig-character.wrong   .fig-char-name { color: #e74c3c; }

/* "18 / 20" לא יישבר לעולם לשתי שורות */
.step-box { white-space: nowrap; }

/* ============================================
   מובייל לרוחב (מסך נמוך) — דחיסה כדי שהכל ייכנס
   (לא משפיע על דסקטופ/טאבלט)
   ============================================ */
@media (max-height: 600px) and (max-width: 1024px) {
    /* מסך פתיחה — גבוה יותר וקטן יותר כדי שלא יוסתר ע"י תמונת הרקע */
    .intro-content { top: 30%; left: 5%; }
    .intro-title-line h1 { font-size: clamp(16px, 3.5vw, 32px); }
    .intro-subtitle { font-size: clamp(10px, 2vw, 18px); }
    .intro-logo { width: clamp(50px, 9vw, 85px); }
    .start-btn-play { width: clamp(18px, 3vw, 30px); height: clamp(18px, 3vw, 30px); }

    /* כותרות ראשיות — קטנות יותר כדי לא לעלות על הקופסאות */
    .instructions-title { font-size: clamp(14px, 4.5vw, 28px); top: 2%; }
    .championship-title { font-size: clamp(15px, 4.5vw, 30px); top: 3%; }
    .results-title      { font-size: clamp(16px, 4vw, 30px); }
    .results-subtitle   { font-size: clamp(11px, 2.5vw, 20px); }
    .results-score      { font-size: clamp(9px, 2vw, 16px); }
    .results-topics-label { font-size: clamp(9px, 1.4vw, 13px); }
    .results-topics-list li { font-size: clamp(8px, 1.2vw, 11px); padding: 2px 8px; }
    .results-topics { margin-top: 4px; }
    .results-topics-list { gap: 4px; }
    .results-topics-footer { font-size: clamp(8px, 1.2vw, 12px); }
    .results-good-luck { font-size: clamp(10px, 1.8vw, 16px); }

    /* כפתור המשך — קטן ב-20% */
    .continue-btn span { font-size: clamp(14px, 2.4vw, 27px); }
    .continue-btn .play-icon { width: clamp(18px, 2.56vw, 29px); height: clamp(18px, 2.56vw, 29px); }

    /* מסך שם — תוכן בחצי הימני בלבד */
    .name-content { right: 2%; width: 46%; }
    .name-title { font-size: clamp(11px, 4.5vh, 22px); line-height: 1.2; }
    .name-input-field { height: clamp(28px, 7vh, 50px); font-size: clamp(11px, 3vh, 20px); }
    .name-continue-btn span { font-size: clamp(13px, 3.5vh, 22px); }

    /* מסך הוראות */
    .instructions-box p:last-child { margin-top: 0.5em; }
    .instructions-bg { height: 80%; bottom: 0; background-size: 100% auto; }
    .instructions-wrapper { top: 10%; bottom: 20%; left: 4%; right: 3%; }
    .instructions-box { max-width: 100%; gap: 2px; padding: 5px 14px; }
    .instructions-box p { font-size: clamp(6px, 1.28vw, 8.4px); line-height: 1.3; }
    .instructions-title { font-size: clamp(14px, 4vw, 21px); top: 2%; left: 4%; right: 23%; padding-right: 0; text-align: right; }

    /* לוח תוצאות — מרווח מתחת לכותרת */
    .championship-wrapper { top: 14%; bottom: 20%; }
    .championship-continue-btn span { font-size: clamp(14px, 2.4vw, 22px); }
    .championship-continue-btn .play-icon { width: clamp(18px, 2.5vw, 26px); height: clamp(18px, 2.5vw, 26px); }

    .stats-panel { gap: 1.5%; top: 3%; }
    .stats-label { font-size: 9px; margin-bottom: 1px; }
    .step-box { padding: 2px 3px; font-size: 16px; letter-spacing: 0.5px; }
    .score-box, .name-box { aspect-ratio: auto; height: 26px; font-size: 12px; }
    #quiz-timer { color: #e74c3c; border-color: #e74c3c; font-size: clamp(16px, 3vw, 28px); }
    .game-continue-btn { margin-top: 2%; }
    .game-continue-btn span { font-size: 16px; }
    .game-continue-btn .play-icon { width: 20px; height: 20px; }

    /* תיבת השאלה — טקסט תשובות קטן יותר שלא ייחתך */
    .quiz-box { top: 3%; bottom: 23%; padding: 1.5%; gap: 1.5%; }
    .question-area { font-size: 12px; padding: 1% 3%; }
    .option-cell { font-size: 12px; padding: 1% 2%; }

    /* שאלת דמויות — כל האלמנטים יכנסו ללא חריגה */
    .fig-area { flex: 1 1 0 !important; min-height: 0; overflow: hidden; }
    .fig-debate { overflow: hidden; height: 100%; align-items: flex-start; }
    .fig-character { flex: 1 1 0; min-height: 0; overflow: hidden; }
    .fig-avatar-img { height: clamp(50px, 14vw, 90px); }
    .speech-bubble { flex: 0 1 auto; min-height: 0; overflow: visible; font-size: 11px; padding: 4px 6px; }
    .speech-bubble::after, .speech-bubble::before { display: none; }
    .fig-char-name { font-size: clamp(10px, 1.8vw, 14px); flex-shrink: 0; }
    .explanation-area { flex: 0 0 auto; font-size: 11px; padding: 3px 8px; line-height: 1.2; max-height: 22%; overflow: hidden; }
    .game-screen > .game-continue-btn { bottom: calc(10% + 10px); left: 50%; transform: translateX(-50%); }
}

/* ============================================
   מסך סיום — מובייל פורטרט
   ============================================ */
@media (max-width: 768px) and (orientation: portrait) {
    /* תוכן — ממורכז בחלק העליון, ללא חפיפה עם התמונה */
    .results-content {
        top: 1%;
        padding: 0 3%;
    }
    .results-title      { font-size: clamp(24px, 8vw, 42px); margin-bottom: 0.05em; }
    .results-subtitle   { font-size: clamp(13px, 4vw, 22px); margin-bottom: 0.1em; }
    .results-score      { font-size: clamp(11px, 3.2vw, 18px); }
    .results-topics     { margin-top: 4px; }
    .results-topics-label { font-size: clamp(9px, 2.5vw, 13px); }
    .results-topics-list li { font-size: clamp(8px, 2.2vw, 12px); padding: 2px 8px; }
    .results-topics-list { gap: 4px; }
    .results-topics-footer { font-size: clamp(8px, 2vw, 12px); }
    .results-good-luck  { font-size: clamp(11px, 3vw, 16px); margin-top: 0.15em; }

    /* כפתור — פס השחור, צד ימין במובייל */
    .results-continue-btn {
        bottom: 4%;
        right: 4%;
        left: auto;
        transform: none;
    }
    .results-continue-btn span {
        font-size: clamp(13px, 3.5vw, 18px);
    }
    .results-continue-btn .play-icon {
        width: clamp(18px, 5vw, 26px);
        height: clamp(18px, 5vw, 26px);
    }
}
