/* ===================================
   Jong Kook's Vocabulary
   Minimal & Premium Design
=================================== */

:root {
    --bg-primary: #faf9f7;
    --bg-card: #ffffff;
    --bg-subtle: #f5f4f2;
    --bg-hover: #f0efed;

    --text-primary: #1a1a1a;
    --text-secondary: #6b6b6b;
    --text-muted: #9a9a9a;

    --accent: #c9a86c;
    --accent-hover: #b8956a;

    --success: #4a7c59;
    --danger: #9e4a4a;
    --info: #4a6a7c;

    --border: #e8e6e3;
    --border-dark: #d4d2cf;

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.06);

    --transition: 0.2s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans KR', sans-serif;
    background-color: var(--bg-primary);
    min-height: 100vh;
    padding: 24px 16px;
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

/* Title */
h1 {
    text-align: center;
    color: var(--text-primary);
    margin-bottom: 40px;
    font-size: 2.2rem;
    font-family: 'Dancing Script', cursive;
    font-weight: 700;
    letter-spacing: 0.5px;
}

h2 {
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 16px;
}

/* Accessibility */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus states */
button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ===================================
   Input Form
=================================== */
.input-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 16px;
}

.input-group {
    margin-bottom: 16px;
}

.input-group:last-of-type {
    margin-bottom: 20px;
}

.input-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.3px;
}

.input-form input[type="text"] {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    background: var(--bg-subtle);
    color: var(--text-primary);
    transition: var(--transition);
}

.input-form input[type="text"]::placeholder {
    color: var(--text-muted);
}

.input-form input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-card);
}

.input-form input.error {
    border-color: var(--danger);
}

/* Button Row */
.button-row {
    display: flex;
    gap: 12px;
}

.button-row > * {
    flex: 1;
}

/* Primary Button */
.input-form button,
#add-btn {
    width: 100%;
    padding: 14px 20px;
    background: var(--text-primary);
    color: var(--bg-card);
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.input-form button:hover,
#add-btn:hover {
    background: #333;
}

.btn-icon-small {
    font-size: 1rem;
    font-weight: 600;
}

/* Upload Button */
.upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.upload-btn:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
}

.upload-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 32px;
    padding-left: 4px;
}

/* ===================================
   Error & Toast
=================================== */
.error-message {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 8px;
    padding: 10px 14px;
    background: #faf5f5;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--danger);
    display: none;
}

.error-message.visible {
    display: block;
}

.success-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-primary);
    color: var(--bg-card);
    padding: 14px 28px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.success-toast.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ===================================
   Quiz Start Section
=================================== */
.quiz-start-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 32px;
}

.quiz-btn {
    width: 100%;
    padding: 20px 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 16px;
    text-align: left;
    background: var(--bg-card);
}

.quiz-btn:hover:not(:disabled) {
    border-color: var(--border-dark);
    background: var(--bg-subtle);
}

.quiz-btn .btn-icon-large {
    font-size: 1.2rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.quiz-btn .btn-label {
    font-size: 0.95rem;
    font-weight: 600;
    display: block;
    color: var(--text-primary);
}

.quiz-btn .btn-sublabel {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: block;
    margin-top: 2px;
}

.quiz-btn.primary-action {
    background: var(--text-primary);
    border-color: var(--text-primary);
}

.quiz-btn.primary-action .btn-label,
.quiz-btn.primary-action .btn-sublabel {
    color: var(--bg-card);
}

.quiz-btn.primary-action .btn-sublabel {
    opacity: 0.7;
}

.quiz-btn.primary-action .btn-icon-large {
    background: rgba(255,255,255,0.15);
    color: var(--bg-card);
}

.quiz-btn.primary-action:hover:not(:disabled) {
    background: #333;
    border-color: #333;
}

.quiz-btn.secondary-action .btn-icon-large {
    background: #faf5f5;
    color: var(--danger);
}

.quiz-btn.tertiary-action .btn-icon-large {
    background: #f5f3fa;
    color: #6b5a7c;
}

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

/* ===================================
   Trash Section
=================================== */
.trash-section {
    margin-bottom: 32px;
}

.trash-toggle {
    width: 100%;
    padding: 14px 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: var(--transition);
    border-radius: var(--radius-md);
}

.trash-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.trash-icon {
    font-size: 1rem;
}

.toggle-arrow {
    margin-left: auto;
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.trash-toggle[aria-expanded="true"] .toggle-arrow {
    transform: rotate(180deg);
}

.trash-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-top: 8px;
    overflow: hidden;
}

.trash-content[hidden] {
    display: none;
}

#trash-list {
    list-style: none;
    max-height: 200px;
    overflow-y: auto;
}

#trash-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

#trash-list li:last-child {
    border-bottom: none;
}

#trash-list .word-text {
    flex: 1;
    font-size: 0.9rem;
    opacity: 0.6;
}

#trash-list .word-text .korean {
    color: var(--text-primary);
    display: block;
    margin-bottom: 2px;
}

#trash-list .word-text .english {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.trash-buttons {
    display: flex;
    gap: 8px;
}

#trash-list .restore-btn,
#trash-list .permanent-delete-btn {
    padding: 8px 14px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

#trash-list .restore-btn {
    background: var(--bg-subtle);
    color: var(--text-secondary);
}

#trash-list .restore-btn:hover {
    background: var(--success);
    color: white;
}

#trash-list .permanent-delete-btn {
    background: transparent;
    color: var(--text-muted);
}

#trash-list .permanent-delete-btn:hover {
    background: var(--danger);
    color: white;
}

.trash-content .empty-message {
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.empty-trash-btn {
    width: calc(100% - 24px);
    margin: 12px;
    padding: 12px;
    background: transparent;
    color: var(--text-muted);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}

.empty-trash-btn:hover:not(:disabled) {
    border-color: var(--danger);
    color: var(--danger);
}

.empty-trash-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ===================================
   Search Section
=================================== */
.search-section {
    margin-bottom: 16px;
}

.search-type-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.search-type-btn {
    flex: 1;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.search-type-btn:hover {
    background: var(--bg-hover);
}

.search-type-btn.active {
    background: var(--text-primary);
    color: var(--bg-card);
    border-color: var(--text-primary);
}

.search-input-wrapper {
    position: relative;
}

.search-input-wrapper input {
    width: 100%;
    padding: 14px 40px 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    background: var(--bg-card);
    color: var(--text-primary);
    transition: var(--transition);
}

.search-input-wrapper input:focus {
    outline: none;
    border-color: var(--accent);
}

.search-input-wrapper input::placeholder {
    color: var(--text-muted);
}

.search-clear-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-subtle);
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 0.75rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-clear-btn:hover {
    background: var(--text-muted);
    color: var(--bg-card);
}

.search-clear-btn[hidden] {
    display: none;
}

/* ===================================
   Quiz Filter Section
=================================== */
.quiz-filter-section {
    margin-bottom: 16px;
}

.filter-toggle {
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    font-size: 0.9rem;
    color: var(--info);
    transition: var(--transition);
}

.filter-toggle:hover {
    color: var(--accent-hover);
}

.filter-toggle[aria-expanded="true"] .filter-toggle-text {
    display: none;
}

.filter-toggle[aria-expanded="true"]::before {
    content: '접기';
}

.filter-toggle-arrow {
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.filter-toggle[aria-expanded="true"] .filter-toggle-arrow {
    transform: rotate(180deg);
}

.filter-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-top: 8px;
}

.filter-content[hidden] {
    display: none;
}

.filter-group {
    margin-bottom: 20px;
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.filter-criteria-selector,
.filter-period-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-criteria-btn,
.filter-period-btn {
    padding: 10px 16px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.filter-criteria-btn:hover,
.filter-period-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-dark);
}

.filter-criteria-btn.active,
.filter-period-btn.active {
    background: var(--text-primary);
    color: var(--bg-card);
    border-color: var(--text-primary);
}

.custom-date-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    padding: 14px 16px;
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    flex-wrap: nowrap;
}

.date-input-group {
    flex: 1;
}

.date-input-group input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    background: var(--bg-card);
    color: var(--text-primary);
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.date-input-group input:focus {
    outline: none;
    border-color: var(--accent);
}

.date-input-group input::placeholder {
    color: var(--text-muted);
}

.date-separator {
    color: var(--text-muted);
    font-size: 1rem;
}

/* ===================================
   Word List
=================================== */
.word-list-section {
    margin-bottom: 40px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.scroll-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.list-container {
    max-height: 360px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.list-container::-webkit-scrollbar {
    width: 6px;
}

.list-container::-webkit-scrollbar-track {
    background: transparent;
}

.list-container::-webkit-scrollbar-thumb {
    background: var(--border-dark);
    border-radius: 3px;
}

#word-list {
    list-style: none;
}

#word-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    gap: 16px;
    transition: var(--transition);
}

#word-list li:last-child {
    border-bottom: none;
}

#word-list li:hover {
    background: var(--bg-subtle);
}

#word-list .word-text {
    flex: 1;
    min-width: 0;
}

#word-list .word-text .korean {
    color: var(--text-primary);
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
}

#word-list .word-text .english {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.list-buttons {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

#word-list .edit-btn,
#word-list .delete-btn {
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

#word-list .edit-btn {
    background: var(--bg-subtle);
    color: var(--text-secondary);
}

#word-list .edit-btn:hover {
    background: var(--accent);
    color: white;
}

#word-list .delete-btn {
    background: transparent;
    color: var(--text-muted);
}

#word-list .delete-btn:hover {
    background: var(--danger);
    color: white;
}

/* No Search Result */
.no-search-result {
    text-align: center;
    padding: 40px 24px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.no-search-result p {
    margin: 0;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
}

.empty-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* ===================================
   Modals
=================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    padding: 20px;
}

.modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    padding: 28px;
    border-radius: var(--radius-lg);
    max-width: 360px;
    width: 100%;
}

.modal h3 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
}

.modal p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 0.95rem;
    text-align: center;
    line-height: 1.5;
}

.modal-buttons {
    display: flex;
    gap: 10px;
}

.modal-buttons button {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.modal-btn-icon {
    font-size: 0.9rem;
}

.modal-cancel {
    background: var(--bg-subtle);
    color: var(--text-secondary);
}

.modal-cancel:hover {
    background: var(--bg-hover);
}

.modal-confirm {
    background: var(--danger);
    color: white;
}

.modal-confirm:hover {
    opacity: 0.9;
}

.modal-save {
    background: var(--text-primary);
    color: white;
}

.modal-save:hover {
    background: #333;
}

/* Edit Modal */
.edit-modal {
    max-width: 400px;
}

.edit-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.edit-form input {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    background: var(--bg-subtle);
    transition: var(--transition);
}

.edit-form input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-card);
}

/* ===================================
   Quiz Section
=================================== */
#quiz-section {
    display: none;
}

.quiz-header {
    margin-bottom: 32px;
}

.quiz-progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.progress-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.progress-stats {
    display: flex;
    gap: 16px;
    font-size: 0.85rem;
    font-weight: 600;
}

.stat-correct {
    color: var(--success);
}

.stat-correct::before {
    content: "O ";
}

.stat-wrong {
    color: var(--danger);
}

.stat-wrong::before {
    content: "X ";
}

.progress-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.4s ease;
}

/* Quiz Question */
.quiz-question {
    text-align: center;
    margin-bottom: 32px;
}

.quiz-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.korean-sentence-wrapper {
    margin-bottom: 24px;
}

.korean-sentence {
    font-size: 1.4rem;
    color: var(--text-primary);
    line-height: 1.8;
    padding: 32px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-weight: 500;
}

/* Answer Area */
.answer-area {
    min-height: 100px;
}

.show-btn {
    padding: 16px 32px;
    background: var(--text-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.show-btn:hover {
    background: #333;
}

.show-btn-icon {
    font-size: 1.1rem;
}

.show-btn-hint {
    font-size: 0.75rem;
    opacity: 0.6;
}

.english-sentence-wrapper {
    margin-top: 20px;
}

.english-sentence {
    display: none;
    font-size: 1.3rem;
    color: var(--accent-hover);
    line-height: 1.8;
    padding: 32px 24px;
    background: #faf8f5;
    border: 1px solid #ebe6dd;
    border-radius: var(--radius-md);
    font-weight: 600;
}

.english-sentence.visible {
    display: block;
    animation: fadeUp 0.3s ease;
}

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

/* Quiz Buttons */
.quiz-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.quiz-answer-btn {
    flex: 1;
    padding: 24px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
}

.quiz-answer-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.quiz-answer-btn:not(:disabled):hover {
    border-color: var(--border-dark);
}

.quiz-answer-btn .btn-icon {
    font-size: 1.5rem;
    font-weight: 700;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.quiz-answer-btn .btn-text {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.quiz-answer-btn .btn-shortcut {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg-subtle);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
}

.correct-btn .btn-icon {
    background: #f0f7f2;
    color: var(--success);
}

.correct-btn:not(:disabled):hover {
    background: #f7faf8;
    border-color: var(--success);
}

.wrong-btn .btn-icon {
    background: #faf5f5;
    color: var(--danger);
}

.wrong-btn:not(:disabled):hover {
    background: #fdf8f8;
    border-color: var(--danger);
}

/* Quit Button */
.quiz-nav {
    text-align: center;
    margin-bottom: 20px;
}

.quit-btn {
    padding: 12px 24px;
    background: transparent;
    color: var(--text-muted);
    border: none;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.quit-btn:hover {
    color: var(--text-secondary);
}

.quit-icon {
    font-size: 0.85rem;
}

/* Keyboard Hints */
.keyboard-hint {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    padding: 16px;
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
}

.hint-item {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.hint-item kbd {
    background: var(--bg-card);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

/* ===================================
   Result Section
=================================== */
#result-section {
    display: none;
    text-align: center;
}

.result-header {
    margin-bottom: 32px;
}

#result-section h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 1.3rem;
    font-weight: 600;
}

.result-score {
    display: inline-flex;
    align-items: baseline;
    background: var(--bg-card);
    padding: 24px 40px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.score-percent {
    font-size: 3rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.score-unit {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-left: 4px;
}

/* Result Random Image */
.result-image-container {
    margin-bottom: 20px;
}

.result-random-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius-lg);
    object-fit: contain;
    opacity: 0;
    animation: fadeInImage 0.8s ease forwards;
}

@keyframes fadeInImage {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.result-summary {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    margin-bottom: 28px;
}

.result-divider {
    width: 1px;
    height: 50px;
    background: var(--border);
}

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

.stat-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    border: 2px solid;
}

.correct-circle {
    background: #f7faf8;
    border-color: var(--success);
}

.wrong-circle {
    background: #fdf8f8;
    border-color: var(--danger);
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 700;
}

.result-stat.correct .stat-number {
    color: var(--success);
}

.result-stat.wrong .stat-number {
    color: var(--danger);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.result-message {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
    padding: 20px 24px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    line-height: 1.6;
}

/* Result Buttons */
.result-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.result-btn {
    width: 100%;
    padding: 16px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--bg-card);
    color: var(--text-primary);
}

.result-btn:hover {
    background: var(--bg-subtle);
    border-color: var(--border-dark);
}

.result-btn-icon {
    font-size: 1rem;
}

.primary-result-btn {
    background: var(--text-primary);
    color: white;
    border-color: var(--text-primary);
}

.primary-result-btn:hover {
    background: #333;
    border-color: #333;
}

.secondary-result-btn {
    background: var(--bg-card);
    border-color: var(--text-primary);
}

.secondary-result-btn:hover {
    background: var(--text-primary);
    color: white;
}

.tertiary-result-btn {
    background: transparent;
    border-color: var(--border);
    color: var(--text-secondary);
}

/* Wrong List */
.wrong-list-section {
    margin: 32px 0;
    text-align: left;
}

.wrong-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.wrong-list-section h3 {
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
}

.wrong-list-count {
    font-size: 0.8rem;
    color: var(--text-muted);
}

#wrong-list {
    list-style: none;
    max-height: 240px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

#wrong-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    gap: 16px;
}

#wrong-list li:last-child {
    border-bottom: none;
}

.wrong-item-content {
    flex: 1;
}

#wrong-list .korean {
    color: var(--text-primary);
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
}

#wrong-list .english {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.wrong-delete-btn {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}

.wrong-delete-btn:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

/* ===================================
   Responsive
=================================== */
@media (max-width: 480px) {
    body {
        padding: 16px 12px;
    }

    h1 {
        font-size: 1.9rem;
        margin-bottom: 32px;
    }

    .input-form {
        padding: 20px;
    }

    .button-row {
        flex-direction: column;
    }

    /* 검색 섹션 반응형 */
    .search-type-selector {
        flex-wrap: wrap;
    }

    .search-type-btn {
        flex: none;
        padding: 8px 14px;
        font-size: 0.8rem;
    }

    /* 필터 섹션 반응형 */
    .filter-criteria-selector,
    .filter-period-selector {
        flex-wrap: wrap;
    }

    .filter-criteria-btn,
    .filter-period-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .custom-date-inputs {
        flex-wrap: nowrap;
        gap: 8px;
    }

    .date-separator {
        flex-shrink: 0;
    }

    .date-input-group {
        min-width: 0;
    }

    .date-input-group input {
        padding: 10px 12px;
        font-size: 0.85rem;
    }

    .quiz-btn {
        padding: 16px 20px;
    }

    .korean-sentence,
    .english-sentence {
        font-size: 1.2rem;
        padding: 24px 20px;
    }

    .quiz-buttons {
        gap: 10px;
    }

    .quiz-answer-btn {
        padding: 20px 12px;
    }

    .keyboard-hint {
        display: none;
    }

    .result-summary {
        gap: 24px;
    }

    .stat-circle {
        width: 56px;
        height: 56px;
    }

    .stat-number {
        font-size: 1.3rem;
    }

    .score-percent {
        font-size: 2.5rem;
    }
}

@media (max-width: 360px) {
    h1 {
        font-size: 1.7rem;
    }

    .quiz-btn .btn-icon-large {
        display: none;
    }
}

/* ===================================
   Statistics Section
=================================== */
.stats-section {
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.stats-section h2 {
    font-size: 0.75rem;
    margin-bottom: 0;
}

.stats-period-selector {
    display: flex;
    gap: 8px;
}

.stats-period-btn {
    padding: 6px 12px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.stats-period-btn:hover {
    background: var(--bg-hover);
}

.stats-period-btn.active {
    background: var(--text-primary);
    color: var(--bg-card);
    border-color: var(--text-primary);
}

.stats-summary {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.stats-card {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
}

.stats-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stats-card-value.success {
    color: var(--success);
}

.stats-card-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.stats-chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
}

.stats-chart-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.stats-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    height: 120px;
    gap: 4px;
}

.stats-chart.monthly {
    gap: 2px;
}

.stats-bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.stats-bar-wrapper {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
}

.stats-bar {
    width: 100%;
    max-width: 32px;
    background: var(--accent);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    min-height: 4px;
    transition: height 0.3s ease;
    position: relative;
}

.stats-chart.monthly .stats-bar {
    max-width: 12px;
}

.stats-chart.monthly .stats-bar::before {
    display: none;
}

.stats-bar::before {
    content: attr(data-value);
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.stats-bar-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 8px;
    text-align: center;
}

.stats-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.stats-empty-icon {
    font-size: 2rem;
    margin-bottom: 12px;
    opacity: 0.4;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===================================
   Authentication Section
=================================== */
.auth-section {
    max-width: 400px;
    margin: 40px auto;
    padding: 40px 32px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.auth-tabs {
    display: flex;
    margin-bottom: 32px;
    border-bottom: 1px solid var(--border);
}

.auth-tab {
    flex: 1;
    padding: 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: -1px;
}

.auth-tab:hover {
    color: var(--text-secondary);
}

.auth-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.auth-form[hidden] {
    display: none;
}

.auth-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-input-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.auth-input-group input {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    background: var(--bg-card);
    transition: var(--transition);
}

.auth-input-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(201, 168, 108, 0.1);
}

.auth-input-group input::placeholder {
    color: var(--text-muted);
}

.auth-submit-btn {
    padding: 16px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 8px;
}

.auth-submit-btn:hover {
    background: var(--accent-hover);
}

.auth-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-error {
    padding: 14px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius-md);
    color: #dc2626;
    font-size: 0.9rem;
    text-align: center;
}

.auth-success {
    padding: 14px 16px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-md);
    color: #16a34a;
    font-size: 0.9rem;
    text-align: center;
}

/* User Header */
.user-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 28px;
}

.user-email {
    font-size: 0.9rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.logout-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.logout-btn:hover {
    background: var(--bg-subtle);
    border-color: var(--border-dark);
}
