:root {
  color-scheme: light;
  --ink: #3c2a22;
  --muted: #8a6d5c;
  --paper: rgba(255, 248, 241, 0.9);
  --line: rgba(90, 58, 38, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  color: var(--ink);
  background: #f3e2cf;
}

.room {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #f6ead8;
}

.room-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 62%;
}

.stage {
  position: absolute;
  left: 50%;
  bottom: 16%;
  width: clamp(200px, 28vw, 420px);
  transform: translateX(-50%) scale(var(--cat-scale, 0.78));
  transform-origin: center bottom;
  filter: drop-shadow(0 18px 12px rgba(92, 58, 24, 0.18));
}

.bubble {
  margin: 0 auto 6px;
  width: fit-content;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 252, 248, 0.94);
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.02em;
  box-shadow: 0 8px 20px rgba(70, 42, 18, 0.12);
}

.stage img {
  display: block;
  width: 100%;
  height: auto;
  transform-origin: center bottom;
  user-select: none;
  -webkit-user-drag: none;
}

.stage[data-pose="sit"] img,
.stage[data-pose="sulk"] img,
.stage[data-pose="sleep"] img {
  animation: breathe 3.6s ease-in-out infinite;
}

.stage[data-pose="sleep"] img { animation-duration: 5.2s; }
.stage[data-pose="eat"] img { animation: nom 0.7s ease-in-out infinite; }
.stage[data-pose="play"] img { animation: hop 0.55s ease-in-out infinite; }
.stage[data-pose="groom"] img { animation: lick 0.95s ease-in-out infinite; }

@keyframes breathe {
  0%, 100% { transform: translateY(0) scale(1, 1); }
  50% { transform: translateY(4px) scale(1.012, 0.988); }
}

@keyframes nom {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(10px) rotate(-3deg); }
}

@keyframes hop {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-16px); }
}

@keyframes lick {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(3deg); }
}

.panel {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 2;
  width: min(340px, calc(100vw - 28px));
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 18px 18px 14px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 0 18px 50px rgba(78, 48, 22, 0.16);
  backdrop-filter: blur(12px);
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
}

h1 {
  margin: 2px 0 0;
  font-size: 32px;
  letter-spacing: -0.04em;
}

h1 small {
  margin-left: 4px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.age {
  margin: 2px 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.stats { display: grid; gap: 9px; }

.stat label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  font-size: 13px;
}

.stat b { font-variant-numeric: tabular-nums; }

.track {
  height: 9px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(90, 58, 38, 0.08);
}

.track span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
}

.hunger { background: #ef8a45; }
.mood { background: #e3b23c; }
.clean { background: #79b4d8; }

.who {
  display: grid;
  gap: 6px;
  margin: 16px 0 12px;
  font-size: 13px;
}

.who input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  font: inherit;
}

.actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.actions button {
  padding: 11px 12px;
  border: 0;
  border-radius: 12px;
  background: #3c2a22;
  color: #fff8f2;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.actions button:disabled {
  background: #e6d8cc;
  color: #9a8476;
  cursor: default;
}

.note {
  min-height: 1.3em;
  margin: 12px 0 8px;
  color: var(--muted);
  font-size: 13px;
}

.log {
  margin: 0;
  padding: 0;
  list-style: none;
}

.log li {
  padding: 7px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.log b { font-weight: 700; }

@media (max-width: 800px) {
  .room { height: 54svh; position: relative; }
  .room-bg { position: absolute; inset: 0; }
  .stage { bottom: 4%; width: min(62vw, 260px); }
  .panel {
    position: relative;
    top: auto;
    right: auto;
    width: auto;
    max-height: none;
    margin-top: -16px;
    border-radius: 22px 22px 0 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stage img { animation: none; }
}
