/* 彩録 SAIROKU
   色は「塗るもの」。UI 自体は墨藍の無彩色で組み、色は視聴した作品だけが持つ。 */

:root {
  --ink: #17162a;
  --ink-2: #1f1e37;
  --ink-3: #292846;
  --line: #3a3860;
  --empty: #2e2c49;
  --paper: #f3f0ff;
  --mute: #a7a3c7;
  --dim: #77739a;
  --ok: #5fe3c0;
  --err: #ff8577;

  --display: 'Dela Gothic One', 'Hiragino Sans', 'Noto Sans JP', sans-serif;
  --sans: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'Yu Gothic UI', 'Meiryo', system-ui, sans-serif;

  --s-1: 12px; --s0: 14px; --s1: 16px; --s2: 20px; --s3: 26px; --s4: 36px;
  --r-s: 6px; --r-m: 12px; --r-l: 22px;
  --pad: clamp(16px, 4vw, 40px);
  --top-h: 64px;
  --tab-h: 0px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top-h) + 64px); }
body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font: 400 var(--s1)/1.7 var(--sans);
  font-feature-settings: 'palt';
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
}
html.sheet-open { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .35; }
a { color: inherit; }
img { display: block; }
:focus-visible { outline: 2px solid var(--paper); outline-offset: 2px; border-radius: 4px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { flex: none; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--paper); color: var(--ink); padding: 8px 14px; border-radius: var(--r-s); z-index: 100; }
.skip:focus { top: 8px; }
[hidden] { display: none !important; }

/* ---------- ブランド記号：4色の色見本（色指定表のチップ） ---------- */
.mark { display: inline-grid; grid-template-columns: 1fr 1fr; gap: 2px; width: 22px; height: 22px; }
.mark i { border-radius: 2px; background: var(--empty); }
.mark i:nth-child(1) { background: #ff6b5a; }
.mark i:nth-child(4) { background: #5fe3c0; }
.mark.big { width: 56px; height: 56px; gap: 4px; }
.mark.big i { border-radius: 5px; }

/* ---------- ヘッダー ---------- */
.top {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  height: var(--top-h); padding: 0 var(--pad);
  background: rgb(23 22 42 / .86);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid rgb(58 56 96 / .6);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: none; }
.wordmark { font-family: var(--display); font-size: 22px; letter-spacing: .04em; line-height: 1; }
.search {
  flex: 1; max-width: 560px; position: relative; display: flex; align-items: center;
  background: var(--ink-2); border: 1px solid var(--line); border-radius: 999px; padding: 0 6px 0 14px; height: 42px;
}
.search:focus-within { border-color: var(--mute); }
.search .ico { color: var(--mute); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; padding: 0 10px; font-size: var(--s1); outline: none; }
.search input::placeholder { color: var(--dim); }
.search input::-webkit-search-cancel-button { display: none; }
.q-clear { border: 0; background: var(--ink-3); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: var(--mute); }

.tabbar { display: flex; gap: 4px; margin-left: auto; }
.tabbar button {
  display: flex; align-items: center; gap: 8px; border: 0; background: none; color: var(--mute);
  padding: 8px 14px; border-radius: 999px; font-size: var(--s0); font-weight: 600;
}
.tabbar button:hover { color: var(--paper); }
.tabbar button[aria-current='page'] { color: var(--ink); background: var(--paper); }

@media (max-width: 760px) {
  :root { --top-h: 58px; --tab-h: 64px; }
  /* backdrop-filter があると固定配置のタブバーがヘッダー基準になるため、モバイルでは使わない */
  .top { gap: 12px; background: rgb(23 22 42 / .97); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .wordmark { display: none; }
  .search { max-width: none; height: 40px; }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; margin: 0; gap: 0;
    height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding: 6px 8px env(safe-area-inset-bottom);
    background: rgb(23 22 42 / .92); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
    border-top: 1px solid var(--line);
  }
  .tabbar button { flex: 1; flex-direction: column; gap: 2px; justify-content: center; font-size: 11px; padding: 4px 0; border-radius: var(--r-m); }
  .tabbar button[aria-current='page'] { background: none; color: var(--paper); }
  .tabbar button[aria-current='page'] .ico { color: #ffc23d; }
}

main { padding: 0 var(--pad) 64px; max-width: 1480px; margin: 0 auto; }

/* ---------- ヒーロー：彩色率 ---------- */
.hero {
  display: grid; grid-template-columns: auto 1fr; align-items: end; gap: 12px clamp(20px, 4vw, 56px);
  padding: clamp(28px, 6vw, 72px) 0 clamp(20px, 3vw, 32px);
}
.hero-num {
  font-family: var(--display); line-height: .82; letter-spacing: -.02em;
  font-size: clamp(84px, 17vw, 220px);
  font-variant-numeric: tabular-nums;
  background: linear-gradient(100deg, #ff6b5a 0%, #ffc23d 28%, #5fe3c0 52%, #7aa8ff 76%, #e58bf6 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  white-space: nowrap;
}
.pct-sign { font-size: .38em; margin-left: .06em; }
.hero-copy { padding-bottom: .4em; max-width: 34em; }
.hero-line { margin: 0 0 4px; font-size: clamp(15px, 2vw, var(--s2)); line-height: 1.6; color: var(--mute); }
.hero-line #hero-total, .hero-line strong { color: var(--paper); font-family: var(--display); font-weight: 400; font-size: 1.15em; margin: 0 .15em; }
.hero-sub { margin: 0 0 16px; color: var(--mute); font-size: var(--s0); min-height: 1em; }
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; padding-top: 28px; }
  .hero-copy { padding: 0; }
}

/* ---------- 全景モザイク ---------- */
.panorama { margin: 0 0 clamp(32px, 5vw, 56px); }
.pano-frame { display: grid; grid-template-columns: 38px 1fr; gap: 10px; }
.gutter { position: relative; font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }
.gutter span { position: absolute; right: 0; transform: translateY(-3px); line-height: 1; }
.mcv { position: relative; min-width: 0; }
.pano-frame[data-axis='x'] { grid-template-columns: 1fr; }
.pano-frame[data-axis='x'] .gutter { display: none; }
.xaxis { position: relative; height: 22px; font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }
.xaxis span { position: absolute; top: 8px; transform: translateX(-50%); line-height: 1; white-space: nowrap; }
.xaxis:empty { display: none; }
#mosaic { display: block; border-radius: 4px; cursor: crosshair; image-rendering: pixelated; }
.mtip {
  position: absolute; left: 0; top: 0; pointer-events: none; z-index: 2; max-width: 240px;
  background: var(--paper); color: var(--ink); font-size: var(--s-1); font-weight: 600; line-height: 1.4;
  padding: 6px 10px; border-radius: var(--r-s); box-shadow: 0 6px 24px rgb(0 0 0 / .4);
}
.pano-frame[data-axis='x'] + .legend { margin-left: 0; }
.legend { list-style: none; margin: 16px 0 0 48px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: var(--s-1); color: var(--mute); }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend .sw, .chip .sw { width: 10px; height: 10px; border-radius: 3px; background: var(--tc); flex: none; }
.legend .lt { color: var(--paper); font-weight: 600; }
.legend .lv { font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
  .pano-frame { grid-template-columns: 1fr; }
  .gutter { display: none; }
  .legend { margin-left: 0; }
}

/* ---------- 絞り込み ---------- */
.browse { outline: none; }
.filters {
  position: sticky; top: var(--top-h); z-index: 20;
  margin: 0 calc(var(--pad) * -1) 18px; padding: 12px var(--pad);
  background: rgb(23 22 42 / .9); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line); background: none; color: var(--mute);
  font-size: var(--s0); font-weight: 600; white-space: nowrap;
}
.chip .sw { opacity: .45; }
.chip:hover { color: var(--paper); }
.chip[aria-pressed='true'] { color: var(--ink); background: var(--tc); border-color: var(--tc); }
.chip[aria-pressed='true'] .sw { background: var(--ink); opacity: .7; }
.sel { position: relative; }
.selects { position: relative; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; flex: 1; }
.sel select {
  appearance: none; height: 34px; padding: 0 30px 0 12px; border-radius: var(--r-s);
  background: var(--ink-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23a7a3c7' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 11px center;
  border: 1px solid var(--line); font-size: var(--s0); color: var(--paper);
}
.count { margin-left: auto; color: var(--mute); font-size: var(--s0); font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 760px) {
  .filters { flex-wrap: nowrap; flex-direction: column; align-items: stretch; gap: 8px; padding-top: 10px; padding-bottom: 10px; }
  .chips, .selects { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(var(--pad) * -1); padding: 0 var(--pad); }
  .chips::-webkit-scrollbar, .selects::-webkit-scrollbar { display: none; }
  .sel select { font-size: 14px; }
}

/* ---------- ポスターグリッド ---------- */
.grid { position: relative; }
.grid > .tile { position: absolute; left: 0; top: 0; }
.tile {
  display: block; padding: 0; border: 0; background: none; text-align: left;
  -webkit-tap-highlight-color: transparent; contain: layout paint;
}
.poster {
  position: relative; aspect-ratio: 1 / 1.42; border-radius: var(--r-s); overflow: hidden;
  background: var(--empty);
}
.poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.poster .ph {
  position: absolute; inset: 0; display: none; place-items: center;
  font-family: var(--display); font-size: 2.4em; color: rgb(243 240 255 / .14);
}
.poster.noimg img { display: none; }
.poster.noimg .ph { display: grid; }

/* 未視聴：グレー */
.tile[data-st='none'] .poster img.base,
.tile[data-st='plan'] .poster img.base,
.tile[data-st='watching'] .poster img.base,
.tile[data-st='hold'] .poster img.base,
.tile[data-st='drop'] .poster img.base { filter: grayscale(1) brightness(.5) contrast(1.05); }
.tile[data-st='none'] .poster img.base { opacity: .82; }
@media (hover: hover) {
  .tile[data-st='none']:hover .poster img.base { filter: grayscale(1) brightness(.78); opacity: 1; }
}
/* 視聴中：下から色が満ちる */
.poster img.paint { clip-path: inset(calc((1 - var(--p)) * 100%) 0 0 0); transition: clip-path .6s var(--ease); }
.poster .meter {
  position: absolute; left: 0; right: 0; height: 2px; background: var(--tc);
  bottom: calc(var(--p) * 100%); box-shadow: 0 0 12px var(--tc);
}
/* 完走：フルカラー＋種別色の縁 */
.tile[data-st='done'] .poster::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 2px var(--tc); pointer-events: none;
}
.tile[data-st='done'].noimg .poster, .tile[data-st='done'] .poster.noimg { background: var(--tc); }
.tile[data-st='done'] .poster.noimg .ph { color: rgb(23 22 42 / .35); }
.tile[data-st='plan'] .poster { outline: 1px dashed rgb(243 240 255 / .35); outline-offset: -1px; }

.badge {
  position: absolute; left: 6px; top: 6px; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; line-height: 1.6; background: var(--ink); color: var(--paper);
  font-variant-numeric: tabular-nums;
}
.tile[data-st='done'] .badge { background: var(--tc); color: var(--ink); }
.tile[data-st='watching'] .badge { background: var(--paper); color: var(--ink); }

.cap { display: flex; flex-direction: column-reverse; padding: 7px 2px 0; }
.cap .t {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: 13px; font-weight: 600; line-height: 1.4; color: var(--mute); min-height: 2.8em;
}
.tile[data-st='done'] .cap .t, .tile[data-st='watching'] .cap .t { color: var(--paper); }
.cap .m { display: flex; gap: 8px; margin-bottom: 1px; font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; }
.cap .ty { color: var(--tc); font-weight: 700; }
.tile[data-st='none'] .cap .ty { color: var(--dim); }

.tile.sm { width: 104px; flex: none; }
.tile.sm .cap .t { font-size: 12px; }

.empty { color: var(--mute); font-size: var(--s0); margin: 0; }
.empty.big { padding: 48px 0; text-align: center; max-width: 36em; margin: 0 auto; line-height: 1.9; }

/* ---------- ボタン類 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px;
  border-radius: 999px; border: 1px solid var(--paper); background: var(--paper); color: var(--ink);
  font-size: var(--s0); font-weight: 700; text-decoration: none; white-space: nowrap;
}
.btn.ghost { background: none; color: var(--paper); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--mute); }
.btn.danger { color: var(--err); }
.btns { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- 詳細シート ---------- */
#sheet {
  padding: 0; border: 0; margin: 0; color: var(--paper); background: var(--ink-2);
  max-width: none; max-height: none; overflow: hidden;
  position: fixed; inset: 0 0 0 auto; width: min(520px, 100vw); height: 100dvh;
  box-shadow: -24px 0 80px rgb(0 0 0 / .5); border-left: 1px solid var(--line);
}
#sheet::backdrop { background: rgb(10 9 24 / .62); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
#sheet[open] { animation: sheet-in .38s var(--ease); }
@keyframes sheet-in { from { transform: translateX(40px); opacity: 0; } }
.sheet-body { height: 100%; overflow-y: auto; overscroll-behavior: contain; padding: 0 0 48px; }
.sheet-close {
  position: absolute; top: 12px; right: 12px; z-index: 3; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; border: 0; background: rgb(23 22 42 / .7); color: var(--paper);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
@media (max-width: 760px) {
  #sheet { inset: auto 0 0 0; width: 100vw; height: 92dvh; border-radius: var(--r-l) var(--r-l) 0 0; border-left: 0; border-top: 1px solid var(--line); }
  #sheet[open] { animation-name: sheet-up; }
  @keyframes sheet-up { from { transform: translateY(60px); opacity: 0; } }
  #sheet::before { content: ''; position: absolute; top: 8px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: var(--line); z-index: 3; }
}

.sh-head { position: relative; }
.art { position: relative; height: 300px; overflow: hidden; background: var(--empty); }
.art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 22%; }
.art img.base { filter: grayscale(1) brightness(.45); }
.art img.paint { clip-path: inset(calc((1 - var(--p)) * 100%) 0 0 0); transition: clip-path .8s var(--ease); }
.art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgb(31 30 55 / 0) 50%, var(--ink-2) 99%); }
.art .meter { position: absolute; left: 0; right: 0; height: 2px; background: var(--tc); bottom: calc(var(--p) * 100%); box-shadow: 0 0 16px var(--tc); z-index: 1; }
.art.noimg .ph { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-size: 120px; color: rgb(243 240 255 / .08); }
.sh-titles { position: relative; margin-top: -96px; padding: 0 24px; z-index: 1; }
.sh-type {
  display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--tc); color: var(--ink);
  font-size: 12px; font-weight: 700;
}
.sh-titles h2 { font-family: var(--display); font-weight: 400; font-size: clamp(24px, 6vw, 30px); line-height: 1.3; margin: 10px 0 4px; letter-spacing: .01em; overflow-wrap: anywhere; }
.sh-sub { margin: 0; color: var(--mute); font-size: var(--s0); line-height: 1.5; }
.sh-paint { margin: 10px 0 0; font-size: var(--s0); color: var(--tc); font-weight: 600; }

.sh-sec { padding: 20px 24px 4px; }
.sh-sec h3 { margin: 18px 0 10px; font-size: var(--s0); font-weight: 700; color: var(--mute); display: flex; justify-content: space-between; }
.sh-sec h3:first-child { margin-top: 4px; }
.sh-sec.rec { border-bottom: 1px solid var(--line); padding-bottom: 24px; }

.seg { display: grid; grid-template-columns: repeat(5, 1fr); background: var(--ink); border: 1px solid var(--line); border-radius: var(--r-m); padding: 3px; gap: 3px; }
.seg.small { grid-template-columns: repeat(3, 56px); }
.seg-b { border: 0; background: none; color: var(--mute); height: 38px; border-radius: 9px; font-size: var(--s0); font-weight: 700; white-space: nowrap; padding: 0 4px; }
.seg-b:hover { color: var(--paper); }
.seg-b[aria-checked='true'] { background: var(--paper); color: var(--ink); }
#sheet .seg-b[data-s='done'][aria-checked='true'] { background: var(--tc); }

.counter { display: grid; grid-template-columns: 56px 1fr 56px; align-items: center; gap: 12px; }
.cnt-b { height: 56px; border-radius: var(--r-m); border: 1px solid var(--line); background: var(--ink); display: grid; place-items: center; color: var(--paper); }
.cnt-b.plus { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.cnt-b:active:not(:disabled) { transform: scale(.96); }
.cnt-v { text-align: center; color: var(--mute); font-size: var(--s0); }
.cnt-v strong { font-family: var(--display); font-weight: 400; font-size: 44px; line-height: 1; color: var(--paper); font-variant-numeric: tabular-nums; }

.eps { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 4px; margin-top: 14px; max-height: 196px; overflow-y: auto; padding: 2px; }
.ep { height: 34px; border-radius: 7px; border: 0; background: var(--empty); color: var(--dim); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ep:hover { color: var(--paper); }
.ep.on { background: var(--tc); color: var(--ink); }
.ep.last { box-shadow: 0 0 0 2px var(--ink-2), 0 0 0 4px var(--tc); }
.ep-jump { display: flex; align-items: end; gap: 10px; margin-top: 14px; }
.ep-jump label { display: grid; gap: 4px; font-size: var(--s-1); color: var(--mute); }
.ep-input, .fld input, .fld textarea, .add-form input, .add-form select, .login input {
  height: 42px; padding: 0 12px; border-radius: var(--r-s); border: 1px solid var(--line); background: var(--ink); color: var(--paper); font-size: 16px; width: 100%;
}
.ep-input { width: 120px; }

.row2 { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; }
.rate-row { display: flex; align-items: center; gap: 12px; }
.rate { display: flex; gap: 3px; }
.rt { width: 20px; height: 28px; border: 0; border-radius: 4px; background: var(--empty); padding: 0; }
.rt.on { background: var(--tc); }
.rt:nth-child(5) { margin-right: 4px; }
.rate-v { font-size: var(--s-1); color: var(--mute); font-variant-numeric: tabular-nums; }
.rw { display: flex; align-items: center; gap: 8px; font-size: var(--s0); color: var(--mute); }
.rw strong { color: var(--paper); min-width: 3em; text-align: center; font-weight: 700; }
.mini { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: none; display: grid; place-items: center; color: var(--paper); }

.dates { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0 12px; }
.fld { display: grid; gap: 6px; font-size: var(--s-1); color: var(--mute); margin-bottom: 14px; }
.fld textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.fld input[type='date'] { color-scheme: dark; }

.facts { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.facts div { min-width: 0; }
.facts dt { font-size: var(--s-1); color: var(--dim); }
.facts dd { margin: 0; font-size: var(--s0); font-weight: 600; overflow-wrap: anywhere; text-transform: capitalize; }
.genres { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.genres li { font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--mute); }
.links { display: flex; gap: 8px 18px; flex-wrap: wrap; margin: 18px 0 0; font-size: var(--s0); }
.links a { display: inline-flex; align-items: center; gap: 4px; color: var(--mute); text-underline-offset: 3px; }
.links a:hover { color: var(--paper); }

.rel { display: flex; gap: 12px; overflow-x: auto; padding: 2px 2px 10px; scroll-snap-type: x proximity; list-style: none; margin: 0; }
.rel > .tile, .rel > li { scroll-snap-align: start; }
.rel.wrap { flex-wrap: wrap; overflow: visible; }
.rel.wrap > li { list-style: none; }

/* ---------- 視聴中・記録・設定 ---------- */
.page { max-width: 880px; margin: 0 auto; padding-top: clamp(24px, 5vw, 48px); }
.page h2, .set-sec h2, .st-sec h2, .w-sec h2 {
  font-family: var(--display); font-weight: 400; font-size: var(--s3); line-height: 1.3; margin: 0 0 16px; display: flex; align-items: baseline; gap: 12px;
}
.w-sec h2 .n { font-family: var(--sans); font-size: var(--s0); color: var(--mute); font-weight: 600; }
.w-sec, .st-sec, .set-sec { margin-bottom: 48px; }

.wl { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.wr { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 16px; background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--r-m); padding: 10px 10px 10px 10px; }
.wr .tile.sm { width: 64px; }
.wr .tile.sm .cap { display: none; }
.wr-main { border: 0; background: none; text-align: left; padding: 0; display: grid; gap: 6px; min-width: 0; }
.wr-t { font-weight: 700; font-size: var(--s1); line-height: 1.4; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.wr-p { height: 6px; border-radius: 6px; background: var(--empty); overflow: hidden; }
.wr-f { display: block; height: 100%; width: calc(var(--p) * 100%); background: var(--tc); border-radius: inherit; transition: width .5s var(--ease); }
.wr-n { font-size: var(--s-1); color: var(--mute); font-variant-numeric: tabular-nums; }
.wr-n strong { font-family: var(--display); font-weight: 400; color: var(--paper); font-size: 18px; margin-right: 2px; }
.wr-plus {
  display: grid; justify-items: center; gap: 0; width: 64px; height: 64px; align-content: center;
  border-radius: var(--r-m); border: 0; background: var(--tc); color: var(--ink); font-size: 11px; font-weight: 800;
}
.wr-plus:active:not(:disabled) { transform: scale(.95); }

.tot { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; }
.stat { background: var(--ink); padding: 18px 18px 16px; display: grid; gap: 4px; }
.stat strong { font-family: var(--display); font-weight: 400; font-size: clamp(24px, 4vw, 34px); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { font-size: var(--s-1); color: var(--mute); }
@media (max-width: 560px) { .tot { grid-template-columns: repeat(2, 1fr); } }

.bars { display: grid; gap: 14px; }
.bar { display: grid; grid-template-columns: 72px 1fr 120px; align-items: center; gap: 14px; }
.bl { font-weight: 700; font-size: var(--s0); color: var(--tc); }
.bt { height: 14px; border-radius: 4px; background: var(--empty); overflow: hidden; }
.bf { display: block; height: 100%; width: calc(var(--w) * 100%); background: var(--tc); border-radius: inherit; }
.bv { text-align: right; display: grid; line-height: 1.3; }
.bv strong { font-family: var(--display); font-weight: 400; font-size: 18px; }
.bv small { color: var(--dim); font-size: 11px; font-variant-numeric: tabular-nums; }

.cols { display: flex; align-items: end; gap: 6px; height: 220px; }
.col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: end; min-width: 0; }
.ct { width: 100%; max-width: 56px; height: calc(var(--h) * 160px); min-height: 3px; background: var(--empty); border-radius: 4px; display: flex; align-items: end; overflow: hidden; }
.cf { width: 100%; height: calc(var(--f) * 100%); background: linear-gradient(180deg, #ffc23d, #ff6b5a); }
.cl, .cv { font-size: 11px; color: var(--dim); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cv { color: var(--paper); font-weight: 700; min-height: 1.4em; }

.gl { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.gl li { position: relative; display: flex; justify-content: space-between; padding: 8px 14px; border-radius: var(--r-s); overflow: hidden; font-size: var(--s0); font-weight: 600; }
.gl li::before { content: ''; position: absolute; inset: 0; width: calc(var(--w) * 100%); background: var(--ink-3); z-index: -1; border-radius: inherit; }
.gl li { isolation: isolate; }

.note { color: var(--mute); font-size: var(--s0); line-height: 1.8; margin: -6px 0 16px; max-width: 40em; }
.err-text { color: var(--err); font-size: var(--s0); margin: 10px 0 0; }
.opt { display: flex; gap: 14px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
.opt label { display: grid; gap: 2px; cursor: pointer; flex: 1; }
.ol { font-weight: 600; }
.od { font-size: var(--s-1); color: var(--mute); }
.type-toggles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 18px; margin-bottom: 8px; }
.type-toggles .opt { border-top: 0; padding: 8px 0; }
@media (max-width: 560px) { .type-toggles { grid-template-columns: repeat(2, 1fr); } }
.sw-in { appearance: none; flex: none; width: 44px; height: 26px; border-radius: 26px; background: var(--empty); border: 1px solid var(--line); position: relative; cursor: pointer; margin: 0; transition: background .2s; }
.sw-in::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--mute); transition: transform .2s var(--ease), background .2s; }
.sw-in:checked { background: var(--ok); border-color: var(--ok); }
.sw-in:checked::after { transform: translateX(18px); background: var(--ink); }
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.add-form { display: grid; grid-template-columns: 2fr 1fr 90px 100px auto; gap: 8px; }
@media (max-width: 640px) { .add-form { grid-template-columns: 1fr 1fr; } .add-form input[type='text'] { grid-column: 1 / -1; } }
.login { display: flex; gap: 8px; max-width: 420px; }
.about .facts { margin-bottom: 20px; }
.about .facts dd { text-transform: none; }

/* ---------- トースト ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 20px); z-index: 60;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--paper); color: var(--ink); font-weight: 700; font-size: var(--s0);
  padding: 12px 20px; border-radius: 999px; box-shadow: 0 12px 40px rgb(0 0 0 / .45);
  transition: transform .3s var(--ease), opacity .3s; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.ok { background: var(--ok); }
.toast.err { background: var(--err); }
dialog[open] ~ .toast { z-index: 2147483647; }

/* ---------- 起動画面 ---------- */
.boot { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--ink); transition: opacity .6s, visibility .6s; }
.boot.done { opacity: 0; visibility: hidden; }
.boot-in { display: grid; justify-items: center; gap: 14px; text-align: center; padding: 24px; }
.boot-word { font-family: var(--display); font-size: 40px; margin: 0; line-height: 1; }
.boot-bar { width: 220px; height: 4px; border-radius: 4px; background: var(--empty); overflow: hidden; }
.boot-bar span { display: block; height: 100%; width: calc(var(--p, .05) * 100%); background: linear-gradient(90deg, #ff6b5a, #ffc23d, #5fe3c0, #7aa8ff, #e58bf6); transition: width .2s; }
.boot-msg { color: var(--mute); font-size: var(--s0); margin: 0; max-width: 28em; }
.boot.err .boot-msg { color: var(--err); }
.boot .mark.big i { animation: chip 1.6s infinite; }
.boot .mark.big i:nth-child(2) { animation-delay: .2s; }
.boot .mark.big i:nth-child(3) { animation-delay: .4s; }
.boot .mark.big i:nth-child(4) { animation-delay: .6s; }
@keyframes chip { 50% { filter: brightness(1.6); } }
.nojs { position: fixed; inset: 0; display: grid; place-items: center; background: var(--ink); z-index: 200; margin: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.wr .badge, .wr .meter { display: none; }
.row2 { margin-top: 20px; }

/* ---------- 広告枠 ---------- */
.ad { display: block; margin: 0 auto clamp(32px, 5vw, 56px); max-width: 970px; text-align: center; }
.ad-label { display: block; font-size: 11px; color: var(--dim); margin-bottom: 6px; text-align: left; }
.ad ins.adsbygoogle { display: block; min-height: 100px; background: var(--ink-2); border-radius: var(--r-s); }
.ad ins.adsbygoogle[data-ad-status='filled'] { background: none; }
/* 配信されなかった枠は詰める（空白を残さない） */
.ad:has(ins[data-ad-status='unfilled']) { display: none; }
.ad-sheet { margin: 32px 24px 8px; padding-top: 24px; border-top: 1px solid var(--line); }
.ad-page { margin-top: 8px; }
@media (max-width: 760px) { .ad ins.adsbygoogle { min-height: 250px; } }

/* ---------- フッター・規約ページ ---------- */
.foot { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: center; padding: 48px 0 8px; font-size: var(--s-1); color: var(--dim); }
.foot a { color: var(--mute); text-underline-offset: 3px; }
.legal { max-width: 720px; margin: 0 auto; padding: clamp(32px, 6vw, 72px) var(--pad) 96px; }
.legal h1 { font-family: var(--display); font-weight: 400; font-size: var(--s4); line-height: 1.3; margin: 0 0 8px; }
.legal h2 { font-size: var(--s2); margin: 40px 0 8px; }
.legal p, .legal li { color: var(--mute); line-height: 1.9; }
.legal a { color: var(--paper); text-underline-offset: 3px; }
.legal .back { display: inline-flex; margin-bottom: 32px; color: var(--mute); }
