.r9 { max-width: 1240px; margin: 0 auto; padding: 8px 14px 30px; display: grid; gap: 16px; grid-template-columns: minmax(300px, 460px) 1fr; align-items: start; }
@media (max-width: 900px) { .r9 { grid-template-columns: 1fr; } }
.board-panel { position: sticky; top: 8px; }
@media (max-width: 900px) { .board-panel { position: static; } }
.board-title { text-align: center; font-family: var(--serif); font-size: clamp(20px, 5vw, 30px); margin: 10px 0;
  background: linear-gradient(90deg, #ffe08a, #fff, #c9a6ff, #ffe08a); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: hue-slide 6s linear infinite; }
.board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cell { position: relative; aspect-ratio: 59 / 86; border-radius: 6px; background: #0f0c1a; border: 2px dashed #ffffff33; display: grid; place-items: center; cursor: pointer; overflow: visible; transition: transform .15s, border-color .2s, box-shadow .2s; }
.cell:hover { border-color: #ffffff77; }
.cell.target { border: 2px solid var(--accent); box-shadow: 0 0 0 3px #ffcc4d44, 0 0 18px #ffcc4d66; }
.cell.picked { transform: scale(.94); box-shadow: 0 0 0 3px #8f6bff, 0 0 18px #8f6bffaa; }
.cell .plus { color: #ffffff55; font-size: 28px; pointer-events: none; text-align: center; line-height: 1.1; }
.cell .plus small { display: block; font-size: 11px; }
.cell.filled { border: none; background: transparent; }
.cell img, .cell .fb { width: 100%; height: 100%; object-fit: cover; border-radius: 4px; display: block; box-shadow: 0 6px 16px #0008; }
.cell.filled.pop { animation: cell-in .45s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes cell-in { 0% { transform: scale(.6) rotateY(90deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
.cell .tools { position: absolute; left: 0; right: 0; bottom: -4px; display: flex; justify-content: center; gap: 3px; opacity: 0; transition: opacity .2s; }
.cell:hover .tools, .cell.picked .tools, .cell:focus-within .tools { opacity: 1; }
@media (pointer: coarse) { .cell.filled .tools { opacity: 1; } }
.tools button { width: 26px; height: 26px; border-radius: 50%; border: 1px solid #fff; background: #000c; color: #fff; font-size: 12px; cursor: pointer; padding: 0; }
.tools button.del { background: #b0213acc; }

.search-panel h2 { margin: 0 0 8px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.f-row { margin: 0 0 10px; border: 0; padding: 0; min-width: 0; }
.f-row > label, .f-row legend { display: block; font-size: 13px; color: var(--muted); margin: 0 0 4px; padding: 0; }
input[type=search], input[type=number] { width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: #0f0c1a; border: 1px solid #ffffff2a; border-radius: 10px; padding: 9px 12px; }
input[type=number] { width: 7.5em; font-size: 15px; padding: 7px 10px; }
.seg { display: inline-flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.seg label { display: inline-flex; align-items: center; gap: 4px; margin: 0; padding: 4px 10px; border-radius: 999px; background: #ffffff10; border: 1px solid #ffffff22; color: var(--ink); font-size: 13px; cursor: pointer; }
.seg label:has(input:checked) { background: #8f6bff44; border-color: #8f6bff; }
.seg input { accent-color: var(--accent2); margin: 0; }
.seg.mini { margin: 0 0 0 8px; }
.seg.mini label { padding: 1px 8px; font-size: 11px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { appearance: none; font: inherit; font-size: 13px; color: var(--ink); background: #ffffff0d; border: 1px solid #ffffff26; border-radius: 999px; padding: 5px 11px; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.chips.small .chip { font-size: 12px; padding: 4px 9px; }
.chip[aria-pressed=true] { background: linear-gradient(135deg, #ffe58a, #ffb547); color: #2a1600; border-color: #ffe08a; font-weight: 700; }
.chip .dot { width: 14px; height: 14px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 9px; color: #fff; font-weight: 900; }
details.more { border: 1px solid #ffffff1a; border-radius: 12px; padding: 6px 12px; margin: 0 0 10px; background: #ffffff06; }
details.more summary { cursor: pointer; font-weight: 700; padding: 4px 0; }
details.more[open] summary { margin-bottom: 8px; }
.range { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.range .lbl { width: 2.6em; font-size: 13px; color: var(--muted); }
.link-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.arrows { display: grid; grid-template-columns: repeat(3, 30px); grid-template-rows: repeat(3, 30px); gap: 3px; }
.arrows button { appearance: none; border: 1px solid #ffffff33; background: #ffffff0d; color: #fff; border-radius: 6px; cursor: pointer; font-size: 14px; padding: 0; }
.arrows button[aria-pressed=true] { background: #ff5a2a; border-color: #ffe2b8; }
.arrows .mid { border: none; background: #3b7be033; border-radius: 4px; }
.sort-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sort-row > label { margin: 0; }
.count { font-size: 13px; color: var(--muted); margin: 6px 0; }
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.res { appearance: none; border: 0; padding: 0; background: none; cursor: pointer; display: flex; flex-direction: column; gap: 3px; color: var(--ink); text-align: left; font: inherit; }
.res .thumb { aspect-ratio: 59 / 86; width: 100%; border-radius: 4px; overflow: hidden; background: #0f0c1a; box-shadow: 0 3px 8px #0008; transition: transform .15s; }
.res:hover .thumb, .res:focus-visible .thumb { transform: translateY(-3px) scale(1.03); }
.res img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .3s; }
.res img.ok { opacity: 1; }
.res .nm { font-size: 11px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pager { text-align: center; margin-top: 12px; }

/* 画像が無いカードの代わり */
.fb { --fa: #dc8d4c; --fb: #ad4f1b; background: linear-gradient(160deg, var(--fa), var(--fb)); border-radius: 4px; padding: 6%; display: flex; flex-direction: column; gap: 4%; color: #111; overflow: hidden; container-type: inline-size; }
.fb .fb-name { background: #ffffffcc; border-radius: 2px; font-weight: 900; font-family: var(--serif); font-size: 9cqw; padding: 2% 4%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fb .fb-art { flex: 1; background: radial-gradient(circle at 50% 40%, #ffffff55, #0004); border: 2px solid #0003; display: grid; place-items: center; font-size: 8cqw; color: #fff; text-shadow: 0 1px 2px #000; text-align: center; padding: 4%; }
.fb .fb-text { background: #f5eedbee; border-radius: 2px; font-size: 6cqw; line-height: 1.3; padding: 3% 4%; max-height: 32%; overflow: hidden; }
.fb.dark { color: #111; }

.detail { width: min(760px, 94vw); max-height: 92vh; border: 1px solid #ffffff2a; border-radius: 16px; background: #1a1530; color: var(--ink); padding: 16px; box-shadow: 0 20px 60px #000c; }
.detail::backdrop { background: #000a; backdrop-filter: blur(3px); }
.detail[open] { animation: pop-in .35s cubic-bezier(.2, 1.3, .4, 1); }
.detail-close { position: absolute; right: 10px; top: 10px; margin: 0; }
.detail-body { display: grid; grid-template-columns: minmax(160px, 260px) 1fr; gap: 16px; margin-bottom: 12px; }
@media (max-width: 600px) { .detail-body { grid-template-columns: 1fr; } .detail-body .big { max-width: 220px; margin: 0 auto; } }
.detail-body .big { width: 100%; aspect-ratio: 59 / 86; }
.detail-body .big img { width: 100%; height: 100%; object-fit: contain; border-radius: 6px; }
.detail-body h3 { margin: 0 0 2px; font-family: var(--serif); font-size: 20px; padding-right: 36px; }
.detail-body .en { color: var(--muted); font-size: 13px; margin: 0 0 8px; }
.detail-body .tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 8px; }
.detail-body .tags span { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #ffffff14; border: 1px solid #ffffff22; }
.detail-body .txt { white-space: pre-wrap; font-size: 14px; line-height: 1.6; background: #0f0c1a; border-radius: 10px; padding: 10px 12px; max-height: 40vh; overflow: auto; }
.detail-body .txt b { color: #9be8d6; font-weight: 700; }
.btn.primary.inline { width: auto; margin: 0; }
.center { text-align: center; }
.row.center { justify-content: center; }
.actions { margin-top: 12px; }
.big .fb, .res .thumb .fb { width: 100%; height: 100%; }

/* ---- ドラッグ＆ドロップ（drag9.js） ---- */
.drag-ghost { position: fixed; z-index: 9999; pointer-events: none; transform-origin: 0 0; will-change: transform; transition: filter .2s, opacity .2s; }
.drag-ghost > * { width: 100% !important; height: 100% !important; margin: 0 !important; transition: transform .22s cubic-bezier(.2, 1.5, .4, 1), box-shadow .22s; border-radius: 6px; }
.drag-ghost > img, .drag-ghost > .fb { object-fit: cover; display: block; }
.drag-ghost.lift > * { transform: scale(1.12); box-shadow: 0 22px 40px #000c, 0 0 0 2px #ffcc4daa, 0 0 26px #ffcc4d66; }
.drag-ghost.will-remove { opacity: .55; filter: grayscale(.7) brightness(.8); }
.drag-ghost.will-return > * { box-shadow: 0 14px 30px #000a, 0 0 0 2px #ffffff55; }
.drag-ghost.settle { transition: transform .26s cubic-bezier(.25, 1.35, .45, 1), opacity .26s; }
.drag-ghost.settle > * { transform: none; box-shadow: 0 6px 16px #0008; }
.drag-ghost.gone { opacity: 0; }
.drag-src { opacity: .28; filter: saturate(.3); transition: opacity .15s; }
.dragging .cell { transition: transform .18s cubic-bezier(.2, 1.4, .4, 1), box-shadow .18s, border-color .18s; }
.dragging .cell:not(.drag-src) { animation: drop-breathe 1.2s ease-in-out infinite; }
.cell.drop-hot { transform: scale(1.07) !important; border-color: var(--accent, #ffcc4d) !important; border-style: solid !important; box-shadow: 0 0 0 3px #ffcc4d77, 0 0 28px #ffcc4daa !important; animation: none !important; z-index: 2; }
.cell.snapped { animation: drop-snap .5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes drop-breathe { 50% { box-shadow: 0 0 0 2px #ffffff22, 0 0 14px #ffcc4d33; } }
@keyframes drop-snap { 0% { transform: scale(.86) rotate(-3deg); } 55% { transform: scale(1.08) rotate(1deg); } 100% { transform: none; } }
html.is-dragging, html.is-dragging * { cursor: grabbing !important; user-select: none !important; -webkit-user-select: none !important; }
@media (prefers-reduced-motion: reduce) { .drag-ghost, .drag-ghost > *, .cell.snapped, .dragging .cell { transition: none !important; animation: none !important; } }
.cell.filled { touch-action: pan-y; -webkit-touch-callout: none; cursor: grab; }
.res { -webkit-touch-callout: none; }
.res img, .cell img { -webkit-user-drag: none; user-select: none; }
