:root {
  --bg: #fffdf8;
  --card: #fffdf8;
  --ink: #3a2a28;
  --muted: #8a726c;
  --line: #f0ddd2;
  --accent: #8ecfff;
  --eat: #ffb38a;
  --play: #9ad7a8;
  --shadow: 0 16px 40px rgba(90, 50, 40, 0.12);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
}

body {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 16px;
}

.app {
  width: min(420px, 100%);
  background: var(--card);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 20px 20px 24px;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.owner {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

h1 {
  margin: 2px 0 0;
  font-size: 24px;
  letter-spacing: 0.04em;
}

.days {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.icon-btn,
.act {
  font: inherit;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}

.icon-btn {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  color: var(--ink);
}

.stage-wrap {
  position: relative;
  margin: 8px 0 4px;
  display: grid;
  place-items: center;
}

#mascot {
  width: min(320px, 86vw);
  height: auto;
  animation: idle 3.4s ease-in-out infinite;
}

.stage-wrap.react #mascot {
  animation: bounce 0.55s ease;
}

.speech {
  margin: 0 0 4px;
  min-height: 1.4em;
  text-align: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 8px 14px;
  font-size: 14px;
}

.status {
  display: grid;
  gap: 10px;
  margin: 8px 0 18px;
}

.bar {
  display: grid;
  grid-template-columns: 5.5em 1fr 2.4em;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}

.track {
  height: 12px;
  background: #f4e8df;
  border-radius: 999px;
  overflow: hidden;
}

.track i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #b9e4ff);
  transition: width 0.35s ease;
}

.bar:first-child .track i {
  background: linear-gradient(90deg, #ffb38a, #ffd19a);
}

.bar em {
  font-style: normal;
  text-align: right;
  color: var(--muted);
}

.birthday {
  margin: 4px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.act {
  border-radius: 18px;
  padding: 16px 12px;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  background: #f7efe8;
}

.act.eat {
  background: var(--eat);
}

.act.play {
  background: var(--play);
}

.act:disabled {
  opacity: 0.5;
  cursor: default;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(50, 30, 24, 0.28);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 10;
}

.modal.hidden {
  display: none;
}

.sheet {
  width: min(420px, 100%);
  background: var(--card);
  border-radius: 24px;
  padding: 22px 20px 18px;
  box-shadow: var(--shadow);
}

.sheet h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.hint {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 13px;
}

.field.hidden,
.preview.hidden {
  display: none;
}

input[type="text"] {
  font: inherit;
  font-size: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}

input[type="color"] {
  width: 100%;
  height: 48px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
}

.preview {
  width: 180px;
  height: auto;
  display: block;
  margin: 0 auto 12px;
}

.sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.sheet-actions .act {
  flex: 1;
}

@keyframes idle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes bounce {
  0% { transform: scale(1); }
  40% { transform: scale(1.08) translateY(-8px); }
  100% { transform: scale(1); }
}

@media (max-width: 380px) {
  h1 { font-size: 20px; }
  .act { font-size: 16px; }
}
