/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #1a1a1a;
    background-color: #fafafa;
    min-height: 100vh;
    overflow-x: hidden;
}

/* App Container */
.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 800px;
    margin: 0 auto;
    background-color: #f8f9fa;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
}

/* Header */
.header {
    background: linear-gradient(135deg, #000000 0%, #2c2c2c 100%);
    color: #ffffff;
    padding: 2rem 1.5rem;
    text-align: center;
}

.header-content {
    max-width: 600px;
    margin: 0 auto;
}

.app-title {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.app-subtitle {
    font-size: 1rem;
    font-weight: 300;
    opacity: 0.9;
    margin-bottom: 1.5rem;
}

/* Progress Bar */
.progress-container {
    margin-top: 1.5rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffffff 0%, #e0e0e0 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.9;
}

/* Tab Navigation */
.tab-navigation {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    padding: 0;
    display: flex;
    width: 100%;
}

.tab-btn {
    background-color: #e9ecef;
    border: 1px solid #dee2e6;
    color: #495057;
    padding: 1rem;
    border-radius: 0;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    text-align: center;
    border-bottom: none;
}

.tab-btn:first-child {
    border-right: none;
}

.tab-btn:hover {
    background-color: #dee2e6;
    color: #212529;
}

.tab-btn.active {
    background-color: #ffffff;
    color: #000000;
    border-color: #dee2e6;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0;
    background-color: #f8f9fa;
    min-height: 0;
    overflow: hidden;
}

/* Loading State */
.loading-state {
    text-align: center;
    color: #666666;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f0f0f0;
    border-top: 3px solid #333333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Card Container */
.card-container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    flex: 0 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 70vh;
    overflow: hidden;
}

/* Study Card */
.study-card {
    background-color: #ffffff;
    border: 2px solid #000000;
    border-radius: 12px;
    padding: 0.8rem;
    margin: 2px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
    width: calc(100% - 4px);
}

.study-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

/* Card Header */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.card-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-number {
    background-color: #000000;
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    min-width: 60px;
    text-align: center;
}

.card-category {
    background-color: #f0f0f0;
    color: #333333;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.4rem 0.8rem;
    border-radius: 15px;
    border: 1px solid #ddd;
    white-space: nowrap;
}

.audio-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Language Selector */
.language-selector {
    position: relative;
}

.language-select {
    background-color: #ffffff;
    border: 2px solid #000000;
    color: #000000;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    appearance: none;
    padding-right: 2rem;
    min-width: 100px;
}

.language-select:hover {
    background-color: #f8f8f8;
}

.language-select:focus {
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.2);
}

/* Custom dropdown arrow */
.language-selector::after {
    content: '▼';
    position: absolute;
    right: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    pointer-events: none;
    color: #333333;
}

.tts-button {
    background-color: transparent;
    border: 2px solid #000000;
    color: #000000;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tts-button:hover {
    background-color: #000000;
    color: #ffffff;
    transform: scale(1.05);
}

.tts-button:active {
    transform: scale(0.95);
}

.tts-button.speaking {
    background-color: #000000;
    color: #ffffff;
    animation: pulse 1.5s ease-in-out infinite;
}

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



/* Card Content */
.card-content {
    text-align: center;
}

/* Sentence Structure */
.sentence-structure {
    display: none; /* 기존 컨테이너 숨김 */
}

/* Memory Controls */
.memory-controls {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 1rem;
    padding: 0.25rem 0.6rem;
    justify-content: space-between;
    background: #f8f9fa;
    border-radius: 8px;
}

.memory-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    padding: 0.4rem 0.7rem;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: #ffffff;
    color: #333;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 80px;
    max-width: 150px;
    flex: 1 1 auto;
    height: 38px;
}

.memory-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.memory-btn.known {
    border-color: #4285F4;
    color: #4285F4;
}

.memory-btn.known:hover,
.memory-btn.known.active {
    background-color: rgba(66, 133, 244, 0.1);
    border-color: #1a73e8;
    color: #1a73e8;
}

.memory-btn.unknown {
    border-color: #EA4335;
    color: #EA4335;
}

.memory-btn.unknown:hover,
.memory-btn.unknown.active {
    background-color: rgba(234, 67, 53, 0.1);
    border-color: #d33b2c;
    color: #d33b2c;
}

.memory-btn.reset {
    border-color: #666;
    color: #666;
}

.memory-btn.reset:hover {
    background-color: rgba(102, 102, 102, 0.1);
    border-color: #333;
    color: #333;
}

.btn-icon {
    font-weight: 700;
    font-size: 1.3rem;
}

.btn-text {
    font-size: 1rem;
}

/* Inline Memory Controls (카드 내부) */
.memory-controls-inline {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    justify-content: center;
    background: transparent;
    border-top: none;
    border-radius: 0;
}

.memory-btn-inline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.5rem 1rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 70px;
    flex: 0 0 auto;
    height: 40px;
    backdrop-filter: blur(10px);
}

.memory-btn-inline:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.memory-btn-inline.known {
    border-color: #4285F4;
    color: #4285F4;
}

.memory-btn-inline.known:hover,
.memory-btn-inline.known.active {
    background-color: rgba(66, 133, 244, 0.15);
    border-color: #1a73e8;
    color: #1a73e8;
}

.memory-btn-inline.unknown {
    border-color: #EA4335;
    color: #EA4335;
}

.memory-btn-inline.unknown:hover,
.memory-btn-inline.unknown.active {
    background-color: rgba(234, 67, 53, 0.15);
    border-color: #d33b2c;
    color: #d33b2c;
}

.memory-btn-inline.reset {
    border-color: #666;
    color: #666;
}

.memory-btn-inline.reset:hover {
    background-color: rgba(102, 102, 102, 0.15);
    border-color: #333;
    color: #333;
}



.part-english {
    font-family: 'Roboto', sans-serif;
    font-size: 1.1rem;
    font-weight: 500;
    color: #1a1a1a;
    margin-bottom: 0.25rem;
}

.part-korean {
    font-size: 0.95rem;
    color: #666;
    font-style: italic;
}

/* Memory Status Styles */
.study-card.memorized {
    background: linear-gradient(135deg, rgba(66, 133, 244, 0.05) 0%, rgba(66, 133, 244, 0.1) 100%);
    border-color: rgba(66, 133, 244, 0.3);
}

.study-card.not-memorized {
    background: linear-gradient(135deg, rgba(234, 67, 53, 0.05) 0%, rgba(234, 67, 53, 0.1) 100%);
    border-color: rgba(234, 67, 53, 0.3);
}



.english-text {
    font-family: 'Roboto', sans-serif;
    font-size: 1.4rem;
    font-weight: 500;
    color: #000000;
    line-height: 1.5;
    margin-bottom: 1.5rem;
    letter-spacing: 0.5px;
    transition: opacity 0.3s ease, transform 0.3s ease;
}



.divider {
    width: 60px;
    height: 2px;
    background-color: #000000;
    margin: 1.5rem auto;
    border-radius: 1px;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.korean-text {
    font-size: 1.1rem;
    color: #333333;
    line-height: 1.6;
    font-weight: 400;
    transition: opacity 0.3s ease, transform 0.3s ease;
    margin-bottom: 0;
}



/* Footer */
.footer {
    background: linear-gradient(135deg, #000000 0%, #2c2c2c 100%);
    color: #ffffff;
    padding: 1rem 1.5rem;
    text-align: center;
    border-top: 4px solid #f0f0f0;
}

.footer p {
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.9;
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-title {
        font-size: 1.8rem;
    }
    
    .app-subtitle {
        font-size: 0.9rem;
    }
    
    .tab-navigation {
        padding: 0;
    }
    
    .tab-btn {
        padding: 0.8rem;
        font-size: 0.8rem;
    }
    
    .main-content {
        padding: 0;
    }
    
    .study-card {
        padding: 0.6rem;
        margin: 2px;
        border-radius: 12px;
        width: calc(100% - 4px);
    }
    
    .english-text {
        font-size: 1.2rem;
    }
    

    
    .korean-text {
        font-size: 1rem;
    }
    
    /* 모바일에서 색상 분석 문장 최적화 */
    .colored-sentence {
        font-size: 1rem;
        line-height: 1.6;
        word-spacing: 1px;
        padding: 0.75rem;
    }
    
    /* 모바일에서 문장 분석 최적화 */
    .sentence-breakdown {
        padding: 0.5rem;
        margin-bottom: 0.75rem;
    }
    
    .sentence-part {
        margin-bottom: 0.5rem;
        padding: 0.4rem;
    }
    
    .part-english {
        font-size: 1rem;
    }
    
    .part-korean {
        font-size: 0.85rem;
    }
    
    /* 모바일에서 메모리 컨트롤 최적화 */
    .memory-controls {
        gap: 0.3rem;
        padding: 0.4rem;
    }
    
    .memory-btn {
        font-size: 0.75rem;
        padding: 0.4rem 0.6rem;
        gap: 0.2rem;
    }
    
    .btn-text {
        font-size: 0.7rem;
    }
    
    .btn-icon {
        font-size: 0.9rem;
    }
    

    
    /* 모바일에서 품사 표시 최적화 */
    .noun-word, .pronoun-word, .verb-word, .adjective-word,
    .adverb-word, .preposition-word, .article-word, .conjunction-word {
        padding: 1px 2px;
        margin-right: 1px;
        font-size: 0.95em;
        border-bottom-width: 1px;
    }

}

@media (max-width: 480px) {
    .header {
        padding: 1.5rem 1rem;
    }
    
    .app-title {
        font-size: 1.6rem;
    }
    
    .tab-navigation {
        padding: 0;
    }
    
    .tab-btn {
        padding: 0.6rem 0.5rem;
        font-size: 0.7rem;
    }
    
    .study-card {
        padding: 0.5rem;
        margin: 2px;
        border-radius: 12px;
        width: calc(100% - 4px);
    }
    
    .english-text {
        font-size: 1.1rem;
    }
    
    /* 모바일 인라인 메모리 버튼 */
    .memory-controls-inline {
        gap: 0.4rem;
        padding: 0.4rem 0.8rem;
        margin-top: 0.4rem;
    }
    
    .memory-btn-inline {
        padding: 0.45rem 0.7rem;
        font-size: 0.8rem;
        min-width: 60px;
        height: 36px;
        gap: 0.2rem;
    }
    
    .memory-btn-inline .btn-icon {
        font-size: 1.1rem;
    }
    
    .memory-btn-inline .btn-text {
        font-size: 0.8rem;
    }
    
    /* 작은 모바일에서 색상 분석 문장 최적화 */
    .colored-sentence {
        font-size: 0.9rem;
        line-height: 1.5;
        word-spacing: 0px;
        padding: 0.5rem;
    }
    
    /* 작은 모바일에서 문장 분석 더욱 최적화 */
    .sentence-breakdown {
        padding: 0.4rem;
        margin-bottom: 0.5rem;
    }
    
    .sentence-part {
        margin-bottom: 0.4rem;
        padding: 0.3rem;
    }
    
    .part-english {
        font-size: 0.9rem;
    }
    
    .part-korean {
        font-size: 0.8rem;
    }
    
    /* 작은 모바일에서 메모리 컨트롤 더욱 최적화 */
    .memory-controls {
        gap: 0.18rem;
        padding: 0.15rem 0.25rem;
        margin-bottom: 0.75rem;
        justify-content: space-between;
    }
    
    .memory-btn {
        font-size: 0.75rem;
        padding: 0.25rem 0.4rem;
        gap: 0.12rem;
        flex: 1 1 auto;
        min-width: 58px;
        max-width: 100px;
        height: 34px;
    }
    
    .btn-text {
        font-size: 0.7rem;
    }
    
    .btn-icon {
        font-size: 0.9rem;
    }
    

    
    .card-header {
        margin-bottom: 1rem;
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .card-number {
        font-size: 1rem;
        padding: 0.4rem 0.8rem;
    }
    
    .card-category {
        font-size: 0.8rem;
        padding: 0.3rem 0.6rem;
    }
    
    .tts-button {
        width: 44px;
        height: 44px;
    }
    
    .voice-select {
        font-size: 0.8rem;
        padding: 0.3rem 1.5rem 0.3rem 0.6rem;
        min-width: 90px;
    }
    
    .card-info {
        justify-content: center;
    }
    
    .audio-controls {
        justify-content: center;
        gap: 0.5rem;
    }
    
    /* 모바일에서 언어 선택기 최적화 */
    .language-select {
        font-size: 0.8rem;
        padding: 0.3rem 0.6rem;
        padding-right: 1.8rem;
        min-width: 90px;
    }
    
    .language-selector::after {
        right: 0.5rem;
        font-size: 0.6rem;
    }
    

    
    .colored-sentence {
        font-size: 1rem;
        padding: 0.6rem;
    }
    
    .sentence-structure {
        margin: 1rem 0;
        padding: 0.75rem;
    }
}

/* 매우 작은 화면 (360px 이하) - 메모리 컨트롤 최적화 */
@media (max-width: 360px) {
    .memory-controls {
        flex-direction: row;
        gap: 0.15rem;
        padding: 0.12rem 0.18rem;
        justify-content: space-between;
    }
    
    /* 매우 작은 화면에서 언어 선택기 */
    .language-select {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
        padding-right: 1.6rem;
        min-width: 80px;
    }
    
    .tts-button {
        width: 42px;
        height: 42px;
    }
    
    .memory-btn {
        flex: 1 1 auto;
        justify-content: center;
        font-size: 0.55rem;
        padding: 0.15rem 0.25rem;
        min-width: 42px;
        max-width: 65px;
        gap: 0.06rem;
        height: 30px;
    }
    
    .btn-text {
        font-size: 0.45rem;
    }
    
    .btn-icon {
        font-size: 0.65rem;
    }
    
    /* 360px 이하 인라인 메모리 버튼 */
    .memory-controls-inline {
        gap: 0.3rem;
        padding: 0.3rem 0.6rem;
        margin-top: 0.3rem;
    }
    
    .memory-btn-inline {
        padding: 0.4rem 0.5rem;
        font-size: 0.7rem;
        min-width: 50px;
        height: 32px;
        gap: 0.15rem;
    }
    
    .memory-btn-inline .btn-icon {
        font-size: 1rem;
    }
    
    .memory-btn-inline .btn-text {
        font-size: 0.7rem;
    }
    
    /* 360px 이하에서 섹션 여백 최소화 */
    .answer-section-line {
        margin-bottom: 0.08rem;
    }
    
    .answer-section-divider {
        margin: 0.03rem 0;
    }
    
    .answer-section-title-line {
        margin-bottom: 0.1rem;
        font-size: 0.65rem;
    }
    
    .answer-section-content-line {
        font-size: 0.7rem;
        line-height: 1.3;
    }
    
    .answer-container {
        padding: 0.15rem;
    }
    
    .answer-text {
        font-size: 0.75rem;
        padding: 0.03rem 0.02rem 0;
        max-height: 60vh;
    }
    
    .answer-header {
        margin-bottom: 0.01rem;
        gap: 0.08rem;
    }
}

/* 초소형 화면 (320px 이하) - 극한 최적화 */
@media (max-width: 320px) {
    .memory-controls {
        gap: 0.12rem;
        padding: 0.1rem 0.15rem;
        justify-content: space-between;
    }
    
    .memory-btn {
        font-size: 0.48rem;
        padding: 0.12rem 0.2rem;
        min-width: 36px;
        max-width: 58px;
        gap: 0.05rem;
        height: 28px;
    }
    
    .btn-text {
        font-size: 0.38rem;
    }
    
    .btn-icon {
        font-size: 0.58rem;
    }
    
    /* 320px 이하 인라인 메모리 버튼 */
    .memory-controls-inline {
        gap: 0.25rem;
        padding: 0.2rem 0.5rem;
        margin-top: 0.2rem;
    }
    
    .memory-btn-inline {
        padding: 0.35rem 0.4rem;
        font-size: 0.6rem;
        min-width: 42px;
        height: 28px;
        gap: 0.1rem;
    }
    
    .memory-btn-inline .btn-icon {
        font-size: 0.9rem;
    }
    
    .memory-btn-inline .btn-text {
        font-size: 0.6rem;
    }
    
    /* 320px 이하에서 극한 섹션 여백 최소화 */
    .answer-section-line {
        margin-bottom: 0.05rem;
    }
    
    .answer-section-divider {
        margin: 0.02rem 0;
    }
    
    .answer-section-title-line {
        margin-bottom: 0.05rem;
        font-size: 0.7rem;
    }
    
    .answer-section-content-line {
        font-size: 0.65rem;
        line-height: 1.25;
    }
    
    .answer-container {
        padding: 0.1rem;
    }
    
    .answer-text {
        font-size: 0.7rem;
        padding: 0.02rem 0.01rem 0;
        max-height: 55vh;
    }
    
    .answer-section-title-line {
        font-size: 0.6rem;
    }
    
    .answer-header {
        margin-bottom: 0.005rem;
        gap: 0.03rem;
    }
}

/* Flip Card Styles - 카드 스타일 */
.flip-card-container {
    perspective: 1000px;
    width: 100%;
    min-height: auto;
    margin: 0;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: auto;
    min-height: auto;
    transition: transform 0.6s ease-in-out;
    transform-style: preserve-3d;
    cursor: pointer;
}

.flip-card-container.flipped .flip-card-inner {
    transform: rotateX(180deg);
}

.flip-card-front,
.flip-card-back {
    position: relative;
    width: 100%;
    height: auto;
    min-height: auto;
    backface-visibility: hidden;
    border-radius: 12px;
}

.flip-card-front {
    background: transparent;
}

.flip-card-back {
    background: transparent;
    transform: rotateX(180deg);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 0;
    margin: 0;
}

.memory-image-container {
    width: calc(100% - 4px);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 400px;
    max-height: 400px;
    background-color: #ffffff;
    border: 2px solid #000000;
    border-radius: 12px;
    margin: 2px;
    padding: 0.8rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.memory-image-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    aspect-ratio: 1 / 1;
}

/* Answer Container for Question Cards - 질문카드와 동일한 스타일 */
.answer-container {
    width: calc(100% - 4px);
    height: auto;
    max-height: none;
    min-height: auto;
    display: flex;
    flex-direction: column;
    padding: 0.3rem;
    margin: 2px;
    overflow: visible;
    background-color: #ffffff;
    border: 2px solid #000000;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 닫기 버튼 제거 */
.close-flip-button {
    display: none;
}

/* 답변 헤더 - 질문카드와 동일한 스타일 */
.answer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.05rem;
    flex-wrap: wrap;
    gap: 0.2rem;
}

.answer-header .card-info {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.answer-header .card-number {
    background-color: #000000;
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    min-width: 60px;
    text-align: center;
}

.answer-header .card-category {
    background-color: #f0f0f0;
    color: #333333;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.4rem 0.8rem;
    border-radius: 15px;
    border: 1px solid #ddd;
    white-space: nowrap;
}

.answer-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.answer-tts-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.answer-tts-button:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.answer-tts-button.speaking {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    animation: pulse 1.5s ease-in-out infinite;
}

.answer-text {
    font-size: 0.85rem;
    line-height: 1.3;
    color: #333333;
    background: #ffffff;
    padding: 0.1rem 0.05rem 0.05rem 0.05rem;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    flex: none;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 70vh;
    font-family: 'Roboto', sans-serif;
    box-shadow: none;
    display: block;
    width: auto;
}

/* 전체 화면 모드에서 답변 텍스트 */
.flip-card-container.flipped .answer-text {
    font-size: 1.3rem;
    line-height: 2.0;
    padding: 2.5rem;
    min-height: calc(100vh - 160px);
    max-height: calc(100vh - 160px);
}

/* 선 기반 답변 섹션 스타일 - 모바일 최적화 */
.answer-section-line {
    margin-bottom: 0.15rem;
}

/* 마지막 섹션 여백 제거 */
.answer-section-line.last-section {
    margin-bottom: 0;
}

.answer-section-divider {
    width: 100%;
    height: 1px;
    background-color: #dee2e6;
    margin: 0.1rem 0;
}

.answer-section-title-line {
    font-size: 0.75rem;
    font-weight: 700;
    color: #000000;
    margin-bottom: 0.1rem;
    display: block;
    padding-bottom: 0.05rem;
    border-bottom: 2px solid #000000;
    display: inline-block;
}

.answer-section-content-line {
    font-size: 0.8rem;
    line-height: 1.3;
    color: #333333;
    font-family: 'Roboto', sans-serif;
}

/* 스크롤바 스타일 커스터마이징 */
.answer-text::-webkit-scrollbar {
    width: 6px;
}

.answer-text::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.answer-text::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.answer-text::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Firefox 스크롤바 스타일 */
.answer-text {
    scrollbar-width: thin;
    scrollbar-color: #888 #f1f1f1;
}

/* 전체 화면에서 섹션 스타일 - 제거됨 (일반 카드 크기로 통일) */

/* Hover effect for flip card */
.flip-card-inner:hover {
    transform: scale(1.01);
}

.flip-card-container.flipped .flip-card-inner:hover {
    transform: rotateX(180deg) scale(1.01);
}

/* Mobile optimization for flip card */
@media (max-width: 480px) {
    .flip-card-container {
        min-height: auto;
    }
    
    .flip-card-inner {
        min-height: auto;
        height: auto;
    }
    
    .flip-card-front,
    .flip-card-back {
        min-height: auto;
        height: auto;
    }
    
    .flip-card-back {
        padding: 1rem;
    }
    
    .memory-image-container {
        max-width: 300px;
        max-height: 300px;
    }
    
    /* Mobile optimization for answer container */
    .answer-container {
        padding: 0.6rem;
        margin: 2px;
        height: auto;
        min-height: auto;
        border-radius: 12px;
        width: calc(100% - 4px);
    }
    
    .answer-header {
        margin-bottom: 0.3rem;
        flex-direction: row;
        align-items: center;
        gap: 0.3rem;
        flex-wrap: nowrap;
    }
    
    .answer-header .card-number {
        font-size: 0.9rem;
        padding: 0.3rem 0.6rem;
        min-width: 40px;
    }
    
    .answer-header .card-category {
        font-size: 0.7rem;
        padding: 0.25rem 0.4rem;
        white-space: nowrap;
    }
    
    .answer-buttons {
        flex-shrink: 0;
    }
    
    .answer-tts-button {
        width: 36px;
        height: 36px;
    }
    
    .answer-tts-button {
        width: 42px;
        height: 42px;
    }
    
    .answer-text {
        font-size: 0.85rem;
        line-height: 1.3;
        padding: 0.25rem 0.15rem 0;
        flex: none;
        overflow: visible;
    }
    
    .answer-section-title-line {
        font-size: 0.8rem;
        margin-bottom: 0.25rem;
        padding-bottom: 0.1rem;
    }
    
    .answer-section-content-line {
        font-size: 0.85rem;
        line-height: 1.3;
    }
    
    .answer-section-line {
        margin-bottom: 0.5rem;
    }
    
    .answer-section-line.last-section {
        margin-bottom: 0;
    }
    
    .answer-section-divider {
        margin: 0.4rem 0;
    }
    
    /* 모바일 답변 섹션 최적화 - 이미 위에서 처리됨 */
    
    .close-flip-button {
        top: 0.5rem;
        right: 0.5rem;
        width: 40px;
        height: 40px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print Styles */
@media print {
    .header,
    .navigation,
    .footer {
        display: none;
    }
    
    .study-card {
        border: 2px solid #000000;
        box-shadow: none;
        margin-bottom: 2rem;
        page-break-inside: avoid;
    }
}

/* Range Playback Section */
.range-playback {
    background-color: #f8f9fa;
    border-top: none;
    padding: 1rem;
    margin: 0;
    flex-shrink: 0;
}

.range-container {
    max-width: 800px;
    margin: 0 auto;
}

.range-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 1.5rem;
    text-align: center;
}

.range-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.range-inputs {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.input-group label {
    font-size: 0.8rem;
    font-weight: 500;
    color: #495057;
    white-space: nowrap;
}

.range-input {
    width: 50px;
    padding: 0.5rem;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    background-color: #ffffff;
    transition: border-color 0.2s ease;
}

.range-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.range-separator {
    font-size: 1.2rem;
    font-weight: 600;
    color: #6c757d;
    margin: 0 0.5rem;
}

.range-filter {
    display: flex;
    align-items: center;
}

.status-filter {
    background-color: #ffffff;
    border: 2px solid #dee2e6;
    color: #495057;
    padding: 0.5rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    appearance: none;
    min-width: 65px;
    text-align: center;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1rem;
    padding-right: 2rem;
}

.status-filter:hover {
    border-color: #007bff;
    background-color: #f8f9fa;
}

.status-filter:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.range-actions {
    display: flex;
    gap: 1rem;
}

.range-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 65px;
    white-space: nowrap;
}

.range-btn.primary {
    background-color: #007bff;
    color: #ffffff;
}

.range-btn.primary:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.range-btn.secondary {
    background-color: #dc3545;
    color: #ffffff;
}

.range-btn.secondary:hover {
    background-color: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

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

.range-status {
    background-color: #ffffff;
    border: 2px solid #007bff;
    border-radius: 12px;
    padding: 1rem;
    margin-top: 1.5rem;
}

.status-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.current-card {
    color: #007bff;
}

.repeat-count {
    color: #28a745;
}

.total-progress {
    color: #6c757d;
}

.range-progress-bar {
    width: 100%;
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.range-progress-fill {
    height: 100%;
    background-color: #007bff;
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .range-playback {
        padding: 1rem 1rem;
        margin-top: 0;
        margin-bottom: 0;
    }
    
    .main-content {
        padding: 0;
    }
    
    .range-title {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }
    
    .range-controls {
        gap: 0.6rem;
    }
    
    .status-filter {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
        min-width: 55px;
        padding-right: 1.8rem;
    }
    
    .range-inputs {
        justify-content: center;
        gap: 0.4rem;
    }
    
    .range-input {
        width: 42px;
        padding: 0.4rem;
        font-size: 0.75rem;
    }
    
    .input-group label {
        font-size: 0.7rem;
    }
    
    .range-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.75rem;
        min-width: 50px;
    }
    
    .status-info {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .range-playback {
        padding: 0.8rem 0.5rem;
        margin-top: 0;
        margin-bottom: 0;
    }
    
    .main-content {
        padding: 0;
    }
    
    .range-input {
        width: 35px;
        padding: 0.25rem;
        font-size: 0.65rem;
    }
    
    .input-group label {
        font-size: 0.55rem;
    }
    
    .range-btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.6rem;
        min-width: 40px;
    }
    
    .status-filter {
        padding: 0.3rem 0.5rem;
        font-size: 0.65rem;
        min-width: 45px;
        padding-right: 1.5rem;
    }
    
    .memory-btn {
        font-size: 0.5rem;
        padding: 0.18rem 0.25rem;
        gap: 0.06rem;
        min-width: 38px;
        max-width: 60px;
        flex: 1;
        white-space: nowrap;
    }
    
    .btn-text {
        font-size: 0.45rem;
    }
    
    .btn-icon {
        font-size: 0.65rem;
    }
    
    /* 480px 이하 답변 텍스트 최적화 */
    .answer-text {
        font-size: 0.8rem;
        line-height: 1.25;
        padding: 0.05rem 0.03rem 0;
        flex: none;
        overflow-y: auto;
        overflow-x: hidden;
        max-height: 65vh;
    }
    
    .answer-container {
        padding: 0.2rem;
        margin: 2px;
        height: auto;
        min-height: auto;
        border-radius: 12px;
        width: calc(100% - 4px);
    }
    
    .answer-section-title-line {
        font-size: 0.7rem;
        margin-bottom: 0.1rem;
        padding-bottom: 0.03rem;
    }
    
    .answer-section-content-line {
        font-size: 0.75rem;
        line-height: 1.25;
    }
    
    .answer-section-line {
        margin-bottom: 0.1rem;
    }
    
    .answer-section-line.last-section {
        margin-bottom: 0;
    }
    
    .answer-section-divider {
        margin: 0.1rem 0;
    }
    
    .answer-header {
        margin-bottom: 0.02rem;
        gap: 0.1rem;
    }
    
    .answer-section-divider {
        margin: 0.3rem 0;
    }
    
    .answer-header {
        margin-bottom: 0.2rem;
        gap: 0.2rem;
        flex-wrap: nowrap;
        flex-direction: row;
    }
    
    .answer-header .card-number {
        font-size: 0.8rem;
        padding: 0.2rem 0.4rem;
        min-width: 35px;
    }
    
    .answer-header .card-category {
        font-size: 0.65rem;
        padding: 0.2rem 0.3rem;
        white-space: nowrap;
    }
    
    .answer-tts-button {
        width: 32px;
        height: 32px;
    }
}