/* AzLife — 全画面ノースクロール / 小さい洗練プロポーション / 静かな「スッ」モーション */
:root {
  --ink: #101725;
  --night: #0d1626;
  --paper: #f7f1e3;
  --paper-line: #d8cdb4;
  --gold: #c9a959;
  --accent: #7fb069;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: var(--night); color: #eef1f6; font-size: 14px;
  position: fixed; inset: 0;
}
button { font-family: inherit; border: none; background: none; color: inherit; cursor: pointer; }
.hidden { display: none !important; }

#stage { position: absolute; inset: 0; overflow: hidden; }
.screen {
  position: absolute; inset: 0; display: none; flex-direction: column;
  overflow: hidden; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.screen.active { display: flex; }

/* ---------- スプラッシュ ---------- */
#scr-splash { align-items: center; justify-content: center; background: #fbfaf7; }
.splash-inner { text-align: center; animation: splashIn 1.1s var(--ease) both; }
.splash-logo { width: 84px; height: 84px; border-radius: 20px; }
.splash-name { color: var(--ink); font-size: 26px; font-weight: 700; letter-spacing: 0.14em; margin-top: 14px; }
.splash-mark { color: #8a8f98; font-size: 10px; letter-spacing: 0.34em; margin-top: 6px; }
@keyframes splashIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- ゲート ---------- */
#scr-gate { align-items: center; justify-content: center; background: linear-gradient(180deg, #0d1626, #16283f); padding-left: 20px; padding-right: 20px; }
.gate-card { max-width: 340px; width: 100%; }
.gate-card h2 { font-size: 16px; letter-spacing: 0.12em; margin-bottom: 16px; font-weight: 600; }
.gate-card ul { list-style: none; }
.gate-card li { font-size: 12.5px; line-height: 1.75; color: #c9d2df; padding-left: 14px; position: relative; margin-bottom: 8px; }
.gate-card li::before { content: "・"; position: absolute; left: 0; color: var(--gold); }

/* ---------- 共通ボタン ---------- */
.btn-primary {
  display: block; width: 100%; max-width: 320px; margin: 22px auto 0; padding: 14px 0;
  background: #eef1f6; color: var(--ink); border-radius: 999px; font-size: 15px; font-weight: 700;
  letter-spacing: 0.08em; transition: transform 0.45s var(--ease), opacity 0.3s;
}
.btn-primary:active { transform: scale(0.97); }
.btn-ghost {
  display: block; width: 100%; max-width: 320px; margin: 10px auto 0; padding: 12px 0;
  border: 1px solid rgba(238, 241, 246, 0.35); color: #eef1f6; border-radius: 999px; font-size: 13px;
  letter-spacing: 0.08em; transition: transform 0.45s var(--ease);
}
.btn-ghost:active { transform: scale(0.97); }

/* ---------- タイトル ---------- */
#scr-title { background: linear-gradient(180deg, #0a1220 0%, #14263f 46%, #3d4a63 78%, #6d5a63 100%); align-items: center; }
.title-sky { position: absolute; inset: 0; pointer-events: none; }
.star { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #fff; opacity: 0.7; animation: twinkle 3.6s ease-in-out infinite; }
.star.s1 { top: 12%; left: 18%; } .star.s2 { top: 22%; left: 76%; animation-delay: 0.8s; }
.star.s3 { top: 8%; left: 58%; animation-delay: 1.6s; } .star.s4 { top: 30%; left: 34%; animation-delay: 2.2s; }
.star.s5 { top: 17%; left: 88%; animation-delay: 1.1s; }
@keyframes twinkle { 0%, 100% { opacity: 0.25; } 50% { opacity: 0.85; } }
.corner-btn { position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 14px; font-size: 11px; color: #aebacd; padding: 8px 10px; letter-spacing: 0.1em; z-index: 3; }
.title-main { margin-top: 15vh; text-align: center; padding: 0 24px; animation: riseIn 0.9s var(--ease) both; }
@keyframes riseIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.title-kicker { font-size: 10px; letter-spacing: 0.42em; color: var(--gold); }
.title-logo { font-size: 54px; font-weight: 700; letter-spacing: 0.1em; margin-top: 10px; }
.title-sub { font-size: 14px; letter-spacing: 0.3em; color: #d7dee9; margin-top: 8px; }
.title-lead { font-size: 12.5px; line-height: 1.9; color: #aebacd; margin: 26px 0 6px; }
.btn-start {
  display: block; width: 220px; margin: 26px auto 0; padding: 16px 0; border-radius: 999px;
  background: var(--paper); color: var(--ink); font-size: 17px; font-weight: 700; letter-spacing: 0.3em;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35); transition: transform 0.45s var(--ease);
}
.btn-start:active { transform: scale(0.96); }
#scr-title .btn-ghost { max-width: 220px; }
.title-note { font-size: 11px; color: #93a1b5; margin-top: 14px; min-height: 15px; }
.title-ver { position: absolute; bottom: calc(12px + env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center; font-size: 10px; color: #77879c; letter-spacing: 0.08em; }

/* ---------- 出生 ---------- */
#scr-birth { background: linear-gradient(180deg, #101a2e, #1d3049); align-items: center; justify-content: center; padding-left: 20px; padding-right: 20px; }
.birth-phase { width: 100%; max-width: 340px; text-align: center; }
.birth-cap { font-size: 13px; letter-spacing: 0.14em; color: #c9d2df; }
.birth-slot { font-size: 40px; font-weight: 700; letter-spacing: 0.12em; margin: 26px 0 18px; min-height: 52px; }
.birth-slot.settled { animation: settleIn 0.7s var(--ease) both; color: #ffe9a8; }
@keyframes settleIn { from { opacity: 0; transform: translateY(10px) scale(0.96); } to { opacity: 1; transform: none; } }
.birth-sub { font-size: 11.5px; color: #93a1b5; line-height: 1.8; }
/* 出生届：紙が送り出され、行が順に印字される */
.paper-wrap { perspective: 700px; }
.paper {
  background: var(--paper); color: #2b2620; border-radius: 6px; text-align: left;
  padding: 20px 20px 14px; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  transform-origin: top center; animation: paperFeed 0.9s var(--ease) both;
}
@keyframes paperFeed { from { opacity: 0; transform: translateY(46px); } to { opacity: 1; transform: none; } }
.paper-head { text-align: center; font-size: 19px; font-weight: 700; letter-spacing: 0.55em; text-indent: 0.55em; border-bottom: 2px solid #2b2620; padding-bottom: 10px; }
.paper-rows { margin-top: 6px; }
.paper-row {
  display: flex; justify-content: space-between; gap: 12px; padding: 7px 2px;
  border-bottom: 1px solid var(--paper-line); font-size: 13px;
  opacity: 0; transform: translateY(4px); animation: printLine 0.55s var(--ease) forwards;
}
.paper-row .k { color: #7a6f57; font-size: 11px; letter-spacing: 0.08em; white-space: nowrap; padding-top: 2px; }
.paper-row .v { font-weight: 600; text-align: right; }
@keyframes printLine { to { opacity: 1; transform: none; } }
.paper-foot { font-size: 10px; color: #8a7d63; line-height: 1.7; margin-top: 10px; }

/* ---------- 人生画面 ---------- */
#scr-life { padding-left: 0; padding-right: 0; }
.life-bg { position: absolute; inset: 0; transition: background 1.6s var(--ease); z-index: 0; }
.life-bg::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(120% 55% at 50% 0%, rgba(255, 255, 255, 0.14), transparent 60%);
}
.hud { position: relative; z-index: 2; padding: 10px 16px 6px; background: linear-gradient(180deg, rgba(8, 13, 24, 0.5), rgba(8, 13, 24, 0)); }
.hud-top { display: flex; align-items: flex-end; gap: 12px; }
.hud-age { font-size: 34px; font-weight: 700; line-height: 1; }
.hud-age small { font-size: 12px; margin-left: 2px; color: #c9d2df; }
.hud-who { flex: 1; padding-bottom: 3px; }
.hud-who #hud-name { font-size: 13px; font-weight: 600; }
.hud-who #hud-place { font-size: 10.5px; color: #b8c3d4; }
.hud-money { text-align: right; padding-bottom: 3px; }
.hud-money small { display: block; font-size: 9.5px; color: #b8c3d4; letter-spacing: 0.12em; }
.hud-money span { font-size: 15px; font-weight: 700; }
.hud-params { display: flex; gap: 10px; margin-top: 10px; }
.param { flex: 1; }
.param .p-head { display: flex; justify-content: space-between; font-size: 9.5px; color: #c9d2df; letter-spacing: 0.06em; }
.param .p-bar { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.22); margin-top: 3px; overflow: hidden; }
.param .p-fill { height: 100%; border-radius: 2px; background: #ffe9a8; transition: width 0.8s var(--ease); }
.param[data-k="health"] .p-fill { background: #8fd0a0; }
.param[data-k="know"] .p-fill { background: #9db9e8; }
.param[data-k="bond"] .p-fill { background: #e8a9c0; }
.peers { position: relative; z-index: 2; display: flex; gap: 6px; padding: 10px 16px 0; }
.peer {
  flex: 1; font-size: 9.5px; line-height: 1.5; color: #d7dee9; background: rgba(10, 17, 30, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 8px; padding: 5px 7px; min-height: 40px;
}
.peer b { color: #fff; font-size: 10px; }
.peer.dead { opacity: 0.55; }
.life-center { position: relative; z-index: 2; flex: 1; display: flex; flex-direction: column; justify-content: flex-end; padding: 0 20px 8px; }
.life-stage-name { font-size: 12px; letter-spacing: 0.2em; color: #ffe9a8; margin-bottom: 8px; }
.life-log { min-height: 66px; }
.life-log .log-line { font-size: 13px; line-height: 1.65; color: #eef1f6; animation: logIn 0.7s var(--ease) both; text-shadow: 0 1px 8px rgba(8, 13, 24, 0.65); }
.life-stage-name { text-shadow: 0 1px 8px rgba(8, 13, 24, 0.65); }
.life-log .log-line.dim { color: #aebacd; font-size: 12px; }
@keyframes logIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.life-bottom { position: relative; z-index: 2; padding: 6px 16px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, transparent, rgba(8, 13, 24, 0.55) 30%); }
.focus-cap { font-size: 10px; letter-spacing: 0.2em; color: #b8c3d4; margin-bottom: 7px; }
.focus-row { display: flex; gap: 7px; }
.focus-chip {
  flex: 1; padding: 10px 2px; border-radius: 999px; font-size: 12px; letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.2); color: #dfe6f0;
  transition: all 0.35s var(--ease);
}
.focus-chip.on { background: var(--paper); color: var(--ink); font-weight: 700; border-color: var(--paper); }
.speed-row { display: flex; gap: 7px; margin-top: 9px; }
.spd {
  padding: 9px 14px; border-radius: 999px; font-size: 11.5px; color: #dfe6f0;
  background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.16);
}
.spd.wide { flex: 1; }
.spd.on { background: rgba(255, 233, 168, 0.9); color: var(--ink); font-weight: 700; }

/* ---------- ひと息 ---------- */
#scr-breath { background: linear-gradient(180deg, #0a1220, #1a2a42); align-items: center; justify-content: center; padding-left: 24px; padding-right: 24px; }
.breath-inner { max-width: 320px; width: 100%; text-align: center; animation: riseIn 0.9s var(--ease) both; }
.breath-age { font-size: 12px; letter-spacing: 0.3em; color: var(--gold); }
.breath-q { font-size: 19px; line-height: 1.8; margin: 20px 0 24px; font-weight: 600; }
.breath-input {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.07); color: #fff; font-size: 16px; outline: none;
}
.breath-input::placeholder { color: #77879c; }

/* ---------- 最期・記録書 ---------- */
#scr-end { background: linear-gradient(180deg, #070d18, #101a2c); align-items: center; justify-content: flex-start; padding: calc(16px + env(safe-area-inset-top)) 20px 0; }
.end-phase { width: 100%; max-width: 340px; text-align: center; }
#end-death { animation: riseIn 1.4s var(--ease) both; }
.end-line1 { font-size: 17px; line-height: 2; }
.end-line2 { font-size: 12.5px; color: #aebacd; line-height: 1.9; margin-top: 10px; }
.book-wrap { perspective: 800px; display: flex; justify-content: center; }
.book {
  position: relative; width: 300px; background: #22364f; border-radius: 4px 10px 10px 4px;
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.5); padding: 16px 16px 12px 24px; text-align: left;
  animation: bookIn 1s var(--ease) both;
}
@keyframes bookIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.book-spine {
  position: absolute; left: 0; top: 0; bottom: 0; width: 10px; border-radius: 4px 0 0 4px;
  background: linear-gradient(90deg, #16263c, #2c4562);
  transform-origin: left center; animation: bindDraw 1.2s var(--ease) 0.5s both;
}
@keyframes bindDraw { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.book-cover { border: 1px solid rgba(201, 169, 89, 0.55); border-radius: 6px; padding: 10px; text-align: center; opacity: 0; animation: printLine 0.8s var(--ease) 1.1s forwards; }
.book-cover .bc-title { font-size: 15px; letter-spacing: 0.3em; color: #ffe9a8; font-weight: 700; }
.book-cover .bc-name { font-size: 12px; color: #d7dee9; margin-top: 6px; letter-spacing: 0.1em; }
.book-pages { margin-top: 12px; }
.book-page {
  background: var(--paper); color: #2b2620; border-radius: 4px; padding: 8px 10px; margin-bottom: 6px;
  font-size: 11px; line-height: 1.65; opacity: 0; transform: translateY(6px); animation: printLine 0.7s var(--ease) forwards;
}
.book-page h4 { font-size: 10px; letter-spacing: 0.2em; color: #7a6f57; margin-bottom: 4px; }
.book-page .row { display: flex; justify-content: space-between; gap: 10px; }
.book-page .row .k { color: #7a6f57; white-space: nowrap; }
.book-page .row .v { font-weight: 600; text-align: right; }
.end-actions { margin-top: 2px; }
#end-book .btn-primary { margin-top: 12px; padding: 12px 0; }
#end-book .btn-ghost { margin-top: 8px; padding: 10px 0; }
#end-death { margin-top: 30vh; }

/* ---------- 棚 ---------- */
#scr-shelf, #scr-record { background: linear-gradient(180deg, #0d1626, #16283f); }
.shelf-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 8px; }
.shelf-head h2 { font-size: 15px; letter-spacing: 0.14em; }
.back-btn { font-size: 13px; color: #aebacd; padding: 6px 4px; }
.shelf-grid { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px 16px; align-content: start; }
.shelf-item {
  background: #22364f; border: 1px solid rgba(201, 169, 89, 0.35); border-radius: 8px; padding: 12px;
  text-align: left; min-height: 104px; transition: transform 0.4s var(--ease);
}
.shelf-item:active { transform: scale(0.97); }
.shelf-item .si-name { font-size: 13px; font-weight: 700; color: #ffe9a8; }
.shelf-item .si-meta { font-size: 10.5px; color: #c9d2df; line-height: 1.7; margin-top: 5px; }
.shelf-empty { grid-column: 1 / -1; text-align: center; color: #93a1b5; font-size: 12.5px; line-height: 2; padding-top: 15vh; }
.shelf-pager { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 10px 0 calc(14px + env(safe-area-inset-bottom)); }
.shelf-pager span { font-size: 11px; color: #aebacd; }
.record-wrap { flex: 1; align-items: flex-start; padding-top: 8px; }

/* ---------- シート ---------- */
.sheet-veil {
  position: absolute; inset: 0; background: rgba(5, 9, 17, 0.55); z-index: 10;
  display: flex; align-items: flex-end;
}
.sheet {
  width: 100%; background: #141f31; border-radius: 20px 20px 0 0; padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
  animation: sheetUp 0.6s var(--ease) both; max-height: 86%;
}
@keyframes sheetUp { from { transform: translateY(60px); opacity: 0.4; } to { transform: none; opacity: 1; } }
.sheet-title { font-size: 16px; font-weight: 700; letter-spacing: 0.06em; }
.sheet-text { font-size: 13px; line-height: 1.85; color: #c9d2df; margin-top: 10px; }
.sheet-text.small { font-size: 11.5px; color: #93a1b5; }
.sheet-stat {
  margin-top: 12px; font-size: 11px; color: #ffe9a8; background: rgba(255, 233, 168, 0.08);
  border-left: 3px solid var(--gold); padding: 8px 10px; line-height: 1.7;
}
.sheet-choices { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.choice-btn {
  width: 100%; padding: 13px 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.18); font-size: 13.5px; text-align: center; color: #eef1f6;
  transition: transform 0.35s var(--ease);
}
.choice-btn:active { transform: scale(0.98); }
.choice-btn.danger { color: #e8a0a0; }
.sheet-result { margin-top: 14px; font-size: 13px; line-height: 1.85; color: #ffe9a8; text-align: center; }
