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

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    background: white;
    width: 100%;
    height: 100%;
    padding: 0;
    animation: fadeIn 0.5s ease-in;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 481px) {
    body {
        overflow: visible;
    }

    .container {
        max-width: 480px;
        height: auto;
        max-height: 90vh;
        border-radius: 20px;
        box-shadow: 0 20px 60px rgba(0,0,0,0.3);
        margin: 20px;
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.app-header {
    position: sticky;
    top: 0;
    background: #667eea;
    color: white;
    padding: 20px;
    text-align: center;
    margin: 0 0 0 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.app-header h1 {
    color: white;
    margin: 0;
    font-size: 1.3em;
    font-weight: 600;
}

.header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

h1 {
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 1.8em;
    font-weight: 700;
}

.subtitle {
    color: #7f8c8d;
    font-size: 0.95em;
    margin: 0;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
}

.screen-content {
    padding: 20px;
}

.btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 14px 30px;
    border-radius: 50px;
    font-size: 1em;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: block;
    margin: 10px auto;
    font-weight: 600;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn.secondary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.btn.secondary:hover {
    box-shadow: 0 10px 20px rgba(245, 87, 108, 0.4);
}

.btn-group {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 10px 0;
}

.quick-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 30px;
    gap: 10px;
}

.quick-stat-item {
    flex: 1;
    text-align: center;
    padding: 15px 10px;
    background: #f8f9fa;
    border-radius: 12px;
}

.quick-stat-icon {
    font-size: 1.8em;
    margin-bottom: 8px;
}

.quick-stat-value {
    font-size: 1.4em;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 4px;
}

.quick-stat-label {
    font-size: 0.75em;
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 20px;
}

.menu-item {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 16px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

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

.menu-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.menu-item:hover::before {
    opacity: 0.05;
}

.menu-item:active::before {
    opacity: 0.1;
}

.menu-item > * {
    position: relative;
    z-index: 1;
}

.menu-icon {
    font-size: 3em;
    margin-bottom: 12px;
    filter: grayscale(0.3);
}

.menu-title {
    font-size: 1.1em;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 6px;
}

.menu-desc {
    font-size: 0.85em;
    color: #95a5a6;
}

.menu-item.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.stat-item {
    text-align: center;
}

.stat-label {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.8em;
    font-weight: bold;
    color: #667eea;
}

.question-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 20px;
    border-radius: 15px;
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.5em;
    font-weight: 600;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.4;
}

.answer-box {
    background: #f8f9fa;
    padding: 40px 30px;
    border-radius: 15px;
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.5em;
    font-weight: 500;
    color: #333;
}

.correct-answer-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 30px;
    border-radius: 15px;
    text-align: center;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.answer-label {
    font-size: 0.8em;
    opacity: 0.9;
    margin-bottom: 15px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.correct-answer-text {
    font-size: 1.8em;
    font-weight: 600;
    line-height: 1.4;
}

.user-answer-box {
    background: #f8f9fa;
    padding: 25px 20px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 20px;
    border: 2px solid #e0e0e0;
}

.answer-label-small {
    font-size: 0.7em;
    color: #999;
    margin-bottom: 10px;
    font-weight: 500;
}

.user-answer-text {
    font-size: 1.1em;
    color: #666;
    font-weight: 400;
}

.recording-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
    font-size: 1.1em;
    color: #666;
}

.recording-dot {
    width: 12px;
    height: 12px;
    background: #e74c3c;
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

.transcript {
    background: white;
    border: 2px solid #667eea;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    min-height: 60px;
    font-size: 1.2em;
    color: #333;
    text-align: center;
}

.result-icon {
    font-size: 4em;
    margin: 20px 0;
    text-align: center;
}

.correct {
    color: #27ae60;
}

.incorrect {
    color: #e74c3c;
}

.timer {
    text-align: center;
    font-size: 1.5em;
    color: #667eea;
    margin: 10px 0;
}

.result-list {
    margin-top: 30px;
}

.result-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    border-left: 4px solid #667eea;
}

.result-item.wrong {
    border-left-color: #e74c3c;
}

.result-item.correct {
    border-left-color: #27ae60;
}

.korean {
    font-weight: 600;
    margin-bottom: 5px;
}

.english {
    color: #666;
    font-size: 0.95em;
}

.your-answer {
    color: #e74c3c;
    font-size: 0.9em;
    font-style: italic;
    margin-top: 5px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 20px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
}

.warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    color: #856404;
    text-align: center;
}

.mode-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.mode-btn {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s;
}

.mode-btn:hover {
    background: #f0f0ff;
}

.mode-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.stats-detail {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px 15px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.stat-card-icon {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.stat-card-value {
    font-size: 2em;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-card-label {
    font-size: 0.9em;
    opacity: 0.9;
}

.today-stats {
    margin-bottom: 30px;
}

.today-stats h2 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.weekly-calendar {
    margin-bottom: 30px;
}

.weekly-calendar h2 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.calendar-day {
    aspect-ratio: 1;
    background: #f8f9fa;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 8px 4px;
    border: 2px solid #e0e0e0;
    min-width: 0;
}

.calendar-day.studied {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.calendar-day.today {
    border-color: #f5576c;
    border-width: 3px;
}

.calendar-day-name {
    font-size: 0.65em;
    margin-bottom: 3px;
    opacity: 0.8;
}

.calendar-day-date {
    font-size: 0.85em;
    font-weight: bold;
}

.calendar-day-count {
    font-size: 0.6em;
    margin-top: 2px;
    opacity: 0.9;
}

@media (max-width: 480px) {
    .app-header {
        padding: 16px;
        margin: 0;
    }

    .app-header h1 {
        font-size: 1.1em;
    }

    .stat-card {
        padding: 20px 15px;
    }

    .stat-card-icon {
        font-size: 2em;
    }

    .stat-card-value {
        font-size: 1.6em;
    }

    .calendar-grid {
        gap: 3px;
    }

    .calendar-day {
        padding: 6px 2px;
        border-width: 1px;
    }

    .calendar-day.today {
        border-width: 2px;
    }

    .calendar-day-name {
        font-size: 0.6em;
        margin-bottom: 2px;
    }

    .calendar-day-date {
        font-size: 0.8em;
    }

    .calendar-day-count {
        font-size: 0.55em;
        margin-top: 1px;
    }

    h1 {
        font-size: 1.6em;
    }

    .question-box {
        font-size: 1.3em;
        padding: 30px 15px;
        min-height: 160px;
    }

    .answer-box {
        font-size: 1.2em;
        padding: 30px 20px;
    }

    .correct-answer-box {
        padding: 30px 20px;
    }

    .correct-answer-text {
        font-size: 1.5em;
    }

    .user-answer-box {
        padding: 20px 15px;
    }

    .user-answer-text {
        font-size: 1em;
    }

    .btn-group {
        gap: 6px;
    }

    .btn {
        width: 100%;
        font-size: 0.95em;
        padding: 13px 25px;
    }
}
