/* ==========================================================================
   SISTERS OF TOMORROW — COMPLETE GAME STYLING
   African warm palette, Ankara borders, responsive canvas, glassmorphism HUDs.
   ========================================================================== */

:root {
    --color-bg-dawn: #fff7ed;
    --color-sun-gold: #f59e0b;
    --color-ankara-blue: #3b82f6;
    --color-emerald-green: #10b981;
    --color-terracotta: #e76f51;
    --color-dark-wood: #451a03;
    --color-text-dark: #1f2937;
    --color-text-light: #f9fafb;
    --font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #1e1b18;
    font-family: var(--font-family);
    color: var(--color-text-dark);
}

#app {
    position: relative;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #78350f 0%, #1c1917 100%);
    overflow: hidden;
}

#game-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#game-container canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
}

/* -------------------------------------------------------------------------- */
/* HUD OVERLAY CONTAINER                                                      */
/* -------------------------------------------------------------------------- */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 50;
}

/* -------------------------------------------------------------------------- */
/* TOP HEADER                                                                 */
/* -------------------------------------------------------------------------- */
.hud-header {
    pointer-events: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 18px;
    background: rgba(30, 27, 24, 0.82);
    backdrop-filter: blur(8px);
    border-bottom: 3px solid var(--color-sun-gold);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.header-brand:hover {
    transform: scale(1.02);
}

.sun-icon {
    font-size: 26px;
    animation: rotateSlow 20s linear infinite;
}

@keyframes rotateSlow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.brand-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #fef08a;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

.brand-subtitle {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: #fed7aa;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.header-stats {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stat-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    font-size: 0.82rem;
    color: #ffffff;
}

.level-badge strong {
    color: #fef08a;
    margin-left: 2px;
}

.stars-badge strong {
    color: #fcd34d;
    font-size: 0.95rem;
}

.hud-btn {
    pointer-events: auto;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    font-weight: 700;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.icon-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
}

.hud-btn:hover {
    background: var(--color-sun-gold);
    color: #1f2937;
    transform: scale(1.06);
}

/* -------------------------------------------------------------------------- */
/* FULLSCREEN OVERLAYS (MENU, LEVEL COMPLETE, CELEBRATION)                   */
/* -------------------------------------------------------------------------- */
.overlay-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 12, 10, 0.7);
    backdrop-filter: blur(4px);
    z-index: 60;
    padding: 20px;
}

.menu-card,
.modal-card,
.celebration-card {
    background: #fffbf5;
    border-radius: 18px;
    padding: 26px;
    max-width: 820px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.ankara-border {
    border: 4px solid #f59e0b;
    box-shadow: 0 0 0 4px #e76f51, 0 16px 40px rgba(0, 0, 0, 0.5);
}

.menu-hero-badge {
    display: inline-block;
    padding: 4px 14px;
    background: #fef3c7;
    color: #b45309;
    font-weight: 800;
    font-size: 0.78rem;
    border-radius: 999px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.menu-title {
    font-size: 1.85rem;
    font-weight: 900;
    color: #78350f;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.menu-tagline {
    font-size: 0.95rem;
    color: #4b5563;
    max-width: 620px;
    margin: 0 auto 18px auto;
    line-height: 1.45;
}

/* -------------------------------------------------------------------------- */
/* SISTERS PROFILES GRID                                                      */
/* -------------------------------------------------------------------------- */
.sisters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 22px;
    text-align: left;
}

.sister-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.sister-avatar-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-bottom: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.sister-name {
    font-size: 1rem;
    font-weight: 800;
    margin-bottom: 2px;
}

.sister-role {
    font-size: 0.72rem;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 6px;
}

.sister-quote {
    font-size: 0.76rem;
    font-style: italic;
    color: #4b5563;
    line-height: 1.35;
}

/* -------------------------------------------------------------------------- */
/* BUTTONS & ACTIONS                                                          */
/* -------------------------------------------------------------------------- */
.cta-btn {
    pointer-events: auto;
    border: none;
    border-radius: 999px;
    padding: 12px 28px;
    font-size: 1.05rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.play-btn {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.play-btn:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

.secondary-btn {
    background: #e5e7eb;
    color: #374151;
    margin-left: 10px;
}

.secondary-btn:hover {
    background: #d1d5db;
}

.pulse-glow {
    animation: pulseGlow 2s infinite ease-in-out;
}

@keyframes pulseGlow {
    0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.6); }
    70% { box-shadow: 0 0 0 14px rgba(245, 158, 11, 0); }
    100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.chapter-select {
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.chapter-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #6b7280;
}

.chapter-pills {
    display: flex;
    gap: 6px;
}

.chapter-pill {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s ease;
}

.chapter-pill:hover {
    background: #f59e0b;
    color: #ffffff;
    border-color: #f59e0b;
}

/* -------------------------------------------------------------------------- */
/* INTERACTIVE DIALOGUE OVERLAY                                               */
/* -------------------------------------------------------------------------- */
.dialogue-backdrop {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 820px;
    pointer-events: auto;
    z-index: 70;
}

.dialogue-box {
    background: rgba(255, 255, 255, 0.96);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    cursor: pointer;
}

.dialogue-speaker-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    color: #ffffff;
}

.speaker-avatar-wrap {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.speaker-name {
    font-size: 1.05rem;
    font-weight: 800;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.speaker-title {
    font-size: 0.75rem;
    opacity: 0.9;
    display: block;
}

.speaker-mood-badge {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.25);
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: capitalize;
}

.dialogue-body {
    padding: 18px;
}

.dialogue-text {
    font-size: 1.05rem;
    line-height: 1.5;
    color: #1f2937;
    font-weight: 500;
}

.dialogue-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 18px 12px 18px;
    border-top: 1px solid #f3f4f6;
}

.dialogue-counter {
    font-size: 0.78rem;
    font-weight: 700;
    color: #9ca3af;
}

.dialogue-next-btn {
    border: none;
    background: #f59e0b;
    color: #ffffff;
    font-weight: 800;
    border-radius: 999px;
    padding: 6px 16px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.dialogue-next-btn:hover {
    transform: scale(1.05);
    background: #d97706;
}

/* -------------------------------------------------------------------------- */
/* IN-GAME LEVEL HUDS                                                         */
/* -------------------------------------------------------------------------- */
.level-hud-bar {
    position: absolute;
    top: 64px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 860px;
    pointer-events: auto;
    z-index: 55;
}

.hud-card {
    background: rgba(255, 255, 255, 0.93);
    border: 2px solid #f59e0b;
    border-radius: 14px;
    padding: 12px 18px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.hud-card-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: #78350f;
    margin-bottom: 6px;
}

.hud-tip {
    font-size: 0.78rem;
    font-style: italic;
    color: #6b7280;
    margin-top: 6px;
}

/* Level 1 Badges */
.fragment-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.frag-badge {
    flex: 1;
    min-width: 140px;
    background: #f3f4f6;
    border: 1px dashed #9ca3af;
    border-radius: 8px;
    padding: 6px 10px;
    display: flex;
    flex-direction: column;
    font-size: 0.78rem;
}

.frag-badge.found {
    background: #d1fae5;
    border: 1px solid #10b981;
    color: #065f46;
}

/* Level 2 Market HUD */
.market-budget-row {
    display: flex;
    justify-content: space-around;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.85rem;
}

.budget-item strong {
    font-size: 1.05rem;
    margin-left: 4px;
}

.market-cart-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
    flex-wrap: wrap;
}

.cart-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #4b5563;
}

.cart-empty {
    font-size: 0.8rem;
    color: #9ca3af;
    font-style: italic;
}

.cart-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.cart-pill {
    border: none;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.pill-req {
    background: #d1fae5;
    color: #065f46;
}

.pill-dist {
    background: #fee2e2;
    color: #991b1b;
}

.market-actions-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
}

.market-hint {
    font-size: 0.76rem;
    font-weight: 600;
    color: #b45309;
}

.market-checkout-btn {
    background: #10b981;
    color: #ffffff;
    padding: 8px 18px;
    font-size: 0.88rem;
}

.market-checkout-btn:hover:not(:disabled) {
    background: #059669;
}

.market-checkout-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Level 3 Garden HUD */
.puzzle-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.puzzle-round-badge {
    background: #d1fae5;
    color: #065f46;
    font-weight: 800;
    font-size: 0.9rem;
    padding: 6px 14px;
    border-radius: 999px;
}

.puzzle-instruction {
    font-size: 0.85rem;
    color: #374151;
    font-weight: 500;
    flex: 1;
}

.replay-btn {
    padding: 6px 14px;
    background: #3b82f6;
    color: #ffffff;
    font-size: 0.82rem;
}

/* Level 4 Choices HUD */
.build-choice-card {
    text-align: center;
}

.build-stage-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #78350f;
}

.build-stage-subtitle {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 12px;
}

.build-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.build-option-box {
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.build-option-box:hover {
    border-color: #f59e0b;
    transform: translateY(-3px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.1);
}

.option-icon {
    font-size: 2rem;
    margin-bottom: 4px;
}

.option-name {
    font-size: 0.95rem;
    font-weight: 800;
    color: #1f2937;
    margin-bottom: 4px;
}

.option-desc {
    font-size: 0.78rem;
    color: #4b5563;
    line-height: 1.35;
    margin-bottom: 8px;
    flex: 1;
}

.option-perk {
    font-size: 0.75rem;
    font-weight: 800;
    color: #059669;
    background: #d1fae5;
    padding: 2px 8px;
    border-radius: 999px;
    margin-bottom: 8px;
}

.option-select-btn {
    border: none;
    background: #f59e0b;
    color: #ffffff;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.8rem;
    cursor: pointer;
}

/* -------------------------------------------------------------------------- */
/* LEVEL COMPLETE & CELEBRATION MODALS                                        */
/* -------------------------------------------------------------------------- */
.modal-stars-burst {
    font-size: 2.4rem;
    letter-spacing: 6px;
    margin-bottom: 8px;
    animation: starPulse 1.2s infinite ease-in-out;
}

@keyframes starPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.modal-title {
    font-size: 1.45rem;
    font-weight: 900;
    color: #78350f;
    margin-bottom: 8px;
}

.modal-message {
    font-size: 0.95rem;
    color: #4b5563;
    line-height: 1.45;
    margin-bottom: 18px;
}

.celebration-badge {
    display: inline-block;
    padding: 4px 16px;
    background: #fef3c7;
    color: #b45309;
    font-weight: 800;
    font-size: 0.82rem;
    border-radius: 999px;
    margin-bottom: 8px;
}

.celebration-title {
    font-size: 1.7rem;
    font-weight: 900;
    color: #78350f;
    margin-bottom: 8px;
}

.celebration-text {
    font-size: 0.95rem;
    color: #4b5563;
    line-height: 1.45;
    margin-bottom: 18px;
}

.celebration-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.stat-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.stat-card .stat-icon {
    font-size: 1.4rem;
    margin-bottom: 2px;
}

.stat-card strong {
    font-size: 1.1rem;
    color: #78350f;
}

.stat-card span {
    font-size: 0.72rem;
    color: #6b7280;
    text-align: center;
}

.celebration-quote {
    font-style: italic;
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
    padding: 12px 16px;
    border-radius: 8px;
    color: #78350f;
    font-size: 0.88rem;
    line-height: 1.4;
    margin-bottom: 20px;
    text-align: left;
}

.celebration-quote cite {
    display: block;
    margin-top: 6px;
    font-weight: 700;
    font-style: normal;
    color: #b45309;
}

/* -------------------------------------------------------------------------- */
/* GUIDE MODAL                                                                */
/* -------------------------------------------------------------------------- */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    pointer-events: auto;
    padding: 16px;
}

.guide-card {
    max-width: 540px;
    text-align: left;
}

.modal-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #6b7280;
}

.guide-chapter {
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f3f4f6;
}

.guide-chapter h4 {
    font-size: 0.92rem;
    color: #78350f;
    margin-bottom: 3px;
}

.guide-chapter p {
    font-size: 0.82rem;
    color: #4b5563;
    line-height: 1.4;
}

.guide-close-btn {
    width: 100%;
    margin-top: 10px;
    background: #f59e0b;
    color: #ffffff;
    padding: 10px;
    font-size: 0.95rem;
}

/* -------------------------------------------------------------------------- */
/* RESPONSIVE BREAKPOINTS                                                     */
/* -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .menu-title { font-size: 1.45rem; }
    .sisters-grid { grid-template-columns: repeat(2, 1fr); }
    .build-options-grid { grid-template-columns: 1fr; }
    .celebration-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .brand-subtitle { display: none; }
    .hud-header { padding: 8px 12px; }
}
