[hidden] { display: none !important; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #2b3a2e; overflow: hidden; font-family: system-ui, -apple-system, "Apple SD Gothic Neo", sans-serif; color: #3d3229; }
button { font: inherit; cursor: pointer; border: 0; border-radius: 10px; padding: 6px 12px; background: #ffd77a; color: #3d3229; font-weight: 700; box-shadow: 0 2px 0 #c9a24a; }
button:active { transform: translateY(2px); box-shadow: none; }
button:disabled { opacity: .45; cursor: default; }

/* 800x600 무대를 화면에 맞게 키우고 줄인다 (main.js fit) */
#stage { position: absolute; left: 50%; top: 50%; width: 800px; height: 600px; transform-origin: center; overflow: hidden; border-radius: 12px;
  background: #bfe6a8 url(img/bg-farm.webp) center / cover no-repeat; }

#top { position: absolute; inset: 0 0 auto; height: 52px; display: flex; align-items: center; gap: 14px; padding: 0 14px; background: #fff8e8e6; z-index: 5; }
#top .logo { font-size: 20px; color: #d9822b; }
#top .grow { flex: 1; }
#loginHint { position: absolute; top: 56px; left: 0; right: 0; margin: 0; text-align: center; font-size: 13px; color: #fff; text-shadow: 0 1px 2px #0008; z-index: 4; }

#farm { position: absolute; inset: 52px 0 0; }
#empty { position: absolute; left: 50%; top: 55%; transform: translate(-50%, -50%); background: #fff8e8; padding: 12px 18px; border-radius: 12px; }
.pet { position: absolute; width: 120px; height: 120px; transition: left 2.5s ease-in-out, top 2.5s ease-in-out; cursor: pointer; text-align: center; }
.pet img, .pet .emoji { width: 100%; height: 100px; object-fit: contain; display: block; filter: drop-shadow(0 4px 2px #0003); }
.pet .emoji { font-size: 72px; line-height: 100px; }
.pet.s1 img, .pet.s1 .emoji { height: 78px; margin-top: 22px; }
.pet.s2 img, .pet.s2 .emoji { height: 96px; margin-top: 4px; }
.pet.s3 img, .pet.s3 .emoji { height: 116px; margin-top: -16px; }
.pet .tag { display: inline-block; font-size: 12px; background: #fff8e8; border-radius: 8px; padding: 1px 6px; }
.pet.sel .tag { background: #ffd77a; }
.pet.hungry .tag::after { content: " 🍽️"; }
.heart { position: absolute; pointer-events: none; animation: up 1s ease-out forwards; font-size: 22px; }
@keyframes up { to { transform: translateY(-50px); opacity: 0; } }

#panel { position: absolute; right: 10px; top: 62px; width: 240px; background: #fff8e8; border-radius: 14px; padding: 12px; z-index: 6; box-shadow: 0 4px 12px #0003; }
#panel h3 { margin: 0 0 2px; }
#panel .sub { font-size: 12px; color: #8a7b6b; margin-bottom: 8px; }
.bar { display: grid; grid-template-columns: 44px 1fr 42px; align-items: center; gap: 6px; font-size: 13px; margin: 4px 0; }
.bar i { display: block; height: 8px; border-radius: 4px; background: #eadfcb; overflow: hidden; }
.bar i b { display: block; height: 100%; background: #f2a65a; }
.bar span { text-align: right; }
#panel .acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
#panel .x { position: absolute; right: 8px; top: 6px; background: none; box-shadow: none; padding: 2px 6px; }

#modal { position: absolute; inset: 0; background: #0006; display: flex; align-items: center; justify-content: center; z-index: 10; }
#modal .box { background: #fff8e8; border-radius: 16px; padding: 18px; width: 640px; max-height: 520px; overflow: auto; }
#modal h2 { margin: 0 0 12px; }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.card { background: #fff; border-radius: 12px; padding: 8px; text-align: center; box-shadow: 0 2px 0 #e6d8bd; font-weight: 400; color: inherit; }
.card img, .card .emoji { width: 90px; height: 90px; object-fit: contain; display: block; margin: 0 auto; font-size: 60px; line-height: 90px; }
.el { font-size: 11px; border-radius: 6px; padding: 1px 5px; color: #fff; }
.el.earth { background: #a0784a; } .el.water { background: #4a8ccf; } .el.fire { background: #e0603a; }
.row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
input[type=text] { font: inherit; padding: 8px; border-radius: 8px; border: 2px solid #e6d8bd; width: 100%; }
.away li { margin: 4px 0; }
#panel h3 small { font-size: 12px; color: #8a7b6b; font-weight: 400; }
#panel .ending { width: 100%; margin-top: 8px; background: #c79bf2; box-shadow: 0 2px 0 #9a6cc8; color: #fff; }
.grow-pic img, .grow-pic .emoji { width: 180px; height: 180px; object-fit: contain; display: block; margin: 0 auto; font-size: 120px; text-align: center; }
.ending-pic img { width: 100%; max-height: 330px; object-fit: cover; border-radius: 12px; display: block; }
.ending-pic .emoji { font-size: 120px; text-align: center; }
.sub { font-size: 12px; color: #8a7b6b; }
.pet .worn { position: absolute; inset: 0 10px 20px; pointer-events: none; }
.pet .worn span { position: absolute; font-size: 26px; }
.pet .worn .w-0 { top: 0; left: 50%; transform: translateX(-50%); }
.pet .worn .w-1 { top: 50%; left: 50%; transform: translateX(-50%); }
.pet .worn .w-2 { bottom: 0; left: 30%; }
.pet .worn .w-3 { top: 35%; right: 0; }
.card.item .emoji { font-size: 44px; height: 56px; line-height: 56px; }
.card b { display: block; }
.card .limited { font-size: 11px; background: #e0603a; color: #fff; border-radius: 6px; padding: 0 5px; }
.card button { margin-top: 6px; padding: 3px 10px; }
button.ghost { background: #eee3cf; box-shadow: 0 2px 0 #cdbfa6; }
button.chip { padding: 1px 6px; font-size: 11px; margin: 2px; box-shadow: none; background: #f1e6d0; font-weight: 400; }
#top { gap: 6px; padding: 0 8px; white-space: nowrap; font-size: 14px; }
#top button { padding: 5px 8px; font-size: 14px; }
#top .logo { font-size: 17px; }
#say { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); background: #3d3229; color: #fff; padding: 10px 18px; border-radius: 20px; z-index: 20; font-size: 15px; white-space: nowrap; }
.place { position: relative; height: 170px; margin: -18px -18px 12px; border-radius: 16px 16px 0 0; background: center / cover; display: flex; align-items: flex-end; }
.place img { position: absolute; right: 12px; bottom: 0; height: 160px; filter: drop-shadow(0 3px 3px #0004); }
.place-title { background: linear-gradient(transparent, #0008); color: #fff; width: 100%; padding: 10px 18px; border-radius: 0; }
.place-title h2 { margin: 0; }
.place-title p { margin: 2px 160px 0 0; font-size: 13px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.sick { color: #d0453a; }
button.on { background: #f2a65a; color: #fff; box-shadow: 0 2px 0 #c97d33; }
.card.on { outline: 3px solid #f2a65a; }
.grid.small { grid-template-columns: repeat(6, 1fr); }
.grid.small .card { padding: 4px; font-size: 12px; }
img.icon { width: 56px; height: 56px; object-fit: contain; display: block; margin: 0 auto; }
.trips { background: #fff; border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; }
.trip { display: flex; align-items: center; gap: 10px; margin: 4px 0; }
#modal .box > b { display: block; margin-top: 8px; font-size: 13px; }
input[type=number] { font: inherit; padding: 6px; border-radius: 8px; border: 2px solid #e6d8bd; width: 160px; }
#deco { position: absolute; inset: 0; }
.deco { position: absolute; width: 60px; height: 60px; font-size: 48px; line-height: 60px; text-align: center; filter: drop-shadow(0 3px 2px #0003); user-select: none; }
.deco.big { width: 110px; height: 110px; font-size: 96px; line-height: 110px; }
.deco img.icon { width: 100%; height: 100%; }
#deco.editing .deco { cursor: grab; outline: 2px dashed #fff8; border-radius: 8px; touch-action: none; }
#deco.editing { z-index: 3; }
#decoBar { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 7; background: #fff8e8f0; border-radius: 14px; padding: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
#decoBar .ghost { padding: 2px 6px; }
#decoBar .emoji, #decoBar img.icon { font-size: 28px; width: 34px; height: 34px; line-height: 34px; }
.gamestage { position: relative; width: 600px; height: 380px; margin: 0 auto; background: #fff; border-radius: 12px; overflow: hidden; user-select: none; touch-action: none; }
.gamestage canvas { display: block; width: 600px; height: 340px; }
.gamestage .hud { height: 40px; line-height: 40px; text-align: center; font-weight: 700; background: #fff3dc; }
.mem { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; padding: 30px 12px; }
.mem button { font-size: 34px; height: 110px; padding: 0; }
.mem button.done { background: #d8f0c8; }
.moles { display: grid; grid-template-columns: repeat(3, 120px); gap: 12px; justify-content: center; padding-top: 14px; }
.moles button { font-size: 52px; height: 96px; }
.pads { display: grid; grid-template-columns: repeat(2, 150px); gap: 14px; justify-content: center; padding-top: 30px; }
.pad { height: 130px; opacity: .55; }
.pad.lit { opacity: 1; transform: scale(1.05); }
.slide { display: grid; grid-template-columns: repeat(3, 96px); gap: 6px; justify-content: center; padding-top: 24px; }
.slide button { height: 96px; font-size: 36px; }
.slide button.empty { visibility: hidden; }
.reflex { width: 100%; height: 100%; font-size: 28px; color: #fff; border-radius: 0; }
.result { padding: 30px; text-align: center; }
.result ol { text-align: left; display: inline-block; }
.battle { display: flex; gap: 16px; align-items: center; }
.battle img.monster, .battle .emoji { width: 200px; height: 200px; object-fit: contain; font-size: 140px; text-align: center; }
.mails { background: #fff; border-radius: 10px; padding: 6px 12px; }
.mail { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; border-bottom: 1px solid #f1e6d0; }
.letter { background: #fff; border-radius: 10px; padding: 8px 12px; margin: 6px 0; }
textarea, select { font: inherit; padding: 8px; border-radius: 8px; border: 2px solid #e6d8bd; width: 100%; margin: 6px 0; }
select { width: auto; }
.mini-farm { position: relative; height: 380px; border-radius: 12px; overflow: hidden; background: #bfe6a8 url(img/bg-farm.webp) center / cover; }
.mini-farm .pet { cursor: default; }
.card.unseen { opacity: .45; }
#quests { position: absolute; left: 8px; top: 60px; z-index: 4; width: 220px; background: #fff8e8e6; border-radius: 12px; padding: 6px 10px; font-size: 12px; box-shadow: 0 2px 6px #0002; }
#quests b { font-size: 12px; color: #d9822b; }
#quests ul { list-style: none; margin: 2px 0 6px; padding: 0; }
#quests li { margin: 2px 0; }
#quests li.done { color: #8a7b6b; text-decoration: line-through; }
/* ---------- 살아 있는 느낌 (문서 15장 15·16단계) ---------- */
.pet > img, .pet > .emoji { transform-origin: 50% 100%; animation: breathe 2.6s ease-in-out infinite; }
.pet.flip > img, .pet.flip > .emoji { scale: -1 1; }
.pet.walk > img, .pet.walk > .emoji { animation: bounce .4s ease-in-out infinite; }
.pet.hop { animation: hop .45s ease-out; }
.pet.squish > img, .pet.squish > .emoji { animation: squish .35s ease-out; }
.pet.sleep > img, .pet.sleep > .emoji { animation: breathe 4s ease-in-out infinite; filter: brightness(.85) drop-shadow(0 4px 2px #0003); }
.pet.sleep::after { content: "💤"; position: absolute; right: 6px; top: 0; font-size: 22px; animation: zz 2s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.02, .98); } }
@keyframes bounce { 50% { transform: translateY(-6px); } }
@keyframes hop { 30% { transform: translateY(-26px); } 60% { transform: translateY(0); } 75% { transform: translateY(-8px); } }
@keyframes squish { 30% { transform: scale(1.12, .85); } 60% { transform: scale(.95, 1.06); } }
@keyframes zz { 50% { transform: translate(4px, -6px); opacity: .6; } }
.bubble { position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); background: #fff; border-radius: 12px; padding: 4px 10px; font-size: 13px; white-space: nowrap; box-shadow: 0 2px 4px #0002; animation: pop .25s ease-out; z-index: 2; }
.bubble::after { content: ""; position: absolute; left: 50%; top: 100%; margin-left: -6px; border: 6px solid transparent; border-top-color: #fff; }
@keyframes pop { from { transform: translateX(-50%) scale(.3); opacity: 0; } }
/* 밤낮: 하늘 위에 색을 겹친다 */
#stage::before { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1; transition: background 2s; }
#stage[data-phase=dawn]::before { background: #ffb0c033; }
#stage[data-phase=dusk]::before { background: #ff8a3a40; }
#stage[data-phase=night]::before { background: #0b1a4a80; }
#ambient { position: absolute; inset: 52px 0 0; pointer-events: none; z-index: 2; overflow: hidden; }
.cloud { position: absolute; font-size: 60px; opacity: .85; animation: drift 90s linear infinite; }
.cloud.c1 { top: 10px; } .cloud.c2 { top: 50px; font-size: 44px; animation-duration: 140s; animation-delay: -60s; }
@keyframes drift { from { left: -80px; } to { left: 820px; } }
.star { position: absolute; color: #fff8c0; font-size: 12px; animation: twinkle 2s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: .2; } }
.fly { position: absolute; font-size: 22px; animation: flutter 14s ease-in-out infinite; left: 0; top: 200px; }
.firefly { font-size: 14px; }
@keyframes flutter { 0% { transform: translate(100px, 120px); } 25% { transform: translate(300px, 40px) rotate(10deg); } 50% { transform: translate(520px, 160px); } 75% { transform: translate(680px, 60px) rotate(-10deg); } 100% { transform: translate(100px, 120px); } }
.confetti { position: absolute; inset: 0; pointer-events: none; z-index: 30; overflow: hidden; }
.confetti span { position: absolute; top: -30px; font-size: 26px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(660px) rotate(360deg); } }
/* 마을 지도 (문서 15장 16단계) */
.village-map { position: relative; height: 450px; margin: -18px -18px 0; border-radius: 16px 16px 0 0; background: center / cover; }
.map-title { position: absolute; left: 0; right: 0; top: 0; padding: 10px 16px; background: linear-gradient(#0008, transparent); color: #fff; border-radius: 16px 16px 0 0; }
.map-title h2 { margin: 0; text-shadow: 0 1px 3px #0008; }
.map-title p { margin: 2px 0 0; font-size: 12px; }
.sign { position: absolute; transform: translate(-50%, -50%); padding: 4px 10px 5px; background: #c98a4f; color: #fff; border-radius: 8px; box-shadow: 0 3px 0 #8a5a2b, 0 6px 8px #0004; border-top: 3px solid var(--c); white-space: nowrap; display: flex; align-items: center; gap: 4px; font-size: 13px; }
.sign::after { content: ""; position: absolute; left: 50%; top: 100%; width: 6px; height: 12px; margin-left: -3px; background: #8a5a2b; }
.sign span { font-size: 18px; }
.sign b { text-shadow: 0 1px 1px #0006; }
.sign:hover { transform: translate(-50%, -56%); }
.area-pop { position: absolute; transform: translateX(-50%); background: #fff8e8; border-radius: 12px; padding: 8px; box-shadow: 0 6px 16px #0005; display: flex; gap: 6px; align-items: center; z-index: 3; }
.area-pop.up { transform: translate(-50%, -100%); }
.area-pop > b { font-size: 12px; white-space: nowrap; margin-right: 4px; }
.area-pop .place-btn { width: 84px; padding: 4px; }
.area-pop .place-btn .emoji { font-size: 26px; width: auto; height: 32px; line-height: 32px; }
.area-pop .place-btn b { font-size: 12px; }
.pet .worn span img.icon, .pet .worn span .emoji { width: 30px; height: 30px; font-size: 24px; line-height: 30px; }
.card.item img.icon { width: 56px; height: 56px; }
