/* 雨待ち観測所 — 濡れたアスファルトと、わずかな灯り */
:root {
  --bg: #0b1016; --surface: #141c25; --surface2: #1b2531; --line: #2c3a49;
  --text: #e8eef4; --sub: #b3c0cc; --dim: #8796a5;
  --lamp: #f2c46d; --water: #8cc3e6; --ok: #8fd6a8; --bad: #ff9a8f; --warn: #f0c87a;
  --bar-h: 76px; --tap: 52px; --r: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
  --fs: 17px;
  color-scheme: dark;
}
html.large { --fs: 20px; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: var(--fs)/1.7 "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent;
  min-height: 100vh; min-height: 100dvh;
  background: radial-gradient(120% 60% at 30% 0%, #16202c 0%, var(--bg) 60%) fixed;
}
body.has-modal { overflow: hidden; }
h1, h2, h3 { font-weight: 600; line-height: 1.4; }
h2 { font-size: 1.35em; margin: .4em 0 .5em; }
h3 { font-size: 1.02em; margin: 1.3em 0 .5em; color: var(--sub); letter-spacing: .04em; }
p { margin: .5em 0; }
b { font-weight: 600; }
small, .small { font-size: .84em; color: var(--sub); }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
button { font: inherit; color: inherit; }
button:focus-visible, .btn:focus-within, label.btn:focus-within { outline: 3px solid var(--water); outline-offset: 2px; }

.screen {
  max-width: 1100px; margin: 0 auto;
  padding: calc(var(--safe-t) + 16px) calc(var(--safe-r) + 18px) calc(var(--bar-h) + var(--safe-b) + 24px) calc(var(--safe-l) + 18px);
}
.lead { color: var(--sub); }

/* 下部の操作バー：主要ボタンは画面下に */
.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
  padding: 10px calc(var(--safe-r) + 14px) calc(var(--safe-b) + 10px) calc(var(--safe-l) + 14px);
  background: linear-gradient(to top, rgba(8,12,17,.97) 70%, rgba(8,12,17,.0));
  border-top: 1px solid rgba(44,58,73,.6);
}
.bar .btn { flex: 1 1 0; max-width: 340px; }
.btn {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: var(--tap); min-width: 88px; padding: 8px 18px; border-radius: var(--r);
  background: var(--surface2); border: 1px solid var(--line); color: var(--text); cursor: pointer;
  font-weight: 600; text-align: center; line-height: 1.3; user-select: none;
}
.btn small { font-weight: 400; font-size: .74em; color: inherit; opacity: .85; }
.btn.primary { background: #e7bd66; color: #1a1206; border-color: #e7bd66; }
.btn.danger { background: #3a1d1d; border-color: #7a3a36; color: #ffd2cc; }
.btn.small { min-height: 44px; font-size: .92em; padding: 6px 14px; }
.btn:disabled { opacity: .42; cursor: default; }
.btn:active:not(:disabled) { transform: translateY(1px); }
label.btn input { display: none; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }

.chip { display: block; margin: .6em 0; padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: .9em; color: var(--sub); }
.chip.ok { color: var(--ok); border-color: #2e5a40; }
.chip.bad { color: var(--bad); border-color: #6a3430; }
.chip.warn { color: var(--warn); border-color: #5e4a25; }
.chip p { margin: 0 0 .5em; }
.saved { color: var(--ok); font-size: .86em; }

/* タイトル */
.title-screen { text-align: center; }
.title-art { position: relative; border-radius: 18px; overflow: hidden; aspect-ratio: 16 / 7; max-height: 42vh; margin: 0 auto 8px; border: 1px solid var(--line); }
.title-art svg, .scene svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.logo { font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif; font-size: 2.3em; letter-spacing: .18em; margin: .3em 0 0; font-weight: 600; }
.sub { color: var(--sub); }
.stats { color: var(--water); font-size: .92em; }
.title-screen .chip { max-width: 560px; margin-left: auto; margin-right: auto; }

/* 夜景 */
.sil path, .sil rect { fill: #0e151d; stroke: #1e2a37; stroke-width: .3; }
.win rect { fill: #e8c174; opacity: .45; }
.hedge { fill: #0f1d17; stroke: #1f3a2c; stroke-width: .4; }
.grate { fill: #070a0e; stroke: #3a4a5a; stroke-width: .3; }
.grate-l, .rail, .steps, .grass { stroke: #3a4a5a; stroke-width: .5; fill: none; }
.roof { fill: #1d2833; stroke: #44566a; stroke-width: .3; }
.gutter { stroke: #263544; stroke-width: 1.4; fill: none; }
.wall { fill: #141c24; stroke: #2a3644; stroke-width: .3; }
.lid { fill: #0a0f14; stroke: #4a5a6a; stroke-width: .4; }
.lamp { stroke: #2c3846; stroke-width: .9; fill: none; }
.lamp-head { fill: #3b4652; } .lamp-head.on { fill: #ffe1a0; }
.puddle { fill: #1c2c3c; }
.marker { cursor: pointer; }
.marker circle { fill: rgba(140,195,230,.18); stroke: var(--water); stroke-width: .5; }
.marker text { font-size: 3px; fill: var(--text); font-weight: 700; pointer-events: none; }
.marker.sel circle { fill: rgba(242,196,109,.35); stroke: var(--lamp); stroke-width: .7; }
.rain { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.rain.still { display: none; }

/* 夜の画面 */
.nhead { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; justify-content: space-between; margin-bottom: 10px; color: var(--sub); }
.nhead .env b { margin-right: 8px; color: var(--text); }
.lampmark.on { color: var(--lamp) !important; }
.lampmark.off { color: var(--water) !important; }
.count { font-weight: 700; color: var(--text); background: var(--surface); padding: 4px 12px; border-radius: 99px; border: 1px solid var(--line); }
.scene { position: relative; aspect-ratio: 5 / 3; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: #0b1016; }
.layout { display: grid; gap: 16px; }
@media (orientation: landscape) and (min-width: 900px) {
  .layout { grid-template-columns: 1.05fr 1fr; align-items: start; }
  .col-a { position: sticky; top: calc(var(--safe-t) + 12px); }
}
@media (orientation: portrait) { .scene { aspect-ratio: 16 / 8; } }
.guide { margin: 10px 0 0; padding: 10px 14px; border-left: 3px solid var(--lamp); background: rgba(242,196,109,.08); border-radius: 0 10px 10px 0; font-size: .94em; }
.spots { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.spot {
  width: 100%; display: flex; gap: 12px; align-items: flex-start; text-align: left; min-height: 64px;
  padding: 12px 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); cursor: pointer;
}
.spot.sel { border-color: var(--lamp); background: #1f1c15; box-shadow: 0 0 0 1px var(--lamp) inset; }
.num { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--water); color: var(--water); font-weight: 700; font-size: .9em; margin-top: 2px; }
.spot.sel .num { border-color: var(--lamp); color: var(--lamp); }
.sbody { display: flex; flex-direction: column; gap: 2px; }
.sign { color: var(--sub); }
.sign.fresh { color: #d8e6f1; }
.sign.fresh::before { content: "〰 "; color: var(--water); }
.used { font-size: .8em; color: var(--dim); }
.tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.tool {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 84px;
  padding: 10px 6px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); cursor: pointer; font-weight: 600; font-size: .92em; text-align: center; line-height: 1.3;
}
.tool.sel { border-color: var(--lamp); background: #1f1c15; box-shadow: 0 0 0 1px var(--lamp) inset; }
.tool:disabled { opacity: .4; cursor: default; }
.tool small { font-weight: 400; font-size: .74em; }
.ti { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pick { text-align: center; color: var(--sub); margin-top: 10px; min-height: 1.7em; }

/* 選択カード */
.choices { display: grid; gap: 12px; }
.grid2 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.card {
  display: flex; flex-direction: column; gap: 4px; text-align: left; width: 100%; min-height: 64px; padding: 14px 16px;
  border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); cursor: pointer;
}
.card b { font-size: 1.06em; }
.card span { color: var(--sub); font-size: .92em; }
.card.inv.ready { border-color: var(--lamp); }
.card.inv.ready span { color: var(--lamp); }
.card.inv.solved span { color: var(--ok); }
.seg { display: flex; gap: 6px; background: var(--surface); padding: 5px; border-radius: 14px; border: 1px solid var(--line); margin: 6px 0 12px; }
.seg-b { flex: 1; min-height: 46px; border-radius: 10px; border: 0; background: transparent; cursor: pointer; font-weight: 600; color: var(--sub); }
.seg-b.on { background: var(--surface2); color: var(--text); box-shadow: 0 0 0 1px var(--line) inset; }
.howto { color: var(--sub); padding-left: 1.2em; }

/* 結果シート */
.modal {
  position: fixed; inset: 0; z-index: 30; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(3,6,9,.72); padding: calc(var(--safe-t) + 12px) var(--safe-r) 0 var(--safe-l);
}
.modal[hidden] { display: none; }
.sheet {
  width: min(760px, 100%); max-height: 100%; overflow: auto; -webkit-overflow-scrolling: touch;
  background: #10171f; border: 1px solid var(--line); border-bottom: 0; border-radius: 20px 20px 0 0;
  padding: 20px 20px 0; animation: up .22s ease-out;
}
.sheet-bar { position: sticky; bottom: 0; display: flex; gap: 10px; padding: 12px 0 calc(var(--safe-b) + 14px); background: linear-gradient(to top, #10171f 80%, rgba(16,23,31,0)); margin-top: 10px; }
.sheet-bar .btn { flex: 1; }
@keyframes up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.rhead { color: var(--sub); margin-top: 0; }
.entries { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.entries li { padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.entries li p { margin: .3em 0 0; }
.tag { font-size: .76em; letter-spacing: .06em; color: var(--dim); display: inline-flex; gap: 8px; align-items: center; }
.tag em { font-style: normal; color: #1a1206; background: var(--lamp); padding: 0 7px; border-radius: 6px; font-weight: 700; }
.e-find { border-color: var(--lamp) !important; background: #1b1913 !important; }
.e-find .tag, .e-refind .tag { color: var(--lamp); }
.e-note .tag { color: var(--ok); }
.e-hint .tag, .e-trace .tag { color: var(--water); }
.sname { display: block; font-size: 1.25em; font-family: "Hiragino Mincho ProN", "Yu Mincho", serif; }
.e-note .sname { font-size: 1em; }
.dim { display: block; color: var(--water); }
.reveal { margin: 6px -4px 4px; color: #f3dca8; }
.reveal svg { width: 100%; max-height: 38vh; }
.art { fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.art .f { fill: currentColor; fill-opacity: .14; }
.art .e { fill: currentColor; stroke: none; }
.art .g { fill: #ffe9a8; stroke: none; filter: drop-shadow(0 0 4px #ffd36b); }
.art .gb { fill: #9fe3ff; stroke: none; filter: drop-shadow(0 0 4px #5fc8ff); }
.reveal .art path, .reveal .art ellipse, .reveal .art rect, .reveal .art circle {
  stroke-dasharray: 600; stroke-dashoffset: 600; animation: draw 1.4s ease-out forwards;
}
.reveal .art { animation: drift 1.6s ease-out; filter: drop-shadow(0 0 10px rgba(243,220,168,.35)); }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes drift { from { transform: translateX(-6%); opacity: .2; } to { transform: none; opacity: 1; } }
html.short .reveal .art, html.short .reveal .art * { animation: none !important; stroke-dashoffset: 0 !important; }
html.short .sheet { animation: none; }
@media (prefers-reduced-motion: reduce) { .reveal .art, .reveal .art * { animation: none !important; stroke-dashoffset: 0 !important; } }

/* 録音 */
.sound { margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: #0d141b; border: 1px dashed #34485c; }
.wave { display: flex; align-items: center; gap: 3px; height: 30px; }
.wave .b { display: block; width: 8px; border-radius: 3px; background: var(--water); }
.wave .hi { height: 12px; } .wave .lo { height: 20px; opacity: .8; } .wave .big { height: 28px; }
.wave .hum { height: 8px; width: 11px; opacity: .7; border-radius: 1px; } .wave .rest { height: 2px; opacity: .3; }
.stext { font-weight: 600; margin: .3em 0; }

/* 記録・ノート */
.obs { border-top: 1px solid var(--line); padding-top: 6px; }
.obs h3 { margin-top: .8em; color: var(--text); font-size: .98em; }
.logi { margin: 10px 0; }
.logi > b { display: block; color: var(--sub); font-size: .9em; margin-bottom: 4px; }
.box { margin-top: 16px; padding: 12px 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.box h3 { margin-top: .2em; color: var(--text); }
.box.tip { border-color: #2f4e66; }
.box ul { margin: 0; padding-left: 1.2em; }
.zgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.zcard {
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 150px; padding: 10px; border-radius: var(--r);
  background: #161f29; border: 1px solid var(--line); cursor: pointer; text-align: center;
}
.zcard.found { background: #1a1f22; border-color: #4b4430; }
.zcard:disabled { opacity: .45; cursor: default; }
.zart { width: 100%; color: #ead6a6; }
.zart svg { width: 100%; height: 76px; }
.zart.unknown, .zbig.unknown { display: grid; place-items: center; height: 76px; font-size: 2em; color: var(--dim); }
.zdetail h2 small { display: block; font-size: .6em; color: var(--sub); font-weight: 400; }
.zdetail h2 { font-family: "Hiragino Mincho ProN", "Yu Mincho", serif; margin-bottom: 0; }
.zbig { color: #f0dcae; background: #0d141b; border-radius: 14px; border: 1px solid var(--line); }
.zbig svg { width: 100%; max-height: 32vh; display: block; }
.zbig.unknown { height: 140px; font-size: 3em; }
.cond { font-size: .88em; color: var(--water); background: #0d141b; padding: 8px 12px; border-radius: 10px; }
.notes { padding-left: 1.1em; }
.notes li { margin: .5em 0; }
.notes .unk { color: var(--dim); }
.reqs { list-style: none; padding: 0; }
.reqs li { display: grid; grid-template-columns: 1.4em 1fr; padding: 6px 0; border-bottom: 1px solid var(--line); }
.reqs li small { grid-column: 2; }
.reqs li.done span, .reqs li.done b { color: var(--ok); }
.qset { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px 12px; margin: 12px 0; }
.qset.wrong { border-color: #7a3a36; }
.qset legend { padding: 0 6px; font-weight: 600; }
.opt { display: block; width: 100%; text-align: left; min-height: var(--tap); margin: 8px 0 0; padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; }
.opt.sel { border-color: var(--lamp); background: #1f1c15; }
.q { font-weight: 600; margin-top: 1em; }
.a { color: var(--ok); }
.bad { color: var(--bad) !important; }
.toggle { display: flex; width: 100%; gap: 14px; align-items: center; justify-content: space-between; text-align: left; min-height: 64px; padding: 12px 16px; margin: 8px 0; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); cursor: pointer; }
.toggle span:first-child { display: flex; flex-direction: column; }
.toggle .sw { flex: none; min-width: 64px; text-align: center; padding: 6px 10px; border-radius: 99px; background: var(--surface2); border: 1px solid var(--line); font-weight: 700; color: var(--sub); }
.toggle[aria-checked="true"] .sw { background: #e7bd66; color: #1a1206; border-color: #e7bd66; }
.ver { margin-top: 2em; }
.ending p { max-width: 40em; }
.ending h2 { font-family: "Hiragino Mincho ProN", "Yu Mincho", serif; font-size: 1.6em; }
