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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f4f8;
    color: #333;
    min-height: 100vh;
}

.screen { max-width: 800px; margin: 0 auto; padding: 20px; }

/* 헤더 */
.header { text-align: center; padding: 40px 0 30px; }
.header h1 { font-size: 2rem; color: #2c3e50; margin-bottom: 10px; }
.header p { color: #666; }

/* 업로드 */
.upload-box {
    background: white;
    border: 2px dashed #a0aec0;
    border-radius: 16px;
    padding: 50px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}
.upload-box:hover { border-color: #4299e1; background: #ebf8ff; }
.upload-icon { font-size: 3rem; margin-bottom: 15px; }
.upload-text { font-size: 1.1rem; color: #4a5568; margin-bottom: 8px; }
.upload-sub { font-size: 0.85rem; color: #a0aec0; }

/* 버튼 */
.btn-primary {
    background: #4299e1; color: white;
    border: none; border-radius: 12px;
    padding: 12px 30px; font-size: 1rem;
    cursor: pointer; margin: 10px 5px;
    transition: all 0.3s;
}
.btn-primary:hover { background: #3182ce; transform: translateY(-2px); }

.btn-secondary {
    background: #e2e8f0; color: #4a5568;
    border: none; border-radius: 12px;
    padding: 12px 30px; font-size: 1rem;
    cursor: pointer; margin: 10px 5px;
}
.btn-secondary:hover { background: #cbd5e0; }

/* 로딩 */
.loading { text-align: center; padding: 30px; }
.spinner {
    width: 50px; height: 50px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #4299e1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* 목록 헤더 */
.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 15px;
}
.btn-back {
    background: none; border: none;
    font-size: 1rem; cursor: pointer;
    color: #4299e1; padding: 8px;
}
.btn-speaker-all {
    background: #4299e1; color: white;
    border: none; border-radius: 8px;
    padding: 8px 15px; cursor: pointer;
    font-size: 0.9rem;
}
.header-info { font-size: 0.9rem; color: #666; }

/* 필터 버튼 */
.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}
.btn-filter {
    padding: 8px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 20px;
    background: white;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}
.btn-filter.active {
    background: #4299e1;
    color: white;
    border-color: #4299e1;
}

/* 문장 목록 */
.sentence-list { display: flex; flex-direction: column; gap: 10px; }

.sentence-item {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    cursor: pointer;
    transition: all 0.2s;
    gap: 12px;
}
.sentence-item:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }

.btn-speak {
    background: #ebf8ff; border: none;
    border-radius: 8px; padding: 8px 10px;
    cursor: pointer; font-size: 1.2rem;
    flex-shrink: 0;
}

.ar-badge {
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.85rem;
    font-weight: bold;
    color: white;
    flex-shrink: 0;
    min-width: 50px;
    text-align: center;
}
.ar-low { background: #48bb78; }
.ar-high { background: #f56565; }

.sentence-text {
    font-size: 0.95rem;
    color: #2d3748;
    line-height: 1.5;
    flex: 1;
}

/* 상세 화면 */
.detail-content { padding: 20px 0; }

.detail-sentence {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.detail-sentence h3 { color: #4299e1; margin-bottom: 10px; font-size: 0.9rem; }
.detail-sentence p { font-size: 1rem; line-height: 1.7; color: #2d3748; }

.slash-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f0f4f8;
}
.slash-english { color: #2d3748; font-weight: 500; }
.slash-korean { color: #718096; font-size: 0.9rem; }

/* 단어 분석표 */
.word-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.word-table th {
    background: #4299e1;
    color: white;
    padding: 8px;
    text-align: left;
}
.word-table td {
    padding: 8px;
    border-bottom: 1px solid #f0f4f8;
}
.word-table tr:hover { background: #f7fafc; }

/* 이해했어요 버튼 */
.btn-understood {
    background: #48bb78; color: white;
    border: none; border-radius: 12px;
    padding: 15px 40px; font-size: 1.1rem;
    cursor: pointer; transition: all 0.3s;
}
.btn-understood:hover { background: #38a169; transform: translateY(-2px); }

/* 업로드 버튼 */
.upload-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 15px;
}

.btn-camera {
    background: #4299e1;
    color: white;
    border: none;
    border-radius: 12px;
    padding: 15px 25px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}
.btn-camera:hover { background: #3182ce; transform: translateY(-2px); }

.btn-gallery {
    background: #48bb78;
    color: white;
    border: none;
    border-radius: 12px;
    padding: 15px 25px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}
.btn-gallery:hover { background: #38a169; transform: translateY(-2px); }

/* 카메라 화면 */
.camera-container {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: black;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#cameraVideo {
    width: 100%;
    max-height: 75vh;
    object-fit: cover;
}

.scan-guide {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -60%);
    width: 80%;
    height: 60%;
    border: 2px solid rgba(255,255,255,0.5);
}

.scan-corner {
    position: absolute;
    width: 25px;
    height: 25px;
    border-color: #4299e1;
    border-style: solid;
}
.top-left { top: -2px; left: -2px; border-width: 3px 0 0 3px; }
.top-right { top: -2px; right: -2px; border-width: 3px 3px 0 0; }
.bottom-left { bottom: -2px; left: -2px; border-width: 0 0 3px 3px; }
.bottom-right { bottom: -2px; right: -2px; border-width: 0 3px 3px 0; }

.scan-text {
    position: absolute;
    bottom: -35px;
    width: 100%;
    text-align: center;
    color: white;
    font-size: 0.9rem;
}

.camera-buttons {
    position: absolute;
    bottom: 40px;
    display: flex;
    gap: 20px;
}

.btn-capture {
    background: white;
    color: #333;
    border: none;
    border-radius: 50px;
    padding: 15px 35px;
    font-size: 1.1rem;
    cursor: pointer;
}

.btn-cancel-camera {
    background: rgba(255,255,255,0.3);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 15px 25px;
    font-size: 1.1rem;
    cursor: pointer;
}