/* ==========================================================
   ثيم قبطان البحار الصغير (The Little Sea Captain)
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@500;700;800;900&display=swap');

:root {
    /* باليت الألوان البحرية */
    --deep-sea-blue: #0F2042;
    --turquoise-water: #00A896;
    --amber-yellow: #FAB800;
    --creamy-white: #F8F9FA;
    --lifebuoy-red: #E63946;
    --wood-brown: #8B5A2B;
    --wood-light: #A0522D;
    
    --text-dark: #1D3557;
    --white: #FFFFFF;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Tajawal', 'Cairo', sans-serif;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" style="font-size:30px"><text y="30">⚓</text></svg>') 10 30, auto !important;
}

body {
    /* خلفية أعماق البحر */
    background: linear-gradient(to bottom, #48CAE4 0%, #0077B6 50%, var(--deep-sea-blue) 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--creamy-white);
    overflow-x: hidden;
    padding-bottom: 120px;
    position: relative;
}

/* ================== تأثيرات الخلفية ================== */
.sea-bubbles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bubble {
    position: absolute;
    bottom: -50px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation: rise 10s infinite ease-in;
}

.fish-shadow {
    position: absolute;
    opacity: 0.1;
    font-size: 5rem;
    animation: swim 20s infinite linear;
    z-index: 0;
}

@keyframes rise {
    0% { transform: translateY(0) scale(1); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translateY(-100vh) scale(1.5); opacity: 0; }
}

@keyframes swim {
    0% { transform: translateX(-150px) translateY(100px); }
    100% { transform: translateX(110vw) translateY(50px); }
}

/* ================== العناوين ================== */
.welcome-msg h2, .sosawy-logo, .lesson-overlay h2 {
    color: var(--amber-yellow);
    font-size: 4.5rem;
    font-weight: 900;
    text-align: center;
    text-shadow: 3px 3px 0 var(--text-dark), -1px -1px 0 var(--text-dark), 2px -2px 0 var(--text-dark), -2px 2px 0 var(--text-dark);
    margin: 20px 0;
    animation: float-wave 3s ease-in-out infinite alternate;
    position: relative;
    z-index: 10;
}

/* ================== الهيدر العلوي ================== */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: rgba(15, 32, 66, 0.8);
    border-bottom: 8px solid var(--wood-brown);
    border-radius: 0 0 30px 30px;
    box-shadow: 0 10px 15px rgba(0,0,0,0.5);
    margin-bottom: 40px;
    position: relative;
    z-index: 10;
    backdrop-filter: blur(5px);
}

.stars-panel {
    background: var(--amber-yellow);
    padding: 10px 30px;
    border-radius: 50px;
    border: 4px solid var(--text-dark);
    box-shadow: 0 6px 0 var(--wood-brown);
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.3s;
}

.stars-panel:hover {
    transform: translateY(-5px) scale(1.05);
}

.sosawy-tool-btn {
    background: var(--turquoise-water);
    border: 4px solid var(--creamy-white);
    border-radius: 50%;
    width: 70px;
    height: 70px;
    font-size: 2rem;
    color: var(--white);
    box-shadow: 0 6px 0 var(--deep-sea-blue);
    cursor: pointer;
    transition: all 0.2s;
}

.sosawy-tool-btn:active {
    transform: translateY(6px);
    box-shadow: 0 0 0 var(--deep-sea-blue);
}

/* ================== البطاقات (نوافذ السفينة) ================== */
.sosawy-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 10;
}

.sosawy-grid, .sosawy-lesson-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 40px;
    padding: 20px 0;
}

.chapter-card, .lesson-card, .mode-card {
    background: rgba(248, 249, 250, 0.95);
    border: 10px solid var(--wood-brown);
    border-radius: 50%; /* شكل نافذة السفينة Porthole */
    padding: 40px 20px;
    text-align: center;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5), 0 10px 15px rgba(0,0,0,0.4);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    aspect-ratio: 1/1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    max-width: 280px;
    margin: 0 auto;
}

.chapter-card::before, .lesson-card::before, .mode-card::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 4px solid var(--amber-yellow);
    top: 0;
    left: 0;
    box-sizing: border-box;
    pointer-events: none;
}

.chapter-icon {
    font-size: 5.5rem;
    margin-bottom: 15px;
    display: block;
    filter: drop-shadow(3px 3px 2px rgba(0,0,0,0.3));
}

.chapter-card h3, .lesson-card h3 { 
    font-size: 2rem; 
    font-weight: 900; 
    margin-bottom: 5px;
    color: var(--text-dark);
}

.chapter-card p, .lesson-card p { 
    font-size: 1.3rem; 
    font-weight: 800; 
    color: var(--turquoise-water); 
}

/* التفاعل */
.chapter-card:hover, .lesson-card:hover, .mode-card:hover {
    transform: translateY(-10px) scale(1.05);
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5), 0 20px 25px rgba(0,0,0,0.6);
    border-color: var(--wood-light);
}

.chapter-card:active, .lesson-card:active, .mode-card:active {
    transform: translateY(5px);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.8), 0 5px 5px rgba(0,0,0,0.6);
}

/* ================== أزرار الأكشن (عوامة الإنقاذ / عجلة القيادة) ================== */
.btn-action {
    background: var(--lifebuoy-red);
    color: white;
    border: 6px dashed var(--creamy-white);
    border-radius: 50px; 
    padding: 15px 35px;
    font-size: 2.2rem;
    font-weight: 900;
    box-shadow: 0 8px 0 var(--deep-sea-blue);
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    display: inline-block;
    position: relative;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.btn-action.success {
    background: var(--turquoise-water);
    border: 6px dashed var(--creamy-white);
}

.btn-action:hover {
    transform: translateY(-5px);
    animation: float-wave 2s infinite alternate;
}

.btn-action:active {
    transform: translateY(8px);
    box-shadow: 0 0 0 var(--deep-sea-blue);
    animation: none;
}

/* ================== نافذة الدروس (Overlay) ================== */
.sosawy-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 32, 66, 0.95);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    padding: 30px;
    overflow-y: auto;
    backdrop-filter: blur(10px);
}

.sosawy-overlay.hidden {
    display: none;
}

.close-btn {
    background: var(--lifebuoy-red);
    color: var(--creamy-white);
    border: 4px solid var(--creamy-white);
    border-radius: 50%;
    width: 70px;
    height: 70px;
    font-size: 2.5rem;
    font-weight: 900;
    box-shadow: 0 6px 0 var(--text-dark);
    cursor: pointer;
    align-self: flex-start;
    margin-bottom: 20px;
    transition: all 0.2s;
}
.close-btn:hover { transform: scale(1.1); }
.close-btn:active { transform: translateY(6px); box-shadow: 0 0 0 var(--text-dark); }

/* ================== الحركات ================== */
@keyframes float-wave {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-8px) rotate(2deg); }
    100% { transform: translateY(0px) rotate(-2deg); }
}

@keyframes pop {
    0% { transform: scale(0.5); opacity: 0; }
    80% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); }
}

.bounce-in {
    animation: pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* ================== Media Queries ================== */
@media (max-width: 768px) {
    .welcome-msg h2, .sosawy-logo, .lesson-overlay h2 { font-size: 3rem; }
    .main-header { flex-direction: column; gap: 15px; border-radius: 0 0 20px 20px;}
    .chapter-icon { font-size: 4.5rem; }
    .chapter-card h3 { font-size: 1.8rem; }
    .btn-action { font-size: 1.8rem !important; padding: 15px 20px !important; }
    .sosawy-overlay { padding: 15px; }
    .chapter-card, .lesson-card, .mode-card { padding: 20px 10px; }
    
    /* Override inline styles */
    [style*="font-size: 8rem"], [style*="font-size:8rem"] { font-size: 5rem !important; }
    [style*="font-size: 6rem"], [style*="font-size:6rem"] { font-size: 4rem !important; }
    [style*="font-size: 5rem"], [style*="font-size:5rem"] { font-size: 3rem !important; }
    [style*="font-size: 4rem"], [style*="font-size:4rem"] { font-size: 2.5rem !important; }
    [style*="font-size: 3rem"], [style*="font-size:3rem"] { font-size: 2rem !important; }
    [style*="font-size: 2.5rem"], [style*="font-size:2.5rem"] { font-size: 1.8rem !important; }
    
    [style*="width: 120px"], [style*="width:120px"] { width: 80px !important; height: 80px !important; }
    [style*="width: 100px"], [style*="width:100px"] { width: 70px !important; height: 70px !important; }
    [style*="width: 90px"], [style*="width:90px"] { width: 60px !important; height: 60px !important; }
    [style*="width: 70px"], [style*="width:70px"] { width: 50px !important; height: 50px !important; }
    
    [style*="gap: 20px"], [style*="gap:20px"] { gap: 10px !important; }
    [style*="gap: 30px"], [style*="gap:30px"] { gap: 15px !important; }
}

@media (max-width: 480px) {
    .welcome-msg h2, .sosawy-logo, .lesson-overlay h2 { font-size: 2.2rem; }
    .chapter-card, .lesson-card, .mode-card { padding: 15px 10px; }
    .chapter-icon { font-size: 3.5rem; }
    
    [style*="font-size: 8rem"], [style*="font-size:8rem"] { font-size: 4rem !important; }
    [style*="font-size: 6rem"], [style*="font-size:6rem"] { font-size: 3rem !important; }
    [style*="font-size: 5rem"], [style*="font-size:5rem"] { font-size: 2.5rem !important; }
    [style*="font-size: 4rem"], [style*="font-size:4rem"] { font-size: 2rem !important; }
    [style*="font-size: 3rem"], [style*="font-size:3rem"] { font-size: 1.5rem !important; }
    
    [style*="width: 120px"], [style*="width:120px"] { width: 60px !important; height: 60px !important; }
    [style*="width: 100px"], [style*="width:100px"] { width: 50px !important; height: 50px !important; }
    [style*="width: 90px"], [style*="width:90px"] { width: 45px !important; height: 45px !important; }
    [style*="width: 70px"], [style*="width:70px"] { width: 35px !important; height: 35px !important; }
    
    [style*="padding: 40px"], [style*="padding:40px"] { padding: 20px !important; }
    [style*="padding: 30px"], [style*="padding:30px"] { padding: 15px !important; }
    [style*="padding: 20px"], [style*="padding:20px"] { padding: 10px !important; }
}

/* ================== زر الرئيسية ================== */
.home-btn-sea {
    position: fixed;
    top: 15px;
    right: 15px;
    background: var(--deep-sea-blue);
    color: var(--creamy-white);
    padding: 10px 25px;
    border: 3px solid var(--amber-yellow);
    border-radius: 30px;
    text-decoration: none;
    font-weight: 900;
    font-size: 1.5rem;
    box-shadow: 0 4px 0 var(--turquoise-water);
    z-index: 1500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}
.home-btn-sea:hover {
    transform: translateY(-5px);
    background: var(--turquoise-water);
    box-shadow: 0 6px 0 var(--deep-sea-blue);
}
.home-btn-sea:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 var(--deep-sea-blue);
}

/* ================== الفوتر ================== */
.sosawy-footer {
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    width: 100%;
    position: relative;
    z-index: 10;
}

.sosawy-footer a {
    color: var(--amber-yellow);
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    transition: color 0.2s;
    background: rgba(15, 32, 66, 0.5);
    padding: 10px 20px;
    border-radius: 20px;
    display: inline-block;
}

.sosawy-footer a:hover {
    color: var(--creamy-white);
    background: rgba(15, 32, 66, 0.8);
}
