:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", sans-serif;
  color: #f9fafb;
  background: #0b1020;
  font-synthesis: none;
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #0b1020; overscroll-behavior: none; }
body { min-height: 100dvh; }
button, textarea, input { font: inherit; }
button { touch-action: manipulation; }
.app-shell {
  width: min(100%, 540px);
  min-height: 100dvh;
  margin: 0 auto;
  background: linear-gradient(180deg, #111827 0%, #0b1020 100%);
  padding: max(16px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
}
.screen { min-height: calc(100dvh - 36px); display: flex; flex-direction: column; gap: 16px; }
.center { justify-content: center; align-items: center; text-align: center; }
.eyebrow { color: #93c5fd; letter-spacing: .14em; font-size: 12px; font-weight: 800; text-transform: uppercase; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(30px, 9vw, 48px); line-height: 1.05; }
h2 { font-size: 25px; }
.muted { color: #9ca3af; line-height: 1.7; }
.card {
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 20px;
  padding: 18px;
  box-shadow: 0 12px 30px rgba(0,0,0,.18);
}
.hero-icon { font-size: 72px; filter: drop-shadow(0 12px 18px rgba(0,0,0,.3)); }
.btn {
  border: 0;
  border-radius: 16px;
  padding: 15px 18px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .08s ease, opacity .2s ease;
  min-height: 52px;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: #60a5fa; color: #08111f; }
.btn-secondary { background: rgba(255,255,255,.10); color: #f9fafb; border: 1px solid rgba(255,255,255,.12); }
.btn-danger { background: #fca5a5; color: #3f1010; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-block { width: 100%; }
.option-grid { display: grid; gap: 10px; }
.option {
  width: 100%; text-align: left; color: #f9fafb; background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10); border-radius: 16px; padding: 15px;
}
.option strong { display: inline-block; width: 26px; color: #93c5fd; }
.topbar { display: grid; grid-template-columns: 1fr auto; align-items: start; gap: 12px; }
.status-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.stat { background: rgba(255,255,255,.06); border-radius: 14px; padding: 10px; text-align: center; }
.stat-value { font-size: 20px; font-weight: 900; }
.stat-label { color: #9ca3af; font-size: 11px; margin-top: 2px; }
.progress { height: 10px; background: rgba(255,255,255,.08); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: #60a5fa; border-radius: inherit; transition: width .3s ease; }
.npc-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.npc { border: 1px solid rgba(255,255,255,.10); background: rgba(255,255,255,.06); border-radius: 18px; padding: 16px; color: inherit; text-align: left; }
.npc-avatar { font-size: 34px; }
.npc-name { font-weight: 900; margin-top: 8px; }
.npc-summary { color: #9ca3af; font-size: 12px; margin-top: 4px; line-height: 1.5; }
.knowledge-list { display: grid; gap: 7px; }
.knowledge-item { display: flex; gap: 9px; align-items: start; font-size: 14px; line-height: 1.45; }
.chat { flex: 1; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; padding-bottom: 8px; }
.bubble { max-width: 86%; border-radius: 18px; padding: 12px 14px; line-height: 1.6; white-space: pre-wrap; }
.bubble.player { align-self: flex-end; background: #2563eb; }
.bubble.npc { align-self: flex-start; background: rgba(255,255,255,.09); }
.bubble.system { align-self: center; background: rgba(96,165,250,.12); color: #bfdbfe; font-size: 13px; max-width: 96%; }
.composer { position: sticky; bottom: 0; background: linear-gradient(180deg, rgba(11,16,32,0), #0b1020 22%); padding-top: 18px; }
textarea {
  width: 100%; min-height: 92px; resize: none; border-radius: 16px; border: 1px solid rgba(255,255,255,.12);
  background: #111827; color: #fff; padding: 13px; outline: none;
}
textarea:focus { border-color: #60a5fa; box-shadow: 0 0 0 3px rgba(96,165,250,.15); }
.composer-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 8px; }
.badge { display: inline-flex; align-items: center; padding: 6px 9px; border-radius: 999px; background: rgba(96,165,250,.12); color: #bfdbfe; font-size: 12px; font-weight: 800; }
.score-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; }
.score-card { background: rgba(255,255,255,.06); border-radius: 16px; padding: 14px; }
.score-card strong { font-size: 24px; display: block; }
.warning { background: rgba(251,191,36,.12); border: 1px solid rgba(251,191,36,.25); color: #fde68a; border-radius: 14px; padding: 12px; line-height: 1.5; }
.success { background: rgba(52,211,153,.12); border: 1px solid rgba(52,211,153,.25); color: #a7f3d0; border-radius: 14px; padding: 12px; line-height: 1.5; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30; max-width: calc(100% - 32px); background: #f9fafb; color: #111827; border-radius: 14px; padding: 11px 14px; box-shadow: 0 14px 40px rgba(0,0,0,.4); font-weight: 800; }
.notice-overlay { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 22px; background: rgba(3,7,18,.76); backdrop-filter: blur(8px); }
.notice-overlay[hidden] { display: none; }
.notice-dialog { position: relative; width: min(100%, 430px); padding: 30px 22px 22px; color: #f9fafb; text-align: center; background: linear-gradient(155deg, #1e293b, #111827); border: 1px solid rgba(255,255,255,.18); border-radius: 24px; box-shadow: 0 26px 80px rgba(0,0,0,.58); animation: notice-in .24s ease-out both; }
.notice-close { position: absolute; top: 10px; right: 10px; display: grid; place-items: center; width: 38px; height: 38px; padding: 0; color: #d1d5db; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); border-radius: 50%; font-size: 24px; line-height: 1; }
.notice-close:focus-visible { outline: 3px solid rgba(96,165,250,.55); outline-offset: 2px; }
.notice-icon { display: grid; place-items: center; width: 66px; height: 66px; margin: 0 auto 16px; color: #06251a; background: #6ee7b7; border-radius: 50%; font-size: 37px; font-weight: 1000; box-shadow: 0 0 0 9px rgba(110,231,183,.11); }
.notice-overlay[data-type="warning"] .notice-icon { color: #372305; background: #fcd34d; box-shadow: 0 0 0 9px rgba(252,211,77,.11); }
.notice-overlay[data-type="info"] .notice-icon { color: #0b2142; background: #93c5fd; box-shadow: 0 0 0 9px rgba(147,197,253,.11); }
.notice-dialog h2 { font-size: 26px; }
.notice-dialog p { margin: 12px 0 22px; color: #d1d5db; line-height: 1.8; text-align: left; }
@keyframes notice-in { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
.timeline { display: grid; gap: 9px; }
.timeline-row { display: grid; grid-template-columns: 66px 1fr; gap: 10px; align-items: start; }
.timeline-time { color: #93c5fd; font-weight: 900; }

/* Case introduction */
.intro-screen { position: relative; overflow: hidden; margin: calc(-1 * max(16px, env(safe-area-inset-top))) -16px calc(-1 * max(20px, env(safe-area-inset-bottom))); min-height: 100dvh; padding: max(20px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom)); gap: 0; background: #080d1a; }
.intro-skip { position: absolute; z-index: 5; top: max(18px, env(safe-area-inset-top)); right: 16px; border: 1px solid rgba(255,255,255,.22); border-radius: 999px; padding: 8px 13px; color: rgba(255,255,255,.82); background: rgba(7,12,24,.52); backdrop-filter: blur(8px); font-size: 12px; font-weight: 800; }
.intro-footer { position: relative; z-index: 4; margin-top: auto; display: grid; gap: 14px; padding-top: 16px; }
.intro-dots { display: flex; justify-content: center; gap: 7px; min-height: 6px; }
.intro-dot { width: 6px; height: 6px; border-radius: 99px; background: rgba(255,255,255,.3); transition: width .25s ease, background .25s ease; }
.intro-dot.active { width: 24px; background: #f5c66d; }
.intro-next { width: 100%; min-height: 54px; border: 1px solid rgba(255,255,255,.2); border-radius: 17px; color: #fff; background: rgba(20,29,48,.88); box-shadow: 0 12px 32px rgba(0,0,0,.3); font-weight: 900; letter-spacing: .02em; animation: intro-cta-in .55s .9s both; }
.intro-next span { margin-left: 8px; color: #f5c66d; font-size: 22px; vertical-align: -1px; }

.intro-title { justify-content: center; background: radial-gradient(circle at 50% 40%, rgba(42,67,103,.48), transparent 42%), linear-gradient(160deg, #111d31 0%, #080d1a 72%); }
.intro-title::before { content: ""; position: absolute; inset: 0; opacity: .22; background-image: radial-gradient(rgba(255,255,255,.55) .6px, transparent .6px); background-size: 13px 13px; mask-image: linear-gradient(to bottom, transparent, #000 20%, #000 70%, transparent); }
.intro-title-content { position: relative; z-index: 2; text-align: center; animation: intro-title-in .9s cubic-bezier(.2,.75,.2,1) both; }
.intro-case-label { color: #f5c66d; letter-spacing: .28em; font-size: 13px; font-weight: 900; }
.intro-rule { width: 36px; height: 1px; margin: 15px auto 20px; background: #f5c66d; }
.intro-kicker { color: #9aa8bd; font-size: 13px; letter-spacing: .08em; }
.intro-main-title { margin-top: 18px; font-family: "Yu Mincho", "Hiragino Mincho ProN", serif; font-size: clamp(47px, 14vw, 70px); line-height: .98; letter-spacing: .06em; text-shadow: 0 10px 30px rgba(0,0,0,.45); }
.intro-main-title span { color: #fff3d7; }
.intro-cake-mark { margin-top: 30px; font-size: 58px; filter: drop-shadow(0 14px 18px rgba(0,0,0,.38)); animation: cake-float 2.5s ease-in-out infinite; }

.intro-scene { padding-left: 0; padding-right: 0; padding-top: 0; }
.intro-scene .intro-skip { top: max(18px, env(safe-area-inset-top)); }
.story-visual { position: absolute; inset: 0; background-position: center; background-size: cover; animation: story-reveal .9s ease-out both; }
.story-visual::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(5,9,18,.18) 35%, rgba(5,9,18,.95) 91%); pointer-events: none; }
.story-home { background-image: url('./assets/intro/home-1500.webp'); animation: story-reveal .8s ease-out both, slow-zoom 9s ease-out both; }
.story-mother { background-image: url('./assets/intro/mother-fridge.webp'); background-position: center 32%; animation: story-reveal .65s ease-out both, slow-zoom 8s ease-out both; }
.time-card { position: absolute; z-index: 2; top: max(74px, calc(env(safe-area-inset-top) + 54px)); left: 18px; display: flex; gap: 10px; align-items: center; padding: 10px 14px; color: #fff; background: rgba(8,13,26,.72); border: 1px solid rgba(255,255,255,.2); border-radius: 15px; backdrop-filter: blur(10px); box-shadow: 0 10px 30px rgba(0,0,0,.26); animation: time-in .6s .45s both; }
.time-icon { font-size: 28px; color: #f5c66d; }
.time-card small, .time-card strong { display: block; }
.time-card small { color: #bcc6d6; font-size: 10px; }
.time-card strong { margin-top: 1px; font-size: 19px; letter-spacing: .08em; }
.story-caption { position: absolute; z-index: 2; left: 22px; right: 22px; bottom: 126px; font-family: "Yu Mincho", "Hiragino Mincho ProN", serif; font-size: clamp(18px, 5.2vw, 24px); line-height: 1.8; text-shadow: 0 3px 13px #000; }
.story-caption p { animation: caption-in .65s .65s both; }
.story-caption .story-caption-delay { color: #d8dee8; font-size: .78em; animation-delay: 1.2s; }
.discovery-flash { position: absolute; z-index: 3; top: 14%; left: 13%; display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; color: #25170a; background: #f5c66d; font-size: 34px; font-weight: 1000; box-shadow: 0 0 0 9px rgba(245,198,109,.18); animation: discovery-pop .5s .55s both; }
.dialogue-box { position: absolute; z-index: 3; left: 18px; right: 18px; bottom: 122px; padding: 20px 18px 17px; color: #1b2332; background: rgba(255,250,239,.96); border-radius: 6px 18px 18px 18px; box-shadow: 0 18px 50px rgba(0,0,0,.42); animation: dialogue-in .6s .75s both; }
.dialogue-box::after { content: ""; position: absolute; left: 0; top: -13px; border-style: solid; border-width: 0 0 14px 18px; border-color: transparent transparent #fffaf0 transparent; }
.speaker { position: absolute; top: -14px; left: 18px; padding: 5px 14px; border-radius: 999px; color: #fff; background: #355c73; font-size: 12px; font-weight: 900; }
.dialogue-box p { font-weight: 900; line-height: 1.7; }
.dialogue-box .dialogue-follow { margin-top: 6px; color: #536071; font-size: 13px; font-weight: 600; }

.intro-question { padding-top: max(56px, calc(env(safe-area-inset-top) + 28px)); background: radial-gradient(circle at 90% 4%, rgba(64,102,146,.32), transparent 34%), #0b1020; }
.intro-question-head { animation: caption-in .55s both; }
.intro-question-head h2 { margin-top: 11px; font-size: clamp(30px, 9vw, 42px); line-height: 1.25; }
.intro-question-head p { margin-top: 10px; color: #aeb8c8; }
.intro-options { margin-top: 28px; animation: dialogue-in .55s .15s both; }
.intro-options .option { min-height: 58px; transition: border-color .2s ease, background .2s ease, transform .1s ease; }
.intro-options .option:active { transform: scale(.985); background: rgba(96,165,250,.12); border-color: #60a5fa; }

@keyframes intro-title-in { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes intro-cta-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes cake-float { 50% { transform: translateY(-7px) rotate(-2deg); } }
@keyframes story-reveal { from { opacity: 0; } to { opacity: 1; } }
@keyframes slow-zoom { from { transform: scale(1.045); } to { transform: scale(1); } }
@keyframes time-in { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
@keyframes caption-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes discovery-pop { 0% { opacity: 0; transform: scale(.25) rotate(-15deg); } 75% { transform: scale(1.16) rotate(4deg); } 100% { opacity: 1; transform: none; } }
@keyframes dialogue-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .intro-screen *, .intro-screen *::before, .intro-screen *::after { animation-duration: .001ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; }
}
@media (max-width: 360px) { .npc-grid { grid-template-columns: 1fr; } .status-row { grid-template-columns: repeat(3,1fr); } }
