/* ========================================
   CSS Custom Properties (Design Rules)
   ======================================== */
:root {
    /* Colors */
    --bg-main: #FFFFFF;
    --bg-sub: #F0F4FF;
    --primary: #667EEA;
    --secondary: #06B6D4;
    --accent: #F97316;
    --text-main: #1F2937;
    --text-sub: #6B7280;
    --word-highlight: #C7D2FE;
    --error: #EF4444;
    --success: #22C55E;
    --gradient-header: linear-gradient(135deg, #667EEA, #06B6D4);
    --status-new: #667EEA;
    --status-learning: #FBBF24;
    --status-mastered: #22C55E;
    
    /* Fonts */
    --font-jp: 'Noto Sans JP', sans-serif;
    --font-zh: 'Noto Sans SC', sans-serif;
    --font-ko: 'Noto Sans KR', sans-serif;
    --font-en: 'Inter', sans-serif;
    
    /* Spacing */
    --padding-vertical: 16px;
    --padding-horizontal: 20px;
    --card-margin: 12px;
    
    /* Border Radius */
    --radius-card: 16px;
    --radius-modal: 12px;
    --radius-button: 24px;
    
    /* Shadows */
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-modal: 0 4px 16px rgba(0, 0, 0, 0.15);
    
    /* Transitions */
    --transition: all 0.2s ease;
}

/* ========================================
   Global Styles
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-jp);
    font-size: 16px;
    color: var(--text-main);
    background-color: var(--bg-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   App Container
   ======================================== */
.app-container {
    width: 100%;
    max-width: 768px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
    padding-bottom: 80px; /* Space for bottom tab bar */
}

/* ========================================
   Header
   ======================================== */
.app-header {
    background: var(--gradient-header);
    padding: var(--padding-vertical) var(--padding-horizontal);
    color: white;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-card);
}

.app-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
}

/* ========================================
   Main Content
   ======================================== */
.main-content {
    padding: var(--padding-vertical) var(--padding-horizontal);
    min-height: calc(100vh - 140px);
}

/* ========================================
   Bottom Tab Bar
   ======================================== */
.bottom-tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 768px;
    margin: 0 auto;
    background: var(--bg-main);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 0;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
    z-index: 1000;
}

.tab-button {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--text-sub);
    cursor: pointer;
    padding: 8px;
    transition: var(--transition);
    font-family: var(--font-jp);
}

.tab-button i {
    font-size: 20px;
}

.tab-button span {
    font-size: 10px;
    font-weight: 500;
}

.tab-button.active {
    color: var(--primary);
}

.tab-button:hover {
    opacity: 0.8;
}

/* ========================================
   Buttons
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 12px 24px;
    border-radius: var(--radius-button);
    border: none;
    font-size: 16px;
    font-weight: 500;
    font-family: var(--font-jp);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-card);
}

.btn:hover {
    transform: scale(1.02);
}

.btn:active {
    transform: scale(0.98);
}

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

.btn-accent {
    background: var(--accent);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-error {
    background: var(--error);
    color: white;
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-secondary {
    background: var(--bg-sub);
    color: var(--text-main);
}

.btn-full {
    width: 100%;
}

/* ========================================
   Cards
   ======================================== */
.card {
    background: var(--bg-main);
    border-radius: var(--radius-card);
    padding: var(--padding-vertical) var(--padding-horizontal);
    margin-bottom: var(--card-margin);
    box-shadow: var(--shadow-card);
    transition: var(--transition);
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.card-section {
    background: var(--bg-sub);
    border-radius: var(--radius-card);
    padding: var(--padding-vertical) var(--padding-horizontal);
    margin-bottom: var(--card-margin);
}

/* ========================================
   Form Elements
   ======================================== */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 8px;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--bg-sub);
    border-radius: 12px;
    font-size: 16px;
    font-family: var(--font-jp);
    color: var(--text-main);
    transition: var(--transition);
    background: var(--bg-main);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

/* ========================================
   Toast Notification
   ======================================== */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-main);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-button);
    font-size: 14px;
    box-shadow: var(--shadow-modal);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 2000;
    max-width: 90%;
    text-align: center;
}

.toast.show {
    opacity: 1;
    pointer-events: auto;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--error);
}

/* ========================================
   Loading Overlay
   ======================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.hidden {
    display: none;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   Page Elements
   ======================================== */
.page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

/* ========================================
   Translation Result
   ======================================== */
.translation-result {
    margin-top: var(--card-margin);
}

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

.result-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-sub);
}

/* Translation Text (Full Sentence) */
.translation-text-container {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.translation-text {
    flex: 1;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.5;
}

.full-text-speak-btn {
    flex-shrink: 0;
    background: var(--text-sub);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 16px;
}

.full-text-speak-btn:hover:not(:disabled) {
    background: var(--primary);
    transform: scale(1.1);
}

.full-text-speak-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.full-text-speak-btn:disabled {
    background: #D1D5DB;
    cursor: not-allowed;
    opacity: 0.5;
}

.full-text-speak-btn.speaking {
    background: var(--error);
    animation: pulse 1s infinite;
}

/* Pronunciation */
.translation-pronunciation {
    font-size: 16px;
    font-weight: 400;
    color: var(--text-sub);
    line-height: 1.5;
    margin-bottom: 12px;
    font-style: italic;
}

/* Word Breakdown Section */
.word-breakdown-section {
    margin-top: 12px;
}

.word-breakdown-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.word-tokens {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    line-height: 2;
}

.word-token {
    display: inline-block;
    padding: 4px 12px;
    background: var(--word-highlight);
    color: var(--text-main);
    border-radius: 8px;
    font-size: 18px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: underline;
    text-decoration-color: var(--primary);
    text-underline-offset: 2px;
}

.word-token:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

.word-token:active {
    transform: translateY(0);
}

/* ========================================
   Status Badges
   ======================================== */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    color: white;
}

.status-new {
    background: var(--status-new);
}

.status-learning {
    background: var(--status-learning);
}

.status-mastered {
    background: var(--status-mastered);
}

/* ========================================
   API Key Input
   ======================================== */
.api-key-input-wrapper {
    position: relative;
    display: flex;
    gap: 8px;
    align-items: center;
}

.api-key-input-wrapper .form-input {
    flex: 1;
    padding-right: 48px;
}

.toggle-visibility-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-sub);
    cursor: pointer;
    padding: 8px;
    font-size: 16px;
    transition: var(--transition);
}

.toggle-visibility-btn:hover {
    color: var(--primary);
}

.api-key-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    margin-top: 8px;
}

.api-key-status.saved {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.api-key-status.not-saved {
    background: rgba(107, 114, 128, 0.1);
    color: var(--text-sub);
}

/* ========================================
   Toggle Switch
   ======================================== */
.toggle-switch-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
}

.toggle-switch-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--text-sub);
    border-radius: 24px;
    transition: var(--transition);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--success);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.test-mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
    margin-top: 8px;
}

/* ========================================
   Modal / Word Detail Popup
   ======================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.modal-overlay.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-main);
    border-radius: var(--radius-modal);
    box-shadow: var(--shadow-modal);
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlideUp 0.3s ease;
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--bg-sub);
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-sub);
    cursor: pointer;
    padding: 4px 8px;
    transition: var(--transition);
    line-height: 1;
}

.modal-close-btn:hover {
    color: var(--text-main);
}

.modal-body {
    padding: 20px;
}

.word-detail-section {
    margin-bottom: 16px;
}

.word-detail-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-sub);
    margin-bottom: 8px;
}

.word-detail-value {
    font-size: 16px;
    color: var(--text-main);
    line-height: 1.6;
}

.word-main {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 12px;
}

.pronunciation-text {
    font-size: 18px;
    color: var(--primary);
    font-style: italic;
}

.meanings-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.meanings-list li {
    padding: 8px 0;
    padding-left: 20px;
    position: relative;
}

.meanings-list li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: 700;
}

.example-item {
    background: var(--bg-sub);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
}

.example-original {
    font-size: 15px;
    color: var(--text-main);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.example-translation {
    font-size: 14px;
    color: var(--text-sub);
}

.speak-btn {
    background: var(--primary);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
}

.speak-btn:hover {
    background: var(--secondary);
    transform: scale(1.1);
}

.speak-btn:active {
    transform: scale(0.95);
}

.speak-btn.speaking {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--bg-sub);
}

/* ========================================
   Vocabulary Page
   ======================================== */
.vocabulary-page {
    padding-bottom: 20px;
}

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

.vocabulary-count {
    font-size: 14px;
    color: var(--text-sub);
    font-weight: 500;
}

/* Search Bar */
.search-bar {
    position: relative;
    margin-bottom: 16px;
}

.search-input {
    width: 100%;
    padding: 12px 40px 12px 40px;
    border: 2px solid var(--bg-sub);
    border-radius: var(--radius-button);
    font-size: 16px;
    font-family: var(--font-jp);
    transition: var(--transition);
}

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

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-sub);
    font-size: 18px;
}

.search-clear-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-sub);
    cursor: pointer;
    padding: 6px;
    font-size: 18px;
    line-height: 1;
    transition: var(--transition);
}

.search-clear-btn:hover {
    color: var(--text-main);
}

/* Filter Tabs */
.filter-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.filter-tabs::-webkit-scrollbar {
    display: none;
}

.filter-tab {
    flex-shrink: 0;
    padding: 8px 16px;
    border: 2px solid var(--bg-sub);
    border-radius: var(--radius-button);
    background: var(--bg-main);
    color: var(--text-main);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.filter-tab:hover {
    border-color: var(--primary);
}

.filter-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.filter-tab .badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 6px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.2);
    font-size: 12px;
    font-weight: 600;
}

.filter-tab.active .badge {
    background: rgba(255, 255, 255, 0.3);
}

/* Vocabulary Cards */
.vocabulary-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.vocabulary-card {
    background: var(--bg-main);
    border: 2px solid var(--bg-sub);
    border-radius: var(--radius-card);
    padding: 16px;
    cursor: pointer;
    transition: var(--transition);
}

.vocabulary-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-card);
}

.vocabulary-card:active {
    transform: scale(0.98);
}

.vocab-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.vocab-card-word {
    flex: 1;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.3;
    word-break: break-word;
}

.vocab-card-language {
    flex-shrink: 0;
    margin-left: 12px;
    font-size: 24px;
    line-height: 1;
}

.vocab-card-pronunciation {
    font-size: 14px;
    color: var(--text-sub);
    font-style: italic;
    margin-bottom: 8px;
}

.vocab-card-meaning {
    font-size: 14px;
    color: var(--text-main);
    line-height: 1.5;
    margin-bottom: 12px;
}

.vocab-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.vocab-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}

.status-badge.new {
    background: rgba(102, 126, 234, 0.15);
    color: var(--status-new);
}

.status-badge.learning {
    background: rgba(251, 191, 36, 0.15);
    color: var(--status-learning);
}

.status-badge.mastered {
    background: rgba(34, 197, 94, 0.15);
    color: var(--status-mastered);
}

.review-count {
    font-size: 12px;
    color: var(--text-sub);
}

.vocab-speak-btn {
    background: var(--bg-sub);
    border: none;
    color: var(--text-sub);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
}

.vocab-speak-btn:hover {
    background: var(--primary);
    color: white;
}

.vocab-speak-btn.speaking {
    background: var(--error);
    color: white;
    animation: pulse 1s infinite;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
}

.empty-state-message {
    font-size: 14px;
    color: var(--text-sub);
    line-height: 1.6;
}

/* ========================================
   Review Page (Flashcard)
   ======================================== */
.review-page {
    padding-bottom: 20px;
}

.review-stats {
    display: flex;
    justify-content: space-around;
    gap: 12px;
    margin-bottom: 20px;
}

.review-stat-item {
    flex: 1;
    text-align: center;
    padding: 16px 12px;
    background: var(--bg-sub);
    border-radius: var(--radius-card);
}

.review-stat-number {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 8px;
}

.review-stat-label {
    font-size: 12px;
    color: var(--text-sub);
    font-weight: 500;
}

/* Flashcard Container */
.flashcard-container {
    perspective: 1000px;
    margin-bottom: 20px;
}

.flashcard {
    position: relative;
    width: 100%;
    min-height: 400px;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.6s;
}

.flashcard.flipped {
    transform: rotateY(180deg);
}

.flashcard-face {
    position: absolute;
    width: 100%;
    min-height: 400px;
    backface-visibility: hidden;
    border-radius: var(--radius-card);
    background: var(--bg-main);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.flashcard-front {
    background: linear-gradient(135deg, #667EEA, #06B6D4);
}

.flashcard-back {
    transform: rotateY(180deg);
    background: var(--bg-main);
    border: 2px solid var(--bg-sub);
}

.flashcard-word {
    font-size: 48px;
    font-weight: 700;
    color: white;
    text-align: center;
    margin-bottom: 16px;
    word-break: break-word;
    line-height: 1.2;
}

.flashcard-language {
    font-size: 24px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 20px;
}

.flashcard-hint {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
}

/* Flashcard Back */
.flashcard-pronunciation {
    font-size: 24px;
    color: var(--primary);
    font-style: italic;
    margin-bottom: 20px;
    text-align: center;
}

.flashcard-meaning {
    font-size: 20px;
    color: var(--text-main);
    text-align: center;
    margin-bottom: 16px;
    line-height: 1.6;
}

.flashcard-meaning-item {
    margin-bottom: 8px;
}

.flashcard-part-of-speech {
    font-size: 14px;
    color: var(--text-sub);
    margin-bottom: 20px;
    text-align: center;
}

.flashcard-speak-btn {
    background: var(--primary);
    border: none;
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 20px;
    margin-top: 20px;
}

.flashcard-speak-btn:hover {
    background: var(--secondary);
    transform: scale(1.1);
}

.flashcard-speak-btn.speaking {
    background: var(--error);
    animation: pulse 1s infinite;
}

/* Review Buttons */
.review-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.review-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 80px;
    padding: 16px 12px;
    border-radius: var(--radius-card);
    border: 2px solid var(--bg-sub);
    background: var(--bg-main);
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-jp);
}

.review-btn:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-card);
}

.review-btn:active {
    transform: scale(0.98);
}

.review-btn-again {
    border-color: var(--error);
    color: var(--error);
}

.review-btn-again:hover {
    background: var(--error);
    color: white;
}

.review-btn-hard {
    border-color: #F59E0B;
    color: #F59E0B;
}

.review-btn-hard:hover {
    background: #F59E0B;
    color: white;
}

.review-btn-good {
    border-color: var(--secondary);
    color: var(--secondary);
}

.review-btn-good:hover {
    background: var(--secondary);
    color: white;
}

.review-btn-easy {
    border-color: var(--success);
    color: var(--success);
}

.review-btn-easy:hover {
    background: var(--success);
    color: white;
}

.review-btn-master {
    border-color: var(--success);
    color: var(--success);
}

.review-btn-master:hover {
    background: var(--success);
    color: white;
}

.review-btn-label {
    font-size: 16px;
    font-weight: 600;
}

.review-btn-interval {
    font-size: 12px;
    opacity: 0.8;
}

/* Review Progress */
.review-progress {
    text-align: center;
    font-size: 14px;
    color: var(--text-sub);
    margin-bottom: 16px;
}

.review-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-sub);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 20px;
}

.review-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 0.3s ease;
}

/* Review Complete */
.review-complete {
    text-align: center;
    padding: 40px 20px;
}

.review-complete-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.review-complete-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 12px;
}

.review-complete-message {
    font-size: 16px;
    color: var(--text-sub);
    margin-bottom: 32px;
    line-height: 1.6;
}

.review-complete-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.review-complete-stat {
    padding: 20px;
    background: var(--bg-sub);
    border-radius: var(--radius-card);
}

.review-complete-stat-number {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.review-complete-stat-label {
    font-size: 14px;
    color: var(--text-sub);
}

/* ========================================
   History Page
   ======================================== */
.history-page {
    padding-bottom: 20px;
}

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

.history-count {
    font-size: 14px;
    color: var(--text-sub);
    font-weight: 500;
}

.clear-all-btn {
    background: none;
    border: none;
    color: var(--error);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    transition: var(--transition);
}

.clear-all-btn:hover {
    opacity: 0.7;
}

/* History Cards */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-card {
    background: var(--bg-main);
    border: 2px solid var(--bg-sub);
    border-radius: var(--radius-card);
    padding: 16px;
    cursor: pointer;
    transition: var(--transition);
}

.history-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-card);
}

.history-card:active {
    transform: scale(0.98);
}

.history-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.history-card-date {
    font-size: 12px;
    color: var(--text-sub);
}

.history-card-language {
    font-size: 20px;
}

.history-card-content {
    margin-bottom: 8px;
}

.history-card-original {
    font-size: 14px;
    color: var(--text-main);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

.history-card-arrow {
    font-size: 12px;
    color: var(--text-sub);
    margin-bottom: 4px;
}

.history-card-translated {
    font-size: 14px;
    color: var(--primary);
    font-weight: 500;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

.history-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}

.history-card-word-count {
    font-size: 12px;
    color: var(--text-sub);
}

.history-card-actions {
    display: flex;
    gap: 8px;
}

.history-action-btn {
    background: none;
    border: none;
    color: var(--text-sub);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 14px;
    transition: var(--transition);
    border-radius: 4px;
}

.history-action-btn:hover {
    background: var(--bg-sub);
    color: var(--primary);
}

.history-action-btn.delete:hover {
    color: var(--error);
}

/* History Detail Modal */
.history-detail-content {
    padding: 20px;
}

.history-detail-section {
    margin-bottom: 20px;
}

.history-detail-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-sub);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.history-detail-text {
    font-size: 16px;
    color: var(--text-main);
    line-height: 1.6;
    background: var(--bg-sub);
    padding: 16px;
    border-radius: 8px;
}

.history-detail-tokens {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ========================================
   Utility Classes
   ======================================== */
.hidden {
    display: none !important;
}

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

.text-sub {
    color: var(--text-sub);
    font-size: 14px;
}

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* ========================================
   Settings Page Styles
   ======================================== */

/* Data Management Section */
.data-management-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.data-management-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--bg-sub);
    border-radius: 12px;
    gap: 16px;
}

.data-management-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.data-management-info i {
    font-size: 24px;
}

.data-management-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 4px;
}

.data-management-desc {
    font-size: 12px;
    color: var(--text-sub);
}

/* Clear Data Modal */
.clear-data-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.clear-data-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-sub);
    border: 1px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.clear-data-btn:hover {
    background: var(--bg-main);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.clear-data-btn.danger {
    border-color: rgba(239, 68, 68, 0.2);
}

.clear-data-btn.danger:hover {
    background: rgba(239, 68, 68, 0.05);
    border-color: var(--error);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

.clear-data-btn i {
    font-size: 24px;
    color: var(--text-sub);
}

.clear-data-btn.danger i {
    color: var(--error);
}

.clear-data-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 4px;
}

.clear-data-desc {
    font-size: 12px;
    color: var(--text-sub);
}

/* App Info Section */
.app-info-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.app-info-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--bg-sub);
    border-radius: 8px;
}

.app-info-label {
    font-size: 14px;
    color: var(--text-sub);
    font-weight: 500;
}

.app-info-value {
    font-size: 14px;
    color: var(--text-main);
    font-weight: 600;
}


.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

/* ========================================
   Responsive Design
   ======================================== */
@media (min-width: 768px) {
    .app-container {
        box-shadow: 0 0 24px rgba(0, 0, 0, 0.1);
    }
    
    .main-content {
        padding: 24px 32px;
    }
}
