*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --primary: #3d2b1f; --accent: #8b6343; --accent-lt: #c8a97a; --bg: #faf8f5; --bg-card: #ffffff;
    --bg-form: #f3efe9; --border: #e0d8cc; --text: #2c2420; --text-sub: #6b5f57;
    --badge-show: #7a6040; --badge-hide: #9e3a2e; --badge-none: #8c8c8c; --badge-folk: #4a6741;
    --radius: 6px; --shadow: 0 1px 4px rgba(0,0,0,.08);
}
body { font-family: 'Noto Sans JP', 'Hiragino Sans', 'Meiryo', sans-serif; font-size: 15px; line-height: 1.7; background: var(--bg); color: var(--text); }
.wrap { max-width: 900px; margin: 0 auto; padding: 24px 16px 60px; }
.site-header { border-bottom: 2px solid var(--accent); padding-bottom: 16px; margin-bottom: 28px; }
.site-header .back-link { font-size: 13px; color: var(--accent); text-decoration: none; letter-spacing: .02em; }
.site-header .back-link:hover { text-decoration: underline; }
.site-header h1 { font-size: clamp(18px, 4vw, 24px); font-weight: 700; color: var(--primary); margin-top: 8px; letter-spacing: .04em; }
.site-header .dl-link { font-size: 13px; color: var(--text-sub); margin-top: 4px; }
.site-header .dl-link a { color: var(--accent); text-decoration: none; }
.site-header .dl-link a:hover { text-decoration: underline; }
.source-tabs { display: flex; margin-bottom: 20px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #fff; }
.source-tab { flex: 1; padding: 10px 16px; text-align: center; font-size: 14px; font-weight: 500; color: var(--text-sub); text-decoration: none; border-right: 1px solid var(--border); background: #fff; transition: background .15s, color .15s; letter-spacing: .04em; }
.source-tab:last-child { border-right: none; }
.source-tab:hover { background: var(--bg-form); color: var(--text); }
.source-tab.active { background: var(--accent); color: #fff; pointer-events: none; }
.source-tab .tab-count { font-size: 11px; opacity: .85; margin-left: 4px; }
.search-form { background: var(--bg-form); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 28px; }
.search-form h2 { font-size: 13px; font-weight: 700; color: var(--text-sub); text-transform: uppercase; letter-spacing: .1em; margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-bottom: 16px; }
.form-item label { display: block; font-size: 12px; font-weight: 500; color: var(--text-sub); margin-bottom: 4px; letter-spacing: .04em; }
.plain-input { width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; font-family: inherit; font-size: 14px; color: var(--text); outline: none; transition: border-color .15s; }
.plain-input:focus { border-color: var(--accent); }
.token-field { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; min-height: 38px; padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; cursor: text; transition: border-color .15s; }
.token-field:focus-within { border-color: var(--accent); }
.token { display: inline-flex; align-items: center; gap: 3px; padding: 3px 6px 3px 10px; background: var(--accent); color: #fff; border-radius: 20px; font-size: 13px; font-weight: 500; white-space: nowrap; user-select: none; animation: tokenPop .12s ease; }
@keyframes tokenPop { from { transform: scale(.75); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.token-del { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; border-radius: 50%; background: rgba(255,255,255,.28); border: none; color: #fff; font-size: 12px; line-height: 1; cursor: pointer; padding: 0; transition: background .1s; flex-shrink: 0; }
.token-del:hover { background: rgba(255,255,255,.55); }
.token-input { flex: 1; min-width: 90px; border: none; outline: none; background: transparent; font-family: inherit; font-size: 14px; color: var(--text); padding: 2px 0; }
.token-input::placeholder { color: #b5a99e; }
.combo-wrap { position: relative; }
.combo-input-row { display: flex; align-items: stretch; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; overflow: hidden; transition: border-color .15s; }
.combo-input-row:focus-within { border-color: var(--accent); }
.combo-text { flex: 1; border: none; outline: none; background: transparent; font-family: inherit; font-size: 14px; color: var(--text); padding: 7px 10px; min-width: 0; }
.combo-arrow { flex-shrink: 0; display: flex; align-items: center; justify-content: center; width: 28px; cursor: pointer; color: var(--text-sub); border-left: 1px solid var(--border); background: #f0ece5; transition: background .12s; font-size: 9px; user-select: none; }
.combo-arrow:hover { background: var(--border); }
.combo-dropdown { position: absolute; top: calc(100% + 3px); left: 0; right: 0; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 6px 20px rgba(0,0,0,.13); z-index: 300; max-height: 220px; overflow-y: auto; display: none; }
.combo-dropdown.open { display: block; }
.combo-opt { padding: 7px 12px; font-size: 13px; color: var(--text); cursor: pointer; transition: background .08s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.combo-opt:hover, .combo-opt.hi { background: var(--bg-form); }
.combo-clear { padding: 6px 12px; font-size: 12px; color: var(--text-sub); cursor: pointer; border-bottom: 1px solid var(--border); transition: background .08s; }
.combo-clear:hover { background: #ffeeed; color: #a03030; }
.combo-dropdown::-webkit-scrollbar { width: 5px; }
.combo-dropdown::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.search-divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.keyword-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
.keyword-row .token-field { flex: 1; min-width: 180px; }
.keyword-row select { padding: 0 10px; height: 38px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; font-family: inherit; font-size: 13px; color: var(--text); }
.btn-search { height: 38px; padding: 0 22px; background: var(--accent); color: #fff; border: none; border-radius: var(--radius); font-family: inherit; font-size: 14px; font-weight: 500; cursor: pointer; letter-spacing: .04em; transition: background .15s; white-space: nowrap; }
.btn-search:hover { background: var(--primary); }
.result-meta { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--text-sub); margin-bottom: 14px; flex-wrap: wrap; gap: 6px; }
.result-meta strong { color: var(--text); font-size: 15px; }
.no-results { padding: 32px; text-align: center; color: var(--text-sub); font-size: 14px; border: 1px dashed var(--border); border-radius: var(--radius); }
.item-card { display: flex; gap: 16px; align-items: flex-start; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow); transition: box-shadow .15s, border-color .15s; text-decoration: none; color: inherit; }
a.item-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.14); border-color: var(--accent-lt); }
.item-card.ketsuban { background: #f2f2f2; border-color: #d4d4d4; cursor: default; }
.item-card.hitenji { background: #fff7f7; border-color: #f0d0d0; }
.item-card.folks-card { border-left: 3px solid var(--badge-folk); }
.item-thumb { flex-shrink: 0; width: 110px; }
.item-thumb img { width: 110px; height: 90px; object-fit: contain; border-radius: 4px; background: #f0ece6; display: block; }
.item-thumb .no-img { width: 110px; height: 90px; background: #ede9e3; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--text-sub); letter-spacing: .05em; }
.item-body { flex: 1; min-width: 0; }
.item-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-bottom: 8px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.item-name { font-size: 16px; font-weight: 700; color: var(--primary); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 500; color: #fff; letter-spacing: .04em; white-space: nowrap; }
.badge-show { background: var(--badge-show); }
.badge-hide { background: var(--badge-hide); }
.badge-none { background: var(--badge-none); }
.badge-folk { background: var(--badge-folk); }
.item-meta { display: flex; flex-wrap: wrap; gap: 4px 20px; font-size: 13px; color: var(--text-sub); }
.item-meta span strong { font-weight: 500; color: var(--text); margin-right: 3px; }
.item-note { font-size: 13px; color: var(--text-sub); font-style: italic; margin-top: 4px; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 4px; flex-wrap: wrap; margin: 24px 0; }
.page-btn { display: inline-block; padding: 5px 11px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; color: var(--accent); text-decoration: none; background: #fff; transition: background .12s, color .12s; }
.page-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 700; pointer-events: none; }
.page-ellipsis { font-size: 13px; color: var(--text-sub); padding: 0 4px; }
@media (max-width: 560px) {
    .item-card { flex-direction: column; }
    .item-thumb { width: 100%; }
    .item-thumb img, .item-thumb .no-img { width: 100%; height: 160px; }
    .form-grid { grid-template-columns: 1fr; }
    .keyword-row { flex-direction: column; align-items: stretch; }
    .source-tabs { flex-direction: column; }
    .source-tab { border-right: none; border-bottom: 1px solid var(--border); }
    .source-tab:last-child { border-bottom: none; }
}
