@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
    --bg: #2B2A28;
    --surface: #35332F;
    --surface-hover: #3F3C37;
    --border: #4A473F;
    --gold: #B8935F;
    --gold-bright: #D4AF7A;
    --ivory: #EDE7DB;
    --muted: #9B9589;
    --sage: #7C9B7C;
    --rust: #A66B5C;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ivory);
    font-family: 'Inter', -apple-system, sans-serif;
    line-height: 1.6;
}

.mono { font-family: 'IBM Plex Mono', monospace; }

a { color: var(--gold-bright); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== 页头 ===== */
header.site {
    padding: 20px 40px 0;
    max-width: 1100px;
    margin: 0 auto;
}
.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}
.brand-logo {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.brand h1 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 26px;
    letter-spacing: 0.1em;
    margin: 0;
    color: var(--ivory);
}
.brand .tagline {
    font-size: 12px;
    color: var(--muted);
    letter-spacing: 0.06em;
}

/* ===== Tab导航 ===== */
.tab-bar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 1100px;
    margin: 16px auto 0;
    padding: 0 40px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-item {
    flex-shrink: 0;
    padding: 12px 16px;
    font-size: 14px;
    color: var(--muted);
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}
.tab-item:hover { color: var(--ivory); text-decoration: none; }
.tab-item.active {
    color: var(--gold-bright);
    border-bottom-color: var(--gold);
    font-weight: 600;
}

main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 30px 40px 80px;
}

section { margin-bottom: 48px; }

h2.section-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 22px;
    letter-spacing: 0.04em;
    color: var(--gold-bright);
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
    margin-bottom: 18px;
}

/* ===== 触发区 ===== */
.trigger-zone {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.trigger-card {
    background: var(--surface);
    border: 1px solid var(--gold);
    border-radius: 4px;
    padding: 18px 20px;
    box-shadow: 0 0 0 1px rgba(184,147,95,0.12);
}
.trigger-card .target { font-size: 17px; font-weight: 600; color: var(--ivory); }
.trigger-card .pattern-name { font-size: 13px; color: var(--muted); margin-top: 4px; }

.empty-state {
    color: var(--muted);
    font-style: italic;
    font-size: 14px;
    padding: 20px 0;
}

/* ===== 分组折叠 ===== */
details.status-group {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    margin-bottom: 10px;
    padding: 4px 0;
}
details.status-group summary {
    cursor: pointer;
    padding: 14px 20px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    list-style: none;
}
details.status-group summary::-webkit-details-marker { display: none; }
.count-badge {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    color: var(--muted);
}

.instance-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
}
.instance-row:hover { background: var(--surface-hover); }
.instance-row .target { font-weight: 500; }
.instance-row .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }

.status-tag {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 100px;
    border: 1px solid var(--border);
    color: var(--muted);
    white-space: nowrap;
}
.status-tag.open { border-color: var(--sage); color: var(--sage); }
.status-tag.rejected { border-color: var(--rust); color: var(--rust); }
.status-tag.watching { border-color: var(--gold); color: var(--gold-bright); }

/* ===== 模式库 ===== */
.pattern-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}
.pattern-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 16px 18px;
}
.pattern-card .name { font-weight: 600; margin-bottom: 6px; }
.pattern-card .mechanism { font-size: 13px; color: var(--muted); }

/* ===== 详情页 ===== */
.back-link { font-size: 13px; color: var(--muted); }
.detail-header { margin: 16px 0 30px; }
.detail-header h1 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 32px;
    margin: 6px 0;
}

.layer {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 20px 24px;
    margin-bottom: 16px;
}
.layer h3 {
    font-size: 14px;
    letter-spacing: 0.06em;
    color: var(--gold-bright);
    text-transform: none;
    margin: 0 0 12px;
}
.layer .field { margin-bottom: 10px; font-size: 14px; }
.layer .field .label { color: var(--muted); font-size: 12px; display: block; margin-bottom: 2px; }
.layer .placeholder { color: var(--muted); font-style: italic; font-size: 13px; }

.timeline-item {
    border-left: 2px solid var(--border);
    padding: 4px 0 14px 16px;
    position: relative;
    font-size: 13px;
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: -5px; top: 6px;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--gold);
}
.timeline-item .transition { font-family: 'IBM Plex Mono', monospace; color: var(--ivory); }
.timeline-item .reason { color: var(--muted); margin-top: 2px; }
.timeline-item .time { color: var(--muted); font-size: 11px; }

/* ===== 意见区 ===== */
.feedback-box { background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 20px 24px; }
.vote-row { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.vote-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--ivory);
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: border-color 0.15s;
}
.vote-btn:hover { border-color: var(--gold); }
.vote-btn.up.active { border-color: var(--sage); color: var(--sage); }
.vote-btn.down.active { border-color: var(--rust); color: var(--rust); }
.vote-counts { font-family: 'IBM Plex Mono', monospace; font-size: 13px; color: var(--muted); }

.reason-picker { display: none; margin-bottom: 14px; }
.reason-picker.show { display: block; }
.reason-picker select, .reason-picker textarea {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--ivory);
    padding: 8px 10px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 13px;
    margin-bottom: 8px;
}
.reason-picker button {
    background: var(--gold);
    border: none;
    color: var(--bg);
    padding: 8px 18px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
}
.reason-picker button:hover { background: var(--gold-bright); }

.reason-dist { margin-top: 10px; font-size: 12px; color: var(--muted); }
.reason-dist span { display: inline-block; margin-right: 12px; }

.mechanism-group { display: none; }

footer.site {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 40px 40px;
    color: var(--muted);
    font-size: 12px;
}

/* ===== 移动端适配(iPhone等窄屏) ===== */
@media (max-width: 600px) {
    header.site { padding: 16px 16px 0; }
    .tab-bar { padding: 0 16px; margin-top: 12px; }
    .tab-item { padding: 10px 12px; font-size: 13px; }
    main { padding: 20px 16px 60px; }
    .brand h1 { font-size: 22px; }
    .brand-logo { width: 36px; height: 36px; }
    .detail-header h1 { font-size: 24px; }
    .layer { padding: 16px 18px; }
    .reason-picker select,
    .reason-picker textarea,
    .reason-picker input,
    .layer input,
    .layer textarea,
    .layer select {
        font-size: 16px;
    }
    .vote-btn, .reason-picker button {
        min-height: 44px;
    }
    .status-tag { font-size: 12px; padding: 4px 12px; }
    footer.site { padding: 16px 16px 32px; }
}

