* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    touch-action: manipulation; /* Eliminate 300ms click delay */
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #f5f0eb 0%, #e8ddd4 50%, #d4c4e0 100%);
    padding: 16px; /* Reduced for mobile */
    min-height: 100vh;
    overflow-x: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.container { max-width: 1600px; margin: 0 auto; background: #faf8f5; border-radius: 20px; padding: 30px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1); }
.header { text-align: center; margin-bottom: 30px; }
.month-title { font-size: 72px; font-weight: 300; font-style: italic; color: #2c2c2c; margin-bottom: 5px; }
.subtitle { font-size: 11px; letter-spacing: 3px; color: #999; font-weight: 600; margin-bottom: 20px; }

.month-selector-top { display: inline-flex; justify-content: center; align-items: center; gap: 10px; background: #f9e5c8; padding: 12px 20px; border-radius: 8px; }
.month-selector-top label { font-size: 10px; font-weight: 700; color: #666; }
.month-selector-top select { padding: 6px 12px; border: 1px solid #ddd; border-radius: 5px; background: white; font-size: 13px; font-weight: 500; cursor: pointer; }

.main-layout { display: grid; grid-template-columns: 280px 1fr 340px; gap: 20px; }
.left-column { display: flex; flex-direction: column; gap: 15px; }

.image-card { background: #e8d5d5; padding: 20px; border-radius: 12px; text-align: center; }
.image-placeholder { width: 100%; height: 200px; background: linear-gradient(135deg, #c8b5a8 0%, #d4c4b8 100%); border-radius: 10px; margin-bottom: 15px; display: flex; align-items: center; justify-content: center; }
.image-text { font-size: 14px; font-style: italic; color: #333; margin-bottom: 5px; }
.image-subtext { font-size: 11px; color: #666; line-height: 1.5; }

.daily-habits-card { background: #d4e4f7; padding: 20px; border-radius: 12px; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.card-header h3 { font-size: 11px; letter-spacing: 2px; font-weight: 700; color: #333; }

.add-btn { background: #5a8fc4; color: white; border: none; width: 28px; height: 28px; border-radius: 6px; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.add-btn:hover { background: #4a7fb4; transform: scale(1.05); }
.habit-list { display: flex; flex-direction: column; gap: 8px; }
.habit-item { display: flex; align-items: center; gap: 10px; font-size: 12px; color: #333; }

.habit-number { background: white; width: 24px; height: 24px; border-radius: 5px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; flex-shrink: 0; }
.habit-name { flex: 1; }
.habit-actions { display: none; gap: 5px; }
.habit-item:hover .habit-actions { display: flex; }
.habit-edit, .habit-delete { background: white; border: none; padding: 4px 8px; border-radius: 4px; font-size: 10px; cursor: pointer; font-weight: 600; }
.habit-edit { color: #5a8fc4; }
.habit-delete { color: #e47ba8; }

.center-column { display: flex; flex-direction: column; gap: 20px; }
.area-chart-card { background: white; padding: 30px; border-radius: 12px; height: 200px; }
#areaChart { width: 100%; height: 100%; }

.weekly-charts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 15px; }
.week-card { padding: 20px 15px; border-radius: 12px; text-align: center; }
.week-1 { background: #d4e4f7; }
.week-2 { background: #f5d4e4; }
.week-3 { background: #d4f5e4; }
.week-4 { background: #f9e5c8; }
.week-5 { background: #e4d4f7; }
.week-label { font-size: 11px; font-style: italic; color: #666; margin-bottom: 10px; }
.week-canvas { width: 100%; height: 100px; margin: 10px 0; }
.week-percent { font-size: 24px; font-weight: 700; margin-top: 10px; }

.week-1 .week-percent { color: #5a8fc4; }
.week-2 .week-percent { color: #e47ba8; }
.week-3 .week-percent { color: #5ac49e; }
.week-4 .week-percent { color: #e8a857; }
.week-5 .week-percent { color: #9b8fc4; }

.habit-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    background: white;
    padding: 20px;
    border-radius: 12px;
}

.grid-cell { aspect-ratio: 1; border: 2px solid #e0e0e0; border-radius: 6px; cursor: pointer; transition: all 0.2s; position: relative; }
.grid-cell:hover { transform: scale(1.05); border-color: #5a8fc4; }
.grid-cell.checked { background: linear-gradient(135deg, #5a8fc4 0%, #4a7fb4 100%); border-color: #5a8fc4; }

.grid-cell.week-1.checked { background: linear-gradient(135deg, #5a8fc4 0%, #4a7fb4 100%); }
.grid-cell.week-2.checked { background: linear-gradient(135deg, #e47ba8 0%, #d46b98 100%); }
.grid-cell.week-3.checked { background: linear-gradient(135deg, #5ac49e 0%, #4ab48e 100%); }
.grid-cell.week-4.checked { background: linear-gradient(135deg, #e8a857 0%, #d89847 100%); }
.grid-cell.week-5.checked { background: linear-gradient(135deg, #9b8fc4 0%, #8b7fb4 100%); }

/* Right Column */
.right-column {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.progress-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.progress-card {
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}

.progress-card.pink {
    background: #f5d4e4;
}

.progress-label {
    font-size: 10px;
    letter-spacing: 2px;
    font-weight: 700;
    color: #666;
    margin-bottom: 15px;
}

.progress-value {
    font-size: 32px;
    font-weight: 700;
    color: #e47ba8;
}

#habitCircle {
    width: 100px;
    height: 100px;
    margin: 10px auto;
}

.progress-fraction {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin-top: 10px;
}

.top-habits-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
}

.top-habits-card h3 {
    font-size: 11px;
    letter-spacing: 2px;
    font-weight: 700;
    color: #333;
    margin-bottom: 15px;
}

.top-habits-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.top-habit-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    padding: 8px;
    background: #f9f9f9;
    border-radius: 6px;
}

.habit-rank {
    background: #5a8fc4;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.habit-title {
    flex: 1;
    color: #333;
}

.habit-percentage {
    font-weight: 700;
    color: #5a8fc4;
}

.footer-text {
    font-size: 11px;
    font-style: italic;
    color: #999;
    margin-top: 15px;
}

.daily-progress-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
}

.daily-progress-card h3 {
    font-size: 11px;
    letter-spacing: 2px;
    font-weight: 700;
    color: #333;
    margin-bottom: 15px;
}

.progress-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.progress-table th {
    text-align: left;
    padding: 10px 8px;
    font-weight: 700;
    color: #666;
    border-bottom: 2px solid #e0e0e0;
    font-size: 11px;
}

.progress-table td {
    padding: 10px 8px;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
}

.progress-bar-container { width: 100%; height: 20px; background: #f0f0f0; border-radius: 4px; overflow: hidden; }
.progress-bar { height: 100%; background: #5a8fc4; border-radius: 4px; transition: width 0.3s; will-change: width; }

@media (max-width: 1200px) {
    .main-layout { grid-template-columns: 1fr; }
    .weekly-charts { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}

@media (max-width: 768px) {
    body { padding: 10px; }
    .container { padding: 15px; border-radius: 16px; margin-top: 5px; }
    .month-title { font-size: clamp(32px, 8vw, 48px); }
    .progress-cards { grid-template-columns: 1fr; }
    .habit-grid { 
        gap: 6px; 
        padding: 12px; 
        grid-template-columns: repeat(7, 1fr) !important;
        margin-top: 10px;
    }
    .grid-cell { border-width: 1.5px; min-height: 38px; }
    .grid-cell:hover { transform: none; }
    
    .add-btn, .habit-edit, .habit-delete, .primary-btn, .select-box { 
        min-height: 48px; 
        min-width: 48px; 
    }
    
    .week-canvas { height: 80px; }
    .main-layout { gap: 12px; }
    .month-selector-top { width: 100%; justify-content: space-between; gap: 5px; }
}

@media (max-width: 480px) {
    .month-title { font-size: 32px; }
    .habit-grid { gap: 4px; }
    .grid-cell { min-height: 30px; }
    .weekly-charts { grid-template-columns: 1fr; }
    .container { padding: 12px; }
}

/* Navbar Logo Glassmorphism Style */
.navbar-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    padding: 4px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3), 0 0 20px rgba(102, 126, 234, 0.2);
    transition: all 0.3s ease;
}

.navbar-logo:hover {
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.5), 0 0 30px rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.15);
}
