/* ========== RAMADAN 1446 JOURNEY ========== */
* { margin:0; padding:0; box-sizing:border-box; }

body {
    font-family: 'Fredoka', 'Comic Sans MS', sans-serif;
    background: #ffe9d6;
    padding: 0.8rem;
    color: #4a3b4c;
    min-height: 100vh;
}

body.girl-mode {
    background: #ffecf0;
    --header-bg: #ffdbeb;
}
body.boy-mode {
    background: #e4f5f1;
    --header-bg: #ccf0e6;
}

/* ===== HEADER ===== */
.candy-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    background: var(--header-bg, #ffdbeb);
    border-radius: 40px 40px 20px 20px;
    padding: 0.7rem 1.2rem;
    margin-bottom: 1.2rem;
    box-shadow: 0 8px 0 rgba(0,0,0,0.05);
    border: 4px solid white;
    gap: 0.8rem;
}
.greeting h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #613a4b;
    text-shadow: 2px 2px 0 #ffeec2;
}
.greeting p {
    font-size: 0.85rem;
    font-weight: 600;
    color: #6d495c;
    background: rgba(255,255,255,0.9);
    display: inline-block;
    padding: 0.2rem 1rem;
    border-radius: 30px;
    border: 3px solid white;
    margin-top: 4px;
    max-width: 100%;
    overflow-x: auto;
}
.toggle-candy {
    display: flex;
    gap: 5px;
    background: white;
    padding: 4px;
    border-radius: 50px;
    border: 3px solid #ffbcd6;
}
.candy-btn {
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 700;
    background: #ffe7f0;
    color: #733f4c;
    border: 3px solid transparent;
    box-shadow: 0 4px 0 #eba2b1;
    cursor: pointer;
}
.candy-btn.active {
    background: #fff2d4;
    border: 3px solid white;
    box-shadow: 0 4px 0 #ffb48a;
    transform: scale(0.96);
}
.stats-sprinkles {
    display: flex;
    gap: 12px;
    font-weight: 700;
    font-size: 0.85rem;
    background: #fffbe0;
    padding: 0.5rem 1.2rem;
    border-radius: 40px;
    border: 3px solid white;
    box-shadow: 0 5px 0 #eeda9e;
    color: #5e4b3c;
    width: 100%;
    justify-content: center;
}

/* ===== JOURNEY MAP ===== */
.journey-candy {
    background: rgba(255,255,255,0.8);
    border-radius: 40px;
    padding: 1.5rem 0.8rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 10px 20px #ffd9d9;
    border: 4px solid white;
}
.board-game {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}
.station-row {
    display: flex;
    justify-content: center;
    gap: 0.3rem 0.8rem;
    flex-wrap: wrap;
    margin-bottom: 0.3rem;
    width: 100%;
}
@media (max-width:600px) {
    .row1{margin-left:0} .row2{margin-left:15px}
    .row3{margin-left:-10px} .row4{margin-left:10px} .row5{margin-left:0}
}
@media (min-width:601px) {
    .row1{margin-left:-20px} .row2{margin-left:60px}
    .row3{margin-left:-40px} .row4{margin-left:30px} .row5{margin-left:-20px}
}

/* ===== STATIONS ===== */
.station {
    width: 60px; height: 60px;
    background: #ffe5c7;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; font-weight: 800; color: #5c3e4e;
    box-shadow: 0 10px 0 #d4a59a;
    border: 4px solid white;
    transform: rotate(-2deg);
    transition: all 0.2s;
    position: relative;
    margin: 4px 2px;
    flex-shrink: 0;
}
@media (min-width:768px) { .station{width:75px;height:75px;font-size:1.8rem} }

.station.current {
    width:70px; height:70px;
    background:#ffe79e;
    border: 6px solid #ffdbb5;
    box-shadow: 0 12px 0 #efb87e, 0 0 0 8px rgba(255,236,153,0.4);
    animation: wobble 0.9s infinite alternate;
    font-size:1.8rem; z-index:9;
}
@media (min-width:768px) { .station.current{width:90px;height:90px;font-size:2.2rem} }

.station.completed {
    background:#cfebcf; box-shadow:0 8px 0 #a8b98b;
    border-color:#f3ffe0; opacity:0.9;
}
.station.completed::before {
    content:"✓"; position:absolute; top:-8px; right:-8px;
    font-size:1.5rem; color:#8bb47e;
    text-shadow:2px 2px 0 white; transform:rotate(5deg);
}
.station.locked {
    filter:grayscale(0.6); opacity:0.7;
    background:#ddd1c5; box-shadow:0 8px 0 #b6a69c; pointer-events:none;
}
.station.locked::after {
    content:"🔒"; position:absolute; font-size:1.8rem;
    top:50%; left:50%; transform:translate(-50%,-50%);
    background:rgba(255,255,255,0.3); width:100%; height:100%;
    border-radius:50%; display:flex; align-items:center; justify-content:center;
}
.station.special { background:#ffe3ae; border:3px solid #ffd78c; }
.station.special::after {
    content:"✨"; position:absolute; top:-15px; font-size:1.3rem;
    left:50%; transform:translateX(-50%);
}
.station.jummah { background:#ffeab5; border:3px solid #ffd58c; }
.station.jummah::after {
    content:"📅"; position:absolute; top:-14px; font-size:1.1rem;
    left:50%; transform:translateX(-50%);
}
.station[data-tooltip]:hover::before {
    content:attr(data-tooltip); position:absolute; bottom:-35px;
    left:50%; transform:translateX(-50%);
    background:#FFF9E6; color:#5e4b3c; padding:5px 10px;
    border-radius:25px; font-size:0.7rem; font-weight:600;
    white-space:nowrap; border:3px solid white; box-shadow:0 4px 0 #DBA979; z-index:100;
}

/* ===== DAILY PANEL ===== */
.daily-candy-panel {
    display:none; background:#fffdf4; border-radius:40px;
    padding:1.2rem; border:5px solid white;
    box-shadow:0 12px 0 #eac0b0; margin-top:0.8rem;
}
.back-candy {
    background:#ffb1a5; color:white; font-size:1.1rem; font-weight:700;
    padding:10px 20px; border-radius:50px; border:4px solid white;
    box-shadow:0 8px 0 #b4716b; margin-bottom:1.2rem;
    display:inline-flex; gap:8px; cursor:pointer;
}

/* ===== CARDS ===== */
.cards-candy { display:grid; grid-template-columns:1fr; gap:1.2rem; }
@media (min-width:768px) { .cards-candy{grid-template-columns:repeat(2,1fr)} }

.candy-card {
    background:#fffcf0; border-radius:30px; padding:1.2rem;
    border:4px solid white; box-shadow:0 12px 0 #fdccb0;
    transition:all 0.18s; animation:cardFloat 0.5s both;
}
.candy-card:has(.memory-game-container) { grid-column:1 !important; }
@media (min-width:768px) {
    .candy-card:has(.memory-game-container) { grid-column:span 2 !important; }
}
.candy-card.special-card, .candy-card.jummah-card { grid-column:1 !important; width:100%; }
@media (min-width:768px) {
    .candy-card.special-card, .candy-card.jummah-card { grid-column:span 2 !important; }
}

.arabic-big {
    font-family:'Amiri',serif; font-size:1.5rem;
    background:#fef1d4; padding:0.5rem; border-radius:20px; margin:0.5rem 0;
}
.btn-candy {
    background:#fec8af; font-weight:700; font-size:1rem;
    padding:12px 18px; border-radius:60px; border:4px solid white;
    box-shadow:0 8px 0 #cf8e86; color:#4f3333;
    margin-top:12px; width:100%; cursor:pointer;
}
.btn-candy.completed { background:#bbdab6; box-shadow:0 8px 0 #8a9e7a; transform:translateY(4px); }

/* ===== MEMORY GAME ===== */
.memory-game-container {
    background:linear-gradient(145deg,#5b9887,#2c5e53);
    border-radius:24px; padding:12px; border:4px solid #ffcf7a;
    box-shadow:0 6px 0 #5a6e3f; margin:10px 0; width:100%;
}
.memory-grid {
    display:grid; grid-template-columns:repeat(3,1fr); gap:8px;
    background:#22564b; padding:10px; border-radius:16px; border:3px solid #facc7c;
}
.memory-tile {
    aspect-ratio:1; width:100%; border-radius:12px;
    display:flex; align-items:center; justify-content:center;
    font-size:1.6rem; border:3px solid #fff2c8; cursor:pointer;
    background:radial-gradient(circle at 30% 30%,#ffeac1,#dba959);
    box-shadow:0 5px 0 #7e623d;
}
.memory-tile.matched { background:radial-gradient(circle at 30% 30%,#d4edb0,#8fb36a); box-shadow:0 4px 0 #4f6b3a; border:3px solid #ffffb5; }
.memory-tile.question { background:radial-gradient(circle at 30% 30%,#ffb3c6,#e68a9e); font-size:1.4rem; }
.memory-status-bar {
    display:flex; justify-content:space-between; align-items:center;
    background:#ac804e; border-radius:40px; padding:6px 14px; margin-top:12px;
}
.memory-pairs-left {
    background:#281f0e; padding:5px 14px; border-radius:40px;
    color:#ffe3a5; font-size:0.9rem; font-weight:bold; border:3px solid #ffc777;
}
.memory-reset-btn {
    background:#ffdca8; border:none; border-bottom:5px solid #b87e4a;
    font-size:1.2rem; padding:5px 18px; border-radius:40px;
    font-weight:bold; color:#3a270f; cursor:pointer;
}

/* ==============================================
   PROGRESS BOOTH — THE ONLY DEFINITION, NO CONFLICTS
   ============================================== */
.progress-booth {
    background: #fffae5;
    border-radius: 40px;
    padding: 1.5rem;
    margin-top: 1.5rem;
    border: 5px solid white;
    box-shadow: 0 12px 0 #ecdba8;
}

/* THE stats row — always a horizontal row, period */
.stats-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 10px;
    width: 100%;
    margin: 12px 0;
}

/* Each card — equal thirds, can shrink small */
.stat-card {
    flex: 1 1 0;
    min-width: 0;
    background: #ffdbeb;
    padding: 12px 5px;
    border-radius: 20px;
    border: 4px solid white;
    box-shadow: 0 6px 0 #e68a9e;
    text-align: center;
}
.stat-card.green  { background:#d4f5d4; box-shadow:0 6px 0 #8fb36a; }
.stat-card.yellow { background:#ffeaa5; box-shadow:0 6px 0 #dbb786; }

.stat-icon   { font-size:1.8rem; line-height:1; margin-bottom:4px; display:block; }
.stat-number { font-size:1.3rem; font-weight:bold; color:#5e3c1f; display:block; }
.stat-label  { font-size:0.7rem; color:#6d495c; display:block; }

.badge-candy {
    background:#ffeec2; padding:8px 16px; border-radius:40px;
    border:4px solid white; font-weight:700; font-size:0.9rem;
    box-shadow:0 6px 0 #dbb786; display:inline-block;
}
.candy-hint {
    text-align:center; margin-top:20px; font-size:1rem; font-weight:700;
    color:#815e5e; background:white; display:inline-block;
    padding:8px 20px; border-radius:40px; border:4px solid #ffc6c6;
}



/* ===== TOUCH ===== */
button,.station,.memory-tile,.btn-candy,.back-candy {
    -webkit-tap-highlight-color:transparent; touch-action:manipulation;
}

/* ===== ANIMATIONS ===== */
@keyframes wobble {
    0%   { transform:rotate(-2deg) scale(1); }
    100% { transform:rotate(2deg) scale(1.05); }
}
@keyframes cardFloat {
    0%   { opacity:0; transform:translateY(20px); }
    100% { opacity:1; transform:translateY(0); }
}
@keyframes popIn {
    0%   { transform:translate(-50%,-50%) scale(0.5); opacity:0; }
    80%  { transform:translate(-50%,-50%) scale(1.1); }
    100% { transform:translate(-50%,-50%) scale(1); opacity:1; }
}
@keyframes popOut {
    0%   { transform:translate(-50%,-50%) scale(1); opacity:1; }
    100% { transform:translate(-50%,-50%) scale(0.5); opacity:0; }
}
@keyframes slideIn  { from{transform:translateX(100%);opacity:0} to{transform:translateX(0);opacity:1} }
@keyframes slideOut { from{transform:translateX(0);opacity:1} to{transform:translateX(100%);opacity:0} }
@keyframes slideUp  { from{transform:translate(-50%,100%);opacity:0} to{transform:translate(-50%,0);opacity:1} }
@keyframes slideDown{ from{transform:translate(-50%,0);opacity:1} to{transform:translate(-50%,100%);opacity:0} }
@keyframes confettiFall {
    0%   { transform:translateY(0) rotate(0deg); opacity:1; }
    100% { transform:translateY(100vh) rotate(720deg); opacity:0; }
}
@keyframes floatStar {
    0%   { transform:translateY(0) rotate(0deg); }
    100% { transform:translateY(-20px) rotate(10deg); }
}
@keyframes certPopIn  { 0%{transform:scale(0.8);opacity:0} 100%{transform:scale(1);opacity:1} }
@keyframes certPopOut { 0%{transform:scale(1);opacity:1} 100%{transform:scale(0.8);opacity:0} }
@keyframes fadeIn     { from{opacity:0} to{opacity:1} }

/* ===== MOBILE — ONE BLOCK ONLY ===== */
@media (max-width:600px) {
    body { padding:0.6rem; }
    .greeting h1 { font-size:1.3rem; }
    .stats-sprinkles { font-size:0.75rem; padding:0.4rem 0.8rem; gap:8px; }
    .station { width:50px; height:50px; font-size:1.3rem; }
    .station.current { width:60px; height:60px; font-size:1.6rem; }
    .memory-tile { font-size:1.3rem; }
    .candy-card { padding:1rem; }
    .btn-candy { font-size:0.9rem; padding:10px 16px; }

    /* stat card sizes on mobile — row stays horizontal */
    .stat-icon   { font-size:1.5rem; }
    .stat-number { font-size:1.1rem; }
    .stat-label  { font-size:0.62rem; }
}

/* ===== CRITICAL FIX FOR MOBILE CARD STACKING ===== */
@media (max-width: 600px) {
    /* Force ALL cards to stack vertically */
    .cards-candy {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
        width: 100% !important;
    }
    
    /* Every card takes full width */
    .candy-card {
        width: 100% !important;
        min-width: 100% !important;
        margin: 0 !important;
        grid-column: 1 !important;
    }
    
    /* Override any span 2 or grid settings */
    [style*="gridColumn: span 2"],
    [style*="grid-column: span 2"] {
        grid-column: 1 !important;
        width: 100% !important;
    }
    
    /* Fix memory game container */
    .candy-card:has(.memory-game-container) {
        grid-column: 1 !important;
        width: 100% !important;
    }
}

@media (max-width:380px) {
    .station         { width:45px !important; height:45px !important; font-size:1.2rem !important; }
    .station.current { width:55px !important; height:55px !important; font-size:1.5rem !important; }
    .stat-icon       { font-size:1.3rem; }
    .stat-number     { font-size:0.95rem; }
    .stat-label      { font-size:0.58rem; }
}

@media (max-height:500px) and (orientation:landscape) {
    .station         { width:45px; height:45px; font-size:1.2rem; }
    .station.current { width:55px; height:55px; font-size:1.5rem; }
    .journey-candy   { padding:1rem; }
}

@media print {
    .candy-top,.journey-candy,.daily-candy-panel,.progress-booth {
        box-shadow:none; border:2px solid #ccc;
    }
}


/* ===== TOGGLEABLE TEST PANEL ===== */
#testToggleBtn {
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

#testToggleBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 0 #b45f6f;
}

#testToggleBtn:active {
    transform: translateY(4px);
    box-shadow: 0 4px 0 #b45f6f;
}

#testPanel {
    animation: slideUp 0.3s ease;
    transform-origin: bottom right;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

#closeTestPanel {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #ffdbeb;
    transition: all 0.1s;
}

#closeTestPanel:hover {
    background: #ffb3c6;
    transform: scale(1.1);
}

#closeTestPanel:active {
    transform: scale(0.9);
}

/* ===== QUIZ STYLES ===== */
.quiz-container {
    background: linear-gradient(145deg, #ffe4b5, #ffd89c);
    border-radius: 30px;
    padding: 20px;
    border: 6px solid white;
    box-shadow: 0 8px 0 #dbb786;
    margin: 15px 0;
    width: 100%;
}

.quiz-option {
    background: #fff9e6;
    border: 4px solid white;
    border-bottom: 6px solid #dbb786;
    padding: 15px 10px;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 600;
    color: #5e3c1f;
    cursor: pointer;
    transition: all 0.05s;
    width: 100%;
    text-align: center;
    box-shadow: 0 4px 0 #dbb786;
}

.quiz-option:hover {
    transform: translateY(-2px);
}

.quiz-option:active {
    transform: translateY(2px);
    border-bottom-width: 2px;
    box-shadow: 0 2px 0 #dbb786;
}

.quiz-option.correct {
    background: #d4f5d4;
    border-bottom-color: #8fb36a;
    box-shadow: 0 4px 0 #8fb36a;
}

.quiz-option.wrong {
    background: #ffb3b3;
    border-bottom-color: #d48d8d;
    box-shadow: 0 4px 0 #d48d8d;
}

@media (max-width: 600px) {
    .quiz-container {
        padding: 15px;
    }
    
    .quiz-option {
        padding: 12px 8px;
        font-size: 0.9rem;
    }
}

@media (max-width: 380px) {
    .quiz-container {
        padding: 12px;
    }
    
    .quiz-option {
        padding: 10px 5px;
        font-size: 0.8rem;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes floatStar {
    0% { transform: translateY(0) rotate(0deg); }
    100% { transform: translateY(-30px) rotate(20deg); }
}

@keyframes confettiFall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.quiz-container .btn-candy.correct {
    background: #4CAF50 !important;
    border-bottom-color: #2E7D32 !important;
    transform: scale(1.05);
}

.quiz-container .btn-candy.wrong {
    background: #f44336 !important;
    border-bottom-color: #b71c1c !important;
}

.quiz-container .success-message {
    color: #4CAF50;
    font-weight: bold;
    margin-top: 10px;
    animation: popIn 0.3s;
}

.quiz-container .try-again-message {
    color: #f44336;
    font-weight: bold;
    margin-top: 10px;
}

/* WhatsApp Share Button */
.whatsapp-share-btn {
    background: #25D366;
    border: none;
    border-bottom: 6px solid #128C7E;
    padding: 15px 25px;
    border-radius: 60px;
    color: white;
    font-weight: bold;
    border: 4px solid white;
    cursor: pointer;
    font-size: 1.2rem;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 0 #128C7E;
    transition: all 0.05s;
    width: 100%;
    justify-content: center;
}

.whatsapp-share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 0 #128C7E;
}

.whatsapp-share-btn:active {
    transform: translateY(4px);
    box-shadow: 0 4px 0 #128C7E;
}

.whatsapp-share-btn i, 
.whatsapp-share-btn span {
    font-size: 1.5rem;
}