/* Tama Gosi — interfaz */
:root {
  --bg: #FFF4EC;
  --bg2: #FFE3EC;
  --bg3: #E3F2FF;
  --card: #FFFFFF;
  --ink: #5A3E36;
  --muted: #A08679;
  --pink: #FF8FAB;
  --track: #F3E6DE;
  --green: #6FCF97;
  --yellow: #FFC94D;
  --red: #FF6B6B;
  --shadow: 0 6px 0 rgba(90, 62, 54, .10), 0 10px 24px rgba(90, 62, 54, .08);
  --press: 0 2px 0 rgba(90, 62, 54, .12);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #211A24; --bg2: #3A2433; --bg3: #1E2B3C; --card: #2E2533; --ink: #F6E7DD; --muted: #BFA9A0;
    --track: #45394B; --shadow: 0 6px 0 rgba(0, 0, 0, .25), 0 10px 24px rgba(0, 0, 0, .2); --press: 0 2px 0 rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  font-family: 'Fredoka', ui-rounded, system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, var(--bg2), transparent 42%),
    radial-gradient(circle at 100% 100%, var(--bg3), transparent 45%),
    var(--bg);
  -webkit-tap-highlight-color: transparent;
}

.app { width: 100%; max-width: 520px; padding: 14px 16px 28px; }

/* Cabecera */
.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.title { display: flex; align-items: center; gap: 6px; font-size: 30px; font-weight: 700; min-width: 0; }
.paw { display: inline-block; animation: paw 3s ease-in-out infinite; }
@keyframes paw { 50% { transform: rotate(-12deg) scale(1.08); } }
#name {
  font: inherit; color: inherit; width: 9ch; min-width: 0;
  border: none; border-bottom: 2px dashed transparent; background: transparent; outline: none;
}
#name:focus { border-bottom-color: var(--pink); }
.meta { display: flex; align-items: center; gap: 8px; }
.pill { padding: 4px 10px; border-radius: 99px; background: var(--card); color: var(--muted); font-weight: 600; font-size: 14px; box-shadow: var(--press); white-space: nowrap; }
.icon-btn {
  border: none; background: var(--card); color: inherit; border-radius: 14px; padding: 6px 10px;
  font-size: 18px; box-shadow: var(--shadow); cursor: pointer;
}
.mood { margin: 6px 2px 10px; font-weight: 600; color: var(--muted); min-height: 1.3em; }

/* Estadísticas en anillos */
.stats {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px;
  background: var(--card); border-radius: 22px; padding: 10px 8px 8px; box-shadow: var(--shadow);
}
.stat { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.stat svg { width: 46px; height: 46px; transform: rotate(-90deg); }
.stat circle { fill: none; stroke-width: 5; }
.stat .track { stroke: var(--track); }
.stat .val { stroke: var(--green); stroke-linecap: round; transition: stroke-dashoffset .6s ease, stroke .4s; }
.stat.mid .val { stroke: var(--yellow); }
.stat.low .val { stroke: var(--red); }
.stat .ico { position: absolute; top: 11px; font-size: 19px; line-height: 1; }
.stat.low .ico { animation: pulse 1s ease-in-out infinite; }
.stat .lbl { font-size: 11px; font-weight: 600; color: var(--muted); }
@keyframes pulse { 50% { transform: scale(1.25); } }

/* Escenario */
.stage {
  position: relative; margin: 12px 0; aspect-ratio: 360 / 290; overflow: hidden;
  border: 4px solid var(--card); border-radius: 28px; box-shadow: var(--shadow);
  user-select: none; -webkit-user-select: none; touch-action: none; cursor: pointer;
  background: #BFE3FF;
}
#scene { display: block; width: 100%; height: 100%; }
.star { animation: twinkle 3s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: .25; } }
.sway { transform-box: fill-box; transform-origin: 50% 100%; animation: sway 3.2s ease-in-out infinite; }
@keyframes sway { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(5deg); } }
.stink { animation: stink 1.8s ease-in-out infinite; }
@keyframes stink { 0% { transform: translateY(0); opacity: .9; } 100% { transform: translateY(-6px); opacity: .2; } }

.bubble {
  position: absolute; z-index: 3; max-width: 70%;
  padding: 6px 12px; border-radius: 16px; background: #fff; color: #5A3E36;
  box-shadow: 0 4px 0 rgba(90, 62, 54, .12); font-weight: 600; font-size: 15px; text-align: center;
  pointer-events: none; opacity: 0; transform: translate(-50%, -90%) scale(.6);
  transition: opacity .2s, transform .25s cubic-bezier(.3, 1.6, .5, 1);
}
.bubble::after {
  content: ''; position: absolute; left: 50%; bottom: -7px; margin-left: -7px;
  border: 7px solid transparent; border-bottom: 0; border-top-color: #fff;
}
.bubble.show { opacity: 1; transform: translate(-50%, -100%) scale(1); }

.hint {
  position: absolute; top: 10px; left: 50%; z-index: 4; max-width: 92%;
  padding: 6px 14px; border-radius: 99px; background: rgba(255, 255, 255, .94); color: #5A3E36;
  font-weight: 600; font-size: 14px; text-align: center; white-space: nowrap;
  opacity: 0; transform: translate(-50%, -8px); transition: opacity .3s, transform .3s; pointer-events: none;
}
.hint.show { opacity: 1; transform: translate(-50%, 0); }

.fade {
  position: absolute; inset: 0; z-index: 5; background: #FFF4EC;
  opacity: 0; transition: opacity .4s ease; pointer-events: none;
}
.fade.on { opacity: 1; }

/* Botones */
.actions { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 64px; padding: 8px 4px; border: none; border-radius: 18px; background: var(--card); color: var(--ink);
  font: inherit; font-weight: 600; font-size: 13px; box-shadow: var(--shadow); cursor: pointer;
  transition: transform .1s, box-shadow .1s, background .2s;
}
.btn .e { font-size: 26px; line-height: 1.1; transition: transform .2s; }
.btn:hover .e { transform: scale(1.12) rotate(-6deg); }
.btn:active { transform: translateY(4px); box-shadow: var(--press); }
.btn.on { background: #FFE3EC; color: #5A3E36; }
body.busy .actions .btn, body.busy .submenu .btn { opacity: .5; }
.submenu {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin: 0 -2px;
  scrollbar-width: none; min-height: 0;
}
.submenu::-webkit-scrollbar { display: none; }
.submenu .btn {
  flex: 0 0 auto; flex-direction: row; gap: 6px; min-height: 0; padding: 9px 14px; font-size: 14px;
  animation: pop .22s ease-out backwards;
}
.submenu .btn .e { font-size: 20px; }
.submenu .btn:nth-child(2) { animation-delay: .03s; }
.submenu .btn:nth-child(3) { animation-delay: .06s; }
.submenu .btn:nth-child(4) { animation-delay: .09s; }
.submenu .btn:nth-child(n+5) { animation-delay: .12s; }
.submenu .btn small { color: var(--muted); font-weight: 500; }
@keyframes pop { from { transform: scale(.7) translateY(6px); opacity: 0; } }

.tip { margin-top: 16px; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.5; }

@media (max-width: 430px) {
  .app { padding: 10px 12px 24px; }
  .title { font-size: 26px; }
  .stats { padding: 8px 4px 6px; }
  .stat svg { width: 40px; height: 40px; }
  .stat .ico { top: 9px; font-size: 17px; }
  .stat .lbl { font-size: 10px; }
  .actions { grid-template-columns: repeat(3, 1fr); }
}
