html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #FFF6E9;
  font-family: sans-serif;
  color: #4A3B34;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  background: #FFF6E9;
}

#header {
  flex: 0 0 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
  padding: 0 16px;
  box-sizing: border-box;
}

#btn-history {
  min-height: 44px;
  min-width: 44px;
  border-radius: 10px;
  border: 2px solid #4A3B34;
  background: #FFF6E9;
  color: #4A3B34;
  font-size: 12px;
}

#btn-fast-forward {
  margin-top: 8px;
  min-height: 44px;
  min-width: 44px;
  border-radius: 10px;
  border: 1px solid #4A3B34;
  background: #FFF6E9;
  color: #4A3B34;
  font-size: 12px;
}

#header[hidden],
#character-area[hidden],
#bond-row[hidden],
.care-row[hidden],
#btn-fast-forward[hidden] {
  display: none;
}

#record-view,
#history-view {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px;
  box-sizing: border-box;
}

#record-view[hidden],
#history-view[hidden] {
  display: none;
}

#history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  width: 100%;
  text-align: center;
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  box-sizing: border-box;
}

#history-list li {
  background: #FFF6E9;
  color: #4A3B34;
  border: 2px solid #4A3B34;
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 10px;
  box-sizing: border-box;
}

#btn-history-back {
  flex: 0 0 auto;
  min-height: 44px;
  min-width: 44px;
  border-radius: 10px;
  border: 2px solid #4A3B34;
  background: #FFF6E9;
  color: #4A3B34;
  font-size: 14px;
}

#record-card {
  background: #FFF6E9;
  color: #4A3B34;
  border: 2px solid #4A3B34;
  border-radius: 10px;
  padding: 16px;
  box-sizing: border-box;
}

#character-area {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

#character-area svg {
  max-width: 100%;
  max-height: 100%;
  transition: opacity 150ms ease-out;
}

.character.growth-egg .posture {
  animation: egg-idle 2.4s ease-in-out infinite;
}

@keyframes egg-idle {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(4deg); }
}

#name-form {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 0 16px 16px;
}

#name-form[hidden] {
  display: none;
}

#name-input {
  flex: 1;
  min-height: 44px;
  border-radius: 12px;
  border: 2px solid #4A3B34;
  background: #FFF6E9;
  color: #4A3B34;
  font-size: 16px;
  padding: 0 12px;
  box-sizing: border-box;
}

#name-confirm {
  min-width: 72px;
  min-height: 44px;
  border-radius: 12px;
  border: 2px solid #4A3B34;
  background: #7BD3B0;
  color: #4A3B34;
  font-size: 16px;
  font-weight: bold;
}

#btn-new-egg {
  min-width: 72px;
  min-height: 44px;
  border-radius: 12px;
  border: 2px solid #4A3B34;
  background: #7BD3B0;
  color: #4A3B34;
  font-size: 16px;
  font-weight: bold;
}

#footer {
  flex: 0 0 180px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 8px 16px 16px;
  box-sizing: border-box;
}

.bond-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
}

.bond-row .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #FFF6E9;
  border: 2px solid #4A3B34;
}

.bond-row .dot.filled {
  background: #7BD3B0;
}

.bond-row .dot.pop {
  animation: dot-pop 0.3s ease-out;
}

@keyframes dot-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.5); }
  100% { transform: scale(1); }
}

.care-row {
  display: flex;
  gap: 10px;
}

.care-btn {
  flex: 1;
  min-height: 52px;
  min-width: 44px;
  border-radius: 12px;
  border: 2px solid #4A3B34;
  background: #FFB4A2;
  color: #4A3B34;
  font-size: 16px;
  font-weight: bold;
}

.care-btn.urge {
  background: #F2994A;
}

.care-btn.tapped {
  animation: btn-tap 0.6s ease-out;
}

@keyframes btn-tap {
  0% { transform: scale(1); }
  30% { transform: scale(0.92); }
  100% { transform: scale(1); }
}

.care-btn.rejected {
  animation: btn-shake 0.6s ease-out;
}

@keyframes btn-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.character.rejecting .posture {
  animation: rejecting-tilt 0.6s ease-out;
}

@keyframes rejecting-tilt {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(10deg); }
  75% { transform: rotate(-10deg); }
}

.character.reacting-feed .posture {
  animation: reacting-feed 0.6s ease-out;
}

@keyframes reacting-feed {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(1.15); }
}

.character.reacting-play .posture {
  animation: reacting-play 0.6s ease-out;
}

@keyframes reacting-play {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}

.character.reacting-sleep .posture {
  animation: reacting-sleep 0.6s ease-out;
}

@keyframes reacting-sleep {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(0.85); }
}

.character.demo-left .posture {
  transform: translateX(-16px) rotate(-5deg);
  transition: transform 0.3s ease-in-out;
}

.character.demo-right .posture {
  transform: translateX(16px) rotate(5deg);
  transition: transform 0.3s ease-in-out;
}

.character.reacting-play-miss .posture {
  animation: reacting-play-miss 0.3s ease-out 1;
}

@keyframes reacting-play-miss {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
