/* 天空星·筑基学习板 引脚分配速查 - 样式表 */
/* Author: LCKFB-YZH */

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

/* ========== Apple 风格配色 ========== */

/* 白天模式（默认） */
:root, [data-theme="light"] {
    --bg-primary: #f7f7fa;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #f0f1f5;
    --border: #d4d5db;
    --border-light: #e8e9ed;
    --text-primary: #1a1a1f;
    --text-secondary: #44454a;
    --text-muted: #6b6c73;
    --accent: #0066cc;
    --accent-dim: #e6f0fa;
    --green: #2da44e;
    --red: #cf222e;
    --orange: #d4820c;
    --purple: #8250df;
    --cyan: #0a7cba;
    --pink: #d4245b;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 24px rgba(0,0,0,0.12);
    --transition: 0.2s ease;
    --font-mono: 'SF Mono', 'Menlo', 'Consolas', monospace;
    /* DIP Switch */
    --dip-housing: #cc2222;
    --dip-housing-dark: #aa1111;
    --dip-slot: #991111;
    --dip-slot-on: #771111;
    --dip-knob: #ffffff;
    --dip-knob-end: #e0e0e0;
    --dip-text: #ffffff;
    /* Notifications */
    --notify-success: #059669;
    --notify-error: #dc2626;
    --notify-warning: #d97706;
    --notify-info: #2563eb;
}

/* 黑夜模式 */
[data-theme="dark"] {
    --bg-primary: #0a0a0c;
    --bg-secondary: #18181b;
    --bg-card: #27272a;
    --bg-hover: #353538;
    --border: #3f3f46;
    --border-light: #52525b;
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --accent: #3b82f6;
    --accent-dim: rgba(59,130,246,0.12);
    --green: #4ade80;
    --red: #f87171;
    --orange: #fb923c;
    --purple: #c084fc;
    --cyan: #67e8f9;
    --pink: #f472b6;
    --shadow: 0 2px 12px rgba(0,0,0,0.3);
    --shadow-lg: 0 4px 24px rgba(0,0,0,0.5);
    /* DIP Switch */
    --dip-housing: #bb1a1a;
    --dip-housing-dark: #991111;
    --dip-slot: #881010;
    --dip-slot-on: #661010;
    --dip-knob: #ffffff;
    --dip-knob-end: #e0e0e0;
    --dip-text: #ffffff;
    /* Notifications */
    --notify-success: #059669;
    --notify-error: #dc2626;
    --notify-warning: #d97706;
    --notify-info: #2563eb;
}

html { font-size: 16px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', system-ui, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-weight: 500;
    line-height: 1.65;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.01em;
}

.app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}
.header-left { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }
.logo-link {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    transition: opacity 0.2s;
}
.logo-link:hover { opacity: 0.8; }
.logo-img {
    height: 32px;
    width: auto;
}
.logo-text { display: flex; flex-direction: column; gap: 0; }
.logo { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); white-space: nowrap; line-height: 1.2; }
.logo-subtitle {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.02em;
    line-height: 1.2;
}
.chip-badge {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 4px;
    font-family: 'Consolas', monospace;
    white-space: nowrap;
}
.header-right { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

/* Theme Toggle */
.theme-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    flex-shrink: 0;
}
.theme-toggle-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--bg-hover); }
[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="light"] .theme-icon-dark, :root .theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-dark { display: block; }

/* Search */
.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.search-icon { position: absolute; left: 10px; color: var(--text-muted); pointer-events: none; }
.search-input {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.4rem 2.2rem 0.4rem 2rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    width: 220px;
    outline: none;
    transition: var(--transition);
}
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent); }
.search-input::placeholder { color: var(--text-muted); }
.search-kbd {
    position: absolute;
    right: 8px;
    font-size: 0.7rem;
    padding: 0.1rem 0.35rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text-muted);
    font-family: monospace;
}

/* Tabs */
.tab-nav { display: flex; gap: 2px; background: var(--bg-primary); border-radius: var(--radius); padding: 2px; }
.tab-btn {
    padding: 0.45rem 0.85rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    border-radius: 6px;
    transition: var(--transition);
    white-space: nowrap;
    min-height: 44px;
}
.tab-btn:hover { color: var(--text-primary); background: var(--bg-hover); }
.tab-btn.active { background: var(--accent); color: #fff; }

/* Main */
.main-content { flex: 1; padding: 1.5rem; max-width: 1600px; margin: 0 auto; width: 100%; }
.tab-panel { display: none; animation: fadeIn 0.3s ease; }
.tab-panel.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Section Title */
.section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
}
.section-title svg { color: var(--accent); flex-shrink: 0; }

/* Overview */
.board-photo-section { min-width: 0; }
.board-main-layout { display: flex; gap: 1rem; align-items: flex-start; }
.board-image-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.25rem;
    overflow: hidden;
    position: relative;
    flex: 1;
    min-width: 0;
    box-shadow: var(--shadow);
    user-select: none;
    -webkit-user-select: none;
}
.board-photo {
    display: block;
    width: 90%;
    border-radius: var(--radius);
    margin: 0 auto;
    -webkit-user-drag: none;
    pointer-events: none;
}

/* 右侧区域信息面板 */
.region-side-panel {
    width: 340px;
    min-width: 280px;
    flex-shrink: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    max-height: 75vh;
    overflow-y: auto;
    position: sticky;
    top: 70px;
}
.side-panel-placeholder {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.side-placeholder-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.side-panel-content .region-info-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.side-panel-content .region-info-tags { margin-bottom: 0.5rem; }
.side-panel-content .region-info-pins { margin-bottom: 0.5rem; }

.overview-bottom {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.stat-list-scroll {
    max-height: 420px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.stat-item-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.6rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.82rem;
    transition: var(--transition);
    cursor: default;
}
.stat-item-row:hover { border-color: var(--accent); background: var(--bg-hover); }
.stat-item-icon { font-size: 1rem; flex-shrink: 0; width: 1.4rem; text-align: center; }
.stat-item-body { flex: 1; min-width: 0; }
.stat-item-top { display: flex; align-items: baseline; gap: 0.4rem; }
.stat-item-value { font-weight: 700; font-size: 0.82rem; white-space: nowrap; }
.stat-item-label { font-size: 0.78rem; color: var(--text-primary); font-weight: 500; }
.stat-item-detail { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.conflict-summary { display: flex; flex-direction: column; gap: 0.5rem; }
.conflict-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.85rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    min-height: 44px;
}
.conflict-item:hover { border-color: var(--orange); background: color-mix(in srgb, var(--orange) 8%, transparent); }
.conflict-bit {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    background: color-mix(in srgb, var(--orange) 15%, transparent);
    color: var(--orange);
    white-space: nowrap;
}
.conflict-pins { color: var(--cyan); font-family: monospace; font-size: 0.85rem; }
.conflict-desc { color: var(--text-secondary); flex: 1; }

/* DIP Switch */
.dip-section { margin-bottom: 2rem; }
.dip-hint { font-size: 0.875rem; color: var(--text-secondary); margin-bottom: 1.25rem; }

.dip-switch-visual {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}
.dip-housing {
    background: var(--dip-housing);
    border: 2px solid var(--dip-housing-dark);
    border-radius: 10px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.15);
}
.dip-label-row {
    display: flex;
    justify-content: center;
    font-size: 0.72rem;
    color: var(--dip-text);
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.dip-numbers {
    display: flex;
    gap: 6px;
}
.dip-numbers span { width: 32px; text-align: center; color: var(--dip-text); font-weight: 700; font-size: 0.75rem; }
.dip-switches {
    display: flex;
    gap: 6px;
}
.dip-switch-item {
    width: 32px;
    height: 52px;
    background: var(--dip-slot);
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.2);
    transition: var(--transition);
    overflow: hidden;
}
.dip-switch-item::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 50%;
    background: rgba(255,255,255,0.05);
    border-radius: 4px 4px 0 0;
}
.dip-switch-item:hover { border-color: rgba(255,255,255,0.5); }
.dip-knob {
    position: absolute;
    left: 4px;
    right: 4px;
    height: 20px;
    background: linear-gradient(180deg, var(--dip-knob) 0%, var(--dip-knob-end) 100%);
    border-radius: 3px;
    bottom: 4px;
    transition: top 0.25s cubic-bezier(0.4, 0, 0.2, 1), bottom 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.dip-switch-item.on .dip-knob {
    bottom: auto;
    top: 4px;
    background: linear-gradient(180deg, var(--dip-knob) 0%, var(--dip-knob-end) 100%);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.dip-switch-item.on { border-color: rgba(255,255,255,0.4); background: var(--dip-slot-on); }

/* DIP Cards */
.dip-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; }
.dip-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
}
.dip-card:hover { border-color: var(--border-light); }
.dip-card.active { border-color: var(--green); box-shadow: 0 0 16px color-mix(in srgb, var(--green) 15%, transparent); }
.dip-card.highlight-flash {
    animation: dipCardFlash 1.5s ease;
}
@keyframes dipCardFlash {
    0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 40%, transparent); }
    30%  { box-shadow: 0 0 20px 4px color-mix(in srgb, var(--accent) 50%, transparent); border-color: var(--accent); }
    100% { box-shadow: none; }
}
.dip-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-hover);
    border-bottom: 1px solid var(--border);
}
.dip-card-bit {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--accent);
}
.dip-card-label { font-size: 0.875rem; color: var(--text-primary); font-weight: 500; }
.dip-card-status {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-weight: 600;
}
.dip-card-status.off { background: color-mix(in srgb, var(--red) 15%, transparent); color: var(--red); }
.dip-card-status.on { background: color-mix(in srgb, var(--green) 15%, transparent); color: var(--green); }
.dip-card-body { padding: 0.85rem 1rem; }

/* Peripheral indicator chips */
.dip-peripheral-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding: 0.6rem;
    background: var(--bg-primary);
    border-radius: var(--radius);
}
.dip-periph-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.dip-periph-arrow {
    color: var(--accent);
    flex-shrink: 0;
    width: 28px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}
.dip-periph-chip {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.55rem;
    border-radius: 6px;
    font-size: 0.8rem;
    transition: all 0.4s ease;
    position: relative;
}
.periph-lit {
    background: color-mix(in srgb, var(--green) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--green) 35%, transparent);
    color: var(--text-primary);
    box-shadow: 0 0 12px color-mix(in srgb, var(--green) 20%, transparent);
}
.periph-dim {
    background: rgba(100,116,139,0.06);
    border: 1px solid rgba(100,116,139,0.15);
    color: var(--text-muted);
    opacity: 0.45;
    filter: grayscale(0.6);
}
.periph-icon { font-size: 0.9rem; }
.periph-name { flex: 1; font-weight: 600; font-size: 0.82rem; }
.periph-led {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: all 0.4s ease;
}
.led-on {
    background: var(--green);
    box-shadow: 0 0 6px var(--green), 0 0 12px color-mix(in srgb, var(--green) 40%, transparent);
    animation: ledPulse 2s ease-in-out infinite;
}
.led-off {
    background: var(--text-muted);
    opacity: 0.3;
}
@keyframes ledPulse {
    0%, 100% { box-shadow: 0 0 4px var(--green), 0 0 8px color-mix(in srgb, var(--green) 30%, transparent); }
    50% { box-shadow: 0 0 8px var(--green), 0 0 20px color-mix(in srgb, var(--green) 50%, transparent); }
}

.dip-card-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}
.dip-func-block {
    flex: 1;
    padding: 0.6rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    transition: var(--transition);
}
.dip-func-block.func-off {
    background: color-mix(in srgb, var(--accent) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
}
.dip-func-block.func-on {
    background: color-mix(in srgb, var(--green) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--green) 20%, transparent);
}
.dip-func-block.active-func {
    border-color: var(--green);
    background: color-mix(in srgb, var(--green) 15%, transparent);
    box-shadow: 0 0 8px color-mix(in srgb, var(--green) 10%, transparent);
}
.dip-func-block.inactive-func { opacity: 0.45; }
.dip-func-title { font-weight: 700; margin-bottom: 0.2rem; color: var(--text-primary); font-size: 0.85rem; }
.dip-func-detail { color: var(--text-primary); font-size: 0.8rem; font-weight: 500; }
.dip-card-pins {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}
.dip-pin-tag {
    font-size: 0.75rem;
    padding: 0.1rem 0.4rem;
    background: var(--accent-dim);
    color: var(--cyan);
    border-radius: 3px;
    font-family: monospace;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
}
.dip-card-reason {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}

/* Peripheral glow effect */
.peripheral-active {
    animation: peripheralGlow 1.5s ease-in-out infinite alternate;
}
@keyframes peripheralGlow {
    from { box-shadow: 0 0 4px color-mix(in srgb, var(--green) 30%, transparent); }
    to { box-shadow: 0 0 16px color-mix(in srgb, var(--green) 60%, transparent); }
}
.peripheral-inactive {
    opacity: 0.35;
    filter: grayscale(0.5);
}

.dip-housing-sm { padding: 10px 14px; }
.dip-housing-sm .dip-switch-item { width: 32px; height: 48px; }
.dip-housing-sm .dip-numbers span { width: 32px; font-size: 0.68rem; }

/* Mini switch info */
.mini-switch-info {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.6rem 0.85rem;
    margin-top: 0.75rem;
}
.mini-switch-result {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.3rem;
    font-size: 0.88rem;
}
.mini-switch-label { color: var(--text-secondary); font-weight: 500; }
.mini-switch-value { font-weight: 700; font-family: var(--font-mono); }
.mini-switch-detail {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
    font-family: var(--font-mono);
}

/* TF Card */
.tf-section { margin-top: 2rem; }
.tf-toggle-wrapper { margin-bottom: 1rem; }
.tf-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
}
.tf-toggle input { display: none; }
.tf-slider {
    width: 44px;
    height: 24px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 12px;
    position: relative;
    transition: var(--transition);
    flex-shrink: 0;
}
.tf-slider::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: var(--text-secondary);
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.tf-toggle input:checked + .tf-slider { background: var(--red); border-color: var(--red); }
.tf-toggle input:checked + .tf-slider::after { left: 22px; background: var(--bg-secondary); }
.tf-label { font-size: 0.85rem; color: var(--text-secondary); transition: var(--transition); }
.tf-toggle input:checked ~ .tf-label { color: var(--red); }

.tf-table-wrapper { overflow-x: auto; }
.tf-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.tf-table th, .tf-table td {
    padding: 0.6rem 0.85rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.tf-table th {
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
}
.tf-table tr:hover td { background: var(--bg-hover); }
.tf-active-cell { color: var(--green); font-weight: 500; }
.tf-inactive-cell { color: var(--text-muted); text-decoration: line-through; opacity: 0.5; }

/* Pin Header Tables */
.pin-header-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.pin-header-col { min-width: 0; }
.pin-header-table-wrapper { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.pin-header-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    table-layout: fixed;
}
.pin-header-table th {
    padding: 0.6rem 0.6rem;
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1;
}
.pin-header-table td {
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
    vertical-align: middle;
}
/* 竖线分隔 - 中间序号列两侧加粗竖线 */
.pin-header-table th,
.pin-header-table td { border-left: 1px solid var(--border-light); border-right: 1px solid var(--border-light); }
.pin-header-table th:first-child,
.pin-header-table td:first-child { border-left: none; }
.pin-header-table th:last-child,
.pin-header-table td:last-child { border-right: none; }
/* 中间两列序号之间用粗竖线强调排针中心 */
.pin-header-table .pin-seq { border-left: 2px solid var(--border); border-right: 2px solid var(--border); }
.pin-header-table tr:hover td { background: var(--bg-hover); }
/* 列宽分配 */
.pin-header-table .th-func-l,
.pin-header-table .pin-func-left { width: 35%; text-align: right; padding-right: 0.8rem; }
.pin-header-table .th-func-r,
.pin-header-table .pin-func-right { width: 35%; text-align: left; padding-left: 0.8rem; }
.pin-header-table .pin-name {
    font-family: var(--font-mono, 'Consolas', monospace);
    font-weight: 700;
    color: var(--cyan);
    cursor: pointer;
    white-space: nowrap;
    text-align: center;
    width: 12%;
}
.pin-header-table .pin-name:hover { color: var(--accent); text-decoration: underline; }
.pin-header-table .pin-seq {
    color: var(--text-muted);
    text-align: center;
    font-size: 0.78rem;
    font-weight: 700;
    width: 3%;
    background: color-mix(in srgb, var(--bg-primary) 60%, var(--bg-card));
}
.pin-header-table .pin-func { color: var(--text-primary); font-size: 0.82rem; font-weight: 500; }
.pin-func-conflict { color: var(--orange) !important; font-weight: 600; }
.pin-func-power { color: var(--red) !important; }
.pin-func-gnd { color: var(--text-muted) !important; }

/* Chip View Table */
.chip-view-header { margin-bottom: 1rem; }
.filter-bar { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-top: 0.75rem; }
.filter-btn {
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.75rem;
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition);
    min-height: 44px;
}
.filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.filter-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.chip-table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    max-height: 70vh;
    overflow-y: auto;
}
.chip-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.chip-table th {
    padding: 0.6rem 0.85rem;
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1;
}
.chip-table td {
    padding: 0.5rem 0.85rem;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}
.chip-table tr:hover td { background: var(--bg-hover); }
.chip-table tr.hidden { display: none; }
.chip-pin-name {
    font-family: 'Consolas', monospace;
    font-weight: 700;
    color: var(--cyan);
    cursor: pointer;
}
.chip-pin-name:hover { color: var(--accent); }
.chip-af { font-family: monospace; color: var(--text-secondary); font-size: 0.83rem; }
.chip-net { font-family: monospace; color: var(--text-muted); font-size: 0.82rem; }
.chip-conflict-tag {
    font-size: 0.73rem;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-weight: 600;
}
.chip-conflict-tag.sw { background: color-mix(in srgb, var(--orange) 15%, transparent); color: var(--orange); }
.chip-conflict-tag.tf { background: color-mix(in srgb, var(--red) 15%, transparent); color: var(--red); }
.chip-conflict-tag.none { color: var(--text-muted); }
.chip-category-tag {
    font-size: 0.73rem;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-weight: 600;
    white-space: nowrap;
    text-shadow: 0 0 1px rgba(0,0,0,0.15);
}
.chip-table tr.search-highlight td { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.chip-table tr.core-pin-row td { background: color-mix(in srgb, var(--text-muted) 10%, transparent); }
.chip-table tr.core-pin-row:hover td { background: color-mix(in srgb, var(--text-muted) 18%, transparent); }

/* I2C Bus - Topology View */
.i2c-hint { font-size: 0.875rem; color: var(--text-secondary); margin-bottom: 1.5rem; }
.i2c-bus-visual { width: 100%; }

.i2c-topology {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2.5rem;
}
.i2c-topology-secondary { margin-bottom: 0; }

/* 顶部引脚 + 总线标签 + 中继器 */
.i2c-bus-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0;
}
.i2c-bus-pins { display: flex; gap: 0.5rem; }
.i2c-pin-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.7rem;
    background: var(--bg-card);
    border: 2px solid var(--accent);
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--accent);
    cursor: pointer;
    transition: var(--transition);
    min-height: 44px;
}
.i2c-pin-chip:hover { background: var(--accent); color: #fff; }
.i2c-pin-role {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.1rem 0.3rem;
    background: var(--accent-dim);
    border-radius: 3px;
    color: var(--accent);
}
.i2c-pin-chip:hover .i2c-pin-role { background: rgba(255,255,255,0.2); color: #fff; }

.i2c-bus-wire {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.i2c-wire-line {
    width: 32px;
    height: 3px;
    background: var(--accent);
    border-radius: 2px;
}
.i2c-wire-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent);
    white-space: nowrap;
    padding: 0.25rem 0.6rem;
    background: var(--accent-dim);
    border-radius: 20px;
}

.i2c-buffer-chip {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.7rem;
    background: var(--bg-card);
    border: 2px dashed var(--orange);
    border-radius: var(--radius);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--orange);
}
.i2c-buffer-icon { font-size: 1rem; }
.i2c-buffer-desc { font-size: 0.7rem; color: var(--text-muted); font-weight: 500; }

/* 总线主干线 */
.i2c-bus-trunk {
    width: 80%;
    height: 4px;
    background: var(--accent);
    border-radius: 2px;
    margin: 0.75rem 0 0;
    position: relative;
}

/* 设备行 */
.i2c-devices-row {
    display: flex;
    justify-content: center;
    gap: 0;
    width: 80%;
}
.i2c-dev-node {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
}
.i2c-dev-branch {
    width: 3px;
    height: 20px;
    border-left: 3px solid var(--accent);
}
.i2c-dev-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-top: 3px solid var(--dev-color, var(--accent));
    border-radius: var(--radius);
    padding: 0.65rem 0.5rem;
    text-align: center;
    width: calc(100% - 8px);
    margin: 0 4px;
    transition: var(--transition);
    cursor: default;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 110px;
}
.i2c-dev-card:hover {
    border-color: var(--dev-color, var(--accent));
    box-shadow: 0 4px 16px color-mix(in srgb, var(--dev-color, var(--accent)) 20%, transparent);
    transform: translateY(-2px);
}
.i2c-dev-addr {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--dev-color, var(--green));
    background: color-mix(in srgb, var(--dev-color, var(--green)) 10%, transparent);
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 10px;
    margin-bottom: 0.3rem;
}
.i2c-dev-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 0.15rem;
}
.i2c-dev-type {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.15rem;
}
.i2c-dev-detail {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.3;
}

/* Pin Detail Overlay */
.pin-detail-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 200;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}
.pin-detail-overlay.show { display: flex; }
.pin-detail-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    max-width: 480px;
    width: 90%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.pin-detail-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.25rem;
}
.pin-detail-close:hover { color: var(--text-primary); }
.pin-detail-title { font-size: 1.25rem; font-weight: 700; color: var(--cyan); font-family: monospace; margin-bottom: 0.75rem; }
.pin-detail-row { display: flex; justify-content: space-between; padding: 0.4rem 0; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
.pin-detail-key { color: var(--text-secondary); }
.pin-detail-val { color: var(--text-primary); font-weight: 500; text-align: right; }

/* Search Results */
.search-results-panel {
    display: none;
    position: fixed;
    top: 56px;
    right: 1.5rem;
    max-width: 380px;
    width: 100%;
    max-height: 60vh;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    z-index: 150;
    padding: 0.5rem;
}
.search-results-panel.show { display: block; }
.search-result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
}
.search-result-item:hover { background: var(--bg-hover); }
.search-result-pin { font-family: monospace; font-weight: 700; color: var(--cyan); min-width: 40px; }
.search-result-desc { color: var(--text-secondary); flex: 1; }
.search-result-cat { font-size: 0.73rem; padding: 0.1rem 0.4rem; border-radius: 10px; }
.search-no-result { padding: 1rem; text-align: center; color: var(--text-muted); font-size: 0.85rem; }

/* Footer */
.footer {
    padding: 0.75rem 1.5rem;
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}
.footer-sep { margin: 0 0.5rem; }

/* 版本号徽章 */
.version-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.5rem;
    background: var(--accent-dim);
    color: var(--accent);
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
    font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}
.version-badge:hover {
    background: var(--accent);
    color: #fff;
}

/* 更新记录弹窗 */
.changelog-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 600;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
}
.changelog-overlay.show {
    display: flex;
}
.changelog-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 520px;
    max-height: 75vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.changelog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.changelog-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}
.changelog-close {
    width: 30px;
    height: 30px;
    border: none;
    background: var(--bg-hover);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.15rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.changelog-close:hover {
    background: var(--border);
    color: var(--text-primary);
}
.changelog-body {
    padding: 1rem 1.25rem;
    overflow-y: auto;
}
.changelog-entry {
    margin-bottom: 1.2rem;
}
.changelog-entry:last-child {
    margin-bottom: 0;
}
.changelog-version-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}
.changelog-ver {
    font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--accent);
    background: var(--accent-dim);
    padding: 0.15rem 0.6rem;
    border-radius: 6px;
}
.changelog-date {
    font-size: 0.78rem;
    color: var(--text-muted);
}
.changelog-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}
.changelog-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0.3rem 0 0.6rem;
}
.changelog-list {
    padding-left: 1.2rem;
    margin: 0;
}
.changelog-list li {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 0.2rem;
}

.site-footer {
    padding: 0.6rem 1.5rem;
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-light);
    background: var(--bg-secondary);
}
.site-footer-inner {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.15rem;
}
.site-footer a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s;
}
.site-footer a:hover {
    color: var(--accent);
}
.site-footer .footer-sep {
    margin: 0 0.3rem;
    opacity: 0.5;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* Responsive */
@media (max-width: 1200px) {
    .overview-bottom { grid-template-columns: 1fr; }
    .pin-header-layout { grid-template-columns: 1fr; }
    .board-main-layout { flex-direction: column; }
    .region-side-panel { width: 100%; max-height: none; position: static; }
    .editor-props-panel { width: 100%; max-height: none; position: static; }
}
@media (max-width: 900px) {
    .header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .header-right { width: 100%; flex-wrap: wrap; }
    .tab-nav { overflow-x: auto; width: 100%; }
    .search-input { width: 100%; }
    .search-input:focus { width: 100%; }
    .dip-cards { grid-template-columns: 1fr; }
    .search-results-panel { right: 0.5rem; left: 0.5rem; max-width: none; }
    .main-content { padding: 1rem; }
    .filter-bar { gap: 0.25rem; }
}
@media (max-width: 768px) {
    .overview-bottom { gap: 1rem; }
    .stat-list-scroll { max-height: 300px; }
    .dip-peripheral-row { flex-direction: column; gap: 0.3rem; }
    .dip-periph-arrow { transform: rotate(90deg); }
    .dip-card-row { flex-direction: column; }
    .pin-header-table { font-size: 0.75rem; }
    .chip-table { font-size: 0.78rem; }
}
@media (max-width: 480px) {
    html { font-size: 14px; }
    .main-content { padding: 0.5rem; }
    .header { padding: 0.5rem 0.75rem; }
    .logo { font-size: 1rem; }
    .board-main-layout { gap: 0.5rem; }
    .dip-housing { padding: 8px 10px; }
    .dip-switch-item { width: 26px; height: 44px; }
    .dip-switches { gap: 4px; }
    .dip-numbers span { width: 26px; font-size: 0.65rem; }
    .dip-numbers { gap: 4px; }
}

/* ========== 区域标注系统 ========== */

/* 编辑器切换按钮 */
.editor-toggle-btn {
    margin-left: auto;
    padding: 0.25rem 0.65rem;
    font-size: 0.78rem;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}
.editor-toggle-btn:hover { border-color: var(--accent); color: var(--accent); }
.editor-toggle-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* 编辑器工具栏 */
.editor-toolbar {
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}
.editor-toolbar.show { display: flex; }
.editor-tool-group { display: flex; gap: 3px; }
.editor-tool-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.45rem 0.65rem;
    font-size: 0.78rem;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    min-height: 44px;
}
.editor-tool-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.editor-tool-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.editor-tool-btn svg { flex-shrink: 0; }
.editor-exit-btn { border-color: var(--red); color: var(--red); }
.editor-exit-btn:hover { background: var(--red); color: #fff; }
.editor-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-left: auto;
}

/* 编辑器属性面板 */
.editor-props-panel {
    display: none;
    flex-direction: column;
    gap: 0.65rem;
    width: 340px;
    min-width: 280px;
    flex-shrink: 0;
    max-height: 75vh;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.85rem;
    position: sticky;
    top: 70px;
}
.editor-props-panel.show { display: flex; }
.region-side-panel.editor-hidden { display: none; }

/* 自定义输入行 */
.prop-custom-input-row {
    display: flex;
    gap: 4px;
    margin-bottom: 0.35rem;
}
.prop-input-sm { flex: 1; font-size: 0.78rem; padding: 0.25rem 0.45rem; }
.prop-add-btn {
    padding: 0.45rem 0.65rem;
    background: var(--accent);
    border: none;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    transition: var(--transition);
    min-height: 44px;
}
.prop-add-btn:hover { background: color-mix(in srgb, var(--accent) 85%, black); }

.prop-group { display: flex; flex-direction: column; gap: 0.25rem; }
.prop-row { display: flex; gap: 0.75rem; }
.prop-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.prop-hint { font-weight: 400; color: var(--text-muted); font-size: 0.72rem; }
.prop-input {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.35rem 0.55rem;
    border-radius: 4px;
    font-size: 0.8rem;
    outline: none;
    transition: var(--transition);
}
.prop-input:focus { border-color: var(--accent); }
.prop-color {
    width: 36px;
    height: 30px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-primary);
    cursor: pointer;
    padding: 2px;
}
.prop-range {
    width: 100%;
    accent-color: var(--accent);
}
.prop-textarea {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.45rem 0.55rem;
    border-radius: 4px;
    font-size: 0.78rem;
    font-family: 'Consolas', monospace;
    outline: none;
    resize: vertical;
    min-height: 80px;
    transition: var(--transition);
}
.prop-textarea:focus { border-color: var(--accent); }
.prop-md-preview {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.5rem;
    font-size: 0.78rem;
    max-height: 150px;
    overflow-y: auto;
    color: var(--text-secondary);
    line-height: 1.5;
}
/* Markdown 工具栏 */
.md-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0.3rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    flex-wrap: wrap;
}
.md-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 28px;
    padding: 0 0.35rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}
.md-tool-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.md-tool-sep { width: 1px; height: 18px; background: var(--border); margin: 0 2px; }
.md-toolbar + .prop-textarea { border-radius: 0 0 4px 4px; }
/* Markdown 预览图片 */
.prop-md-preview img, .region-md-content img {
    max-width: 100%;
    border-radius: var(--radius);
    margin: 0.3rem 0;
}
.prop-md-preview h1, .prop-md-preview h2, .prop-md-preview h3 {
    color: var(--text-primary);
    margin: 0.3rem 0;
    font-size: 0.9rem;
}
.prop-md-preview p { margin: 0.25rem 0; }
.prop-md-preview code {
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.75rem;
}
.prop-md-preview table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.4rem 0;
    font-size: 0.75rem;
    border: 1px solid var(--border);
}
.prop-md-preview thead { background: var(--bg-primary); }
.prop-md-preview th {
    text-align: left;
    font-weight: 600;
    padding: 0.35rem 0.5rem;
    border-bottom: 2px solid var(--border);
    font-size: 0.72rem;
    white-space: nowrap;
}
.prop-md-preview td {
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
}
.prop-md-preview tr:last-child td { border-bottom: none; }
.prop-md-preview tr:hover td { background: var(--bg-hover); }
.prop-empty { color: var(--text-muted); font-size: 0.78rem; padding: 0.5rem; }

/* 资源选择器 */
.prop-resource-list {
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.35rem;
}
.prop-resource-grid {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 0.1rem 0;
}
.prop-resource-label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
    border: 1px solid transparent;
}
.prop-resource-label:hover { background: var(--bg-hover); color: var(--text-primary); }
.prop-resource-label.selected { background: var(--accent-dim); color: var(--cyan); border-color: var(--accent); }
.prop-resource-label input { display: none; }

.prop-label-sm {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
}
.prop-dip-overlay-group .prop-row {
    gap: 0.4rem;
}

/* 引脚选择器 */
.prop-pin-list {
    max-height: 180px;
    overflow-y: auto;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.35rem;
}
.prop-pin-category {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.2rem 0.3rem;
    margin-top: 0.25rem;
}
.prop-pin-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 0.15rem 0;
}
.prop-pin-label {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.72rem;
    font-family: monospace;
    padding: 0.15rem 0.35rem;
    border-radius: 3px;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
    border: 1px solid transparent;
}
.prop-pin-label:hover { background: var(--bg-hover); color: var(--text-primary); }
.prop-pin-label.selected { background: var(--accent-dim); color: var(--cyan); border-color: var(--accent); }
.prop-pin-label input { display: none; }

/* SVG 覆盖层 */
.region-overlay-svg {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

/* 区域 tooltip */
.region-tooltip {
    position: fixed;
    z-index: 300;
    padding: 0.3rem 0.6rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-primary);
    pointer-events: none;
    box-shadow: var(--shadow);
    white-space: nowrap;
}

/* 搜索高亮动画 */
@keyframes regionSearchPulse {
    0%   { opacity: 1; }
    25%  { opacity: 1; }
    50%  { opacity: 0.5; }
    75%  { opacity: 1; }
    100% { opacity: 1; }
}
.region-search-pulse path {
    animation: regionSearchPulse 0.6s ease-in-out 3;
}

/* 区域详情弹窗 */
.region-info-card { max-width: 560px; }
.region-info-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}
.region-info-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0.75rem 0 0.4rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border);
}
.region-pin-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: var(--transition);
    flex-wrap: wrap;
}
.region-pin-item:hover { background: var(--bg-hover); }
.region-pin-name {
    font-family: monospace;
    font-weight: 700;
    color: var(--cyan);
    min-width: 36px;
}
.region-pin-af {
    font-family: monospace;
    font-size: 0.72rem;
    color: var(--text-muted);
}
.region-pin-desc {
    flex: 1;
    color: var(--text-secondary);
    font-size: 0.75rem;
}
.region-info-empty {
    color: var(--text-muted);
    font-size: 0.8rem;
    padding: 0.5rem;
}
.region-md-content {
    font-size: 0.82rem;
    line-height: 1.6;
    color: var(--text-secondary);
    padding: 0.5rem 0;
}
.region-md-content h1, .region-md-content h2, .region-md-content h3 {
    color: var(--text-primary);
    margin: 0.5rem 0 0.25rem;
}
.region-md-content h1 { font-size: 1.1rem; }
.region-md-content h2 { font-size: 0.95rem; }
.region-md-content h3 { font-size: 0.88rem; }
.region-md-content p { margin: 0.3rem 0; }
.region-md-content code {
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    font-size: 0.78rem;
    font-family: monospace;
}
.region-md-content pre {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.6rem;
    overflow-x: auto;
    margin: 0.4rem 0;
}
.region-md-content pre code { background: none; padding: 0; }
.region-md-content ul, .region-md-content ol { padding-left: 1.2rem; margin: 0.3rem 0; }
.region-md-content li { margin: 0.15rem 0; }
.region-md-content strong { color: var(--text-primary); }
.region-md-content blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 0.75rem;
    margin: 0.4rem 0;
    color: var(--text-muted);
}
.region-md-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5rem 0;
    font-size: 0.78rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: table;
}
.region-md-content thead {
    background: var(--bg-primary);
}
.region-md-content th {
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    padding: 0.4rem 0.6rem;
    border-bottom: 2px solid var(--border);
    font-size: 0.75rem;
    white-space: nowrap;
}
.region-md-content td {
    padding: 0.35rem 0.6rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
    vertical-align: top;
}
.region-md-content tr:last-child td {
    border-bottom: none;
}
.region-md-content tr:hover td {
    background: var(--bg-hover);
}
.region-md-content hr {
    border: none;
    border-top: 1px solid var(--border-light);
    margin: 0.6rem 0;
}
.region-md-content a {
    color: var(--accent);
    text-decoration: none;
}
.region-md-content a:hover {
    text-decoration: underline;
}
.region-tag-chip {
    display: inline-block;
    font-size: 0.73rem;
    padding: 0.15rem 0.5rem;
    background: var(--accent-dim);
    color: var(--accent);
    border-radius: 10px;
    margin: 0.15rem 0.2rem 0.15rem 0;
}

/* 搜索分组标签 */
.search-section-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.4rem 0.75rem 0.15rem;
}

/* 编辑器通知 */
.editor-notifications {
    position: fixed;
    top: 60px;
    right: 1rem;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.editor-notification {
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.8rem;
    color: #fff;
    box-shadow: var(--shadow);
    animation: slideInRight 0.25s ease;
}
.editor-notification.success { background: var(--notify-success); }
.editor-notification.error { background: var(--notify-error); }
.editor-notification.warning { background: var(--notify-warning); }
.editor-notification.info { background: var(--notify-info); }
.editor-notification.fade-out { opacity: 0; transition: opacity 0.3s; }
@keyframes slideInRight { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* 顶点手柄 */
.vertex-handle { transition: r 0.15s; }
.vertex-handle:hover { r: 8; }
.edge-mid-handle { transition: opacity 0.15s; opacity: 0.6; }
.edge-mid-handle:hover { opacity: 1; }

/* 绘制预览 */
.drawing-preview-group { pointer-events: none; }
