:root { --bg: #161d1b; --card: #1f2926; --card2: #27332f; --line: #33433e; --text: #eef3ef; --muted: #93a59f; --accent: #8fd9b6; --pink: #ff8fab; font-family: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", system-ui, sans-serif; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; }
button { font: inherit; color: inherit; background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 6px 14px; cursor: pointer; }
.muted { color: var(--muted); } .small { font-size: 12px; } .hidden { display: none !important; }
header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; max-width: 1100px; margin: 0 auto; flex-wrap: wrap; }
h1 { margin: 0; font-size: 24px; letter-spacing: .2px; }
#sub { font-size: 13px; margin-top: 2px; }
nav { display: flex; gap: 6px; }
nav button.on { background: #2f4a40; border-color: #4a7363; }
.tab { display: none; max-width: 1100px; margin: 0 auto; padding: 0 20px 40px; }
.tab.on { display: block; }

/* ---------- scene ---------- */
.scene { position: relative; height: 420px; border-radius: 22px; overflow: hidden; border: 1px solid var(--line); user-select: none; }
.sky { position: absolute; inset: 0; background: var(--sky, linear-gradient(#8fd3f4, #d4f1ff)); transition: background 3s; }
.stars { position: absolute; inset: 0 0 40% 0; opacity: 0; transition: opacity 3s; }
.stars i { position: absolute; width: 2px; height: 2px; background: #fff; border-radius: 50%; animation: tw 3s infinite; }
@keyframes tw { 50% { opacity: .3; } }
.night .stars { opacity: 1; }
.sunmoon { position: absolute; width: 54px; height: 54px; border-radius: 50%; top: 34px; right: 12%; background: #ffe27a; box-shadow: 0 0 40px #ffe27a99; transition: all 3s; }
.night .sunmoon { background: #f1f1e6; box-shadow: 0 0 30px #ffffff55, inset -14px -6px 0 #d8d8c8; }
.hill { position: absolute; border-radius: 50%; }
.h1 { left: -10%; right: 40%; bottom: 60px; height: 170px; background: var(--hill1, #7cc68a); }
.h2 { left: 35%; right: -15%; bottom: 52px; height: 140px; background: var(--hill2, #6ab87a); }
.ground { position: absolute; left: 0; right: 0; bottom: 0; height: 92px; background: var(--ground, linear-gradient(#5aa964, #4c9156)); }
.night .hill, .night .ground { filter: brightness(.45) saturate(.7); }
.dusk .hill, .dusk .ground { filter: brightness(.75) saturate(.9) sepia(.15); }
.nest { position: absolute; left: 5%; bottom: 26px; width: 150px; height: 70px; }
.nestbowl { position: absolute; left: 0; right: 0; bottom: 0; height: 34px; border-radius: 0 0 80px 80px / 0 0 40px 40px; background: repeating-linear-gradient(160deg, #a77b4b 0 5px, #8b6238 5px 9px); box-shadow: inset 0 6px 0 #6e4b28; }
.eggs { position: absolute; left: 0; right: 0; bottom: 14px; display: flex; justify-content: center; gap: 2px; z-index: 1; }
.eggs svg { width: 46px; height: 58px; animation: wob 3s ease-in-out infinite; transform-origin: 50% 90%; }
.eggs svg:nth-child(2) { animation-delay: -1s; } .eggs svg:nth-child(3) { animation-delay: -2s; }
.eggs.big svg { width: 76px; height: 96px; }
@keyframes wob { 0%, 70%, 100% { transform: rotate(0); } 78% { transform: rotate(-7deg); } 86% { transform: rotate(6deg); } 93% { transform: rotate(-3deg); } }
.bowl { position: absolute; right: 7%; bottom: 30px; width: 62px; height: 24px; background: #d65f5f; border-radius: 4px 4px 30px 30px; box-shadow: inset 0 4px 0 #b44a4a; }
.bowl i { position: absolute; left: 8px; right: 8px; top: -7px; height: 12px; border-radius: 50%; background: radial-gradient(circle at 30% 50%, #ffb347 0 4px, transparent 5px), radial-gradient(circle at 60% 40%, #9be15d 0 4px, transparent 5px), radial-gradient(circle at 80% 60%, #ff6f61 0 4px, transparent 5px); }
.ball { position: absolute; left: 60%; bottom: 30px; width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff 0 3px, #ff7aa2 4px 100%); box-shadow: inset -4px -4px 0 #d9567f; transition: left 1.2s cubic-bezier(.3,.7,.4,1), bottom .6s; }
.ball.hop { animation: hop .6s ease-out; }

.petBox { position: absolute; bottom: 14px; left: 40%; width: 270px; height: 252px; margin-left: -135px; transition: left var(--walk, 3s) linear; z-index: 2; }
.petFlip { width: 100%; height: 100%; transition: transform .3s; }
.petFlip.left { transform: scaleX(-1); }
.petArt, .petArt svg { width: 100%; height: 100%; display: block; overflow: visible; }
.pet .eye { animation: blink 5s infinite; transform-box: fill-box; transform-origin: center; }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
.pet .wing { animation: flap 1.6s ease-in-out infinite; } .pet .wing:first-child { animation-direction: reverse; }
@keyframes flap { 50% { transform: rotate(-8deg); } }
.pet .spark { animation: spark 2s infinite; } @keyframes spark { 50% { opacity: 0; } }
.pet .bulb { animation: spark 3s infinite; }
.act-sit .petArt, .act-sulk .petArt { animation: breathe 3.4s ease-in-out infinite; transform-origin: 50% 100%; }
.act-sleep .petArt { animation: breathe 5s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes breathe { 50% { transform: scale(1.025, .975); } }
.walking .petArt { animation: bob .45s ease-in-out infinite; }
.walking .leg0 { animation: step .45s infinite; } .walking .leg1 { animation: step .45s infinite reverse; }
@keyframes bob { 50% { transform: translateY(-5px); } }
@keyframes step { 50% { transform: translateY(-5px); } }
.act-play .petArt.jump { animation: hop .6s ease-out; transform-origin: 50% 100%; }
@keyframes hop { 0% { transform: translateY(0) scale(1.05, .92); } 40% { transform: translateY(-46px) scale(.96, 1.05); } 80% { transform: translateY(0) scale(1.06, .92); } 100% { transform: none; } }
.act-eat .petArt { animation: nibble .5s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes nibble { 50% { transform: rotate(3deg) translateY(4px); } }
.legless.walking .petArt { animation: hop .7s ease-in-out infinite; }
.old .petArt { animation-duration: 6s; }
.bubble { position: absolute; left: 62%; top: -8px; background: #fff; color: #333; border-radius: 14px; padding: 3px 9px; font-size: 18px; box-shadow: 0 3px 10px #0003; white-space: nowrap; }
.bubble::after { content: ""; position: absolute; left: 10px; bottom: -6px; border: 6px solid transparent; border-top-color: #fff; border-bottom: 0; }
.zzz { position: absolute; font-size: 16px; z-index: 3; font-weight: 700; color: #fff; text-shadow: 0 1px 4px #0006; pointer-events: none; }
.zzz span { position: absolute; animation: zz 3s infinite; opacity: 0; }
.zzz span:nth-child(2) { animation-delay: 1s; font-size: 20px; } .zzz span:nth-child(3) { animation-delay: 2s; font-size: 26px; }
@keyframes zz { 0% { opacity: 0; transform: translate(0, 0); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(28px, -60px); } }
.cloud { position: absolute; z-index: 3; font-size: 34px; animation: rain 2s ease-in-out infinite; pointer-events: none; }
@keyframes rain { 50% { transform: translateY(-4px); } }
.sceneMsg { position: absolute; left: 50%; top: 22px; transform: translateX(-50%); background: #000a; color: #fff; padding: 8px 14px; border-radius: 12px; font-size: 15px; text-align: center; z-index: 4; max-width: 90%; }

/* ---------- info ---------- */
.cols { display: grid; grid-template-columns: 1fr 1.15fr; gap: 16px; margin-top: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px; }
.nameRow { display: flex; align-items: center; gap: 10px; }
h2 { margin: 0; font-size: 26px; }
h3 { margin: 0 0 10px; font-size: 16px; }
.pill { font-size: 12px; padding: 3px 10px; border-radius: 99px; background: #2f4a40; color: var(--accent); }
#pMeta { margin-top: 3px; font-size: 14px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.chip { font-size: 12px; padding: 3px 10px; border-radius: 99px; background: var(--card2); }
.chip.new { background: #4d3a1e; color: #ffcf7a; }
.looks { font-size: 14px; line-height: 1.5; margin: 12px 0; }
.bars { display: grid; gap: 7px; }
.bar { display: grid; grid-template-columns: 56px 1fr 92px; align-items: center; gap: 10px; font-size: 13px; }
.bar div { height: 9px; background: #121816; border-radius: 9px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 9px; background: #b7a6ff; transition: width 1s; }
.bar i.food { background: #ffb36b; } .bar i.energy { background: #7fd0ff; } .bar i.fun { background: var(--pink); }
.bar small { color: var(--muted); text-align: right; }
#pSkills { font-size: 13px; }
#pSkills b { display: block; margin: 10px 0 4px; font-size: 13px; }
.diary { display: flex; flex-direction: column; gap: 6px; max-height: 430px; overflow: auto; padding-right: 4px; }
.d { padding: 8px 11px; border-radius: 12px; background: var(--card2); font-size: 14px; line-height: 1.4; }
.d small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.d.big { border-left: 3px solid var(--accent); } .d.new { border-left: 3px solid #ffcf7a; } .d.skill { border-left: 3px solid #b7a6ff; }
.d.old { opacity: .6; }

/* ---------- tree ---------- */
.treeIntro { max-width: 720px; line-height: 1.5; }
.tree { display: flex; flex-direction: column; align-items: flex-start; }
.genRow { display: flex; align-items: center; gap: 14px; position: relative; padding: 8px 0; }
.genRow + .genRow::before { content: ""; position: absolute; left: 49px; top: -10px; height: 22px; border-left: 3px dotted #4a6158; }
.heir { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 8px 16px 8px 8px; cursor: pointer; min-width: 300px; }
.heir:hover, .sib:hover { border-color: #5a8a77; }
.heir.now { border-color: var(--accent); box-shadow: 0 0 0 3px #8fd9b622; }
.portrait { width: 84px; height: 80px; flex: none; background: radial-gradient(circle at 50% 70%, #2c3a35, #222c29); border-radius: 12px; }
.portrait svg { width: 100%; height: 100%; }
.heir .t b { font-size: 16px; } .heir .t div { font-size: 12px; color: var(--muted); margin-top: 2px; }
.heir .chips { margin-top: 5px; }
.sibs { display: flex; gap: 8px; flex-wrap: wrap; }
.sib { width: 72px; text-align: center; font-size: 11px; color: var(--muted); cursor: pointer; border: 1px solid transparent; border-radius: 12px; padding: 4px; }
.sib .portrait { width: 62px; height: 58px; margin: 0 auto 2px; opacity: .75; }
.waitEggs { display: flex; gap: 6px; align-items: center; margin-top: 10px; color: var(--muted); font-size: 13px; }
.waitEggs svg { width: 34px; height: 42px; }

.modal { position: fixed; inset: 0; background: #000b; display: grid; place-items: center; z-index: 10; padding: 16px; }
.modal .box { width: min(560px, 100%); max-height: 90vh; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 20px; position: relative; }
.modal .x { position: absolute; right: 14px; top: 14px; }
.modal .bigPic { width: 220px; height: 200px; margin: 0 auto; background: radial-gradient(circle at 50% 70%, #2c3a35, #1f2926); border-radius: 18px; }
.modal .bigPic svg { width: 100%; height: 100%; }
.modal h2 { text-align: center; margin-top: 10px; }
.modal .sub { text-align: center; color: var(--muted); font-size: 14px; }
.modal .diary { max-height: 260px; margin-top: 12px; }

@media (max-width: 760px) {
  header { padding: 12px 14px; } .tab { padding: 0 12px 30px; }
  .scene { height: 300px; }
  .petBox { width: 160px; height: 150px; margin-left: -80px; }
  .nest { width: 110px; } .eggs svg { width: 36px; height: 46px; }
  .cols { grid-template-columns: 1fr; }
  .heir { min-width: 0; }
  .genRow { flex-direction: column; align-items: flex-start; }
  .genRow + .genRow::before { left: 40px; }
}
