:root {
  --bg: #0c100d;
  --panel: #151a16;
  --line: rgba(255, 255, 255, 0.12);
  --ink: #f2f0e8;
  --mute: rgba(242, 240, 232, 0.62);
  --faint: rgba(242, 240, 232, 0.36);
  --accent: #c9d8b6;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 300 15px/1.8 "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", system-ui, sans-serif;
  padding: env(safe-area-inset-top) 0 calc(72px + env(safe-area-inset-bottom));
  -webkit-text-size-adjust: 100%;
}
main { max-width: 640px; margin: 0 auto; padding: 0 16px; }
.top { max-width: 640px; margin: 0 auto; padding: 18px 16px 6px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.eyebrow { margin: 0; font-size: 12px; letter-spacing: 0.25em; color: var(--mute); }
.about-link { font-size: 12px; color: var(--faint); text-decoration: none; }
h2 { font-weight: 400; font-size: 17px; letter-spacing: 0.1em; margin: 28px 0 4px; }
.lead { color: var(--mute); font-size: 13px; margin: 4px 0 14px; }
.note { color: var(--mute); font-size: 13px; min-height: 1.6em; margin: 6px 0; }
a { color: var(--accent); }
.tab { display: none; }
.tab.is-on { display: block; }

/* 歩く：林床 */
.field { position: relative; width: 100%; aspect-ratio: 3 / 4; margin: 0 auto; }
.field .c {
  position: absolute; border-radius: 50%; overflow: hidden; border: 0; padding: 0; cursor: pointer; background: var(--panel);
  transform: translate(-50%, -50%); transition: filter 0.6s ease, opacity 0.6s ease;
}
.field .c img { width: 100%; height: 100%; object-fit: cover; display: block; }
.field .c.off { filter: grayscale(1) brightness(0.72); opacity: 0.55; }
.field .c .v { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; writing-mode: vertical-rl; font: 400 11px/1.5 "Hiragino Mincho ProN", serif; color: #2a2a24; background: #e9e4d6; padding: 10%; }
.field .c.sound::after { content: "♪"; position: absolute; right: 12%; bottom: 8%; font-size: 12px; color: #fff; text-shadow: 0 0 4px #000; }
.field .c.rare { outline: 1px solid rgba(255,255,255,0.55); outline-offset: 4px; }
.field .print { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); transform: translate(-50%, -50%); pointer-events: none; }
.moves { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.moves button, .btn {
  appearance: none; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  font: inherit; font-size: 14px; padding: 10px 12px; border-radius: 999px; min-height: 44px; cursor: pointer;
}
.moves button { font-size: 12px; padding: 8px 4px; }
.btn.ghost { background: none; width: 100%; }
.btn[disabled] { color: var(--mute); }
.happened { margin: 8px 0 24px; padding: 0; list-style: none; }
.happened p { font-size: 13px; color: var(--mute); margin: 0 0 8px; padding-left: 12px; border-left: 1px solid var(--line); }
.happened .t { color: var(--faint); font-size: 11px; letter-spacing: 0.1em; }

/* 相棒 */
.gift { text-align: center; padding: 6px 0 20px; }
.gift .circle { width: min(74vw, 340px); aspect-ratio: 1; margin: 12px auto 20px; border-radius: 50%; overflow: hidden; outline: 1px solid rgba(255,255,255,0.7); outline-offset: 10px; background: #e9e4d6; border: 0; padding: 0; cursor: pointer; display: block; }
.gift .circle img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gift .words { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; padding: 14%; writing-mode: vertical-rl; font: 400 clamp(17px, 4.6vw, 22px)/1.9 "Hiragino Mincho ProN", serif; color: #2a2a24; }
.gift h1 { font-weight: 400; font-size: 20px; line-height: 1.5; margin: 0 0 4px; }
.gift .sub { color: var(--mute); font-size: 12px; margin: 0 0 10px; }
.gift .why { font-size: 15px; margin: 0; }
.gift .where { color: var(--faint); font-size: 12px; letter-spacing: 0.2em; margin: 6px 0 18px; }
.letter { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin: 16px 0; background: var(--panel); }
.letter .d { font-size: 11px; color: var(--faint); letter-spacing: 0.15em; margin: 0 0 6px; }
.letter p { margin: 0 0 6px; font-size: 14px; }
.taste { color: var(--faint); font-size: 12px; margin-top: 20px; }
audio { width: 100%; margin: 6px 0 10px; }
details { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 8px; }
summary { cursor: pointer; color: var(--mute); font-size: 13px; padding: 8px 0; }
code { font-size: 12px; word-break: break-all; color: var(--accent); }

/* 関わる */
form { display: flex; flex-direction: column; gap: 10px; }
form.row { flex-direction: row; }
form.row input { flex: 1; }
.pick { display: block; border: 1px dashed var(--line); border-radius: 16px; padding: 24px 16px; text-align: center; color: var(--mute); cursor: pointer; }
.pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
#seed-preview { width: 100%; border-radius: 16px; }
textarea, input { width: 100%; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 12px; font: inherit; font-size: 16px; }
.hues { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin: 6px 0 12px; }
.hues button { aspect-ratio: 1; border-radius: 50%; border: 0; cursor: pointer; min-height: 40px; }
.make-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 10px; margin-bottom: 10px; }
.make-pick button { aspect-ratio: 1; border-radius: 50%; overflow: hidden; border: 0; padding: 0; background: #e9e4d6; cursor: pointer; opacity: 0.6; }
.make-pick button.on { opacity: 1; outline: 2px solid var(--accent); outline-offset: 3px; }
.make-pick img { width: 100%; height: 100%; object-fit: cover; }
.make-pick .v { writing-mode: vertical-rl; font: 400 9px/1.4 "Hiragino Mincho ProN", serif; color: #2a2a24; }

/* 標本箱 */
.box { display: flex; flex-direction: column; gap: 1px; background: var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 24px; }
.box button { appearance: none; border: 0; background: var(--bg); color: inherit; font: inherit; text-align: left; cursor: pointer; display: grid; grid-template-columns: 60px 1fr; gap: 12px; align-items: center; padding: 10px 12px; min-height: 80px; }
.box .thumb { width: 60px; height: 60px; border-radius: 50%; overflow: hidden; background: #e9e4d6; display: flex; align-items: center; justify-content: center; }
.box .thumb img { width: 100%; height: 100%; object-fit: cover; }
.box .thumb .v { writing-mode: vertical-rl; font: 400 9px/1.4 "Hiragino Mincho ProN", serif; color: #2a2a24; max-height: 80%; overflow: hidden; }
.box .d { font-size: 11px; color: var(--faint); letter-spacing: 0.12em; }
.box .n { font-size: 14px; line-height: 1.5; }
.box .r { font-size: 12px; color: var(--mute); }

/* タブ */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr); background: rgba(12,16,13,0.94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.tabs button { appearance: none; border: 0; background: none; color: var(--mute); font: inherit; font-size: 13px; letter-spacing: 0.1em; min-height: 56px; cursor: pointer; }
.tabs button.is-on { color: var(--ink); }

/* シート・ようこそ */
dialog { width: min(100vw, 640px); max-width: 100vw; max-height: 92vh; margin: auto auto 0; padding: 0 0 env(safe-area-inset-bottom); border: 0; border-radius: 20px 20px 0 0; background: var(--panel); color: var(--ink); }
dialog::backdrop { background: rgba(0,0,0,0.6); }
#sheet-body img.hero { width: 100%; max-height: 52vh; object-fit: contain; background: #000; display: block; }
#sheet-body .words { padding: 32px 24px; font: 400 18px/2 "Hiragino Mincho ProN", serif; }
#sheet-body .meta { padding: 12px 20px 0; }
#sheet-body h3 { font-weight: 400; font-size: 18px; margin: 0 0 4px; line-height: 1.5; }
#sheet-body p { margin: 4px 0; font-size: 13px; color: var(--mute); }
#sheet-body .btn { margin-top: 10px; }
dialog .close { display: block; margin: 6px auto 12px; appearance: none; border: 0; background: none; color: var(--mute); font: inherit; min-height: 44px; padding: 0 24px; cursor: pointer; }
.welcome { padding: 24px 20px 8px; }
.welcome p { font-size: 14px; color: var(--mute); }
.welcome form { margin: 16px 0 10px; }

@media (prefers-reduced-motion: no-preference) {
  .tab.is-on { animation: fade 0.4s ease; }
  @keyframes fade { from { opacity: 0; } to { opacity: 1; } }
}

/* 眼を借りる・気配・相棒 */
.eyes { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.eyes button { appearance: none; border: 1px solid var(--line); background: none; color: var(--mute); font: inherit; font-size: 12px; padding: 6px 12px; border-radius: 999px; min-height: 36px; cursor: pointer; }
.eyes button.on { background: var(--panel); color: var(--ink); border-color: var(--accent); }
.field .c.hide { opacity: 0.07; filter: grayscale(1); }
.field .mino { position: absolute; transform: translate(-50%, -12%); pointer-events: none; }
.field .mino.other { opacity: 0.8; }
.meet { font-size: 13px; color: var(--accent); margin: 8px 0 0; min-height: 1.4em; }
.hints p { font-size: 13px; color: var(--mute); margin: 4px 0; }
.hints p::before { content: "· "; color: var(--faint); }
.comp-head { display: flex; gap: 16px; align-items: center; margin: 12px 0 8px; }
.comp-head .name { font-size: 20px; font-weight: 400; margin: 0; }
.comp-head .status { font-size: 13px; color: var(--mute); margin: 4px 0 0; }
.crave { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin: 16px 0; }
.crave p { margin: 0 0 8px; font-size: 14px; }
.comp-head svg { flex: none; width: 118px; height: 170px; }
