:root {
  color-scheme: light;
  font-family: "Atkinson Hyperlegible Next", "Noto Sans TC", system-ui, sans-serif;
  color: #263d32;
  background: #f8f4ea;
  --green: #245640;
  --line: #ded9ca;
}
* { box-sizing: border-box; }
body { margin: 0; }
.site-header { max-width: 960px; margin: auto; padding: 22px 20px 14px; }
.brand { color: var(--green); font-size: 1.05rem; font-weight: 800; text-decoration: none; }
.brand span { color: #8a531d; margin-right: 4px; }
main {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 16px;
  max-width: 960px;
  padding: 10px 20px 40px;
  margin: auto;
}
.habitat, .care, .animals { border: 1px solid var(--line); border-radius: 24px; background: #fffdf7; padding: 24px; min-width: 0; }
.habitat { padding-bottom: 16px; }
.pet-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); overflow-wrap: anywhere; }
h2 { font-size: 1.22rem; margin-bottom: 18px; }
.stage { font-size: .875rem; color: #506557; margin-bottom: 5px; }
.scene { isolation: isolate; position: relative; display: grid; place-items: center; overflow: hidden; min-height: 245px; border-radius: 16px; background: linear-gradient(#dceee2 65%, #c7dcb2 65%); }
.sun { position: absolute; top: 22px; right: 30px; background: #ffe4a0; width: 60px; height: 60px; border-radius: 50%; }
.hill { position: absolute; border-radius: 55% 55% 0 0; bottom: -25px; height: 42%; width: 75%; background: #aecda3; z-index: -1; }
.hill-left { left: -25%; }
.hill-right { right: -12%; bottom: -45px; background: #bdd7a9; }
.portrait { position: relative; font-size: clamp(80px, 16vw, 118px); line-height: 1.4; filter: drop-shadow(0 10px 9px #2e614c33); }
.portrait[data-species="capybara"] { width: 142px; height: 93px; background: #a66e49; border-radius: 44% 49% 32% 36%; box-shadow: -19px 18px 0 -10px #774b35, 26px 18px 0 -9px #774b35; }
.portrait[data-species="capybara"]::before { content: ""; position: absolute; left: 79px; top: 4px; width: 76px; height: 59px; border-radius: 43% 55% 48% 31%; background: radial-gradient(circle at 44% 36%, #32271d 3px, transparent 4px), radial-gradient(circle at 87% 50%, #624333 4px, transparent 5px), #bb8158; box-shadow: -14px -18px 0 -22px #754e37, -10px -24px 0 -20px #754e37; }
.portrait[data-species="capybara"]::after { content: "🍊"; position: absolute; top: -46px; right: 14px; font-size: 30px; transform: rotate(12deg); }
.portrait.bounce { animation: bounce 420ms ease-out; }
@keyframes bounce { 45% { transform: translateY(-20px) rotate(-6deg); } }
.message { min-height: 3em; padding-top: 11px; color: #415e4f; }
.meters { display: grid; gap: 15px; margin-bottom: 24px; }
.meters label { display: block; font-weight: 650; }
.meters span { float: right; font-variant-numeric: tabular-nums; color: #506557; }
meter { display: block; width: 100%; height: 19px; accent-color: #4d835f; }
meter::-webkit-meter-optimum-value { background: #60916c; }
.actions, .animal-list { display: grid; gap: 8px; }
.actions { grid-template-columns: repeat(3, 1fr); }
.animal-list { grid-template-columns: repeat(4, 1fr); }
.animals { grid-column: 1 / -1; }
button { min-height: 44px; padding: 9px 12px; border: 1px solid transparent; border-radius: 12px; background: var(--green); color: #fff; font: inherit; font-weight: 650; cursor: pointer; }
button:hover { filter: brightness(.93); }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #a96523; outline-offset: 3px; }
.quiet, .animal-list button { background: #f4f0e4; color: #263d32; border-color: var(--line); }
.animal-list button[aria-pressed="true"] { background: #e1eddd; border-color: #518365; box-shadow: inset 0 0 0 1px #518365; }
.actions span, .animal-list span { display: block; font-size: 1.35rem; margin-bottom: 3px; }
.save-note { color: #506557; font-size: .875rem; margin-top: 14px; }
dialog { width: min(420px, calc(100% - 32px)); padding: 24px; border: 1px solid var(--line); border-radius: 20px; background: #fffdf7; color: inherit; }
dialog::backdrop { background: #20362e66; }
input { display: block; width: 100%; margin: 6px 0 14px; padding: 10px; font: inherit; border: 1px solid #8a9a8d; border-radius: 8px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
@media (max-width: 680px) { main { grid-template-columns: 1fr; } .habitat, .care, .animals { padding: 17px; } .scene { min-height: 200px; } }
@media (max-width: 380px) { .animal-list { grid-template-columns: repeat(2, 1fr); } }
@media (prefers-reduced-motion: reduce) { .portrait.bounce { animation: none; } }
