/* ==========================================================================
   Kinder Piano Hero - Light Minimalist Theme
   Designed for Mobile & Tablet (GitHub Pages Ready)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;600;700&family=Outfit:wght@400;600;800&display=swap');

:root {
    --font-primary: 'Fredoka', 'Outfit', system-ui, -apple-system, sans-serif;
    --bg-light: #F8FAFC;
    --bg-card: #FFFFFF;
    --text-main: #1E293B;
    --text-muted: #64748B;
    --border-color: #E2E8F0;
    
    /* Baby Einstein 8 Key Colors (Exact order matching piano) */
    --color-red: #E53935;
    --color-orange: #FB8C00;
    --color-yellow: #FDD835;
    --color-green: #7CB342;
    --color-cyan: #00ACC1;
    --color-blue: #1E88E5;
    --color-pink: #F72585;
    --color-purple: #7209B7;
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-light);
    font-family: var(--font-primary);
    color: var(--text-main);
}

#app-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   Screens Management
   ========================================================================== */
.screen {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    z-index: 10;
    transition: opacity 0.3s ease;
}

.hidden {
    display: none !important;
    opacity: 0;
    pointer-events: none;
}

/* ==========================================================================
   Start Screen
   ========================================================================== */
#start-screen {
    background: linear-gradient(180deg, #EFF6FF 0%, #F8FAFC 100%);
    justify-content: center;
    align-items: center;
    padding: 24px;
    text-align: center;
}

.hero-logo-wrapper {
    margin-bottom: 24px;
    animation: floatBounce 3s ease-in-out infinite;
}

.hero-logo-img {
    max-width: 220px;
    width: 65vw;
    height: auto;
    border-radius: 28px;
    box-shadow: 0 16px 36px rgba(37, 99, 235, 0.15), 0 4px 12px rgba(0, 0, 0, 0.05);
}

.app-title {
    font-size: 2.6rem;
    font-weight: 700;
    color: #1E3A8A;
    margin-bottom: 8px;
}

.app-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 36px;
    max-width: 360px;
    line-height: 1.4;
}

.menu-buttons-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 320px;
}

.btn-primary, .btn-secondary {
    font-family: var(--font-primary);
    font-size: 1.25rem;
    font-weight: 700;
    padding: 16px 28px;
    border-radius: 99px;
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.2);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, #2563EB, #1D4ED8);
    color: #ffffff;
}

.btn-primary:active {
    transform: scale(0.96);
}

.btn-secondary {
    background: #E2E8F0;
    color: #334155;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.btn-secondary:active {
    transform: scale(0.96);
}

/* ==========================================================================
   Game Screen
   ========================================================================== */
#game-screen {
    background-color: #F1F5F9;
}

.game-header {
    height: 56px;
    padding: 0 16px;
    background: #FFFFFF;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 20;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

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

.header-center {
    flex: 1;
    text-align: center;
}

#current-song-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1E293B;
}

.header-select {
    font-family: var(--font-primary);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 99px;
    background: #F1F5F9;
    color: #334155;
    border: 1px solid #CBD5E1;
    outline: none;
}

.btn-icon {
    background: #F1F5F9;
    border: 1px solid #CBD5E1;
    color: #334155;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.btn-icon:active {
    background: #E2E8F0;
    transform: scale(0.92);
}

/* Fullscreen Canvas Container */
.canvas-container {
    flex: 1;
    position: relative;
    width: 100%;
    height: calc(100% - 56px);
    overflow: hidden;
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: pointer;
}

/* Countdown Overlay */
.countdown-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(248, 250, 252, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
}

#countdown-text {
    font-size: 6rem;
    font-weight: 800;
    color: #2563EB;
    animation: countdownPop 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) infinite;
}

/* ==========================================================================
   Modals & Overlays
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(6px);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-card {
    background: var(--bg-card);
    border-radius: 28px;
    width: 100%;
    max-width: 440px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-main);
}

.btn-icon-close {
    background: #F1F5F9;
    border: none;
    color: #64748B;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
}

.modal-body {
    padding: 20px 24px;
    overflow-y: auto;
}

/* Song List Cards */
.song-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.song-card {
    background: #F8FAFC;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.12s ease;
}

.song-card:hover, .song-card:active {
    background: #EFF6FF;
    transform: scale(0.99);
}

.song-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
}

.song-category {
    font-size: 0.85rem;
    color: #D97706;
    font-weight: 600;
}

.song-description {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.btn-play-song {
    background: #2563EB;
    color: white;
    font-family: var(--font-primary);
    font-weight: 700;
    font-size: 0.95rem;
    border: none;
    padding: 8px 18px;
    border-radius: 99px;
    cursor: pointer;
}

/* Victory Popup */
.victory-card {
    text-align: center;
    padding: 32px 24px;
}

.victory-title {
    font-size: 2.2rem;
    font-weight: 700;
    color: #16A34A;
    margin-bottom: 12px;
}

.stars-container {
    font-size: 2.5rem;
    margin-bottom: 20px;
}

.star {
    display: inline-block;
}

.star-filled {
    animation: starPop 0.4s ease forwards;
}

.star-empty {
    opacity: 0.25;
    filter: grayscale(100%);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    background: #F8FAFC;
    padding: 16px;
    border-radius: 18px;
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Animations */
@keyframes floatBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes modalPop {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes countdownPop {
    0% { transform: scale(0.4); opacity: 0; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes starPop {
    0% { transform: scale(0); }
    70% { transform: scale(1.3); }
    100% { transform: scale(1); }
}
