/* かえでゲームズ ミニ
   Design rules this file follows:
   1. One radius scale (6 / 10 / pill). Mixed radii were most of the "generic template" feel.
   2. Gradients are reserved for the play state and the one primary button. Decorative
      multi-stop gradients are what made the page read as machine-made.
   3. Section headings are marked with a square + hairline rule (print / old-web idiom),
      not by size alone — that is where the site's own character lives.
   4. Exactly one loud element per screen; everything else steps down in weight. */
:root {
  --bg: #faf8f2;
  --bg2: #f3efe5;
  --surface: #ffffff;
  --surface2: #f6f2ea;
  --border: #e6dfd1;
  --border-soft: #f0ebe1;
  --text: #2e2a22;
  --text2: #61594c;
  --muted: #948b7a;
  --accent: #d8402a;
  --accent2: #b0842f;
  --accent-ink: #8c2417;
  --accent-soft: rgba(216, 64, 42, 0.07);
  --gold-soft: rgba(176, 132, 47, 0.09);
  --shadow: rgba(90, 74, 46, 0.06);
  --shadow-lift: rgba(90, 74, 46, 0.12);
  --grain: rgba(90, 74, 44, 0.035);
  --r-sm: 6px;
  --r: 10px;
  --topbar-h: 56px;
  --dock-h: 58px;
  --safe-b: max(10px, env(safe-area-inset-bottom));
  --dock-total: calc(var(--dock-h) + var(--safe-b));
}
:root[data-theme="dark"] {
  --bg: #161512;
  --bg2: #1d1c18;
  --surface: #23221d;
  --surface2: #2e2c25;
  --border: #423f36;
  --border-soft: #332f28;
  --text: #f2eee6;
  --text2: #c9c2b3;
  --muted: #98917f;
  --accent: #ff8264;
  --accent2: #d9b268;
  --accent-ink: #ffd9a0;
  --accent-soft: rgba(255, 122, 92, 0.15);
  --gold-soft: rgba(240, 171, 60, 0.10);
  --shadow: rgba(0, 0, 0, 0.45);
  --shadow-lift: rgba(0, 0, 0, 0.62);
  --grain: rgba(255, 236, 200, 0.028);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161512;
    --bg2: #1d1c18;
    --surface: #23221d;
    --surface2: #2e2c25;
    --border: #423f36;
    --border-soft: #332f28;
    --text: #f2eee6;
    --text2: #c9c2b3;
    --muted: #98917f;
    --accent: #ff8264;
    --accent2: #d9b268;
    --accent-ink: #ffd9a0;
    --accent-soft: rgba(255, 122, 92, 0.15);
    --gold-soft: rgba(240, 171, 60, 0.10);
    --shadow: rgba(0, 0, 0, 0.45);
    --shadow-lift: rgba(0, 0, 0, 0.62);
    --grain: rgba(255, 236, 200, 0.028);
  }
}
* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  background-color: var(--bg);
  /* a faint 3px dot grid: enough to read as paper rather than a flat render */
  background-image: radial-gradient(var(--grain) 1px, transparent 1px);
  background-size: 3px 3px;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic UI", "Noto Sans JP", Meiryo, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  font-feature-settings: "palt";
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { line-height: 1.35; letter-spacing: 0.005em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
.ic { width: 18px; height: 18px; flex-shrink: 0; display: block; overflow: visible; }

/* ---------- topbar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--topbar-h); z-index: 50;
  display: flex; align-items: center; gap: 10px; padding: 0 14px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--border);
}
.logo { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.logo-img { width: 30px; height: 30px; }
.logo-t { font-weight: 800; font-size: 15px; white-space: nowrap; }
.logo-t b { color: var(--accent); }
.searchbox { position: relative; flex: 1; max-width: 440px; margin-left: auto; }
.search-ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
#q {
  width: 100%; height: 38px; padding: 0 12px 0 34px; border-radius: var(--r);
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 14px; outline: none; appearance: none; -webkit-appearance: none;
}
#q:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#q::placeholder { color: var(--muted); font-size: 13px; }
.search-results {
  position: absolute; top: 44px; left: 0; right: 0; max-height: min(62vh, 480px); overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: 0 18px 44px var(--shadow-lift); z-index: 60;
}
.sr-row { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-bottom: 1px solid var(--border-soft); cursor: pointer; }
.sr-row:last-child { border-bottom: 0; }
.sr-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.sr-cat { flex-shrink: 0; font-size: 11px; color: var(--text2); background: var(--bg2); border: 1px solid var(--border-soft); border-radius: 999px; padding: 2px 9px; }
.sr-more { padding: 9px 12px; text-align: center; color: var(--muted); font-size: 12px; }
.tb-btn { flex-shrink: 0; width: 36px; height: 36px; display: grid; place-items: center; color: var(--text2); border-radius: var(--r-sm); }
:root[data-theme="dark"] .i-moon, .i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-moon { display: none; }
  :root:not([data-theme="light"]) .i-sun { display: block; }
}

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 244px minmax(0, 1fr); max-width: 1180px; margin: 0 auto; padding-top: var(--topbar-h); }
main { padding: 18px 22px 120px; min-width: 0; }

.side {
  position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h));
  overflow-y: auto; padding: 10px 8px 40px; border-right: 1px solid var(--border);
  scrollbar-width: thin;
}
.side-h { font-size: 10.5px; font-weight: 800; color: var(--muted); letter-spacing: .1em; padding: 15px 10px 5px; display: flex; align-items: center; }
.side-h:first-child { padding-top: 4px; }
.side a { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: var(--r-sm); font-size: 13px; color: var(--text2); }
.side a.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; box-shadow: inset 2px 0 0 var(--accent); }
.sb-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-done { font-size: 10px; color: var(--accent2); display: none; }
.sb-done.on { display: inline; }
.gdot { display: inline-block; width: 7px; height: 7px; border-radius: 2px; margin-right: 7px; flex-shrink: 0; box-shadow: 0 0 0 1px rgba(0, 0, 0, .14); }

.chips { display: none; gap: 7px; overflow-x: auto; padding: 2px 0 12px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; font-size: 12.5px; padding: 6px 13px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text2); white-space: nowrap; }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }

/* ---------- section headings: square marker + hairline rule ---------- */
section > h2, .qhead h2 {
  font-size: 16.5px; font-weight: 800; margin: 32px 0 12px;
  display: flex; align-items: center; gap: 9px;
}
section > h2::before {
  content: ""; width: 9px; height: 9px; flex-shrink: 0;
  background: var(--accent); border-radius: 2px;
}
section > h2::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}
section > h2 .ic { color: var(--accent2); width: 18px; height: 18px; }
.h-sub { font-size: 11.5px; color: var(--muted); font-weight: 500; flex-shrink: 0; }
.grp-h {
  font-size: 10.5px; font-weight: 800; color: var(--muted); letter-spacing: .1em;
  display: flex; align-items: center; margin: 18px 0 8px;
}

/* ---------- category head: flat block, no decorative gradients ---------- */
.cat-head {
  position: relative; padding: 18px 20px 16px; margin-bottom: 14px;
  background: var(--surface);
  border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: var(--r); overflow: hidden;
}
.cat-head::after {
  content: ""; position: absolute; right: -16px; bottom: -24px; width: 124px; height: 124px;
  background: url('/static/kaede-icon.png') no-repeat center / contain;
  opacity: .06; transform: rotate(-8deg); pointer-events: none;
}
.cat-catch { font-size: 12.5px; color: var(--accent); font-weight: 700; margin-bottom: 2px; }
.cat-catch span { display: inline-block; }
.cat-head h1 { font-size: 23px; font-weight: 900; margin-bottom: 12px; }
.cat-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.badge { font-size: 11.5px; font-weight: 800; color: var(--accent-ink); background: var(--gold-soft); border: 1px solid var(--accent2); border-radius: 999px; padding: 3px 11px; }
.badge-prog { display: none; background: var(--surface2); color: var(--accent-ink); border: 1px solid var(--border); }
.badge-prog.on { display: inline-block; }
.spacer { flex: 1; }
.share-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 12.5px; font-weight: 700; height: 34px; padding: 0 15px; border-radius: 999px;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text2);
}
.share-btn .ic { width: 15px; height: 15px; }

/* ---------- 語録 explainer ---------- */
.origin { margin-bottom: 14px; }
.origin summary {
  display: flex; align-items: center; gap: 12px; cursor: pointer; list-style: none;
  padding: 13px 15px; border-radius: var(--r);
  background: var(--surface);
  border: 1.5px solid var(--border); border-left: 4px solid var(--accent2);
}
.origin summary::-webkit-details-marker { display: none; }
.origin-ic { display: grid; place-items: center; width: 34px; height: 34px; flex-shrink: 0; border-radius: var(--r-sm); background: var(--gold-soft); color: var(--accent2); }
.origin-ic .ic { width: 19px; height: 19px; }
.origin-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.origin-txt b { font-size: 14.5px; font-weight: 800; }
.origin-txt span { font-size: 11.5px; color: var(--muted); }
.origin-go { color: var(--accent2); transition: transform .18s; }
.origin[open] summary { border-radius: var(--r) var(--r) 0 0; border-bottom-color: transparent; }
.origin[open] .origin-go { transform: rotate(180deg); }
.origin-body { padding: 15px 17px 17px; border: 1.5px solid var(--border); border-left: 4px solid var(--accent2); border-top: 0; border-radius: 0 0 var(--r) var(--r); background: var(--surface); }
.origin-lede { font-size: 13.5px; color: var(--text2); margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border-soft); }
.origin-body h3 { font-size: 13.5px; font-weight: 800; color: var(--accent-ink); margin: 16px 0 5px; }
.origin-body h3:first-of-type { margin-top: 0; }
.origin-body p { font-size: 13.5px; color: var(--text2); line-height: 1.85; }

/* ---------- soundboard ---------- */
.board { list-style: none; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.s { display: flex; align-items: stretch; border-bottom: 1px solid var(--border-soft); position: relative; }
.s:last-child { border-bottom: 0; }
.s-ad { display: block; padding: 4px 12px; background: var(--bg2); }
.s-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 11px; padding: 11px 6px 11px 13px; text-align: left; position: relative; }
.s-name { flex: 1; min-width: 0; font-size: 13.5px; color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-ico {
  width: 30px; height: 30px; flex-shrink: 0; display: grid; place-items: center;
  border-radius: 50%; background: var(--surface2); color: var(--accent);
  border: 1px solid var(--border); position: relative; transition: transform .12s, background .12s;
}
.s-ico .ic { width: 13px; height: 13px; margin-left: 1px; }
.s-main:active .s-ico { transform: scale(.92); }
.eq { display: none; align-items: flex-end; gap: 2px; height: 13px; }
.eq i { width: 3px; background: currentColor; border-radius: 1px; animation: eq .68s ease-in-out infinite; height: 40%; }
.eq i:nth-child(2) { animation-delay: .22s; height: 92%; }
.eq i:nth-child(3) { animation-delay: .44s; height: 60%; }
@keyframes eq { 50% { transform: scaleY(.32); } }

.playing .s-ico, .qs.playing .s-ico, .pad.playing .s-ico {
  background: linear-gradient(140deg, var(--accent), var(--accent2)); color: #fff;
  border-color: transparent; box-shadow: 0 0 0 4px var(--accent-soft);
  animation: pop .3s ease;
}
@keyframes pop { 0% { transform: scale(1); } 45% { transform: scale(1.18); } 100% { transform: scale(1); } }
.playing .i-play, .qs.playing .i-play, .pad.playing .i-play { display: none; }
.playing .eq, .qs.playing .eq, .pad.playing .eq { display: flex; }
.s.playing { background: var(--accent-soft); }
.s.playing .s-name { color: var(--text); font-weight: 700; }
.s.paused .s-ico { background: var(--accent-soft); }
.s.heard .s-ico::after {
  content: ""; position: absolute; right: -1px; bottom: -1px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--accent2); border: 2px solid var(--surface);
}
.s-hot { flex-shrink: 0; color: var(--accent2); display: grid; place-items: center; }
.s-hot .ic { width: 14px; height: 14px; }
.s-n { flex-shrink: 0; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }
.s-prog { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--accent); transform-origin: left; transform: scaleX(0); pointer-events: none; }
.s-act { flex-shrink: 0; width: 44px; display: grid; place-items: center; color: var(--muted); }
.s-act .ic { width: 17px; height: 17px; }
.s-act.done { color: var(--accent2); }
.s.hl { box-shadow: inset 0 0 0 2px var(--accent); }

/* ---------- top page ---------- */
.hero { display: flex; align-items: center; gap: 18px; padding: 18px 0 4px; }
.hero-chara { width: 86px; height: 86px; flex-shrink: 0; }
.hero-t { min-width: 0; }
.hero-catch { font-size: 13.5px; color: var(--accent); font-weight: 700; }
.hero-catch b { font-size: 16px; }
.hero h1 { font-size: 26px; font-weight: 900; margin: 3px 0 5px; letter-spacing: -.01em; text-wrap: balance; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero-sub { color: var(--muted); font-size: 13px; }
.hero-sub a { color: var(--accent); text-decoration: underline; }

.qhead { display: flex; align-items: center; gap: 12px; }
.qhead h2 { margin-bottom: 12px; flex: 1; }
.gacha {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  flex-shrink: 0; height: 36px; padding: 0 16px; border-radius: 999px;
  font-size: 12.5px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  transition: transform .1s, filter .1s;
}
.gacha-e { font-size: 15px; line-height: 1; }
.gacha:active { transform: scale(.95); }

.quick-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.qs {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 15px 0 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px; font-size: 13px;
  color: var(--text2); transition: transform .08s, border-color .1s;
}
.qs:active { transform: scale(.95); }
.qs .s-ico { width: 28px; height: 28px; }
.qs-more { color: var(--accent); font-weight: 700; padding: 0 16px; }
.qs-more .ic { width: 15px; height: 15px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.card {
  position: relative; display: flex; flex-direction: column; gap: 3px; padding: 13px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  transition: border-color .12s, transform .08s;
}
.card-rank { position: absolute; top: 10px; right: 12px; font-size: 12px; font-weight: 900; color: var(--accent2); font-variant-numeric: tabular-nums; }
.card-t { font-weight: 800; font-size: 14px; padding-right: 20px; }
.card-c { font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.card-c span { display: inline-block; }
.card-n { font-size: 11px; color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 3px; }
.about p { color: var(--text2); font-size: 13.5px; max-width: 680px; }

.rank { list-style: none; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.rk { display: flex; align-items: center; border-bottom: 1px solid var(--border-soft); }
.rk:last-child { border-bottom: 0; }
.rk-n { width: 38px; flex-shrink: 0; text-align: center; font-weight: 900; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rk:nth-child(-n+3) .rk-n { color: var(--accent2); font-size: 15px; }
.rk .s-main { padding-left: 2px; }
.rk-cat { flex-shrink: 0; margin-right: 12px; font-size: 11px; color: var(--text2); background: var(--bg2); border: 1px solid var(--border-soft); border-radius: 999px; padding: 2px 9px; }

.zukan {
  display: none; align-items: center; gap: 11px; margin-top: 24px; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent2);
  border-radius: var(--r); font-size: 12.5px;
}
.zukan.on { display: flex; }
.zukan-ic { color: var(--accent2); display: grid; place-items: center; }
.zukan-bar { flex: 1; min-width: 60px; height: 8px; border-radius: 999px; background: var(--surface2); overflow: hidden; }
.zukan-fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width .5s cubic-bezier(.2,.9,.3,1); }
.zukan-label { font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.zukan-rank { color: var(--accent); font-weight: 800; white-space: nowrap; font-size: 11.5px; }

.revs { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: thin; }
.rev { flex: 0 0 240px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); }
.rev-t { font-weight: 800; font-size: 13px; margin-bottom: 2px; }
.rev-b { font-size: 12px; color: var(--text2); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.rev-m { font-size: 11px; color: var(--muted); margin-top: 6px; }
.rev-stars { color: var(--accent2); font-size: 11px; letter-spacing: 1px; }

/* ads + adblock fallback */
.adbox { margin: 22px 0; min-height: 1px; }
.adbox-feed { margin: 0; }
.noad { margin: 22px 0; }
.noad iframe { max-width: 560px; display: block; }
.noad-alt { display: flex; gap: 14px; margin-top: 7px; font-size: 11.5px; }
.noad-alt a { color: var(--muted); }
.noad iframe { max-width: 560px; display: block; }
.noad-alt { display: flex; gap: 14px; margin-top: 7px; font-size: 11.5px; }
.noad-alt a { color: var(--muted); }
.noad-alt a:hover { color: var(--accent); }

/* recirculation */
.nextup { margin-top: 26px; }
.nextup-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.nextup-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 16px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text2);
}
.nextup-btn .ic { width: 16px; height: 16px; }
.nextup-sug { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.nextup-lead { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.nextup-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 13px;
  border-radius: 999px; font-size: 12.5px;
  background: var(--gold-soft); border: 1px solid var(--accent2); color: var(--text);
}
.nextup-pill b { font-size: 10.5px; color: var(--accent); font-variant-numeric: tabular-nums; }

.related { margin-top: 26px; }
.related h2 { font-size: 15px; }

/* prev / next as real targets, not footnotes */
.cat-pn { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.pn {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  color: var(--text2); min-width: 0;
}
.pn .ic { width: 18px; height: 18px; flex-shrink: 0; color: var(--muted); }
.pn span { display: flex; flex-direction: column; min-width: 0; }
.pn small { font-size: 10.5px; color: var(--muted); font-weight: 700; letter-spacing: .06em; }
.pn b { font-size: 13.5px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pn i { font-style: normal; font-size: 10.5px; color: var(--accent); font-variant-numeric: tabular-nums; }
.pn-next { justify-content: flex-end; text-align: right; }
.pn-next span { align-items: flex-end; }

/* ---------- footer ---------- */
.foot { margin-top: 44px; border-top: 1px solid var(--border); padding-top: 24px; }
.foot-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; }
.foot-brand { display: flex; align-items: center; gap: 7px; font-weight: 800; margin-bottom: 7px; }
.foot-brand b { color: var(--accent); }
.foot p { font-size: 12.5px; color: var(--text2); margin-bottom: 6px; }
.foot-note { font-size: 11.5px !important; color: var(--muted) !important; line-height: 1.7; }
.foot-h { font-size: 10.5px; font-weight: 800; color: var(--muted); letter-spacing: .09em; margin-bottom: 6px; }
.foot-grid a { display: block; font-size: 13px; color: var(--text2); padding: 3px 0; }
.foot-coin {
  display: flex !important; align-items: center; gap: 9px; padding: 9px 12px !important;
  margin: 2px 0 8px; border: 1px solid var(--accent2); border-radius: var(--r); background: var(--gold-soft);
}
.foot-coin .ic { width: 20px; height: 20px; color: var(--accent2); flex-shrink: 0; }
.foot-coin span { display: flex; flex-direction: column; line-height: 1.35; }
.foot-coin b { font-size: 13px; font-weight: 800; color: var(--text); }
.foot-coin span span, .foot-coin > span > :not(b) { font-size: 11px; color: var(--muted); }
.foot-social { display: flex; gap: 8px; margin-top: 12px; }
.foot-social a { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text2); }
.foot-c { text-align: center; font-size: 11px; color: var(--muted); padding: 24px 0 10px; }

/* ---------- bottom dock (mobile) + player ---------- */
.dock {
  display: none; align-items: stretch;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 55;
  height: var(--dock-total);
  padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
}
.dock-b.on { color: var(--accent); }
.dock-b {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 10.5px; font-weight: 700; color: var(--muted);
}
.dock-b .ic { width: 20px; height: 20px; }
.dock-e { font-size: 19px; line-height: 20px; }
.dock-b:active { color: var(--accent); }

.nowbar {
  position: fixed; left: 50%; bottom: var(--safe-b); transform: translateX(-50%);
  z-index: 60; display: flex; align-items: center; gap: 10px;
  width: min(560px, calc(100vw - 20px)); padding: 8px 10px 8px 8px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border); border-radius: var(--r); box-shadow: 0 12px 34px var(--shadow-lift);
}
.nb-toggle { width: 38px; height: 38px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(140deg, var(--accent), var(--accent2)); color: #fff; }
.nb-toggle .ic { width: 15px; height: 15px; }
.nowbar .i-pause { display: none; }
.nowbar.playing .i-pause { display: block; }
.nowbar.playing .i-play { display: none; }
.nb-info { flex: 1; min-width: 0; }
.nb-name { font-size: 12.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-prog { height: 3px; background: var(--surface2); border-radius: 999px; margin-top: 4px; overflow: hidden; }
.nb-fill { height: 100%; width: 0; background: var(--accent); }
.nb-act { flex-shrink: 0; width: 36px; height: 36px; display: grid; place-items: center; color: var(--text2); border-radius: var(--r-sm); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--safe-b) + 70px); transform: translate(-50%, 12px);
  z-index: 70; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  width: max-content; max-width: min(440px, calc(100vw - 20px));
  padding: 11px 15px; font-size: 13px; line-height: 1.5;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: 0 14px 38px var(--shadow-lift);
  opacity: 0; transition: opacity .22s, transform .22s;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast b { font-weight: 800; }
.toast-sub { display: block; font-size: 11.5px; color: var(--muted); }
.toast-sub a { color: var(--accent); text-decoration: underline; }
.toast-x { flex-shrink: 0; font-size: 12px; font-weight: 800; color: #fff; background: var(--accent); border-radius: var(--r-sm); padding: 7px 13px; }
.toast-pwa { display: flex; align-items: center; gap: 10px; }
.toast-pwa img { flex-shrink: 0; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .chips { display: flex; }
  main { padding: 12px 12px var(--dock-pad, calc(var(--dock-total) + 28px)); }
  .topbar { padding: 0 10px; gap: 8px; }
  .tb-theme { display: none; }
  .searchbox { max-width: none; }
  .logo-t { display: none; }
  .hero { gap: 14px; padding: 10px 0 2px; }
  .hero-chara { width: 64px; height: 64px; }
  .hero h1 { font-size: 21px; }
  .cat-head { padding: 15px 16px 14px; }
  .cat-head h1 { font-size: 19px; }
  section > h2, .qhead h2 { margin: 26px 0 10px; font-size: 15.5px; }
  .foot-grid { grid-template-columns: 1fr; gap: 18px; }
  .cat-pn { grid-template-columns: 1fr; }

  /* the dock owns the bottom; the player replaces it rather than stacking on top */
  .dock { display: flex; }
  /* Bottom stack, from the floor up: dock → player → toast. Each one clears the one
     below it, so nothing can land on the tab bar in standalone PWA either. */
  .nowbar {
    left: 8px; right: 8px; width: auto; transform: none;
    bottom: calc(var(--dock-total) + 8px);
    padding: 7px 8px; box-shadow: 0 6px 22px var(--shadow-lift);
  }
  body.has-player { --dock-pad: calc(var(--dock-total) + 70px); }
  .toast { bottom: calc(var(--dock-total) + 14px); }
  body.has-player .toast { bottom: calc(var(--dock-total) + 76px); }

  /* pill widths were visibly ragged on a narrow screen: one row height, one radius,
     and long labels truncate instead of wrapping the row */
  .qs { height: 38px; max-width: 100%; }
  /* five items in one row overflowed a 430px screen; wrap the rank onto its own line */
  .zukan { flex-wrap: wrap; row-gap: 4px; }
  .zukan-bar { order: 4; flex-basis: 100%; }
  .zukan-rank { order: 3; margin-left: auto; }
  .qs > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .gacha, .nextup-btn, .share-btn { height: 34px; }
}
@media (max-width: 480px) {
  .cards { grid-template-columns: 1fr 1fr; }
  .card-c { display: none; }
  .qhead { flex-wrap: nowrap; }
  .qhead h2::after { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- hero brand line ---------- */
.hero-brand {
  display: block; font-size: 13px; font-weight: 800; letter-spacing: .06em;
  color: var(--accent); margin-bottom: 2px;
}

/* ---------- popular: a ranked list, not another card grid ---------- */
.poplist { list-style: none; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.poplist li { border-bottom: 1px solid var(--border-soft); }
.poplist li:last-child { border-bottom: 0; }
.poplist a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; }
.pop-n {
  width: 26px; height: 26px; flex-shrink: 0; display: grid; place-items: center;
  border-radius: var(--r-sm); font-size: 12.5px; font-weight: 900;
  background: var(--surface2); color: var(--muted); font-variant-numeric: tabular-nums;
}
.pop-1 { background: linear-gradient(145deg, #f2c14e, #c9962a); color: #4a3607 !important; box-shadow: inset 0 1px 0 rgba(255,255,255,.5); }
.pop-2 { background: linear-gradient(145deg, #dcdcdc, #a9adb2); color: #3b3f44 !important; box-shadow: inset 0 1px 0 rgba(255,255,255,.6); }
.pop-3 { background: linear-gradient(145deg, #d8a273, #ab6f42); color: #40230c !important; box-shadow: inset 0 1px 0 rgba(255,255,255,.4); }
.pop-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pop-t b { font-size: 14px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-t i { font-style: normal; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-n2 { flex-shrink: 0; font-size: 14px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.pop-n2 small { font-size: 10px; font-weight: 600; color: var(--muted); margin-left: 1px; }

/* ---------- player extras ---------- */
.nb-act.on { color: var(--accent); background: var(--accent-soft); }
.nb-x { display: none; }
.nb-act .i-load { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- footer, rebuilt as two link cards ---------- */
.foot-grid { grid-template-columns: 1.15fr 1fr; align-items: start; }
.foot-credit { font-size: 12.5px; color: var(--text2); line-height: 1.75; max-width: 30em; }
.foot-credit b { color: var(--accent); font-weight: 800; }
.foot-social { display: flex; gap: 8px; margin-top: 14px; }
.foot-social a, .foot-theme {
  display: grid; place-items: center; width: 38px; height: 38px; padding: 0;
  border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text2);
}
.foot-links { display: flex; flex-direction: column; gap: 8px; }
.foot-card {
  display: flex !important; align-items: center; gap: 11px; padding: 11px 13px !important;
  border: 1px solid var(--border); border-radius: var(--r); background: var(--surface);
}
.foot-card img { flex-shrink: 0; border-radius: var(--r-sm); }
.foot-card > span { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.4; }
.foot-card b { font-size: 13.5px; font-weight: 800; color: var(--text); }
.foot-card i { font-style: normal; font-size: 11.5px; color: var(--muted); }
.foot-card .ic { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.foot-coin img { border-radius: 50%; }

/* ---------- 図鑑 sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 80; }
.sheet-bg { position: absolute; inset: 0; background: rgba(20, 15, 8, .5); opacity: 0; transition: opacity .22s; }
.sheet.on .sheet-bg { opacity: 1; }
.sheet-card {
  position: absolute; left: 50%; bottom: 0; transform: translate(-50%, 100%);
  width: min(460px, 100%); padding: 20px 20px calc(20px + var(--safe-b));
  background: var(--surface); border: 1px solid var(--border); border-bottom: 0;
  border-radius: 16px 16px 0 0; transition: transform .26s cubic-bezier(.2,.9,.3,1);
  max-height: 82vh; overflow-y: auto;
}
.sheet.on .sheet-card { transform: translate(-50%, 0); }
.sheet-x { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; display: grid; place-items: center; color: var(--muted); border-radius: var(--r-sm); }
.sheet-h { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; color: var(--muted); letter-spacing: .08em; }
.sheet-h .ic { width: 16px; height: 16px; color: var(--accent2); }
.sheet-big { font-size: 40px; font-weight: 900; line-height: 1.1; margin: 6px 0 10px; font-variant-numeric: tabular-nums; }
.sheet-big small { font-size: 15px; font-weight: 700; color: var(--muted); }
.sheet-rank { display: flex; align-items: baseline; gap: 9px; margin-top: 9px; font-size: 12.5px; }
.sheet-rank b { font-size: 15px; font-weight: 900; color: var(--accent); }
.sheet-rank span { color: var(--muted); }
.sheet-list { margin: 14px 0 4px; }
.zs-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 9px; }
.zs-row small { font-size: 10px; font-weight: 800; color: var(--muted); letter-spacing: .08em; width: 100%; }
.zs-row a { font-size: 12.5px; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg2); }
.zs-row i { font-style: normal; font-size: 10.5px; color: var(--muted); }
.zs-empty { font-size: 13px; color: var(--muted); line-height: 1.8; margin: 14px 0; }
.sheet-go { width: 100%; margin-top: 6px; height: 42px; }

/* ---------- toast extras ---------- */
.toast-e { font-size: 20px; line-height: 1; }
.toast-tap { display: flex; align-items: center; gap: 11px; text-align: left; width: 100%; }
.toast-tap img { flex-shrink: 0; border-radius: var(--r-sm); }
.toast-tap span { display: flex; flex-direction: column; }
.toast-load { display: flex; align-items: center; gap: 9px; }
.toast-x2 { background: var(--surface2); color: var(--accent); border: 1px solid var(--accent); }
.s-share.loading .ic, .share-btn.loading .ic { animation: spin .9s linear infinite; }

/* ---------- motion: small, opt-out respected ---------- */
@keyframes riseIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.board .s { animation: riseIn .26s ease backwards; }
.board .s:nth-child(1) { animation-delay: .01s; }
.board .s:nth-child(2) { animation-delay: .03s; }
.board .s:nth-child(3) { animation-delay: .05s; }
.board .s:nth-child(4) { animation-delay: .07s; }
.board .s:nth-child(5) { animation-delay: .09s; }
.board .s:nth-child(n+6) { animation: none; }
.card, .poplist li { animation: riseIn .3s ease backwards; }
.poplist li:nth-child(2) { animation-delay: .04s; }
.poplist li:nth-child(3) { animation-delay: .08s; }
.poplist li:nth-child(4) { animation-delay: .12s; }
.poplist li:nth-child(5) { animation-delay: .16s; }
.poplist li:nth-child(6) { animation-delay: .2s; }
@keyframes roll { 50% { transform: rotate(180deg) scale(1.2); } to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .nb-x { display: grid; }
  .nb-act { width: 34px; }
  .foot-grid { grid-template-columns: 1fr; }
}

/* ---------- soundboard pad page ---------- */
.pad {
  display: flex; flex-direction: column; justify-content: space-between; gap: 8px;
  min-height: 78px; padding: 11px 12px; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  position: relative; overflow: hidden; transition: transform .07s, border-color .12s;
}
.pad:active { transform: scale(.97); }
.pad-n {
  font-size: 12.5px; font-weight: 700; color: var(--text2); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pad-b { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.pad-c { font-size: 10px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pad .s-ico { width: 24px; height: 24px; }
.pad .s-ico .ic { width: 11px; height: 11px; }
.pad.playing { background: var(--accent-soft); border-color: var(--accent); }
.pad.playing .pad-n { color: var(--text); }
.pad .s-prog { height: 3px; }
.board-filter { display: flex; gap: 7px; overflow-x: auto; padding: 0 0 12px; scrollbar-width: none; }
.board-filter::-webkit-scrollbar { display: none; }
.board-filter button {
  flex-shrink: 0; font-size: 12.5px; font-weight: 700; padding: 6px 13px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text2); white-space: nowrap;
}
.board-filter button.on { background: var(--accent); border-color: var(--accent); color: #fff; }

@media (max-width: 900px) {
  /* Ragged pill widths stop reading as a mistake once the row is a deliberate swipe
     surface. Two rows, horizontal scroll, snapping — same content, intentional shape. */
  .quick-grid {
    display: flex; flex-wrap: nowrap; gap: 8px;
    overflow-x: auto; scroll-snap-type: x proximity;
    padding: 2px 12px 8px; margin: 0 -12px;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .quick-grid::-webkit-scrollbar { display: none; }
  .qs { scroll-snap-align: start; flex: 0 0 auto; max-width: 74vw; }
  .pads { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  /* two columns truncated every title; one column is easier to scan and leaves room
     for the catchphrase line to come back */
  .cards { grid-template-columns: 1fr; }
  .card-c { display: block; }
  .card { padding: 12px 14px; }
}
.foot-nav { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; }
.foot-nav a { font-size: 12.5px; color: var(--text2); padding: 2px 0; }

/* ---------- action sheet ---------- */
.act-head { display: flex; align-items: center; gap: 10px; margin: 2px 34px 14px 0; }
.act-head .s-ico { width: 32px; height: 32px; }
.act-head b { font-size: 14.5px; font-weight: 800; line-height: 1.4; }
.act-list { display: flex; flex-direction: column; }
.act {
  display: flex; align-items: center; gap: 13px; width: 100%; text-align: left;
  padding: 12px 4px; border-top: 1px solid var(--border-soft); color: var(--text);
}
.act:first-child { border-top: 0; }
.act:active { background: var(--surface2); }
.act .ic { width: 20px; height: 20px; color: var(--accent); }
.act span { display: flex; flex-direction: column; line-height: 1.4; }
.act b { font-size: 13.5px; font-weight: 700; }
.act i { font-style: normal; font-size: 11.5px; color: var(--muted); }

/* ---------- my board ---------- */
.board-empty { text-align: center; padding: 34px 16px 26px; }
.be-art { display: inline-grid; place-items: center; width: 62px; height: 62px; border-radius: 16px; background: var(--gold-soft); color: var(--accent2); margin-bottom: 12px; }
.be-art .ic { width: 30px; height: 30px; }
.board-empty h2 { font-size: 18px; font-weight: 800; margin-bottom: 6px; }
.board-empty p { font-size: 13px; color: var(--muted); line-height: 1.8; }
.be-actions { display: flex; gap: 9px; justify-content: center; flex-wrap: wrap; margin: 18px 0 14px; }
.be-hint { font-size: 11.5px !important; }
.be-hint b { color: var(--accent); }
.pad-x {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 800;
  box-shadow: 0 2px 6px var(--shadow-lift);
}


/* ---------- search landing ---------- */
.srch-hero { padding: 8px 0 4px; }
.srch-hero h1 { font-size: 24px; font-weight: 900; margin-bottom: 12px; }
.srch-open {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 48px; padding: 0 16px;
  border-radius: var(--r); border: 1.5px solid var(--border); background: var(--surface);
  color: var(--muted); font-size: 14px; text-align: left;
}
.srch-open .ic { width: 19px; height: 19px; }
.srch-quick { display: flex; gap: 9px; margin-top: 12px; flex-wrap: wrap; }

/* ---------- library ---------- */
.lib-tabs { display: flex; gap: 7px; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.lib-tabs::-webkit-scrollbar { display: none; }
.lib-tabs button {
  flex-shrink: 0; font-size: 12.5px; font-weight: 700; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text2); white-space: nowrap;
}
.lib-tabs button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.lib-empty { text-align: center; padding: 34px 16px; }
.lib-empty p { font-size: 13px; color: var(--muted); line-height: 1.9; margin-bottom: 14px; }
.lib-empty b { color: var(--accent); }
.zk-card { padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); }
.zk-card .sheet-big { margin-top: 0; }

/* repeat button states */
.nb-act[data-mode="one"] { position: relative; }
.nb-act[data-mode="one"]::after {
  content: "1"; position: absolute; top: 3px; right: 3px;
  font-size: 9px; font-weight: 900; color: var(--accent);
}

/* ---------- board: sixteen slots, one screen ---------- */
.board-main { display: flex; flex-direction: column; }
.bhead { display: flex; align-items: center; gap: 10px; padding: 4px 0 2px; }
.bhead h1 { flex: 1; font-size: 21px; font-weight: 900; }
.bhead-a { display: flex; gap: 6px; }
.ib {
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text2);
}
.ib.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.bhint { font-size: 12px; color: var(--muted); margin: 4px 0 12px; }

.pad-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 1fr;
  gap: 7px;
  /* the whole board should be reachable without scrolling */
  height: min(62vh, 430px);
}
.pad {
  position: relative; overflow: hidden;
  display: grid; place-items: center; padding: 6px 5px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background:
    linear-gradient(155deg, color-mix(in srgb, var(--pad, var(--accent)) 42%, transparent), color-mix(in srgb, var(--pad, var(--accent)) 10%, transparent) 70%),
    var(--surface);
  border-color: color-mix(in srgb, var(--pad, var(--border)) 35%, var(--border));
  transition: transform .07s;
}
.pad:active { transform: scale(.95); }
.pad-n {
  font-size: 10.5px; font-weight: 700; color: var(--text); line-height: 1.35; text-align: center;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  overflow-wrap: anywhere;
}
.pad.playing {
  border-color: var(--pad, var(--accent));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pad, var(--accent)) 30%, transparent);
}
.pad.playing .pad-n { font-weight: 800; }
.pad .s-prog { height: 3px; background: var(--pad, var(--accent)); }
.pad-empty {
  background: transparent; border-style: dashed; color: var(--muted);
  place-content: center; place-items: center;
}
.pad-empty .ic { width: 20px; height: 20px; }
.pad-x {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 800;
}

/* ---------- picker ---------- */
.sheet-tall { max-height: 88vh; display: flex; flex-direction: column; }
.pick-h { font-size: 15px; font-weight: 800; margin: 0 34px 12px 0; }
.pick-search { position: relative; margin-bottom: 10px; }
.pick-search .search-ic { left: 11px; }
#pickQ {
  width: 100%; height: 42px; padding: 0 12px 0 36px; border-radius: var(--r);
  border: 1.5px solid var(--border); background: var(--bg2); color: var(--text);
  font-size: 15px; outline: none; appearance: none;
}
#pickQ:focus { border-color: var(--accent); background: var(--surface); }
.pick-list { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; }
.pick-row {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 11px 6px; border-bottom: 1px solid var(--border-soft);
}
.pick-row:active { background: var(--surface2); }
.pick-n { flex: 1; min-width: 0; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* gacha living inside the quick list */
.qs-gacha {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-color: transparent; color: #fff; font-weight: 800; padding: 0 16px 0 12px;
}
.qs-e { font-size: 16px; line-height: 1; }

@media (min-width: 901px) {
  .pad-grid { max-width: 620px; height: 420px; }
}
@media (max-width: 380px) {
  .pad-grid { grid-template-columns: repeat(3, 1fr); height: min(60vh, 420px); }
}


/* Hover effects only where a real pointer exists. On touch, a :hover rule makes the
   first tap register as hover and the second as the click — every button felt broken. */
@media (hover: hover) and (pointer: fine) {
  .sr-row:hover { background: var(--surface2); }
  .tb-btn:hover { color: var(--text); background: var(--surface2); }
  .side a:hover { background: var(--surface2); color: var(--text); }
  .share-btn:hover, .share-btn.done { color: var(--accent); border-color: var(--accent); }
  .s-main:hover { background: var(--surface2); }
  .s-main:hover .s-ico { transform: scale(1.07); }
  .s-act:hover { color: var(--accent); background: var(--surface2); }
  .gacha:hover { filter: brightness(1.06); }
  .qs:hover { border-color: var(--accent); color: var(--text); }
  .card:hover { border-color: var(--accent); transform: translateY(-2px); }
  .nextup-btn:hover { border-color: var(--accent); color: var(--accent); }
  .nextup-pill:hover { background: var(--accent2); color: #40260a; }
  .nextup-pill:hover b { color: #40260a; }
  .pn:hover { border-color: var(--accent); color: var(--text); }
  .pn:hover .ic { color: var(--accent); }
  .foot-grid a:hover { color: var(--accent); }
  .foot-social a:hover { border-color: var(--accent); color: var(--accent); }
  .nb-act:hover { color: var(--accent); background: var(--surface2); }
  .poplist a:hover { background: var(--surface2); }
  .foot-social a:hover, .foot-theme:hover { border-color: var(--accent); color: var(--accent); }
  .foot-card:hover { border-color: var(--accent); }
  .zs-row a:hover { border-color: var(--accent); color: var(--accent); }
  .gacha:hover .gacha-e { animation: roll .5s ease; }
  .pad:hover { border-color: var(--accent); }
  .foot-nav a:hover { color: var(--accent); }
  .srch-open:hover { border-color: var(--accent); }
  .ib:hover { border-color: var(--accent); color: var(--accent); }
  .pad-empty:hover { border-color: var(--accent); color: var(--accent); }
  .qs-gacha:hover .qs-e { animation: roll .5s ease; }
}

/* ---------- board editing ---------- */
.pad.editing { animation: wobble .3s ease-in-out infinite alternate; overflow: visible; }
.pad.editing:nth-child(even) { animation-delay: -.15s; }
@keyframes wobble { from { transform: rotate(-1deg); } to { transform: rotate(1deg); } }
.pad.dragging { opacity: .4; }
.pad.drop-target { outline: 2px dashed var(--accent); outline-offset: 2px; }

/* ---------- non-verbal loading ---------- */
/* A progress ring on the element you just pressed, instead of a sentence in a toast. */
.busy { position: relative; pointer-events: none; }
.busy > * { opacity: .25; }
.busy::after {
  content: ""; position: absolute; inset: 50% auto auto 50%;
  width: 20px; height: 20px; margin: -10px 0 0 -10px;
  border: 2.5px solid color-mix(in srgb, currentColor 25%, transparent);
  border-top-color: currentColor; border-radius: 50%;
  animation: spin .7s linear infinite;
}
.ring { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(3px); }
.ring[hidden] { display: none; }
.ring-box { display: grid; place-items: center; }
.ring-box > * { grid-area: 1 / 1; }
.ring-box > svg { width: 76px; height: 76px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 5; stroke-linecap: round; }
.ring .r-bg { stroke: var(--border); }
.ring .r-fg { stroke: var(--accent); transition: stroke-dashoffset .12s linear; }
.ring-ic { color: var(--accent); display: grid; place-items: center; }
.ring-ic .ic { width: 26px; height: 26px; }

/* ---------- toast: icon-led ---------- */
.toast-i {
  width: 32px; height: 32px; flex-shrink: 0; display: grid; place-items: center;
  border-radius: 50%; background: var(--accent-soft); color: var(--accent);
}
.toast-i .ic { width: 17px; height: 17px; }
.toast-i.good { background: color-mix(in srgb, #2e9e5b 14%, transparent); color: #2e9e5b; }
.toast-i.gold { background: var(--gold-soft); color: var(--accent2); }
.toast-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* iOS haptic shim: an invisible label over each control so the real tap lands on a
   switch input. Safari ticks the Taptic Engine only for genuine taps, never for
   script-driven clicks. */
.hap {
  position: absolute; inset: 0; z-index: 1;
  cursor: inherit; -webkit-tap-highlight-color: transparent;
}
/* the remove badge must stay above its pad's haptic overlay */
.pad-x { z-index: 3; }
/* On a phone the OS share sheet already offers "ファイルに保存", so a separate download
   icon is a second door to the same room. One action, less to decide. */
@media (max-width: 900px) {
  .s-dl { display: none; }
}

/* card: count on the trailing edge, text takes the rest */
.card { flex-direction: row; align-items: center; gap: 10px; }
.card-x { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.card-n { margin-top: 0; flex-shrink: 0; font-size: 15px; font-weight: 800; text-align: right; }
.card-n small { display: block; font-size: 9.5px; font-weight: 600; color: var(--muted); }
.card-rank { position: static; order: -1; }

.blead { font-size: 14.5px; font-weight: 800; margin: 2px 0 4px; }
.bhint { font-size: 12px; color: var(--muted); margin: 0 0 12px; }

/* ---------- desktop main nav (sidebar) ---------- */
.snav { display: flex; flex-direction: column; gap: 2px; padding: 4px 0 10px; margin-bottom: 6px; border-bottom: 1px solid var(--border-soft); }
.snav-b { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-sm); font-size: 13.5px; font-weight: 700; color: var(--text2); }
.snav-b .ic { width: 19px; height: 19px; }
.snav-b.on { color: var(--accent); background: var(--accent-soft); }
@media (max-width: 900px) { .snav { display: none; } }

/* labelled toggle (rhythm) */
.tb-lbl {
  display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text2); font-size: 12.5px; font-weight: 700;
}
.tb-lbl .ic { width: 16px; height: 16px; }
.tb-lbl.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.tb-lbl.on .ic { animation: tick .5s ease-in-out infinite alternate; }
@keyframes tick { from { transform: rotate(-12deg); } to { transform: rotate(12deg); } }

/* progress you can see without counting */
.catbar { display: block; width: 100%; height: 4px; border-radius: 999px; background: var(--surface2); overflow: hidden; margin-top: 8px; }
.catbar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s; }
.catbar.full i { background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.sb-bar { position: absolute; left: 10px; right: 10px; bottom: 2px; height: 2px; border-radius: 999px; overflow: hidden; }
.sb-bar i { display: block; height: 100%; background: var(--accent); opacity: .55; }
.side a { position: relative; }
.s.heard .s-name { color: var(--muted); }

/* new sound unlocked */
.unlocked { animation: unlock .65s cubic-bezier(.2,.9,.3,1); }
@keyframes unlock {
  0% { box-shadow: inset 0 0 0 0 var(--accent-soft); }
  35% { box-shadow: inset 0 0 0 3px var(--accent); background: var(--accent-soft); }
  100% { box-shadow: inset 0 0 0 0 transparent; }
}

/* desktop: the action sheet becomes a centred dialog */
@media (min-width: 901px) {
  .sheet-card {
    left: 50%; top: 50%; bottom: auto;
    transform: translate(-50%, -46%) scale(.97);
    width: min(400px, 92vw); border-radius: 14px; border-bottom: 1px solid var(--border);
    padding: 22px 22px 18px; opacity: 0;
    transition: transform .18s cubic-bezier(.2,.9,.3,1), opacity .18s;
  }
  .sheet.on .sheet-card { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  .sheet-tall { max-height: 74vh; }
}

/* ---------- temporary cross-promo strip ---------- */
.promo {
  position: fixed; left: 8px; right: 8px; z-index: 58;
  bottom: calc(var(--dock-total) + 8px);
  display: flex; align-items: stretch; gap: 2px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border); border-left: 3px solid #d6402f;
  border-radius: var(--r); box-shadow: 0 6px 22px var(--shadow-lift);
  overflow: hidden;
  animation: promoIn .34s cubic-bezier(.2,.9,.3,1) both;
}
@keyframes promoIn { from { opacity: 0; transform: translateY(10px); } }
.promo-a { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 9px 4px 9px 11px; }
.promo-a:active { background: var(--surface2); }
.promo-mark { width: 28px; height: 28px; flex-shrink: 0; border-radius: 7px; }
.promo-t { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.promo-t b { font-size: 13.5px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.promo-t span { font-size: 10.5px; color: var(--muted); }
.promo-pct {
  flex-shrink: 0; font-size: 10.5px; color: var(--muted); text-align: right; line-height: 1.2;
}
.promo-pct b { display: block; font-size: 16px; font-weight: 900; color: #d6402f; font-variant-numeric: tabular-nums; }
.promo-a .ic { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.promo-x {
  flex-shrink: 0; width: 38px; display: grid; place-items: center;
  color: var(--muted); border-left: 1px solid var(--border-soft);
}
.promo-x .ic { width: 15px; height: 15px; }

/* stack upward: dock → promo → player → toast */
body.has-promo .nowbar { bottom: calc(var(--dock-total) + 62px); }
body.has-promo.has-player { --dock-pad: calc(var(--dock-total) + 124px); }
body.has-promo:not(.has-player) { --dock-pad: calc(var(--dock-total) + 80px); }
body.has-promo .toast { bottom: calc(var(--dock-total) + 68px); }
body.has-promo.has-player .toast { bottom: calc(var(--dock-total) + 130px); }

@media (min-width: 901px) {
  /* no dock on desktop, so it sits on the floor and stays out of the player's lane */
  .promo { left: auto; right: 16px; width: 340px; bottom: var(--safe-b); }
  body.has-promo .nowbar { bottom: var(--safe-b); }
  body.has-promo .toast, body.has-promo.has-player .toast { bottom: calc(var(--safe-b) + 70px); }
}
