/* なにこれカメラ — ファインダー／HUD のデザイン */
:root {
  --ink: #0a0a0b;
  --ink-2: #141416;
  --ink-3: #1e1e22;
  --line: #303036;
  --yellow: #ffd60a;
  --yellow-ink: #1a1500;
  --paper: #f4f1e8;
  --mute: #aaa79f;
  --signal: #ff6a55;
  --f-ja: "M PLUS 1", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  --f-mono: "Martian Mono", "M PLUS 1", ui-monospace, "SFMono-Regular", monospace;
  --r-s: 4px;
  --r-m: 12px;
  --r-l: 22px;
  --dial-h: 52px;
  --deck-h: 104px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --t-fast: 140ms;
  --t-mid: 240ms;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: #050506;
  color: var(--paper);
  font-family: var(--f-ja);
  font-size: 15px;
  line-height: 1.7;
  line-break: strict;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
h1, h2, h3, p { margin: 0; }
h1, h2, h3, .gate__title, .onboard__title { font-feature-settings: "palt"; word-break: keep-all; overflow-wrap: anywhere; }
/* 短いラベル・1行の文は文節で折り返す（段落・説明文は word-break: normal のまま） */
.toast__msg, .found__none, .loader__sub, .tech span, .frame__names { word-break: keep-all; overflow-wrap: anywhere; }
.gate__title > span, .strip__pick > span > span { display: block; }
button { font: inherit; color: inherit; }
a { color: inherit; }
img { display: block; }
[hidden] { display: none !important; }
.mono { font-family: var(--f-mono); font-feature-settings: "tnum"; letter-spacing: 0; }
.nw { white-space: nowrap; }
:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }

/* PC 等の広い画面では中央の列に収める */
@media (min-width: 600px) {
  body {
    background:
      linear-gradient(90deg, rgba(255, 214, 10, .06) 1px, transparent 1px) 0 0 / 48px 48px,
      linear-gradient(rgba(255, 214, 10, .06) 1px, transparent 1px) 0 0 / 48px 48px,
      #050506;
  }
}

.app {
  position: relative;
  width: 100%;
  max-width: 430px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--ink);
  isolation: isolate;
}

/* ---------- 画面 ---------- */
.screens { position: absolute; inset: 0; }
.scr { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--ink); overflow: hidden; }
.scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--dial-h) + var(--safe-b) + 28px);
}
.scr--push { z-index: 3; }

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 22px;
  border: 0; border-radius: 999px;
  font-weight: 700; font-size: 16px; letter-spacing: .02em; text-decoration: none;
  cursor: pointer; white-space: nowrap;
  transition: transform var(--t-fast) var(--ease), background-color var(--t-fast);
}
.btn:active { transform: scale(.96); }
.btn--block { display: flex; width: 100%; }
.btn--primary { background: var(--yellow); color: var(--ink); }
.btn--ghost { background: var(--ink-3); color: var(--paper); box-shadow: inset 0 0 0 1px var(--line); }
.btn--danger { background: #2a1512; color: #ffb3a6; box-shadow: inset 0 0 0 1px #5a2a22; }
.btn--small { min-height: 44px; padding: 0 16px; font-size: 14px; background: var(--ink-3); color: var(--paper); box-shadow: inset 0 0 0 1px var(--line); }
.btn[disabled] { opacity: .7; }
.icon-btn {
  display: grid; place-items: center; width: 44px; height: 44px; flex: none;
  border: 0; border-radius: 50%; background: rgba(20, 20, 22, .72); color: var(--paper); cursor: pointer;
  transition: transform var(--t-fast) var(--ease);
}
.icon-btn:active { transform: scale(.88); }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--yellow); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- ファインダー ---------- */
.vf { position: relative; overflow: hidden; background: #000; touch-action: pan-y; }
.vf--full { position: absolute; inset: 0; }
.vf__media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.vf--detail .vf__media { object-fit: contain; }
#cam-video.is-mirror { transform: scaleX(-1); }
.vf__preview { transition: filter var(--t-mid); }
.vf__preview.is-dim { filter: brightness(.35) saturate(.6) blur(2px); }
.app[data-screen="camera"] .vf--full::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(10, 10, 11, .55) 0, transparent 22%, transparent 45%, rgba(10, 10, 11, .78) 72%, rgba(10, 10, 11, .96) 100%);
}
.app.cam-live[data-screen="camera"] .vf--full::after { background: linear-gradient(180deg, rgba(10, 10, 11, .5) 0, transparent 18%, transparent 78%, rgba(10, 10, 11, .55) 100%); }
.vf__boxes { position: absolute; inset: 0; z-index: 2; }
.vf__reticle { position: absolute; inset: 14px; pointer-events: none; z-index: 1; }
.vf--full .vf__reticle { top: calc(var(--safe-t) + 70px); bottom: calc(var(--dial-h) + var(--deck-h) + var(--safe-b) + 54px); }
.vf__reticle i { position: absolute; width: 22px; height: 22px; border: 0 solid rgba(244, 241, 232, .7); }
.vf__reticle i:nth-child(1) { left: 0; top: 0; border-left-width: 2px; border-top-width: 2px; }
.vf__reticle i:nth-child(2) { right: 0; top: 0; border-right-width: 2px; border-top-width: 2px; }
.vf__reticle i:nth-child(3) { left: 0; bottom: 0; border-left-width: 2px; border-bottom-width: 2px; }
.vf__reticle i:nth-child(4) { right: 0; bottom: 0; border-right-width: 2px; border-bottom-width: 2px; }
.vf__reticle::after { content: ""; position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px;
  background: linear-gradient(rgba(244, 241, 232, .6), rgba(244, 241, 232, .6)) center / 2px 100% no-repeat, linear-gradient(rgba(244, 241, 232, .6), rgba(244, 241, 232, .6)) center / 100% 2px no-repeat; }
.vf__flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 5; }
.vf__flash.is-on { animation: flash .38s ease-out; }
@keyframes flash { 0% { opacity: .85; } 100% { opacity: 0; } }

/* 認識枠：四隅のブラケット＋細い枠 */
.bx {
  position: absolute; left: 0; top: 0;
  --c: var(--yellow);
  border: 1px solid rgba(255, 214, 10, .5);
  background:
    linear-gradient(var(--c), var(--c)) left top / 16px 3px no-repeat,
    linear-gradient(var(--c), var(--c)) left top / 3px 16px no-repeat,
    linear-gradient(var(--c), var(--c)) right top / 16px 3px no-repeat,
    linear-gradient(var(--c), var(--c)) right top / 3px 16px no-repeat,
    linear-gradient(var(--c), var(--c)) left bottom / 16px 3px no-repeat,
    linear-gradient(var(--c), var(--c)) left bottom / 3px 16px no-repeat,
    linear-gradient(var(--c), var(--c)) right bottom / 16px 3px no-repeat,
    linear-gradient(var(--c), var(--c)) right bottom / 3px 16px no-repeat;
  transform-origin: center;
  transition: opacity var(--t-fast);
  will-change: transform;
  cursor: pointer;
}
.bx > .bx__tag { animation: tagin .32s var(--ease) both; animation-delay: inherit; }
.bx:not(.bx--still) { animation: lock .34s var(--ease) both; }
@keyframes lock {
  0% { opacity: 0; box-shadow: 0 0 0 18px rgba(255, 214, 10, 0); }
  40% { opacity: 1; box-shadow: 0 0 0 6px rgba(255, 214, 10, .35); }
  100% { opacity: 1; box-shadow: 0 0 0 0 rgba(255, 214, 10, 0); }
}
@keyframes tagin { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.bx--still > .bx__tag, .is-quiet .rl__bar i { animation: none; }
.bx--out { opacity: 0; }
.bx--weak { opacity: .55; }
.bx__tag {
  position: absolute; left: -1px; bottom: 100%; margin-bottom: 3px;
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 2px 7px 3px; border-radius: var(--r-s);
  background: var(--yellow); color: var(--ink);
  font-size: 14px; line-height: 1.35; white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
}
.bx__tag b { font-weight: 800; }
.bx__tag .mono { font-size: 11px; font-weight: 700; }
.bx--in .bx__tag { bottom: auto; top: var(--tag-top, 4px); left: 4px; margin: 0; }
.bx--right .bx__tag { left: auto; right: -1px; }
.bx--right.bx--in .bx__tag { right: 4px; }
.has-hi .bx:not(.is-hi) { opacity: .22; }
.bx.is-hi { --c: #fff; border-color: #fff; z-index: 3; }
.bx.is-hi .bx__tag { background: #fff; }

/* 走査線（解析中） */
.vf__scan { position: absolute; inset: 0; pointer-events: none; z-index: 3; opacity: 0; }
.is-scan .vf__scan { opacity: 1; }
.is-scan .vf__scan::before {
  content: ""; position: absolute; left: 0; right: 0; height: 90px; top: -90px;
  background: linear-gradient(180deg, rgba(255, 214, 10, 0), rgba(255, 214, 10, .28) 85%, var(--yellow) 100%);
  animation: scan 1s linear infinite;
}
@keyframes scan { to { transform: translateY(calc(100% + 600px)); } }
.vf--sample.is-kept { animation: kept .5s var(--ease); }
@keyframes kept { 0% { filter: brightness(2); } 100% { filter: none; } }

/* ---------- HUD ---------- */
.hud { position: absolute; z-index: 4; left: 0; right: 0; display: flex; align-items: center; gap: 8px; padding: 0 12px; pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud--top { top: calc(var(--safe-t) + 10px); }
.hud--sample { top: 10px; }
.hud__state {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px;
  border-radius: var(--r-s); background: rgba(10, 10, 11, .78);
  font-size: 13px; font-weight: 700; letter-spacing: .04em; white-space: nowrap;
}
.hud__state .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mute); flex: none; }
.hud__state.is-live .dot, .hud__state.is-on .dot { background: var(--yellow); box-shadow: 0 0 0 4px rgba(255, 214, 10, .2); animation: pulse 1.6s ease-in-out infinite; }
.hud__state.is-wait .dot { background: var(--signal); }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(255, 214, 10, 0); } }
.hud__metrics {
  margin-left: auto; height: 32px; display: inline-flex; align-items: center; padding: 0 10px;
  border-radius: var(--r-s); background: rgba(10, 10, 11, .78); color: var(--paper);
  font-size: 12px; white-space: nowrap;
}

/* ---------- カメラ：起動前 ---------- */
.gate, .cam-msg {
  position: absolute; z-index: 5; left: 12px; right: 12px;
  bottom: calc(var(--dial-h) + var(--safe-b) + 14px);
  padding: 22px 20px 18px; border-radius: var(--r-l);
  background: rgba(14, 14, 16, .9);
  -webkit-backdrop-filter: blur(18px) saturate(1.2); backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07), 0 20px 50px rgba(0, 0, 0, .5);
  display: flex; flex-direction: column; gap: 10px;
}
.gate__eyebrow { font-size: 12px; color: var(--yellow); letter-spacing: .02em; }
.gate__title { font-size: 30px; line-height: 1.3; font-weight: 800; letter-spacing: -.01em; }
.gate__text { color: #d8d5cc; font-size: 15px; margin-bottom: 6px; }
.cam-msg { align-items: stretch; }
.cam-msg__icon { color: var(--yellow); }
.cam-msg__title { font-size: 21px; font-weight: 800; line-height: 1.4; }
.cam-msg__text { color: #d8d5cc; font-size: 15px; margin-bottom: 6px; }

.loader { position: absolute; z-index: 6; left: 50%; top: 42%; transform: translate(-50%, -50%); width: 260px; padding: 20px 16px; border-radius: var(--r-l); background: rgba(10, 10, 11, .86); text-align: center; display: grid; justify-items: center; gap: 6px; }
.loader--inline { top: 50%; }
.loader__ring { position: relative; width: 72px; height: 72px; }
.loader__ring svg { width: 72px; height: 72px; transform: rotate(-90deg); }
.loader__ring circle { fill: none; stroke: var(--line); stroke-width: 4; }
.loader__ring .loader__bar { stroke: var(--yellow); stroke-linecap: round; transition: stroke-dashoffset .25s; }
.loader__pct { position: absolute; inset: 0; display: grid; place-items: center; font-size: 14px; font-weight: 700; }
.loader__text { font-weight: 700; font-size: 15px; }
.loader__sub { font-size: 12px; color: #d8d5cc; line-height: 1.6; word-break: keep-all; }

.found {
  position: absolute; z-index: 4; left: 0; right: 0;
  bottom: calc(var(--dial-h) + var(--deck-h) + var(--safe-b) + 8px);
  display: flex; gap: 6px; padding: 0 12px; overflow-x: auto; scrollbar-width: none; min-height: 36px; align-items: center;
}
.found::-webkit-scrollbar { display: none; }
.app:not(.cam-live) .found { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: baseline; gap: 6px; height: 34px; padding: 6px 12px 0;
  border-radius: var(--r-s); background: rgba(10, 10, 11, .8); box-shadow: inset 3px 0 0 var(--yellow);
  font-size: 14px; white-space: nowrap;
}
.chip b { font-weight: 700; }
.chip .mono { font-size: 12px; color: var(--yellow); }
.found__none { margin: 0 auto; padding: 4px 14px; border-radius: var(--r-s); background: rgba(10, 10, 11, .8); font-size: 14px; word-break: keep-all; }

/* ---------- デッキ（シャッター段）---------- */
.deck {
  position: absolute; z-index: 8; left: 0; right: 0; bottom: calc(var(--dial-h) + var(--safe-b));
  height: var(--deck-h); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 22px;
  background: var(--ink);
  transition: transform var(--t-mid) var(--ease), opacity var(--t-mid);
}
.app[data-screen="camera"] .deck { background: rgba(10, 10, 11, .5); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.app:not([data-screen="camera"]) .deck,
.app[data-screen="camera"]:not(.cam-live) .deck { transform: translateY(30px); opacity: 0; pointer-events: none; visibility: hidden; }
.deck__side { display: flex; align-items: center; }
.deck__side--r { justify-content: flex-end; }
.shutter {
  width: 76px; height: 76px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  background: transparent; box-shadow: inset 0 0 0 4px var(--paper); display: grid; place-items: center;
}
.shutter__in { width: 60px; height: 60px; border-radius: 50%; background: var(--yellow); transition: transform var(--t-fast) var(--ease); }
.shutter:active .shutter__in { transform: scale(.82); }
.deck__btn {
  display: grid; place-items: center; min-width: 52px; height: 52px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  background: rgba(40, 40, 44, .9); color: var(--paper); transition: transform var(--t-fast) var(--ease);
}
.deck__btn:active { transform: scale(.88); }
.deck__btn--lbl { border-radius: var(--r-m); height: auto; min-height: 56px; padding: 6px 10px; gap: 2px; background: transparent; }
.deck__btn--lbl span { font-size: 12px; font-weight: 700; white-space: nowrap; }
.deck__thumb { display: block; width: 52px; height: 52px; border-radius: var(--r-m); overflow: hidden; box-shadow: inset 0 0 0 2px var(--paper); background: var(--ink-3); transition: transform var(--t-fast) var(--ease); }
.deck__thumb:active { transform: scale(.9); }
.deck__thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- モードダイヤル ---------- */
.dial {
  position: absolute; z-index: 9; left: 0; right: 0; bottom: 0;
  height: calc(var(--dial-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: var(--ink); overflow: hidden; touch-action: pan-y;
}
.app[data-screen="detail"] .dial, .app[data-screen="settings"] .dial, .app[data-screen="about"] .dial { transform: translateY(100%); }
.dial { transition: transform var(--t-mid) var(--ease); }
.dial__track { display: flex; gap: 6px; height: var(--dial-h); align-items: center; width: max-content; transition: transform .32s var(--ease); }
.dial__track a {
  position: relative; display: grid; place-items: center; min-height: 44px; padding: 0 12px;
  color: var(--mute); font-size: 14px; font-weight: 700; letter-spacing: .06em; text-decoration: none; white-space: nowrap;
  transition: color var(--t-fast);
}
.dial__track a.is-on { color: var(--yellow); }
.dial__track a.is-on::after { content: ""; position: absolute; left: 50%; bottom: 3px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--yellow); }
.dial::after { content: ""; position: absolute; inset: 0 0 var(--safe-b); pointer-events: none;
  background: linear-gradient(90deg, var(--ink) 0, rgba(10, 10, 11, 0) 16%, rgba(10, 10, 11, 0) 84%, var(--ink) 100%); }
.dial::before { content: ""; position: absolute; left: 50%; top: 0; width: 1px; height: 8px; background: var(--line); }

/* ---------- 見本で試す ---------- */
.vf--sample { flex: none; height: min(57vh, 520px); height: min(57dvh, 520px); margin-top: var(--safe-t); }
.strip__pick {
  flex: none; width: 64px; height: 78px; border: 0; border-radius: var(--r-s); cursor: pointer; padding: 0;
  display: grid; place-content: center; justify-items: center; gap: 4px;
  background: var(--ink-3); color: var(--paper); box-shadow: inset 0 0 0 1px var(--line);
  font-size: 12px; font-weight: 700; line-height: 1.3; text-align: center; transition: transform var(--t-fast) var(--ease);
}
.strip__pick:active { transform: scale(.92); }
.keep {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px 0 14px; margin-left: 4px;
  border: 0; border-radius: 999px; background: var(--yellow); color: var(--ink); font-weight: 700; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: transform var(--t-fast) var(--ease);
}
.keep:active { transform: scale(.94); }
.keep__dot { width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--ink); }
.keep.is-done .keep__dot { background: var(--ink); }
.result__head { align-items: center; }
.vf--sample .vf__reticle { inset: 54px 14px 14px; }
.strip { display: flex; gap: 8px; padding: 12px 16px 4px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
.strip::-webkit-scrollbar { display: none; }
.strip__it {
  flex: none; width: 52px; height: 78px; padding: 0; border: 0; border-radius: var(--r-s); overflow: hidden; cursor: pointer;
  background: var(--ink-3); opacity: .6; scroll-snap-align: center;
  transition: opacity var(--t-fast), transform var(--t-fast) var(--ease), box-shadow var(--t-fast);
}
.strip__it img { width: 100%; height: 100%; object-fit: cover; }
.strip__it.is-on { opacity: 1; box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--yellow); }
.strip__it:active { transform: scale(.92); }
.notice { margin: 12px 16px 0; padding: 14px 16px; border-radius: var(--r-m); background: #2a2207; color: #ffe680; font-size: 14px; display: grid; gap: 10px; justify-items: start; box-shadow: inset 0 0 0 1px #5c4a05; }

.result { padding: 18px 16px 0; }
.result__head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.result__title { font-size: 20px; font-weight: 800; }
.result__count { margin-left: auto; font-size: 12px; color: var(--yellow); white-space: nowrap; }
.result__list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.result__list li { border-bottom: 1px solid var(--line); }
.rl {
  display: grid; grid-template-columns: 30px 1fr 64px 44px; align-items: center; gap: 10px;
  width: 100%; min-height: 58px; padding: 8px 2px; border: 0; background: transparent; text-align: left; cursor: pointer;
  transition: background-color var(--t-fast);
}
.rl:active { background: var(--ink-3); }
.is-hi .rl { background: #262109; }
.rl__no { font-size: 12px; color: var(--mute); }
.rl__name { display: grid; line-height: 1.35; min-width: 0; }
.rl__name b { font-size: 16px; font-weight: 700; }
.rl__en { font-size: 12px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rl__cat { font-family: var(--f-ja); font-size: 12px; }
.rl__bar { height: 6px; border-radius: 3px; background: var(--ink-3); overflow: hidden; }
.rl__bar i { display: block; height: 100%; background: var(--yellow); border-radius: 3px; transform-origin: left; animation: grow .6s var(--ease) both; }
@keyframes grow { from { transform: scaleX(0); } }
.rl__pct { font-size: 13px; text-align: right; font-weight: 700; }
.rl-empty { padding: 18px 4px; color: #d8d5cc; font-size: 15px; }
.sk { height: 58px; display: flex; align-items: center; padding: 0 4px; }
.sk span { display: block; width: 100%; height: 18px; border-radius: var(--r-s); background: linear-gradient(90deg, var(--ink-2), var(--ink-3), var(--ink-2)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.result__hint { margin-top: 12px; color: var(--mute); font-size: 14px; }

/* ---------- ページ見出し ---------- */
.page-head { position: relative; padding: calc(var(--safe-t) + 22px) 16px 14px; }
.page-head__eyebrow { color: var(--yellow); font-size: 12px; letter-spacing: .12em; }
.page-head__title { font-size: 34px; font-weight: 800; line-height: 1.25; letter-spacing: -.01em; }
.page-head__meta { position: absolute; right: 16px; bottom: 20px; font-size: 12px; color: var(--mute); }
.page-head__act { position: absolute; right: 12px; top: calc(var(--safe-t) + 22px); background: var(--ink-3); }

/* 見つけた種類メーター */
.dex {
  display: block; width: calc(100% - 32px); margin: 0 16px 6px; padding: 14px 14px 12px; text-align: left; cursor: pointer;
  border: 0; border-radius: var(--r-m); background: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line);
  transition: transform var(--t-fast) var(--ease);
}
.dex:active { transform: scale(.98); }
.dex__head { display: flex; align-items: baseline; justify-content: space-between; }
.dex__label { font-weight: 700; font-size: 15px; }
.dex__num { font-size: 12px; color: var(--mute); }
.dex__num b { font-size: 24px; color: var(--yellow); font-weight: 700; margin-right: 2px; }
.dex__grid { display: grid; grid-template-columns: repeat(20, 1fr); gap: 3px; margin: 10px 0 8px; }
.dex__grid i { aspect-ratio: 1; border-radius: 1px; background: var(--ink-3); }
.dex__grid i.on { background: var(--yellow); }
.dex__more { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; color: var(--yellow); font-weight: 700; }

/* 日付ごとのコンタクトシート */
.day { margin-top: 18px; }
.day__head { display: flex; align-items: baseline; gap: 10px; padding: 0 16px 8px; }
.day__rel { font-size: 17px; font-weight: 800; }
.day__mono { font-size: 12px; color: var(--mute); }
.sheetgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 0 3px; }
.frame { position: relative; display: block; aspect-ratio: 3 / 4; overflow: hidden; background: var(--ink-2); text-decoration: none; transition: transform var(--t-fast) var(--ease); }
.frame:active { transform: scale(.97); }
.frame__img { position: absolute; inset: 0; width: 100%; height: 100%; }
.th-boxes rect { fill: none; stroke: var(--yellow); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.frame__src { position: absolute; left: 6px; top: 6px; padding: 1px 6px; border-radius: var(--r-s); background: rgba(10, 10, 11, .82); font-size: 12px; color: var(--paper); }
.frame__cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 8px 7px; background: rgba(10, 10, 11, .86); display: grid; gap: 1px; }
.frame__names { word-break: keep-all; font-size: 14px; font-weight: 700; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.frame__meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--yellow); }

.empty { position: relative; margin: 18px 16px 0; border-radius: var(--r-l); overflow: hidden; background: var(--ink-2); }
.empty img { width: 100%; height: 260px; object-fit: cover; object-position: center 30%; }
.empty__body { padding: 18px 18px 20px; display: grid; gap: 8px; justify-items: start; }
.empty__title { font-size: 22px; font-weight: 800; line-height: 1.35; }
.empty__text { color: #d8d5cc; }
.empty--small { padding: 28px 18px; display: grid; gap: 10px; justify-items: start; }

/* ---------- アプリバー（プッシュ画面） ---------- */
.appbar { position: relative; z-index: 2; display: flex; align-items: center; gap: 8px; padding: calc(var(--safe-t) + 6px) 8px 6px; background: var(--ink); border-bottom: 1px solid var(--line); }
.appbar .icon-btn { background: transparent; }
.appbar__title { flex: 1; text-align: center; font-size: 16px; font-weight: 700; white-space: nowrap; }
p.appbar__title { font-size: 13px; }
.appbar__sp { width: 44px; flex: none; }
.vf--detail { width: 100%; max-height: 62vh; max-height: 62dvh; aspect-ratio: 2 / 3; }
.det-actions { display: grid; gap: 10px; margin-top: 20px; }

/* ---------- しくみ ---------- */
.how-lead { padding: 0 16px; font-size: 17px; font-weight: 500; line-height: 1.75; }
.pipe { list-style: none; margin: 20px 16px 8px; padding: 0; position: relative; }
.pipe::before { content: ""; position: absolute; left: 17px; top: 18px; bottom: 18px; width: 2px; background: repeating-linear-gradient(var(--yellow) 0 6px, transparent 6px 10px); }
.pipe__step { position: relative; display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; padding: 10px 0 14px; }
.pipe__no { position: relative; display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-s); background: var(--yellow); color: var(--ink); font-size: 12px; font-weight: 700; }
.pipe__step h3 { font-size: 16px; font-weight: 800; line-height: 1.45; margin-top: 4px; }
.pipe__step p { font-size: 14px; color: #d8d5cc; margin-top: 2px; }
.pipe__val { align-self: start; margin-top: 7px; padding: 2px 6px; border-radius: var(--r-s); box-shadow: inset 0 0 0 1px var(--line); font-size: 12px; color: var(--yellow); white-space: nowrap; }
.sec-title { margin: 28px 16px 10px; font-size: 19px; font-weight: 800; }
.meter { margin: 0 16px 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border-radius: var(--r-m); overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.meter div { background: var(--ink-2); padding: 12px 12px 10px; }
.meter dt { font-size: 13px; color: var(--mute); }
.meter dd { margin: 2px 0 0; font-size: 15px; font-weight: 700; color: var(--yellow); white-space: nowrap; }
#how-bench { width: calc(100% - 32px); margin: 0 16px; }
.how-note { padding: 0 16px 12px; color: #d8d5cc; font-size: 14px; }
.classes, .sheet__scroll { padding: 0 16px; display: grid; gap: 16px; }
.cls__head { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; font-weight: 700; margin-bottom: 6px; color: var(--paper); }
.cls__head .mono { font-size: 11px; color: var(--mute); }
.cls__list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 5px; }
.cls__list li { padding: 3px 9px; border-radius: var(--r-s); background: var(--ink-3); color: #cfccc3; font-size: 14px; white-space: nowrap; }
.cls__list li.on { background: var(--yellow); color: var(--ink); font-weight: 700; }
.tips { margin: 0 16px; padding: 0; list-style: none; display: grid; gap: 8px; }
.tips li { padding: 12px 14px; border-radius: var(--r-m); background: var(--ink-2); font-size: 15px; box-shadow: inset 3px 0 0 var(--yellow); }
.tips b { color: var(--yellow); }
.disclaimer { margin: 18px 16px 0; font-size: 13px; color: var(--mute); }

/* ---------- 設定 ---------- */
.set { margin: 18px 16px 0; border-radius: var(--r-m); background: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.set__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 10px 16px; border: 0; width: 100%; background: transparent; text-align: left; text-decoration: none; cursor: pointer; }
.set__row + .set__row { border-top: 1px solid var(--line); }
.set__row--col { flex-direction: column; align-items: stretch; cursor: default; padding: 14px 16px; }
.set__head { display: flex; justify-content: space-between; align-items: baseline; }
.set__label { font-size: 16px; font-weight: 500; }
.set__val { font-size: 20px; font-weight: 700; color: var(--yellow); }
.set__help { font-size: 14px; color: #d8d5cc; }
.set__link:active { background: var(--ink-3); }
.set__danger .set__label { color: #ff9c8c; font-weight: 700; }
.set__foot { margin: 14px 16px 0; font-size: 13px; color: var(--mute); }
input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 44px; margin: 4px 0 2px; background: transparent; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--yellow) var(--p, 50%), var(--ink-3) var(--p, 50%)); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--yellow) var(--p, 50%), var(--ink-3) var(--p, 50%)); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -10px; border-radius: 50%; background: var(--paper); box-shadow: 0 0 0 4px var(--ink), 0 0 0 6px var(--yellow); }
input[type="range"]::-moz-range-thumb { width: 26px; height: 26px; border: 0; border-radius: 50%; background: var(--paper); box-shadow: 0 0 0 4px var(--ink), 0 0 0 6px var(--yellow); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; margin-top: 10px; border-radius: var(--r-m); background: var(--ink); }
.seg button { min-height: 44px; border: 0; border-radius: 9px; background: transparent; color: var(--paper); font-weight: 700; cursor: pointer; transition: background-color var(--t-fast); }
.seg button.is-on { background: var(--yellow); color: var(--ink); }
.sw { -webkit-appearance: none; appearance: none; position: relative; flex: none; width: 52px; height: 32px; margin: 0; border-radius: 16px; background: var(--line); cursor: pointer; transition: background-color var(--t-fast); }
.sw::after { content: ""; position: absolute; left: 3px; top: 3px; width: 26px; height: 26px; border-radius: 50%; background: var(--paper); transition: transform var(--t-mid) var(--ease); }
.sw:checked { background: var(--yellow); }
.sw:checked::after { transform: translateX(20px); background: var(--ink); }

/* ---------- アプリについて ---------- */
.about { padding: 28px 16px 0; display: grid; gap: 10px; justify-items: center; text-align: center; }
.about__icon { width: 96px; height: 96px; border-radius: 22px; }
.about__name { font-size: 22px; font-weight: 800; }
.about__ver { font-size: 12px; color: var(--mute); }
.about__note { text-align: left; font-size: 14px; color: #d8d5cc; padding: 14px; border-radius: var(--r-m); background: var(--ink-2); }
.about .sec-title { margin: 14px 0 0; justify-self: start; }
.tech { list-style: none; margin: 0 0 12px; padding: 0; width: 100%; display: grid; gap: 1px; background: var(--line); border-radius: var(--r-m); overflow: hidden; text-align: left; }
.tech li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; background: var(--ink-2); }
.tech b { font-family: var(--f-mono); font-size: 13px; color: var(--yellow); white-space: nowrap; }
.tech span { font-size: 14px; color: #d8d5cc; text-align: right; word-break: keep-all; }

/* ---------- シート・トースト ---------- */
.scrim { position: absolute; inset: 0; z-index: 20; background: rgba(0, 0, 0, .6); opacity: 0; transition: opacity var(--t-mid); }
.scrim.is-on { opacity: 1; }
.sheet {
  position: absolute; z-index: 21; left: 0; right: 0; bottom: 0; max-height: 86%;
  display: flex; flex-direction: column; padding: 8px 16px calc(16px + var(--safe-b));
  border-radius: var(--r-l) var(--r-l) 0 0; background: var(--ink-2); box-shadow: 0 -10px 40px rgba(0, 0, 0, .5);
  transform: translateY(100%); transition: transform .3s var(--ease); touch-action: none;
}
.sheet.is-on { transform: none; }
.sheet__grip { width: 40px; height: 5px; margin: 0 auto 12px; border-radius: 3px; background: #4a4a50; }
.sheet__body { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.sheet__title { font-size: 20px; font-weight: 800; display: flex; align-items: baseline; gap: 10px; }
.sheet__title .mono { font-size: 13px; color: var(--yellow); }
.sheet__text { color: #d8d5cc; font-size: 15px; }
.sheet__scroll { overflow-y: auto; padding: 0; max-height: 52vh; overscroll-behavior: contain; touch-action: pan-y; }
.toast {
  position: absolute; z-index: 30; left: 12px; right: 12px; bottom: calc(var(--dial-h) + var(--safe-b) + 12px);
  display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 10px 10px 16px;
  border-radius: var(--r-m); background: var(--paper); color: var(--ink); font-size: 15px; box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  transform: translateY(20px); opacity: 0; pointer-events: none; transition: transform var(--t-mid) var(--ease), opacity var(--t-mid);
}
.app[data-screen="camera"].cam-live .toast { bottom: calc(var(--dial-h) + var(--deck-h) + var(--safe-b) + 10px); }
.app[data-screen="detail"] .toast, .app[data-screen="settings"] .toast { bottom: calc(var(--safe-b) + 16px); }
.toast.is-on { transform: none; opacity: 1; pointer-events: auto; }
.toast__msg { flex: 1; word-break: keep-all; }
.toast__act { flex: none; min-height: 44px; padding: 0 14px; border: 0; border-radius: 8px; background: var(--ink); color: var(--yellow); font-weight: 700; cursor: pointer; }

/* ---------- スプラッシュ・オンボーディング ---------- */
.splash { position: absolute; inset: 0; z-index: 50; display: grid; place-content: center; justify-items: center; gap: 18px; background: var(--ink); transition: opacity .3s; }
.splash img { width: 112px; height: 112px; border-radius: 26px; animation: splash .7s var(--ease) both; }
.splash__name { font-size: 22px; font-weight: 800; letter-spacing: .06em; }
.splash.is-out { opacity: 0; }
@keyframes splash { from { transform: scale(.86); opacity: 0; } }
.onboard { position: absolute; inset: 0; z-index: 40; background: var(--ink); display: flex; flex-direction: column; overflow: hidden; transition: opacity .3s; }
.onboard.is-out { opacity: 0; }
.onboard__track { flex: 1; display: flex; transition: transform .4s var(--ease); touch-action: pan-y; min-height: 0; }
.onboard__slide { flex: 0 0 100%; position: relative; }
.vf--ob { position: absolute; inset: 0; }
.vf--ob .vf__reticle { inset: calc(var(--safe-t) + 18px) 18px 18px; }
.onboard__foot { padding: 20px 20px calc(18px + var(--safe-b)); display: grid; gap: 10px; background: var(--ink); }
.onboard__dots { display: flex; gap: 6px; }
.onboard__dots i { width: 18px; height: 4px; border-radius: 2px; background: var(--line); transition: background-color var(--t-fast), width var(--t-mid) var(--ease); }
.onboard__dots i.on { width: 32px; background: var(--yellow); }
.onboard__title { font-size: 27px; font-weight: 800; line-height: 1.35; }
.onboard__text { color: #d8d5cc; font-size: 15px; min-height: 3.4em; }
.onboard__btns { display: grid; grid-template-columns: auto 1fr; gap: 10px; margin-top: 6px; }

.boot-error, .nojs { position: absolute; inset: auto 16px 40% 16px; z-index: 60; padding: 18px; border-radius: var(--r-m); background: var(--ink-3); color: var(--paper); font-size: 15px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  .is-scan .vf__scan::before { display: none; }
}
