/* ============================================
   RX-8 Parts DB — JDM Style Theme
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Noto+Sans+TC:wght@400;500;700;900&family=Rajdhani:wght@400;600;700&display=swap');

:root {
    --bg-primary: #0d0d0d;
    --bg-secondary: #111;
    --bg-card: #161616;
    --bg-hover: #1e1e1e;
    --border: #2a2a2a;
    --text-primary: #f5f5f5;
    --text-secondary: #aaa;
    --text-muted: #666;
    --accent: #ffd100;
    --accent-hover: #cca800;
    --accent-glow: rgba(255, 209, 0, 0.15);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ff1744;
    --orange: #ff6d00;
    --purple: #8b5cf6;
    --cyan: #00e5ff;
    --red: #ff1744;
    --red-glow: rgba(255, 23, 68, 0.2);
    --radius: 2px;
    --radius-lg: 4px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.7);
    --stripe-angle: -4deg;
}

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

/* Focus-visible ring for keyboard accessibility */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

:focus:not(:focus-visible) {
    outline: none;
}

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

body {
    font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Diagonal stripe background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        135deg,
        transparent,
        transparent 40px,
        rgba(255,255,255,0.01) 40px,
        rgba(255,255,255,0.01) 41px
    );
    pointer-events: none;
    z-index: 0;
}

/* ---- Header ---- */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 300;
    overflow: visible;
}

/* Yellow-red gradient top bar */
.header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent) 40%, var(--red) 100%);
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    height: 60px;
    gap: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.logo-mark {
    background: var(--accent);
    color: #000;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 20px;
    font-weight: 700;
    padding: 4px 12px;
    transform: skewX(-4deg);
    letter-spacing: 1px;
    line-height: 1;
}

.logo-mark span {
    display: inline-block;
    transform: skewX(4deg);
}

.logo-text {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 26px;
    letter-spacing: 3px;
    color: #fff;
}

.logo-icon {
    display: none;
}

.logo h1 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #fff;
}

.badge {
    font-family: 'Rajdhani', monospace;
    font-size: 10px;
    padding: 2px 8px;
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 0;
    font-weight: 700;
    letter-spacing: 1px;
    transform: skewX(var(--stripe-angle));
}

/* ---- Nav Tabs ---- */
.nav-tabs {
    display: flex;
    gap: 2px;
    flex: 1;
    margin-left: 12px;
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 18px 20px;
    background: transparent;
    border: none;
    border-radius: 0;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    transition: all 0.15s;
    font-family: 'Noto Sans TC', sans-serif;
    position: relative;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.nav-tab:hover {
    background: rgba(255,255,255,0.05);
    color: #fff;
}

.nav-tab.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
    clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
}

.tab-label-en {
    font-size: 11px;
    opacity: 0.7;
}

/* ---- Header Controls ---- */
.header-controls {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.header-controls select {
    padding: 5px 10px;
    background: #222;
    border: 1px solid var(--border);
    border-radius: 0;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    font-family: 'Noto Sans TC', sans-serif;
    transform: skewX(var(--stripe-angle));
}

/* ---- Generation Switch ---- */
.gen-switch {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.gen-btn {
    flex: 1;
    padding: 18px 24px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 0;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    clip-path: polygon(12px 0, 100% 0, calc(100% - 12px) 100%, 0 100%);
}

.gen-btn:hover {
    border-color: #555;
    background: var(--bg-hover);
}

.gen-btn-label {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--text-muted);
    transition: color 0.2s;
}

.gen-btn-year {
    font-family: 'Rajdhani', monospace;
    font-size: 14px;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.gen-btn-code {
    font-family: 'Rajdhani', monospace;
    font-size: 11px;
    color: #444;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.gen-btn-early {
    color: var(--orange);
}

.gen-btn-early.active {
    border-color: var(--accent);
    background: var(--accent-glow);
    box-shadow: none;
}

.gen-btn-early.active .gen-btn-label {
    color: var(--accent);
}

.gen-btn-early.active::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: var(--accent);
}

.gen-btn-late {
    color: var(--cyan);
}

.gen-btn-late.active {
    border-color: var(--accent);
    background: var(--accent-glow);
    box-shadow: none;
}

.gen-btn-late.active .gen-btn-label {
    color: var(--accent);
}

.gen-btn-late.active::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: var(--accent);
}

/* ---- Search Section ---- */
.search-section {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 24px 0;
    position: relative;
    z-index: 1;
}

.search-box {
    display: flex;
    gap: 0;
    margin-bottom: 12px;
}

.search-box input {
    flex: 1;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-right: none;
    border-radius: 0;
    color: var(--text-primary);
    font-size: 16px;
    font-family: 'Noto Sans TC', sans-serif;
    transition: border-color 0.2s;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 8px 100%);
}

.search-box input:focus {
    border-color: var(--accent);
    box-shadow: inset 0 0 20px var(--accent-glow);
}

.search-box input:focus:not(:focus-visible) {
    outline: none;
}

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

.search-btn {
    padding: 14px 32px;
    background: var(--accent);
    border: none;
    border-radius: 0;
    color: #000;
    font-size: 15px;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.15s;
    font-family: 'Noto Sans TC', sans-serif;
    clip-path: polygon(12px 0, 100% 0, 100% 100%, 0 100%);
    letter-spacing: 2px;
    transform: skewX(var(--stripe-angle));
}

.search-btn > * {
    display: inline-block;
    transform: skewX(4deg);
}

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

.search-hints {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.hint-tag {
    padding: 10px 14px;
    background: transparent;
    border: 1px solid #333;
    border-radius: 0;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
    transform: skewX(var(--stripe-angle));
}

.hint-tag > * {
    display: inline-block;
    transform: skewX(4deg);
}

.hint-tag:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}

/* ---- Category Browser ---- */
.category-browser {
    max-width: 1400px;
    margin: 20px auto;
    padding: 0 24px;
    display: flex;
    gap: 20px;
    min-height: 60vh;
    position: relative;
    z-index: 1;
}

.category-sidebar {
    display: none;
}

.cat-group { margin-bottom: 8px; }

.cat-group-title {
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    cursor: pointer;
    border-radius: var(--radius);
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cat-group-title:hover { background: var(--bg-hover); }

.cat-group-title .count {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
}

.subcat-list { display: none; padding-left: 12px; }
.cat-group.open .subcat-list { display: block; }

.subcat-item {
    padding: 6px 12px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.subcat-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.subcat-item.active {
    background: var(--accent);
    color: #000;
}

/* ---- Parts Main ---- */
.parts-main { flex: 1; min-width: 0; }

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--text-secondary);
    padding: 10px 0;
    border-bottom: 2px solid var(--border);
    position: relative;
}

.results-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 120px;
    height: 2px;
    background: var(--accent);
}

.view-toggle { display: flex; gap: 4px; }

.view-btn {
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
}

.view-btn.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

/* ---- Parts Table ---- */
.parts-table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.parts-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.parts-table thead {
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
}

.parts-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.parts-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.parts-table th.sortable:hover { color: var(--accent); }

.parts-table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.parts-table tbody tr {
    transition: background 0.15s;
}

.parts-table tbody tr:hover {
    background: var(--bg-hover);
}

.part-number {
    font-family: 'Rajdhani', 'SF Mono', 'Fira Code', monospace;
    font-weight: 600;
    color: var(--accent);
    cursor: pointer;
}

.part-number:hover { text-decoration: underline; }

.part-number-usdm {
    font-family: 'Rajdhani', 'SF Mono', 'Fira Code', monospace;
    color: var(--orange);
    font-size: 13px;
}

.gen-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 0;
    font-size: 11px;
    font-weight: 600;
    transform: skewX(var(--stripe-angle));
}

.gen-early {
    background: rgba(255, 109, 0, 0.15);
    color: var(--orange);
    border: 1px solid rgba(255, 109, 0, 0.3);
}

.gen-late {
    background: rgba(0, 229, 255, 0.15);
    color: var(--cyan);
    border: 1px solid rgba(0, 229, 255, 0.3);
}

.gen-both {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* ---- Pagination ---- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 20px 0;
}

.pagination button {
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    transform: skewX(var(--stripe-angle));
}

.pagination button > * {
    display: inline-block;
    transform: skewX(4deg);
}

.pagination button:hover { background: var(--bg-hover); border-color: var(--accent); }
.pagination button.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

/* ---- DTC Section ---- */
.dtc-categories {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.dtc-cat-btn {
    padding: 6px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    transform: skewX(var(--stripe-angle));
}

.dtc-cat-btn.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

.dtc-results {
    max-width: 1400px;
    margin: 20px auto;
    padding: 0 24px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 16px;
}

/* ---- DTC Card ---- */
.dtc-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.dtc-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 3px;
    background: var(--red);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s;
}

.dtc-card:hover {
    border-color: rgba(255, 23, 68, 0.3);
    background: var(--bg-hover);
    transform: translateY(-2px);
}

.dtc-card:hover::before {
    transform: scaleX(1);
}

.dtc-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.dtc-code {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 24px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: var(--radius);
    color: var(--red);
    letter-spacing: 2px;
}

.dtc-powertrain { background: rgba(255, 23, 68, 0.15); color: var(--danger); }
.dtc-chassis { background: rgba(255, 109, 0, 0.15); color: var(--orange); }
.dtc-body { background: rgba(139, 92, 246, 0.15); color: var(--purple); }
.dtc-network { background: rgba(0, 229, 255, 0.15); color: var(--cyan); }

.dtc-card-title {
    font-size: 14px;
    color: var(--text-primary);
    flex: 1;
}

.dtc-severity {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 0;
    font-weight: 600;
    transform: skewX(var(--stripe-angle));
}

.severity-critical { background: rgba(255, 23, 68, 0.2); color: var(--danger); }
.severity-warning { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.severity-info { background: rgba(0, 229, 255, 0.2); color: var(--cyan); }

.dtc-card-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.5;
}

.dtc-card-parts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.dtc-part-tag {
    font-size: 11px;
    padding: 3px 10px;
    background: var(--bg-hover);
    border-radius: 0;
    color: var(--text-secondary);
    transform: skewX(var(--stripe-angle));
}

/* ---- DTC Detail Overlay ---- */
.dtc-detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding-top: var(--header-height, 56px);
    background: var(--bg-primary);
    z-index: 200;
    overflow-y: auto;
}

/* ---- DTC Detail Fullpage Layout ---- */
.dtc-detail-fullpage {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.dtc-detail-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 12px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.back-btn {
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    white-space: nowrap;
    transform: skewX(var(--stripe-angle));
}

.back-btn > * {
    display: inline-block;
    transform: skewX(4deg);
}

.back-btn:hover {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

.dtc-detail-title {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.dtc-code-big {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--danger);
    background: rgba(255, 23, 68, 0.15);
    padding: 4px 12px;
    border-radius: var(--radius);
    flex-shrink: 0;
    letter-spacing: 2px;
}

.dtc-name-big {
    font-size: 15px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dtc-pdf-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.pdf-nav-btn {
    padding: 6px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.pdf-nav-btn:hover {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

#dtcPdfPageInfo {
    font-family: 'Rajdhani', monospace;
    font-size: 13px;
    color: var(--text-muted);
    min-width: 50px;
    text-align: center;
}

/* ---- DTC Top Info ---- */
.dtc-top-info {
    padding: 12px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

/* ---- Split View ---- */
.dtc-detail-split {
    display: flex;
    min-height: 600px;
}

.dtc-pdf-viewer {
    flex: 1;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    background: #111;
}

.pdf-viewer-label,
.zh-steps-label,
.related-parts-label {
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    font-family: 'Rajdhani', monospace;
}

.pdf-img-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.pdf-img-container img {
    max-width: 100%;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    background: white;
}

.pdf-page-wrapper {
    margin-bottom: 16px;
    position: relative;
}

.pdf-page-wrapper .pdf-page-label {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 6px;
    padding: 2px 8px;
    background: rgba(0,0,0,0.3);
    border-radius: 2px;
    display: inline-block;
    font-family: 'Rajdhani', monospace;
}

.pdf-page-wrapper img {
    max-width: 100%;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    background: white;
}

.dtc-zh-steps {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 50%;
}

.zh-steps-label {
    flex-shrink: 0;
}

#dtcZhContent {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* ---- Chinese translation styles ---- */
.zh-section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 10px;
    font-family: 'Noto Sans TC', sans-serif;
}

.zh-dtc-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--border);
    margin-bottom: 16px;
    font-size: 13px;
}

.zh-dtc-table td {
    padding: 12px 14px;
    border: 1px solid var(--border);
    vertical-align: top;
    line-height: 1.7;
    color: var(--text-primary);
}

.zh-dtc-code {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 700;
    color: var(--danger) !important;
    white-space: nowrap;
    width: 120px;
    letter-spacing: 2px;
}

.zh-dtc-name {
    font-weight: 600;
}

.zh-label {
    font-weight: 700;
    color: var(--text-secondary) !important;
    white-space: nowrap;
    width: 120px;
    background: var(--bg-hover);
}

.zh-content {
    color: var(--text-primary);
}

.zh-cause-list {
    list-style: disc;
    padding-left: 20px;
    margin: 0;
}

.zh-cause-list li {
    margin-bottom: 4px;
    color: var(--text-secondary);
}

/* Diagnostic step table */
.zh-step-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--border);
    font-size: 13px;
    margin-bottom: 16px;
}

.zh-step-table thead th {
    padding: 8px 10px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    font-weight: 600;
    color: var(--text-secondary);
    text-align: left;
    font-size: 12px;
}

.zh-step-table tbody td {
    padding: 8px 10px;
    border: 1px solid var(--border);
    vertical-align: top;
    line-height: 1.5;
    color: var(--text-primary);
}

.zh-step-num-cell {
    text-align: center;
    font-weight: 700;
    color: var(--accent) !important;
    width: 40px;
    font-size: 15px;
    font-family: 'Bebas Neue', sans-serif;
}

.zh-step-inspection {
    line-height: 1.6;
}

.zh-step-inspection ul {
    margin: 6px 0 4px 16px;
    padding: 0;
}

.zh-step-inspection li {
    margin-bottom: 3px;
}

.zh-yes-label {
    text-align: center;
    font-weight: 700;
    color: var(--success) !important;
    width: 50px;
    font-size: 13px;
}

.zh-no-label {
    text-align: center;
    font-weight: 700;
    color: var(--warning) !important;
    width: 50px;
    font-size: 13px;
}

.zh-yes-cell {
    font-size: 12px;
    color: var(--success);
    line-height: 1.5;
}

.zh-no-cell {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

.zh-step-yes-row td {
    border-bottom: none;
}

.zh-step-no-row td {
    border-top: 1px dashed rgba(255,255,255,0.1);
}

/* Step alternating colors */
.zh-step-yes-row:nth-child(4n+1) td,
.zh-step-no-row:nth-child(4n+2) td {
    background: rgba(255,255,255,0.02);
}

/* ---- Related Parts (bottom section) ---- */
.dtc-related-parts {
    border-top: 2px solid var(--border);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.related-parts-label {
    border-bottom: 1px solid var(--border);
}

.related-parts-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 10px;
    padding: 16px;
}

.related-part-item {
    padding: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.related-part-item::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px;
    height: 100%;
    background: var(--accent);
    opacity: 0;
    transition: opacity 0.2s;
}

.related-part-item:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.related-part-item:hover::before {
    opacity: 1;
}

.related-part-item .part-num {
    font-family: 'Rajdhani', monospace;
    color: var(--accent);
    font-weight: 600;
    font-size: 14px;
}

.related-part-item .part-name {
    color: var(--text-secondary);
    margin-top: 4px;
}

.related-part-item .part-likelihood {
    display: inline-block;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 0;
    margin-top: 6px;
    font-weight: 600;
    transform: skewX(var(--stripe-angle));
}

.likelihood-high {
    background: rgba(255, 23, 68, 0.2);
    color: var(--danger);
}

.likelihood-medium {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.likelihood-low {
    background: rgba(100, 116, 139, 0.2);
    color: var(--text-muted);
}

/* === DTC 社群資料樣式 === */
.dtc-difficulty {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.diff-easy {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.diff-medium {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.diff-hard {
    background: rgba(255, 23, 68, 0.2);
    color: var(--danger);
}

.dtc-related-link {
    display: inline-block;
    padding: 2px 8px;
    margin: 2px 4px 2px 0;
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s;
}

.dtc-related-link:hover {
    background: rgba(59, 130, 246, 0.3);
}

/* Legacy styles kept for backward compat */
.likelihood-likely { border-left: 3px solid var(--danger); }
.likelihood-possible { border-left: 3px solid var(--warning); }
.likelihood-rare { border-left: 3px solid var(--text-muted); }

/* DTC category badges */
.dtc-cat-badge {
    display: inline-block;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 0;
    font-weight: 600;
    margin-left: 8px;
    transform: skewX(var(--stripe-angle));
}

.dtc-cat-engine { background: rgba(255, 23, 68, 0.15); color: var(--danger); }
.dtc-cat-fuel { background: rgba(255, 109, 0, 0.15); color: var(--orange); }
.dtc-cat-emission { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.dtc-cat-electrical { background: rgba(139, 92, 246, 0.15); color: var(--purple); }
.dtc-cat-transmission { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.dtc-cat-brake { background: rgba(236, 72, 153, 0.15); color: #ec4899; }
.dtc-cat-communication { background: rgba(0, 229, 255, 0.15); color: var(--cyan); }

@media (max-width: 1200px) {
    .dtc-detail-fullpage {
        display: flex;
        flex-direction: column;
    }
    .dtc-detail-split {
        display: contents;
    }
    .dtc-top-info { order: 1; }
    .dtc-related-parts { order: 2; }
    .dtc-zh-steps {
        order: 3;
        max-width: 100%;
        flex-shrink: 0;
    }
    .dtc-pdf-viewer {
        order: 4;
        border-right: none;
        border-bottom: 1px solid var(--border);
        flex-shrink: 0;
    }
    .pdf-img-container {
        max-height: none;
    }
    .dtc-detail-header {
        flex-wrap: wrap;
        gap: 8px;
        order: 0;
    }
}

/* ---- DTC Return Bar ---- */
#dtcReturnBar {
    margin-bottom: 12px;
    padding: 10px 16px;
    background: rgba(255, 209, 0, 0.08);
    border: 1px solid rgba(255, 209, 0, 0.25);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
}

#dtcReturnBar button {
    padding: 8px 20px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius);
    color: #000;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s;
    transform: skewX(var(--stripe-angle));
}

#dtcReturnBar button > * {
    display: inline-block;
    transform: skewX(4deg);
}

#dtcReturnBar button:hover {
    background: var(--accent-hover);
}

/* ---- Footer ---- */
.footer {
    max-width: 1400px;
    margin: 40px auto 0;
    padding: 24px;
    text-align: center;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 13px;
    position: relative;
    z-index: 1;
}

.footer-sub { font-size: 11px; margin-top: 4px; }

.footer-links {
    margin-top: 12px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px 0;
}
.footer-links a {
    color: var(--accent);
    text-decoration: none;
    font-size: 13px;
    padding: 10px 4px;
    transition: color 0.2s;
}
.footer-links a:hover { color: #fff; text-decoration: underline; }
.footer-sep { color: var(--text-muted); margin: 0 8px; font-size: 12px; }
.footer-contact {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
}
.footer-contact a { color: var(--accent); text-decoration: none; }
.footer-contact a:hover { text-decoration: underline; }

/* Terms / Pricing modal */
.terms-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.terms-modal {
    background: #000;
    border: 1px solid var(--border);
    border-radius: 8px;
    max-width: 800px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 40px;
    position: relative;
    color: var(--text);
}
.terms-close {
    position: absolute;
    top: 12px; right: 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    cursor: pointer;
}
.terms-close:hover { color: #fff; }
.terms-content h1 { font-size: 22px; color: var(--accent); margin-bottom: 20px; font-family: var(--font-title); }
.terms-content h2 { font-size: 16px; color: var(--accent); margin: 24px 0 10px; }
.terms-content p, .terms-content li { font-size: 14px; line-height: 1.8; color: var(--text-muted); margin-bottom: 8px; }
.terms-content ul { padding-left: 20px; }
.terms-content .pricing-cards { display: flex; gap: 20px; justify-content: center; margin: 24px 0; }
.terms-content .pricing-card {
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 24px;
    flex: 1;
    min-width: 200px;
    max-width: 300px;
    text-align: center;
    transition: border-color 0.3s;
}
.terms-content .pricing-card:hover { border-color: var(--accent); }
.terms-content .pricing-card .price { font-size: 36px; font-weight: bold; color: var(--accent); font-family: var(--font-title); }
.terms-content .pricing-card .price-unit { font-size: 14px; color: var(--text-muted); }
.terms-content .pricing-card .plan-name { font-size: 18px; font-weight: bold; margin-bottom: 8px; color: #fff; }
.terms-content .pricing-card .plan-desc { font-size: 13px; color: var(--text-muted); margin-top: 8px; }
.terms-content .contact-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    margin-top: 20px;
}
.terms-content .contact-box a { color: var(--accent); }

/* Footer stripe decoration - hidden on mobile */
.footer-stripe {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: repeating-linear-gradient(
        90deg,
        var(--accent) 0px,
        var(--accent) 20px,
        #000 20px,
        #000 30px
    );
    z-index: 999;
}
@media (max-width: 768px) {
    .footer-stripe { display: none; }
    .footer { display: none; }
}

/* ---- Tab Content ---- */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: #333; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .header-inner {
        flex-wrap: wrap;
        height: auto;
        padding: 8px 10px;
        gap: 4px;
    }

    .logo {
        order: 1;
        flex-shrink: 0;
    }
    .logo h1 { font-size: 16px; }

    .header-controls {
        order: 2;
        position: static;
        width: auto;
        margin-left: auto;
        flex-shrink: 0;
        gap: 6px;
    }

    .nav-tabs {
        order: 3;
        flex: 0 0 100%;
        gap: 2px;
        margin-left: 0;
        justify-content: center;
    }
    .nav-tab {
        padding: 10px 16px;
        font-size: 13px;
        flex: 1;
        text-align: center;
        justify-content: center;
        flex-direction: row;
        gap: 4px;
    }
    .nav-tab.active {
        clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%);
    }
    .tab-label-en { display: none; }
    .header-controls select {
        font-size: 11px;
        padding: 3px 6px;
    }
    .user-info {
        gap: 4px;
    }
    .user-credits-badge {
        font-size: 0.65rem;
        padding: 2px 6px;
        letter-spacing: 0;
    }
    .user-menu-btn {
        font-size: 0.75rem;
        padding: 4px 8px;
    }

    .search-box input {
        padding: 10px 14px;
        font-size: 14px;
    }
    .search-btn {
        padding: 10px 20px;
        font-size: 14px;
    }

    .category-browser {
        flex-direction: column;
    }

    .category-sidebar {
        width: 100%;
        max-height: 200px;
        position: static;
    }

    .dtc-results {
        grid-template-columns: 1fr;
    }

    .parts-table th:nth-child(4),
    .parts-table td:nth-child(4) {
        display: none;
    }

    .gen-switch { gap: 8px; }
    .gen-btn {
        clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
        padding: 14px 16px;
    }
    .gen-btn-label { font-size: 22px; }
}

/* ---- Loading Animation ---- */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

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

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

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

.empty-state-text {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 22px;
    letter-spacing: 3px;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.empty-state-sub {
    font-size: 13px;
    color: #555;
}

/* ============================================
   Diagram Viewer (Overlay)
   ============================================ */
.diagram-btn {
    cursor: pointer;
    margin-left: 6px;
    font-size: 14px;
    opacity: 0.6;
    transition: opacity 0.2s;
    vertical-align: middle;
}
.diagram-btn:hover {
    opacity: 1;
}

.diagram-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
    padding: 24px;
}

.diagram-viewer {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-width: 900px;
    width: 100%;
    overflow: hidden;
}

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

.diagram-title {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.diagram-category {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.diagram-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.diagram-pn {
    font-size: 12px;
    color: var(--accent);
    font-family: 'Rajdhani', monospace;
}

.diagram-close {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 18px;
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.diagram-close:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.diagram-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 80vh;
    overflow-y: auto;
}

.diagram-img-wrapper {
    position: relative;
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    line-height: 0;
}

.diagram-img-wrapper img {
    width: 100%;
    height: auto;
    display: block;
}

.diagram-highlight-rect {
    position: absolute;
    display: none;
    border: 3px solid rgba(255, 209, 0, 0.9);
    background: rgba(255, 209, 0, 0.15);
    pointer-events: none;
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(255, 209, 0, 0.4);
    animation: diagramPulse 2s ease-in-out infinite;
}

@keyframes diagramPulse {
    0%, 100% { box-shadow: 0 0 8px rgba(255, 209, 0, 0.4); }
    50% { box-shadow: 0 0 16px rgba(255, 209, 0, 0.7); }
}

/* ============================================
   Diagram Browsing System
   ============================================ */

/* ---- Breadcrumb ---- */
.diag-browse-header {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 24px 0;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.diag-back-btn {
    background: var(--bg-card);
    color: var(--accent);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    transform: skewX(var(--stripe-angle));
}

.diag-back-btn > * {
    display: inline-block;
    transform: skewX(4deg);
}

.diag-back-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

.diag-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.diag-breadcrumb-link {
    color: var(--accent);
    cursor: pointer;
    transition: color 0.2s;
}

.diag-breadcrumb-link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.diag-breadcrumb-sep {
    color: var(--text-muted);
    font-size: 16px;
}

.diag-breadcrumb-active {
    color: var(--text-primary);
    font-weight: 600;
}

.diag-browse-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

/* ---- Search Result Diagram Grid ---- */
.search-diag-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
    padding: 16px 0;
}

.search-diag-card {
    display: flex;
    gap: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.search-diag-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px;
    height: 100%;
    background: var(--accent);
    opacity: 0;
    transition: opacity 0.2s;
}

.search-diag-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 16px rgba(255, 209, 0, 0.1);
    transform: translateY(-2px);
}

.search-diag-card:hover::before {
    opacity: 1;
}

.search-diag-thumb {
    width: 120px;
    min-width: 120px;
    height: 120px;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-hover);
    display: flex;
    align-items: center;
    justify-content: center;
}
.search-diag-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
}
.search-diag-no-img {
    color: var(--text-muted);
    font-size: 11px;
}

.search-diag-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.search-diag-cat {
    font-size: 11px;
    color: var(--accent);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.search-diag-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}
.search-diag-name-en {
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'Rajdhani', monospace;
}
.search-diag-match {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 4px;
}
.search-diag-badge {
    background: rgba(255, 23, 68, 0.15);
    color: var(--red);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 0;
    transform: skewX(var(--stripe-angle));
}
.search-diag-total {
    font-size: 11px;
    color: var(--text-muted);
}
.search-diag-parts {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---- Level 1: Category Grid ---- */
.diag-cat-grid {
    max-width: 1400px;
    margin: 20px auto;
    padding: 0 24px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.diag-cat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.25s;
    position: relative;
}

.diag-cat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px;
    height: 100%;
    background: var(--accent);
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 1;
}

.diag-cat-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--accent-glow);
}

.diag-cat-card:hover::before {
    opacity: 1;
}

.diag-cat-thumb {
    height: 160px;
    background: #111;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.diag-cat-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
    padding: 4px;
}

.diag-cat-icon-big {
    font-size: 48px;
    opacity: 0.5;
}

.diag-cat-info {
    padding: 16px;
}

.diag-cat-icon {
    font-size: 20px;
    margin-bottom: 4px;
}

.diag-cat-name-zh {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.diag-cat-name-en {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: capitalize;
    margin-bottom: 8px;
    font-family: 'Rajdhani', monospace;
}

.diag-cat-count {
    font-size: 12px;
    color: var(--accent);
    font-weight: 600;
    font-family: 'Rajdhani', monospace;
}

/* ---- Level 2: Subcategory Grid ---- */
.diag-sub-grid {
    max-width: 1400px;
    margin: 20px auto;
    padding: 0 24px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

.diag-sub-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.25s;
    position: relative;
}

.diag-sub-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px;
    height: 100%;
    background: var(--accent);
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 1;
}

.diag-sub-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--accent-glow);
}

.diag-sub-card:hover::before {
    opacity: 1;
}

.diag-sub-thumb {
    height: 140px;
    background: #fff;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.diag-sub-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
}

.diag-sub-no-img {
    color: var(--text-muted);
    font-size: 13px;
}

.diag-sub-info {
    padding: 12px;
}

.diag-sub-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.diag-sub-name-en {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 2px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-family: 'Rajdhani', monospace;
}

.diag-sub-count {
    font-size: 11px;
    color: var(--text-muted);
}

/* ---- Level 3: Diagram Detail ---- */
.diag-detail-layout {
    max-width: 1400px;
    margin: 16px auto;
    padding: 0 24px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
    position: relative;
    z-index: 1;
}

.diag-detail-images {
    flex: 7;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.diag-detail-img-wrap {
    position: relative;
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    line-height: 0;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.diag-detail-img-wrap img {
    width: 100%;
    height: auto;
    display: block;
}

/* SVG overlay for diagram highlights */
.diag-svg-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

/* SVG highlight rectangles */
.diag-svg-hl {
    fill: rgba(200, 200, 200, 0.12);
    stroke: rgba(200, 200, 200, 0.5);
    stroke-width: 1.5;
    cursor: pointer;
    pointer-events: all;
    transition: all 0.2s;
    rx: 2;
    ry: 2;
}

.diag-svg-hl:hover,
.diag-svg-hl.diag-hl-hover {
    stroke: rgba(255, 209, 0, 0.9);
    fill: rgba(255, 209, 0, 0.25);
    stroke-width: 2.5;
    filter: drop-shadow(0 0 8px rgba(255, 209, 0, 0.6));
}

.diag-svg-hl.diag-hl-active {
    stroke: rgba(255, 23, 68, 0.95);
    fill: rgba(255, 23, 68, 0.3);
    stroke-width: 2.5;
    filter: drop-shadow(0 0 10px rgba(255, 23, 68, 0.7));
    animation: diagramPulse 2s ease-in-out infinite;
}

/* Parts list panel */
.diag-detail-parts {
    flex: 3;
    min-width: 240px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.diag-detail-parts-header {
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.diag-detail-parts-count {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
    font-family: 'Rajdhani', monospace;
}

.diag-detail-parts-list {
}

.diag-parts-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.diag-parts-table thead {
    background: var(--bg-secondary);
    z-index: 1;
}

.diag-parts-table th {
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.diag-parts-table td {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(42, 42, 42, 0.5);
    vertical-align: middle;
}

.diag-part-row {
    cursor: pointer;
    transition: background 0.15s;
}

.diag-part-row:hover,
.diag-part-row.hover {
    background: rgba(255, 209, 0, 0.15);
}

.diag-part-row.active {
    background: rgba(255, 23, 68, 0.2);
}

.diag-part-row.active .diag-part-pn {
    color: #fff;
}

.diag-part-row.hover .diag-part-pn {
    color: var(--accent);
}

.diag-part-idx {
    color: var(--text-muted);
    font-size: 11px;
    width: 30px;
    text-align: center;
}

.diag-part-name {
    color: var(--text-primary);
    font-size: 12px;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.diag-part-pn {
    font-family: 'Rajdhani', 'SF Mono', 'Fira Code', monospace;
    font-weight: 600;
    color: var(--accent);
    cursor: pointer;
    font-size: 12px;
}

.diag-part-pn:hover {
    text-decoration: underline;
}

.diag-part-occur {
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
    width: 60px;
}

/* ---- Responsive for diagrams ---- */
@media (max-width: 900px) {
    .diag-detail-layout {
        flex-direction: column;
    }
    .diag-detail-parts {
        width: 100%;
        max-height: none;
        position: static;
    }
    .diag-cat-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    .diag-sub-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}

@media (max-width: 480px) {
    .nav-tab {
        padding: 5px 10px;
        font-size: 11px;
    }

    .search-box input {
        padding: 8px 12px;
        font-size: 13px;
    }
    .search-btn {
        padding: 8px 16px;
        font-size: 13px;
    }

    .gen-switch { gap: 8px; }
    .gen-btn { padding: 10px 8px; }
    .gen-btn-label { font-size: 16px; }
    .gen-btn-year { font-size: 11px; }
    .gen-btn-code { font-size: 9px; }

    .search-diag-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .search-diag-thumb {
        width: 90px;
        min-width: 90px;
        height: 90px;
    }

    .diag-cat-grid,
    .diag-sub-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .diag-cat-thumb { height: 100px; }
    .diag-sub-thumb { height: 100px; }
}

/* ---- DTC Disclaimer Modal ---- */
.dtc-disclaimer-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.dtc-disclaimer-modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 440px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.dtc-disclaimer-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.dtc-disclaimer-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--warning);
    margin-bottom: 16px;
    font-family: 'Bebas Neue', sans-serif;
    letter-spacing: 2px;
}

.dtc-disclaimer-text {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 24px;
}

.dtc-disclaimer-author {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
    font-style: italic;
}

.dtc-disclaimer-btn {
    padding: 10px 40px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius);
    color: #000;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    transform: skewX(var(--stripe-angle));
}

.dtc-disclaimer-btn > * {
    display: inline-block;
    transform: skewX(4deg);
}

.dtc-disclaimer-btn:hover {
    background: var(--accent-hover);
}

/* ============================================
   Auth UI
   ============================================ */

/* Header auth button */
.auth-btn {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 6px 18px;
    border-radius: 0;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    transition: all 0.2s;
    transform: skewX(var(--stripe-angle));
    font-family: 'Noto Sans TC', sans-serif;
    letter-spacing: 0.5px;
}
.auth-btn:hover {
    background: var(--accent);
    color: #000;
}

/* User info in header */
.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}
.user-nickname {
    color: var(--text-primary);
    font-weight: 600;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-credits-badge {
    background: rgba(255, 209, 0, 0.08);
    color: var(--accent);
    padding: 3px 10px;
    border-radius: 0;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid rgba(255, 209, 0, 0.25);
    font-family: 'Bebas Neue', sans-serif;
    letter-spacing: 1px;
    transform: skewX(var(--stripe-angle));
}
.logout-btn {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.78rem;
    transition: all 0.2s;
}
.logout-btn:hover {
    color: var(--danger);
    border-color: var(--danger);
}

/* Auth Modal Overlay */
.auth-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}
.auth-modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    width: 100%;
    max-width: 420px;
    position: relative;
    box-shadow: var(--shadow-lg);
}
.auth-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
}
.auth-modal-close:hover { color: var(--text-primary); }

.auth-modal-title {
    text-align: center;
    color: var(--text-primary);
    font-size: 1.3rem;
    margin-bottom: 20px;
    font-family: 'Bebas Neue', sans-serif;
    letter-spacing: 2px;
}

/* Auth form fields */
.auth-field {
    margin-bottom: 14px;
}
.auth-field label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 4px;
}
.auth-field input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
    font-family: 'Noto Sans TC', sans-serif;
}
.auth-field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.password-wrapper input {
    flex: 1;
    padding-right: 40px;
}
.password-toggle {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    opacity: 0.5;
    padding: 4px;
    line-height: 1;
}
.password-toggle:hover {
    opacity: 1;
}
.password-toggle.active {
    opacity: 1;
}
.password-hint {
    color: #666;
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

/* reCAPTCHA container */
.auth-recaptcha {
    display: flex;
    justify-content: center;
    margin: 16px 0;
    min-height: 78px;
}

/* Submit button */
.auth-submit-btn {
    width: 100%;
    padding: 12px;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    transform: skewX(var(--stripe-angle));
    font-family: 'Noto Sans TC', sans-serif;
}
.auth-submit-btn > * {
    display: inline-block;
    transform: skewX(4deg);
}
.auth-submit-btn:hover { background: var(--accent-hover); }
.auth-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Auth error message */
.auth-error {
    background: rgba(255, 23, 68, 0.15);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    margin-bottom: 12px;
    text-align: center;
}

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    margin: 18px 0;
    gap: 12px;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}
.auth-divider span {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* OAuth buttons */
.auth-oauth-btns {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.oauth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: opacity 0.2s;
    cursor: pointer;
}
.oauth-btn:hover { opacity: 0.85; }
.oauth-google {
    background: #fff;
    color: #333;
    border: 1px solid #ddd;
}
.oauth-facebook {
    background: #1877F2;
    color: #fff;
    border: none;
}

/* Switch login/register */
.auth-switch {
    text-align: center;
    margin-top: 16px;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.auth-switch a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}
.auth-switch a:hover { text-decoration: underline; }

/* No credits modal */
.no-credits-modal {
    text-align: center;
}
.no-credits-msg {
    color: var(--text-secondary);
    margin: 16px 0 24px;
    line-height: 1.6;
}

/* User dropdown menu */
.user-menu-wrap {
    position: relative;
}
.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #222;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 5px 12px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.85rem;
    transition: border-color 0.2s;
    transform: skewX(var(--stripe-angle));
}
.user-menu-btn > * {
    display: inline-block;
    transform: skewX(4deg);
}
.user-menu-btn:hover {
    border-color: var(--accent);
    background: rgba(255, 209, 0, 0.08);
}
.user-menu-arrow {
    font-size: 0.7rem;
    color: var(--text-muted);
}
.user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-width: 160px;
    box-shadow: var(--shadow-lg);
    z-index: 500;
    overflow: hidden;
}
.user-dropdown.show {
    display: block;
}
.user-dropdown button {
    display: block;
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.85rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
}
.user-dropdown button:hover {
    background: var(--bg-hover);
}
.user-dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* Mobile responsive for auth */
@media (max-width: 480px) {
    .auth-modal {
        margin: 16px;
        padding: 24px 20px;
    }
    .user-info {
        gap: 4px;
        font-size: 0.75rem;
    }
    .user-credits-badge {
        font-size: 0.72rem;
        padding: 2px 8px;
    }
    .user-nickname { display: none; }
}

/* ---- Guest Menu ---- */
.guest-menu-wrap {
    position: relative;
}
.guest-menu-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 209, 0, 0.08);
    border: 1px solid rgba(255, 209, 0, 0.25);
    color: var(--accent);
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'Bebas Neue', sans-serif;
    transition: all 0.2s;
    transform: skewX(var(--stripe-angle));
    letter-spacing: 1px;
}
.guest-menu-btn > * {
    display: inline-block;
    transform: skewX(4deg);
}
.guest-menu-btn:hover {
    background: var(--accent);
    color: #000;
}
.guest-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    min-width: 220px;
    box-shadow: var(--shadow-lg);
    z-index: 500;
    overflow: hidden;
}
.guest-dropdown.show { display: block; }
.guest-dropdown button {
    display: block;
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.85rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
}
.guest-dropdown button:hover { background: var(--bg-hover); }


/* Hide unused elements */
.lang-select-desktop { display: none; }
@media (max-width: 768px) {
    .badge { display: none; }
}

/* ============================================
   說明書 Manual Section
   ============================================ */
.manual-header {
    text-align: center;
    padding: 40px 20px 20px;
}
.manual-main-title {
    font-family: var(--font-display);
    font-size: 28px;
    color: var(--accent);
    margin: 0 0 8px;
}
.manual-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin: 0;
}
.manual-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}
.manual-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
}
.manual-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(230, 57, 70, 0.15);
}
.manual-card-body {
    flex: 1;
    min-width: 0;
}
.manual-card-title {
    font-family: var(--font-display);
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 6px;
    font-weight: 700;
}
.manual-card-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 8px;
}
.manual-card-pages {
    font-size: 12px;
    color: var(--accent);
    font-weight: 600;
}

/* Manual Detail */
.manual-detail-overlay .dtc-detail-header {
    top: 101px;
    z-index: 200;
}
.manual-detail-fullpage {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 80px);
}
.manual-viewer {
    flex: 1;
    background: #111;
}
.manual-pdf-container {
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    max-width: 900px;
    margin: 0 auto;
}
.manual-pdf-canvas {
    max-width: 100%;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    background: white;
}
.manual-lang-notice {
    padding: 12px 20px;
    background: rgba(230, 57, 70, 0.1);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    color: var(--accent);
    text-align: center;
    font-size: 14px;
    margin-bottom: 16px;
}

@media (max-width: 768px) {
    .manual-grid {
        grid-template-columns: 1fr;
        padding: 12px;
    }
    .manual-card {
        padding: 16px;
    }
    .manual-card-icon {
        font-size: 24px;
    }
    .manual-main-title {
        font-size: 22px;
    }
}

/* ============================================
   Wiki Tab — JDM Style
   ============================================ */
.wiki-layout {
    display: flex;
    min-height: calc(100vh - 120px);
    gap: 0;
}
.wiki-sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    flex-shrink: 0;
    overflow-y: auto;
    position: sticky;
    top: 0;
    max-height: calc(100vh - 120px);
}
.wiki-sidebar::-webkit-scrollbar { width: 3px; }
.wiki-sidebar::-webkit-scrollbar-thumb { background: var(--border); }
.wiki-sidebar-header {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 5;
}
.wiki-search {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.wiki-search:focus { border-color: var(--accent); }
.wiki-search::placeholder { color: var(--text-muted); }
.wiki-search-results {
    display: none;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-top: none;
    max-height: 350px;
    overflow-y: auto;
}
.wiki-sr-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}
.wiki-sr-item:hover { background: var(--bg-hover); }
.wiki-sr-title { font-size: 13px; font-weight: 600; color: var(--accent); }
.wiki-sr-snippet { font-size: 11px; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }
.wiki-sr-snippet mark { background: var(--accent-glow); color: var(--accent); padding: 0 2px; border-radius: 1px; }
.wiki-sr-empty { padding: 16px; color: var(--text-muted); text-align: center; font-size: 12px; }
.wiki-nav { padding: 8px 0; }
.wiki-cat { margin-bottom: 2px; }
.wiki-cat-header {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    padding: 10px 14px 4px;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 4px;
}
.wiki-cat-header:hover { color: var(--text-secondary); }
.wiki-cat-arrow { font-size: 10px; transition: transform 0.2s; }
.wiki-cat-header.collapsed .wiki-cat-arrow { transform: rotate(-90deg); }
.wiki-nav-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px 6px 22px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.15s;
    border-left: 2px solid transparent;
}
.wiki-nav-item:hover { background: var(--bg-hover); color: var(--accent); }
.wiki-nav-item.active {
    background: var(--accent-glow);
    color: var(--accent);
    font-weight: 600;
    border-left-color: var(--accent);
}
.wiki-nav-icon { font-size: 13px; flex-shrink: 0; }

/* Wiki Main Content */
.wiki-main {
    flex: 1;
    padding: 20px 36px 40px;
    min-width: 0;
    max-width: 820px;
}
.wiki-breadcrumb {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.wiki-bc-home { cursor: pointer; color: var(--text-muted); }
.wiki-bc-home:hover { color: var(--accent); }
.wiki-bc-cat { color: var(--text-secondary); }
.wiki-bc-page { color: var(--accent); font-weight: 600; }

/* Wiki Markdown Rendering */
.wiki-content h1 {
    font-family: 'Rajdhani', 'Noto Sans TC', sans-serif;
    font-size: 26px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 6px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.wiki-content h2 {
    font-family: 'Rajdhani', 'Noto Sans TC', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
    margin: 24px 0 10px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
    letter-spacing: 0.5px;
}
.wiki-content h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 18px 0 6px;
}
.wiki-content h4 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    margin: 14px 0 4px;
}
.wiki-content p {
    margin: 6px 0;
    line-height: 1.7;
    font-size: 14px;
    color: var(--text-primary);
}
.wiki-content ul, .wiki-content ol { margin: 6px 0; padding-left: 22px; }
.wiki-content li { margin: 3px 0; line-height: 1.6; font-size: 13px; color: var(--text-primary); }
.wiki-content blockquote {
    border-left: 3px solid var(--accent);
    padding: 8px 14px;
    margin: 10px 0;
    background: var(--accent-glow);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 13px;
    color: var(--text-secondary);
}
.wiki-content blockquote strong { color: var(--text-primary); }
.wiki-content code {
    background: var(--bg-card);
    padding: 2px 5px;
    border-radius: var(--radius);
    font-size: 12px;
    font-family: 'Courier New', monospace;
    color: var(--accent);
    border: 1px solid var(--border);
}
.wiki-content pre {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    overflow-x: auto;
    margin: 10px 0;
}
.wiki-content pre code { background: none; padding: 0; border: none; color: var(--text-primary); }
.wiki-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 13px;
}
.wiki-content th {
    background: var(--bg-card);
    color: var(--accent);
    font-weight: 700;
    text-align: left;
    padding: 8px 10px;
    border: 1px solid var(--border);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.wiki-content td {
    padding: 7px 10px;
    border: 1px solid var(--border);
    vertical-align: top;
    color: var(--text-primary);
}
.wiki-content tr:hover td { background: rgba(255,209,0,0.03); }
.wiki-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}
.wiki-content img {
    max-width: 100%;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin: 8px 0;
    display: block;
}
.wiki-content em { color: var(--text-muted); font-size: 12px; }
.wiki-content strong { color: #fff; }
.wiki-link {
    color: var(--accent);
    cursor: pointer;
    text-decoration: none;
    border-bottom: 1px dashed rgba(255,209,0,0.3);
    transition: all 0.2s;
}
.wiki-link:hover {
    border-bottom-color: var(--accent);
    text-shadow: 0 0 6px var(--accent-glow);
}

/* Wiki Welcome */
.wiki-welcome { text-align: center; padding-top: 60px; }
.wiki-welcome h2 {
    font-family: 'Rajdhani', 'Noto Sans TC', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--accent);
    border: none;
    margin-bottom: 8px;
    letter-spacing: 1px;
}
.wiki-welcome p {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 28px;
}
.wiki-quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    max-width: 600px;
    margin: 0 auto;
    text-align: left;
}
.wiki-quick-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    cursor: pointer;
    transition: all 0.2s;
}
.wiki-quick-card:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
    box-shadow: 0 0 12px var(--accent-glow);
}
.wiki-quick-icon { font-size: 18px; }
.wiki-quick-title { font-size: 14px; font-weight: 700; color: var(--text-primary); margin-top: 4px; }
.wiki-quick-desc { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Wiki empty */
.wiki-empty { text-align: center; padding-top: 80px; color: var(--text-muted); }
.wiki-empty-icon { font-size: 48px; margin-bottom: 12px; }

/* Wiki sidebar toggle (mobile) */
.wiki-sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: var(--accent);
    color: var(--bg-primary);
    border: none;
    padding: 10px 16px;
    border-radius: var(--radius-lg);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    z-index: 100;
    box-shadow: var(--shadow-lg);
}

/* Wiki Responsive */
@media (max-width: 768px) {
    .wiki-layout { display: block; }
    .wiki-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 280px;
        max-height: 100vh;
        z-index: 350;
        transform: translateX(-100%);
        transition: transform 0.3s;
        border-right: 1px solid var(--border);
        padding-top: env(safe-area-inset-top, 0px);
    }
    .wiki-sidebar.open { transform: translateX(0); }
    .wiki-sidebar-toggle { display: block; z-index: 350; }
    .wiki-main { padding: 16px 14px 60px; }
    .wiki-content h1 { font-size: 20px; }
    .wiki-content h2 { font-size: 16px; }
    .wiki-quick-grid { grid-template-columns: 1fr 1fr; }
}
