/* Shared base: tokens, controls, pet scene art and animations, sheets, toast. */
:root {
  --bg1: #ffe8f0; --bg2: #e3f2ff;
  --ink: #33283a; --muted: #6b5d75;
  --card: #ffffffee; --line: #f0d4e2;
  --pink: #ff6f9c; --pink-d: #d63a76; --pink-edge: #a82557;
  --good: #2f8f4e; --warn: #b4690e; --bad: #c0304f;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Hiragino Sans', 'Yu Gothic UI', sans-serif;
  --font-display: 'DotGothic16', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: linear-gradient(160deg, var(--bg1), var(--bg2)) fixed; min-height: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); min-height: 100vh; min-height: 100dvh; font-size: 16px; line-height: 1.5; -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
h1, h2, h3, .brand { font-family: var(--font-display); font-weight: 400; }
h1, h2, h3 { margin: 0; }
.jp { color: var(--pink-d); font-size: .8em; font-family: var(--font-display); }
button, input { font: inherit; }
button { cursor: pointer; color: var(--ink); touch-action: manipulation; }
:focus-visible { outline: 3px solid #2b7fff; outline-offset: 2px; }
a { color: var(--pink-d); }

/* controls */
.btn-primary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 12px 22px; border: 0; border-radius: 16px; background: var(--pink-d); color: #fff; font-size: 1.05rem; font-weight: 600; box-shadow: 0 4px 0 var(--pink-edge); text-decoration: none; transition: transform .1s, box-shadow .1s; }
.btn-primary:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--pink-edge); }
.btn-primary:disabled { opacity: .6; cursor: default; }
.btn-primary.block { width: 100%; }
.btn-secondary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 18px; border-radius: 14px; background: #fff; border: 2px solid var(--line); color: var(--pink-d); font-weight: 600; text-decoration: none; }
.btn-secondary:active { background: #fff3f8; }
.btn-text { background: none; border: 0; color: var(--pink-d); font-weight: 600; min-height: 44px; padding: 8px 12px; text-decoration: underline; text-underline-offset: 3px; }
.spinner { width: 18px; height: 18px; border: 3px solid #ffffff66; border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; margin-bottom: 6px; font-size: .9rem; font-weight: 600; }
.field small { display: block; margin-top: 6px; color: var(--muted); font-size: .8rem; }
.input-wrap { position: relative; display: flex; }
.input-wrap input { flex: 1; min-width: 0; }
input { display: block; width: 100%; min-height: 52px; padding: 12px 14px; border: 2px solid var(--line); border-radius: 14px; font-size: 1rem; color: var(--ink); background: #fff; }
input:focus { outline: none; border-color: var(--pink-d); box-shadow: 0 0 0 4px #ff6f9c33; }
input[aria-invalid='true'] { border-color: var(--bad); }
.input-wrap .adorn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); min-width: 44px; min-height: 44px; border: 0; background: none; font-size: 1.2rem; border-radius: 12px; }
.input-wrap .adorn + input, .input-wrap input.has-adorn { padding-right: 52px; }
.error { color: var(--bad); min-height: 1.4em; margin: 0 0 8px; font-size: .9rem; font-weight: 500; }

/* pet scene (shared by the game and the landing demo) */
.scene { position: absolute; inset: 0; transition: background .6s; }
.scene.day { background: linear-gradient(#cfeeff, #f3fbe9 70%); }
.scene.night { background: linear-gradient(#2c2f5c, #4a4f8a 70%); }
.ground { position: absolute; left: 0; right: 0; bottom: 0; height: 22%; background: #b9e3a4; }
.night .ground { background: #4b6b6d; }
.pet-wrap { position: absolute; left: 20%; right: 20%; bottom: 8%; top: 12%; }
.pet-wrap.pet3d-wrap { left: 0; right: 0; top: 0; bottom: -6%; }
.pet-svg { width: 100%; height: 100%; overflow: visible; }
.pet3d-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: manipulation; }
.portrait { width: 100%; height: 100%; object-fit: contain; display: block; }
.poop { width: 100%; animation: wiggle 2s infinite; }

/* landing device */
.device {
  background: radial-gradient(circle at 35% 25%, #ffa8c5, #ff6f9c 55%, #e5527f);
  border-radius: 50% 50% 46% 46% / 55% 55% 45% 45%;
  padding: 48px 38px 52px; box-shadow: 0 12px 0 #c43f69, 0 18px 30px #c43f6955, inset 0 -8px 16px #0000001a, inset 0 8px 16px #ffffff55;
  max-width: 360px; margin: 0 auto; text-align: center;
}
.screen { position: relative; aspect-ratio: 1; background: #e8f5df; border: 6px solid #3b2f3f; border-radius: 18px; overflow: hidden; box-shadow: inset 0 0 14px #0003; }
.screen-note { position: absolute; top: 6px; left: 0; right: 0; text-align: center; font-size: .78rem; color: var(--ink); text-shadow: 0 1px #fff8; }
.device-name { margin-top: 14px; color: #fff; text-shadow: 0 2px #c43f69; letter-spacing: .1em; min-height: 1.4em; font-family: var(--font-display); }
.fx-item { position: absolute; bottom: 30%; font-size: 1.6rem; animation: rise 1.4s ease-out forwards; }

/* bottom sheet */
.sheet-backdrop { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; background: #2a1d3300; transition: background .25s; }
.sheet-backdrop.in { background: #2a1d3380; }
.sheet { width: 100%; max-width: 520px; max-height: 88dvh; overflow-y: auto; background: #fff; border-radius: 28px 28px 0 0; padding: 6px 20px calc(20px + var(--safe-bottom)); transform: translateY(100%); transition: transform .28s cubic-bezier(.2, .9, .3, 1); box-shadow: 0 -10px 40px #2a1d3340; overscroll-behavior: contain; }
.sheet-backdrop.in .sheet { transform: none; }
.sheet-grab { display: grid; place-items: center; height: 28px; touch-action: none; cursor: grab; }
.sheet-grab span { width: 44px; height: 5px; border-radius: 999px; background: #e3cdd9; }
.sheet-title { font-size: 1.35rem; margin: 0 0 14px; }
html.sheet-open, html.sheet-open body { overflow: hidden; }
.install-steps { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 14px; }
.install-steps li { display: flex; gap: 12px; align-items: flex-start; line-height: 1.5; }
.step-num { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--pink-d); color: #fff; font-weight: 700; font-size: .9rem; }
.inline-ico { display: inline-flex; vertical-align: middle; color: #2b7fff; }

@keyframes idle { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-2px) } }
@keyframes bounce { 0%,100% { transform: translateY(0) scale(1,1) } 40% { transform: translateY(-8px) scale(.97,1.03) } 60% { transform: translateY(0) scale(1.04,.96) } }
@keyframes breathe { 0%,100% { transform: scale(1) } 50% { transform: scale(1.03,.97) } }
@keyframes wobble { 0%,100% { transform: rotate(-4deg) } 50% { transform: rotate(4deg) } }
@keyframes shake { 0%,100% { transform: rotate(0) } 20% { transform: rotate(-9deg) } 40% { transform: rotate(9deg) } 60% { transform: rotate(-6deg) } 80% { transform: rotate(6deg) } }
@keyframes float { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-4px) } }
@keyframes blink { 50% { opacity: .45 } }
@keyframes wiggle { 0%,100% { transform: rotate(-3deg) } 50% { transform: rotate(3deg) } }
@keyframes rise { from { transform: translateY(0) scale(.6); opacity: 1 } to { transform: translateY(-110px) scale(1.2); opacity: 0 } }
@keyframes zzz { from { opacity: 0; transform: translateY(4px) } 50% { opacity: 1 } to { opacity: 0; transform: translateY(-4px) } }
.idle { animation: idle 2.2s ease-in-out infinite; }
.bounce { animation: bounce 1.2s ease-in-out infinite; }
.breathe { animation: breathe 3s ease-in-out infinite; }
.egg { transform-origin: 32px 56px; transform-box: view-box; }
.wobble { animation: wobble 2.4s ease-in-out infinite; }
.shake { animation: shake .5s ease-in-out infinite; }
.float { animation: float 2.5s ease-in-out infinite; }
.zzz { animation: zzz 2s infinite; } .z2 { animation-delay: .8s; }
.sparkle { animation: blink 1.4s infinite; }
.home-link { color: inherit; text-decoration: none; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; } }
