/* 車椅子 検索 — 「明るい療育室の掲示板」
   設計: design-spec-v2（Fable）。クリーム紙・白い丸カード・製品写真が主役・装飾は黄のにこにこ丸だけ */

:root {
  --bg: #FCF4E8; --paper: #FFFDF9; --well: #F4ECDF; --line: #ECE4D4;
  --ink: #2F3A2C; --sub: #6F786A;
  --blue: #3845AD; --blue-soft: #E5E8F8; --on-blue: #fff;
  --red: #D8401F; --red-soft: #FDE3DD; --on-red: #fff;
  --green: #2E7D5B; --green-soft: #DFF1E7;
  --pink: #B2443F; --pink-soft: #FBE1E0;
  --yellow: #FFCD64;
  --radius: 18px; --radius-s: 12px; --pill: 999px;
  --shadow: 0 6px 18px rgba(47, 58, 44, .06);
  --shadow-hover: 0 12px 26px rgba(47, 58, 44, .12);
  --backdrop: rgba(47, 58, 44, .4);
  --focus: #3845AD;
  --font-head: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", sans-serif;
  --font-body: "BIZ UDPGothic", "Hiragino Sans", "Yu Gothic", sans-serif;
  --tap: 44px; --ease: cubic-bezier(.2, .7, .2, 1);
  --gutter: 24px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #201F1B; --paper: #2A2925; --well: #34322D; --line: #413F39;
    --ink: #F1ECE2; --sub: #B1AB9F;
    --blue: #9EA7F4; --blue-soft: #2F3352; --on-blue: #201F1B;
    --red: #F28E7A; --red-soft: #4A2620; --on-red: #201F1B;
    --green: #86CFA9; --green-soft: #1F3A2E;
    --pink: #F0A3A0; --pink-soft: #4A2A2A;
    --yellow: #E9B94F;
    --shadow: 0 6px 18px rgba(0, 0, 0, .35); --shadow-hover: 0 12px 26px rgba(0, 0, 0, .5);
    --backdrop: rgba(0, 0, 0, .6); --focus: #9EA7F4;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #201F1B; --paper: #2A2925; --well: #34322D; --line: #413F39;
  --ink: #F1ECE2; --sub: #B1AB9F;
  --blue: #9EA7F4; --blue-soft: #2F3352; --on-blue: #201F1B;
  --red: #F28E7A; --red-soft: #4A2620; --on-red: #201F1B;
  --green: #86CFA9; --green-soft: #1F3A2E;
  --pink: #F0A3A0; --pink-soft: #4A2A2A;
  --yellow: #E9B94F;
  --shadow: 0 6px 18px rgba(0, 0, 0, .35); --shadow-hover: 0 12px 26px rgba(0, 0, 0, .5);
  --backdrop: rgba(0, 0, 0, .6); --focus: #9EA7F4;
  color-scheme: dark;
}

/* ---------- 基礎 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.7 var(--font-body); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
body.is-modal { overflow: hidden; }
h1, h2, h3, h4, .btn, .chip, .tag, .switch, label, legend, .label { font-family: var(--font-head); font-weight: 700; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
a { color: var(--blue); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sprite { display: none; }
.wrap { width: 100%; max-width: calc(1160px + var(--gutter) * 2); margin: 0 auto; padding-inline: var(--gutter); }
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--paper); padding: 8px 12px; border-radius: var(--radius-s); }
.skip:focus { left: 8px; }
[hidden] { display: none !important; }

/* 表示の切り替え: 編集中だけ／ログイン前だけ／PT意見を出すときだけ */
.editor-only { display: none !important; }
body.is-editor .editor-only { display: revert !important; }
body.is-editor .login-only { display: none !important; }
body.pt-hidden .pt-only { display: none !important; }

/* ---------- 部品 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); padding: 0 20px; border-radius: var(--pill);
  border: 2px solid var(--blue); color: var(--blue); background: transparent;
  font-size: 15px; line-height: 1.2; text-decoration: none; white-space: nowrap;
  transition: background-color .15s var(--ease), transform .15s var(--ease);
}
.btn:hover { background: var(--blue-soft); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--blue); color: var(--on-blue); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--red); border-color: var(--red); color: var(--on-red); }
.btn.text { border: 0; padding: 0 10px; color: var(--sub); background: none; }
.btn.text:hover { color: var(--ink); background: var(--well); }
.btn.danger-text { color: var(--red); }
.btn[disabled] { opacity: .6; cursor: default; }
.iconbtn {
  display: inline-grid; place-items: center; flex: none; width: var(--tap); height: var(--tap);
  border: 0; border-radius: 50%; background: var(--well); color: var(--ink);
}
.iconbtn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.iconbtn:hover { filter: brightness(.96); }
.round {
  width: var(--tap); height: var(--tap); border-radius: 50%; border: 0; background: var(--well); color: var(--ink);
  font: 700 22px/1 var(--font-head); display: inline-grid; place-items: center;
}
.tag { display: inline-block; padding: 3px 10px; border-radius: var(--pill); background: var(--well); color: var(--ink); font-size: 12px; line-height: 1.5; }
.tag.active { background: var(--blue-soft); color: var(--blue); }
.tag.opinion { background: var(--yellow); color: #2F3A2C; }
.tag--editing { border: 0; background: var(--yellow); color: #2F3A2C; font-size: 14px; padding: 8px 14px; min-height: 36px; }
.error { margin: 6px 0 0; font-size: 13px; color: var(--red); }
.hint { margin: 6px 0 0; font-size: 13px; color: var(--sub); }
.req { font-size: 12px; color: var(--red); margin-left: 4px; }
.muted { color: var(--sub); margin: 0; }
.face-lg { width: 64px; height: 64px; }
.face-md { width: 56px; height: 56px; opacity: .55; }

/* ---------- ヘッダー ---------- */
.site-head { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; min-height: 72px; padding-block: 18px 12px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand__face { width: 36px; height: 36px; flex: none; }
.brand__name { margin: 0; font-size: 28px; line-height: 1.2; letter-spacing: .08em; }
.brand__sub { margin: 0; font-size: 13px; color: var(--sub); }
.head-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.switch { display: inline-flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 0 6px 0 14px; border: 0; border-radius: var(--pill); background: var(--paper); box-shadow: var(--shadow); font-size: 14px; }
.switch__track { position: relative; width: 46px; height: 28px; border-radius: var(--pill); background: var(--well); transition: background-color .15s var(--ease); }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .18s var(--ease); }
.switch[aria-checked="true"] .switch__track { background: var(--blue); }
.switch[aria-checked="true"] .switch__track::after { transform: translateX(18px); }

.status { margin-bottom: 12px; }
.status__in { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 12px 16px; border-radius: var(--radius-s); background: var(--red-soft); color: var(--ink); font-size: 14px; }

/* ---------- 絞り込み ---------- */
.filter-wrap { position: sticky; top: 8px; z-index: 5; }
.panel { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.panel__top { display: flex; gap: 8px; align-items: center; flex: 1 1 100%; }
.panel__top .search { max-width: 460px; }
.search { position: relative; flex: 1; }
.search svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: none; stroke: var(--sub); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.search input { width: 100%; min-height: var(--tap); padding: 0 14px 0 40px; border: 0; border-radius: var(--radius-s); background: var(--well); font-size: 16px; -webkit-appearance: none; appearance: none; }
.search input:focus { outline: 2px solid var(--blue); outline-offset: 0; }
.search input::placeholder { color: var(--sub); }
.reset { order: 3; }
.panel__top .reset { order: 0; }
.reset.is-off { opacity: .4; pointer-events: none; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; flex: 1 1 520px; }
.chip { min-height: 40px; padding: 0 16px; border: 0; border-radius: var(--pill); background: var(--well); color: var(--ink); font-size: 15px; transition: background-color .15s var(--ease), color .15s var(--ease); }
.chip:hover { filter: brightness(.97); }
.chip[aria-checked="true"] { background: var(--blue); color: var(--on-blue); }
.chip--opinion[aria-checked="true"] { background: var(--yellow); color: #2F3A2C; }
.countbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 4px 0; background: linear-gradient(var(--bg) 70%, transparent); }
.count { margin: 0; font-family: var(--font-head); font-weight: 700; font-size: 15px; }
.count strong { font-size: 24px; color: var(--blue); margin-right: 2px; }
.sort select {
  min-height: 40px; padding: 0 36px 0 14px; border: 0; border-radius: var(--pill); background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236F786A' stroke-width='1.8'/%3E%3C/svg%3E") no-repeat right 14px center / 12px 8px;
  box-shadow: var(--shadow); font-family: var(--font-head); font-weight: 700; font-size: 14px; -webkit-appearance: none; appearance: none;
}

/* ---------- カード ---------- */
main.wrap { padding-block: 16px 48px; }
.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.card {
  display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 12px 12px 16px;
  background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); color: inherit; text-decoration: none;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
@media (hover: hover) { .card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); } }
.card.is-new { outline: 3px solid var(--yellow); outline-offset: 2px; }
.card__img { position: relative; margin: 0 0 8px; aspect-ratio: 1; background: #fff; border-radius: var(--radius-s); overflow: hidden; }
.card__img img { width: 100%; height: 100%; object-fit: contain; }
.card__img .tag { position: absolute; top: 8px; left: 8px; }
.card__img--page img { padding: 8%; }
.card__noimg { height: 100%; display: grid; place-content: center; justify-items: center; gap: 6px; font-size: 13px; color: #6F786A; }
.card__name { margin: 0; font-size: 17px; line-height: 1.35; overflow-wrap: anywhere; }
.card__maker { margin: 0; font-size: 13px; color: var(--sub); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 6px 0 0; padding: 0; }
.skel { background: var(--well); border-radius: var(--radius-s); animation: pulse 1.2s ease-in-out infinite alternate; }
@keyframes pulse { to { opacity: .5; } }

.empty { text-align: center; padding: 56px 16px; color: var(--sub); display: grid; justify-items: center; gap: 12px; }
.empty p { margin: 0; font-family: var(--font-head); font-weight: 700; font-size: 17px; }
.site-foot { padding-block: 8px 32px; font-size: 12px; color: var(--sub); }
.site-foot p { margin: 0; }

/* ---------- 詳細 ---------- */
.detail {
  border: 0; padding: 0; width: min(960px, calc(100vw - 48px)); max-width: none; height: 90vh; max-height: 90vh;
  border-radius: var(--radius); background: var(--paper); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
.detail[open] { animation: rise .22s var(--ease); }
.detail::backdrop { background: var(--backdrop); }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } }
.detail__scroll { height: 100%; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.d-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; gap: 14px; padding: 16px 20px; background: var(--paper); border-bottom: 1px solid var(--line); }
.d-head__title { flex: 1; min-width: 0; }
.d-head__title h2 { margin: 0; font-size: 24px; line-height: 1.3; overflow-wrap: anywhere; }
.d-head__title p { margin: 0; font-size: 13px; color: var(--sub); }
.d-head__title #dMaker:empty { display: none; }
.d-head__edit { margin-top: 4px !important; display: flex; gap: 4px; }
.d-head__edit .btn { min-height: 36px; font-size: 14px; }
.d-body { padding: 24px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; }
.d-body > * { min-width: 0; }
.d-sec { scroll-margin-top: 100px; }
.d-sec > h3 { display: flex; align-items: baseline; gap: 8px; margin: 0 0 14px; font-size: 18px; line-height: 1.3; }
.d-sec > h3 small { font-size: 14px; color: var(--sub); }
.d-sec__acts { margin-left: auto; }
.d-top { display: grid; grid-template-columns: min(300px, 40%) 1fr; gap: 24px; align-items: start; }
.d-photo { aspect-ratio: 1; background: #fff; border-radius: var(--radius-s); overflow: hidden; border: 1px solid var(--line); }
.d-photo img { width: 100%; height: 100%; object-fit: contain; }
.d-top .tags .tag { font-size: 14px; padding: 6px 14px; }
.d-spec { margin: 16px 0 0; display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.d-spec dt { font-size: 13px; color: var(--sub); padding-top: 2px; }
.d-spec dd { margin: 0; }

.notes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.note { padding: 16px 18px; border-radius: var(--radius-s); line-height: 1.8; }
.note--merit { background: var(--green-soft); }
.note--demerit { background: var(--pink-soft); }
.note h4 { margin: 0 0 4px; font-size: 16px; }
.note--merit h4 { color: var(--green); }
.note--demerit h4 { color: var(--pink); }
.note ul { margin: 0; padding-left: 1.2em; }
.note p { margin: 0; color: var(--sub); }
.nothing { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px 18px; border: 2px dashed var(--line); border-radius: var(--radius-s); color: var(--sub); }
.nothing svg { width: 40px; height: 40px; flex: none; }
.nothing p { margin: 0; flex: 1; }

/* カタログ */
.doc-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.doc-tabs .chip { min-height: 36px; font-size: 14px; }
.cat__stage { height: min(70vh, 720px); background: var(--well); border-radius: var(--radius-s); display: grid; place-items: center; padding: 12px; cursor: zoom-in; touch-action: pan-y; }
.cat__stage img { max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; border-radius: 4px; box-shadow: 0 2px 10px rgba(0, 0, 0, .1); transition: opacity .15s var(--ease); }
.cat__stage img.is-loading { opacity: .35; }
.cat__nav { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.cat__counter { font-family: var(--font-head); font-weight: 700; min-width: 4.5em; text-align: center; }
.cat__nav .spacer { flex: 1; }
.thumbs { display: flex; gap: 8px; overflow-x: auto; list-style: none; margin: 12px 0 0; padding: 2px 2px 6px; scroll-snap-type: x proximity; }
.thumbs li { flex: none; scroll-snap-align: start; }
.thumbs button { position: relative; display: block; width: 72px; padding: 0; border: 3px solid transparent; border-radius: 8px; background: #fff; overflow: hidden; }
.thumbs button[aria-current="true"] { border-color: var(--blue); }
.thumbs span { position: absolute; right: 2px; bottom: 2px; padding: 0 5px; border-radius: 6px; background: rgba(255, 255, 255, .9); color: #2F3A2C; font: 700 11px/1.5 var(--font-head); }

/* 作製事例 */
.cases { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.case { position: relative; background: var(--bg); border-radius: var(--radius-s); overflow: hidden; }
.case__img { display: block; width: 100%; aspect-ratio: 1; padding: 0; border: 0; background: #fff; cursor: zoom-in; position: relative; }
.case__img img { width: 100%; height: 100%; object-fit: cover; }
.case__count { position: absolute; right: 8px; bottom: 8px; }
.case__text { padding: 10px 14px 12px; }
.case__point { margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.case__point.is-open { -webkit-line-clamp: unset; }
.case__meta { margin: 4px 0 0; font-size: 13px; color: var(--sub); }
.case__edit { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; }
.case__edit .btn { min-height: 32px; padding: 0 10px; font-size: 13px; background: var(--paper); box-shadow: var(--shadow); }

/* ---------- 拡大表示 ---------- */
.lightbox { border: 0; padding: 0; margin: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; background: #151714; color: #F1ECE2; display: none; grid-template-rows: auto 1fr auto auto; }
.lightbox[open] { display: grid; }
.lightbox::backdrop { background: #151714; }
.lightbox__bar { display: flex; align-items: center; gap: 12px; padding: max(8px, env(safe-area-inset-top)) 10px 8px 18px; }
.lightbox__title { margin: 0; flex: 1; min-width: 0; font: 700 15px var(--font-head); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox__counter { font: 700 15px var(--font-head); color: #B1AB9F; }
.iconbtn.light, .round.light { background: rgba(255, 255, 255, .1); color: #F1ECE2; }
.btn.ghost-light { border-color: rgba(255, 255, 255, .35); color: #F1ECE2; }
.btn.ghost-light:hover { background: rgba(255, 255, 255, .08); }
.lightbox__stage { overflow: auto; display: grid; place-items: center; touch-action: pan-x pan-y pinch-zoom; }
.lightbox__stage img { max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; cursor: zoom-in; transition: opacity .15s var(--ease); }
.lightbox__stage img.is-loading { opacity: .4; }
.lightbox__stage.is-zoomed { place-items: start; }
.lightbox__stage.is-zoomed img { max-width: none; max-height: none; width: 200%; cursor: zoom-out; }
.lightbox__nav { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 10px; }
.lightbox__caption { margin: 0; padding: 0 18px max(12px, env(safe-area-inset-bottom)); text-align: center; font-size: 13px; color: #B1AB9F; }
.lightbox__caption:empty { display: none; }

/* ---------- 小さなダイアログ（ログイン・削除確認） ---------- */
.small-dlg { border: 0; padding: 24px; width: min(380px, calc(100vw - 32px)); border-radius: var(--radius); background: var(--paper); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.small-dlg::backdrop { background: var(--backdrop); }
.small-dlg h2 { margin: 0 0 6px; font-size: 20px; }
.small-dlg p { margin: 0 0 14px; }
.small-dlg input { width: 100%; min-height: 48px; padding: 0 14px; border: 0; border-radius: var(--radius-s); background: var(--well); font-size: 18px; letter-spacing: .08em; }
.small-dlg input:focus { outline: 2px solid var(--blue); }
.small-dlg input.is-invalid { outline: 2px solid var(--red); }
.small-dlg__acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ---------- 編集シート ---------- */
.sheet {
  border: 0; padding: 0; margin: 0 0 0 auto; width: min(560px, 100vw); height: 100dvh; max-height: 100dvh; max-width: none;
  background: var(--paper); color: var(--ink); border-radius: var(--radius) 0 0 var(--radius); box-shadow: -12px 0 40px rgba(0, 0, 0, .18);
}
.sheet[open] { animation: slide .22s var(--ease); }
@keyframes slide { from { opacity: 0; transform: translateX(24px); } }
.sheet::backdrop { background: var(--backdrop); }
.sheet-form { display: flex; flex-direction: column; height: 100%; }
.sheet-head, .sheet-foot { display: flex; align-items: center; gap: 8px; padding: 14px 20px; background: var(--paper); }
.sheet-head { border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0; flex: 1; font-size: 20px; line-height: 1.3; overflow-wrap: anywhere; }
.sheet-foot { border-top: 1px solid var(--line); padding-bottom: max(14px, env(safe-area-inset-bottom)); }
.sheet-foot .save { width: 100%; min-height: 52px; font-size: 17px; }
.sheet-body { flex: 1; overflow: auto; padding: 20px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-content: start; overscroll-behavior: contain; }
.field { margin: 0; padding: 0; border: 0; min-width: 0; }
.field > label, .field legend, .field .label { display: block; margin-bottom: 6px; padding: 0; font-size: 15px; }
.field input:not([type="checkbox"]):not([type="file"]), .field textarea, .field select {
  width: 100%; min-height: 48px; padding: 10px 14px; border: 0; border-radius: var(--radius-s); background: var(--well); font-size: 16px;
}
.field textarea { line-height: 1.7; resize: vertical; }
.field :is(input, textarea, select):focus { outline: 2px solid var(--blue); outline-offset: 0; }
.field.invalid input { outline: 2px solid var(--red); }
.photo { display: flex; gap: 16px; align-items: center; }
.photo-preview { position: relative; width: 160px; height: 160px; flex: none; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-s); display: grid; place-items: center; overflow: hidden; }
.photo-preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: none; }
.photo-preview.has-photo img { display: block; }
.photo-preview.has-photo svg { display: none; }
.flag-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.flag-picker .tag { position: relative; font-size: 15px; padding: 9px 16px; cursor: pointer; user-select: none; -webkit-user-select: none; }
.flag-picker .tag:has(:checked) { background: var(--blue); color: var(--on-blue); }
.flag-picker .tag:has(:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.flag-picker input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.case-previews { list-style: none; margin: 0 0 10px; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.case-previews:empty { display: none; }
.case-previews li { position: relative; width: 96px; height: 96px; border-radius: var(--radius-s); overflow: hidden; background: #fff; border: 1px solid var(--line); }
.case-previews img { width: 100%; height: 100%; object-fit: cover; }
.case-previews button { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .6); color: #fff; font-size: 16px; line-height: 1; }
.save-error { margin: 0; padding: 10px 20px; background: var(--red-soft); color: var(--ink); font-size: 14px; display: flex; align-items: center; gap: 8px; }
.save-error span { flex: 1; }
.save[aria-busy="true"]::before { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 100; display: flex; align-items: center; gap: 8px; padding: 12px 20px; background: var(--paper); border-radius: var(--pill); box-shadow: var(--shadow-hover); font: 700 15px var(--font-head); animation: rise .2s var(--ease); }
.toast svg { width: 22px; height: 22px; }
.toast[data-kind="error"] { background: var(--red-soft); }
.toast[data-kind="error"] svg { display: none; }

/* ---------- 幅ごとの調整 ---------- */
@media (max-width: 1199px) { :root { --gutter: 20px; } }
@media (max-width: 1023px) {
  :root { --gutter: 16px; }
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .panel__top { flex-basis: 100%; }
  .chips { flex-basis: 100%; }
  .detail { width: 100vw; height: 96dvh; max-height: 96dvh; margin: auto 0 0; border-radius: var(--radius) var(--radius) 0 0; }
  .detail::before { content: ""; position: absolute; z-index: 3; top: 6px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--line); }
  .sheet { width: 100vw; border-radius: 0; }
  .cases { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .card { padding: 8px 8px 12px; }
  .card__name { font-size: 15px; }
  .tags .tag { font-size: 11px; padding: 2px 8px; }
  .brand__name { font-size: 24px; }
  .head-tools { width: 100%; }
  .head-tools #addItem { margin-left: auto; }
  .filter-wrap { position: static; }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin-inline: -16px; padding: 2px 16px; scroll-padding-inline: 16px; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
  .d-head { padding: 18px 14px 12px; flex-wrap: wrap; }
  .d-head #dSite { order: 3; width: 100%; }
  .d-body { padding: 18px 16px 32px; }
  .d-top { grid-template-columns: 1fr; }
  .d-photo { max-width: 320px; }
  .notes { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .cat__stage { height: 56vh; }
  .toast { left: 16px; right: 16px; bottom: 16px; justify-content: center; }
  .photo { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
