:root {
  --bg: #05080a;
  --panel: rgba(10, 17, 20, 0.72);
  --panel-solid: #0c1417;
  --line: rgba(220, 245, 240, 0.09);
  --line-strong: rgba(220, 245, 240, 0.18);
  --text: #e7efec;
  --muted: #8fa19d;
  --faint: #5e706c;
  --accent: #7fd6c2;
  --accent-ink: #062520;
  --accent-soft: rgba(127, 214, 194, 0.14);
  --warm: #e9c46a;
  --danger: #ef8a7a;
  --radius: 16px;
  --panel-w: 392px;
  --top: 64px;
  --serif: 'Shippori Mincho', 'Hiragino Mincho ProN', 'Yu Mincho', serif;
  --sans: 'Zen Kaku Gothic New', 'Hiragino Sans', 'Yu Gothic UI', system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 14px; line-height: 1.6; overflow: hidden; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#stage { position: fixed; inset: 0; overflow: hidden; touch-action: none; }
#stage .layer, #stage canvas.gl3d { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#stage canvas.gl3d { outline: none; }
#stage.feed { cursor: crosshair; }
#stage.grab { cursor: grab; }
#stage.grabbing { cursor: grabbing; }
#ui { position: fixed; inset: 0; pointer-events: none; z-index: 10; transition: opacity .5s; }
#ui > * { pointer-events: auto; }
#ui.hidden { opacity: 0; pointer-events: none; }
#ui.hidden > * { pointer-events: none; }

/* ---------- トップバー ---------- */
.topbar { position: fixed; top: 0; left: 0; right: 0; height: var(--top); display: flex; align-items: center; gap: 12px; padding: 0 16px 0 22px; z-index: 20; pointer-events: none; transition: opacity .5s; }
.topbar > * { pointer-events: auto; }
.topbar.hidden { opacity: 0; }
.topbar.hidden > * { pointer-events: none; }
.logo { display: flex; align-items: baseline; gap: 10px; text-decoration: none; color: var(--text); margin-right: auto; }
.logo b { font-family: var(--serif); font-size: 24px; font-weight: 700; letter-spacing: .12em; }
.logo span { font-size: 10px; letter-spacing: .38em; color: var(--muted); }
.nav { display: flex; gap: 4px; background: rgba(8, 14, 16, 0.55); border: 1px solid var(--line); border-radius: 999px; padding: 4px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.nav a { text-decoration: none; color: var(--muted); padding: 6px 14px; border-radius: 999px; font-size: 13px; }
.nav a.on, .nav a:hover { color: var(--text); background: rgba(255,255,255,0.07); }
.icon-btn { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 999px; border: 1px solid var(--line); background: rgba(8, 14, 16, 0.55); color: var(--text); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); transition: background .2s, border-color .2s; flex: none; }
.icon-btn:hover { background: rgba(255,255,255,0.08); border-color: var(--line-strong); }
.icon-btn.on { color: var(--accent); border-color: rgba(127,214,194,.4); }
.clockchip { font-size: 12px; color: var(--muted); padding: 7px 12px; border-radius: 999px; background: rgba(8,14,16,.55); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.clockchip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.clockchip .dot.on { background: var(--warm); box-shadow: 0 0 10px var(--warm); }
.clockchip .warp { color: var(--warm); }

/* ---------- 共通 ---------- */
.panel { position: fixed; top: calc(var(--top) + 8px); right: 16px; bottom: 16px; width: var(--panel-w); background: var(--panel); border: 1px solid var(--line); border-radius: 22px; backdrop-filter: blur(22px) saturate(1.2); -webkit-backdrop-filter: blur(22px) saturate(1.2); display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.45); animation: panelIn .5s cubic-bezier(.2,.8,.2,1); }
@keyframes panelIn { from { opacity: 0; transform: translateX(24px); } }
.panel-head { padding: 22px 24px 6px; }
.panel-body { flex: 1; overflow-y: auto; padding: 8px 24px 20px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.12) transparent; }
.panel-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
.eyebrow { font-size: 10px; letter-spacing: .3em; color: var(--accent); text-transform: uppercase; }
h1, h2, h3 { margin: 0; font-weight: 700; }
h2 { font-family: var(--serif); font-size: 22px; letter-spacing: .04em; line-height: 1.4; margin: 6px 0 4px; }
h3 { font-size: 12px; letter-spacing: .12em; color: var(--muted); font-weight: 500; margin: 22px 0 10px; display: flex; align-items: center; gap: 10px; }
h3::after { content: ''; flex: 1; height: 1px; background: var(--line); }
p.lead { color: var(--muted); margin: 4px 0 8px; font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.btn { border: 1px solid var(--line-strong); background: rgba(255,255,255,0.04); color: var(--text); padding: 10px 18px; border-radius: 999px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: background .2s, transform .1s, border-color .2s; white-space: nowrap; text-decoration: none; }
.btn:hover { background: rgba(255,255,255,0.09); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 700; }
.btn.primary:hover { background: #95e2d0; }
.btn.warm { background: var(--warm); color: #2a1f05; border-color: transparent; font-weight: 700; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: rgba(255,255,255,.05); }
.btn[disabled] { opacity: .4; pointer-events: none; }
.btn.grow { flex: 1; }
.btn.sm { padding: 6px 12px; font-size: 12px; }

/* 選択カード */
.cards { display: grid; gap: 10px; }
.cards.two { grid-template-columns: 1fr 1fr; }
.cards.three { grid-template-columns: repeat(3, 1fr); }
.card { position: relative; text-align: left; border: 1px solid var(--line); background: rgba(255,255,255,0.025); border-radius: 14px; padding: 14px; transition: border-color .2s, background .2s, transform .15s; }
.card:hover { border-color: var(--line-strong); background: rgba(255,255,255,0.05); }
.card.on { border-color: rgba(127,214,194,.7); background: var(--accent-soft); }
.card.on::after { content: ''; position: absolute; top: 10px; right: 10px; width: 18px; height: 18px; border-radius: 50%; background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23062520' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12l4 4 8-8'/%3E%3C/svg%3E") center/12px no-repeat; }
.card.disabled { opacity: .35; pointer-events: none; }
.card .t { font-weight: 700; font-size: 14px; }
.card .en { font-size: 9px; letter-spacing: .3em; color: var(--muted); }
.card .d { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.55; }
.card .art { display: block; width: 100%; height: 82px; margin-bottom: 8px; border-radius: 10px; background: rgba(0,0,0,.25); object-fit: contain; }
.card canvas.art { background: radial-gradient(circle at 50% 70%, rgba(127,214,194,.08), rgba(0,0,0,.25)); }
.card.type { display: grid; grid-template-columns: 76px 1fr; gap: 14px; align-items: center; }
.card.type svg { width: 76px; height: 76px; }
.meter { display: flex; gap: 3px; margin-top: 6px; align-items: center; font-size: 10px; color: var(--faint); }
.meter i { width: 14px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.1); }
.meter i.f { background: var(--accent); }
.meter span { width: 44px; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tag { font-size: 10px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted); }
.tag.a { color: var(--accent); border-color: rgba(127,214,194,.35); }
.tag.w { color: var(--warm); border-color: rgba(233,196,106,.35); }

.seg { display: flex; background: rgba(255,255,255,0.04); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { flex: 1; border: 0; background: transparent; color: var(--muted); padding: 7px 10px; border-radius: 999px; font-size: 13px; }
.seg button.on { background: rgba(255,255,255,0.1); color: var(--text); }
.toggle { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,0.025); cursor: pointer; margin-bottom: 8px; text-align: left; width: 100%; }
.toggle .sw { flex: none; width: 36px; height: 20px; border-radius: 999px; background: rgba(255,255,255,.12); position: relative; margin-top: 2px; transition: background .2s; }
.toggle .sw::after { content: ''; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: #cfd9d6; transition: transform .2s; }
.toggle.on .sw { background: var(--accent); }
.toggle.on .sw::after { transform: translateX(16px); background: #fff; }
.toggle.disabled { opacity: .35; pointer-events: none; }
.toggle .t { font-weight: 700; }
.toggle .d { font-size: 12px; color: var(--muted); }

.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); background: none; border: 0; }
.swatch i { width: 44px; height: 44px; border-radius: 12px; border: 2px solid transparent; box-shadow: inset 0 0 0 1px var(--line-strong); }
.swatch.on i { border-color: var(--accent); }
.swatch.on { color: var(--text); }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; }
.field label b { color: var(--text); font-weight: 500; }
.field.lpos { margin-bottom: 10px; }
.field .ends { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); opacity: 0.7; margin-top: -3px; }
input[type=text], input[type=password], select, textarea { background: rgba(255,255,255,0.05); border: 1px solid var(--line-strong); border-radius: 12px; padding: 10px 12px; width: 100%; outline: none; }
input[type=text]:focus, input[type=password]:focus, textarea:focus, select:focus { border-color: var(--accent); }
select option { background: #0c1417; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 6px; background: var(--track, rgba(255,255,255,.12)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #fff; margin-top: -7px; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 6px; background: var(--track, rgba(255,255,255,.12)); }
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 0; }
.kelvin { --track: linear-gradient(90deg, #ffb46b, #ffe2c6, #fff, #d6e6ff, #a9c8ff); }

/* ステップ表示 */
.steps { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 2px; z-index: 21; background: rgba(8,14,16,.55); border: 1px solid var(--line); border-radius: 999px; padding: 4px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.steps button { border: 0; background: transparent; color: var(--faint); padding: 5px 12px; border-radius: 999px; font-size: 12px; display: flex; gap: 6px; align-items: center; }
.steps button b { font-family: var(--serif); font-size: 12px; }
.steps button.done { color: var(--muted); }
.steps button.on { color: var(--accent-ink); background: var(--accent); }
.steps button[disabled] { pointer-events: none; }

/* トレイ（レイアウト） */
.tray { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,0.03); padding: 6px 6px 8px; text-align: center; font-size: 11px; color: var(--muted); cursor: grab; user-select: none; touch-action: none; transition: border-color .2s, background .2s; }
.tile:hover { border-color: var(--line-strong); color: var(--text); background: rgba(255,255,255,.06); }
.tile canvas { width: 100%; height: 58px; object-fit: contain; display: block; pointer-events: none; }
.tile span { display: block; line-height: 1.3; margin-top: 2px; }
.tools { display: flex; gap: 6px; flex-wrap: wrap; }
.tool { border: 1px solid var(--line); background: rgba(255,255,255,.03); color: var(--muted); border-radius: 12px; padding: 8px 12px; font-size: 12px; display: inline-flex; gap: 6px; align-items: center; }
.tool.on { color: var(--accent-ink); background: var(--accent); border-color: transparent; }
.selbar { position: fixed; z-index: 25; display: flex; gap: 4px; align-items: center; background: rgba(8,14,16,.82); border: 1px solid var(--line-strong); border-radius: 999px; padding: 4px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); transform: translate(-50%, -100%); pointer-events: auto; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.selbar .icon-btn { width: 32px; height: 32px; background: transparent; border-color: transparent; }
.selbar .icon-btn:hover { background: rgba(255,255,255,.08); }
.selbar .lbl { font-size: 11px; color: var(--muted); padding: 0 8px; white-space: nowrap; }
.selbar .depth { display: flex; align-items: center; gap: 6px; padding: 0 8px; font-size: 11px; color: var(--muted); }
/* 選んだ物の操作バー: 画面の上に固定（形や深さを変えても動かない） */
.selbar { transform: none; width: max-content; max-width: calc(100vw - 16px); margin: 0 auto; flex-wrap: wrap; justify-content: center; border-radius: 22px; }
/* 差し込みのバー: 浅いうちは赤、しっかり差し込むと水色。指でスライド・ドラッグ・ホイールで */
.selbar .depth { gap: 8px; cursor: pointer; }
.insert-slider { -webkit-appearance: none; appearance: none; width: 150px; height: 30px; margin: 0; background: transparent; touch-action: none; cursor: pointer; --insert-color: var(--danger); --insert-fill: 0%; }
.insert-slider:focus { outline: none; }
.insert-slider::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--insert-color) var(--insert-fill), rgba(255,255,255,.14) var(--insert-fill)); }
.insert-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; margin-top: -9px; border-radius: 50%; background: #f4f1ea; border: 2px solid var(--insert-color); box-shadow: 0 2px 10px rgba(0,0,0,.45); }
.insert-slider::-moz-range-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--insert-color) var(--insert-fill), rgba(255,255,255,.14) var(--insert-fill)); }
.insert-slider::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: #f4f1ea; border: 2px solid var(--insert-color); }
.insert-value { min-width: 46px; color: var(--text); font-variant-numeric: tabular-nums; }
@media (max-width: 820px) { .insert-slider { width: min(54vw, 220px); } .selbar .icon-btn { width: 40px; height: 40px; } }
.hint { font-size: 12px; color: var(--muted); background: rgba(255,255,255,.03); border: 1px dashed var(--line-strong); border-radius: 12px; padding: 10px 12px; line-height: 1.7; }
.hint kbd { font-family: inherit; font-size: 11px; padding: 0 6px; border-radius: 5px; border: 1px solid var(--line-strong); color: var(--text); }
.drag-ghost { position: fixed; z-index: 50; pointer-events: none; width: 80px; height: 60px; object-fit: contain; transform: translate(-50%, -50%); opacity: .9; filter: drop-shadow(0 6px 14px rgba(0,0,0,.5)); }
.card img.art { background: radial-gradient(circle at 50% 60%, rgba(127,214,194,.08), rgba(0,0,0,.25)); }

/* ---------- ホーム ---------- */
.hero { position: fixed; left: 48px; bottom: 210px; max-width: 460px; animation: fadeUp 1s cubic-bezier(.2,.8,.2,1); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } }
.hero .kicker { font-size: 11px; letter-spacing: .5em; color: var(--accent); }
.hero h1 { font-family: var(--serif); font-size: 64px; letter-spacing: .14em; line-height: 1.1; margin: 10px 0 12px; text-shadow: 0 4px 40px rgba(0,0,0,.6); }
.hero p { color: #c3d0cc; font-size: 15px; line-height: 1.9; margin: 0 0 22px; text-shadow: 0 2px 20px rgba(0,0,0,.8); }
.hero .row { display: flex; gap: 10px; flex-wrap: wrap; }
.shelf { position: fixed; left: 32px; right: 32px; bottom: 22px; display: flex; gap: 12px; overflow-x: auto; padding: 6px 4px 8px; scrollbar-width: none; }
.shelf::-webkit-scrollbar { display: none; }
.shelf-label { position: fixed; left: 36px; bottom: 170px; font-size: 11px; letter-spacing: .3em; color: var(--muted); }
.tankcard { flex: none; width: 210px; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: var(--panel); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); text-decoration: none; color: var(--text); transition: transform .2s, border-color .2s; }
.tankcard:hover { transform: translateY(-3px); border-color: var(--line-strong); }
.tankcard .img { height: 92px; background: #0a1215 center/cover no-repeat; position: relative; }
.tankcard .img .chip { position: absolute; left: 8px; top: 8px; }
.tankcard .meta { padding: 8px 12px 10px; }
.tankcard .meta b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tankcard .meta span { font-size: 11px; color: var(--muted); }
.tankcard.new { display: grid; place-items: center; min-height: 138px; color: var(--muted); border-style: dashed; background: rgba(8,14,16,.4); }
.tankcard.new:hover { color: var(--accent); }
.chip { font-size: 10px; padding: 2px 8px; border-radius: 999px; background: rgba(0,0,0,.55); color: var(--text); border: 1px solid var(--line-strong); letter-spacing: .05em; }
.chip.a { color: var(--accent); border-color: rgba(127,214,194,.4); }
.chip.w { color: var(--warm); border-color: rgba(233,196,106,.4); }
.chip.ff { color: #ffd38a; border-color: rgba(255,211,138,.55); background: rgba(60,40,0,.55); }
/* 時間の早送り */
.ffbox { display: grid; gap: 8px; }
.ffrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ffrow .seg { flex: 1; min-width: 220px; }
.ffchk { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--text); padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; }
.ffchk input { accent-color: var(--accent); }
.ffstat { font-size: 12px; color: #ffd38a; }

/* ---------- 飼育画面 ---------- */
.careinfo { position: fixed; left: 22px; top: calc(var(--top) + 6px); max-width: 520px; }
.careinfo .name { font-family: var(--serif); font-size: 30px; letter-spacing: .08em; line-height: 1.2; text-shadow: 0 2px 30px rgba(0,0,0,.7); }
.careinfo .sub { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.day { font-family: var(--serif); font-size: 13px; color: var(--muted); }
.day b { font-size: 22px; color: var(--text); margin: 0 3px; }
.status { border-radius: 16px; padding: 14px 16px; background: rgba(255,255,255,.035); border: 1px solid var(--line); margin-top: 8px; }
.status .big { font-family: var(--serif); font-size: 17px; margin-bottom: 4px; }
.bar { height: 6px; border-radius: 4px; background: rgba(255,255,255,.08); overflow: hidden; margin: 10px 0 6px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #5fbfae, var(--accent)); border-radius: 4px; transition: width 1s; }
.params { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.param { border-radius: 12px; padding: 10px 12px; background: rgba(255,255,255,.03); border: 1px solid var(--line); }
.param .k { font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; }
.param .v { font-family: var(--serif); font-size: 18px; margin-top: 2px; }
.param .v small { font-family: var(--sans); font-size: 11px; color: var(--muted); margin-left: 3px; }
.param .lv { height: 3px; border-radius: 2px; background: rgba(255,255,255,.08); margin-top: 6px; overflow: hidden; }
.param .lv i { display: block; height: 100%; border-radius: 2px; }
.good { color: var(--accent); }
.warn { color: var(--warm); }
.bad { color: var(--danger); }
.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.act { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px 8px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.03); font-size: 11px; color: var(--muted); transition: background .2s, color .2s, border-color .2s; }
.act:hover { color: var(--text); background: rgba(255,255,255,.07); border-color: var(--line-strong); }
.act.on { color: var(--accent); border-color: rgba(127,214,194,.45); }
.act.hl { color: var(--accent-ink); background: var(--accent); border-color: transparent; }
.act svg { width: 22px; height: 22px; }
.act[disabled] { opacity: .35; pointer-events: none; }
.tabs { display: flex; gap: 2px; margin: 12px 0 2px; border-bottom: 1px solid var(--line); }
.tabs button { background: none; border: 0; color: var(--muted); padding: 8px 10px; font-size: 13px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--text); border-color: var(--accent); }
.diary { list-style: none; margin: 0; padding: 0; }
.diary li { display: grid; grid-template-columns: 58px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.diary li time { font-family: var(--serif); color: var(--muted); font-size: 12px; }
.inhab { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.inhab canvas { width: 64px; height: 38px; flex: none; }
.inhab .n { flex: 1; font-size: 13px; }
.inhab .n small { display: block; color: var(--muted); font-size: 11px; }
.pop { position: fixed; z-index: 30; width: 240px; padding: 14px 16px; border-radius: 16px; background: rgba(8,14,16,.88); border: 1px solid var(--line-strong); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); transform: translate(-50%, calc(-100% - 18px)); box-shadow: 0 20px 50px rgba(0,0,0,.5); animation: popIn .25s ease-out; }
@keyframes popIn { from { opacity: 0; transform: translate(-50%, calc(-100% - 8px)); } }
.pop input { padding: 4px 8px; font-size: 15px; font-family: var(--serif); background: transparent; border-color: transparent; }
.pop input:hover, .pop input:focus { border-color: var(--line-strong); }
.pop .row { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; }
.pop .row b { color: var(--text); font-weight: 500; }
.floating-cta { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 22; animation: fadeUp .5s; }

/* ---------- ギャラリー ---------- */
.gallery { position: fixed; inset: 0; overflow-y: auto; background: radial-gradient(ellipse at 50% -20%, #10222a 0%, #05080a 60%); padding: calc(var(--top) + 30px) 40px 60px; animation: fadeIn .4s; }
@keyframes fadeIn { from { opacity: 0; } }
.gallery header { max-width: 1240px; margin: 0 auto 26px; display: flex; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.gallery header h1 { font-family: var(--serif); font-size: 40px; letter-spacing: .14em; font-weight: 700; }
.gallery header p { color: var(--muted); margin: 0; flex: 1; min-width: 240px; }
.masonry { max-width: 1240px; margin: 0 auto; columns: 3 340px; column-gap: 18px; }
.gcard { break-inside: avoid; margin-bottom: 18px; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); background: #0a1114; cursor: pointer; display: block; text-decoration: none; color: var(--text); transition: transform .3s, box-shadow .3s, border-color .3s; }
.gcard:hover { transform: translateY(-4px); box-shadow: 0 24px 60px rgba(0,0,0,.5); border-color: var(--line-strong); }
.gcard .ph { position: relative; background: #081013; min-height: 160px; }
.gcard img { width: 100%; display: block; }
.gcard .ph .chips { position: absolute; left: 12px; top: 12px; display: flex; gap: 6px; }
.gcard .cap { padding: 14px 16px 16px; }
.gcard .cap b { font-family: var(--serif); font-size: 19px; letter-spacing: .06em; font-weight: 700; }
.gcard .cap .by { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 4px; }
.gcard .cap p { margin: 8px 0 0; color: #b8c6c2; font-size: 13px; }
.skeleton { height: 220px; background: linear-gradient(100deg, #0b1316 30%, #132024 50%, #0b1316 70%); background-size: 300% 100%; animation: shimmer 1.6s infinite linear; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ---------- モーダル・トースト ---------- */
.modal-back { position: fixed; inset: 0; z-index: 60; background: rgba(2,5,6,.55); display: grid; place-items: center; padding: 20px; opacity: 0; transition: opacity .25s; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.modal-back.show { opacity: 1; }
.modal { position: relative; width: min(560px, 100%); max-height: min(86vh, 900px); overflow-y: auto; background: var(--panel-solid); border: 1px solid var(--line-strong); border-radius: 22px; padding: 26px; box-shadow: 0 40px 100px rgba(0,0,0,.6); transform: translateY(10px); transition: transform .25s; }
.modal.wide { width: min(980px, 100%); }
.modal-back.show .modal { transform: none; }
.modal-x { position: absolute; top: 14px; right: 14px; }
.shop { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-top: 12px; }
.fcard { border: 1px solid var(--line); border-radius: 16px; padding: 12px; background: rgba(255,255,255,.025); display: flex; flex-direction: column; }
.fcard.on { border-color: rgba(127,214,194,.6); background: var(--accent-soft); }
.fcard.na { opacity: .45; }
.fcard.fam { text-align: left; cursor: pointer; font: inherit; color: inherit; transition: border-color .2s, background .2s; }
.fcard.fam:hover { border-color: rgba(127,214,194,.45); }
.fam-n { display: block; margin-top: 6px; font-size: 11px; color: var(--accent); }
.fam-head { display: flex; align-items: center; gap: 10px; margin: 6px 0 2px; }
.fcard canvas { width: 100%; height: 90px; }
.fcard .t { font-weight: 700; }
.fcard .d { font-size: 11px; color: var(--muted); margin: 4px 0 8px; flex: 1; }
.qty { display: flex; align-items: center; gap: 6px; }
.qty .icon-btn { width: 30px; height: 30px; }
.qty b { min-width: 26px; text-align: center; font-family: var(--serif); font-size: 17px; }
.cap-bar { height: 8px; border-radius: 4px; background: rgba(255,255,255,.08); overflow: hidden; }
.cap-bar i { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.cap-bar i.over { background: var(--danger); }
.strip { display: grid; grid-template-columns: 90px 1fr 70px; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.strip .pad { height: 26px; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.1); }
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { background: rgba(10,18,20,.92); border: 1px solid var(--line-strong); padding: 10px 18px; border-radius: 999px; font-size: 13px; opacity: 0; transform: translateY(10px); transition: opacity .3s, transform .3s; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 10px 30px rgba(0,0,0,.4); max-width: 90vw; }
.toast.show { opacity: 1; transform: none; }
.toast.good { border-color: rgba(127,214,194,.5); }
.toast.warn { border-color: rgba(233,196,106,.5); }
.viewmode-hint { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 22; font-size: 12px; color: rgba(255,255,255,.5); letter-spacing: .1em; pointer-events: none; animation: fadeOut 4s forwards; }
@keyframes fadeOut { 70% { opacity: 1; } to { opacity: 0; } }
/* 鑑賞モードの操作（全画面・時計・終了）: しばらく触らないと消える */
.vm-bar { position: fixed; top: 18px; right: 18px; z-index: 27; display: flex; gap: 8px; opacity: 0; transform: translateY(-6px); transition: opacity .5s, transform .5s; pointer-events: none; }
.vm-bar.show { opacity: 1; transform: none; pointer-events: auto; }
.vm-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 999px; border: 1px solid rgba(255,255,255,.14); background: rgba(8,14,16,.55); color: rgba(255,255,255,.82); cursor: pointer; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: border-color .2s, color .2s, background .2s; }
.vm-btn:hover { border-color: var(--accent); color: #fff; background: rgba(8,14,16,.75); }
.vm-btn.on { color: var(--accent); border-color: rgba(127,214,194,.45); }
/* 時計: 枠も塗りもない数字だけ。大きさを変えるとき（ホバー・つまむ）だけ枠が出る。タップで書体が変わる */
.vm-clock { position: fixed; right: 24px; bottom: 20px; z-index: 26; display: none; cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: none; }
.vm-clock-in { position: relative; display: flex; flex-direction: column; align-items: flex-end; padding: 8px 14px; border-radius: 12px; border: 1px dashed transparent; background-color: transparent; transition: border-color .35s, background-color .35s; transform: scale(var(--vm-scale, 1)); transform-origin: 100% 100%; }
.vm-clock:hover .vm-clock-in, .vm-clock.edit .vm-clock-in { border-color: rgba(233,223,198,.4); background-color: rgba(8,12,14,.14); }
.vm-grip { position: absolute; left: -8px; top: -8px; width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(233,223,198,.55); background: rgba(8,14,16,.7); cursor: nwse-resize; opacity: 0; transition: opacity .3s; touch-action: none; }
.vm-clock:hover .vm-grip, .vm-clock.edit .vm-grip { opacity: 1; }
/* 時計は鑑賞中ずっと前面に（自動カメラの重ねや、止まったアニメーションで消えないように） */
.vm-clock.show { display: flex; opacity: 1; z-index: 40; animation: vmIn .6s ease backwards; }
@keyframes vmIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.vm-digital { display: flex; align-items: baseline; gap: .22em; }
.vm-hm { font-family: var(--vm-font, var(--sans)); font-weight: var(--vm-weight, 300); font-style: var(--vm-style, normal); font-size: calc(56px * var(--vm-fsize, 1)); line-height: 1; letter-spacing: var(--vm-track, .04em); color: #f4eedd; text-shadow: 0 0 24px rgba(0,0,0,.5), 0 1px 3px rgba(0,0,0,.45); font-variant-numeric: tabular-nums; transition: font-size .2s; }
.vm-sec { font-family: var(--vm-font, var(--sans)); font-weight: var(--vm-weight, 300); font-style: var(--vm-style, normal); font-size: calc(17px * var(--vm-fsize, 1)); color: rgba(127,214,194,.92); text-shadow: 0 0 12px rgba(0,0,0,.6); font-variant-numeric: tabular-nums; }
.vm-dg { display: inline-block; width: calc(var(--vm-dw, 0.62) * 1em); text-align: center; letter-spacing: 0; }
.vm-col { display: inline-block; letter-spacing: 0; padding: 0 .05em; }
.vm-sec { min-width: calc(var(--vm-dw, 0.62) * 2em); }
.vm-date { font-family: var(--vm-font, var(--sans)); font-size: 11px; letter-spacing: .22em; color: rgba(233,223,198,.72); margin-top: 6px; text-shadow: 0 0 10px rgba(0,0,0,.65); white-space: pre; }
.vm-fontname { position: absolute; right: 14px; bottom: -16px; font-size: 10px; letter-spacing: .18em; color: rgba(233,223,198,.75); opacity: 0; pointer-events: none; white-space: nowrap; }
.vm-fontname.flash { animation: vmFlash 1.5s ease; }
@keyframes vmFlash { 12%, 60% { opacity: 1; } to { opacity: 0; } }
@media (max-width: 820px) { .vm-clock { right: 12px; bottom: 12px; } .vm-hm { font-size: calc(42px * var(--vm-fsize, 1)); } .vm-bar { top: 12px; right: 12px; } }

/* ---------- モバイル ---------- */
@media (max-width: 820px) {
  :root { --top: 56px; }
  .logo span { display: none; }
  .nav a { padding: 6px 10px; }
  .panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 48vh; border-radius: 22px 22px 0 0; animation: sheetIn .45s cubic-bezier(.2,.8,.2,1); }
  @keyframes sheetIn { from { transform: translateY(40px); opacity: 0; } }
  .panel-head { padding: 16px 18px 2px; }
  .panel-body { padding: 6px 18px 16px; }
  h2 { font-size: 19px; }
  .steps { top: auto; bottom: calc(48vh + 10px); }
  .steps button span { display: none; }
  .hero { left: 20px; right: 20px; bottom: 200px; }
  .hero h1 { font-size: 46px; }
  .careinfo { left: 16px; }
  .careinfo .name { font-size: 22px; }
  .gallery { padding: calc(var(--top) + 16px) 16px 40px; }
  .gallery header h1 { font-size: 30px; }
  .tray { grid-template-columns: repeat(4, 1fr); }
  .actions { grid-template-columns: repeat(4, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- 起動時の読み込み ---------- */
.boot { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: var(--bg); transition: opacity 0.7s ease; }
.boot.out { opacity: 0; pointer-events: none; }
.boot-in { display: grid; justify-items: center; gap: 12px; color: var(--muted); font-size: 13px; letter-spacing: 0.12em; }
.boot-in b { font-family: var(--serif); font-size: 30px; font-weight: 600; color: var(--text); letter-spacing: 0.3em; }
.boot-bar { width: 180px; height: 2px; background: var(--line); border-radius: 2px; overflow: hidden; }
.boot-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.25s ease; }

/* ---------- 収容力 ---------- */
.cap-bar { position: relative; }
.cap-bar i { position: absolute; left: 0; top: 0; bottom: 0; opacity: .5; }
.cap-bar i.now { opacity: 1; z-index: 1; }
.cap-bar i.warn { background: var(--warm); }
.cap-factors { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 12px; }
.fcard .qty .small { flex-basis: 100%; margin-top: 4px; }
.fcard .qty { flex-wrap: wrap; }

/* ---------- 立ち上げの暗転トランジション ---------- */
.cycle { position: fixed; inset: 0; z-index: 85; background: #010203; opacity: 0; transition: opacity 1.1s ease; display: grid; place-items: center; cursor: pointer; overflow: hidden; }
.cycle.on { opacity: 1; }
.cycle-in { display: grid; justify-items: center; gap: 18px; text-align: center; }
.cycle .day { font-family: var(--sans); font-size: 11px; letter-spacing: .5em; color: var(--muted); }
.cycle .day b { font-family: var(--serif); font-size: 44px; font-weight: 500; letter-spacing: .05em; color: var(--text); display: block; margin-top: 6px; }
.cycle .msg { font-family: var(--serif); font-size: 24px; letter-spacing: .32em; color: var(--text); min-height: 1.6em; opacity: 0; transform: translateY(8px); transition: opacity .7s ease, transform .7s ease; }
.cycle .msg.show { opacity: 1; transform: none; }
.cycle .sub { font-size: 12px; letter-spacing: .12em; color: var(--muted); min-height: 1.4em; opacity: 0; transition: opacity .7s ease .15s; }
.cycle .msg.show + .sub { opacity: 1; }
.cycle .prog { width: 220px; height: 2px; border-radius: 2px; background: var(--line); overflow: hidden; }
.cycle .prog i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .6s ease; }
.cycle .skip { position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%); font-size: 11px; letter-spacing: .2em; color: var(--faint); }
.cycle .bub { position: absolute; bottom: -20px; width: 6px; height: 6px; border-radius: 50%; border: 1px solid rgba(160, 230, 215, .35); animation: cycleBub linear infinite; }
@keyframes cycleBub { from { transform: translate(0, 0); opacity: 0; } 10% { opacity: 1; } to { transform: translate(var(--dx, 0), -110vh); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cycle .bub { display: none; } }

/* ---------- オリジナル品種づくり ---------- */
.studio { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, 1fr); gap: 22px; margin-top: 12px; }
.studio-view { align-self: start; position: sticky; top: 0; }
.studio-canvas { width: 100%; height: auto; aspect-ratio: 640 / 440; display: block; border-radius: 14px; border: 1px solid var(--line); cursor: grab; touch-action: none; }
.studio-ctrl h3 { margin: 16px 0 4px; }
.srow { display: grid; grid-template-columns: 84px 1fr; gap: 10px; align-items: center; margin: 7px 0; font-size: 12px; color: var(--muted); }
.sfield { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sfield input[type=range] { flex: 1; min-width: 90px; }
.sfield input[type=color] { width: 38px; height: 28px; padding: 0; border: 1px solid var(--line-strong); border-radius: 8px; background: none; cursor: pointer; }
.sfield input[type=text] { flex: 1; }
.seg.wrap { flex-wrap: wrap; border-radius: 14px; }
.seg.wrap button { flex: none; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 6px; }
.chip-btn { font-size: 11px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line-strong); background: rgba(255,255,255,.04); color: var(--text); cursor: pointer; }
.chip-btn:hover { border-color: var(--accent); }
.strain-list { margin-top: 14px; }
.paintbox { margin-top: 8px; display: grid; gap: 8px; }
.paint-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.paint-row input[type=range] { flex: 1; min-width: 80px; }
.paint-row input[type=color] { width: 38px; height: 28px; padding: 0; border: 1px solid var(--line-strong); border-radius: 8px; background: none; cursor: pointer; }
.paint-sw { display: flex; gap: 5px; flex-wrap: wrap; }
.paint-sw button { width: 24px; height: 24px; border-radius: 50%; border: 2px solid rgba(255,255,255,.15); cursor: pointer; padding: 0; }
.paint-sw button.on { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(127,214,194,.35); }
.strain-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 14px; }
/* 品種づくり: 下の設定を見に行っても、魚の窓は上に残る */
.studio-view { z-index: 3; background: var(--panel-solid); }
@media (max-width: 820px) {
  .studio { grid-template-columns: 1fr; }
  .studio-view { position: sticky; top: -18px; margin: -6px -6px 0; padding: 8px 6px 10px; box-shadow: 0 14px 18px -12px rgba(0,0,0,.7); }
  .studio-canvas { max-height: 34vh; width: auto; max-width: 100%; margin: 0 auto; }
  .studio-view .small { display: none; }
}

/* ---------- 自動カメラ ---------- */
body.autocam-on #ui, body.autocam-on .topbar, body.autocam-on .floating-cta, body.autocam-on .viewmode-hint { opacity: 0 !important; pointer-events: none !important; transition: opacity 1.2s; }
body.autocam-on #ui > *, body.autocam-on .topbar > * { pointer-events: none !important; }
.autocam { position: fixed; inset: 0; z-index: 25; pointer-events: none; display: none; }
body.autocam-on .autocam { display: block; }
.autocam-rec { position: absolute; top: 18px; left: 22px; font-size: 10px; letter-spacing: .28em; color: rgba(255,255,255,.55); display: flex; align-items: center; gap: 8px; animation: acIn 1.6s ease both; }
/* 録画中に見えないよう、赤いランプは置かない */
.autocam-cap { position: absolute; left: 28px; bottom: 26px; display: flex; flex-direction: column; gap: 2px; opacity: 0; text-shadow: 0 2px 16px rgba(0,0,0,.8); }
.autocam-cap .n { font-size: 10px; letter-spacing: .3em; color: rgba(255,255,255,.45); }
.autocam-cap b { font-family: var(--serif); font-size: 20px; font-weight: 600; letter-spacing: .14em; color: rgba(255,255,255,.92); }
.autocam-cap .s { font-size: 12px; letter-spacing: .12em; color: rgba(255,255,255,.7); }
.autocam-cap.show { animation: acCap 6.5s ease both; }
.autocam-lock { position: absolute; top: 12px; right: 16px; pointer-events: auto; display: flex; align-items: center; gap: 6px; padding: 7px 12px 7px 10px; border-radius: 999px; border: 1px solid rgba(255,255,255,.16); background: rgba(8,14,16,.45); color: rgba(255,255,255,.7); font-size: 11px; letter-spacing: .1em; cursor: pointer; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); opacity: .55; transition: opacity .3s, border-color .2s, color .2s; }
.autocam-lock:hover { opacity: 1; }
.autocam-lock.on { color: var(--accent); border-color: rgba(127,214,194,.45); opacity: .9; }
body.autocam-on .vm-bar { top: 58px; }
.autocam-hint { position: absolute; right: 24px; bottom: 26px; font-size: 11px; letter-spacing: .12em; color: rgba(255,255,255,.4); animation: acHint 7s ease both; }
@keyframes acIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes acBlink { 0%, 60% { opacity: 1; } 61%, 100% { opacity: .25; } }
@keyframes acCap { 0% { opacity: 0; transform: translateY(6px); } 12% { opacity: 1; transform: none; } 75% { opacity: 1; } 100% { opacity: 0; } }
@keyframes acHint { 0%, 20% { opacity: 0; } 35% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
@media (max-width: 820px) { .autocam-cap { left: 16px; bottom: 18px; } .autocam-cap b { font-size: 17px; } .autocam-hint { display: none; } }

/* ---------- トリミング ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn.on { background: rgba(127,214,194,.18); border-color: rgba(127,214,194,.6); color: var(--text); }
.trimtag { position: fixed; z-index: 24; transform: translate(8px, -50%); pointer-events: none; font-size: 12px; font-weight: 600; letter-spacing: .06em; color: #ffd6cc; background: rgba(40,12,8,.72); border: 1px solid rgba(255,138,112,.6); padding: 2px 8px; border-radius: 999px; white-space: nowrap; }

/* ギャラリーの展示室: 左上の案内（展示室の上に重なる。操作の邪魔をしないよう小さく） */
/* 展示室・庭の案内: 板を置かず、暗闇（光）の上に文字だけ */
.hallui { position: fixed; left: 40px; top: calc(var(--top) + 26px); max-width: 300px; animation: fadeIn 1s 1.2s both; pointer-events: none; }
.hallui > * { pointer-events: auto; }
.hallui h1 { font-family: var(--serif); font-size: 26px; letter-spacing: .2em; font-weight: 500; margin: 6px 0 10px; color: #ece7dc; text-shadow: 0 2px 24px rgba(0,0,0,.7); }
.hallui p { color: #a39e93; font-size: 12px; line-height: 2; letter-spacing: .04em; margin: 0 0 14px; }
.hallui-row { display: flex; gap: 6px; flex-wrap: wrap; }
.hallui.light .eyebrow { color: #8a857c; }
.hallui.light h1 { color: #2b2925; text-shadow: none; }
.hallui.light p { color: #77726a; }
/* 正面に来た水景の名前（美術館の札のように） */
.hallcap { position: fixed; left: 50%; bottom: 46px; transform: translateX(-50%); text-align: center; pointer-events: none; opacity: 0; }
.hallcap b { display: block; font-family: var(--serif); font-size: 19px; font-weight: 500; letter-spacing: .18em; color: #ece7dc; text-shadow: 0 2px 22px rgba(0,0,0,.85); }
.hallcap span { display: block; margin-top: 6px; font-size: 10px; letter-spacing: .26em; color: #a39e93; }
.hallcap.light b { color: #2b2925; text-shadow: none; }
.hallcap.light span { color: #8a857c; }
.gallery-over { z-index: 30; }
@media (max-width: 820px) { .hallui { left: 16px; right: 16px; max-width: none; } .hallui h1 { font-size: 20px; } .hallui p { font-size: 11px; } .hallcap { bottom: 28px; } }

/* ==========================================================
   2 案「間」: パネルをたたみ、余白で見せる
   ========================================================== */
:root { --text: #ece7dc; --muted: #a39e93; --lamp: #f1e3c4; --amber: #e3b064; --num: 'Newsreader', var(--serif); --top: 72px; }
/* 上の帯: 板を置かず、文字と細い線だけ */
.topbar { padding: 0 24px 0 40px; gap: 22px; color: var(--text); }
.topbar, .topbar a, .topbar span, .topbar b, .topbar button, .nav a { transition: color 1.2s ease, border-color 1.2s ease, background .2s; }
.logo { color: var(--text); }
.logo b { font-size: 22px; font-weight: 600; letter-spacing: .14em; }
.nav { background: none; border: 0; padding: 0; gap: 26px; backdrop-filter: none; -webkit-backdrop-filter: none; }
.nav a { padding: 6px 0; border-radius: 0; font-size: 13px; color: var(--muted); background: none !important; border-bottom: 1px solid transparent; }
.nav a.on { color: var(--text); border-bottom-color: var(--lamp); }
.nav a:hover { color: var(--text); }
.tsep { width: 1px; height: 20px; background: currentColor; opacity: .18; flex: none; }
.daydial { display: flex; align-items: center; gap: 10px; color: var(--text); white-space: nowrap; }
.daydial .tm { font-family: var(--num); font-size: 16px; font-variant-numeric: tabular-nums; }
.daydial .lt { font-size: 11px; color: var(--muted); letter-spacing: .04em; }
.daydial .warp { font-size: 11px; color: var(--amber); }
.topbar .icon-btn { background: none; border-color: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; width: 40px; height: 40px; color: var(--text); }
.topbar .icon-btn:hover { background: rgba(255,255,255,.06); border-color: transparent; }
.topbar .icon-btn.on { color: var(--lamp); border-color: transparent; }
/* 白い外の世界（ビオトープの庭）では、上の文字を黒へ */
body.lightworld .topbar { --text: #2b2925; --muted: #7a756c; --lamp: #8a7650; }
body.lightworld .topbar .icon-btn:hover { background: rgba(0,0,0,.05); }

/* 左: 縦書きの名前 */
.mtitle { position: fixed; left: 52px; top: calc(var(--top) + 70px); display: flex; flex-direction: column; gap: 14px; writing-mode: vertical-rl; pointer-events: none; animation: fadeIn 1s .15s both; }
.mtitle h1 { margin: 0; font-family: var(--serif); font-size: 42px; font-weight: 600; letter-spacing: .22em; line-height: 1.15; color: var(--text); text-shadow: 0 2px 30px rgba(0,0,0,.6); max-height: calc(100vh - var(--top) - 300px); }
.mtitle .sub { display: flex; gap: 12px; font-size: 12px; letter-spacing: .16em; color: var(--muted); text-shadow: 0 1px 10px rgba(0,0,0,.7); }
.mtitle .ff { color: var(--amber); }
html:not([lang="ja"]):not([lang="zh-Hans"]) .mtitle { writing-mode: horizontal-tb; left: 40px; top: calc(var(--top) + 26px); gap: 8px; }
html:not([lang="ja"]):not([lang="zh-Hans"]) .mtitle h1 { font-size: 30px; letter-spacing: .06em; max-height: none; }
/* 左下: 大きな数字 */
.mstats { position: fixed; left: 40px; bottom: 40px; display: flex; align-items: flex-end; gap: 28px; background: none; border: 0; padding: 0; color: var(--text); cursor: pointer; text-align: left; font: inherit; animation: fadeIn 1s .3s both; }
.mstats .st { display: flex; flex-direction: column; gap: 4px; }
.mstats small { font-size: 11px; color: var(--muted); letter-spacing: .12em; }
.mstats b { font-family: var(--num); font-weight: 300; font-size: 40px; line-height: 1; font-variant-numeric: tabular-nums; text-shadow: 0 2px 20px rgba(0,0,0,.5); }
.mstats em { font-style: normal; font-family: var(--sans); font-size: 14px; color: var(--muted); margin-left: 4px; }
.mstats .warn b { color: var(--amber); }
.mstats .bad b { color: var(--danger); }
.mstats .sep { width: 1px; height: 44px; background: rgba(236,231,220,.18); }
.mstats:hover small { color: var(--text); }
/* 中央下: いまの様子と、いまやるとよいこと */
.mstatus { position: fixed; left: 50%; bottom: 44px; transform: translateX(-50%); width: 420px; max-width: calc(100vw - 32px); display: flex; flex-direction: column; align-items: center; gap: 14px; pointer-events: none; animation: fadeIn 1s .4s both; }
.mstatus > * { pointer-events: auto; }
.mstatus .line { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 19px; letter-spacing: .04em; text-shadow: 0 1px 14px rgba(0,0,0,.85); }
.mstatus .dot { width: 7px; height: 7px; border-radius: 50%; background: #9fc2a8; flex: none; }
.mstatus .dot.warn { background: var(--amber); }
.mstatus .dot.wait { background: var(--muted); }
.mstatus .prog { width: 180px; height: 1px; background: rgba(236,231,220,.2); }
.mstatus .prog i { display: block; height: 100%; background: var(--lamp); }
.mact { height: 46px; padding: 0 30px; border: 0; border-radius: 6px; background: var(--lamp); color: #0b0e0f; font: inherit; font-size: 14px; font-weight: 700; letter-spacing: .08em; cursor: pointer; transition: transform .2s, filter .2s; }
.mact:hover { filter: brightness(1.06); }
.mact:active { transform: scale(.98); }
/* 右: たたんだ道具の列 */
.mrail { position: fixed; right: 22px; top: 50%; transform: translateY(-50%); width: 52px; padding: 6px 0; display: flex; flex-direction: column; align-items: center; gap: 4px; background: rgba(9,13,14,.62); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border: 1px solid rgba(236,231,220,.1); border-radius: 26px; transition: opacity .3s, transform .3s; animation: fadeIn 1s .5s both; }
.mrail button { position: relative; width: 44px; height: 44px; display: grid; place-items: center; background: none; border: 0; border-radius: 50%; color: var(--text); cursor: pointer; }
.mrail button:hover { background: rgba(255,255,255,.07); }
.mrail .tip { position: absolute; right: 56px; top: 50%; transform: translateY(-50%); height: 30px; padding: 0 12px; display: flex; align-items: center; white-space: nowrap; background: rgba(9,13,14,.85); border: 1px solid rgba(236,231,220,.12); border-radius: 4px; font-size: 12px; color: var(--text); opacity: 0; pointer-events: none; transition: opacity .15s; }
.mrail button:hover .tip, .mrail button:focus-visible .tip { opacity: 1; }
.mrail .sep { width: 24px; height: 1px; background: rgba(236,231,220,.18); margin: 4px 0; }
body.care-open .mrail { opacity: 0; pointer-events: none; transform: translate(20px, -50%); }
/* たたんだパネル（くわしく で開く） */
.panel.fold { transform: translateX(calc(100% + 40px)); opacity: 0; pointer-events: none; animation: none; transition: transform .5s cubic-bezier(.2,.8,.2,1), opacity .35s; }
.panel.fold.open { transform: none; opacity: 1; pointer-events: auto; }
.panel-top { display: flex; align-items: center; justify-content: space-between; }
.panel-x { width: 34px; height: 34px; margin-right: -8px; border: 0; border-radius: 50%; background: none; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.panel-x:hover { color: var(--text); background: rgba(255,255,255,.06); }
@media (max-width: 1180px) { .mstatus { bottom: 132px; } }
@media (max-width: 820px) {
  :root { --top: 56px; }
  .topbar { padding: 0 8px 0 16px; gap: 12px; }
  .nav { gap: 14px; }
  .nav a { padding: 6px 0; }
  .daydial .lt, .tsep { display: none; }
  .mtitle { left: 16px; top: calc(var(--top) + 18px); }
  .mtitle h1 { font-size: 28px; }
  .mstats { left: 16px; bottom: 18px; gap: 14px; }
  .mstats b { font-size: 26px; }
  .mstats em { font-size: 11px; }
  .mstats .sep { height: 30px; }
  .mstatus { bottom: 96px; }
  .mstatus .line { font-size: 16px; }
  .mrail { right: 10px; width: 46px; }
  .mrail button { width: 40px; height: 40px; }
  .mrail .tip { display: none; }
  .panel.fold { transform: translateY(105%); }
  .panel.fold.open { transform: none; }
}

/* タッチ画面: 二段のナビ、折りたたみシート、常に戻れる鑑賞操作 */
.mobile-sheet-toggle { display: none; }
.mobile-full[hidden] { display: none; }
.mobile-viewing .vm-bar { opacity: 1; transform: none; pointer-events: auto; }
@media (max-width: 820px) {
  :root { --top: calc(104px + env(safe-area-inset-top, 0px)); }
  .topbar { height: var(--top); box-sizing: border-box; padding: env(safe-area-inset-top, 0px) 10px 0; gap: 6px; flex-wrap: wrap; align-content: center; background: linear-gradient(#081012ed, #08101280); }
  .topbar .logo { margin-right: auto; }
  .topbar .daydial { display: none; }
  .topbar .nav { order: 10; width: 100%; justify-content: space-around; box-sizing: border-box; height: 46px; padding: 0; }
  .topbar .nav a { flex: 1; text-align: center; display: flex; justify-content: center; align-items: center; min-height: 44px; padding: 0 8px; }
  .mobile-full { font-size: 12px; padding: 8px 10px; min-height: 44px; }
  .topbar .icon-btn, .vm-btn, .panel-x, .mrail button { width: 44px; height: 44px; min-width: 44px; }
  .btn, .seg button, .tabs button, .steps button { min-height: 44px; }
  input, select, textarea { font-size: 16px; }
  .panel { height: 42vh; height: 42dvh; max-height: calc(100dvh - var(--top) - 64px); padding-bottom: env(safe-area-inset-bottom, 0px); box-sizing: border-box; }
  .panel-body { min-height: 0; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .panel-foot { flex-wrap: wrap; gap: 8px; padding: 10px 14px; flex-shrink: 0; }
  .panel-head { padding: 8px 16px 2px; }
  .mobile-sheet-toggle { display: block; flex: 0 0 44px; width: 100%; border: 0; border-bottom: 1px solid var(--line); background: #132623; color: var(--accent); font-size: 13px; touch-action: manipulation; }
  .panel.mobile-folded { height: calc(44px + env(safe-area-inset-bottom, 0px)); }
  .panel.mobile-folded > :not(.mobile-sheet-toggle) { display: none; }
  .steps { bottom: calc(42dvh + env(safe-area-inset-bottom, 0px) + 8px); max-width: calc(100vw - 20px); overflow-x: auto; }
  #ui:has(.panel.mobile-folded) .steps { bottom: calc(52px + env(safe-area-inset-bottom, 0px)); }
  .vm-bar { top: calc(12px + env(safe-area-inset-top, 0px)); right: calc(10px + env(safe-area-inset-right, 0px)); opacity: 1; transform: none; pointer-events: auto; }
  .vm-clock { bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  .modal { max-height: calc(100dvh - 32px); overflow-y: auto; box-sizing: border-box; }
  .tray, .actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mrail { top: auto; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); left: 8px; right: 8px; width: auto; transform: none; flex-direction: row; overflow-x: auto; justify-content: flex-start; border-radius: 18px; padding: 6px; gap: 4px; }
  .mrail button { flex: 0 0 72px; width: 72px; height: 60px; display: flex; flex-direction: column; justify-content: center; gap: 5px; }
  .mrail .tip { display: block; position: static; opacity: 1; transform: none; background: none; border: 0; padding: 0; font-size: 10px; white-space: nowrap; }
  .mrail .sep { display: none; }
  .mstats { bottom: calc(94px + env(safe-area-inset-bottom, 0px)); }
  .mstatus { bottom: calc(163px + env(safe-area-inset-bottom, 0px)); }
  .mtitle { writing-mode: horizontal-tb; top: calc(var(--top) + 10px); gap: 4px; }
  .mtitle h1 { font-size: 20px; max-height: none; }
}

/* スマホの下のパネル: 見出し（STEP・題名・説明）も中身と一緒にスクロールし、読める範囲を広く。
   たたむつまみと下の「戻る／次へ」は細くして、パネルの上下に貼りつける */
@media (max-width: 820px) {
  .panel { height: 46vh; height: 46dvh; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .panel > .panel-head, .panel > .panel-body { flex: none; overflow: visible; min-height: auto; }
  .panel > .mobile-sheet-toggle { position: sticky; top: 0; z-index: 3; flex: 0 0 32px; height: 32px; min-height: 32px; font-size: 11px; letter-spacing: .08em; background: rgba(15,30,28,.97); }
  .panel > .panel-foot { position: sticky; bottom: 0; z-index: 3; margin-top: auto; padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)); background: var(--panel-solid); border-top: 1px solid var(--line); }
  .panel { padding-bottom: 0; }
  .panel-foot .btn { min-height: 42px; padding-top: 0; padding-bottom: 0; }
  .panel-head { padding: 10px 16px 0; }
  .panel-head h2 { font-size: 18px; margin: 2px 0 2px; }
  .panel-head .lead { font-size: 12px; line-height: 1.65; margin: 0 0 4px; }
  .panel-body { padding-top: 4px; }
  .steps { bottom: calc(46dvh + 8px); }
  #ui:has(.panel.mobile-folded) .steps { bottom: calc(40px + env(safe-area-inset-bottom, 0px)); }
  .panel.mobile-folded { height: calc(32px + env(safe-area-inset-bottom, 0px)); overflow: hidden; }
}

/* スマホを横にしたとき（背の低い画面）: 上の帯は 1 段・細く、題名は横書き、道具の列は右下に横並び、
   くわしくパネルは右からの細い板に。縦書きが 1 文字ずつ折り返して読めなくなるのを防ぐ */
@media (max-height: 500px) and (orientation: landscape) {
  :root { --top: calc(48px + env(safe-area-inset-top, 0px)); }
  .topbar { height: var(--top); flex-wrap: nowrap; align-content: normal; gap: 12px; padding: env(safe-area-inset-top, 0px) max(10px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); background: linear-gradient(#081012d0, #08101200); }
  .logo, .nav a, .mobile-full { white-space: nowrap; }
  .logo b { font-size: 18px; }
  .logo span, .daydial .lt, .tsep { display: none; }
  .topbar .nav { order: 0; width: auto; height: auto; gap: 14px; justify-content: flex-start; }
  .topbar .nav a { flex: none; min-height: 36px; padding: 0 2px; font-size: 12px; }
  .topbar .icon-btn { width: 38px; height: 38px; min-width: 38px; }
  .mobile-full { font-size: 11px; padding: 6px 10px; min-height: 36px; }
  .mtitle { writing-mode: horizontal-tb; left: max(16px, env(safe-area-inset-left, 0px)); top: calc(var(--top) + 6px); gap: 2px; }
  .mtitle h1 { font-size: 19px; letter-spacing: .08em; max-height: none; }
  .mtitle .sub { font-size: 10px; gap: 8px; }
  .mstats { left: max(16px, env(safe-area-inset-left, 0px)); bottom: calc(10px + env(safe-area-inset-bottom, 0px)); gap: 12px; }
  .mstats b { font-size: 22px; }
  .mstats small { font-size: 10px; }
  .mstats em { font-size: 10px; }
  .mstats .sep { height: 26px; }
  .mstatus { left: max(16px, env(safe-area-inset-left, 0px)); bottom: calc(66px + env(safe-area-inset-bottom, 0px)); transform: none; width: auto; max-width: 42vw; align-items: flex-start; gap: 6px; }
  .mstatus .line { font-size: 14px; }
  .mstatus .prog { width: 140px; }
  .mrail { top: auto; left: auto; right: max(8px, env(safe-area-inset-right, 0px)); bottom: calc(8px + env(safe-area-inset-bottom, 0px)); width: auto; max-width: 56vw; transform: none; flex-direction: row; overflow-x: auto; padding: 3px 6px; gap: 0; border-radius: 22px; }
  .mrail button { flex: none; width: 38px; height: 38px; min-width: 38px; display: grid; }
  .mrail .tip { display: none; }
  .mrail .sep { width: 1px; height: 22px; margin: 0 4px; }
  body.care-open .mrail { transform: translateY(20px); }
  .panel { top: calc(var(--top) + 4px); bottom: calc(6px + env(safe-area-inset-bottom, 0px)); left: auto; right: max(6px, env(safe-area-inset-right, 0px)); width: min(380px, 46vw); height: auto; max-height: none; border-radius: 16px; }
  .panel.fold { transform: translateX(105%); }
  .panel.fold.open { transform: none; }
  .steps { top: auto; bottom: 8px; left: 8px; transform: none; max-width: calc(100vw - min(380px, 46vw) - 28px); }
  #ui:has(.panel.mobile-folded) .steps { bottom: 8px; }
  .panel.mobile-folded { top: auto; }
  .vm-bar { top: calc(8px + env(safe-area-inset-top, 0px)); }
  .vm-clock { bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
  /* ホーム: 左半分に文と棚、右半分に水槽 */
  .hero { left: max(16px, env(safe-area-inset-left, 0px)); right: auto; top: calc(var(--top) + 2px); bottom: auto; max-width: 46vw; }
  .hero .kicker { display: none; }
  .hero h1 { font-size: 26px; margin: 0 0 4px; }
  .hero p { font-size: 11.5px; line-height: 1.6; margin: 0 0 10px; }
  .hero .row { gap: 6px; }
  .hero .row .btn { min-height: 34px; padding: 6px 12px; font-size: 12px; }
  .shelf-label { display: none; }
  .shelf { left: max(12px, env(safe-area-inset-left, 0px)); right: 52vw; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); gap: 8px; padding: 4px 2px; }
  .tankcard { width: 140px; border-radius: 12px; }
  .tankcard .img { height: 46px; }
  .tankcard .meta { padding: 5px 9px 7px; }
  .tankcard.new { min-height: 86px; }
}
.cutinfo { margin: 6px 0 2px; font-size: 13px; color: var(--muted); }
.cutinfo b { font-family: var(--num); font-size: 22px; font-weight: 400; color: var(--text); margin: 0 4px; }
body.care-editing .mtitle, body.care-editing .mstats, body.care-editing .mstatus { opacity: 0 !important; pointer-events: none !important; transition: opacity .4s; }
.modal form { margin-top: 12px; }
