:root {
  --pink: #f4a6c4;
  --pink-deep: #e2669c;
  --pink-pale: #fde8f1;
  --lilac: #b9a3e3;
  --lilac-pale: #f1ebfb;
  --cream: #fffafc;
  --ink: #4d3f50;
  --ink-soft: #85748a;
  --line: #f1cadb;
  --green: #34c759;
  --shadow: 0 10px 30px rgba(150, 90, 130, .18);
  --radius: 18px;
  --font: "Noto Sans JP", system-ui, -apple-system, "Hiragino Sans", sans-serif;
  --font-pop: "Mochiy Pop One", "Noto Sans JP", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,.9) 0 2px, transparent 3px) 0 0 / 28px 28px,
    linear-gradient(160deg, #fdeef4, #efe7fb);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
img { -webkit-touch-callout: none; -webkit-user-drag: none; user-select: none; pointer-events: none; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
html.embedded body { overscroll-behavior: auto; }

#app {
  position: relative;
  width: min(100vw, calc(100dvh * 0.5625));
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 0 60px rgba(150, 90, 130, .15);
}

#stage { position: absolute; inset: 0; overflow: hidden; transform-origin: 50% 40%; z-index: 0; }
#bg, #cats { transform-origin: 0 0; transition: transform .8s cubic-bezier(.3, .8, .3, 1); }
#bg { position: absolute; inset: 0; }
.bg-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: var(--pos, 50%) 50%;
  opacity: 0; transition: opacity .5s ease;
}
.bg-img.on { opacity: 1; }

#chars { position: absolute; inset: 0; pointer-events: none; }
.ch {
  position: absolute;
  left: 50%;
  bottom: 0;
  height: 50%;
  transform: translateX(-50%);
  transition: left .45s cubic-bezier(.3,.8,.3,1), filter .25s, opacity .35s, height .35s, bottom .35s;
  opacity: 0;
  filter: drop-shadow(0 6px 14px rgba(120, 70, 110, .18));
}
.ch img { height: 100%; display: block; }
.ch.in { opacity: 1; }
.ch.in.ghost { opacity: .5; filter: brightness(1.12) blur(.4px) drop-shadow(0 0 14px rgba(255, 255, 255, .9)); transition: opacity 1.4s ease; }
.ch.ghost.dim, .ch.ghost.talk { filter: brightness(1.12) blur(.4px) drop-shadow(0 0 14px rgba(255, 255, 255, .9)); }
.ch.dim { filter: brightness(.82) saturate(.9) drop-shadow(0 6px 14px rgba(120, 70, 110, .12)); }
.ch.back { filter: brightness(.95) drop-shadow(0 6px 14px rgba(120, 70, 110, .12)); }
.ch.back.dim { filter: brightness(.8) saturate(.9); }

.ch.fx-jump img { animation: jump .7s ease; }
.ch.fx-hop img { animation: hop .35s ease; }
.ch.fx-sink img { animation: sink .9s ease forwards; }
.ch.fx-shiver img { animation: shiver .12s linear 8; }
.ch.fx-spin img { animation: spin .8s ease; }
@keyframes jump { 0%,100% { transform: translateY(0); } 20% { transform: translateY(-7%); } 40% { transform: translateY(0); } 60% { transform: translateY(-5%); } 80% { transform: translateY(0); } }
@keyframes hop { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-3%); } }
@keyframes sink { to { transform: translateY(6%); filter: brightness(.75); } }
@keyframes shiver { 0%,100% { transform: translateX(0); } 50% { transform: translateX(1.2%); } }
@keyframes spin { from { transform: rotateY(0); } to { transform: rotateY(360deg); } }

#stage.fx-zoom { transform: scale(1.14); transition: transform .5s ease; }
#stage.fx-zoomin { transform: scale(1.4); transition: transform .35s ease; }
#stage.fx-push { transform: scale(1.16); transition: transform 4s linear; }
#stage.fx-tilt { transform: rotate(4deg) scale(1.16); transition: transform .4s ease; }
#stage { transition: transform .45s ease; }
#stage.fx-shake { animation: shake .45s ease; }
#stage.fx-quake { animation: quake 1.4s ease; }
@keyframes shake { 0%,100% { translate: 0 0; scale: 1; } 8%,92% { scale: 1.06; } 20% { translate: -2.2% 0; } 40% { translate: 2% 0; } 60% { translate: -1.4% 0; } 80% { translate: 1% 0; } }
@keyframes quake { 0%,100% { translate: 0 0; scale: 1; } 5%,95% { scale: 1.08; } 10%,50%,90% { translate: -3% 1%; } 30%,70% { translate: 3% -1%; } }
#stage.fx-glitch { animation: glitch .55s steps(2) 1; }
@keyframes glitch { 0% { filter: none; translate: 0 0; scale: 1.05; } 25% { filter: brightness(1.45) contrast(.9); translate: -2% 0; } 50% { filter: brightness(.88); translate: 2% 0; } 75% { filter: brightness(1.3); translate: -1% 0; } 100% { filter: none; translate: 0 0; scale: 1; } }

#fx { position: absolute; inset: 0; pointer-events: none; z-index: 8; }
#fx > div { position: absolute; inset: 0; }
.fx-flash { background: #fff; animation: flash .5s ease forwards; }
@keyframes flash { from { opacity: .95; } to { opacity: 0; } }
.fx-blackout { background: #1d1620; animation: blackout .64s ease forwards; }
@keyframes blackout { 0% { opacity: 0; } 30%,60% { opacity: 1; } 100% { opacity: 0; } }
.fx-lines {
  background: repeating-conic-gradient(from 0deg at var(--cx, 50%) var(--cy, 35%), rgba(255,255,255,.0) 0 4deg, rgba(255,255,255,.85) 4deg 5deg);
  -webkit-mask: radial-gradient(circle at var(--cx, 50%) var(--cy, 35%), transparent 0 28%, #000 46%);
  mask: radial-gradient(circle at var(--cx, 50%) var(--cy, 35%), transparent 0 28%, #000 46%);
  animation: lines .25s steps(2) infinite;
}
@keyframes lines { 50% { transform: rotate(1.5deg) scale(1.03); } }
.fx-gloom {
  background:
    repeating-linear-gradient(90deg, rgba(90,70,110,.25) 0 2px, transparent 2px 22px) top / 100% 45% no-repeat,
    linear-gradient(rgba(70,55,90,.55), transparent 55%);
  animation: fadein .5s ease;
}
.fx-rage { box-shadow: inset 0 0 70px 20px rgba(226, 70, 90, .55); animation: rage .5s ease-in-out infinite alternate; }
@keyframes rage { from { opacity: .5; } to { opacity: 1; } }
@keyframes fadein { from { opacity: 0; } }
.fx-sparkles i {
  position: absolute; top: -6%; font-style: normal; font-size: var(--s, 18px); color: var(--c, #fff);
  text-shadow: 0 0 8px rgba(255,255,255,.9);
  animation: fall var(--d, 2.4s) linear var(--delay, 0s) forwards;
}
@keyframes fall { to { transform: translateY(115vh) rotate(200deg); opacity: .2; } }
.fx-confetti { overflow: hidden; }
.fx-confetti i {
  position: absolute; top: -4%; width: var(--w); height: var(--h); border-radius: 2px;
  background: var(--c); box-shadow: 0 0 0 .5px rgba(150, 90, 130, .2);
  animation: confetti var(--d) cubic-bezier(.25, .6, .45, 1) var(--delay) forwards;
}
@keyframes confetti {
  0% { transform: translate(0, 0) rotate(0) rotateX(0); }
  50% { transform: translate(var(--sway), 55vh) rotate(calc(var(--r) / 2)) rotateX(360deg); }
  100% { transform: translate(0, 112vh) rotate(var(--r)) rotateX(720deg); opacity: .6; }
}
#fx > .fx-maru, #fx > .fx-batsu { display: grid; place-items: center; padding-bottom: 66%; }
.fx-maru::before {
  content: ""; grid-area: 1 / 1; width: 50%; aspect-ratio: 1;
  border: 22px solid #f06f9f; border-radius: 50%;
  box-shadow: 0 0 0 4px #fff, inset 0 0 0 4px #fff, 0 6px 18px rgba(200, 80, 130, .3);
  animation: mark 1.1s ease forwards;
}
.fx-batsu::before, .fx-batsu::after {
  content: ""; grid-area: 1 / 1; width: 56%; height: 24px; border-radius: 12px;
  background: #8b7fc7; box-shadow: 0 0 0 4px #fff, 0 6px 18px rgba(110, 90, 160, .3);
  rotate: 45deg; animation: mark 1.1s ease forwards;
}
.fx-batsu::after { rotate: -45deg; }
@keyframes mark {
  0% { transform: scale(.3); opacity: 0; }
  25% { transform: scale(1.08); opacity: 1; }
  35%, 75% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1); opacity: 0; }
}
.fx-thunder { background: #fff; animation: thunder .9s ease forwards; }
@keyframes thunder { 0%,20%,40% { opacity: .9; } 10%,30% { opacity: 0; } 100% { opacity: 0; } }

#emote { position: absolute; inset: 0; pointer-events: none; z-index: 9; }
.emote {
  position: absolute; transform: translate(-50%, -50%);
  font-size: 34px; font-weight: 900; line-height: 1;
  animation: pop .35s cubic-bezier(.3,1.6,.5,1);
  text-shadow: 0 2px 0 #fff, 0 0 10px rgba(255,255,255,.9);
}
@keyframes pop { from { transform: translate(-50%, -50%) scale(.2); opacity: 0; } }

#cats { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.cat {
  position: absolute; pointer-events: auto; cursor: pointer;
  width: var(--w); aspect-ratio: 1; padding: 0; border: 0; background: none;
  transform: translate(-50%, -50%);
  opacity: .92;
}
.cat svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 1px 2px rgba(80,50,70,.35)); }
.cat.found { animation: catfound .6s ease forwards; }
@keyframes catfound { 50% { transform: translate(-50%, -80%) scale(1.3); } to { transform: translate(-50%, -120%) scale(.6); opacity: 0; } }

#textbox {
  position: absolute; left: 10px; right: 10px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  font-size: 16.5px;
  min-height: calc(1.8em * 3 + 50px);
  padding: 24px 20px 26px;
  background: rgba(255, 252, 254, .93);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 10;
  cursor: pointer;
}
#nameplate {
  position: absolute; top: -17px; left: 16px;
  padding: 5px 18px;
  border-radius: 999px;
  background: var(--c, var(--pink-deep));
  color: #fff; font-weight: 900; font-size: 15px; letter-spacing: .08em;
  box-shadow: 0 4px 10px rgba(120, 70, 110, .2);
}
#nameplate:empty { display: none; }
#text { font-size: 1em; line-height: 1.8; font-weight: 500; white-space: pre-wrap; word-break: normal; overflow-wrap: anywhere; line-break: strict; }
#text .rest { visibility: hidden; }
#text.narr { color: var(--ink-soft); }
#text.big { font-size: 21px; font-weight: 900; }
#next {
  position: absolute; right: 18px; bottom: 10px;
  color: var(--pink-deep); font-size: 13px;
  animation: blink 1s ease-in-out infinite;
  opacity: 0;
}
#textbox.done #next { opacity: 1; }
@keyframes blink { 50% { transform: translateY(3px); opacity: .5; } }

#topic {
  position: absolute; left: 10px; top: calc(52px + env(safe-area-inset-top)); z-index: 12;
  max-width: calc(100% - 20px); display: flex; align-items: center; gap: 7px;
  padding: 5px 13px 5px 5px; border-radius: 999px;
  background: rgba(255, 250, 252, .93); border: 1.5px solid var(--line); box-shadow: 0 4px 12px rgba(150, 90, 130, .16);
  font-size: 13px; font-weight: 900; line-height: 1.3; pointer-events: none;
}
#topic.pop { animation: rise .35s ease; }
.topic-flash {
  position: absolute; left: 50%; top: 36%; z-index: 13; pointer-events: none;
  width: min(84%, 330px); display: flex; flex-direction: column; align-items: center; gap: 9px;
  padding: 16px 18px 18px; border-radius: 20px;
  background: rgba(255, 250, 252, .97); border: 2px solid var(--pink-deep);
  box-shadow: 0 12px 30px rgba(150, 90, 130, .3);
  transform: translate(-50%, -50%); opacity: 0;
  animation: topicFlash 1.6s ease forwards;
}
.topic-flash-k {
  padding: 3px 13px; border-radius: 999px; background: var(--pink-deep); color: #fff;
  font-size: 12.5px; font-weight: 900; letter-spacing: .06em;
}
.topic-flash-q { font-size: 19px; font-weight: 900; line-height: 1.45; color: var(--ink); text-align: center; }
@keyframes topicFlash {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.86); }
  14% { opacity: 1; transform: translate(-50%, -50%) scale(1.04); }
  22% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  78% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -54%) scale(.97); }
}
.topic-k {
  flex: 0 0 auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  background: var(--pink-deep); color: #fff; font-size: 11.5px;
}
.topic-q { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topic-n { flex: 0 0 auto; color: var(--pink-deep); font-size: 11.5px; }
.topic-n:empty { display: none; }

#menu {
  position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 10px;
  display: flex; gap: 5px; z-index: 26;
}
#menu button {
  border: 1.5px solid rgba(255,255,255,.9);
  background: rgba(255, 245, 250, .9);
  border-radius: 999px; padding: 6px 10px;
  font-size: 12px; font-weight: 700; color: var(--ink); white-space: nowrap;
  cursor: pointer;
}
#menu button.on { background: var(--pink-deep); color: #fff; border-color: var(--pink-deep); }
#menu button:disabled { opacity: .45; cursor: default; }

.layer { position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 14px; }
#choices { flex-direction: column; gap: 12px; background: rgba(60, 40, 60, .18); padding-bottom: 30%; }
.choice {
  width: min(100%, 340px);
  padding: 15px 18px;
  border-radius: 999px;
  border: 2px solid var(--pink);
  background: #fff;
  font-size: 15.5px; font-weight: 700; line-height: 1.5;
  word-break: auto-phrase; text-wrap: balance;
  box-shadow: var(--shadow);
  cursor: pointer;
  animation: rise .3s ease backwards;
}
.choice:nth-child(2) { animation-delay: .05s; }
.choice:nth-child(3) { animation-delay: .1s; }
.choice:active, .choice:hover { background: var(--pink-pale); }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }

.panel {
  width: min(100%, 380px);
  max-height: 88%;
  display: flex; flex-direction: column;
  background: var(--cream);
  border-radius: 22px;
  border: 2px solid var(--line);
  box-shadow: var(--shadow);
  padding: 16px 14px 14px;
  animation: rise .3s ease;
}
.panel-title { font-weight: 900; font-size: 16px; text-align: center; margin-bottom: 12px; color: var(--pink-deep); }
#ask { background: rgba(60, 40, 60, .25); }
.ask-list { overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 2px; }
.ask-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  padding: 11px 12px; border-radius: 14px;
  border: 1.5px solid var(--line); background: #fff;
  font-size: 14.5px; font-weight: 700; line-height: 1.5; cursor: pointer;
  word-break: auto-phrase; text-wrap: balance;
}
.ask-item::before {
  content: ""; flex: 0 0 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--pink);
}
.ask-item.done { color: var(--ink-soft); background: #fbf6fa; }
.ask-item.done::before { background: var(--green); border-color: var(--green); box-shadow: inset 0 0 0 3px #fff; }
.ask-item:active { background: var(--pink-pale); }
.ask-foot { display: flex; gap: 8px; margin-top: 12px; }
.ask-foot .btn { flex: 1; padding: 10px 8px; white-space: nowrap; font-size: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 16px; min-height: 46px;
  border-radius: 999px; border: 2px solid var(--line);
  background: #fff; color: var(--ink);
  font-size: 14.5px; font-weight: 700; text-decoration: none; text-align: center;
  cursor: pointer;
}
.btn-main { background: var(--pink-deep); border-color: var(--pink-deep); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-soft); }
.btn-line { background: #06c755; border-color: #06c755; color: #fff; }
.btn:active { transform: scale(.97); }

#card { background: rgba(60, 40, 60, .25); }
.card-rows { list-style: none; margin: 0 0 14px; padding: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 7px; }
.card-rows li {
  padding: 10px 12px; border-radius: 12px; background: #fff; border: 1.5px solid var(--line);
  font-size: 14.5px; line-height: 1.6; font-weight: 500;
  word-break: auto-phrase; text-wrap: pretty;
}
.card-rows li b { color: var(--pink-deep); }
.card-rows li.pair { display: flex; gap: 10px; align-items: baseline; }
.pair-k { flex: 0 0 auto; color: var(--pink-deep); font-weight: 900; white-space: nowrap; }
.pair-v { flex: 1 1 auto; min-width: 0; }

#phone { background: rgba(60, 40, 60, .3); padding: 14px 18px calc(20% + 12px); z-index: 15; }
#choices.on-phone { justify-content: flex-end; padding-bottom: calc(5% + env(safe-area-inset-bottom)); background: transparent; }
.phone-frame {
  position: relative; width: min(100%, 330px); height: 100%; max-height: 520px;
  border-radius: 30px; background: #f4eef6; border: 7px solid #fff;
  box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden;
  animation: rise .35s ease;
}
.phone-head {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px;
  background: #fff; font-weight: 900; font-size: 14px; border-bottom: 1px solid #eee3ee;
}
.phone-back { color: var(--pink-deep); font-size: 20px; line-height: 1; }
.phone-body { flex: 1; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 82%; padding: 9px 13px; border-radius: 18px; font-size: 14px; line-height: 1.6; animation: rise .25s ease; word-break: auto-phrase; text-wrap: pretty; }
.bubble.left { align-self: flex-start; background: #fff; border-top-left-radius: 6px; }
.bubble.right { align-self: flex-end; background: #c9f0b8; border-top-right-radius: 6px; }
.bubble.sys { align-self: center; background: rgba(120, 100, 130, .14); font-size: 12px; color: var(--ink-soft); border-radius: 999px; padding: 4px 12px; }
.bubble-line { display: flex; align-items: flex-end; gap: 4px; align-self: flex-start; max-width: 88%; }
.bubble-line.me { align-self: flex-end; }
.bubble-line .bubble { max-width: none; min-width: 0; }
.bubble-meta { display: flex; flex-direction: column; flex: 0 0 auto; font-size: 9.5px; line-height: 1.3; color: var(--ink-soft); padding-bottom: 2px; }
.bubble-meta:empty { display: none; }
.bubble-line.me .bubble-meta { align-items: flex-end; }
.bubble-meta .read { animation: fadein .3s ease .8s backwards; }
.bubble-row { display: flex; gap: 6px; align-items: flex-start; align-self: flex-start; max-width: 100%; }
.bubble-row img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; object-position: 50% 8%; background: #fff; flex: 0 0 34px; }
.bubble-col { min-width: 0; }
.bubble-row .bubble-line { max-width: 100%; }
.bubble-name { font-size: 11px; color: var(--ink-soft); margin: 0 0 2px 4px; }
.bubble-row.typing .bubble { display: flex; gap: 4px; padding: 13px 14px; }
.bubble-row.typing i { width: 7px; height: 7px; border-radius: 50%; background: #c8b9c9; animation: typing 1s ease-in-out infinite; }
.bubble-row.typing i:nth-child(2) { animation-delay: .15s; }
.bubble-row.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }
.phone-next { position: absolute; right: 16px; bottom: 8px; color: var(--pink-deep); font-size: 12px; animation: blink 1s infinite; }
#phone.picking { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
#phone.picking .phone-next, #phone.busy .phone-next { display: none; }
.phone-sheet { background: #fff; border-top: 1px solid #eee3ee; padding: 10px 10px 8px; animation: rise .3s ease; }
.sheet-title { font-size: 12.5px; font-weight: 900; text-align: center; margin-bottom: 6px; }
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; text-align: center; }
.cal-head { margin-bottom: 3px; }
.cal-head span { font-size: 10.5px; font-weight: 700; color: var(--ink-soft); }
.cal-head span:first-child, .cal-day.sun b { color: #e0607a; }
.cal-head span:last-child, .cal-day.sat b { color: #4f9fd1; }
.cal-day {
  height: 40px; padding: 2px 0 0; border: 0; border-radius: 9px; background: #f8f1f6;
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.15; cursor: pointer;
}
.cal-day b { font-size: 13.5px; font-weight: 700; }
.cal-day small { min-height: 10px; font-size: 9px; font-weight: 900; color: var(--pink-deep); }
.cal-day:disabled { background: transparent; opacity: .45; cursor: default; }
.cal-day.on { background: var(--pink-deep); }
.cal-day.on b, .cal-day.on small { color: #fff; }
.sheet-later {
  width: 100%; margin-top: 7px; padding: 8px; border: 1.5px solid var(--line); border-radius: 999px;
  background: #fff; font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.sheet-later.on { background: var(--pink-deep); border-color: var(--pink-deep); color: #fff; }
.phone-input { display: flex; gap: 8px; align-items: center; padding: 8px 10px; background: #fff; border-top: 1px solid #eee3ee; }
.phone-field { flex: 1; min-width: 0; min-height: 34px; padding: 7px 12px; border-radius: 18px; background: #f3eef4; font-size: 13px; line-height: 1.45; color: #b3a6b6; }
.phone-field.filled { color: var(--ink); }
.phone-send { flex: 0 0 auto; padding: 8px 14px; border: 0; border-radius: 999px; background: var(--pink-deep); color: #fff; font-size: 13px; font-weight: 900; cursor: pointer; }
.phone-send:disabled { background: #e8dbe5; cursor: default; }
.phone-send:not(:disabled) { animation: ready 1.2s ease-in-out infinite; }
@keyframes ready { 50% { transform: scale(1.07); } }

#explore { display: block; padding: 0; pointer-events: none; }
.explore-head {
  position: absolute; left: 50%; top: calc(54px + env(safe-area-inset-top)); transform: translateX(-50%);
  display: flex; gap: 8px; align-items: baseline; padding: 7px 15px; border-radius: 999px;
  background: rgba(255, 250, 252, .93); border: 1.5px solid var(--line); box-shadow: var(--shadow);
  font-size: 13.5px; font-weight: 900; white-space: nowrap; animation: rise .35s ease;
}
.explore-count { font-size: 12px; color: var(--pink-deep); }
.spot {
  position: absolute; padding: 0; border: 0; border-radius: 14px; background: none; pointer-events: auto; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.spot:active { background: rgba(255, 255, 255, .2); }
.spot-mark {
  width: 40px; height: 40px; border-radius: 50%; border: 2.5px solid #fff; background: rgba(255, 255, 255, .78);
  display: flex; align-items: center; justify-content: center;
  color: var(--pink-deep); font-size: 20px; font-weight: 900; line-height: 1;
  animation: spot 1.8s ease-out infinite;
}
.spot-mark::before { content: "？"; }
.spot.done .spot-mark { width: 30px; height: 30px; background: var(--green); color: #fff; font-size: 15px; animation: none; box-shadow: 0 3px 10px rgba(120, 70, 110, .25); }
.spot.done .spot-mark::before { content: "✓"; }
.spot-label { display: none; padding: 2px 9px; border-radius: 999px; background: rgba(255, 255, 255, .93); font-size: 11.5px; font-weight: 900; white-space: nowrap; }
.spot.done .spot-label { display: block; }
@keyframes spot {
  0% { box-shadow: 0 0 0 0 rgba(226, 102, 156, .55), 0 3px 10px rgba(120, 70, 110, .25); }
  70%, 100% { box-shadow: 0 0 0 16px rgba(226, 102, 156, 0), 0 3px 10px rgba(120, 70, 110, .25); }
}
.explore-foot { position: absolute; left: 0; right: 0; bottom: calc(26px + env(safe-area-inset-bottom)); display: flex; justify-content: center; }
.explore-foot .btn { min-width: 210px; pointer-events: auto; box-shadow: var(--shadow); }
.explore-foot .btn.ready { animation: ready 1.4s ease-in-out infinite; }

#monitor { flex-direction: column; background: rgba(40, 30, 40, .55); animation: fadein .3s ease; }
.monitor-wrap { width: min(100%, 360px); display: flex; flex-direction: column; align-items: center; }
.monitor {
  width: 100%; padding: 12px 12px 8px; border-radius: 18px;
  background: linear-gradient(#4a4450, #35303a);
  box-shadow: 0 14px 30px rgba(30, 20, 30, .45), inset 0 1px 0 rgba(255, 255, 255, .15);
  animation: rise .35s ease;
}
.monitor-screen { position: relative; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 8px; background: #111; }
.monitor-pic { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.15) brightness(.97); animation: flicker 5s steps(1) infinite; }
@keyframes flicker { 0%, 100% { opacity: 1; } 47% { opacity: .9; } 48% { opacity: 1; } 81% { opacity: .94; } 82% { opacity: 1; } }
.monitor-scan { position: absolute; inset: 0; background: repeating-linear-gradient(rgba(255, 255, 255, .04) 0 1px, rgba(0, 0, 0, .13) 1px 3px); }
.monitor-scan::after {
  content: ""; position: absolute; left: 0; right: 0; height: 28%;
  background: linear-gradient(transparent, rgba(255, 255, 255, .09), transparent);
  animation: roll 3.4s linear infinite;
}
@keyframes roll { from { top: -30%; } to { top: 100%; } }
.monitor-cam, .monitor-rec, .monitor-time {
  position: absolute; font-family: ui-monospace, Consolas, monospace; font-size: 12px; font-weight: 700;
  color: #fff; letter-spacing: .04em; text-shadow: 0 0 3px rgba(0, 0, 0, .9);
}
.monitor-cam { left: 10px; top: 8px; }
.monitor-rec { right: 10px; top: 8px; color: #ff6b6b; animation: rec 1.2s steps(1) infinite; }
@keyframes rec { 50% { opacity: 0; } }
.monitor-time { right: 10px; bottom: 8px; }
.monitor-bar { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 7px; font-size: 11px; font-weight: 700; letter-spacing: .1em; color: rgba(255, 255, 255, .65); }
.monitor-led { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 6px var(--green); }
.monitor-stand { width: 26%; height: 14px; border-radius: 0 0 10px 10px; background: linear-gradient(#3e3844, #2e2a33); }
.monitor-q { margin: 16px 0 12px; font-size: 17px; font-weight: 900; color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, .45); }
.monitor-btns { width: min(100%, 320px); display: flex; flex-direction: column; gap: 10px; animation: rise .35s ease .15s backwards; }
.monitor-btns .btn { min-height: 50px; font-size: 15.5px; box-shadow: var(--shadow); }

.keypad-panel { align-items: center; }
.keypad-display { display: flex; gap: 10px; margin: 4px 0 8px; }
.keypad-display span {
  width: 44px; height: 54px; border-radius: 12px; background: #fff; border: 2px solid var(--line);
  display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 900;
}
.keypad-display.ng { animation: shake .4s; }
.keypad-display.ok span { border-color: var(--green); color: var(--green); }
.keypad-hint { min-height: 20px; font-size: 13px; color: var(--ink-soft); margin-bottom: 8px; }
.keypad-keys { display: grid; grid-template-columns: repeat(3, 64px); gap: 10px; }
.keypad-keys button {
  height: 56px; border-radius: 16px; border: 2px solid var(--line); background: #fff;
  font-size: 22px; font-weight: 700; cursor: pointer;
}
.keypad-keys button:active { background: var(--pink-pale); }
.keypad-keys .k-del { font-size: 14px; }

#chapter { background: rgba(255, 248, 252, .92); z-index: 30; animation: fadein .4s ease; }
.chapter-inner { text-align: center; }
.chapter-title { font-family: var(--font-pop); font-size: 30px; color: var(--pink-deep); letter-spacing: .06em; animation: rise .5s ease; }
.chapter-sub { margin-top: 10px; font-size: 14px; color: var(--ink-soft); font-weight: 700; animation: rise .5s ease .15s backwards; }

#log { background: rgba(60, 40, 60, .35); z-index: 40; }
.log-panel { height: 86%; }
.log-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.log-item { font-size: 14px; line-height: 1.6; }
.log-item b { display: block; font-size: 12px; color: var(--c, var(--pink-deep)); }
.log-item.pick { color: var(--pink-deep); font-weight: 700; }
#sys { background: rgba(60, 40, 60, .35); z-index: 40; }
.sys-row { margin-bottom: 14px; }
.sys-label { font-size: 13px; font-weight: 700; margin-bottom: 6px; color: var(--ink-soft); }
.seg { display: flex; background: #fff; border: 1.5px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button { flex: 1; border: 0; background: none; padding: 11px 4px; min-height: 44px; border-radius: 999px; font-size: 14px; font-weight: 700; cursor: pointer; }
.seg button.on { background: var(--pink-deep); color: #fff; }
.sys-btns { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }

.screen { position: absolute; inset: 0; z-index: 50; display: flex; flex-direction: column; overflow: hidden; background: #fdf3f8; }
.kv { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; animation: kvin 1.2s ease; }
.kv-soft { object-position: 50% 22%; }
@keyframes kvin { from { opacity: 0; transform: scale(1.04); } }
.title-shade { position: absolute; inset: 0; background: linear-gradient(rgba(255, 248, 252, .55), rgba(255, 248, 252, 0) 34%, rgba(255, 248, 252, 0) 62%, rgba(255, 246, 251, .92) 86%); }
.title-top { position: relative; text-align: center; padding: calc(18px + env(safe-area-inset-top)) 12px 0; }
.title-shop { font-size: 12px; font-weight: 900; letter-spacing: .32em; color: var(--pink-deep); text-shadow: 0 1px 0 #fff; }
.title-logo-img { position: relative; margin: 0 auto 2px; width: min(94%, 370px); animation: rise .7s ease .2s backwards; }
.title-logo-img img { display: block; width: 100%; height: auto; filter: drop-shadow(0 4px 10px rgba(200, 90, 140, .18)); animation: float 4.5s ease-in-out 1s infinite; }
.title-logo-img::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, .85) 50%, transparent 62%) no-repeat;
  background-size: 260% 100%; background-position: 160% 0;
  -webkit-mask: var(--logo) center / 100% 100% no-repeat; mask: var(--logo) center / 100% 100% no-repeat;
  animation: shine 6s ease-in-out 1.6s infinite, float 4.5s ease-in-out 1s infinite;
}
@keyframes float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -5px; } }
@keyframes shine { 0% { background-position: 160% 0; } 22%, 100% { background-position: -60% 0; } }
.title-fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.title-fx i {
  position: absolute; top: -8%; font-style: normal; line-height: 1;
  color: var(--c); font-size: var(--s); opacity: 0;
  text-shadow: 0 0 6px rgba(255, 255, 255, .95);
  animation: drift var(--d) linear var(--delay) infinite;
}
@keyframes drift {
  0% { transform: translate(0, 0) rotate(0); opacity: 0; }
  10% { opacity: .95; }
  50% { transform: translate(var(--sway), 52vh) rotate(160deg); }
  85% { opacity: .8; }
  100% { transform: translate(0, 105vh) rotate(320deg); opacity: 0; }
}
.kv { animation: kvin 1.2s ease, kvzoom 22s ease-in-out 1.2s infinite alternate; }
@keyframes kvzoom { from { transform: scale(1); } to { transform: scale(1.045); } }
.title-bottom { position: relative; }
.title-mascot {
  position: absolute; right: 8px; bottom: calc(100% - 22px); width: 74px; height: auto;
  transform-origin: 50% 100%; animation: mascot 3.2s ease-in-out 1s infinite;
  filter: drop-shadow(0 4px 6px rgba(120, 70, 110, .25));
}
@keyframes mascot {
  0%, 100% { transform: translateY(0) rotate(0); }
  10% { transform: translateY(-12px) rotate(-6deg); }
  20% { transform: translateY(0) rotate(0); }
  28% { transform: translateY(-6px) rotate(5deg); }
  36% { transform: translateY(0) rotate(0); }
  60% { transform: translateY(0) rotate(-3deg); }
  75% { transform: translateY(0) rotate(3deg); }
}
@media (prefers-reduced-motion: reduce) {
  .title-fx, .title-logo-img::after { display: none; }
  .kv, .title-logo-img img, .title-mascot { animation: none; }
}
.title-sub {
  display: inline-block; margin-top: 4px; padding: 4px 14px; border-radius: 999px;
  background: rgba(255, 255, 255, .85); color: var(--pink-deep); font-weight: 900; font-size: 13.5px; letter-spacing: .1em;
  animation: rise .7s ease .35s backwards;
}
.title-bottom { position: relative; margin-top: auto; padding: 0 22px calc(28px + env(safe-area-inset-bottom)); text-align: center; }
.title-gate, .title-menu { width: min(100%, 320px); margin: 0 auto; animation: rise .5s ease .5s backwards; }
.gate-q { font-weight: 900; font-size: 17px; margin: 0 0 12px; color: var(--ink); text-shadow: 0 1px 0 #fff, 0 0 12px #fff; }
.gate-btns { display: flex; gap: 10px; }
.gate-btns .btn { flex: 1; }
.gate-no { margin: 12px 0 0; padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, .92); font-size: 13.5px; line-height: 1.7; animation: rise .3s ease; }
.title-menu { display: flex; flex-direction: column; gap: 10px; }
.title-menu[hidden], .title-gate[hidden] { display: none !important; }
.title-menu .btn { min-height: 50px; font-size: 16px; box-shadow: var(--shadow); }

#ending { justify-content: flex-end; }
#ending::before { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(255, 248, 252, 0) 45%, rgba(255, 246, 251, .9) 78%); }
.ending-card {
  position: relative; width: min(100% - 40px, 330px); margin: 0 auto calc(24px + env(safe-area-inset-bottom)); text-align: center;
  background: rgba(255, 250, 252, .9); border-radius: 24px; border: 2px solid var(--line);
  padding: 22px 20px 12px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 12px;
}
.ending-title { font-family: var(--font-pop); font-weight: 400; color: var(--pink-deep); font-size: 24px; line-height: 1.35; margin: 0 0 4px; }
.ending-card .btn-line { min-height: 54px; font-size: 16px; }
.ending-note { font-size: 12px; color: var(--ink-soft); margin: 0; line-height: 1.6; }

#toast {
  position: absolute; left: 50%; top: 64px; transform: translateX(-50%) translateY(-20px);
  background: #fff; border: 2px solid var(--pink); color: var(--ink);
  border-radius: 999px; padding: 8px 16px; font-size: 13.5px; font-weight: 700;
  box-shadow: var(--shadow); opacity: 0; transition: .3s; z-index: 60; pointer-events: none; white-space: nowrap;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (min-height: 760px) {
  #textbox { font-size: 17px; }
}
