* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 500px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    min-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px 20px;
    text-align: center;
}

header h1 {
    font-size: 28px;
    margin-bottom: 20px;
    font-weight: 700;
}

.stats-bar {
    display: flex;
    justify-content: space-around;
    gap: 20px;
    margin-top: 20px;
}

.stat-item {
    flex: 1;
    background: rgba(255, 255, 255, 0.2);
    padding: 15px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.stat-label {
    display: block;
    font-size: 12px;
    opacity: 0.9;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
}

.add-habit-section {
    padding: 20px;
    display: flex;
    gap: 10px;
    border-bottom: 1px solid #f0f0f0;
}

#habit-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s;
}

#habit-input:focus {
    border-color: #667eea;
}

.btn-primary {
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    touch-action: manipulation;
}

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

.btn-primary:hover {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.habits-list {
    flex: 1;
    padding: 10px 20px 20px;
    overflow-y: auto;
    display: none;
}

.habits-list.has-habits {
    display: block;
}

.habit-item {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
    touch-action: manipulation;
}

.habit-item:active {
    transform: scale(0.98);
}

.habit-checkbox {
    width: 32px;
    height: 32px;
    border: 3px solid #667eea;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s;
    background: white;
}

.habit-checkbox.checked {
    background: #667eea;
    border-color: #667eea;
}

.habit-checkbox.checked::after {
    content: '✓';
    color: white;
    font-size: 20px;
    font-weight: bold;
}

.habit-content {
    flex: 1;
    min-width: 0;
}

.habit-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
    word-break: break-word;
}

.habit-checkbox.checked + .habit-content .habit-name {
    text-decoration: line-through;
    opacity: 0.6;
}

.habit-streak {
    font-size: 12px;
    color: #666;
}

.habit-streak.active {
    color: #667eea;
    font-weight: 600;
}

.habit-delete {
    width: 32px;
    height: 32px;
    border: none;
    background: #ff4757;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s;
    touch-action: manipulation;
}

.habit-delete:active {
    transform: scale(0.9);
}

.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: #999;
}

.empty-state.hidden {
    display: none;
}

.empty-state p {
    font-size: 16px;
    margin-bottom: 10px;
}

.empty-hint {
    font-size: 14px;
    opacity: 0.7;
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .container {
        min-height: calc(100vh - 20px);
        border-radius: 16px;
    }

    header {
        padding: 24px 16px;
    }

    header h1 {
        font-size: 24px;
    }

    .add-habit-section {
        padding: 16px;
    }

    .habits-list {
        padding: 10px 16px 16px;
    }
}

