:root {
    --bg-color: #0b0f19;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --neon-accent: #38bdf8;
    /* Pastel Neon Blue */
    --neon-glow: rgba(56, 189, 248, 0.4);
    --neon-purple: #c084fc;
    --neon-pink: #f472b6;
    --success-green: #4ade80;
    --warning-red: #fb7185;

    /* Glassmorphism Variables */
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.12);
    --font-family: 'Poppins', sans-serif;
}

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

html,
body {
    overscroll-behavior-y: none;
    /* Prevents pull-to-refresh */
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    /* Subtle background gradients for depth */
    background-image:
        radial-gradient(circle at 15% 10%, rgba(56, 189, 248, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 85% 90%, rgba(192, 132, 252, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(244, 114, 182, 0.05) 0%, transparent 60%);
    color: var(--text-main);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    overflow: hidden;
    /* Hide scrollbars on body level */
    display: flex;
    justify-content: center;
}

/* Hide scrollbars strictly but keep scrollability */
::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

html {
    scrollbar-width: none;
    /* Firefox */
}

.app-container {
    width: 100%;
    max-width: 480px;
    /* Mobile First Constraint */
    height: 100vh;
    height: -webkit-fill-available;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    padding: 24px 0 0 0;
}

/* Glassmorphism Shared Utility */
.glass-card,
.glass-header,
.glass-btn,
.glass-input {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

/* Header Sections */
.glass-header {
    margin: 0 24px 24px 24px;
    padding: 24px;
    text-align: center;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    animation: fadeInDown 0.6s ease-out;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.settings-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
}

.settings-btn:active {
    transform: scale(0.9);
    background: rgba(255, 255, 255, 0.25);
}

.streak {
    background: rgba(0, 0, 0, 0.3);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #fdba74;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(253, 186, 116, 0.15);
    box-shadow: 0 0 10px rgba(253, 186, 116, 0.1);
}

.balance-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 8px;
    font-weight: 500;
}

#total-balance {
    font-size: 3.2rem;
    font-weight: 700;
    background: linear-gradient(to right, var(--neon-accent), var(--neon-purple));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 24px var(--neon-glow);
    letter-spacing: -1px;
}

/* Main Content List */
.goals-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 0 24px 120px 24px;
    /* Space for the floating button */
    overflow-y: auto;
    min-height: 0;
}

/* Goal Card Styling */
.goal-card {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.goal-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.goal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.goal-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.goal-emoji {
    font-size: 1.8rem;
    background: rgba(255, 255, 255, 0.05);
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.goal-name {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.goal-amounts {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 500;
}

.goal-controls {
    display: flex;
    gap: 10px;
}

.control-btn {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    border: none;
    background: var(--glass-highlight);
    color: var(--text-main);
    font-size: 1.4rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--glass-border);
}

.control-btn:active {
    transform: scale(0.9);
    background: rgba(255, 255, 255, 0.25);
}

.control-btn.sub:active {
    color: var(--warning-red);
}

.control-btn.add:active {
    color: var(--success-green);
}

/* Visual Progress Bar */
.progress-container {
    height: 10px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 5px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-accent), var(--neon-purple));
    border-radius: 5px;
    width: 0%;
    transition: width 1s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Bouncy dynamic fill */
    box-shadow: 0 0 12px var(--neon-glow);
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.2) 0%, transparent 100%);
}

.progress-bar.complete {
    background: linear-gradient(90deg, var(--success-green), #22c55e);
    box-shadow: 0 0 15px rgba(74, 222, 128, 0.4);
}

/* Floating Add Button */
.add-goal-btn {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 48px);
    max-width: 432px;
    padding: 18px;
    font-size: 1.1rem;
    font-family: inherit;
    font-weight: 600;
    color: var(--text-main);
    border: 1px solid rgba(56, 189, 248, 0.3);
    background: rgba(56, 189, 248, 0.15);
    box-shadow: 0 8px 32px var(--neon-glow);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    z-index: 10;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 20px;
    animation: bounceIn 0.8s 0.3s both;
}

.add-goal-btn:active {
    transform: translateX(-50%) scale(0.95);
    background: rgba(56, 189, 248, 0.25);
}

.plus-icon {
    font-size: 1.4rem;
    font-weight: 500;
    line-height: 1;
}

/* Modals Numpad & New Goal */
.numpad-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 100;
}

.numpad-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.numpad-container,
.new-goal-container,
.settings-container {
    width: 100%;
    max-width: 480px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: 32px;
    border-top-right-radius: 32px;
    padding: 30px 24px;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border-bottom: none;
}

.numpad-overlay.active .numpad-container,
.numpad-overlay.active .new-goal-container,
.numpad-overlay.active .settings-container {
    transform: translateY(0);
}

.numpad-header {
    text-align: center;
    margin-bottom: 24px;
}

.numpad-header h3 {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 6px;
}

.numpad-header h2 {
    font-size: 3rem;
    color: var(--neon-accent);
    font-weight: 700;
    letter-spacing: -1px;
}

.numpad-header h2.subtext {
    color: var(--warning-red);
}

/* Numpad Grid */
.numpad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.numpad-grid button {
    border: none;
    border-radius: 18px;
    padding: 20px 0;
    font-size: 1.6rem;
    font-family: inherit;
    font-weight: 500;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.15s ease;
    background: var(--glass-highlight);
}

.numpad-grid button:active {
    transform: scale(0.92);
    background: rgba(255, 255, 255, 0.25);
}

.action-key {
    font-size: 1.2rem !important;
    font-weight: 600 !important;
}

.action-key.warning {
    color: var(--warning-red) !important;
}

.numpad-actions {
    display: flex;
    gap: 12px;
}

.numpad-actions button {
    flex: 1;
    padding: 16px;
    font-size: 1.05rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    border-radius: 16px;
    transition: all 0.2s ease;
}

.numpad-actions button:active {
    transform: scale(0.95);
}

.numpad-actions .primary {
    background: rgba(56, 189, 248, 0.2);
    color: var(--neon-accent);
    border: 1px solid rgba(56, 189, 248, 0.4);
}

.numpad-actions .primary.danger,
button.primary.danger {
    background: rgba(251, 113, 133, 0.2);
    color: var(--warning-red);
    border: 1px solid rgba(251, 113, 133, 0.4);
}

.action-btn {
    padding: 16px;
    font-size: 1.05rem;
    font-weight: 600;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

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

.numpad-actions .secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

/* Forms */
.modal-title {
    margin-bottom: 24px;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 600;
}

.form-group {
    margin-bottom: 16px;
}

.glass-input {
    width: 100%;
    padding: 18px;
    font-family: inherit;
    font-size: 1rem;
    color: var(--text-main);
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.glass-input:focus {
    border-color: rgba(56, 189, 248, 0.5);
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.2);
}

.glass-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

/* Settings Modal Specifics */
.section-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.account-section,
.danger-section {
    margin-bottom: 24px;
}

.account-controls {
    display: flex;
    gap: 10px;
}

.account-select {
    flex: 1;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2394a3b8%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem top 50%;
    background-size: 0.65rem auto;
}

.account-select option {
    background-color: var(--bg-color);
    color: var(--text-main);
}

.small-btn {
    width: 60px;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.full-width {
    width: 100%;
}

/* Keyframe Animations */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: translateX(-50%) scale(0.8);
    }

    50% {
        opacity: 1;
        transform: translateX(-50%) scale(1.05);
    }

    100% {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }
}