:root {
  --bg: #09111f;
  --text: #f7fbff;
  --muted: #aab8cf;
  --accent: #72d6ff;
  --green: #8af0b2;
  --pink: #ffc8d6;
  --blueBtn: #243f75;
  --disabled: rgba(255,255,255,.055);
  --shadow: 0 18px 45px rgba(0,0,0,.35);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  min-height: 100svh;
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 30% 0%, rgba(68,128,255,.32), transparent 22rem),
    radial-gradient(circle at 90% 85%, rgba(255,75,200,.25), transparent 20rem),
    var(--bg);
  overflow: hidden;
}

.app {
  width: min(520px, 100%);
  height: 100svh;
  margin: 0 auto;
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.01));
}

.app-header {
  padding: max(18px, env(safe-area-inset-top)) 18px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(34px, 9vw, 48px); margin-bottom: 3px; letter-spacing: -.04em; }
p { color: var(--muted); line-height: 1.25; }

button, input, select { font: inherit; }

button {
  border: 0;
  color: var(--text);
  background: var(--blueBtn);
  border-radius: 22px;
  font-weight: 900;
  padding: 15px 16px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}

button:active { transform: scale(.97); }
button:disabled { opacity: .45; background: var(--disabled); cursor: not-allowed; }

.icon-btn {
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 18px;
  background: rgba(255,255,255,.1);
  font-size: 22px;
}

.screen-root { overflow: hidden; position: relative; }

.screen {
  height: 100%;
  padding: 0 18px 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: pop .18s ease-out;
  padding-bottom: 98px;
  scroll-behavior: smooth;
}

@keyframes pop { from { opacity: .3; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.card {
  background: linear-gradient(180deg, rgba(255,255,255,.105), rgba(255,255,255,.045));
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 28px;
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.hero-pet {
  min-height: 390px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  position: relative;
  background:
    radial-gradient(circle at 50% 80%, rgba(138,240,178,.27), transparent 11rem),
    linear-gradient(180deg, rgba(61,99,166,.68), rgba(21,35,61,.95));
}

.speech {
  background: rgba(255,255,255,.94);
  color: #142036;
  border-radius: 25px;
  padding: 15px 17px;
  font-weight: 900;
  font-size: 18px;
  z-index: 3;
}

.pet-stage { display: grid; place-items: center; position: relative; }
.pet-stage::after {
  content: "";
  position: absolute;
  bottom: 24px;
  width: 150%;
  height: 95px;
  background: rgba(138,240,178,.2);
  border-radius: 50%;
}

.pet-sprite {
  z-index: 2;
  font-size: 124px;
  filter: drop-shadow(0 26px 22px rgba(0,0,0,.38));
  animation: idle 1.65s infinite ease-in-out;
}

@keyframes idle {
  0%,100% { transform: translateY(0) rotate(-1deg) scale(1); }
  50% { transform: translateY(-13px) rotate(1deg) scale(1.04); }
}

.pet-title { z-index: 2; }
.pet-title h2 { font-size: 36px; margin-bottom: 4px; }

.quick-actions, .egg-grid, .food-grid, .toy-grid, .split-buttons, .mode-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.action-btn { min-height: 76px; font-size: 20px; }

.stat-list { display: grid; gap: 17px; }
.stat-row { display: grid; gap: 8px; font-size: 18px; font-weight: 800; }
.statbar, .xp-track { height: 14px; border-radius: 999px; overflow: hidden; background: rgba(255,255,255,.15); }
.statbar div, .xp-fill {
  height: 100%;
  width: 50%;
  background: linear-gradient(90deg, var(--green), var(--accent));
  border-radius: inherit;
  transition: width .2s ease;
}

.pet-grid { display: grid; gap: 14px; }

.pet-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
}

.pet-card-icon {
  width: 76px;
  height: 76px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  font-size: 44px;
  background: rgba(255,255,255,.1);
}

.badge {
  display: inline-block;
  background: rgba(114,214,255,.16);
  border: 1px solid rgba(114,214,255,.2);
  color: #dcf7ff;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
}

input, select {
  width: 100%;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.08);
  color: var(--text);
  border-radius: 20px;
  padding: 16px;
  outline: none;
  font-weight: 700;
}

select option { color: #111827; }

.choice {
  min-height: 128px;
  display: grid;
  place-items: center;
  gap: 6px;
  background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.12);
}
.choice strong { display: block; font-size: 18px; }
.choice .emoji { font-size: 54px; }
.choice.selected { outline: 3px solid rgba(114,214,255,.55); background: rgba(114,214,255,.15); }

.mini-list { padding-left: 20px; color: var(--muted); font-size: 17px; }
.mini-list li { margin: 10px 0; }

.bottom-nav {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: max(10px, env(safe-area-inset-bottom));
  height: 76px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  padding: 8px;
  background: rgba(12,22,39,.82);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 27px;
  box-shadow: 0 20px 50px rgba(0,0,0,.42);
  backdrop-filter: blur(16px);
  z-index: 20;
}

.nav-btn {
  position: relative;
  padding: 6px 2px;
  border-radius: 20px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  gap: 1px;
  font-size: 23px;
}

.nav-btn span { font-size: 11px; font-weight: 900; }
.nav-btn.active { background: linear-gradient(180deg, rgba(114,214,255,.25), rgba(138,240,178,.15)); color: var(--text); }

.nav-badge {
  position: absolute;
  top: 5px;
  right: 8px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: none;
  place-items: center;
  border-radius: 999px;
  background: #fb7185;
  color: white;
  font-size: 11px;
  line-height: 18px;
  font-weight: 1000;
}
.nav-badge.show { display: grid; }

.empty { text-align: center; padding: 35px 20px; }
.big-btn { width: 100%; min-height: 62px; }
.back-btn { margin-bottom: 12px; background: rgba(255,255,255,.1); }
.danger-btn { background: rgba(251,113,133,.18); color: #ffe4e9; border: 1px solid rgba(251,113,133,.25); }
.success-btn { background: rgba(138,240,178,.17); color: #eafff1; border: 1px solid rgba(138,240,178,.25); }
.notice { background: rgba(255,200,214,.12); border: 1px solid rgba(255,200,214,.2); border-radius: 20px; padding: 14px; color: #ffe4ec; font-weight: 800; }

@media (min-width: 850px) {
  body { overflow: auto; }
  .app {
    margin-top: 24px;
    margin-bottom: 24px;
    height: min(900px, calc(100vh - 48px));
    border-radius: 34px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.12);
    box-shadow: var(--shadow);
  }
}


/* v10: in-game meldingen en actie-animaties */
.modal-root {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(2, 8, 20, .72);
  backdrop-filter: blur(10px);
  z-index: 80;
  animation: fadeIn .18s ease-out;
}

.modal-root.hidden {
  display: none;
}

.game-modal {
  width: min(430px, 100%);
  border-radius: 32px;
  padding: 22px;
  background:
    radial-gradient(circle at 30% 0%, rgba(114,214,255,.25), transparent 14rem),
    linear-gradient(180deg, rgba(34,52,86,.98), rgba(16,25,44,.98));
  border: 1px solid rgba(255,255,255,.16);
  box-shadow: 0 28px 80px rgba(0,0,0,.55);
  animation: modalPop .22s ease-out;
}

.modal-icon {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border-radius: 26px;
  background: rgba(255,255,255,.1);
  font-size: 44px;
  margin-bottom: 12px;
}

.game-modal h2 {
  font-size: 28px;
  margin-bottom: 8px;
}

.game-modal p {
  font-size: 18px;
  margin-bottom: 18px;
}

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

.toast-root {
  position: absolute;
  top: max(84px, calc(env(safe-area-inset-top) + 72px));
  left: 18px;
  right: 18px;
  z-index: 70;
  display: grid;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: rgba(17, 30, 52, .92);
  border: 1px solid rgba(255,255,255,.14);
  color: var(--text);
  border-radius: 22px;
  padding: 13px 15px;
  box-shadow: 0 20px 45px rgba(0,0,0,.35);
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 900;
  animation: toastIn .22s ease-out;
}

.toast-icon {
  font-size: 26px;
}

.action-stage {
  min-height: 300px;
  margin-bottom: 16px;
}

.action-scene {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 300px;
}

.action-visual {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  justify-items: center;
  min-height: 190px;
}

.action-pet {
  font-size: 105px;
  filter: drop-shadow(0 22px 20px rgba(0,0,0,.38));
  animation: idle 1.65s infinite ease-in-out;
}

.action-item {
  font-size: 58px;
  opacity: .9;
  animation: floatItem 1.4s infinite ease-in-out;
}

.action-pet.eating {
  animation: eatAnim .75s ease-in-out 2;
}

.action-pet.playing {
  animation: playAnim .75s ease-in-out 2;
}

.action-pet.washing {
  animation: washAnim .75s ease-in-out 2;
}

.action-pet.sleeping {
  animation: sleepAnim 1.2s ease-in-out 2;
}

.pet-sprite.wiggle {
  animation: eggWiggle .65s ease-in-out 3;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalPop {
  from { opacity: .2; transform: translateY(16px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-8px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes floatItem {
  0%,100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-12px) rotate(5deg); }
}

@keyframes eatAnim {
  0%,100% { transform: translateX(0) scale(1); }
  35% { transform: translateX(14px) scale(1.06); }
  65% { transform: translateX(6px) scale(.98); }
}

@keyframes playAnim {
  0%,100% { transform: translateY(0) rotate(0deg) scale(1); }
  25% { transform: translateY(-18px) rotate(-8deg) scale(1.06); }
  60% { transform: translateY(4px) rotate(8deg) scale(1.02); }
}

@keyframes washAnim {
  0%,100% { transform: rotate(0deg) scale(1); filter: drop-shadow(0 22px 20px rgba(0,0,0,.38)); }
  50% { transform: rotate(6deg) scale(1.05); filter: drop-shadow(0 22px 20px rgba(114,214,255,.42)); }
}

@keyframes sleepAnim {
  0%,100% { transform: translateY(0) scale(1); opacity: 1; }
  50% { transform: translateY(6px) scale(.96); opacity: .82; }
}

@keyframes eggWiggle {
  0%,100% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(-8deg) scale(1.04); }
  75% { transform: rotate(8deg) scale(1.04); }
}

.shop-grid, .inventory-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
