* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4CAF50;
    --primary-dark: #45a049;
    --secondary-color: #2196F3;
    --background: #f8f9fa;
    --card-background: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
}

.container {
    max-width: 600px;
    margin: 0 auto;
    background: var(--card-background);
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 30px;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

header h1 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.user-info {
    color: var(--text-secondary);
    font-size: 1rem;
}

#userName {
    color: var(--secondary-color);
    font-weight: 600;
}

.progress-section {
    margin: 20px 0;
}

.progress-info {
    text-align: center;
    margin-bottom: 25px;
}

.progress-info h2 {
    color: var(--text-primary);
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.progress-text {
    font-size: 2rem;
    font-weight: 700;
    color: var(--secondary-color);
    margin-bottom: 10px;
}

.percentage {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.progress-bar-container {
    width: 100%;
    height: 50px;
    background: var(--background);
    border-radius: 25px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color) 0%, #66BB6A 100%);
    border-radius: 25px;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    position: relative;
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.3);
}

.progress-bar-text {
    color: white;
    font-weight: 600;
    font-size: 1rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.add-button {
    width: 100%;
    padding: 18px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.3rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.add-button:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.add-button:active {
    transform: translateY(0);
}

.add-button.clicked {
    animation: pulse 0.4s ease;
}

.add-button.loading {
    background: #9E9E9E;
    cursor: not-allowed;
    position: relative;
}

.add-button.loading:hover {
    background: #9E9E9E;
    transform: none;
}

.add-button.loading::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.95);
    }
}

.goal-message {
    margin-top: 30px;
    padding: 25px;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    border-radius: 12px;
    text-align: center;
    animation: slideDown 0.5s ease;
    box-shadow: var(--shadow-hover);
}

.goal-message h2 {
    font-size: 1.8rem;
    color: white;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.goal-message p {
    font-size: 1.2rem;
    color: white;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hidden {
    display: none !important;
}

footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
    text-align: center;
    color: var(--text-secondary);
}

.footer-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
    flex-wrap: wrap;
}

.footer-btn {
    padding: 12px 20px;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 5px;
}

.footer-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.install-btn {
    background: var(--primary-color);
}

.install-btn:hover {
    background: var(--primary-dark);
}

.install-btn.hidden {
    display: none;
}

/* Install Help Modal */
.install-help-content {
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
}

.install-instructions {
    text-align: left;
}

.install-section {
    margin-bottom: 25px;
    padding: 20px;
    background: var(--background);
    border-radius: 10px;
    border-left: 4px solid var(--primary-color);
}

.install-section h3 {
    color: var(--text-primary);
    margin-bottom: 12px;
    font-size: 1.1rem;
}

.install-section ol {
    margin-left: 20px;
    margin-bottom: 10px;
}

.install-section ol li {
    margin-bottom: 8px;
    color: var(--text-primary);
    line-height: 1.5;
}

.install-section .note {
    margin-top: 12px;
    padding: 10px;
    background: white;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-left: 3px solid var(--secondary-color);
}

.important-note {
    border-left-color: #FF9800;
    background: #FFF3E0;
}

.important-note h3 {
    color: #F57C00;
}

.important-note p {
    color: var(--text-primary);
    margin-bottom: 8px;
}

/* Name Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-content h2 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.8rem;
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

#nameInput {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    margin-bottom: 20px;
    transition: border-color 0.3s ease;
}

#nameInput:focus {
    outline: none;
    border-color: var(--primary-color);
}

#saveNameBtn {
    width: 100%;
    padding: 15px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

#saveNameBtn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* Fireworks Canvas */
#fireworksCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 20px;
        border-radius: 15px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .progress-text {
        font-size: 1.5rem;
    }

    .progress-bar-container {
        height: 40px;
    }

    .add-button {
        font-size: 1.1rem;
        padding: 15px;
    }

    .goal-message h2 {
        font-size: 1.4rem;
    }

    .modal-content {
        padding: 30px 20px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.3rem;
    }

    .progress-text {
        font-size: 1.3rem;
    }

    .percentage {
        font-size: 1rem;
    }
}

/* Settings Button */
.settings-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    box-shadow: var(--shadow-hover);
    transition: all 0.3s ease;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-btn:hover {
    background: var(--primary-dark);
    transform: rotate(90deg) scale(1.1);
}

/* Settings Modal */
.settings-content {
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    text-align: left;
}

.settings-content h2 {
    text-align: center;
    margin-bottom: 25px;
    color: var(--primary-color);
}

.settings-section {
    margin-bottom: 30px;
    padding: 20px;
    background: var(--background);
    border-radius: 10px;
}

.settings-section h3 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.settings-section label {
    display: block;
    margin-bottom: 15px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.settings-section input {
    width: 100%;
    padding: 10px;
    margin-top: 5px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.settings-section input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.settings-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.settings-actions button {
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-warning {
    background: #FF9800;
    color: white;
}

.btn-warning:hover {
    background: #F57C00;
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-danger:hover {
    background: #d32f2f;
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.3s ease;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal:hover {
    color: var(--text-primary);
}

.error-message {
    color: #f44336;
    margin-top: 10px;
    font-size: 0.9rem;
    text-align: center;
    min-height: 20px;
}

/* Activity Log */
.activity-log {
    max-height: 300px;
    overflow-y: auto;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
}

.activity-log::-webkit-scrollbar {
    width: 8px;
}

.activity-log::-webkit-scrollbar-track {
    background: var(--background);
    border-radius: 4px;
}

.activity-log::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.log-entry {
    padding: 10px;
    margin-bottom: 8px;
    background: var(--background);
    border-radius: 6px;
    border-left: 3px solid var(--primary-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.log-entry:last-child {
    margin-bottom: 0;
}

.log-user {
    font-weight: 600;
    color: var(--text-primary);
}

.log-time {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.log-action {
    color: var(--primary-color);
    margin-left: 10px;
}

/* Responsive for Settings */
@media (max-width: 768px) {
    .settings-btn {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
        bottom: 15px;
        right: 15px;
    }

    .settings-content {
        max-height: 90vh;
        padding: 20px 15px;
    }
}
