/* Color Switch - High-Performance Glassmorphism CSS Design System */

:root {
    --bg-dark: #090d16;
    --color-blue: #3B82F6;
    --color-pink: #EC4899;
    --color-yellow: #FACC15;
    --color-purple: #8B5CF6;
    
    --glass-bg: rgba(15, 23, 42, 0.75);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-glow: rgba(59, 130, 246, 0.25);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 9999px;

    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

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

/* Main Container */
.app-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    max-width: 500px;
    margin: 0 auto;
    overflow: hidden;
    background: radial-gradient(circle at 50% 30%, #1e1b4b 0%, #0f172a 70%, #090d16 100%);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
}

@media (min-width: 501px) {
    body {
        display: flex;
        align-items: center;
        justify-content: center;
        background: #030712;
    }
    .app-container {
        height: 92vh;
        max-height: 900px;
        border-radius: var(--radius-lg);
        border: 1px solid var(--glass-border);
    }
}

/* Canvas */
canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: 1;
}

/* Glass Panel Utility */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* HUD Overlay */
.hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 16px 20px;
    z-index: 10;
    pointer-events: none;
}

.hud.hidden {
    display: none;
}

.hud-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.hud-controls {
    pointer-events: auto;
    display: flex;
    gap: 10px;
}

.score-container {
    display: flex;
    flex-direction: column;
}

.score-label {
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
}

.score-value {
    font-family: var(--font-heading);
    font-size: 38px;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 0 12px rgba(255, 255, 255, 0.4);
}

.difficulty-badge {
    font-family: var(--font-heading);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.5px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
}

.difficulty-badge.easy { color: var(--color-blue); border-color: var(--color-blue); }
.difficulty-badge.medium { color: var(--color-yellow); border-color: var(--color-yellow); }
.difficulty-badge.hard { color: var(--color-pink); border-color: var(--color-pink); }
.difficulty-badge.expert { color: var(--color-purple); border-color: var(--color-purple); }

.hud-stars {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 14px;
    color: var(--color-yellow);
}

.star-icon {
    width: 18px;
    height: 18px;
}

/* Icon Buttons */
.icon-btn, .btn-circle {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-normal);
}

.icon-btn:hover, .btn-circle:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: scale(1.08);
}

.icon-btn:active, .btn-circle:active {
    transform: scale(0.95);
}

.svg-icon {
    width: 22px;
    height: 22px;
}

.hidden {
    display: none !important;
}

/* Overlay Screen Base */
.overlay-screen {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.overlay-screen.active {
    opacity: 1;
    pointer-events: auto;
}

.menu-card {
    width: 100%;
    max-width: 380px;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

/* Game Logo */
.game-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.logo-circle {
    position: relative;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: spin 10s linear infinite;
}

.logo-arc {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 10px solid transparent;
}

.arc-blue { border-top-color: var(--color-blue); }
.arc-pink { border-right-color: var(--color-pink); }
.arc-yellow { border-bottom-color: var(--color-yellow); }
.arc-purple { border-left-color: var(--color-purple); }

.logo-ball {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--text-primary);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.9);
    animation: bounceBall 1.5s ease-in-out infinite alternate;
}

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

@keyframes bounceBall {
    0% { transform: translateY(18px) scaleY(0.85); background: var(--color-pink); }
    50% { transform: translateY(-18px) scaleY(1.1); background: var(--color-blue); }
    100% { transform: translateY(18px) scaleY(0.85); background: var(--color-yellow); }
}

.logo-title {
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 900;
    text-align: center;
    line-height: 1;
    letter-spacing: 2px;
}

.logo-title .highlight {
    background: linear-gradient(135deg, var(--color-blue), var(--color-pink), var(--color-yellow));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Best Score Badge */
.best-score-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(250, 204, 21, 0.1);
    border: 1px solid rgba(250, 204, 21, 0.3);
    border-radius: var(--radius-full);
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    color: var(--color-yellow);
}

.trophy-icon {
    width: 18px;
    height: 18px;
}

/* Buttons System */
.menu-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
}

.btn {
    width: 100%;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition-bounce);
}

.btn-large {
    padding: 18px 24px;
    font-size: 18px;
    border-radius: var(--radius-lg);
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-blue), #2563eb);
    color: white;
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 14px 30px rgba(59, 130, 246, 0.6);
}

.btn-primary:active {
    transform: translateY(1px) scale(0.98);
}

.glow-btn {
    animation: pulseGlow 2s infinite alternate;
}

@keyframes pulseGlow {
    from { box-shadow: 0 0 15px rgba(59, 130, 246, 0.5); }
    to { box-shadow: 0 0 30px rgba(236, 72, 153, 0.7); }
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.16);
    transform: translateY(-2px);
}

.btn-tertiary {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
}

.btn-tertiary:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.btn-icon {
    width: 20px;
    height: 20px;
}

/* Modals */
.modal-screen {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(3, 7, 18, 0.85);
    backdrop-filter: blur(12px);
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-screen.hidden {
    display: none !important;
}

.modal-card {
    width: 100%;
    max-width: 420px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    padding: 24px;
    overflow: hidden;
}

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

.modal-header h2 {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 1px;
}

.btn-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
}

.btn-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

/* How to play guide steps */
.guide-step {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(255, 255, 255, 0.04);
    padding: 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
}

.step-icon {
    font-size: 28px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
}

.step-desc strong {
    display: block;
    font-family: var(--font-heading);
    font-size: 15px;
    margin-bottom: 2px;
}

.step-desc p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Shop Modal */
.shop-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 16px 0 12px 0;
}

.shop-tab {
    padding: 10px;
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.shop-tab.active {
    background: var(--color-blue);
    color: white;
    border-color: var(--color-blue);
}

.shop-stars-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: var(--font-heading);
    font-size: 14px;
    color: var(--color-yellow);
    margin-bottom: 12px;
}

.shop-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-height: 50vh;
    overflow-y: auto;
    padding-right: 4px;
}

.shop-item-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    position: relative;
}

.shop-item-card.equipped {
    border-color: var(--color-blue);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
}

.shop-preview-box {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
}

.shop-item-title {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
}

.shop-item-btn {
    width: 100%;
    padding: 8px;
    font-size: 12px;
    border-radius: var(--radius-sm);
}

/* Achievements List */
.achievements-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 55vh;
    overflow-y: auto;
    padding-right: 4px;
}

.achievement-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
}

.achievement-card.unlocked {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.4);
}

.achievement-icon {
    font-size: 26px;
}

.achievement-info strong {
    display: block;
    font-family: var(--font-heading);
    font-size: 14px;
}

.achievement-info p {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Game Over Screen Specifics */
.text-danger {
    color: var(--color-pink);
    text-shadow: 0 0 15px rgba(236, 72, 153, 0.5);
}

.score-board {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    width: 100%;
}

.score-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.highlight-card {
    background: rgba(250, 204, 21, 0.08);
    border-color: rgba(250, 204, 21, 0.3);
}

.card-label {
    font-family: var(--font-heading);
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.card-value {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 900;
}

.stars-earned-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: var(--font-heading);
    font-size: 14px;
    color: var(--color-yellow);
}

.new-record-tag {
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1px;
    background: linear-gradient(135deg, var(--color-yellow), #f59e0b);
    color: #000;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    box-shadow: 0 0 15px rgba(250, 204, 21, 0.6);
    animation: bounce 1s infinite alternate;
}

@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-4px); }
}

/* Toast Container */
.toast-container {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid var(--color-yellow);
    border-radius: var(--radius-full);
    padding: 10px 20px;
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    color: var(--color-yellow);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    animation: toastPop 0.4s var(--transition-bounce);
}

@keyframes toastPop {
    from { opacity: 0; transform: scale(0.8) translateY(-10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
