/* Spirit Grove — approved concept C. Warm painted scenery, quiet paper surfaces. */
:root {
  --bg: #f3efdf; --surface: #fffcf1; --surface-2: #f4eedc;
  --ink: #443a29; --muted: #80765f; --line: #e0d5b9;
  --accent: #50734d; --accent-ink: #fffef6; --accent-soft: #e5edd7;
  --gold: #ab7a31; --gold-soft: #fff0c5; --warn: #bb5f4f; --warn-soft: #f9e2d7;
  --radius: 23px;
  --shadow: 0 2px 0 #d8ceaf55, 0 12px 30px -18px #5a543f66;
}
body {
  background: radial-gradient(ellipse at 8% 4%, #d6dfbe66, transparent 35%), radial-gradient(ellipse at 95% 36%, #eed7a655, transparent 32%), var(--bg);
  background-attachment: fixed;
}
.app { max-width: 480px; gap: 14px; padding: 16px 16px 120px; }
.top { gap: 10px; min-height: 68px; padding: 0 4px; }
.brand { color: #4c5133; font-size: 25px; line-height: .91; letter-spacing: -.06em; flex: 1; }
.brand-name { font-family: Georgia, 'Times New Roman', serif; font-weight: 700; text-shadow: 0 1px 0 #fff8e3; }
.brand small { margin-top: 4px; font-size: 9px; letter-spacing: .12em; font-family: var(--font-body); }
.top-actions { gap: 7px; }
#shopBtn { display: none; }
.top-actions .icon-btn { width: 42px; height: 42px; padding: 5px; border-color: var(--line); background: var(--surface); }
#accountBtn { position: relative; }
#accountBtn.is-online::after { content: ''; position: absolute; right: 2px; bottom: 3px; width: 7px; height: 7px; background: #6d9464; border: 2px solid var(--surface); border-radius: 50%; }
#accountIco { display: block; width: 100%; height: 100%; }
#accountIco .ui-icon { width: 100%; height: 100%; }
.dex-btn { display: flex; align-items: center; gap: 4px; font-size: 13px; padding: 8px 10px; min-height: 42px; background: linear-gradient(#fffcf2, #f5ecd4); border: 1px solid var(--line); }
.dex-mark { width: 24px; height: 24px; }
.dex-mark .ui-icon { width: 100%; height: 100%; }
#dexLabel { color: var(--ink); }
h2.title { font-size: 27px; line-height: 1.3; color: var(--accent); letter-spacing: -.035em; }
.lead { font-size: 13px; line-height: 1.8; max-width: 40ch; }
.screen { gap: 15px; }
.habitat { border-radius: 29px; border: 1px solid #bdb88c; aspect-ratio: 1.3; box-shadow: 0 3px 0 #c9c1a0, 0 18px 38px -19px #54604488; isolation: isolate; }
.habitat::before { display: none; }
.habitat .hab-scenery { opacity: 1; }
.hab-info { top: 12px; left: 12px; right: 12px; padding: 10px 12px; border: 1px solid #fff7df77; background: color-mix(in srgb, var(--surface) 87%, transparent); border-radius: 18px; gap: 5px; }
.hab-name { font-size: 21px; letter-spacing: -.03em; }
.hab-name small { margin-top: 2px; font-size: 10px; letter-spacing: .03em; }
.chips { gap: 4px; align-self: center; }
.chip { font-size: 10px; padding: 3px 7px; border-width: 1px; }
/* 위쪽 이름 카드가 키 큰 아이(개구리 연잎 등)의 머리를 가리지 않게 조금 낮춘다 */
.stage { height: 71%; bottom: calc(1% - var(--y, 0%)); }
.painted-creature { filter: drop-shadow(0 5px 3px #283f3026); }
.painted-creature.is-shiny { filter: drop-shadow(0 0 5px #fff6d655) drop-shadow(0 5px 3px #283f3026); }
.shiny-star { transform-box: fill-box; transform-origin: center; animation: shinyTwinkle 4.2s ease-in-out var(--twinkle-delay, 0s) infinite; }
@keyframes shinyTwinkle {
  0%, 65%, 100% { opacity: .18; transform: scale(.55); }
  28% { opacity: 1; transform: scale(1.1); }
}
.motion-paused .shiny-star { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) { .shiny-star { animation: none; opacity: .8; transform: none; } }
.painted-creature[data-mood="sad"] { filter: saturate(.72) drop-shadow(0 4px 4px #283f3026); }
.painted-creature[data-mood="dead"] { filter: grayscale(.85); opacity: .7; }
.painted-creature[data-mood="sleep"] { filter: saturate(.82) drop-shadow(0 4px 4px #283f3026); }
.bubble { font-size: 12px; color: var(--accent); margin: -3px 0 0; min-height: 1.7em; }
.stats, .friends, .result { background: linear-gradient(125deg, var(--surface), var(--surface-2)); border: 1px solid var(--line); box-shadow: var(--shadow); }
.growth-notes { display: grid; gap: 10px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; }
.growth-notes .outlook { border: 0; padding-top: 0; }
.stats { padding: 12px 14px; gap: 6px; }
.stat { grid-template-columns: 6.4em minmax(0, 1fr) 2.3em; gap: 8px; }
.stat-label { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink); }
.stat-label .ui-icon { width: 23px; height: 23px; flex: 0 0 23px; }
.stat-num { font-size: 12px; color: var(--muted); }
.bar { height: 11px; border-color: #d3c6a2; background: #e7dec555; box-shadow: inset 0 1px 2px #897e6222; }
.bar > i { background: linear-gradient(180deg, color-mix(in srgb, var(--bar-color, var(--accent)) 65%, white), var(--bar-color, var(--accent))); box-shadow: inset 0 1px 0 #ffffff55; }
#bar_hunger { --bar-color: #80a350; } #bar_love { --bar-color: #df8790; } #bar_clean { --bar-color: #79abc4; }
.bar.is-low { --bar-color: #c06c57 !important; }
.stat-note { font-size: 11px; line-height: 1.7; }
.outlook { font-size: 11px; gap: 5px; padding-top: 7px; }
.request { background: var(--gold-soft); border-color: #e2c77c; font-size: 11px; padding: 8px 10px; gap: 7px; }
.row-label { color: var(--muted); font-size: 10px; letter-spacing: .12em; margin: 0 4px -3px; }
.controls { gap: 10px; }
.row { gap: 10px; }
.act { position: relative; min-height: 83px; padding: 9px 7px 8px; gap: 1px; border: 1px solid #dbcfac; border-radius: 22px; background: linear-gradient(155deg, #fffdf3, #f4ead1); box-shadow: inset 0 2px 0 #fffef8, 0 3px 0 #d6c9a8, 0 6px 12px -9px #766b4c88; }
.act .ico { display: block; width: 48px; height: 48px; }
.act .ico > .ui-icon { display: block; width: 100%; height: 100%; }
.act .lbl { font-size: 12px; color: #63563c; }
.act[aria-pressed="true"] { background: linear-gradient(#f3f7e8, #dfe9cc); }
.act:disabled { opacity: .5; }
.ui-icon { display: inline-block; width: 30px; height: 30px; vertical-align: middle; flex-shrink: 0; }
.ui-glyph { color: var(--accent); padding: 3px; }
.ui-glyph-sun { color: #c0913e; } .ui-glyph-flame { color: #d17b49; } .ui-glyph-snow { color: #7aa7bf; }
.helper { background: color-mix(in srgb, var(--surface) 70%, transparent); border: 1px dashed var(--line); border-radius: 18px; padding: 10px; gap: 8px; }
.helper p { font-size: 10px; line-height: 1.7; }
.helper-ico .ui-icon { width: 32px; height: 32px; }
.btn { font-size: 15px; border-radius: 16px; }
.btn.is-small { font-size: 11px; padding: 8px 10px; }
.btn.is-ghost { background: var(--surface); border-width: 1px; }
.env-row { gap: 4px; }
.env { padding: 5px 2px; gap: 4px; border-width: 1px; border-radius: 13px; overflow: hidden; min-height: 54px; }
.env .env-thumb { display: block; width: 31px; height: 26px; border-radius: 7px; overflow: hidden; }
.env-thumb svg { width: 100%; height: 100%; display: block; }
.env .lbl { display: block; max-width: 100%; font-size: 9px; overflow: hidden; text-overflow: ellipsis; }
.env[aria-pressed="true"] { box-shadow: inset 0 -2px 0 var(--accent); }
.egg-card { position: relative; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; min-height: 355px; padding: 0; overflow: hidden; border: 1px solid #d5c9a4; border-radius: 28px; box-shadow: var(--shadow); }
.egg-card-scene { position: absolute; inset: 0 0 75px; }
.egg-card-scene > svg { width: 100%; height: 100%; }
.egg-card-art { position: absolute; left: 50%; top: 20px; width: 200px; height: 200px; transform: translateX(-50%); }
.egg-card-art svg { width: 100%; height: 100%; }
.egg-card-copy { position: relative; padding: 15px 19px; background: color-mix(in srgb, var(--surface) 94%, transparent); border-top: 1px solid var(--line); }
.egg-card h3 { font-size: 22px; }
.egg-card p { font-size: 12px; line-height: 1.8; }
.egg-card .go { font-size: 12px; font-family: var(--font-display); }
.friends { padding: 14px; }
.friends h3 { font-size: 12px; letter-spacing: .07em; margin-bottom: 12px; }
.friends .env-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.friends .env-list li { display: flex; flex-direction: column; align-items: stretch; gap: 3px; font-size: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; padding-bottom: 9px; }
.env-list .env-preview { display: block; height: 77px; border: 0; border-radius: 0; margin-bottom: 3px; }
.env-list b, .env-list small { padding: 0 9px; align-self: auto; }
.env-list small { font-size: 10px; line-height: 1.6; }
.friends .env-list li:last-child { grid-column: 1 / -1; }
.friends .env-list li:last-child .env-preview { height: 100px; }
.dex { background: var(--bg); }
.dex-head { padding-block: 4px 12px; }
.dex-card { border: 1px solid var(--line); border-radius: 17px; background: var(--surface); }
.dex-card.is-unknown { background: var(--surface-2); }
.dex-card .nm { font-size: 10px; }
.dex-detail, .acct-card, .product { background: var(--surface); border-color: var(--line); }
.dex-detail { border-radius: 21px; }
.product { border-radius: 19px; }
.dex::backdrop { background: #1e302dc4; backdrop-filter: blur(5px); }
.grove-nav { position: fixed; z-index: 8; bottom: max(10px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: min(448px, calc(100% - 28px)); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 6px; background: color-mix(in srgb, var(--surface) 96%, transparent); border: 1px solid #cec2a0; border-radius: 25px; box-shadow: 0 7px 24px #3f492f33, inset 0 2px 0 #fffbed88; backdrop-filter: blur(15px); }
.grove-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-width: 0; min-height: 60px; padding: 3px 4px; border: 0; border-radius: 19px; background: none; color: var(--muted); font-size: 10px; }
.grove-nav .ui-icon { width: 36px; height: 36px; display: block; }
.grove-nav button[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.grove-nav button[aria-current="page"] > span:last-child { font-weight: 700; }
.foot-link { font-size: 10px; }
@media (max-width: 350px) { .app { padding-inline: 12px; } .brand { font-size: 23px; } .chip { font-size: 9px; padding-inline: 5px; } .hab-name { font-size: 19px; } .hab-info { left: 9px; right: 9px; gap: 4px; } .stage { height: 73%; } .act { min-height: 77px; } .act .ico { width: 43px; height: 43px; } }
@media (min-width: 700px) { .app { padding-top: 28px; } .grove-nav { bottom: 18px; } }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #18251f; --surface: #26382d; --surface-2: #223026; --ink: #f2ebd5; --muted: #bbbea8; --line: #465440; --accent: #b1ce92; --accent-ink: #213321; --accent-soft: #3b5038; --gold: #e7c576; --gold-soft: #4d4530; --warn: #efa48c; --warn-soft: #4e332b; --shadow: 0 3px 0 #12231c66, 0 10px 25px -14px #07160eaa; }
  :root:not([data-theme="light"]) .brand { color: #e0e4be; } :root:not([data-theme="light"]) .brand-name { text-shadow: none; }
  :root:not([data-theme="light"]) .act, :root:not([data-theme="light"]) .dex-btn { background: linear-gradient(#354832, #283d2c); border-color: var(--line); box-shadow: 0 3px 0 #152e22; }
  :root:not([data-theme="light"]) .act .lbl { color: var(--ink); }
  :root:not([data-theme="light"]) .habitat .hab-scenery { filter: brightness(.78) saturate(.87); }
}
:root[data-theme="dark"] { --bg: #18251f; --surface: #26382d; --surface-2: #223026; --ink: #f2ebd5; --muted: #bbbea8; --line: #465440; --accent: #b1ce92; --accent-ink: #213321; --accent-soft: #3b5038; --gold: #e7c576; --gold-soft: #4d4530; }
:root[data-theme="dark"] .brand { color: #e0e4be; }
:root[data-theme="dark"] .brand-name { text-shadow: none; }
:root[data-theme="dark"] .act, :root[data-theme="dark"] .dex-btn { background: var(--surface); border-color: var(--line); box-shadow: 0 3px 0 #152e22; }
:root[data-theme="dark"] .act .lbl { color: var(--ink); }
:root[data-theme="dark"] .habitat .hab-scenery { filter: brightness(.78) saturate(.87); }
.outlook .stat-note { font-size: 10px; line-height: 1.6; }
.lean { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 8px; }
.lean-item { grid-template-columns: 4em 1fr 2.6em; gap: 4px; font-size: 10px; }
.lean-item .ui-icon { width: 15px; height: 15px; }
.request p { font-size: 11px; line-height: 1.6; }
.request em { font-size: 11px; }
.req-ico .ui-icon { width: 24px; height: 24px; }
.request p .ui-icon { width: 17px; height: 17px; }
.chip .ui-icon { width: 14px; height: 14px; }
.fx i .ui-icon { width: 28px; height: 28px; }
.mg-ball .ui-icon { width: 52px; height: 52px; }
.mg-hud .ui-icon { width: 24px; height: 24px; }

/* Every navigation destination occupies the same main viewport. */
.page { display: flex; flex-direction: column; gap: 15px; min-width: 0; }
.page.dex { width: 100%; max-width: none; height: auto; max-height: none; margin: 0; padding: 0; }
.page .dex-head { position: static; background: none; padding: 4px 0; }
.page h2:focus { outline: none; }
.habitat-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.habitat-choice { display: flex; flex-direction: column; gap: 0; padding: 0; overflow: hidden; text-align: left; border: 2px solid var(--line); border-radius: 21px; background: var(--surface); box-shadow: var(--shadow); }
.habitat-choice[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.habitat-choice:disabled { cursor: default; opacity: .65; }
.habitat-preview { display: block; height: 108px; overflow: hidden; }
.habitat-preview svg { display: block; width: 100%; height: 100%; }
.habitat-copy { display: grid; gap: 3px; padding: 10px 12px 12px; }
.habitat-copy b { font-family: var(--font-display); font-weight: 400; font-size: 18px; }
.habitat-copy small { color: var(--muted); font-size: 11px; line-height: 1.6; }
.habitat-link { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 17px; text-align: left; font-size: 12px; }
.habitat-link span:nth-child(2) { flex: 1; }
.stage { transition: none; }
.stage.is-evolving { position: absolute; }
.stage.motion-paused .mover, .stage.motion-paused .creature, .stage.motion-paused [class^="p-"] { animation-play-state: paused; }
.stage.is-eating .creature { animation: none; }
.stage.is-eating .mover { animation: feedingLean .9s ease-in-out; }
.hab-food { position: absolute; z-index: 4; width: 48px; height: 48px; margin: -24px; pointer-events: none; transform-origin: center; }
.hab-food .ui-icon { width: 100%; height: 100%; }
.hab-food.is-eaten { animation: foodBite .9s ease-in forwards; }
.mg { pointer-events: none; background: none; }
.mg-hud, .mg-ball { pointer-events: auto; }
.mg-ball { animation: ballRoll 1.65s ease-in-out forwards; }
.mg-ball.is-batted { animation: ballBat .5s ease-out forwards; }
.mg-ball.is-caught { animation: ballCaught .25s ease forwards; }
@keyframes feedingLean { 0%, 100% { rotate: 0deg; } 25%, 65% { rotate: 4deg; translate: 0 2%; } 45%, 85% { rotate: 1deg; } }
@keyframes foodBite { 0% { scale: 1; translate: 0 0; } 30%, 55% { scale: .75; translate: var(--bite-x, 0px) var(--bite-y, -20px); } 70%, 85% { scale: .4; opacity: 1; translate: var(--bite-x, 0px) var(--bite-y, -20px); } 100% { scale: .1; opacity: 0; translate: var(--bite-x, 0px) var(--bite-y, -20px); } }
@keyframes ballRoll { 0% { rotate: -35deg; scale: .8; } 30% { rotate: 10deg; scale: 1; } 60% { translate: 0 -5px; } 100% { rotate: 35deg; } }
@keyframes ballBat { to { translate: 12px -18px; rotate: 65deg; } }

/* 부위별 관절은 꺼 두었으므로(rig.js 의 RIG_SPECIES), 그림 전체의 움직임(숨쉬기·걷기·먹기)을 쓴다.
   기울이기(rotate)는 motion.js 가 바라보는 방향에 맞춰 준다. */
.stage .painted-creature { transition: rotate .25s ease-out; }

/* Release: consent, permanent garden and illustrated theme previews. */
.grove-nav { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grove-nav:has(> [data-open="shop"][hidden]) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.onboarding-card, .garden-card, .theme-preview-card { padding: 16px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); margin-bottom: 14px; }
.onboarding-card p, .garden-card p { color: var(--muted); font-size: 13px; line-height: 1.75; }
.onboarding-card .btn-row { margin-top: 12px; }
.consent-panel h2 { font-size: 20px; }
.consent-panel label { display: flex; gap: 9px; align-items: flex-start; font-size: 13px; line-height: 1.8; margin: 12px 0; }
.consent-panel input { flex: 0 0 auto; margin-top: 6px; accent-color: var(--accent); }
.consent-panel a { color: var(--accent); }
.consent-panel [role="status"] { color: var(--warn); }
.egg-card:disabled { cursor: default; opacity: .65; }
.theme-preview-scene, .favorite-scene { aspect-ratio: 1.3; overflow: hidden; position: relative; isolation: isolate; border-radius: 23px; background: var(--surface-2); }
.theme-preview-scene > svg, .favorite-backdrop, .favorite-backdrop > svg { position: absolute; width: 100%; height: 100%; inset: 0; }
.preview-pet { position: absolute; width: 72%; height: 86%; left: 14%; bottom: 0; }
.preview-pet > svg, .favorite-pet > svg { width: 100%; height: 100%; }
.theme-preview-options, .favorite-choices { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0; }
.theme-preview-options .btn { white-space: normal; flex: 1 1 95px; }
.favorite-pet { position: absolute; inset: 7% 10% 0; width: 80%; height: 93%; padding: 0; border: 0; background: none; z-index: 2; cursor: pointer; }
.favorite-pet:active { scale: .98; }
.favorite-name { margin-bottom: 6px; }
.garden-empty { position: relative; min-height: 260px; display: grid; place-content: center; text-align: center; padding: 24px; color: var(--ink); background: #fff7e4bb; }
.garden-empty .ui-icon { width: 44px; height: 44px; margin: auto; }
.garden-empty p { font-size: 13px; line-height: 1.8; }
.garden-card h3, .theme-preview-card h3 { font-size: 18px; margin: 0 0 10px; }
.recovery-label { display: block; font-size: 13px; margin: 16px 0 8px; }
.recovery-label input { display: block; width: 100%; min-height: 44px; margin-top: 7px; padding: 9px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--surface); box-sizing: border-box; }
.recovery-code { overflow-wrap: anywhere; user-select: all; padding: 12px; background: var(--surface-2); border-radius: 10px; font-family: monospace; }
[aria-pressed="true"].btn { box-shadow: inset 0 0 0 2px var(--accent); }
.favorite-scene .deco { z-index: 1; }
@media (prefers-reduced-motion: reduce) { .favorite-pet:active { scale: 1; } }

.garden-keepsake { display:flex; align-items:center; gap:8px; font-size:13px; }
.garden-keepsake .ui-icon { width:28px; height:28px; flex:none; }

/* The approved sprout uses continuous mesh deformation, not the old cutout rig. */
.living-screen { position: relative; display: block; width: 100%; height: 100%; }
.living-screen > img.living-fallback { position: absolute; left: 7.8125%; top: 7.8125%; display: block; width: 84.375%; height: 84.375%; max-width: none; object-fit: contain; pointer-events: none; }
.living-screen > .living-fallback[data-living-quality="thumbnail"], .living-screen > .living-fallback[data-living-quality="missing"] { inset: 0; width: 100%; height: 100%; }
.living-screen > .living-overlay { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; pointer-events: none; }
.friends li > .living-screen { width: 56px; height: 56px; margin: 0 auto; }
.living-canvas { display:block; width:100%; height:100%; pointer-events:none; }
.living-canvas[hidden] { display:none; }
.living-creature[data-surface="ready"] .living-fallback { opacity:0; }
.stage .living-creature, .stage.is-poked .living-creature, .is-asleep .stage .living-creature { animation:none; transition:none; }
.stage:has(.living-creature) .mover { animation:none; }

/* The dex uses native thumbnails: no external SVG image/filter surfaces. */
.dex-portrait { position: relative; display: block; width: 100%; max-width: 76px; aspect-ratio: 1; flex: none; }
.dex-card .dex-portrait > img, .dex-detail .dex-portrait > img { display: block; width: 100%; height: 100%; max-width: none; object-fit: contain; }
.dex-card .dex-portrait > svg, .dex-detail .dex-portrait > svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; max-width: none; pointer-events: none; }
.dex-detail > .dex-portrait { width: 72px; height: 72px; }
.dex-portrait > img[data-dex-full] { box-sizing: border-box; padding: 7.8125%; }

/* 토스 배너 광고: 화면 맨 위 한 줄(정책상 상단·하단만). 게임 화면을 가리지 않게 흐름 안에 둔다. */
.ad-banner { min-height: 0; padding-top: env(safe-area-inset-top); }
.ad-banner[hidden] { display: none; }
.ad-btn { white-space: normal; }

/* 먹이 버튼: 키우는 성격 힌트와 별사탕 남은 개수 */
.act .food-trait { display: block; font-size: 10px; color: var(--muted); line-height: 1.2; }
.act .candy-count { font-weight: 700; color: var(--gold, #c99a2e); }
.food-hint { margin: 6px 2px 0; font-size: 11.5px; color: var(--muted); line-height: 1.45; }
