/* ===== Responsive Reset & Base ===== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Noto Sans', 'Noto Sans KR', 'Nanum Gothic', sans-serif;
    background: #f8f9fa;
    color: #212529;
    line-height: 1.6;
}

#app {
    max-width: 1200px;           /* wider for desktop */
    margin: 0 auto;
    background: white;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

header {
    padding: 1.5rem;
    background: white;
    border-bottom: 1px solid #e9ecef;
    position: sticky;
    top: 0;
    z-index: 10;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #1e7e34;
}

.subtitle {
    font-size: 1rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

.progress-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
    font-size: 1rem;
}

.progress-bar-container {
    flex: 1;
    min-width: 200px;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: #28a745;
    width: 0%;
    transition: width 0.3s ease;
}

main {
    flex: 1;
    padding: 1.5rem;
}

/* ===== Day Grid ===== */
.day-grid-container h2 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.day-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.day-card {
    background: #e7f3ff;
    border-radius: 12px;
    padding: 1.5rem 0.5rem;
    text-align: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: #1e7e34;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 2px solid transparent;
}

.day-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 12px rgba(0,0,0,0.15);
    border-color: #28a745;
}

.day-card.completed {
    background: #d4edda;
    border-color: #28a745;
}

.day-card.locked {
    background: #e9ecef;
    color: #adb5bd;
    cursor: not-allowed;
    opacity: 0.7;
}

/* ===== Lesson List (cards) ===== */
.lesson-list-container {
    max-width: 800px;
    margin: 0 auto;
}

.back-btn {
    background: none;
    border: none;
    color: #1e7e34;
    font-size: 1rem;
    margin-bottom: 1rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 30px;
    background: #e9ecef;
}

.back-btn:hover {
    background: #dee2e6;
}

.lesson-cards {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.lesson-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.lesson-card:hover {
    background: #f8f9fa;
    border-color: #28a745;
}

.lesson-card.completed {
    background: #d4edda;
    border-color: #28a745;
}

.lesson-info h3 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-right: 1rem;
    display: inline;
}

.lesson-info .roman {
    font-size: 1.2rem;
    color: #6c757d;
}

.lesson-example {
    font-size: 1rem;
    color: #495057;
}

.lesson-status {
    font-size: 1.5rem;
}

/* ===== Existing lesson view tweaks ===== */
.character-display {
    text-align: center;
    margin: 2rem 0;
}

.hangul-large {
    font-size: clamp(100px, 20vw, 180px);
    font-weight: 700;
    line-height: 1.2;
    color: #212529;
}

.romanization {
    font-size: 2rem;
    color: #6c757d;
}

.example-section {
    text-align: center;
    margin: 2rem 0;
}

.example-word {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.stroke-guide {
    text-align: center;
}

#stroke-canvas {
    width: 100%;
    max-width: 240px;
    height: auto;
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

.primary-btn, .secondary-btn {
    display: block;
    width: 100%;
    max-width: 400px;
    margin: 1rem auto;
    padding: 1rem;
    font-size: 1.2rem;
    border: none;
    border-radius: 50px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

.primary-btn {
    background: #28a745;
    color: white;
}

.primary-btn:active {
    background: #218838;
}

.secondary-btn {
    background: #e9ecef;
    color: #212529;
}

.secondary-btn:active {
    background: #dee2e6;
}

/* ===== Practice View ===== */
.practice-container {
    max-width: 600px;
    margin: 0 auto;
}

#drawing-canvas {
    display: block;
    margin: 1rem auto;
    border: 2px solid #ced4da;
    border-radius: 8px;
    background: white;
    touch-action: none;
    width: 100%;
    max-width: 340px;
    height: auto;
    aspect-ratio: 1/1;
}

.practice-toolbar {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.feedback-area {
    text-align: center;
    font-size: 2rem;
    margin: 1rem 0;
    min-height: 3rem;
}

.tip-box {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    text-align: center;
    font-size: 1rem;
}

/* ===== Profile View ===== */
.profile-container {
    max-width: 500px;
    margin: 0 auto;
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 12px;
}

.profile-container p {
    font-size: 1.2rem;
    margin: 1rem 0;
}

.progress-chart {
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    margin: 1rem 0;
    overflow: hidden;
}

/* ===== Navigation ===== */
nav {
    display: flex;
    background: white;
    border-top: 1px solid #e9ecef;
    position: sticky;
    bottom: 0;
}

nav button {
    flex: 1;
    padding: 1rem;
    border: none;
    background: white;
    font-size: 1rem;
    cursor: pointer;
    color: #6c757d;
    transition: color 0.2s;
}

nav button.active {
    color: #28a745;
    font-weight: 700;
}

/* ===== Desktop Adjustments ===== */
@media (min-width: 768px) {
    .day-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .lesson-cards {
        max-width: 700px;
        margin: 0 auto;
    }
    .practice-toolbar {
        gap: 2rem;
    }
}

@media (min-width: 1024px) {
    .day-grid {
        grid-template-columns: repeat(5, 1fr);
    }
    .hangul-large {
        font-size: 180px;
    }
}