/* style.css - Wholesome, cheerful styling for Adoption Story: Baby Dragons */

:root {
    --primary: #38bdf8;
    --primary-dark: #0284c7;
    --accent: #f43f5e;
    --bg-dark: #0f172a;
    --card-bg: rgba(255, 255, 255, 0.88);
    --glass-border: rgba(255, 255, 255, 0.4);
    --text-dark: #1e293b;
    --font-heading: 'Fredoka', cursive, sans-serif;
    --font-body: 'Outfit', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    font-family: var(--font-body);
    color: var(--text-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    max-width: calc(100vh * (16 / 9));
    max-height: 100vh;
    aspect-ratio: 16 / 9;
    display: flex;
    flex-direction: column;
    background: #0f172a;
    border-radius: 0;
    overflow: hidden;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.7);
    margin: auto;
}

/* Header & HUD */
#top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 18px;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(10px);
    z-index: 10;
    border-bottom: 2px solid rgba(255, 255, 255, 0.15);
}

.hud-left, .hud-right, .hud-center {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hud-btn {
    text-decoration: none;
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.2s ease;
}

.hud-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.hud-badge {
    background: linear-gradient(135deg, #38bdf8, #818cf8);
    color: #ffffff;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 14px;
    padding: 6px 16px;
    border-radius: 999px;
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.4);
}

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

.chapter-jump-btn {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e2e8f0;
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.chapter-jump-btn:hover {
    background: #38bdf8;
    color: #0f172a;
}

/* Canvas Area */
#canvas-wrapper {
    position: relative;
    flex: 1;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
    overflow: hidden;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: #0f172a;
}

/* Dialogue Toast */
#dialogue-toast {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-30px);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    padding: 12px 28px;
    border-radius: 30px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
    border: 3px solid #38bdf8;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 25;
    max-width: 85%;
    text-align: center;
}

#dialogue-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

#toast-speaker {
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 700;
    color: #0284c7;
    margin-bottom: 3px;
}

#toast-text {
    font-family: var(--font-body);
    font-size: 17px;
    font-weight: 700;
    color: #0f172a;
}

/* Story Panel Overlay */
#story-panel {
    position: absolute;
    top: 18px;
    right: 20px;
    width: 330px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(14px);
    border-radius: 20px;
    padding: 16px 18px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    border: 2px solid rgba(255, 255, 255, 0.8);
    pointer-events: none;
    z-index: 15;
}

#story-title {
    font-family: var(--font-heading);
    font-size: 17px;
    font-weight: 800;
    color: #0369a1;
    margin-bottom: 8px;
}

#story-text {
    font-size: 13.5px;
    line-height: 1.45;
    color: #334155;
    margin-bottom: 12px;
    font-weight: 500;
}

#quest-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quest-item {
    font-size: 13.5px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #1e293b;
    background: rgba(255, 255, 255, 0.75);
    padding: 6px 10px;
    border-radius: 10px;
}

.quest-item.completed {
    color: #15803d;
    background: #dcfce7;
    text-decoration: line-through;
}

/* Dynamic On-Screen Mobile/Tablet Virtual Joystick */
#virtual-joystick {
    position: absolute;
    width: 120px;
    height: 120px;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 30;
}

#virtual-joystick.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.0);
}

#joystick-base {
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.25) 0%, rgba(15, 23, 42, 0.45) 80%);
    border: 2.5px solid rgba(56, 189, 248, 0.65);
    border-radius: 50%;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(4px);
}

#joystick-stick {
    position: absolute;
    width: 48px;
    height: 48px;
    top: 50%;
    left: 50%;
    margin-top: -24px;
    margin-left: -24px;
    background: radial-gradient(circle, #ffffff 10%, #38bdf8 80%, #0284c7 100%);
    border-radius: 50%;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
    border: 2px solid #ffffff;
    transition: transform 0.05s linear;
}

/* Floating Action Cluster (Unobtrusive bottom-right layout) */
#floating-actions {
    position: absolute;
    bottom: 24px;
    right: 24px;
    display: flex;
    gap: 12px;
    z-index: 20;
}

.float-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2.5px solid rgba(255, 255, 255, 0.85);
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.float-btn:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5);
}

.float-btn:active {
    transform: scale(0.92);
}

.float-btn .btn-label {
    font-family: var(--font-heading);
    font-size: 10px;
    font-weight: 700;
    color: #ffffff;
    margin-top: 1px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.fly-btn {
    background: linear-gradient(135deg, #38bdf8, #0284c7);
}

.roar-btn {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.spar-btn {
    background: linear-gradient(135deg, #a855f7, #7c3aed);
}

.snuggle-btn {
    background: linear-gradient(135deg, #f43f5e, #e11d48);
}

.screen-hint {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    color: #94a3b8;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    padding: 6px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10;
}

/* Tablet Optimizations */
@media (max-width: 1024px) {
    #top-bar {
        padding: 8px 14px;
    }
    .hud-badge {
        font-size: 13px;
        padding: 5px 12px;
    }
    .chapter-jump-btn {
        font-size: 12px;
        padding: 5px 10px;
    }
    #story-panel {
        width: 250px;
        padding: 10px 12px;
        top: 10px;
        right: 10px;
    }
    #story-title {
        font-size: 14px;
    }
    #story-text {
        font-size: 11.5px;
    }
    .quest-item {
        font-size: 11.5px;
        padding: 4px 6px;
    }
    #floating-actions {
        bottom: 18px;
        right: 18px;
        gap: 10px;
    }
    .float-btn {
        width: 58px;
        height: 58px;
        font-size: 20px;
    }
}

/* Mobile & Small Tablets in portrait */
@media (max-width: 768px) {
    #story-panel {
        display: none;
    }
    .chapter-nav {
        display: none;
    }
    #floating-actions {
        bottom: 14px;
        right: 14px;
        gap: 8px;
    }
    .float-btn {
        width: 52px;
        height: 52px;
        font-size: 18px;
    }
    .screen-hint {
        display: none;
    }
}
