/* ボトメ — 世界観: 夜の海・月・ランタン・古い紙（docs/UIUXデザイン指針.md） */
:root {
  --sea-deep: #0b1a2b; --sea: #12304a; --sea-light: #1f4d6b;
  --moon: #f4ead8; --lantern: #f2b25c; --lantern-deep: #d98f2e; --glass: #7fc8b6;
  --paper: #f4ead8; --paper-shadow: #d9c9a8; --ink: #3b3128;
  --text: #e6eef5; --text-dim: #9fb3c4; --danger: #e07a6a;
  --serif: "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --sans: "Zen Kaku Gothic New", "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
  --nav-h: 64px; --radius: 16px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--sans); font-size: 15px; line-height: 1.7; color: var(--text);
  background: var(--sea-deep);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
/* 背景は独立した固定レイヤー。スクロールやアドレスバーの伸縮で動かない */
.bg { position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: var(--sea-deep) radial-gradient(ellipse at 50% -10%, #23486a 0%, var(--sea) 40%, var(--sea-deep) 100%); }
.bg .art { position: absolute; top: 0; bottom: 0; left: 50%; width: 100%; max-width: 480px; transform: translateX(-50%);
  background: url("/assets/img/sea_night.webp") center top / cover no-repeat; }
.bg .art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(11,26,43,0) 45%, rgba(11,26,43,.55) 100%); }
.bg .stars { position: absolute; inset: 0; opacity: .7; animation: twinkle 6s ease-in-out infinite alternate;
  background:
    radial-gradient(1px 1px at 12% 8%, #fff 60%, transparent), radial-gradient(1px 1px at 68% 14%, #fff 60%, transparent),
    radial-gradient(1.5px 1.5px at 84% 6%, #fff 60%, transparent), radial-gradient(1px 1px at 40% 22%, #fff 60%, transparent),
    radial-gradient(1px 1px at 92% 30%, #fff 60%, transparent), radial-gradient(1px 1px at 22% 34%, #fff 60%, transparent); }
@media (min-width: 560px) { .bg .art { top: 24px; bottom: 24px; border-radius: 28px; box-shadow: 0 0 0 1px rgba(255,255,255,.06), 0 30px 80px rgba(0,0,0,.6); } }
.serif { font-family: var(--serif); }
.dim { color: var(--text-dim); }
.num { font-variant-numeric: tabular-nums; }
a { color: var(--glass); }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }

/* 端末枠：スマホは全面、PC は中央 480px */
.device { position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh; max-width: 480px; margin: 0 auto; }
@keyframes twinkle { from { opacity: .35 } to { opacity: .9 } }
@media (min-width: 560px) { .device { min-height: calc(100vh - 48px); margin: 24px auto; } }

/* 起動 */
.boot { min-height: 100vh; display: grid; place-items: center; text-align: center; color: var(--text-dim); }
.boot-moon { width: 56px; height: 56px; border-radius: 50%; background: var(--moon); box-shadow: 0 0 40px 10px rgba(244,234,216,.35); margin: 0 auto 16px; animation: breathe 3s ease-in-out infinite; }
@keyframes breathe { 0%,100% { transform: scale(1) } 50% { transform: scale(1.06) } }

/* 画面 */
.screen { position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh; padding: 16px 16px calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); }
.topbar .gear, .card .gear { background: none; border: 0; color: var(--text-dim); font-size: 20px; padding: 0; line-height: 1; width: 44px; min-width: 44px; height: 44px; flex: none; display: inline-grid; place-items: center; border-radius: 12px; }
.topbar .gear:active, .card .gear:active { background: rgba(255,255,255,.1); }
.topbar .right { display: flex; align-items: center; gap: 6px; }
.screen.center { display: grid; place-items: center; text-align: center; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.topbar h1 { font-family: var(--serif); font-size: 20px; margin: 0; font-weight: 500; letter-spacing: .04em; }
.topbar .sub { font-size: 12px; color: var(--text-dim); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.08); font-size: 12px; }
.pill .shell { color: var(--lantern); }
.section-title { font-family: var(--serif); font-size: 16px; color: var(--moon); margin: 22px 0 10px; display: flex; align-items: baseline; justify-content: space-between; }
.section-title small { font-family: var(--sans); font-size: 12px; color: var(--text-dim); }

/* カード */
.card {
  position: relative; background: linear-gradient(160deg, rgba(31,77,107,.78), rgba(18,48,74,.82));
  border: 1px solid rgba(255,255,255,.08); border-radius: var(--radius); padding: 14px 16px; backdrop-filter: blur(6px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 10px 30px rgba(0,0,0,.25);
}
.card + .card { margin-top: 10px; }
.card.tap { cursor: pointer; transition: transform .15s ease; position: relative; }
.card.tap::after { content: "›"; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--text-dim); font-size: 18px; }
.card.tap:active { transform: scale(.985); }
.card .row { display: flex; align-items: center; gap: 12px; }
.card .grow { flex: 1; min-width: 0; }
.card .meta { font-size: 12px; color: var(--text-dim); }
.card .title { font-family: var(--serif); font-size: 16px; color: var(--moon); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--lantern); color: var(--ink); font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; background: rgba(255,255,255,.1); color: var(--text); }
.chip.glass { background: rgba(127,200,182,.18); color: var(--glass); }
.chip.lantern { background: rgba(242,178,92,.18); color: var(--lantern); }
.chip.dim { color: var(--text-dim); }

/* ボタン */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 14px; border: 1px solid transparent; font-weight: 500; text-decoration: none; transition: transform .12s ease, background .2s ease; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn.primary { background: var(--lantern); color: var(--ink); box-shadow: 0 0 0 1px rgba(255,255,255,.1) inset, 0 8px 30px rgba(242,178,92,.35); }
.btn.primary:hover { background: #f6be74; }
.btn.primary:disabled { background: #6b6252; color: #b8ad98; box-shadow: none; cursor: not-allowed; }
.btn.ghost { background: transparent; border-color: rgba(127,200,182,.6); color: var(--glass); }
.btn.ghost:disabled { border-color: rgba(159,179,196,.4); color: var(--text-dim); cursor: not-allowed; }
.btn.danger { background: transparent; border-color: rgba(224,122,106,.6); color: var(--danger); }
.btn.block { width: 100%; }
.btn.small { min-height: 44px; padding: 0 14px; font-size: 13px; border-radius: 10px; }
.btn-row { display: flex; gap: 10px; margin-top: 14px; }
.btn-row .btn { flex: 1; }
.link { background: none; border: 0; color: var(--text-dim); text-decoration: underline; padding: 10px 8px; min-height: 44px; display: inline-flex; align-items: center; font-size: 14px; }

/* 入力 */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.input { width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px; border: 1px solid rgba(255,255,255,.14); background: rgba(11,26,43,.6); color: var(--text); font-family: inherit; font-size: 16px; outline: none; }
.input:focus { border-color: var(--glass); box-shadow: 0 0 0 3px rgba(127,200,182,.18); }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.toggle input { width: 28px; height: 28px; accent-color: var(--lantern); flex: none; }
.toggle { cursor: pointer; min-height: 44px; }
.hint { font-size: 12px; color: var(--text-dim); margin-top: 6px; }
.error { color: var(--danger); font-size: 13px; margin-top: 8px; }

/* 手紙用紙 */
.paper {
  position: relative; color: var(--ink); font-family: var(--serif); font-size: 16px; line-height: 1.95;
  background: var(--paper) url("/assets/img/letter_paper.webp") center / cover; border-radius: 6px; padding: 22px 20px 26px;
  box-shadow: 0 1px 0 var(--paper-shadow), 0 14px 30px rgba(0,0,0,.35);
  clip-path: polygon(0 1.5%, 3% 0, 7% 1.2%, 12% 0, 20% 1%, 30% 0, 40% 1.2%, 50% 0, 60% 1%, 70% 0, 80% 1.2%, 90% 0, 97% 1%, 100% 0, 100% 98.5%, 96% 100%, 90% 98.8%, 80% 100%, 70% 98.8%, 60% 100%, 50% 98.8%, 40% 100%, 30% 98.8%, 20% 100%, 10% 98.8%, 3% 100%, 0 99%);
}
.paper::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(transparent 0 30px, rgba(59,49,40,.08) 30px 31px); pointer-events: none; opacity: .8; border-radius: 6px; }
.paper .body { position: relative; white-space: pre-wrap; word-break: break-word; }
.paper .sign { position: relative; text-align: right; font-size: 13px; color: #6b5d4f; margin-top: 12px; }
.paper .photo { position: relative; margin: 12px 0 4px; border: 6px solid #fff; box-shadow: 0 6px 14px rgba(0,0,0,.25); transform: rotate(-1.2deg); }
.paper .photo img { border-radius: 2px; }
.paper textarea { position: relative; width: 100%; min-height: 220px; border: 0; background: transparent; resize: vertical; font: inherit; color: var(--ink); line-height: 31px; outline: none; padding: 0; }
.paper textarea::placeholder { color: #9b8b76; }
.paper .counter { position: relative; text-align: right; font-size: 12px; color: #8a7a66; font-family: var(--sans); }
.paper .counter.over { color: var(--danger); }
.paper.mine { transform: rotate(.6deg); }
.paper.theirs { transform: rotate(-.5deg); }
.thread .paper { margin: 14px 0; font-size: 15px; padding: 16px 16px 18px; }
.thread .paper .from { position: relative; font-family: var(--sans); font-size: 11px; color: #8a7a66; margin-bottom: 6px; }

/* 枡（枠表示） */
.slots { display: flex; gap: 14px; }
.slotbox { flex: 1; }
.slotbox .lab { font-size: 11px; color: var(--text-dim); margin-bottom: 4px; }
.slot-dots { display: flex; gap: 6px; }
.dot { width: 26px; height: 26px; border-radius: 50%; border: 1.5px dashed rgba(230,238,245,.35); display: grid; place-items: center; font-size: 13px; }
.dot.used { border-style: solid; border-color: var(--glass); background: rgba(127,200,182,.15); }
.dot.lock { border-style: solid; border-color: var(--lantern); background: rgba(242,178,92,.15); }

/* 海の舞台（浜辺） */
.stage { position: relative; height: 230px; border-radius: var(--radius); overflow: hidden; background: linear-gradient(#0f2a44, #0b1a2b); border: 1px solid rgba(255,255,255,.08); }
.stage .moonlight { position: absolute; left: 50%; top: 40%; width: 220px; height: 220px; transform: translate(-50%, -50%); background: radial-gradient(circle, rgba(244,234,216,.22), transparent 60%); pointer-events: none; }
.stage .wave { position: absolute; left: -50%; width: 200%; height: 80px; bottom: -8px; fill: rgba(31,77,107,.9); animation: drift 12s linear infinite; }
.stage .wave.w2 { bottom: 6px; fill: rgba(18,48,74,.9); animation-duration: 17s; animation-direction: reverse; }
.stage .wave.w3 { bottom: 22px; fill: rgba(31,77,107,.5); animation-duration: 23s; }
@keyframes drift { from { transform: translateX(0) } to { transform: translateX(25%) } }
.stage .bottle-float { position: absolute; left: 50%; bottom: 46px; width: 92px; margin-left: -46px; filter: drop-shadow(0 8px 12px rgba(0,0,0,.5)); animation: bob 4s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-6deg) } 50% { transform: translateY(-8px) rotate(4deg) } }
.stage .caption { position: absolute; left: 0; right: 0; top: 14px; text-align: center; font-family: var(--serif); color: var(--moon); font-size: 15px; text-shadow: 0 2px 10px rgba(0,0,0,.6); padding: 0 16px; }
.stage .empty { position: absolute; inset: 0; background: url("/assets/img/empty_beach.webp") center / cover; opacity: .0; transition: opacity .8s ease; }
.stage.is-empty .empty { opacity: .9; }
.stage.is-empty .bottle-float { display: none; }
.stage.checking .wave { animation-duration: 3s; }
.stage.cast .bottle-float { animation: castaway 1.3s cubic-bezier(.3,.7,.2,1) forwards; }
@keyframes castaway { 0% { transform: translateY(0) scale(1) rotate(0) } 40% { transform: translate(60px,-120px) scale(.8) rotate(160deg) } 100% { transform: translate(140px,-40px) scale(.15) rotate(420deg); opacity: 0 } }
.stage .found { position: absolute; left: 50%; bottom: 40px; width: 110px; margin-left: -55px; animation: wash 1.2s ease-out forwards; filter: drop-shadow(0 0 22px rgba(242,178,92,.65)); }
@keyframes wash { 0% { transform: translateY(60px) scale(.6); opacity: 0 } 60% { opacity: 1 } 100% { transform: translateY(0) scale(1); opacity: 1 } }

/* 漂流記 */
.story { font-family: var(--serif); font-size: 17px; line-height: 1.9; color: var(--moon); text-align: center; padding: 8px 6px 4px; }
.story p { margin: 0 0 6px; opacity: 0; transform: translateY(6px); animation: fadeup .8s ease forwards; }
.story p:nth-child(2) { animation-delay: .5s; }
.story p:nth-child(3) { animation-delay: 1s; }
.story em { font-style: normal; color: var(--lantern); font-size: 1.15em; }
@keyframes fadeup { to { opacity: 1; transform: none } }
.sender { display: flex; align-items: center; gap: 10px; justify-content: center; margin: 8px 0 14px; font-size: 13px; color: var(--text-dim); }
.sender b { color: var(--text); font-weight: 500; }

/* 島 */
.island-hero { position: relative; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16/9; border: 1px solid rgba(255,255,255,.08); }
.island-hero img { width: 100%; height: 100%; object-fit: cover; }
.island-hero .name { position: absolute; left: 14px; bottom: 10px; font-family: var(--serif); color: var(--moon); font-size: 18px; text-shadow: 0 2px 8px rgba(0,0,0,.7); }
.island-hero .beacon { position: absolute; right: 12px; top: 10px; }
.xpbar { height: 8px; border-radius: 4px; background: rgba(255,255,255,.1); overflow: hidden; margin: 6px 0; }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--glass), var(--lantern)); border-radius: 4px; transition: width .6s ease; }
.task .dur { font-size: 12px; color: var(--text-dim); }
.task .reward { font-size: 12px; color: var(--lantern); }
.task.locked { opacity: .55; }
.task.running { border-color: rgba(242,178,92,.45); }
.task.ready { border-color: var(--lantern); box-shadow: 0 0 24px rgba(242,178,92,.3); animation: glow 2s ease-in-out infinite; }
@keyframes glow { 0%,100% { box-shadow: 0 0 14px rgba(242,178,92,.25) } 50% { box-shadow: 0 0 30px rgba(242,178,92,.5) } }
.progress { height: 4px; background: rgba(255,255,255,.1); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--lantern); }

/* カモメ便 */
.chat { display: flex; flex-direction: column; gap: 10px; padding-bottom: 8px; }
.bubble { max-width: 82%; padding: 10px 14px; border-radius: 16px; font-size: 15px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.bubble.theirs { align-self: flex-start; background: rgba(244,234,216,.95); color: var(--ink); border-bottom-left-radius: 4px; font-family: var(--serif); }
.bubble.mine { align-self: flex-end; background: rgba(127,200,182,.22); border: 1px solid rgba(127,200,182,.4); border-bottom-right-radius: 4px; }
.bubble .t { display: block; font-size: 10px; opacity: .7; margin-top: 4px; font-family: var(--sans); }
.bubble.flying { border-style: dashed; opacity: .8; }
.bubble img { border-radius: 8px; margin-top: 6px; }
.composer { position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); display: flex; gap: 8px; align-items: flex-end; padding: 10px 0 0; background: linear-gradient(transparent, rgba(11,26,43,.95) 30%); }
.composer textarea { flex: 1; min-height: 44px; max-height: 120px; }
.gull { position: fixed; top: 14%; left: -140px; width: 120px; z-index: 50; pointer-events: none; animation: fly 1.8s ease-in forwards; filter: drop-shadow(0 6px 12px rgba(0,0,0,.5)); }
@keyframes fly { 0% { transform: translate(0,0) rotate(-6deg); opacity: 0 } 15% { opacity: 1 } 100% { transform: translate(calc(100vw + 300px), -60px) rotate(4deg); opacity: 1 } }

/* ボトムナビ */
.nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); z-index: 40;
  display: grid; grid-template-columns: repeat(4, 1fr); background: rgba(11,26,43,.88); backdrop-filter: blur(10px); border-top: 1px solid rgba(255,255,255,.08); }
@media (min-width: 560px) { .nav { bottom: 24px; border-radius: 0 0 28px 28px; } }
.nav button { position: relative; background: none; border: 0; color: var(--text-dim); font-size: 11px; display: grid; place-items: center; gap: 2px; padding-top: 6px; min-height: 56px; }
.nav button svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.nav button.active { color: var(--lantern); }
.nav .badge { position: absolute; top: 4px; right: calc(50% - 22px); }

/* FAB */
.fab { position: fixed; right: max(16px, calc(50% - 240px + 16px)); bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom)); z-index: 41; width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--lantern); color: var(--ink); box-shadow: 0 10px 30px rgba(242,178,92,.45); display: grid; place-items: center; }
.fab img { width: 36px; }
@media (min-width: 560px) { .fab { bottom: calc(var(--nav-h) + 42px); } }

/* トースト / オーバーレイ */
#toast-root { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 100; width: min(92vw, 440px); display: grid; gap: 8px; pointer-events: none; }
.toast { background: var(--paper); color: var(--ink); font-family: var(--serif); padding: 12px 16px; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: dropin .5s ease; font-size: 14px; }
.toast.bad { background: #f3d9d4; }
@keyframes dropin { from { transform: translateY(-30px) rotate(-1deg); opacity: 0 } to { transform: none; opacity: 1 } }
.overlay { position: fixed; inset: 0; z-index: 90; background: rgba(5,12,20,.72); display: grid; place-items: center; padding: 20px; animation: fadein .3s ease; }
@keyframes fadein { from { opacity: 0 } to { opacity: 1 } }
.modal { width: min(92vw, 420px); }
.modal .card { padding: 22px 20px; text-align: center; }
.levelup { font-family: var(--serif); color: var(--lantern); font-size: 22px; margin: 6px 0; }

/* オンボーディング */
.hero { text-align: center; padding-top: 12vh; }
.hero .logo { font-family: var(--serif); font-size: 44px; letter-spacing: .18em; color: var(--moon); text-shadow: 0 0 30px rgba(244,234,216,.35); margin: 0; font-weight: 500; }
.hero .tag { font-family: var(--serif); color: var(--text-dim); font-size: 14px; margin: 6px 0 26px; }
.hero .bottle-img { width: 120px; margin: 0 auto 10px; animation: bob 5s ease-in-out infinite; filter: drop-shadow(0 12px 20px rgba(0,0,0,.6)); }
.onboard-card { margin-top: 10px; }
.legal { font-size: 11px; color: var(--text-dim); margin-top: 14px; }

.empty-note { text-align: center; color: var(--text-dim); padding: 30px 10px; font-family: var(--serif); }
.list-gap { display: grid; gap: 10px; }
.back { background: none; border: 0; color: var(--text-dim); padding: 0 12px 0 0; min-height: 44px; font-size: 14px; display: inline-flex; align-items: center; gap: 4px; }
.transit { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(242,178,92,.1); border: 1px dashed rgba(242,178,92,.5); font-size: 13px; }
.transit img { width: 34px; }

/* 資源・建物・クエスト・図鑑 */
.res { display: flex; gap: 8px; flex-wrap: wrap; }
.res .pill { font-size: 13px; }
.res .wood { color: #d9b48a; }
.building .lvl { display: inline-flex; gap: 3px; margin-left: 6px; vertical-align: middle; }
.building .lvl i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.15); }
.building .lvl i.on { background: var(--lantern); box-shadow: 0 0 6px rgba(242,178,92,.7); }
.building .cost { font-size: 12px; color: var(--text-dim); }
.building .cost b { color: var(--text); font-weight: 500; }
.quest.done { border-color: var(--lantern); }
.quest.claimed { opacity: .5; }
.quest .check { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.25); display: grid; place-items: center; font-size: 14px; flex: none; }
.quest.done .check, .quest.claimed .check { background: var(--lantern); color: var(--ink); border-color: var(--lantern); }
.finds { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.find { aspect-ratio: 1; border-radius: 12px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); display: grid; place-items: center; text-align: center; font-size: 11px; padding: 4px; color: var(--text-dim); line-height: 1.3; position: relative; }
.find.have { background: rgba(244,234,216,.12); color: var(--moon); border-color: rgba(244,234,216,.3); }
.find.r3.have { border-color: var(--lantern); box-shadow: 0 0 12px rgba(242,178,92,.3); }
.find .n { position: absolute; right: 4px; top: 3px; font-size: 10px; color: var(--lantern); }
.find-card { text-align: center; }
.find-card .name { font-family: var(--serif); font-size: 20px; color: var(--lantern); margin: 6px 0 2px; }
.find-card .flavor { font-family: var(--serif); color: var(--moon); }
.tabs { display: flex; gap: 6px; margin: 14px 0 6px; }
.tabs button { flex: 1; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); color: var(--text-dim); border-radius: 10px; padding: 0 4px; min-height: 44px; font-size: 13px; }
.tabs button.active { background: rgba(242,178,92,.15); color: var(--lantern); border-color: rgba(242,178,92,.4); }
.steps { display: grid; gap: 6px; }
.step { display: flex; gap: 10px; align-items: center; font-size: 14px; }
.step .check { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.25); display: grid; place-items: center; font-size: 12px; flex: none; }
.step.done { color: var(--text-dim); text-decoration: line-through; }
.step.done .check { background: var(--glass); color: var(--ink); border-color: var(--glass); }
.code { font-family: ui-monospace, monospace; font-size: 22px; letter-spacing: .1em; color: var(--lantern); text-align: center; padding: 10px; background: rgba(0,0,0,.25); border-radius: 10px; margin: 8px 0; user-select: all; }
.npc-tag { display: inline-block; font-size: 11px; color: var(--glass); }

/* 島の絵に建物 */
.island-hero .sprites { position: absolute; inset: 0; pointer-events: none; }
.island-hero .sprite { position: absolute; height: auto !important; object-fit: contain; transform: translate(-50%, -100%); filter: drop-shadow(0 3px 6px rgba(0,0,0,.6)); animation: sprite-in .9s ease both; transform-origin: 50% 100%; }
.island-hero .sprite.lv2 { transform: translate(-50%, -100%) scale(1.12); filter: drop-shadow(0 3px 6px rgba(0,0,0,.6)) drop-shadow(0 0 10px rgba(242,178,92,.35)); }
.island-hero .sprite.lv3 { transform: translate(-50%, -100%) scale(1.24); filter: drop-shadow(0 3px 6px rgba(0,0,0,.6)) drop-shadow(0 0 16px rgba(242,178,92,.55)); }
@keyframes sprite-in { from { opacity: 0; transform: translate(-50%, -90%) scale(.8) } to { opacity: 1 } }
.island-hero .fireglow { position: absolute; width: 22%; aspect-ratio: 1; transform: translate(-50%, -50%) scale(var(--s, 1)); background: radial-gradient(circle, rgba(242,178,92,.45), rgba(242,178,92,0) 65%); mix-blend-mode: screen; animation: fireglow 2.4s ease-in-out infinite; }
@keyframes fireglow { 0%,100% { opacity: .75 } 50% { opacity: 1 } }
.island-hero .beam { position: absolute; width: 60%; aspect-ratio: 1; transform: translate(-50%, -50%); background: conic-gradient(from 0deg, rgba(242,178,92,0) 0deg, rgba(242,178,92,.35) 14deg, rgba(242,178,92,0) 30deg); border-radius: 50%; mix-blend-mode: screen; animation: beam 9s linear infinite; }
@keyframes beam { to { transform: translate(-50%, -50%) rotate(360deg) } }

/* 季節イベント：空の演出（背景レイヤーに重ねる） */
.bg::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 1.2s ease; }
body.sky-moon .bg::after { opacity: 1; background: radial-gradient(circle at 78% 14%, rgba(244,234,216,.55) 0, rgba(244,234,216,.25) 6%, rgba(244,234,216,0) 22%); animation: moonglow 8s ease-in-out infinite alternate; }
@keyframes moonglow { from { opacity: .7 } to { opacity: 1 } }
body.sky-meteor .bg::after { opacity: 1; background: linear-gradient(115deg, transparent 0 40%, rgba(255,255,255,.9) 40.2%, transparent 40.6%), linear-gradient(120deg, transparent 0 62%, rgba(255,255,255,.8) 62.2%, transparent 62.5%); background-size: 200% 60%, 200% 50%; background-repeat: no-repeat; animation: meteor 6s linear infinite; }
@keyframes meteor { 0% { background-position: 120% -20%, 140% 10%; opacity: 0 } 10% { opacity: 1 } 60% { background-position: -60% 40%, -80% 60%; opacity: 1 } 61%,100% { opacity: 0 } }
body.sky-sakura .bg::after { opacity: 1; background: radial-gradient(3px 3px at 12% 20%, rgba(255,200,215,.9), transparent 60%), radial-gradient(2.5px 2.5px at 40% 8%, rgba(255,200,215,.8), transparent 60%), radial-gradient(3px 3px at 70% 30%, rgba(255,200,215,.9), transparent 60%), radial-gradient(2px 2px at 88% 12%, rgba(255,200,215,.8), transparent 60%), radial-gradient(3px 3px at 55% 45%, rgba(255,200,215,.7), transparent 60%); background-size: 100% 100%; animation: petals 14s linear infinite; }
@keyframes petals { from { background-position: 0 -10% } to { background-position: 0 110% } }
body.sky-stars .bg::after, body.sky-dawn .bg::after { opacity: 1; background: radial-gradient(1.5px 1.5px at 20% 12%, #fff, transparent 60%), radial-gradient(1.5px 1.5px at 60% 6%, #fff, transparent 60%), radial-gradient(2px 2px at 80% 20%, #fff, transparent 60%), radial-gradient(1.5px 1.5px at 35% 30%, #fff, transparent 60%); animation: twinkle 3s ease-in-out infinite alternate; }
body.sky-dawn .bg::after { background: linear-gradient(180deg, rgba(242,178,92,0) 30%, rgba(242,178,92,.18) 60%, rgba(242,178,92,0) 75%); animation: none; }
body.sky-lantern .bg::after { opacity: 1; background: radial-gradient(4px 4px at 15% 70%, rgba(242,178,92,.9), transparent 60%), radial-gradient(3px 3px at 45% 78%, rgba(242,178,92,.8), transparent 60%), radial-gradient(4px 4px at 72% 66%, rgba(242,178,92,.9), transparent 60%), radial-gradient(3px 3px at 90% 74%, rgba(242,178,92,.7), transparent 60%); animation: lanterns 10s ease-in-out infinite alternate; }
@keyframes lanterns { from { background-position: 0 0; opacity: .7 } to { background-position: 2% -1%; opacity: 1 } }
.card.event { border-color: rgba(242,178,92,.45); background: linear-gradient(160deg, rgba(31,77,107,.85), rgba(60,40,70,.7)); }
.find.ev { border-style: dashed; }
.find.ev-on { border-color: rgba(242,178,92,.6); }
.find .evname { font-size: 10px; color: var(--lantern); }

/* 通報・ブロック */
.card.other .gear { align-self: flex-start; font-size: 18px; }
.steps input[type=radio] { accent-color: var(--lantern); width: 18px; height: 18px; }

/* 音 */
.sndbtn { position: absolute; right: 8px; top: 8px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255,255,255,.2); background: rgba(11,26,43,.6); color: var(--text-dim); display: grid; place-items: center; z-index: 2; }
.sndbtn.on { color: var(--lantern); border-color: rgba(242,178,92,.6); }

/* 住人の物語 */
.paper.p-chapter { background: #efe3c8 url("/assets/img/letter_paper.webp") center / cover; box-shadow: 0 0 0 2px rgba(242,178,92,.5), 0 14px 30px rgba(0,0,0,.35); }
.chapter-title { position: relative; font-family: var(--serif); font-size: 17px; color: #7a4a1a; margin: 2px 0 10px; padding-bottom: 6px; border-bottom: 1px solid rgba(122,74,26,.3); letter-spacing: .04em; }
.bubble.chapter { background: #efe3c8; border: 2px solid rgba(242,178,92,.6); max-width: 92%; }
.bubble.chapter .chapter-title { font-size: 15px; }
.choices { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 0 4px; }
.choices .meta { width: 100%; }
.choice { background: rgba(244,234,216,.1); border: 1px solid rgba(244,234,216,.3); color: var(--moon); border-radius: 999px; padding: 0 14px; min-height: 44px; font-size: 13px; font-family: var(--serif); }
.choice:disabled { opacity: .5; }
.choice:active { background: rgba(242,178,92,.25); }
.bondbar { display: flex; gap: 4px; margin: 6px 0 4px; }
.bondbar i { width: 22px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.12); }
.bondbar i.on { background: var(--lantern); box-shadow: 0 0 8px rgba(242,178,92,.5); }
.chapter-locked { padding: 10px 12px; border: 1px dashed rgba(255,255,255,.15); border-radius: 10px; color: var(--text-dim); font-size: 13px; margin: 8px 0; text-align: center; }

/* キーボード表示中：固定要素を隠す（iOS/Android で fixed 要素がキーボード上に浮くのを防ぐ） */
body.kb-open .nav, body.kb-open .fab { display: none; }
body.kb-open .composer { position: static; background: none; padding-top: 8px; }
body.kb-open .screen { padding-bottom: 40vh; }
.endcard { border-color: rgba(224,122,106,.3); }

/* ミオの案内 */
.guide { border-color: rgba(242,178,92,.35); }
.guide .avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex: none; border: 2px solid rgba(242,178,92,.6); box-shadow: 0 0 16px rgba(242,178,92,.3); }
.guide .say { font-family: var(--serif); color: var(--moon); font-size: 15px; line-height: 1.8; margin-top: 2px; }
.gbar { height: 6px; border-radius: 3px; background: rgba(255,255,255,.1); overflow: hidden; margin-top: 10px; }
.gbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--glass), var(--lantern)); }
.steps .step { width: 100%; background: none; border: 0; color: var(--text); padding: 0 6px; min-height: 44px; border-radius: 10px; text-align: left; }
.steps .step.now { background: rgba(242,178,92,.12); }
.steps .step:active { background: rgba(255,255,255,.08); }
.steps .step.done { color: var(--text-dim); text-decoration: line-through; }
.coach { animation: coach 1.2s ease-in-out infinite; position: relative; z-index: 2; }
@keyframes coach { 0%,100% { box-shadow: 0 0 0 0 rgba(242,178,92,.9), 0 0 24px rgba(242,178,92,.5) } 50% { box-shadow: 0 0 0 10px rgba(242,178,92,0), 0 0 40px rgba(242,178,92,.8) } }
.oisland.portrait { width: 56px; height: 56px; border-radius: 50%; }

/* 縁：到着待ち・相手の島・拾われた演出 */
.incoming { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px; background: rgba(11,26,43,.7); border: 1px dashed rgba(242,178,92,.5); font-size: 13px; color: var(--moon); backdrop-filter: blur(4px); }
.incoming img { width: 24px; }
.incoming b { color: var(--lantern); font-weight: 500; }
.card.other { margin: 6px 0 12px; padding: 10px 12px; }
.oisland { width: 72px; height: 48px; object-fit: cover; border-radius: 10px; flex: none; border: 1px solid rgba(255,255,255,.1); }
.picked .compass { margin: 8px 0; }

/* ゲーム性強化：解放・潮・導入・用紙・方位盤・封・建物・日誌 */
.levelup-card .unlocks { list-style: none; padding: 0; margin: 8px 0 14px; text-align: left; display: grid; gap: 6px; }
.levelup-card .unlocks li { padding: 8px 12px; border-radius: 10px; background: rgba(242,178,92,.12); border: 1px solid rgba(242,178,92,.35); color: var(--moon); font-size: 14px; }
.levelup-card .unlocks li::before { content: "✦ "; color: var(--lantern); }
.tide .moon { line-height: 0; filter: drop-shadow(0 0 12px rgba(244,234,216,.45)); }
.ico { display: inline-flex; vertical-align: -3px; line-height: 0; }
.res-pill { border: 1px solid rgba(255,255,255,.1); color: var(--text); cursor: pointer; min-height: 44px; }
.res-pill .lab { color: var(--text-dim); font-size: 11px; }
.res-pill:active { background: rgba(255,255,255,.14); }
.ico + .num, .pill .ico { margin-right: 2px; }
.topbar .gear { line-height: 0; }
.stage.has-bottle { cursor: pointer; }
.stage.has-bottle .bottle-float { filter: drop-shadow(0 0 26px rgba(242,178,92,.75)) drop-shadow(0 8px 12px rgba(0,0,0,.5)); animation: bob 3s ease-in-out infinite; }
.stage .bottle-float { width: 120px; margin-left: -60px; bottom: 34px; }
.stage .found { width: 140px; margin-left: -70px; }
.intro img { margin-bottom: 10px; }
.intro .dots { display: flex; justify-content: center; gap: 6px; margin: 4px 0 14px; }
.intro .dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.2); }
.intro .dots i.on { background: var(--lantern); }
.papers { display: flex; gap: 6px; margin-left: auto; }
.pchip { min-width: 56px; min-height: 40px; padding: 5px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,.15); font-size: 11px; background: var(--paper); color: var(--ink); font-family: var(--serif); opacity: .7; }
.pchip.on { opacity: 1; box-shadow: 0 0 0 2px var(--lantern); }
.paper.p-indigo, .pchip.p-indigo { background: #1a2f4a url("/assets/img/letter_paper.webp") center / cover; background-blend-mode: multiply; color: #eef3f7; }
.paper.p-indigo::before { background: repeating-linear-gradient(transparent 0 30px, rgba(255,255,255,.08) 30px 31px); }
.paper.p-indigo textarea, .paper.p-indigo .sign, .paper.p-indigo .from, .paper.p-indigo .counter { color: #dbe6ee; }
.paper.p-indigo textarea::placeholder { color: rgba(238,243,247,.5); }
.paper.p-sakura, .pchip.p-sakura { background: #f7e1e3 url("/assets/img/letter_paper.webp") center / cover; background-blend-mode: soft-light; color: #4a3238; }
.paper.p-star, .pchip.p-star { background: radial-gradient(1px 1px at 18% 30%, #fff 60%, transparent), radial-gradient(1px 1px at 72% 62%, #fff 60%, transparent), radial-gradient(1.5px 1.5px at 40% 80%, #fff 60%, transparent), radial-gradient(1px 1px at 88% 18%, #fff 60%, transparent), #0e1f36; color: #eef3f7; }
.paper.p-star::before { background: repeating-linear-gradient(transparent 0 30px, rgba(255,255,255,.07) 30px 31px); }
.paper.p-star textarea, .paper.p-star .sign, .paper.p-star .from, .paper.p-star .counter { color: #dbe6ee; }
.paper.p-star textarea::placeholder { color: rgba(238,243,247,.5); }
.compass { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 6px 0 4px; }
.compass .needle { transform-origin: 60px 60px; animation: needle 1.6s cubic-bezier(.2,.8,.2,1) both; }
@keyframes needle { from { opacity: 0; transform: rotate(-120deg) } to { opacity: 1 } }
.compass .dist { font-family: var(--serif); color: var(--moon); }
.compass .dist b { font-size: 34px; color: var(--lantern); font-weight: 500; }
.seal { position: relative; height: 260px; display: grid; place-items: center; }
.seal .moonlight { position: absolute; left: 50%; top: 50%; width: 260px; height: 260px; transform: translate(-50%,-50%); background: radial-gradient(circle, rgba(244,234,216,.25), transparent 60%); }
.seal-bottle { width: 170px; filter: drop-shadow(0 16px 24px rgba(0,0,0,.6)); animation: bob 5s ease-in-out infinite; }
.seal.open .seal-bottle { animation: uncork 1s ease forwards; }
@keyframes uncork { 0% { transform: rotate(0) } 20% { transform: rotate(-8deg) } 40% { transform: rotate(8deg) } 60% { transform: rotate(-4deg) scale(1.05) } 100% { transform: scale(1.15); opacity: 0 } }
.seal .cork { position: absolute; left: 50%; top: 22%; width: 22px; height: 18px; border-radius: 4px; background: #b8865a; opacity: 0; }
.seal.open .cork { animation: cork 1s ease forwards; }
@keyframes cork { 0% { opacity: 0 } 30% { opacity: 1; transform: translate(0,0) } 100% { opacity: 0; transform: translate(90px,-140px) rotate(200deg) } }
.bicons { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 10px; }
.bicon { background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); border-radius: 10px; padding: 4px 2px; min-height: 60px; display: grid; gap: 2px; place-items: center; color: var(--text-dim); font-size: 10px; }
.bicon img { width: 100%; aspect-ratio: 1; border-radius: 8px; filter: grayscale(1) brightness(.45); }
.bicon.on img { filter: none; box-shadow: 0 0 12px rgba(242,178,92,.35); }
.bicon.on { color: var(--lantern); border-color: rgba(242,178,92,.35); }
.bimg { width: 56px; height: 56px; border-radius: 12px; flex: none; object-fit: cover; }
.bimg.off { filter: grayscale(1) brightness(.5); }
.journal .entry { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed rgba(255,255,255,.08); font-family: var(--serif); font-size: 14px; }
.journal .entry:last-child { border-bottom: 0; }
.journal .ico { width: 22px; text-align: center; flex: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
