/* ═══════════════════════════════════════════════════════════
   Ge'ez Fidel Bubble Shooter - Styles
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Ethiopic:wght@400;700&display=swap');

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

body {
    background: #0a0a1e;
    color: #ffffff;
    font-family: 'Noto Sans Ethiopic', 'Segoe UI', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    user-select: none;
    -webkit-user-select: none;
}

/* ─── Game Container ──────────────────────────────────────── */

.game-container {
    position: relative;
    width: 480px;
    max-width: 100vw;
    aspect-ratio: 480 / 720;
    border-radius: 12px;
    overflow: hidden;
    box-shadow:
        0 0 40px rgba(74, 144, 226, 0.2),
        0 0 80px rgba(74, 144, 226, 0.1);
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    touch-action: none;
    -ms-touch-action: none;
}

/* ─── Overlays ────────────────────────────────────────────── */

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(10, 10, 30, 0.92);
    z-index: 10;
    padding: 30px;
    text-align: center;
    transition: opacity 0.3s ease;
}

.overlay.hidden {
    display: none;
}

.overlay h1 {
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 5px;
    background: linear-gradient(135deg, #E63946, #F4A261, #E9C46A, #2A9D8F, #4361EE, #7B2D8E, #00B4D8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 2px;
}

.overlay h2 {
    font-size: 20px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 30px;
}

.overlay h3 {
    font-size: 26px;
    color: #FFD700;
    margin-bottom: 10px;
}

.overlay p {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 12px;
    line-height: 1.5;
    max-width: 380px;
}

.overlay .score-display {
    font-size: 48px;
    font-weight: 700;
    color: #FFD700;
    margin: 10px 0 20px;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
}

/* ─── Buttons ─────────────────────────────────────────────── */

.btn {
    display: inline-block;
    padding: 14px 40px;
    margin: 8px;
    font-family: 'Noto Sans Ethiopic', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(135deg, #4361EE, #7B2D8E);
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 1px;
    text-transform: uppercase;
    min-width: 180px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(67, 97, 238, 0.4);
}

.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background: linear-gradient(135deg, #2a2a4e, #3a3a5e);
    font-size: 14px;
    padding: 10px 30px;
}

.btn-secondary:hover {
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
}

.btn-success {
    background: linear-gradient(135deg, #2A9D8F, #264653);
}

.btn-success:hover {
    box-shadow: 0 6px 20px rgba(42, 157, 143, 0.4);
}

.btn-demo {
    background: linear-gradient(135deg, #B8860B, #8B6914);
    font-size: 14px;
    padding: 10px 30px;
}

.btn-demo:hover {
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}

/* ─── Mode Selection Buttons ─────────────────────────────── */

.mode-select {
    display: flex;
    gap: 12px;
    margin: 15px 0;
    width: 100%;
    max-width: 400px;
    justify-content: center;
}

.btn-mode {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 14px;
    min-width: 150px;
    border-radius: 16px;
    background: linear-gradient(135deg, #1a1a3e, #2a2a5e);
    border: 2px solid rgba(67, 97, 238, 0.3);
    transition: all 0.25s ease;
}

.btn-mode:hover {
    border-color: rgba(67, 97, 238, 0.8);
    box-shadow: 0 6px 25px rgba(67, 97, 238, 0.3);
    transform: translateY(-3px);
}

.btn-vowel {
    border-color: rgba(42, 157, 143, 0.3);
}

.btn-vowel:hover {
    border-color: rgba(42, 157, 143, 0.8);
    box-shadow: 0 6px 25px rgba(42, 157, 143, 0.3);
}

.mode-icon {
    font-size: 28px;
    margin-bottom: 6px;
}

.mode-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.mode-desc {
    font-size: 11px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.6);
    text-transform: none;
    letter-spacing: 0;
    line-height: 1.3;
}

/* ─── How to Play ─────────────────────────────────────────── */

.how-to-play-content {
    max-height: 80vh;
    overflow-y: auto;
    padding: 10px;
    width: 100%;
    max-width: 400px;
}

.how-to-play-content h3 {
    font-size: 18px;
    color: #4361EE;
    margin: 15px 0 8px;
    text-align: left;
}

.how-to-play-content p {
    font-size: 13px;
    text-align: left;
    margin-bottom: 8px;
}

.how-to-play-content ul {
    text-align: left;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    padding-left: 20px;
    margin-bottom: 10px;
}

.how-to-play-content li {
    margin-bottom: 5px;
    line-height: 1.4;
}

/* ─── Color Legend ─────────────────────────────────────────── */

#colorLegend {
    width: 100%;
    margin: 10px 0;
}

.legend-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
}

.legend-swatch {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.legend-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

/* ─── Level Complete Extras ────────────────────────────────── */

.new-families-label {
    font-size: 14px !important;
    color: #2A9D8F !important;
    margin-top: 10px !important;
}

.family-preview {
    display: inline-block;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 12px;
    margin: 3px;
    border-radius: 15px;
    font-size: 14px;
}

/* ─── Title Fidel Characters ──────────────────────────────── */

.title-fidel {
    font-size: 56px;
    letter-spacing: 8px;
    margin-bottom: 5px;
    opacity: 0.9;
}

/* ─── Responsive ──────────────────────────────────────────── */

@media (max-width: 500px) {
    .game-container {
        width: 100vw;
        border-radius: 0;
        max-height: 100vh;
    }

    .overlay h1 {
        font-size: 32px;
    }

    .overlay h2 {
        font-size: 16px;
    }

    .btn {
        padding: 12px 30px;
        font-size: 16px;
    }
}

@media (max-height: 720px) {
    body {
        align-items: flex-start;
    }
    .game-container {
        max-height: 100vh;
    }
}

/* ─── Scrollbar for How to Play ───────────────────────────── */

.how-to-play-content::-webkit-scrollbar {
    width: 4px;
}

.how-to-play-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.how-to-play-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

/* ═══════════════════════════════════════════════════════════
   HUB PAGE — Game Selection
   ═══════════════════════════════════════════════════════════ */

.hub-container {
    max-width: 540px;
    width: 100%;
    padding: 30px 20px;
    text-align: center;
}

.hub-header {
    margin-bottom: 30px;
}

.hub-header h1 {
    font-size: 42px;
    font-weight: 700;
    background: linear-gradient(135deg, #E63946, #F4A261, #E9C46A, #2A9D8F, #4361EE, #7B2D8E, #00B4D8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 3px;
    margin-bottom: 5px;
}

.hub-header h2 {
    font-size: 18px;
    color: rgba(255,255,255,0.6);
    font-weight: 400;
    margin-bottom: 15px;
}

.hub-header p {
    font-size: 14px;
    color: rgba(255,255,255,0.5);
    line-height: 1.5;
    max-width: 400px;
    margin: 0 auto;
}

.hub-header .title-fidel {
    font-size: 56px;
    letter-spacing: 8px;
    margin-bottom: 5px;
    opacity: 0.9;
}

/* ─── Game Cards ──────────────────────────────────────────── */

.game-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 30px;
}

.game-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px;
    background: linear-gradient(135deg, #111133, #1a1a44);
    border: 2px solid rgba(67, 97, 238, 0.2);
    border-radius: 16px;
    text-decoration: none;
    color: #fff;
    transition: all 0.25s ease;
    cursor: pointer;
}

.game-card:hover {
    border-color: rgba(67, 97, 238, 0.7);
    box-shadow: 0 6px 30px rgba(67, 97, 238, 0.2);
    transform: translateY(-2px);
}

.game-card-icon {
    flex-shrink: 0;
    width: 120px;
    height: 120px;
    border-radius: 12px;
    overflow: hidden;
}

.game-card-icon canvas {
    display: block;
    width: 120px;
    height: 120px;
}

.coming-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.05);
    font-size: 40px;
}

.game-card-info {
    flex: 1;
    text-align: left;
}

.game-card-info h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 6px;
    color: #fff;
}

.game-card-info p {
    font-size: 13px;
    color: rgba(255,255,255,0.6);
    line-height: 1.4;
    margin-bottom: 8px;
}

.game-card-modes {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.mode-tag {
    display: inline-block;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 10px;
    background: rgba(67, 97, 238, 0.2);
    color: #7B9FFF;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tag-learn {
    background: rgba(42, 157, 143, 0.2);
    color: #5ECFBF;
}

.tag-coming {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.4);
}

.game-card-coming {
    opacity: 0.45;
    cursor: default;
    pointer-events: none;
}

/* ─── Back Link ──────────────────────────────────────────── */

.back-link {
    position: absolute;
    top: 15px;
    left: 15px;
    color: rgba(255,255,255,0.5);
    text-decoration: none;
    font-size: 14px;
    z-index: 20;
    transition: color 0.2s;
}

.back-link:hover {
    color: #fff;
}

/* ─── Hub Footer ─────────────────────────────────────────── */

.hub-footer p {
    font-size: 12px;
    color: rgba(255,255,255,0.3);
    letter-spacing: 1px;
}

/* ═══════════════════════════════════════════════════════════
   LANGUAGE PICKER
   ═══════════════════════════════════════════════════════════ */

.lang-picker {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 1000;
}

.lang-picker-btn {
    background: rgba(20, 20, 50, 0.9);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: all 0.2s;
}

.lang-picker-btn:hover {
    border-color: rgba(67, 97, 238, 0.6);
    background: rgba(30, 30, 70, 0.95);
}

.lang-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: rgba(15, 15, 40, 0.97);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    overflow: hidden;
    min-width: 150px;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}

.lang-dropdown.hidden {
    display: none;
}

.lang-option {
    display: block;
    width: 100%;
    background: none;
    border: none;
    color: #fff;
    padding: 10px 16px;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
}

.lang-option:hover {
    background: rgba(67, 97, 238, 0.25);
}

/* RTL support */
[dir="rtl"] .game-card-info {
    text-align: right;
}

[dir="rtl"] .back-link {
    left: auto;
    right: 15px;
}

[dir="rtl"] .lang-picker {
    right: auto;
    left: 10px;
}

[dir="rtl"] .lang-dropdown {
    right: auto;
    left: 0;
}
