/* ═══════════════════════════════════════════════════════════
   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;
}

.btn-home {
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

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

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

/* ─── Hub Appeal (mission message + email capture) ─────── */

.hub-appeal {
    margin: 30px auto 20px;
    padding: 22px 20px;
    max-width: 640px;
    background: linear-gradient(135deg, rgba(255,215,0,0.08), rgba(231,76,60,0.08));
    border: 1px solid rgba(255,215,0,0.3);
    border-radius: 14px;
    text-align: center;
}

.hub-appeal-text {
    font-size: 15px;
    color: #fff;
    line-height: 1.5;
    margin-bottom: 14px;
}

.hub-appeal-form {
    display: flex;
    gap: 8px;
    max-width: 420px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.hub-appeal-input {
    flex: 1;
    min-width: 180px;
    padding: 10px 14px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    font-family: inherit;
}

.hub-appeal-input:focus {
    outline: none;
    border-color: #FFD700;
    background: rgba(0,0,0,0.5);
}

.hub-appeal-input::placeholder {
    color: rgba(255,255,255,0.4);
}

.hub-appeal-btn {
    padding: 10px 22px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #0a0a1e;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.1s, box-shadow 0.15s;
}

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

.hub-appeal-btn:active { transform: scale(0.97); }

.hub-appeal-thanks {
    font-size: 14px;
    color: #4ADE80;
    padding: 10px;
}

.hub-appeal-thanks.hidden { display: none; }

/* ─── Hub Language Selector ──────────────────────────────── */

.hub-lang-select {
    margin: 20px auto 30px;
    padding: 20px;
    max-width: 640px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,215,0,0.25);
    border-radius: 14px;
    text-align: center;
}

.hub-lang-label {
    font-size: 14px;
    color: rgba(255,215,0,0.85);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 14px;
}

.hub-lang-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.hub-lang-btn {
    flex: 1;
    min-width: 130px;
    max-width: 200px;
    padding: 14px 18px;
    background: rgba(255,255,255,0.08);
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 12px;
    color: #fff;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.hub-lang-btn:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,215,0,0.5);
}

.hub-lang-btn:active {
    transform: scale(0.97);
}

.hub-lang-btn.active {
    background: rgba(255,215,0,0.15);
    border-color: #FFD700;
}

.hub-lang-flag {
    font-size: 26px;
    line-height: 1;
}

.hub-lang-name {
    font-size: 18px;
    font-weight: bold;
    font-family: "Noto Sans Ethiopic", sans-serif;
}

.hub-lang-sub {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    letter-spacing: 1px;
}

/* ─── Voice Sub-Picker (appears when English is selected) ─── */

.voice-sub-picker {
    margin: 12px auto 0;
    padding: 14px 18px;
    max-width: 640px;
    background: rgba(0, 229, 255, 0.06);
    border: 1px solid rgba(0, 229, 255, 0.4);
    border-radius: 12px;
    animation: voicePickerSlide 0.25s ease-out;
}

.voice-sub-picker.hidden { display: none; }

.voice-sub-picker-label {
    font-size: 13px;
    color: #00E5FF;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 10px;
    text-align: center;
}

.voice-sub-picker-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.voice-sub-btn {
    flex: 1;
    max-width: 200px;
    padding: 10px 14px;
    background: rgba(255,255,255,0.08);
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.voice-sub-btn:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(0,229,255,0.6);
}

.voice-sub-btn:active { transform: scale(0.97); }

.voice-sub-btn.active {
    background: rgba(0,229,255,0.15);
    border-color: #00E5FF;
}

.voice-sub-flag { font-size: 20px; line-height: 1; }

.voice-sub-name {
    font-size: 16px;
    font-weight: bold;
    font-family: "Noto Sans Ethiopic", sans-serif;
}

.voice-sub-desc {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    letter-spacing: 0.5px;
}

@keyframes voicePickerSlide {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════════
   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;
}

/* ──────────────────────────────────────────────────────────
   Feedback widget (floating button + modal) and rating stars
   ────────────────────────────────────────────────────────── */

.feedback-fab {
    position: fixed;
    right: 14px;
    bottom: 14px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid #FFD700;
    background: rgba(10, 10, 30, 0.85);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    z-index: 9000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}
.feedback-fab:hover {
    background: rgba(20, 20, 50, 0.95);
    transform: scale(1.05);
}

.feedback-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.feedback-modal.hidden { display: none; }

.feedback-modal-content {
    width: 100%;
    max-width: 420px;
    background: #1a1a3a;
    border: 2px solid #FFD700;
    border-radius: 12px;
    padding: 18px;
    color: #fff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

.feedback-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.feedback-modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #FFD700;
}

.feedback-close {
    background: transparent;
    color: #fff;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}

.feedback-textarea,
.feedback-input {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid #444;
    background: #0a0a1e;
    color: #fff;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
}
.feedback-textarea { resize: vertical; min-height: 90px; }

.feedback-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 6px;
}

.feedback-thanks {
    text-align: center;
    padding: 24px 8px;
    color: #FFD700;
    font-size: 16px;
}
.feedback-thanks.hidden { display: none; }

/* Footer feedback link (sits in hub footer) */
.feedback-footer-link {
    background: none;
    border: none;
    color: #FFD700;
    cursor: pointer;
    text-decoration: underline;
    font: inherit;
    padding: 0 4px;
}

/* Rating widget appended inside levelCompleteOverlay */
.rating-widget {
    margin-top: 18px;
    padding: 14px;
    border-top: 1px solid rgba(255, 215, 0, 0.3);
    text-align: center;
}
.rating-question {
    color: #FFD700;
    margin-bottom: 8px;
    font-size: 15px;
}
.rating-stars {
    display: inline-flex;
    gap: 4px;
    margin-bottom: 6px;
}
.rating-star {
    background: none;
    border: none;
    color: #555;
    font-size: 32px;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
    transition: color 0.15s, transform 0.15s;
}
.rating-star.hover,
.rating-star:hover {
    color: #FFD700;
    transform: scale(1.15);
}
.rating-skip {
    display: block;
    margin: 6px auto 0;
    background: none;
    border: none;
    color: #aaa;
    font-size: 12px;
    cursor: pointer;
    text-decoration: underline;
}
.rating-thanks {
    color: #FFD700;
    font-size: 14px;
    padding: 8px 0;
}
.rating-thanks.hidden,
.rating-stars.hidden,
.rating-skip.hidden { display: none; }

/* Share modal — reuses .feedback-modal base, adds QR-specific bits */
.share-modal-content {
    text-align: center;
}
.share-qr-container {
    display: flex;
    justify-content: center;
    margin: 12px 0;
    padding: 12px;
    background: #fff;
    border-radius: 8px;
}
.share-qr {
    display: block;
    width: 220px;
    height: 220px;
}
.share-scan-text {
    margin: 10px 0 6px;
    color: #FFD700;
    font-size: 14px;
}
.share-link-input {
    text-align: center;
    font-size: 13px;
    color: #aef;
    background: #0a0a1e;
    cursor: text;
}
.share-modal-content .feedback-actions { justify-content: center; }

/* Install button (PWA Add-to-Home-Screen) — hidden by default */
#installBtn.hidden,
#installSep.hidden { display: none; }
