:root {
    --primary: #FF6B35;
    --secondary: #4ECDC4;
    --accent: #FFE066;
    --dark: #2D3142;
    --bg: #FFF9F0;
    --radius: 16px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--dark);
}

/* ---------- Ecran selectare limbă ---------- */
.lang-select-screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    background: linear-gradient(160deg, var(--secondary), var(--primary));
    color: white;
}
.lang-select-screen h1 { font-size: 64px; margin: 0; }
.lang-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 24px;
    width: 100%;
    max-width: 320px;
}
.lang-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    color: var(--dark);
    text-decoration: none;
    padding: 16px 20px;
    border-radius: var(--radius);
    font-size: 18px;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}
.flag { font-size: 28px; }

/* ---------- Header / Nav ---------- */
.app-header {
    background: var(--primary);
    color: white;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 10;
}
.logo { color: white; text-decoration: none; font-weight: 700; font-size: 18px; }
.main-nav a {
    color: white;
    text-decoration: none;
    margin-left: 14px;
    font-weight: 600;
    font-size: 14px;
}
.app-main { padding: 16px; max-width: 800px; margin: 0 auto; }
.app-footer { text-align: center; padding: 20px; color: #999; font-size: 13px; }

/* ---------- Grile ---------- */
.page-title { font-size: 24px; margin-bottom: 16px; }
.episode-grid, .coloring-grid, .product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
}
.episode-card, .coloring-card, .product-card {
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none;
    color: var(--dark);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform .15s ease;
}
.episode-card:active, .product-card:active { transform: scale(0.97); }
.episode-card img, .coloring-card img, .product-card img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
}
.episode-card-title, .product-card-title {
    padding: 10px;
    font-weight: 600;
    font-size: 14px;
}

/* ---------- Pagina episod ---------- */
.video-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: var(--radius);
    overflow: hidden;
    background: black;
}
.video-wrapper iframe { width: 100%; height: 100%; border: 0; }
.episode-title { font-size: 22px; margin: 16px 0 4px; }
.avg-rating { color: #888; font-size: 14px; margin-bottom: 10px; }
.episode-description { line-height: 1.6; }

/* ---------- Formular recenzie ---------- */
.review-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: white;
    padding: 16px;
    border-radius: var(--radius);
    margin: 16px 0;
}
.review-form input, .review-form textarea {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
}
.star-select { display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: 2px; }
.star-select input { display: none; }
.star-select label {
    font-size: 28px;
    color: #ddd;
    cursor: pointer;
}
.star-select input:checked ~ label,
.star-select label:hover,
.star-select label:hover ~ label { color: var(--accent); }
.review-form button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
}
.success-msg { color: #2e7d32; font-weight: 600; }
.error-msg { color: #c62828; font-weight: 600; }
.review-item {
    background: white;
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 10px;
}
.review-header { display: flex; justify-content: space-between; margin-bottom: 4px; }
.review-stars { color: var(--accent); }
.empty-state { color: #999; text-align: center; padding: 40px 0; }

/* ---------- Toolbar desen ---------- */
.draw-toolbar {
    background: white;
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 10px;
    position: sticky;
    top: 62px;
    z-index: 5;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.color-swatches {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    align-items: center;
}
.swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    padding: 0;
}
.swatch.active { border-color: var(--dark); transform: scale(1.1); }
#customColor {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    padding: 0;
    background: none;
    cursor: pointer;
}
.tool-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}
.brush-sizes { display: flex; gap: 4px; }
.brush-btn {
    width: 36px;
    height: 36px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
}
.brush-btn.active { border-color: var(--primary); background: #FFF3EC; }
.tool-btn {
    border: 2px solid #ddd;
    background: white;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.tool-btn.active { border-color: var(--primary); background: #FFF3EC; }
.tool-btn-primary { background: var(--secondary); color: white; border-color: var(--secondary); }

.canvas-wrapper {
    background: white;
    border-radius: var(--radius);
    padding: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.canvas-scroll {
    overflow: auto;
    max-height: 65vh;
    border-radius: 8px;
    background: #f0f0f0;
}
.canvas-stack {
    position: relative;
}
#baseCanvas, #drawCanvas {
    display: block;
    border-radius: 8px;
}
#baseCanvas {
    position: relative;
    z-index: 1;
}
#drawCanvas {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    touch-action: none;
    cursor: crosshair;
}

/* ---------- Zoom ---------- */
.zoom-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}
.zoom-label {
    font-weight: 700;
    font-size: 14px;
    min-width: 46px;
    text-align: center;
}

/* ---------- Produse ---------- */
.product-price {
    color: var(--primary);
    font-weight: 700;
    margin-top: 2px;
}

/* ---------- Meniuri personalizate ---------- */
.custom-page-content {
    background: white;
    padding: 18px;
    border-radius: var(--radius);
    line-height: 1.7;
}
.custom-item-desc {
    font-weight: 400;
    font-size: 12px;
    color: #777;
    margin-top: 2px;
}

/* ---------- Listă joculețe ---------- */
.quiz-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.quiz-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: white;
    border-radius: var(--radius);
    padding: 14px;
    text-decoration: none;
    color: var(--dark);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.quiz-card-icon { font-size: 36px; }
.quiz-card-title { font-weight: 700; font-size: 16px; }
.quiz-card-desc { font-size: 13px; color: #777; margin-top: 2px; }
.quiz-card-count { font-size: 12px; color: var(--secondary); font-weight: 600; margin-top: 4px; }

/* ---------- Joc trivia ---------- */
.quiz-game {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.quiz-progress { font-size: 13px; color: #888; font-weight: 600; margin-bottom: 6px; }
.quiz-progress-bar {
    height: 8px;
    background: #eee;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 18px;
}
.quiz-progress-fill {
    height: 100%;
    background: var(--secondary);
    transition: width .3s ease;
}
.quiz-question {
    font-size: 19px;
    font-weight: 700;
    margin-bottom: 18px;
    line-height: 1.4;
}
.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.quiz-option {
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    background: #FAFAFA;
    border: 2px solid #eee;
    border-radius: 12px;
    padding: 14px;
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    color: var(--dark);
}
.quiz-option:disabled { cursor: default; }
.quiz-option-letter {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    background: var(--secondary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
}
.quiz-option-correct {
    border-color: #22B14C !important;
    background: #EAFAF0 !important;
}
.quiz-option-correct .quiz-option-letter { background: #22B14C; }
.quiz-option-wrong {
    border-color: #ED1C24 !important;
    background: #FDEAEA !important;
}
.quiz-option-wrong .quiz-option-letter { background: #ED1C24; }
.quiz-feedback { margin-top: 18px; text-align: center; }
.quiz-feedback-correct { color: #22B14C; font-weight: 700; margin-bottom: 12px; font-size: 16px; }
.quiz-feedback-wrong { color: #ED1C24; font-weight: 700; margin-bottom: 12px; font-size: 16px; }

.quiz-result { text-align: center; padding: 10px 0; }
.quiz-result-emoji { font-size: 56px; }
.quiz-result-score { font-size: 32px; font-weight: 700; color: var(--primary); margin: 8px 0; }
.quiz-result-message { font-size: 15px; color: #666; margin-bottom: 20px; }
.quiz-back-link { display: block; margin-top: 14px; color: #888; font-size: 14px; }

/* ---------- Povești interactive ---------- */
.story-cover-placeholder {
    width: 100%;
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    background: #FFF3EC;
}
.story-game {
    background: white;
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.story-progress { font-size: 13px; color: #888; font-weight: 600; margin-bottom: 8px; }
.story-scene {
    position: relative;
    width: 100%;
    padding-bottom: 75%; /* raport 4:3, funcționează pe orice telefon */
    border-radius: 12px;
    overflow: hidden;
    background: #000;
}
.story-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.story-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.story-text {
    margin-top: 14px;
    font-size: 16px;
    line-height: 1.6;
    background: #FFF9F0;
    padding: 14px;
    border-radius: 12px;
}
.story-text-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
    margin-top: 14px;
}
.story-text-row .story-text { margin-top: 0; flex: 1; }
.story-audio-btn {
    background: var(--secondary);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 0 16px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
.story-action-btn {
    display: block;
    width: 100%;
    margin-top: 14px;
    padding: 14px;
    font-size: 16px;
}

/* Efect: tremur ecran (cutremur / grindină) */
.fx-shake { animation: fxShake 0.6s ease; }
@keyframes fxShake {
    0%, 100% { transform: translate(0,0); }
    20% { transform: translate(-8px, 4px); }
    40% { transform: translate(8px, -4px); }
    60% { transform: translate(-6px, -4px); }
    80% { transform: translate(6px, 4px); }
}

/* Efect: fulger / tunet */
.fx-flash { background: white; animation: fxFlash 0.9s ease; }
@keyframes fxFlash {
    0%, 100% { opacity: 0; }
    10%, 30% { opacity: 0.9; }
    20%, 40% { opacity: 0.1; }
    50% { opacity: 0.7; }
    60% { opacity: 0; }
}

/* Efect: întuneric (plaga întunericului) */
.fx-darken { background: black; animation: fxDarken 1.5s ease; }
@keyframes fxDarken {
    0% { opacity: 0; }
    50% { opacity: 0.92; }
    100% { opacity: 0; }
}

/* Efect: apă/sânge (Nilul transformat) */
.fx-blood { background: #8B0000; mix-blend-mode: multiply; animation: fxBlood 1.3s ease forwards; }
@keyframes fxBlood {
    0% { opacity: 0; }
    60% { opacity: 0.75; }
    100% { opacity: 0.55; }
}

/* Particule căzătoare (insecte / stele / pâine) */
.fx-particle {
    position: absolute;
    top: -10%;
    animation-name: fxFall;
    animation-timing-function: ease-in;
    animation-fill-mode: forwards;
}
@keyframes fxFall {
    0% { top: -10%; opacity: 0; transform: rotate(0deg); }
    10% { opacity: 1; }
    100% { top: 105%; opacity: 1; transform: rotate(180deg); }
}

/* Efect: marea despărțită */
.fx-sea-left, .fx-sea-right {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 50%;
    background: linear-gradient(180deg, #1E90FF, #0047AB);
    transition: transform 1.2s ease-in-out;
}
.fx-sea-left { left: 0; }
.fx-sea-right { right: 0; }
.fx-sea-left.fx-sea-open { transform: translateX(-100%); }
.fx-sea-right.fx-sea-open { transform: translateX(100%); }

/* Ecran final poveste */
.story-end { text-align: center; padding: 10px 0; }
.story-end-emoji { font-size: 56px; }
.story-end-title { font-size: 20px; font-weight: 700; margin-top: 6px; }
.story-end-message { font-size: 15px; color: #666; margin: 8px 0 20px; }

/* ---------- Profil jucător ---------- */
.player-intro {
    background: #FFF3EC;
    padding: 14px;
    border-radius: var(--radius);
    line-height: 1.6;
    margin-bottom: 16px;
}
.player-status {
    font-size: 13px;
    color: #777;
    margin-bottom: 16px;
}
.player-status a { color: var(--primary); font-weight: 600; }

/* ---------- Joc blocat ---------- */
.quiz-card-locked {
    opacity: 0.55;
    cursor: default;
}

/* ---------- Clasament ---------- */
.leaderboard-list {
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.leaderboard-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
}
.leaderboard-row:last-child { border-bottom: none; }
.leaderboard-row-me { background: #FFF3EC; }
.leaderboard-rank {
    width: 28px;
    font-weight: 700;
    color: var(--secondary);
    text-align: center;
}
.leaderboard-name { flex: 1; font-weight: 600; }
.leaderboard-score { font-weight: 700; color: var(--primary); }
.quiz-create-profile-link {
    display: inline-block;
    margin-left: 8px;
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 12px;
}
