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

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: radial-gradient(circle at 50% 25%, #141c38 0%, #060914 100%);
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #ffffff;
    transition: background 0.8s ease;
}

#game-canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Floating Combo Notification Text */
#floating-text-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 15;
}

.floating-combo-text {
    position: absolute;
    transform: translate(-50%, -50%);
    font-weight: 900;
    text-shadow: 0 4px 18px rgba(0, 0, 0, 0.7);
    animation: floatUpAndFade 0.8s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
    white-space: nowrap;
}

@keyframes floatUpAndFade {
    0% {
        opacity: 0;
        transform: translate(-50%, 0%) scale(0.6);
    }
    30% {
        opacity: 1;
        transform: translate(-50%, -30px) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -85px) scale(1.0);
    }
}

/* UI Overlays */
.ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    display: flex;
    flex-direction: column;
    pointer-events: none;
}

.hidden {
    display: none !important;
}

/* HUD Header */
#hud-screen {
    padding: env(safe-area-inset-top, 20px) 20px 20px 20px;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
}

.hud-top-bar {
    width: 100%;
    max-width: 480px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: auto;
}

.hud-gems-badge {
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(0, 245, 212, 0.35);
    padding: 6px 14px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 800;
    font-size: 15px;
    color: #00f5d4;
    box-shadow: 0 4px 15px rgba(0, 245, 212, 0.2);
}

.hud-right-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hud-highscore-badge {
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(254, 228, 64, 0.4);
    padding: 6px 13px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 800;
    font-size: 14px;
    color: #fee440;
    box-shadow: 0 4px 15px rgba(254, 228, 64, 0.2);
}

.hud-center-content {
    width: 100%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.score-display {
    font-size: 54px;
    font-weight: 900;
    letter-spacing: -1px;
    text-shadow: 0 4px 25px rgba(0, 0, 0, 0.6);
    background: linear-gradient(180deg, #ffffff 40%, #c4c4c4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.progress-container {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
}

.infinite-badge {
    background: linear-gradient(135deg, rgba(255, 0, 84, 0.25), rgba(157, 78, 221, 0.25));
    border: 1px solid rgba(255, 0, 84, 0.5);
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 14px rgba(255, 0, 84, 0.3);
}

.badge-dot {
    color: rgba(255, 255, 255, 0.4);
}

.level-badge {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    border: 2px solid rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 15px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.progress-bar {
    flex: 1;
    height: 12px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

#progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #fee440, #ff0054);
    border-radius: 12px;
    transition: width 0.15s ease-out;
    box-shadow: 0 0 16px rgba(254, 228, 64, 0.9);
}

.icon-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    font-size: 19px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
    transition: transform 0.15s ease, background 0.2s;
    color: #ffffff;
}

.icon-btn:active {
    transform: scale(0.9);
}

/* Mode Selector Tabs */
.mode-selector {
    display: flex;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 4px;
    gap: 6px;
    margin-bottom: 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    width: 100%;
}

.mode-tab {
    flex: 1;
    padding: 10px 14px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.65);
    font-weight: 800;
    font-size: 14px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.mode-tab.active {
    background: linear-gradient(135deg, #00f5d4, #00bbf9);
    color: #051923;
    box-shadow: 0 4px 15px rgba(0, 245, 212, 0.4);
    transform: scale(1.02);
}

/* Modal Popups */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    pointer-events: auto;
    z-index: 25;
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.modal-card {
    width: 100%;
    max-width: 360px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 28px;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.game-logo {
    font-size: 44px;
    font-weight: 900;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #fee440 0%, #ff0054 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.game-sub {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 24px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.score-stats {
    width: 100%;
    display: flex;
    justify-content: space-around;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 16px;
    margin-bottom: 24px;
}

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

.stat-label {
    font-size: 11px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 30px;
    font-weight: 800;
    color: #fee440;
    margin-top: 4px;
}

.action-btn {
    width: 100%;
    padding: 18px;
    border-radius: 20px;
    border: none;
    font-family: inherit;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #ffffff;
    background: linear-gradient(135deg, #ff0054, #ff5400);
    box-shadow: 0 12px 28px rgba(255, 0, 84, 0.45);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    text-transform: uppercase;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 35px rgba(255, 0, 84, 0.6);
}

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: none;
    margin-top: 12px;
    font-size: 16px;
    padding: 14px;
}

.btn-win {
    background: linear-gradient(135deg, #00f5d4, #00b4d8);
    box-shadow: 0 12px 28px rgba(0, 245, 212, 0.45);
    color: #080e1a;
}

.drag-instruction {
    margin-top: 20px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.75);
    display: flex;
    align-items: center;
    gap: 8px;
    animation: pulseHint 1.6s infinite;
}

@keyframes pulseHint {
    0%, 100% { opacity: 0.5; transform: scale(0.98); }
    50% { opacity: 1; transform: scale(1.02); }
}

/* Shop Modal Styles */
.shop-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.shop-title {
    font-size: 26px;
    font-weight: 900;
}

.skins-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    max-height: 380px;
    overflow-y: auto;
    padding-right: 4px;
    margin-bottom: 20px;
}

.skin-card {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 18px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: transform 0.15s, border-color 0.2s;
}

.skin-card.selected {
    border-color: #00f5d4;
    box-shadow: 0 0 15px rgba(0, 245, 212, 0.35);
}

.skin-ball-preview {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.5);
}

.skin-name {
    font-size: 13px;
    font-weight: 700;
}

.skin-btn {
    width: 100%;
    padding: 8px;
    border-radius: 12px;
    border: none;
    font-weight: 800;
    font-size: 12px;
    cursor: pointer;
    text-transform: uppercase;
}

.btn-active {
    background: #00f5d4;
    color: #080e1a;
}

.btn-equip {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.btn-buy {
    background: linear-gradient(135deg, #fee440, #ff9e00);
    color: #080e1a;
}

/* Settings Modal */
.settings-group {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.setting-row {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 15px;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255, 255, 255, 0.2);
    transition: .3s;
    border-radius: 28px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #00f5d4;
}

input:checked + .slider:before {
    transform: translateX(22px);
    background-color: #080e1a;
}

.slider-range {
    width: 100%;
    accent-color: #00f5d4;
}
