/* ウェブ版（案 A：iPhone をそのまま広げる）。色と大きさは iPhone の壁（MasonryWall.swift・HomeView.swift）に合わせる。
   背景は iPhone と同じ6色（2026-11-20 ユーザー「A・アで作って」）：はじめの黒がここ。白・さくら・ふじ・そらは下の :root[data-bg] で入れかえる
   （data-bg は app.js が付ける。サインインの画面は付けないので、いつも黒）。色の値は iPhone の app/Shared/Theme.swift と同じ */
:root {
  --bg: #111111;
  --fg: #ffffff;
  /* 字と線の色（rgb の3つ）。薄い字や線は rgb(var(--ink) / 0.5) のように書く */
  --ink: 255 255 255;
  --title: rgb(var(--ink) / 0.88);
  --dim: rgb(var(--ink) / 0.45);
  --card: rgba(255, 255, 255, 0.09);
  --pill: rgba(255, 255, 255, 0.1);
  --pill-hover: rgba(255, 255, 255, 0.16);
  --pill-focus: rgba(255, 255, 255, 0.14);
  /* サムネを待つ間・入力欄・読みこみ中の箱 */
  --soft: rgba(255, 255, 255, 0.08);
  /* メニューの行にのせたとき */
  --hover: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.08);
  /* メニュー・小窓・名前を打つ画面の地 */
  --sheet: #1e1e20;
  --shadow: rgba(0, 0, 0, 0.5);
  --backdrop: rgba(0, 0, 0, 0.6);
  /* 字の色のボタン（選んだピル・閉じる）の上の字 */
  --inv: #000000;
  --logo: #ffffff;
  --cur: #7fb4ff;
  --achip-bg: rgba(127, 180, 255, 0.18);
  --achip-fg: #cfe2ff;
  --danger: #ff9b8a;
  /* 選んでいる間の帯・知らせ（黒の背景では白い板。明るい背景では iPhone と同じく暗いピル） */
  --float-line: transparent;
  --toast-bg: #ffffff;
  --toast-fg: #000000;
  --toast-link: #2a62c9;
  --toast-hover: rgba(0, 0, 0, 0.06);
  --cancel-icon: invert(1) opacity(0.5);
  --focus: #7fb4ff;
  --pad: 28px;
  --sans: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif;
  color-scheme: dark;
}
/* 明るい背景（白・さくら・ふじ・そら）に共通 */
:root[data-bg] {
  --dim: rgb(var(--ink) / 0.5);
  --inv: #ffffff;
  --cur: #2a62c9;
  --achip-bg: rgba(42, 98, 201, 0.1);
  --achip-fg: #2456b8;
  --danger: #b2402f;
  --float-line: rgb(var(--ink) / 0.08);
  --toast-bg: #1c1c1e;
  --toast-fg: #ffffff;
  --toast-link: #7fb4ff;
  --toast-hover: rgba(255, 255, 255, 0.1);
  --cancel-icon: opacity(0.5);
  color-scheme: light;
}
/* 白：面は黒をうすく重ねる（iPhone の fillColor と同じ 0.55 倍） */
:root[data-bg="white"] {
  --bg: #ffffff; --fg: #16161a; --ink: 22 22 26; --logo: #33333a;
  --card: rgba(0, 0, 0, 0.05); --pill: rgba(0, 0, 0, 0.055); --pill-hover: rgba(0, 0, 0, 0.09); --pill-focus: rgba(0, 0, 0, 0.075);
  --soft: rgba(0, 0, 0, 0.045); --hover: rgba(0, 0, 0, 0.05); --line: rgba(0, 0, 0, 0.08);
  --sheet: #f5f5f7; --shadow: rgba(0, 0, 0, 0.14); --backdrop: rgba(0, 0, 0, 0.3);
}
/* さくら・ふじ・そら：面は白（色のついた地に黒を重ねると、くすんだ灰色に見えた：iPhone と同じ）。字・影は地の色に寄せる */
:root[data-bg="sakura"], :root[data-bg="fuji"], :root[data-bg="sora"] {
  --card: rgba(255, 255, 255, 0.89); --pill: rgba(255, 255, 255, 0.92); --pill-hover: #ffffff; --pill-focus: #ffffff;
  --soft: rgba(255, 255, 255, 0.7);
}
:root[data-bg="sakura"] {
  --bg: #fbe4ea; --fg: #2a1f26; --ink: 42 31 38; --logo: #3b2b36;
  --hover: rgba(59, 43, 54, 0.06); --line: rgba(59, 43, 54, 0.1);
  --sheet: #fff3f6; --shadow: rgba(115, 51, 77, 0.18); --backdrop: rgba(59, 43, 54, 0.28);
}
:root[data-bg="fuji"] {
  --bg: #eae3f9; --fg: #252036; --ink: 37 32 54; --logo: #3a3252;
  --hover: rgba(58, 50, 82, 0.06); --line: rgba(58, 50, 82, 0.1);
  --sheet: #f5f1fe; --shadow: rgba(77, 56, 128, 0.18); --backdrop: rgba(58, 50, 82, 0.28);
}
:root[data-bg="sora"] {
  --bg: #dfedf9; --fg: #1d2836; --ink: 29 40 54; --logo: #2a3a52;
  --hover: rgba(42, 58, 82, 0.06); --line: rgba(42, 58, 82, 0.1);
  --sheet: #f2f8fe; --shadow: rgba(38, 77, 128, 0.18); --backdrop: rgba(42, 58, 82, 0.28);
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--sans); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

/* 画面の切りかえ（body の data-screen） */
.signin, .errorbox, .app { display: none; }
body[data-screen="signin"] .signin { display: grid; }
body[data-screen="error"] .errorbox { display: flex; }
body[data-screen="wall"] .app { display: block; }

/* ---- サインイン ---- */
.signin { min-height: 100vh; min-height: 100dvh; place-items: center; position: relative; overflow: hidden; padding: 24px max(16px, env(safe-area-inset-left)); }
/* うしろにうっすら見せる壁（飾り）：保存したリンクの壁と同じ角丸のカード。壁は画面より下まで伸ばし（列の下がそろわないのを見せない）、
   まんなかだけ上から少し暗くして、字を読みやすくする */
.tiles { position: absolute; top: 10px; left: -16px; right: -16px; display: flex; gap: 10px; opacity: 0.5; pointer-events: none; z-index: 0; }
/* 列は7つに決める。広い画面では列が太くなり、画像が大きくなる（並ぶ枚数は変わらない）。狭い画面は5列・2列 */
.tcol { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.tcol img { display: block; width: 100%; height: auto; }
/* 保存したリンクの壁と同じカード：左上に出どころ、下に題名（2行まで）とジャンル */
.tcard { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.tth { position: relative; border-radius: 12px; overflow: hidden; background: #222; }
.tbd { position: absolute; left: 8px; top: 8px; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: rgba(0, 0, 0, 0.5); color: #fff; }
.tcard figcaption { display: flex; flex-direction: column; gap: 2px; padding: 0 3px; }
.ttl { font-size: 13px; font-weight: 500; color: var(--title); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tgn { font-size: 11px; font-weight: 600; color: var(--dim); }
@media (max-width: 1099px) { .tcol:nth-child(n+6) { display: none; } }
@media (max-width: 699px) { .tcol:nth-child(n+3) { display: none; } }
.signin::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(ellipse 34% 40% at center, rgba(17, 17, 17, 0.62) 55%, rgba(17, 17, 17, 0) 100%); }
.sbox { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; background: rgba(17, 17, 17, 0.94); border: 1px solid rgba(255, 255, 255, 0.08); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); padding: 40px 48px; border-radius: 24px; max-width: 100%; }
.slogo { height: 40px; width: auto; margin-bottom: 6px; }
.sbox h1 { margin: 0; font-size: 24px; line-height: 1.35; text-wrap: balance; }
.sbox p { margin: 0; color: rgba(255, 255, 255, 0.6); }
.sbox .serr { color: #ff9b8a; font-weight: 600; }
.sbtn { width: 300px; max-width: 100%; height: 48px; border-radius: 99px; font-size: 15px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 10px; }
/* Apple・Google の公式の印（Apple は字と同じ色・Google は4色の G） */
.sbtn .mark { width: 18px; height: 18px; flex: none; }
.sbtn.apple .mark { width: 16px; height: 19px; margin-top: -2px; }
.sbtn.apple { background: #fff; color: #000; margin-top: 8px; }
.sbtn.google { background: var(--pill); color: #fff; }
.sbtn:hover { filter: brightness(0.92); }
.sbtn.google:hover { filter: brightness(1.3); }
.sbox small { color: rgba(255, 255, 255, 0.4); font-size: 12px; margin-top: 6px; }
.sbox small a { color: rgba(255, 255, 255, 0.6); }

/* ---- 読めなかった ---- */
.errorbox { min-height: 100vh; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center; padding: 24px; }
.errorbox button { background: var(--fg); color: var(--inv); font-weight: 700; border-radius: 99px; padding: 10px 24px; }

/* ---- 上の段（ロゴ・さがす・アカウント・タブ） ---- */
.bar { position: sticky; top: 0; z-index: 10; background: var(--bg); transition: box-shadow 0.2s; }
.bar.scrolled { box-shadow: 0 1px 0 var(--line); }
.row { display: flex; align-items: center; gap: 10px; padding: 16px var(--pad) 12px; padding-left: max(var(--pad), env(safe-area-inset-left)); padding-right: max(var(--pad), env(safe-area-inset-right)); }
.brand { flex: none; display: block; }
.brand svg { height: 22px; width: 92px; display: block; }
/* ロゴは地に合わせた色（白系は地の色に寄せた濃い色：iPhone と同じ）。星としおりの間のすきまは地の色で切る */
.brand .lg-ink { fill: var(--logo); }
.brand .lg-cut { fill: var(--bg); stroke: var(--bg); }
.search { flex: 0 1 440px; margin: 0 0 0 auto; display: flex; align-items: center; gap: 10px; background: var(--pill); border-radius: 99px; height: 38px; padding: 0 8px 0 16px; min-width: 0; }
.search:focus-within { background: var(--pill-focus); box-shadow: 0 0 0 1px rgb(var(--ink) / 0.2); }
.search svg { width: 15px; height: 15px; flex: none; fill: none; stroke: rgb(var(--ink) / 0.6); stroke-width: 1.8; stroke-linecap: round; }
.search input { flex: 1; min-width: 0; background: none; border: 0; color: var(--fg); font: inherit; font-size: 14px; outline: none; }
.search input::placeholder { color: var(--dim); }
.search input::-webkit-search-cancel-button { filter: var(--cancel-icon); }
.search kbd { font-family: var(--sans); font-size: 11px; color: rgb(var(--ink) / 0.5); border: 1px solid rgb(var(--ink) / 0.2); border-radius: 5px; padding: 0 6px; }
.search:focus-within kbd { display: none; }
.acct-wrap { position: relative; flex: none; }
.acct { width: 34px; height: 34px; border-radius: 50%; background: var(--pill); display: grid; place-items: center; }
.acct:hover { background: var(--pill-hover); }
.acct svg { width: 16px; height: 16px; fill: rgb(var(--ink) / 0.75); }
.menu { position: absolute; right: 0; top: 44px; width: 280px; background: var(--sheet); border: 1px solid rgb(var(--ink) / 0.1); border-radius: 14px; padding: 8px; box-shadow: 0 12px 32px var(--shadow); display: flex; flex-direction: column; gap: 4px; }
.who { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); }
.who b { font-size: 13px; overflow-wrap: anywhere; }
.who span { font-size: 12px; color: var(--dim); }
.menu-note { margin: 0; padding: 6px 10px 2px; font-size: 12px; color: var(--dim); }
.menu button { text-align: left; padding: 9px 10px; border-radius: 8px; font-weight: 600; }
.menu button:hover { background: var(--hover); }
.bg-row { display: flex; flex-direction: column; gap: 10px; padding: 10px 10px 13px; border-bottom: 1px solid var(--line); }
.bg-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; font-weight: 600; }
.bg-head small { font-size: 11px; font-weight: 500; color: var(--dim); text-align: right; }
.bg-sws { display: flex; gap: 9px; padding: 0 2px; }
.menu .bg-sw { position: relative; flex: none; width: 28px; height: 28px; padding: 0; border-radius: 50%; background: var(--sw); box-shadow: inset 0 0 0 1px rgb(var(--ink) / 0.2); }
.menu .bg-sw:hover { background: var(--sw); }
.bg-sw[aria-checked="true"]::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--fg); }
/* 自動は白と黒を斜めに半分（iPhone と同じ印） */
.bg-auto { --sw: linear-gradient(135deg, #ffffff 50%, #111111 50%); }
.bg-black { --sw: #111111; }
.bg-white { --sw: #ffffff; }
.bg-sakura { --sw: #f5c8d6; }
.bg-fuji { --sw: #d4c7f3; }
.bg-sora { --sw: #bad8f4; }

/* タグで絞る（# つき・枠線だけのピル。選ぶと白い枠と太字：iPhone の TagPill と同じ） */

/* 字のタブ（iPhone と同じ。選んだものに白い下線） */
.tabs { display: flex; gap: 26px; padding: 2px var(--pad) 0; padding-left: max(var(--pad), env(safe-area-inset-left)); padding-right: max(var(--pad), env(safe-area-inset-right)); overflow-x: auto; scrollbar-width: none; transition: opacity 0.2s; }
.tabs::-webkit-scrollbar { display: none; }
.tabs.dim { opacity: 0.35; }
.tab { flex: none; font-size: 16px; font-weight: 700; color: var(--dim); padding-bottom: 7px; border-bottom: 2px solid transparent; margin-bottom: 12px; white-space: nowrap; }
.tab:hover { color: rgb(var(--ink) / 0.8); }
.tab.on { color: var(--fg); border-bottom-color: var(--fg); }

/* ---- 壁 ---- */
.result { margin: 2px 0 14px; padding: 0 var(--pad); color: var(--dim); font-size: 13px; }
.wall { padding: 4px var(--pad) 64px; padding-left: max(var(--pad), env(safe-area-inset-left)); padding-right: max(var(--pad), env(safe-area-inset-right)); }
.columns { display: flex; gap: 12px; align-items: flex-start; }
.col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.card { display: flex; flex-direction: column; gap: 6px; color: inherit; text-decoration: none; border-radius: 12px; transition: transform 0.15s ease, filter 0.15s ease; }
.card:hover { transform: translateY(-2px); filter: brightness(1.1); }
.thumb { position: relative; width: 100%; border-radius: 12px; overflow: hidden; background: var(--soft); }
/* 枠より縦に長い画像は、上をそろえて下を切る（縦に長いスクショは上に題があることが多い） */
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; opacity: 0; transition: opacity 0.25s ease-out; }
.thumb img.loaded { opacity: 1; }
.badge { position: absolute; left: 8px; top: 8px; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: rgba(0, 0, 0, 0.5); color: #fff; }
.card .title { font-size: 13px; font-weight: 500; color: var(--title); padding: 0 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .genre { font-size: 11px; font-weight: 600; color: var(--dim); padding: 0 3px; margin-top: -3px; }
.card.text { background: var(--card); padding: 14px; gap: 10px; }
.card.text .src { font-size: 11px; font-weight: 600; color: rgb(var(--ink) / 0.5); }
.card.text .big { font-size: 15px; font-weight: 700; color: var(--fg); display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.card.text .foot { font-size: 11px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { display: flex; flex-direction: column; gap: 10px; align-items: center; text-align: center; padding: 18vh 16px; }
.empty b { font-size: 15px; }
.empty span { font-size: 13px; color: var(--dim); }
.ghost { border-radius: 12px; background: var(--soft); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { background: var(--pill); } }

/* 狭い窓・スマホ */
@media (max-width: 640px) {
  :root { --pad: 12px; }
  .row { gap: 12px; }
  .search kbd { display: none; }
  /* ボタンが右寄りなので、狭い画面では画面の幅いっぱいに出す（左がはみ出さないように） */
  .tabs { gap: 20px; }
  .columns { gap: 6px; }
  .col { gap: 10px; }
  .sbox { padding: 32px 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .card, .thumb img, .bar, .tabs { transition: none; }
  .card:hover { transform: none; }
  .ghost { animation: none; }
}


/* ---- 整理（案 B：2026-11-17）：絞りこみの小窓・タブの下の札・選んでまとめて・「…」・整える ---- */
.filter-wrap { position: relative; flex: none; }
.filter-btn, .select-btn { display: flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px 0 12px; border-radius: 99px; background: var(--pill); font-size: 13px; font-weight: 700; color: rgb(var(--ink) / 0.85); flex: none; }
.filter-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.filter-btn:hover, .select-btn:hover { background: var(--pill-hover); }
.filter-btn.on, .select-btn.on { background: var(--fg); color: var(--inv); }
.filter-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--focus); color: #000; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.select-btn { padding: 0 14px; margin-right: auto; }
.brand { margin-right: 14px; }
.filter-pop { position: absolute; right: 0; top: 46px; width: 400px; max-width: calc(100vw - 24px); max-height: min(70vh, 560px); overflow-y: auto; background: var(--sheet); border: 1px solid rgb(var(--ink) / 0.12); border-radius: 16px; padding: 16px; box-shadow: 0 18px 44px var(--shadow); display: flex; flex-direction: column; gap: 14px; z-index: 30; }
.filter-pop h3 { margin: 0 0 8px; font-size: 11px; font-weight: 800; color: var(--dim); letter-spacing: 0.06em; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12.5px; font-weight: 600; padding: 6px 12px; border-radius: 99px; background: var(--pill); color: rgb(var(--ink) / 0.85); }
.chip:hover { background: var(--pill-hover); }
.chip.on { background: var(--fg); color: var(--inv); }
.chip.tag.on { background: var(--focus); color: #000; }
.chip.add { background: none; border: 1px dashed rgb(var(--ink) / 0.35); color: rgb(var(--ink) / 0.75); }
.pop-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--dim); font-size: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.pop-foot > span:last-child { display: flex; gap: 10px; align-items: center; }
.link-btn { font-size: 12.5px; font-weight: 600; color: rgb(var(--ink) / 0.7); padding: 4px 6px; border-radius: 6px; }
.link-btn:hover { color: var(--fg); background: var(--hover); }
.link-btn.danger { color: var(--danger); }
.done-btn { background: var(--fg); color: var(--inv); border-radius: 99px; padding: 7px 18px; font-weight: 800; font-size: 13px; }
.active-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; padding: 0 var(--pad); }
.achip { display: flex; align-items: center; gap: 4px; background: var(--achip-bg); color: var(--achip-fg); border-radius: 99px; padding: 4px 6px 4px 12px; font-size: 12.5px; font-weight: 700; }
.achip-x { color: var(--achip-fg); font-size: 12px; width: 20px; height: 20px; border-radius: 50%; }
.achip-x:hover { background: var(--hover); }
.tab-add { flex: none; width: 40px; height: 26px; border-radius: 99px; border: 1px dashed rgb(var(--ink) / 0.35); color: rgb(var(--ink) / 0.7); font-size: 15px; margin-bottom: 12px; }
.tab-tidy { flex: none; font-size: 12.5px; font-weight: 700; color: var(--dim); margin: 0 0 14px auto; padding: 4px 8px; border-radius: 8px; }
.tab-add:hover, .tab-tidy:hover { color: var(--fg); border-color: rgb(var(--ink) / 0.6); }

/* カードの選ぶ丸と「…」 */
.card { position: relative; }
.card .chk, .card .more { position: absolute; top: 8px; width: 28px; height: 28px; border-radius: 50%; display: none; place-items: center; z-index: 2; }
.card .chk { left: 8px; border: 2px solid rgba(255, 255, 255, 0.9); background: rgba(0, 0, 0, 0.4); }
.card .chk svg { width: 14px; height: 14px; fill: none; stroke: #000; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; visibility: hidden; }
.card .more { right: 8px; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 15px; font-weight: 800; letter-spacing: 1px; }
.card:hover .chk, .card:hover .more, .card:focus-within .chk, .card:focus-within .more, body.selecting .card .chk { display: grid; }
.card:hover .badge, .card:focus-within .badge, body.selecting .card .badge { left: 42px; }
.card.text:hover .src, body.selecting .card.text .src { margin-left: 30px; }
.card.sel .chk { background: var(--focus); border-color: var(--focus); }
.card.sel .chk svg { visibility: visible; }
.card.sel .thumb, .card.sel.text { box-shadow: 0 0 0 3px var(--focus); }
body.selecting .card:hover { transform: none; }

/* 選んでいる間の帯 */
.sel-bar { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 40; background: #fff; color: #000; border-radius: 16px; padding: 8px 8px 8px 18px; display: flex; align-items: center; gap: 2px; box-shadow: 0 0 0 1px var(--float-line), 0 14px 40px var(--shadow); white-space: nowrap; max-width: calc(100vw - 24px); overflow-x: auto; }
.sel-bar > button { color: #000; padding: 9px 13px; border-radius: 10px; font-weight: 700; font-size: 13.5px; }
.sel-bar > button:hover { background: rgba(0, 0, 0, 0.07); }
.sel-bar .danger { color: #b2402f; }
.sel-bar .muted-btn { color: rgba(0, 0, 0, 0.5); }
.sel-count { font-weight: 800; font-size: 14px; margin-right: 10px; }
.sel-pop { position: fixed; z-index: 45; width: 240px; max-height: 50vh; overflow-y: auto; background: #fff; border-radius: 12px; padding: 6px; box-shadow: 0 0 0 1px var(--float-line), 0 14px 34px var(--shadow); display: flex; flex-direction: column; }
.sel-pop .pop-head { margin: 0; padding: 6px 10px 4px; font-size: 11.5px; font-weight: 800; color: rgba(0, 0, 0, 0.5); }
.pop-item { text-align: left; padding: 8px 10px; border-radius: 8px; font-weight: 600; font-size: 13.5px; color: #000; }
.pop-item:hover { background: rgba(0, 0, 0, 0.06); }
.pop-item.add { color: #2a62c9; }

/* 「…」と右クリックのメニュー */
.card-menu { position: fixed; z-index: 50; width: 240px; max-height: 70vh; overflow-y: auto; background: var(--sheet); border: 1px solid rgb(var(--ink) / 0.12); border-radius: 12px; padding: 6px; box-shadow: 0 14px 34px var(--shadow); display: flex; flex-direction: column; gap: 1px; }
.menu-item { display: flex; justify-content: space-between; text-align: left; padding: 8px 10px; border-radius: 8px; font-size: 13.5px; font-weight: 600; }
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); }
.menu-item.cur { color: var(--cur); }
.menu-item.add { color: rgb(var(--ink) / 0.7); }
.menu-item.danger { color: var(--danger); }
.menu-list { display: flex; flex-direction: column; gap: 1px; margin: 0 4px 4px 12px; padding-left: 4px; border-left: 2px solid rgb(var(--ink) / 0.1); }
.menu-list .menu-item { font-weight: 500; font-size: 13px; padding: 6px 10px; }
.card-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }

/* 知らせ */
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; background: var(--toast-bg); color: var(--toast-fg); font-size: 13.5px; font-weight: 700; padding: 10px 18px; border-radius: 99px; box-shadow: 0 8px 24px var(--shadow); display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 24px); }
.toast button { color: var(--toast-link); font-weight: 800; padding: 4px 10px; border-radius: 99px; flex: none; }
.toast button:hover { background: var(--toast-hover); }

/* 名前・メモ・整える の画面 */
.dialog-back { position: fixed; inset: 0; z-index: 70; background: var(--backdrop); display: grid; place-items: center; padding: 16px; }
.dialog { width: 560px; max-width: 100%; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--sheet); border: 1px solid rgb(var(--ink) / 0.1); border-radius: 18px; padding: 22px; box-shadow: 0 20px 50px var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.dlg-form { display: flex; flex-direction: column; gap: 12px; }
.dlg-title { margin: 0; font-size: 18px; }
.dlg-sub { margin: 0; color: var(--dim); font-size: 12.5px; }
.dlg-input, .dlg-memo { width: 100%; background: var(--soft); border: 1px solid rgb(var(--ink) / 0.14); border-radius: 10px; color: var(--fg); font: inherit; font-size: 15px; padding: 10px 12px; outline: none; }
.dlg-input:focus, .dlg-memo:focus { border-color: var(--focus); }
.dlg-memo { resize: vertical; line-height: 1.6; }
.dlg-row { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.dlg-row .grow { flex: 1; }
.dlg-count { color: var(--dim); font-size: 12px; }
.dlg-head { display: flex; align-items: center; gap: 12px; }
.dlg-head .link-btn { margin-left: auto; }
.dlg-tabs { display: flex; gap: 6px; }
.tidy-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tidy-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--hover); font-weight: 700; font-size: 14px; }
.tidy-row .grip { color: var(--dim); cursor: grab; }
.tidy-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tidy-count { color: var(--dim); font-size: 12px; font-weight: 500; }
.tidy-sure { display: flex; align-items: center; gap: 6px; color: var(--danger); font-size: 12.5px; }
.icon-btn { width: 26px; height: 26px; border-radius: 8px; color: rgb(var(--ink) / 0.7); font-size: 13px; }
.icon-btn:hover:not(:disabled) { background: var(--hover); color: var(--fg); }
.icon-btn:disabled { opacity: 0.3; cursor: default; }
.tidy-add { padding: 10px 12px; border-radius: 10px; border: 1px dashed rgb(var(--ink) / 0.3); color: rgb(var(--ink) / 0.75); font-weight: 700; font-size: 14px; text-align: left; }
.tidy-add:hover { color: var(--fg); border-color: rgb(var(--ink) / 0.6); }

@media (max-width: 640px) {
  .filter-btn .filter-label { display: none; }
  .filter-btn { padding: 0 11px; }
  .select-btn { display: none; }
  .filter-pop { position: fixed; left: 12px; right: 12px; top: 60px; width: auto; }
  .tab-tidy { display: none; }
}

/* 指で使う端末（マウスをのせられない）では「…」をいつも出す（スマホのブラウザで整理するため） */
@media (hover: none) { .card .more { display: grid; } }
