.app-body { overflow: hidden; }
.app { position: relative; height: 100vh; height: 100dvh; max-width: 480px; margin: 0 auto; display: flex; flex-direction: column; overflow: hidden; background: transparent; }
@media (min-width: 520px) {
  .app { height: min(100dvh - 32px, 900px); margin-top: 16px; border-radius: 32px; background: #ffffff66; box-shadow: 0 20px 60px #b0488066, 0 0 0 8px #ffffffaa; }
}
.page, .main, .splash { flex: 1; min-height: 0; }
.muted { color: var(--muted); margin: 0; font-size: .85rem; }

.offline-banner { position: absolute; top: 0; left: 0; right: 0; z-index: 60; padding: calc(8px + var(--safe-top)) 14px 8px; background: #33283a; color: #fff; text-align: center; font-size: .85rem; }

/* splash */
.splash { display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); }
.splash-egg img { border-radius: 24px; box-shadow: 0 10px 24px #d9739d55; animation: wobble 1.6s ease-in-out infinite; }

/* auth + adopt */
.page { display: flex; flex-direction: column; overflow-y: auto; padding: calc(20px + var(--safe-top)) 20px calc(20px + var(--safe-bottom)); }
.auth-hero { text-align: center; padding: 8px 0 18px; }
.auth-logo { border-radius: 24px; box-shadow: 0 10px 24px #d9739d55; }
.auth-hero h1 { font-size: 1.8rem; margin-top: 12px; }
.tagline { margin: 6px 0 0; color: var(--muted); }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: #ffffffcc; border: 2px solid var(--line); border-radius: 16px; margin-bottom: 18px; }
.segmented button { min-height: 44px; border: 0; border-radius: 12px; background: transparent; font-weight: 600; color: var(--muted); }
.segmented button[aria-selected='true'] { background: var(--pink-d); color: #fff; box-shadow: 0 2px 0 var(--pink-edge); }
.auth form { background: #ffffffcc; border: 2px solid var(--line); border-radius: 22px; padding: 18px; }
.auth-foot { text-align: center; margin: 16px 0 0; }
.auth-foot a { display: inline-block; padding: 12px; }

.adopt { padding-left: 0; padding-right: 0; }
.adopt-head { padding: 0 20px; text-align: center; }
.adopt-head h1 { font-size: 1.6rem; }
.memorial-note { margin: 10px 0 0; padding: 10px 14px; border-radius: 14px; background: #fff; border: 2px solid var(--line); font-size: .9rem; color: var(--muted); }
.carousel-wrap { position: relative; margin-top: 8px; flex: 1; display: flex; align-items: center; min-height: 0; }
.carousel { width: 100%; display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 14px calc(50% - 120px) 18px; scrollbar-width: none; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.carousel::-webkit-scrollbar { display: none; }
.slide { flex: none; width: 240px; scroll-snap-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 14px 18px; border-radius: 28px; background: #fff; border: 3px solid var(--line); text-align: center; transform: scale(.88); opacity: .6; transition: transform .25s, opacity .25s, border-color .25s, box-shadow .25s; position: relative; }
.slide.on { transform: none; opacity: 1; border-color: var(--pink); box-shadow: 0 10px 30px #ff6f9c44; }
.slide-art { width: 170px; height: 170px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle, #fff3f8, #fff 70%); }
.slide h2 { font-size: 1.3rem; margin-top: 4px; }
.slide p { margin: 0; font-size: .85rem; color: var(--muted); min-height: 2.6em; }
.tag3d { position: absolute; top: 12px; right: 12px; padding: 2px 10px; border-radius: 999px; background: linear-gradient(90deg, #d63a76, #8a4bd6); color: #fff; font-size: .72rem; font-weight: 700; }
.tag3d.real { background: linear-gradient(90deg, #e0703a, #ff6f9c); }
.car-arrow { display: none; position: absolute; top: 40%; z-index: 2; width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--line); background: #fff; font-size: 1.6rem; line-height: 1; color: var(--pink-d); }
#car-prev { left: 6px; } #car-next { right: 6px; }
@media (hover: hover) and (pointer: fine) { .car-arrow { display: block; } }
.dots { display: flex; justify-content: center; gap: 7px; margin-bottom: 14px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: #e7c7d6; transition: all .2s; }
.dots i.on { width: 22px; border-radius: 99px; background: var(--pink-d); }
.adopt-form { padding: 0 20px; margin-top: auto; }
.adopt-form .field { margin-bottom: 8px; }

/* main shell */
.main { display: flex; flex-direction: column; position: relative; }
.appbar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: calc(10px + var(--safe-top)) 18px 6px; min-height: 56px; }
.ab-title { min-width: 0; display: flex; flex-direction: column; }
.ab-title b { font-family: var(--font-display); font-weight: 400; font-size: 1.35rem; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ab-title span { color: var(--muted); font-size: .8rem; }
.ab-install { flex: none; min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 2px solid var(--pink-d); background: #fff; color: var(--pink-d); font-weight: 700; font-size: .85rem; }
.panels { flex: 1; min-height: 0; position: relative; }
.panel { position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 16px 16px; }
.panel[hidden] { display: none; }
#panel-pet { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
#panel-pet[hidden] { display: none; }
.panel-title { font-size: 1.3rem; margin: 6px 0 12px; }
.panel-title.second { margin-top: 26px; }

.tabbar { flex: none; display: grid; grid-template-columns: repeat(4, 1fr); padding: 6px 8px calc(6px + var(--safe-bottom)); background: #ffffffee; border-top: 2px solid var(--line); backdrop-filter: blur(10px); }
.tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 52px; border: 0; background: none; border-radius: 14px; font-size: .72rem; font-weight: 600; color: var(--muted); }
.tabbar .t-ico { font-size: 1.35rem; line-height: 1.2; filter: grayscale(.8); opacity: .75; transition: transform .15s; }
.tabbar button[aria-selected='true'] { color: var(--pink-d); background: #fff1f6; }
.tabbar button[aria-selected='true'] .t-ico { filter: none; opacity: 1; transform: scale(1.12); }

/* install banner */
.banner { flex: none; display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border-radius: 16px; background: #fff; border: 2px solid var(--line); box-shadow: 0 4px 14px #d9739d22; }
.banner-ico { font-size: 1.5rem; }
.banner-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.banner-text small { color: var(--muted); font-size: .75rem; }
.banner-btn { min-height: 40px; padding: 6px 16px; border: 0; border-radius: 12px; background: var(--pink-d); color: #fff; font-weight: 700; }
.banner-x { min-width: 40px; min-height: 40px; border: 0; background: none; font-size: 1.5rem; color: var(--muted); border-radius: 12px; }

/* stage */
.stage-card { position: relative; flex: 1; min-height: 200px; border-radius: 28px; overflow: hidden; border: 4px solid #fff; box-shadow: 0 8px 24px #d9739d44, 0 0 0 2px var(--line); background: #cfeeff; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.stage-card .pet-wrap { left: 14%; right: 14%; top: 18%; bottom: 8%; }
.stage-card .pet-wrap.pet3d-wrap { left: 0; right: 0; top: 4%; bottom: -3%; }
.poops { position: absolute; left: 6%; right: 6%; bottom: 3%; display: flex; justify-content: space-between; pointer-events: none; }
.poop-slot { width: 11%; max-width: 44px; }
.poop-slot:nth-child(even) { margin-top: 10px; }
.bubble { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); max-width: 90%; z-index: 3; padding: 9px 16px; border: 2px solid var(--line); border-radius: 18px; background: #fff; color: var(--ink); font-size: .92rem; font-weight: 600; box-shadow: 0 4px 12px #0002; text-align: center; }
.bubble::after { content: ''; position: absolute; left: 50%; bottom: -9px; width: 14px; height: 14px; background: inherit; border-right: 2px solid var(--line); border-bottom: 2px solid var(--line); transform: translateX(-50%) rotate(45deg); }
.bubble.action { border-color: var(--pink-d); color: var(--pink-d); animation: nudge 1.8s ease-in-out infinite; min-height: 44px; }
.bubble.action::after { border-color: var(--pink-d); }
.bubble:disabled { cursor: default; }
@keyframes nudge { 0%,100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-3px); } }
.fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 4; }
.hatch { position: absolute; left: 16px; right: 16px; bottom: 14px; z-index: 3; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: .85rem; font-weight: 600; }
.hatch-bar { width: 70%; height: 10px; border-radius: 99px; background: #ffffffaa; overflow: hidden; border: 2px solid #fff; }
.hatch-bar i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #ff9ec0, #b36bff); transition: width 1s linear; }
.stage-hint { position: absolute; left: 0; right: 0; bottom: 8px; margin: 0; text-align: center; font-size: .75rem; color: #3b2f3fb0; pointer-events: none; transition: opacity .6s; }
.night .stage-hint, .stage-card.night .stage-hint { color: #ffffffb0; }
.mood-chip { position: absolute; top: 10px; left: 10px; z-index: 3; display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px 5px 7px; border-radius: 999px; background: #ffffffee; border: 2px solid var(--line); font-size: .78rem; font-weight: 700; color: var(--ink); box-shadow: 0 2px 0 var(--line); pointer-events: none; }
.mood-chip .m-emoji { font-size: 1rem; line-height: 1; }
.stage-card.night .mood-chip { background: #2a2438ee; color: #fff; border-color: #ffffff33; box-shadow: none; }
.stage-card.pressed .pet-wrap { transform: scale(.98); }
.stage-card.nudge { animation: nudgecard .3s; }
@keyframes nudgecard { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* stats */
.stats { flex: none; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.stat { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px 7px; border-radius: 16px; background: #fff; border: 2px solid var(--line); }
.stat .s-ico { font-size: 1.25rem; line-height: 1; }
.stat .s-bar { width: 100%; height: 8px; border-radius: 99px; background: #f3e9ef; overflow: hidden; }
.stat .s-bar i { display: block; height: 100%; border-radius: 99px; transition: width .5s, background-color .5s; }
.stat .s-label { font-size: .66rem; font-weight: 600; color: var(--muted); }
.stat.low { border-color: #ff8a9d; animation: lowpulse 1.4s ease-in-out infinite; }
.stat.low .s-ico { animation: wiggle .5s ease-in-out infinite; }
@keyframes lowpulse { 50% { background: #fff0f3; } }

.tips { flex: none; padding: 10px 14px; border-radius: 16px; background: #fff9e6; border: 2px solid #ffe08a; font-size: .85rem; }
.tips p { margin: 0 0 4px; }
.tips ul { margin: 0; padding-left: 18px; }
.tips .btn-text { padding: 6px 0 0; min-height: 36px; }

/* dock */
.dock { flex: none; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.dock button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 7px; min-height: 66px; background: #fff; border: 2px solid var(--line); border-radius: 18px; box-shadow: 0 3px 0 var(--line); transition: transform .08s, box-shadow .08s; position: relative; }
.dock button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.dock .d-ico { font-size: 1.6rem; line-height: 1.15; }
.dock .d-label { font-size: .72rem; font-weight: 700; }
.dock button[aria-disabled='true'] { opacity: .45; box-shadow: none; }
.dock button.attn { border-color: var(--pink-d); background: #fff1f6; animation: attn 1.4s ease-in-out infinite; }
.dock button.attn::after { content: ''; position: absolute; top: 5px; right: 8px; width: 10px; height: 10px; border-radius: 50%; background: var(--pink-d); border: 2px solid #fff; }
@keyframes attn { 50% { transform: translateY(-2px); } }
.dock.busy button { pointer-events: none; }
.dead-cta { flex: none; padding: 14px; border-radius: 20px; background: #f4f0f7; text-align: center; }
.dead-cta p { margin: 0 0 12px; }

/* toast */
.toast { position: absolute; left: 50%; top: calc(64px + var(--safe-top)); transform: translate(-50%, -12px); z-index: 90; max-width: calc(100% - 32px); padding: 11px 18px; border-radius: 16px; background: #33283a; color: #fff; font-size: .92rem; font-weight: 500; text-align: center; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; box-shadow: 0 8px 24px #0004; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.good { background: #1f6b3a; }
.toast.warn { background: #8a4b0a; }

/* sheets (feature content) */
.choice-grid { display: grid; gap: 12px; }
.choice { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 76px; padding: 12px 16px; text-align: left; background: #fff; border: 2px solid var(--line); border-radius: 20px; box-shadow: 0 3px 0 var(--line); }
.choice:active { transform: translateY(2px); box-shadow: none; }
.choice .c-ico { font-size: 2.2rem; }
.choice .c-text { flex: 1; display: flex; flex-direction: column; line-height: 1.3; }
.choice .c-text b { font-size: 1.05rem; }
.choice .c-text small { color: var(--muted); font-size: .82rem; }
.choice[aria-disabled='true'] { opacity: .5; }
.choice .badge { padding: 2px 10px; border-radius: 99px; background: #fff1f6; color: var(--pink-d); font-size: .75rem; font-weight: 700; }
.guess { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.guess button { min-height: 110px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border-radius: 22px; border: 2px solid var(--line); background: #fff; box-shadow: 0 4px 0 var(--line); font-weight: 700; font-size: 1.1rem; }
.guess button span { font-size: 2.2rem; color: var(--pink-d); }
.guess button:active { transform: translateY(3px); box-shadow: none; }
.sheet-note { margin: 0 0 12px; color: var(--muted); font-size: .9rem; }
.weight { margin-top: 12px; font-size: .8rem; color: var(--muted); }
.weight .s-bar { height: 8px; border-radius: 99px; background: #f3e9ef; overflow: hidden; margin-top: 4px; }
.weight .s-bar i { display: block; height: 100%; background: #ff9f43; border-radius: 99px; }
.tip-list { margin: 0 0 16px; padding-left: 20px; display: grid; gap: 8px; }

/* diary, ranks, me */
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 3px solid var(--line); display: grid; gap: 14px; }
.timeline li { position: relative; }
.timeline li::before { content: ''; position: absolute; left: -26px; top: 5px; width: 11px; height: 11px; border-radius: 50%; background: var(--pink); border: 2px solid #fff; }
.timeline time { display: block; font-size: .75rem; color: var(--muted); }
.empty { padding: 28px 12px; text-align: center; color: var(--muted); }
.ranklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: r; }
.ranklist li { counter-increment: r; display: flex; align-items: center; gap: 12px; padding: 8px 14px 8px 8px; background: #fff; border: 2px solid var(--line); border-radius: 18px; }
.ranklist:not(.plain) li::before { content: counter(r); flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: #f3e9ef; font-size: .85rem; font-weight: 700; }
.ranklist:not(.plain) li:nth-child(1)::before { background: #ffd34d; } .ranklist:not(.plain) li:nth-child(2)::before { background: #dfe5ee; } .ranklist:not(.plain) li:nth-child(3)::before { background: #f1c19a; }
.ranklist li.mine { border-color: var(--pink-d); background: #fff6fa; }
.ranklist .r-art { flex: none; width: 44px; height: 44px; }
.ranklist .r-art svg, .ranklist .r-art img { width: 100%; height: 100%; }
.ranklist .r-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.ranklist .r-text b, .ranklist .r-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranklist .r-text small { color: var(--muted); }
.ranklist .r-meta { font-size: .8rem; font-weight: 600; color: var(--good); }
.ranklist .r-meta.dead { color: var(--muted); }
.me-card { display: flex; align-items: center; gap: 14px; padding: 14px; background: #fff; border: 2px solid var(--line); border-radius: 22px; margin-bottom: 16px; }
.me-avatar { width: 64px; height: 64px; flex: none; border-radius: 50%; background: radial-gradient(circle, #fff3f8, #ffe0ec); display: grid; place-items: center; overflow: hidden; }
.me-avatar svg, .me-avatar img { width: 100%; height: 100%; }
.menu { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.menu button, .menu a { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; padding: 10px 14px; background: #fff; border: 2px solid var(--line); border-radius: 18px; text-align: left; color: var(--ink); text-decoration: none; font-size: 1rem; }
.menu button:active, .menu a:active { background: #fff6fa; }
.menu .m-text { flex: 1; display: flex; flex-direction: column; line-height: 1.3; }
.menu .m-text small { color: var(--muted); font-size: .8rem; }
.menu .chev { color: var(--muted); font-size: 1.4rem; }
.menu li > button > span:first-child, .menu li > a > span:first-child { font-size: 1.5rem; }

@media (max-height: 700px) {
  .appbar { min-height: 48px; padding-top: calc(6px + var(--safe-top)); }
  .dock button { min-height: 58px; }
  .dock .d-ico { font-size: 1.4rem; }
  .stat { padding: 6px 4px; }
  .tabbar button { min-height: 46px; }
  .stage-card { min-height: 160px; }
}

