:root {
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-border: rgba(255, 255, 255, 0.1);
    --highlight-bg: #fbbf24;
    --highlight-text: #1e3a8a;
    --badge-bg: rgba(96, 165, 250, 0.2);
    --badge-hover: rgba(96, 165, 250, 0.4);
    --badge-text: #60a5fa;
    --list-hover: rgba(255, 255, 255, 0.05);
    --list-active: rgba(59, 130, 246, 0.2);
}

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

body {
    font-family: 'Inter', 'Noto Sans TC', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
}

.app-container {
    max-width: 1200px; /* Increased for split layout */
    margin: 0 auto;
    padding: 2rem;
}

/* Header & Tabs */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    position: relative;
}
.logo h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}
.logo p {
    color: var(--text-muted);
    font-size: 1rem;
    margin-top: 0.2rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.report-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
}
.report-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s;
}
.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}
.modal-content {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    transform: translateY(0);
    transition: transform 0.3s;
}
.modal-overlay.hidden .modal-content {
    transform: translateY(20px);
}
.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h2 { margin: 0; font-size: 1.25rem; color: #f8fafc; }
.modal-close {
    background: none; border: none; color: #94a3b8; font-size: 1.5rem; cursor: pointer;
}
.modal-close:hover { color: #f8fafc; }
.modal-body { padding: 1.5rem; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.5rem; color: #cbd5e1; font-size: 0.9rem; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 0.75rem; border-radius: 6px; border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2); color: #f8fafc; font-family: inherit; font-size: 1rem;
    box-sizing: border-box;
}
.submit-btn {
    width: 100%; padding: 0.75rem; border-radius: 6px; border: none;
    background: var(--primary); color: white; font-size: 1rem; font-weight: 600;
    cursor: pointer; transition: 0.2s;
}
.submit-btn:hover { background: #2563eb; }
.submit-btn:disabled { background: #64748b; cursor: not-allowed; }

/* Footer Styles */
footer {
    margin-top: 4rem;
    padding: 2rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    color: #94a3b8;
    font-size: 0.85rem;
    line-height: 1.6;
}
.footer-content p {
    margin: 0.3rem 0;
}
.footer-content strong {
    color: #cbd5e1;
}
.footer-content .disclaimer {
    margin-top: 1rem;
    font-size: 0.8rem;
    color: #64748b;
}

.tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.tab-btn {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid var(--card-border);
    color: var(--text-muted);
    padding: 0.8rem 1.5rem;
    border-radius: 99px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.tab-btn:hover {
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.tab-content {
    display: none;
    animation: fadeInUp 0.5s ease-out;
}

.tab-content.active {
    display: block;
}

/* Search Area */
.search-container {
    margin-top: 1rem;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
}

.search-options, .match-mode-options {
    display: flex;
    gap: 1.5rem;
    background: rgba(15, 23, 42, 0.6);
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    border: 1px solid var(--card-border);
    backdrop-filter: blur(10px);
}

.match-mode-options {
    background: rgba(30, 41, 59, 0.6);
    padding: 0.4rem 1rem;
}

.corpus-options {
    display: flex;
    gap: 1.5rem;
    background: rgba(15, 23, 42, 0.6);
    padding: 0.5rem 1.5rem;
    border-radius: 9999px;
    border: 1px solid var(--card-border);
    backdrop-filter: blur(10px);
    margin-top: -0.5rem;
    align-items: center;
}

.corpus-title {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.radio-label, .checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.95rem;
    transition: color 0.3s ease;
}

.radio-label:hover, .checkbox-label:hover {
    color: #60a5fa;
}

.radio-label input[type="radio"] {
    accent-color: var(--primary-color);
}

.checkbox-label input[type="checkbox"] {
    accent-color: var(--primary-color);
    width: 1.1rem;
    height: 1.1rem;
}

.badge-corpus-dict { color: #60a5fa; border: 1px solid #60a5fa; }
.badge-corpus-klokah { color: #fde047; border: 1px solid #fde047; }
.badge-corpus-lit { color: #10b981; border: 1px solid #10b981; }
.badge-corpus-org { color: #f472b6; border: 1px solid #f472b6; } /* Pink */
.badge-corpus-db { color: #2dd4bf; border: 1px solid #2dd4bf; } /* Teal */
.badge-corpus-subcat { color: #fb923c; border: 1px solid #fb923c; background: rgba(251, 146, 60, 0.1); }

.search-box {
    display: flex;
    width: 100%;
    max-width: 600px;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.search-box:focus-within {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px -5px rgba(59, 130, 246, 0.3);
}

.search-box input {
    width: 100%;
    padding: 1.2rem 1.5rem;
    font-size: 1.1rem;
    border: 1px solid var(--card-border);
    background: rgba(30, 41, 59, 0.8);
    color: var(--text-color);
    outline: none;
    backdrop-filter: blur(12px);
}

.search-box input::placeholder {
    color: #64748b;
}

.search-box button {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    padding: 0 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-box button:hover {
    background: var(--primary-hover);
}

/* Split UI Layout */
#split-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    max-width: 1050px;
    margin: 0 auto;
    animation: fadeInUp 0.5s ease-out;
}

@media (max-width: 900px) {
    #split-layout {
        grid-template-columns: 1fr;
    }
}

/* Left: List View */
.split-left {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    backdrop-filter: blur(12px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.results-list {
    overflow-y: auto;
    max-height: 70vh;
}

/* Custom Scrollbar */
.results-list::-webkit-scrollbar {
    width: 8px;
}
.results-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}
.results-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}
.results-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.list-item {
    padding: 1rem;
    border-bottom: 1px solid var(--card-border);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item:hover {
    background-color: var(--list-hover);
}

.list-item.active {
    background-color: var(--list-active);
    border-left: 4px solid var(--primary-color);
}

.list-item-truku {
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
    font-weight: 500;
}

.list-item-chinese {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.list-item-badge {
    font-size: 0.75rem;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    background: rgba(0,0,0,0.3);
    margin-left: 0.5rem;
    vertical-align: middle;
    display: inline-block;
    white-space: nowrap;
}

.badge-exact { color: #4ade80; border: 1px solid #4ade80; }
.badge-partial { color: #fbbf24; border: 1px solid #fbbf24; }

/* Right: Detail View */
.split-right {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: sticky;
    top: 2rem;
    align-self: flex-start;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    padding-right: 0.5rem;
}

#empty-detail-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    background: var(--card-bg);
    border: 1px dashed var(--card-border);
    border-radius: 16px;
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Search Stats Summary */
#search-stats-summary {
    background: linear-gradient(135deg, rgba(30,41,59,0.8), rgba(15,23,42,0.8));
    border: 1px solid rgba(59, 130, 246, 0.4);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.stat-item {
    text-align: center;
    background: rgba(0,0,0,0.2);
    padding: 0.8rem;
    border-radius: 8px;
}

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

/* AI Analysis Markdown Styles */
.markdown-body {
    font-size: 1rem;
    line-height: 1.6;
}
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 {
    color: #e2e8f0;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}
.markdown-body p {
    margin-bottom: 1rem;
}
.markdown-body ul, .markdown-body ol {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}
.markdown-body li {
    margin-bottom: 0.5rem;
}
.markdown-body strong {
    color: #fca5a5;
    font-weight: bold;
}
.markdown-body code {
    background: rgba(255,255,255,0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: monospace;
    color: #fb923c;
}
.markdown-body pre {
    background: rgba(0,0,0,0.5);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1rem;
}
.markdown-body pre code {
    background: transparent;
    padding: 0;
    color: #e2e8f0;
}
.markdown-body blockquote {
    border-left: 4px solid #60a5fa;
    padding-left: 1rem;
    color: #94a3b8;
    margin: 0 0 1rem 0;
    background: rgba(96, 165, 250, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 0 8px 8px 0;
}
.stat-item .value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #e2e8f0;
}

.stat-item .pct {
    font-size: 0.8rem;
    color: #94a3b8;
}

.highlight-count {
    color: var(--highlight-bg);
    font-weight: bold;
    font-size: 1.2rem;
}

.collocations-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.8rem;
}

.collocation-badge {
    background: var(--badge-bg);
    color: var(--badge-text);
    border: 1px solid rgba(96, 165, 250, 0.3);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.collocation-badge:hover {
    background: var(--badge-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(96, 165, 250, 0.2);
}

/* Result Card in Right Panel */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem;
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2);
    animation: fadeInUp 0.4s ease-out;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--card-border);
}

.source-word {
    font-size: 1.5rem;
    font-weight: 700;
    color: #a78bfa;
}

.source-file {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.3);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.card-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.truku-text {
    font-size: 1.2rem;
    line-height: 1.5;
}

.chinese-text {
    color: #cbd5e1;
    font-size: 1rem;
}

.explanation {
    margin-top: 0.5rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    font-size: 0.95rem;
    color: #94a3b8;
    border-left: 3px solid var(--primary-color);
}

/* Keyword Highlighting */
.keyword-highlight {
    background-color: var(--highlight-bg);
    color: var(--highlight-text);
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    font-weight: bold;
    font-size: 1.25em;
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
    display: inline-block;
}

.kwic-text {
    font-family: monospace;
    font-size: 1.15rem;
    background: rgba(0,0,0,0.3);
    padding: 1rem;
    border-radius: 8px;
    letter-spacing: 0.5px;
    color: #e2e8f0;
}

/* Stats Dashboard (Tab 2) */
.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    backdrop-filter: blur(10px);
}

.stat-card h3 {
    font-size: 2.5rem;
    color: #a78bfa;
    margin-bottom: 0.5rem;
}

.stat-card p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.charts-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.chart-box {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem;
    backdrop-filter: blur(12px);
}

.chart-box h3 {
    margin-bottom: 1.5rem;
    color: #e2e8f0;
    text-align: center;
    font-size: 1.3rem;
}

/* Stats Split Layout */
#stats-split-layout {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
}

@media (max-width: 900px) {
    #stats-split-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .split-left, .split-right {
        max-height: none;
    }
}

/* PDF Export Mode Styling */
.pdf-exporting {
    font-size: 0.9em !important;
    line-height: 1.6 !important;
}

.pdf-exporting h1, 
.pdf-exporting h2, 
.pdf-exporting h3 {
    margin-top: 1rem !important;
    margin-bottom: 0.5rem !important;
}

.pdf-exporting p, 
.pdf-exporting li, 
.pdf-exporting blockquote,
.pdf-exporting h1,
.pdf-exporting h2,
.pdf-exporting h3 {
    page-break-inside: avoid !important;
}

.stats-list-container {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    backdrop-filter: blur(12px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 1200px;
}

.stats-list-header {
    display: flex;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.4);
    font-weight: bold;
    border-bottom: 1px solid var(--card-border);
    color: #a78bfa;
}

.col-word {
    flex: 2;
    padding-left: 0.5rem;
}

.col-count {
    flex: 1;
    text-align: right;
    padding-right: 0.5rem;
}

.stats-word-list {
    overflow-y: auto;
    flex: 1;
}

/* Custom Scrollbar */
.stats-word-list::-webkit-scrollbar {
    width: 8px;
}
.stats-word-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}
.stats-word-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.stats-list-item {
    display: flex;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background-color 0.2s ease;
}

.stats-list-item:hover {
    background-color: var(--list-hover);
}

.stats-list-item .col-word {
    color: #e2e8f0;
    font-size: 1.1rem;
}

.stats-list-item .col-count {
    color: #60a5fa;
    font-weight: 600;
}

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

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

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

.sub-tab-content {
    display: block;
}

.sub-tab-content.hidden {
    position: absolute;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    z-index: -1;
    height: 0;
    overflow: hidden;
}

/* Helpers */
.hidden { display: none !important; }

.sub-tabs {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
}
.sub-tab-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 0.8rem 1.5rem;
    cursor: pointer;
    font-size: 1.8rem;
    border-radius: 8px;
    transition: all 0.2s;
}
.sub-tab-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}
.sub-tab-btn.active {
    color: #fff;
    background: rgba(59, 130, 246, 0.2);
    font-weight: bold;
}
.sub-tab-content {
    animation: fadeIn 0.3s ease;
}
.ngram-box {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.ngram-item {
    background: rgba(255,255,255,0.05);
    padding: 0.5rem 0.8rem;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex: 1 1 45%;
}
.ngram-text {
    color: #e2e8f0;
}
.ngram-count {
    color: #60a5fa;
    font-size: 0.9em;
}
@media (max-width: 768px) {
    .sub-tabs {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* ======================================================
   🏷️  IGT Annotation Container (Academic Style)
   ====================================================== */
.igt-container {
    font-family: 'Times New Roman', 'Noto Serif TC', 'PMingLiU', serif;
    background: transparent;
    border: none;
    padding: 0.5rem 0;
    margin-top: 1rem;
}

/* 行一：原文整行 */
.igt-l1 {
    font-size: 1.15rem;
    font-weight: 400;
    color: var(--text-color);
    margin-bottom: 0.4rem;
    line-height: 1.4;
}

/* 行二 & 行三：每詞一欄，水平對齊 */
.igt-words-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.5rem;
    margin-bottom: 0.6rem;
    align-items: flex-start;
}

.igt-word-col {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: auto;
    padding: 0;
    border: none;
}

.igt-word-col.igt-low-conf {
    position: relative;
}
.igt-word-col.igt-low-conf::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 1px;
    background: repeating-linear-gradient(to right, transparent, transparent 2px, #f59e0b 2px, #f59e0b 4px);
}

/* 行二：詞素切分 */
.igt-l2 {
    font-size: 1.1rem;
    color: var(--text-color);
    cursor: text;
    padding: 0;
    outline: none;
}

/* 行三：語法標記 */
.igt-l3 {
    font-size: 1.05rem;
    color: var(--text-color);
    font-weight: 400;
    cursor: text;
    padding: 0;
    outline: none;
}

.igt-l2:hover, .igt-l2:focus, .igt-l3:hover, .igt-l3:focus {
    background: rgba(139, 92, 246, 0.1);
    border-radius: 3px;
}

/* 行四：整句翻譯 */
.igt-l4 {
    font-size: 1.15rem;
    color: var(--text-color);
    padding: 0;
    border: none;
    line-height: 1.4;
}

/* 動作按鈕列 */
.igt-actions {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    margin-top: 1rem;
    flex-wrap: wrap;
    font-family: 'Inter', 'Noto Sans TC', sans-serif; /* Reset back to UI font */
}

.igt-save-btn {
    background: rgba(79, 70, 229, 0.15);
    color: #818cf8;
    border: 1px solid rgba(79, 70, 229, 0.3);
    padding: 0.35rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}
.igt-save-btn:hover { background: rgba(79, 70, 229, 0.3); }

.igt-csv-btn, .igt-word-btn {
    background: rgba(15, 23, 42, 0.5);
    color: #94a3b8;
    border: 1px solid rgba(255,255,255,0.1);
    padding: 0.35rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}
.igt-csv-btn:hover, .igt-word-btn:hover {
    background: rgba(255,255,255,0.08);
    color: #e2e8f0;
}

.igt-block + .igt-block {
    margin-top: 1.2rem;
    padding-top: 1.2rem;
    border-top: 1px solid rgba(255,255,255,0.08);
}

/* ======================================================
   ☀️  Light Theme (亮色模式)
   ====================================================== */
html[data-theme="light"] {
    --bg-color: #fdfbf7; /* 淡黃/米白底 */
    --text-color: #1e293b; /* 深藍黑色，高對比 */
    --text-muted: #475569;
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --card-bg: rgba(255, 255, 255, 0.9);
    --card-border: rgba(0, 0, 0, 0.1);
    --highlight-bg: #fde047;
    --highlight-text: #0f172a;
    --badge-bg: rgba(59, 130, 246, 0.1);
    --badge-hover: rgba(59, 130, 246, 0.2);
    --badge-text: #1d4ed8;
    --list-hover: rgba(0, 0, 0, 0.05);
    --list-active: rgba(59, 130, 246, 0.1);
}

html[data-theme="light"] body {
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.08) 0px, transparent 50%);
}

html[data-theme="light"] .modal-content {
    background: #f8fafc;
    border: 1px solid rgba(0,0,0,0.1);
}
html[data-theme="light"] .modal-header h2 { color: var(--text-color); }
html[data-theme="light"] .modal-close:hover { color: #000; }
html[data-theme="light"] .form-group input, 
html[data-theme="light"] .form-group select, 
html[data-theme="light"] .form-group textarea {
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.2);
    color: var(--text-color);
}

/* Force light colors on inline text/bg from JS */
html[data-theme="light"] span[style*="color: #cbd5e1"],
html[data-theme="light"] span[style*="color: #e2e8f0"],
html[data-theme="light"] span[style*="color:#f1f5f9"],
html[data-theme="light"] div[style*="color: #cbd5e1"],
html[data-theme="light"] div[style*="color: #e2e8f0"],
html[data-theme="light"] div[style*="color:#f1f5f9"] {
    color: var(--text-color) !important;
}

html[data-theme="light"] span[style*="color: #94a3b8"],
html[data-theme="light"] span[style*="color:#64748b"],
html[data-theme="light"] div[style*="color: #94a3b8"],
html[data-theme="light"] div[style*="color:#64748b"] {
    color: var(--text-muted) !important;
}

html[data-theme="light"] div[style*="background: rgba(0,0,0,0.3)"],
html[data-theme="light"] div[style*="background: rgba(0,0,0,0.2)"],
html[data-theme="light"] textarea[style*="background:rgba(0,0,0,0.35)"],
html[data-theme="light"] textarea[style*="background:rgba(0,0,0,0.25)"] {
    background: rgba(255,255,255,0.7) !important;
    border-color: rgba(0,0,0,0.15) !important;
    color: var(--text-color) !important;
}

/* IGT button Overrides */
html[data-theme="light"] .igt-save-btn {
    background: rgba(79, 70, 229, 0.1);
    color: #4338ca;
    border-color: rgba(79, 70, 229, 0.3);
}
html[data-theme="light"] .igt-csv-btn, 
html[data-theme="light"] .igt-word-btn {
    background: rgba(0,0,0,0.05);
    color: #475569;
    border-color: rgba(0,0,0,0.2);
}
html[data-theme="light"] .igt-block + .igt-block {
    border-top-color: rgba(0,0,0,0.1);
}

/* List Items / Typography */
html[data-theme="light"] .list-item-truku {
    color: var(--text-color);
}
html[data-theme="light"] .list-item-chinese {
    color: var(--text-muted);
}
html[data-theme="light"] .markdown-body {
    color: var(--text-color) !important;
}
html[data-theme="light"] .logo h1 {
    background: linear-gradient(135deg, #1e40af, #7e22ce);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
html[data-theme="light"] .tab-btn {
    color: var(--text-muted);
}
html[data-theme="light"] .tab-btn.active {
    color: #1e3a8a;
    border-bottom: 2px solid #2563eb;
}