/* Virtual Pet — estilos.
   Concepto: un cuarto-terrario de juguete. Interfaz de "botones de juguete" con borde de tinta
   y sombra sólida, sobre papel tibio. Un solo look a propósito (el cuarto cambia de día/noche). */
@font-face { font-family: 'Grandstander'; font-weight: 800; font-display: swap; src: url('../fonts/grandstander-latin-800-normal.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 600; font-display: swap; src: url('../fonts/nunito-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 800; font-display: swap; src: url('../fonts/nunito-latin-800-normal.woff2') format('woff2'); }

:root {
  /* color */
  --ink: #2a1f3d;
  --ink-soft: #6b5f80;
  --paper: #fff9ef;
  --card: #ffffff;
  --line: #e8dcc8;
  --plum: #5b3fa8;
  --plum-d: #3f2a7c;
  --yolk: #ffc93c;
  --yolk-d: #d99a1a;
  --berry: #ff4f6d;
  --mint: #22b07d;
  --m-food: #ff8a3d;
  --m-energy: #5b7cff;
  --m-fun: #ff5d9e;
  --m-hygiene: #20b5a8;
  --m-health: #ef3f57;
  /* tipo */
  --f-display: 'Grandstander', 'Trebuchet MS', 'Comic Sans MS', sans-serif;
  --f-body: 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --r: 1.125rem;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
/* La página entera nunca se desplaza (sólo las listas de adentro): "clip" impide que el foco o el teclado la corran. */
html, body { overflow: hidden; overflow: clip; }
body { font-family: var(--f-body); font-weight: 600; color: var(--ink); background: var(--paper); -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--plum); outline-offset: 2px; }
.ic { width: 1.25em; height: 1.25em; flex: none; }
.ic.flipx { transform: scaleX(-1); }
[hidden] { display: none !important; }
.coin-ic { display: inline-flex; width: 1.15em; height: 1.15em; vertical-align: -0.2em; margin-left: .15em; }
.coin-ic svg { width: 100%; height: 100%; }

/* ---------- botones de juguete ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35em;
  border: 2px solid var(--ink); border-radius: 0.875rem; background: var(--card);
  padding: .5em .9em; font-weight: 800; box-shadow: 0 3px 0 var(--ink);
  transition: transform .06s, box-shadow .06s; white-space: nowrap;
}
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.btn.primary { background: var(--yolk); }
.btn.ghost { background: transparent; box-shadow: none; border-style: dashed; }
.btn.big { font-size: 1.1rem; padding: .7em 1.2em; width: 100%; }
.btn:disabled { opacity: .45; box-shadow: 0 3px 0 var(--ink); }
.row { display: flex; gap: 0.625rem; flex-wrap: wrap; }
.row > .btn { flex: 1; }

/* ---------- panel (compartido) ---------- */
.hud { display: flex; align-items: center; justify-content: space-between; gap: 0.625rem; }
.who { display: flex; align-items: baseline; gap: 0.5rem; min-width: 0; flex-wrap: wrap; }
.pname { font-family: var(--f-display); font-weight: 800; font-size: 1.45rem; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 11ch; }
.chip { font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.coins { display: inline-flex; align-items: center; gap: 0.375rem; border: 2px solid var(--ink); background: #fff3c4; border-radius: 62.4375rem; padding: 0.25rem 0.75rem 0.25rem 0.375rem; font-weight: 800; box-shadow: 0 2px 0 var(--ink); font-variant-numeric: tabular-nums; }
.coins .coin-ic { width: 1.5em; height: 1.5em; margin: 0; }

.meters { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.5rem; }
.meter { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 0.25rem; min-width: 0; }
.meter .mi { display: grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 0.5rem; color: #fff; }
.meter .mi .ic { width: 1rem; height: 1rem; }
.meter .ml { grid-column: 1 / 3; text-align: center; font-size: .68rem; font-weight: 800; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.bar { display: block; height: 0.5625rem; border-radius: 0.5625rem; background: #efe6d8; overflow: hidden; border: 1.5px solid rgba(42, 31, 61, .18); }
.bar i { display: block; height: 100%; width: 100%; border-radius: inherit; transform: translateX(-100%); transition: transform .6s ease; }
.m-food .mi, .m-food .bar i { background: var(--m-food); }
.m-energy .mi, .m-energy .bar i { background: var(--m-energy); }
.m-fun .mi, .m-fun .bar i { background: var(--m-fun); }
.m-hygiene .mi, .m-hygiene .bar i { background: var(--m-hygiene); }
.m-health .mi, .m-health .bar i { background: var(--m-health); }
.meter.low.ping .mi { animation: pulse 1s ease-in-out 3; }
.meter.low .ml { color: var(--berry); }
@keyframes pulse { 50% { transform: scale(1.12); } }

.eggbar { display: grid; gap: 0.5rem; }
.eggrow { display: grid; grid-template-columns: 7.5em 1fr; align-items: center; font-weight: 800; font-size: .85rem; }
.eggrow .bar { height: 0.75rem; }
.bar.warmth i { background: linear-gradient(90deg, #ffb347, #ff6a3d); }
.bar.hatch i { background: var(--plum); }

.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; }
.act {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  border: 2px solid var(--ink); border-radius: 1rem; background: var(--card); padding: 0.5rem 2px 0.375rem;
  box-shadow: 0 3px 0 var(--ink); transition: transform .06s, box-shadow .06s;
}
.act:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.act .ai { display: grid; place-items: center; width: 2.125rem; height: 2.125rem; border-radius: 0.75rem; background: #f3ecff; color: var(--plum); }
.act .ai .ic { width: 1.375rem; height: 1.375rem; }
.act .al { font-size: .78rem; font-weight: 800; }
.act.dim { opacity: .5; }
.act-food .ai { background: #ffeadb; color: #d9601c; }
.act-play .ai { background: #ffe3ef; color: #d6337a; }
.act-bath .ai { background: #dcf6f3; color: #138a80; }
.act-clean .ai { background: #f1ead9; color: #7a5530; }
.act-sleep .ai { background: #e4e8ff; color: #3d55d6; }
.act-med .ai { background: #ffe1e5; color: #d32a45; }
.act-shop .ai { background: #fff1c4; color: #a86d00; }
.act-warm .ai { background: #ffe3cf; color: #e2531f; }
.badge { position: absolute; top: -7px; right: -5px; min-width: 1.375rem; height: 1.375rem; padding: 0 0.3125rem; border-radius: 0.6875rem; background: var(--berry); color: #fff; font-size: .75rem; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--ink); }
.actions.egg-actions { grid-template-columns: 2fr 1fr 1fr; }
.act.big { flex-direction: row; justify-content: center; gap: 0.625rem; font-size: 1.05rem; }
.act.big .al { font-size: 1rem; }

/* ---------- listas / tienda ---------- */
.list { display: grid; gap: 0.625rem; }
.list h4, .more h4 { margin: 0.5rem 0 0; font-family: var(--f-display); font-size: 1.05rem; display: flex; align-items: center; gap: 0.5rem; }
.item { display: grid; grid-template-columns: 3.25rem 1fr auto; gap: 0.625rem; align-items: center; background: var(--card); border: 2px solid var(--line); border-radius: 1rem; padding: 0.5rem 0.625rem; }
.item-art { width: 3.25rem; height: 3.25rem; display: grid; place-items: center; background: #fbf4e6; border-radius: 0.75rem; }
.item-art svg { width: 2.5rem; height: 2.5rem; }
.item-txt { display: grid; min-width: 0; }
.item-txt small { color: var(--ink-soft); font-size: .8rem; }
.item-txt .qty { font-size: .75rem; font-weight: 800; color: var(--plum); }
.note { margin: 0; font-size: .9rem; color: var(--ink-soft); }
.note.warn { color: var(--berry); font-weight: 800; }

.more { display: grid; gap: 1.125rem; }
.more section { display: grid; gap: 0.625rem; }
.rename { display: flex; gap: 0.5rem; }
.rename input, .field input { flex: 1; min-width: 0; font: inherit; font-weight: 800; font-size: 1rem; padding: .6em .8em; border: 2px solid var(--ink); border-radius: 0.75rem; background: #fff; color: var(--ink); }
.toggle { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; background: var(--card); border: 2px solid var(--line); border-radius: 0.875rem; padding: 0.625rem 0.75rem; cursor: pointer; }
/* El casillero real queda invisible ENCIMA del interruptor (adentro de la etiqueta). Antes quedaba suelto y, al
   tocarlo, el navegador corría toda la página para mostrarlo: en Windows desaparecían la mascota y el panel. */
.toggle input { position: absolute; right: 0.75rem; top: 50%; width: 2.875rem; height: 1.625rem; margin: -0.8125rem 0 0; opacity: 0; pointer-events: none; }
.toggle i { flex: none; width: 2.875rem; height: 1.625rem; border-radius: 0.8125rem; background: #d9cfe6; position: relative; border: 2px solid var(--ink); transition: background .15s; }
.toggle i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 1.125rem; height: 1.125rem; border-radius: 50%; background: #fff; border: 2px solid var(--ink); transition: transform .15s; }
.toggle input:checked + i { background: var(--mint); }
.toggle input:checked + i::after { transform: translateX(1.25rem); }
.toggle input:focus-visible + i { outline: 3px solid var(--plum); outline-offset: 2px; }
.memo { margin: 0; padding-left: 1.1em; display: grid; gap: 0.25rem; }
.memo small { color: var(--ink-soft); }
.help p { margin: 0 0 .6em; line-height: 1.45; max-width: 60ch; }

/* ---------- juegos ---------- */
.games { display: grid; gap: 0.75rem; }
.game-card { display: grid; grid-template-columns: 4rem 1fr; grid-template-rows: auto auto; column-gap: 0.75rem; text-align: left; align-items: center; background: var(--card); border: 2px solid var(--ink); border-radius: 1.125rem; padding: 0.75rem; box-shadow: 0 3px 0 var(--ink); }
.game-card .gc-art { grid-row: 1 / 3; width: 4rem; height: 4rem; display: grid; place-items: center; grid-auto-flow: column; background: #fff3c4; border-radius: 0.875rem; color: var(--plum); }
.game-card .gc-art svg { width: 2.5rem; height: 2.5rem; }
.game-card .gc-art .ic { width: 1.625rem; height: 1.625rem; }
.game-card b { font-family: var(--f-display); font-size: 1.1rem; }
.game-card small { color: var(--ink-soft); }
.game-host { display: grid; }
.g-top { display: flex; justify-content: space-between; font-weight: 800; margin-bottom: 0.5rem; font-variant-numeric: tabular-nums; }
.g-canvas { width: 100%; max-width: 23.75rem; aspect-ratio: 360 / 420; margin: 0 auto; display: block; border: 2px solid var(--ink); border-radius: 1rem; cursor: none; }
.g-canvas.g-jump { cursor: pointer; }
.g-hint { text-align: center; color: var(--ink-soft); font-size: .85rem; margin: 0.375rem 0 0; }
.g-guess { display: grid; gap: 0.5rem; text-align: center; }
.gg-pet { width: min(13.75rem, 60vw); aspect-ratio: 240 / 200; margin: 0 auto; }
.gg-pet svg, .go-pet svg, .cel-pet svg { width: 100%; height: 100%; }
.gg-msg { font-family: var(--f-display); font-size: 1.15rem; margin: 0; min-height: 1.5em; }
.game-over { text-align: center; display: grid; gap: 0.375rem; }
.game-over h3 { font-family: var(--f-display); font-size: 1.6rem; margin: 0; }
.game-over p { margin: 0; }
.game-over .won { font-weight: 800; color: var(--plum); }
.go-pet { width: 11.25rem; aspect-ratio: 240 / 200; margin: 0 auto; }

/* ---------- ventanas ---------- */
.modal { display: grid; gap: 0.75rem; text-align: center; }
.modal h2 { font-family: var(--f-display); font-weight: 800; font-size: 1.6rem; line-height: 1.15; margin: 0; text-wrap: balance; }
.modal .sub { margin: 0; color: var(--ink-soft); line-height: 1.4; text-wrap: balance; }
.eggs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; }
@media (max-width: 480px) { .mode-room .eggs { grid-template-columns: repeat(2, 1fr); } .mode-room .egg-pick .ep-art { max-width: 90px; } }
.egg-pick { display: grid; justify-items: center; gap: 2px; background: var(--card); border: 2px solid var(--line); border-radius: 1.125rem; padding: 0.5rem 0.25rem 0.625rem; transition: transform .12s, border-color .12s; }
.egg-pick .ep-art { width: 100%; max-width: 6.875rem; aspect-ratio: 240 / 200; }
.egg-pick .ep-art svg { width: 100%; height: 100%; }
.egg-pick b { font-family: var(--f-display); font-size: 1.1rem; }
.egg-pick small { font-size: .72rem; color: var(--ink-soft); line-height: 1.2; }
.egg-pick.on { border-color: var(--ink); background: #fff3c4; transform: translateY(-3px); box-shadow: 0 3px 0 var(--ink); }
.field { display: grid; gap: 0.375rem; text-align: left; font-weight: 800; }
.err { color: var(--berry); margin: 0; font-weight: 800; }
.big-ic { display: grid; place-items: center; width: 4.5rem; height: 4.5rem; margin: 0 auto; border-radius: 1.375rem; background: #fff3c4; color: var(--plum); border: 2px solid var(--ink); }
.big-ic .ic { width: 2.5rem; height: 2.5rem; }
.prize { font-family: var(--f-display); font-size: 2.3rem; margin: 0; display: flex; justify-content: center; align-items: center; gap: 0.25rem; }
.prize.small { font-size: 1.4rem; }
.bonus { margin: 0; font-weight: 800; color: var(--mint); }
.streak { display: flex; justify-content: center; gap: 0.375rem; }
.streak .dot { width: 1.875rem; height: 1.875rem; display: grid; place-items: center; border-radius: 50%; border: 2px solid var(--ink); font-size: .8rem; font-weight: 800; background: #fff; }
.streak .dot.on { background: var(--yolk); }
.grave { width: 9.375rem; margin: 0 auto; }
.countdown { font-family: var(--f-display); font-size: 2.4rem; margin: 0; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.cel-pet { width: 13.125rem; max-width: 70%; aspect-ratio: 240 / 200; margin: 0 auto; }
.news { text-align: left; margin: 0; padding-left: 1.2em; display: grid; gap: 0.25rem; }
.news .need { color: var(--berry); font-weight: 800; }

/* ---------- efectos ---------- */
.fx { position: absolute; transform: translate(-50%, -50%); pointer-events: none; z-index: 5; }
.fx-heart { color: var(--berry); width: 1.875rem; animation: fx-up 1.4s ease-out both; }
.fx-heart .ic { width: 1.875rem; height: 1.875rem; fill: var(--berry); }
.fx-star { color: var(--yolk-d); width: 1.625rem; animation: fx-up 1.4s ease-out both; }
.fx-star .ic { width: 1.625rem; height: 1.625rem; fill: var(--yolk); }
.fx-warm { color: #ff6a3d; animation: fx-up 1.1s ease-out both; }
.fx-warm .ic { width: 2.125rem; height: 2.125rem; fill: #ffb347; }
.fx-food { width: 2.875rem; height: 2.875rem; animation: fx-eat 2s ease-in both; }
.fx-food svg { width: 100%; height: 100%; }
.fx-bubble { width: 1.375rem; height: 1.375rem; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #fff, rgba(190, 240, 255, .5) 60%, rgba(120, 210, 255, .35)); border: 1.5px solid rgba(255, 255, 255, .9); animation: fx-bub 1.6s ease-out both; }
.fx-coins { font-family: var(--f-display); font-size: 1.4rem; color: var(--yolk-d); white-space: nowrap; animation: fx-up 1.6s ease-out both; }
@keyframes fx-up { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.6); } 20% { opacity: 1; transform: translate(-50%, -60%) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -260%) scale(.9); } }
@keyframes fx-eat { 0% { opacity: 0; transform: translate(-50%, -150%) scale(.8); } 15% { opacity: 1; transform: translate(-50%, -60%) scale(1); } 85% { opacity: 1; transform: translate(-50%, -40%) scale(.55); } 100% { opacity: 0; transform: translate(-50%, -40%) scale(.2); } }
@keyframes fx-bub { 0% { opacity: 0; transform: translate(-50%, 0) scale(.3); } 25% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -140px) scale(1.2); } }

.bubble {
  position: absolute; bottom: calc(100% - 0.25rem); left: 50%; transform: translateX(-50%);
  background: #fff; border: 2px solid var(--ink); border-radius: 1rem; padding: 0.375rem 0.75rem; font-weight: 800; font-size: .95rem;
  white-space: nowrap; max-width: 80vw; box-shadow: 0 3px 0 var(--ink); z-index: 6; pointer-events: none;
}
.bubble::after { content: ''; position: absolute; left: 50%; bottom: -9px; width: 0.875rem; height: 0.875rem; background: #fff; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: translateX(-50%) rotate(45deg); }
.bubble.warn { background: #fff0f2; }
.bubble.warn::after { background: #fff0f2; }
.bubble.pop { animation: pop .25s ease-out; }
@keyframes pop { 0% { transform: translateX(-50%) scale(.6); } 80% { transform: translateX(-50%) scale(1.05); } 100% { transform: translateX(-50%) scale(1); } }

/* =================================================================
   MODO CUARTO
   ================================================================= */
body.mode-room { background: #2a1f3d; overflow: hidden; }
.mode-room #app { height: 100%; }
/* el alto lo mide room.js (--app-h): es lo que de verdad se ve, sin la barra de botones de Android */
body.mode-room, .mode-room #app { height: var(--app-h, 100%); }
.room-app { height: 100%; max-width: 35rem; margin: 0 auto; display: flex; flex-direction: column; background: var(--paper); position: relative; }
.scene { position: relative; flex: 1 1 auto; min-height: 9.375rem; overflow: hidden; --floor: 30%; }
.wall { position: absolute; top: 0; right: 0; bottom: var(--floor); left: 0; background:
  radial-gradient(circle at 0.75rem 0.75rem, rgba(255, 255, 255, .45) 2.5px, transparent 3px) 0 0 / 2.125rem 2.125rem,
  linear-gradient(#bfe6d3, #d6f0e2); transition: filter .6s; }
.floor { position: absolute; left: 0; right: 0; bottom: 0; height: var(--floor); background:
  repeating-linear-gradient(90deg, rgba(0, 0, 0, .06) 0 2px, transparent 2px 4rem),
  linear-gradient(#e7bb84, #d9a466); border-top: 0.375rem solid #b9874f; }
.rug { position: absolute; left: 50%; bottom: 5%; width: 64%; height: 13%; transform: translateX(-50%); border-radius: 50%; background: repeating-radial-gradient(ellipse at center, #ff8fa0 0 0.625rem, #ffc0c9 0.625rem 1.25rem); opacity: .85; }
.window { position: absolute; top: 9%; left: 7%; width: 30%; max-width: 9.375rem; aspect-ratio: 1 / 1.05; border: 0.4375rem solid #fff; border-radius: 50% 50% 0.875rem 0.875rem; overflow: hidden; box-shadow: 0 0 0 3px #b9874f; }
.window .sill { position: absolute; left: -7px; right: -7px; bottom: -7px; height: 0.5rem; background: #b9874f; }
.sky { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: linear-gradient(#5fc0ff, #bfe9ff); transition: background .8s; }
.sky::before, .sky::after { content: ''; position: absolute; background: #fff; z-index: 2; }
.sky::before { left: 50%; top: 0; bottom: 0; width: 0.3125rem; transform: translateX(-50%); }
.sky::after { top: 52%; left: 0; right: 0; height: 0.3125rem; }
.sun { position: absolute; width: 34%; aspect-ratio: 1; border-radius: 50%; background: #ffd23f; box-shadow: 0 0 1.25rem #ffe58a; top: 18%; right: 14%; transition: opacity .6s; }
.moon { position: absolute; width: 26%; aspect-ratio: 1; border-radius: 50%; top: 18%; right: 18%; box-shadow: -8px 0.25rem 0 0 #fff5c8; opacity: 0; transition: opacity .6s; }
.cloud { position: absolute; width: 42%; height: 14%; left: 10%; top: 62%; background: #fff; border-radius: 1.25rem; box-shadow: 0.625rem -8px 0 2px #fff; opacity: .9; }
.st { position: absolute; width: 0.25rem; height: 0.25rem; background: #fff; border-radius: 50%; opacity: 0; }
.st.s1 { left: 20%; top: 22%; } .st.s2 { left: 34%; top: 72%; } .st.s3 { left: 75%; top: 70%; }
.scene[data-sky="dusk"] .sky { background: linear-gradient(#ff8a5b, #ffd1a1); }
.scene[data-sky="dusk"] .sun { top: 56%; background: #ff6a3d; box-shadow: 0 0 1.25rem #ffb08a; }
.scene[data-sky="night"] .sky { background: linear-gradient(#141a46, #2d3a7a); }
.scene[data-sky="night"] .sun, .scene[data-sky="night"] .cloud { opacity: 0; }
.scene[data-sky="night"] .moon, .scene[data-sky="night"] .st { opacity: 1; }
.scene[data-sky="night"] .wall { filter: brightness(.82) saturate(.9); }
.frame { position: absolute; top: 14%; right: 9%; width: 18%; max-width: 5.375rem; aspect-ratio: 4 / 3; border: 0.3125rem solid #b9874f; background: #fff; border-radius: 0.375rem; }
.frame span { position: absolute; top: 14%; right: 14%; bottom: 14%; left: 14%; background: linear-gradient(160deg, #ffd23f 0 30%, transparent 30%), linear-gradient(#bfe8ff 60%, #9fd67a 60%); border-radius: 3px; }
.lamp { position: absolute; top: 0; left: 56%; width: 4rem; height: 30%; }
.lamp .cord { position: absolute; left: 50%; top: 0; width: 3px; height: 55%; background: var(--ink); transform: translateX(-50%); }
.lamp .shade { position: absolute; left: 50%; top: 55%; width: 3.75rem; height: 1.875rem; transform: translateX(-50%); background: var(--yolk); border: 3px solid var(--ink); border-radius: 1.875rem 1.875rem 0.375rem 0.375rem; }
.lamp .glow { position: absolute; left: 50%; top: calc(55% + 1.625rem); width: 1.625rem; height: 0.8125rem; transform: translateX(-50%); background: #fff7c2; border-radius: 0 0 0.8125rem 0.8125rem; box-shadow: 0 0.375rem 1.875rem 0.875rem rgba(255, 238, 160, .55); transition: opacity .5s; }
.dark { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: radial-gradient(ellipse at 50% 80%, rgba(20, 22, 60, .45), rgba(12, 14, 40, .78)); opacity: 0; pointer-events: none; transition: opacity .8s; z-index: 4; }
.scene.lights-off .dark { opacity: 1; }
.scene.lights-off .lamp .glow { opacity: 0; }
.nest { position: absolute; left: 50%; bottom: 7%; width: min(62%, 18.75rem); transform: translateX(-50%); z-index: 1; }
.nest svg { width: 100%; display: block; }
.petbox { position: absolute; bottom: 8%; left: 50%; width: min(60%, 18.125rem); aspect-ratio: 240 / 200; transform: translateX(-50%); z-index: 3; }
.scene.has-egg .petbox { bottom: 10%; width: min(50%, 15rem); }
.petsvg { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; border-radius: 30%; }
.petsvg svg { width: 100%; height: 100%; }
.petbox .bubble { z-index: 7; }
.poops { position: absolute; left: 0; right: 0; bottom: 6%; height: 0; z-index: 2; }
.poop { position: absolute; bottom: 0; width: 2.875rem; height: 2.5rem; padding: 0; border: 0; background: none; transform: translateX(-50%); }
.poop svg { width: 100%; height: 100%; }
/* el olorcito se anima desde js/room.js, al mismo ritmo que la mascota */
.fastbadge { position: absolute; top: 0.5rem; right: 0.5rem; z-index: 8; background: var(--berry); color: #fff; font-weight: 800; border-radius: 0.5rem; padding: 2px 0.5rem; display: none; }
body.fast .fastbadge { display: block; }

.panel { flex: none; display: grid; gap: 0.75rem; padding-block: 0.875rem 0.875rem; padding-left: max(1rem, env(safe-area-inset-left, 0px)); padding-right: max(1rem, env(safe-area-inset-right, 0px)); padding-bottom: max(0.875rem, env(safe-area-inset-bottom, 0px)); background: var(--paper); border-top: 3px solid var(--ink); border-radius: 1.375rem 1.375rem 0 0; margin-top: -18px; position: relative; z-index: 5; }
.room-app::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 0; }

.sheet-wrap { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 50; background: rgba(42, 31, 61, .45); display: flex; align-items: flex-end; justify-content: center; animation: fade .18s ease-out; }
.sheet { width: 100%; max-width: 35rem; max-height: min(86%, calc(100% - env(safe-area-inset-top, 0px) - 1.25rem)); display: flex; flex-direction: column; background: var(--paper); border: 3px solid var(--ink); border-bottom: 0; border-radius: 1.5rem 1.5rem 0 0; animation: slide-up .22s ease-out; }
.sheet header { position: relative; display: flex; align-items: center; justify-content: space-between; padding: 0.875rem max(1rem, env(safe-area-inset-right, 0px)) 0.375rem max(1rem, env(safe-area-inset-left, 0px)); }
.sheet h3 { font-family: var(--f-display); font-size: 1.35rem; margin: 0; }
.sheet .x { width: 2.5rem; height: 2.5rem; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 0.75rem; background: #fff; box-shadow: 0 2px 0 var(--ink); }
.sheet-body { overflow-y: auto; padding: 0.5rem max(1rem, env(safe-area-inset-right, 0px)) max(1.25rem, env(safe-area-inset-bottom, 0px)) max(1rem, env(safe-area-inset-left, 0px)); }
.modal-wrap { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 60; background: rgba(42, 31, 61, .6); display: grid; place-items: center; padding: max(1rem, env(safe-area-inset-top, 0px)) 1rem max(1rem, env(safe-area-inset-bottom, 0px)); animation: fade .2s ease-out; overflow-y: auto; }
.modal-box { width: 100%; max-width: 27.5rem; background: var(--paper); border: 3px solid var(--ink); border-radius: 1.625rem; padding: 1.375rem 1.125rem; box-shadow: 0 0.375rem 0 var(--ink); animation: pop-in .28s cubic-bezier(.2, 1.4, .5, 1); }
@keyframes fade { from { opacity: 0; } }
@keyframes slide-up { from { transform: translateY(2.5rem); opacity: .5; } }
@keyframes pop-in { from { transform: scale(.85); opacity: 0; } }

@media (min-width: 600px) {
  body.mode-room { background:
    radial-gradient(circle at 0.75rem 0.75rem, rgba(255, 255, 255, .06) 2.5px, transparent 3px) 0 0 / 2.125rem 2.125rem, #2a1f3d; }
  .room-app { border-left: 3px solid var(--ink); border-right: 3px solid var(--ink); }
}
@media (max-height: 640px) {
  .mode-room .meter .mn { display: none; }
  .mode-room .act { padding: 0.3125rem 2px 0.25rem; }
  .mode-room .act .ai { width: 1.75rem; height: 1.75rem; }
  .mode-room .panel { gap: 0.5rem; padding-block: 0.625rem; }
}
@media (max-width: 360px) {
  .mode-room .meters { gap: 0.25rem; }
  .mode-room .meter { grid-template-columns: 1fr; justify-items: center; }
  .mode-room .meter .mi { grid-row: auto; }
  .mode-room .meter .bar { width: 100%; }
  .mode-room .meter .mn { display: none; }
  .mode-room .meter .ml { grid-column: 1; }
  .mode-room .egg-pick small { display: none; }
}

/* =================================================================
   MODO ESCRITORIO (Windows) — fondo transparente sobre el escritorio
   ================================================================= */
html.desk, body.mode-desktop { background: transparent !important; overflow: hidden; user-select: none; }
.dpet { position: absolute; left: 0; top: 0; width: 9.375rem; aspect-ratio: 240 / 200; z-index: 10; cursor: pointer; touch-action: none; }
.dpet.egg { width: 6.875rem; }
.dpet .dsvg { width: 100%; height: 100%; pointer-events: none; }
.dpet .dsvg svg { width: 100%; height: 100%; }
.dpet .hit { position: absolute; left: 18%; right: 18%; top: 20%; bottom: 2%; border-radius: 40%; }
.dpet .bubble { font-size: .9rem; }
.dpet.dragging { cursor: grabbing; }
.dtag { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); font-weight: 800; font-size: .78rem; background: rgba(255, 255, 255, .92); border: 2px solid var(--ink); border-radius: 0.625rem; padding: 1px 0.5rem; white-space: nowrap; opacity: 0; transition: opacity .2s; pointer-events: none; }
.dpet:hover .dtag { opacity: 1; }
.dcard { position: absolute; z-index: 20; width: 22.5rem; max-height: 37.5rem; display: flex; flex-direction: column; background: var(--paper); border: 3px solid var(--ink); border-radius: 1.375rem; box-shadow: 0 0.375rem 0 var(--ink); }
.dcard-head { display: flex; align-items: center; gap: 0.5rem; padding: 0.625rem 0.625rem 0 0.875rem; cursor: grab; }
.dcard-head .brand { font-family: var(--f-display); font-size: .95rem; color: var(--ink-soft); flex: 1; }
.dcard-head button { width: 2rem; height: 2rem; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 0.625rem; background: #fff; box-shadow: 0 2px 0 var(--ink); }
.dcard-body { overflow-y: auto; padding: 0.625rem 0.875rem 0.875rem; display: grid; gap: 0.75rem; flex: 1 1 auto; min-height: 0; }
.dcard-head, .dcard-foot { flex: none; }
.dcard-foot { padding: 0.5rem 0.875rem 0.75rem; border-top: 2px solid var(--line); }
.dcard-foot .btn { width: 100%; }
.dcard .dpanel { display: grid; gap: 0.75rem; }
.dcard .meters { grid-template-columns: 1fr; gap: 0.375rem; }
.dcard .meter { grid-template-columns: 1.625rem 6.9rem 1fr; grid-template-rows: auto; }
.dcard .meter .mi { grid-row: auto; width: 1.625rem; height: 1.625rem; }
.dcard .meter .ml { order: 0; font-size: .8rem; grid-column: auto; text-align: left; margin: 0; display: flex; justify-content: space-between; gap: 0.25rem; padding-right: 0.25rem; }
.dcard .meter .bar { order: 1; }
.dsheet { display: grid; gap: 0.625rem; }
.dsheet-head { display: flex; align-items: center; gap: 0.5rem; }
.dsheet-head h3 { font-family: var(--f-display); font-size: 1.2rem; margin: 0; flex: 1; }
.dsheet-head button { width: 2.125rem; height: 2.125rem; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 0.625rem; background: #fff; box-shadow: 0 2px 0 var(--ink); }
.dcard .modal h2 { font-size: 1.35rem; }
.dcard .eggs { gap: 0.375rem; grid-template-columns: repeat(2, 1fr); }
.dcard .egg-pick .ep-art { max-width: 5rem; }

/* globo de diálogo a la altura de la cabeza según la etapa */
/* (--bub lo calcula ui.js a partir de dónde está la cabeza en el dibujo) */
.petbox[data-stage="egg"] .bubble, .dpet[data-stage="egg"] .bubble { bottom: 64%; }
.petbox[data-stage="baby"] .bubble, .dpet[data-stage="baby"] .bubble { bottom: var(--bub, 70%); }
.petbox[data-stage="young"] .bubble, .dpet[data-stage="young"] .bubble { bottom: var(--bub, 80%); }
.petbox[data-stage="adult"] .bubble, .dpet[data-stage="adult"] .bubble { bottom: var(--bub, 90%); }

/* En el escritorio la mascota se anima con un reloj propio a 10 cuadros por segundo (desktop.js),
   así que se apagan las animaciones CSS, que Chromium recalcula 60 veces por segundo. */
body.mode-desktop .meter.low .mi { animation: none; }

/* ---------- nivel ---------- */
.level { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.5rem; }
.level .lvnum { font-family: var(--f-display); font-size: .95rem; background: var(--plum); color: #fff; border-radius: 62.4375rem; padding: 2px 0.625rem; border: 2px solid var(--ink); }
.level .bar.xp { height: 0.625rem; }
.level .bar.xp i { background: linear-gradient(90deg, var(--plum), #9b7bff); }
.level .lvnext { font-size: .75rem; font-weight: 800; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.level.max .lvnum { background: var(--yolk); color: var(--ink); }
.level.max .bar.xp i { background: linear-gradient(90deg, var(--yolk-d), var(--yolk)); }
.lvbadge { justify-self: center; display: grid; place-items: center; width: 4rem; height: 4rem; margin-top: -10px; border-radius: 50%; background: var(--plum); color: #fff; font-family: var(--f-display); font-size: 1.8rem; border: 3px solid var(--ink); box-shadow: 0 3px 0 var(--ink); }

/* ---------- pedidos ---------- */
.bubble.ask { pointer-events: auto; white-space: normal; width: max-content; max-width: min(15.625rem, 80vw); display: grid; gap: 0.375rem; justify-items: center; text-align: center; padding: 0.5rem 0.75rem 0.625rem; z-index: 8; }
.bubble-act { font: inherit; font-weight: 800; font-size: .85rem; border: 2px solid var(--ink); border-radius: 0.625rem; background: var(--yolk); padding: 3px 0.75rem; box-shadow: 0 2px 0 var(--ink); cursor: pointer; }
.bubble-act:active { transform: translateY(2px); box-shadow: none; }
.needicon { position: absolute; top: 30%; left: 80%; transform: translate(-50%, -50%); z-index: 6; width: 2.25rem; height: 2.25rem; display: grid; place-items: center; padding: 0; border-radius: 50%; border: 2px solid var(--ink); background: #fff; color: var(--plum); box-shadow: 0 2px 0 var(--ink); cursor: pointer; }
.needicon .ic { width: 1.25rem; height: 1.25rem; }
.needicon.urgent { background: var(--berry); color: #fff; }
.mode-room .needicon.ping { animation: need-bob 1.4s ease-in-out 3; }
.mode-room .needicon.urgent.ping { animation-duration: .7s; animation-iteration-count: 5; }
@keyframes need-bob { 50% { transform: translate(-50%, calc(-50% - 0.3125rem)); } }

.dpet .needicon { width: 1.875rem; height: 1.875rem; }
.dpet .needicon .ic { width: 1.0625rem; height: 1.0625rem; }


/* ---------- empezar de nuevo ---------- */
.btn.danger { color: var(--berry); border-color: var(--berry); }
.btn.danger-fill { background: var(--berry); color: #fff; }
.reset .confirm { display: grid; gap: 0.5rem; }

/* ---------- logros y álbum ---------- */
.more section.more-top { display: flex; gap: 0.5rem; }
.more-top .btn { flex: 1; }
.cnt { font-size: .75rem; background: #f3ecff; color: var(--plum); border-radius: 62.4375rem; padding: 0 0.4375rem; }
.ach-list { display: grid; gap: 0.5rem; }
.ach { display: grid; grid-template-columns: 2.375rem 1fr auto; gap: 0.625rem; align-items: center; padding: 0.5rem 0.625rem; border-radius: 0.875rem; border: 2px dashed var(--line); background: transparent; color: var(--ink-soft); }
.ach.on { border-style: solid; background: var(--card); color: var(--ink); }
.ach-ic { width: 2.375rem; height: 2.375rem; display: grid; place-items: center; border-radius: 0.75rem; background: #efe6d8; color: var(--ink-soft); }
.ach.on .ach-ic { background: var(--yolk); color: var(--ink); }
.ach.on .ach-ic .ic { fill: #fff3c4; }
.ach-txt { display: grid; min-width: 0; }
.ach-txt small { font-size: .78rem; }
.ach-prize { font-size: .78rem; font-weight: 800; white-space: nowrap; }
.album { display: grid; gap: 0.75rem; }
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.125rem, 1fr)); gap: 0.625rem; }
.photo { margin: 0; background: #fff; border: 2px solid var(--line); border-radius: 0.375rem; padding: 0.5rem 0.5rem 0.625rem; box-shadow: 0 2px 0 var(--line); transform: rotate(-1deg); }
.photo:nth-child(2n) { transform: rotate(1.2deg); }
.ph-pet { aspect-ratio: 240 / 200; background: linear-gradient(#d6f0e2 62%, #e7bb84 62%); border-radius: 3px; overflow: hidden; }
.ph-pet svg { width: 100%; height: 100%; }
.photo figcaption { font-size: .8rem; margin-top: 0.375rem; display: grid; }
.photo figcaption small { color: var(--ink-soft); }

/* ---------- memoria ---------- */
.mem-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; width: 100%; max-width: 23.75rem; justify-self: center; }
.mem-card { aspect-ratio: 3 / 4; border: 2px solid var(--ink); border-radius: 0.75rem; background: var(--plum); box-shadow: 0 3px 0 var(--ink); padding: 0; position: relative; overflow: hidden; }
.mem-card .mem-back { position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: grid; place-items: center; color: #fff; font-family: var(--f-display); font-size: 1.6rem; }
.mem-card .mem-front { position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: none; place-items: center; background: #fff; }
.mem-card .mem-front svg { width: 70%; height: 70%; }
.mem-card.up .mem-front { display: grid; }
.mem-card.done { opacity: .55; box-shadow: none; transform: translateY(2px); }
.g-memory { display: grid; gap: 0.5rem; }
.about-txt { margin: 0; line-height: 1.5; }
.dcard-body { overflow-x: hidden; }
.row > .btn { min-width: 0; white-space: normal; text-align: center; }

/* ---------- fondos del cuarto ---------- */
.bgsky, .bgground, .bgstars { position: absolute; left: 0; right: 0; display: none; pointer-events: none; }
.bgsky { top: 0; bottom: var(--floor); transition: filter .8s; }
.bgground { bottom: 0; height: var(--floor); transition: filter .8s; }
.bgsky svg, .bgground svg { width: 100%; height: 100%; display: block; }
.scene[data-bg]:not([data-bg="cuarto"]) .bgsky, .scene[data-bg]:not([data-bg="cuarto"]) .bgground { display: block; }
.scene[data-bg]:not([data-bg="cuarto"]) :is(.wall, .window, .frame, .lamp, .floor, .rug) { display: none; }
.scene[data-bg]:not([data-bg="cuarto"]) .bgground { box-shadow: inset 0 0.375rem 0.5rem -6px rgba(0, 0, 0, .25); }
/* afuera se hace de noche de verdad; adentro (castillo) sólo baja un poco la luz */
.scene.outdoor[data-sky="dusk"] .bgsky { filter: sepia(.35) saturate(1.3) hue-rotate(-12deg) brightness(.9); }
.scene.outdoor[data-sky="dusk"] .bgground { filter: brightness(.85) sepia(.15); }
.scene.outdoor[data-sky="night"] .bgsky { filter: brightness(.38) saturate(.6) hue-rotate(25deg); }
.scene.outdoor[data-sky="night"] .bgground { filter: brightness(.55) saturate(.7); }
.scene.outdoor[data-sky="night"] .bgstars { display: block; top: 0; bottom: calc(var(--floor) + 25%); background:
  radial-gradient(circle at 12% 20%, #fff 1.5px, transparent 2px), radial-gradient(circle at 30% 60%, #fff 1px, transparent 1.6px),
  radial-gradient(circle at 46% 14%, #fff 1.4px, transparent 2px), radial-gradient(circle at 64% 42%, #fff 1px, transparent 1.6px),
  radial-gradient(circle at 78% 18%, #fff 1.6px, transparent 2.2px), radial-gradient(circle at 90% 55%, #fff 1px, transparent 1.6px),
  radial-gradient(circle at 22% 80%, #fff 1px, transparent 1.6px), radial-gradient(circle at 56% 74%, #fff 1.2px, transparent 1.8px); opacity: .85; }
.scene[data-bg="castillo"][data-sky="night"] .bgsky, .scene[data-bg="castillo"][data-sky="night"] .bgground { filter: brightness(.8); }

.bg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.125rem, 1fr)); gap: 0.625rem; }
.bg-card { display: grid; gap: 0.25rem; background: var(--card); border: 2px solid var(--line); border-radius: 1rem; padding: 0.5rem; text-align: center; }
.bg-card.on { border-color: var(--plum); box-shadow: 0 0 0 2px var(--plum) inset; }
.bg-card b { font-family: var(--f-display); font-size: .98rem; }
.bg-card small { color: var(--ink-soft); font-size: .76rem; line-height: 1.2; min-height: 2.4em; }
.bg-card .btn { justify-self: stretch; }
.bg-thumb { position: relative; display: block; aspect-ratio: 1 / .82; border-radius: 0.625rem; overflow: hidden; background: #ddd; }
.bg-thumb > svg { width: 100%; height: 100%; display: block; }
.bg-thumb .bgt-sky { position: absolute; left: 0; right: 0; top: 0; height: 70%; }
.bg-thumb .bgt-ground { position: absolute; left: 0; right: 0; bottom: 0; height: 30%; }
.bg-thumb .bgt-sky svg, .bg-thumb .bgt-ground svg { width: 100%; height: 100%; display: block; }
.bg-card.locked .bg-thumb > :not(.bg-lock) { filter: saturate(.55) brightness(.92); }
.bg-lock { position: absolute; right: 0.375rem; top: 0.375rem; width: 1.625rem; height: 1.625rem; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, .92); color: var(--ink); }
.bg-lock svg { width: 1rem; height: 1rem; }
.bgsky .tsun { transition: opacity .6s; }
.scene.outdoor[data-sky="night"] .bgsky .tsun { opacity: 0; }
.bgmoon { position: absolute; display: none; top: 9%; right: 12%; width: 13%; max-width: 4rem; aspect-ratio: 1; border-radius: 50%; box-shadow: -10px 0.3125rem 0 0 #fff5c8; pointer-events: none; }
.scene.outdoor[data-sky="night"] .bgmoon { display: block; }
/* el volcán ilumina su propia noche */
.scene[data-bg="volcan"][data-sky="night"] .bgsky { filter: brightness(.6) saturate(.9) hue-rotate(-8deg); }
.scene[data-bg="volcan"][data-sky="night"] .bgground { filter: brightness(.75); }

/* =================================================================
   RENDIMIENTO
   ================================================================= */
/* La mascota se anima con el reloj propio (js/anim.js), a pocos cuadros por segundo; para caminar,
   la caja se desliza con una transición de transform, que la hace la placa de video sin usar JavaScript. */
.petbox { will-change: transform; }
.ph-pet svg.pet *, .ep-art svg.pet * { transition: none; }

/* =================================================================
   TAMAÑOS: la mascota se adapta al lugar que tiene (celular, tablet, compu)
   ================================================================= */
@supports (width: 1cqh) {
  .scene { container-type: size; }
  .petbox { width: min(60cqw, 64cqh, 26.875rem); }
  .scene.has-egg .petbox { width: min(50cqw, 52cqh, 21.25rem); }
  .nest { width: min(62cqw, 64cqh, 26.25rem); }
  .poop { width: clamp(2.5rem, 7cqh, 4rem); height: auto; aspect-ratio: 46 / 40; }
}

/* Tablet parada: la app usa más ancho */
/* Tablets: todo el juego se agranda parejo (botones, textos, tienda), así el menú no queda chiquito en una
   pantalla grande. Funciona porque los tamaños están en "rem" (relativos a la letra base). */
@media (min-width: 700px) and (min-height: 900px) {
  html.is-room { font-size: 125%; }
  .room-app { max-width: 47.5rem; }
  .sheet { max-width: 42.5rem; }
}
@media (min-width: 760px) and (min-height: 1100px) {
  html.is-room { font-size: 140%; }
}
@media (orientation: landscape) and (min-width: 1000px) and (min-height: 700px) {
  html.is-room { font-size: 130%; }
}

/* Acostado (celular o tablet horizontal): cuarto a la izquierda y panel a la derecha */
@media (orientation: landscape) and (max-height: 600px), (orientation: landscape) and (min-width: 1000px) and (min-height: 600px) {
  .room-app { max-width: 80rem; flex-direction: row; }
  .scene { min-height: 0; }
  .mode-room .panel { flex: 0 0 clamp(18.75rem, 38%, 26.25rem); margin: 0 0 0 -18px; border-top: 0; border-left: 3px solid var(--ink); border-radius: 1.375rem 0 0 1.375rem; overflow-y: auto; align-content: start; padding-top: max(0.875rem, env(safe-area-inset-top, 0px)); }
  .sheet { max-width: 40rem; max-height: 94%; }
}
@media (orientation: landscape) and (max-height: 600px) {
  .mode-room .panel { gap: 0.5rem; padding-block: 0.625rem; }
  .mode-room .meter .mn { display: none; }
  .mode-room .act { padding: 0.3125rem 2px 0.25rem; }
  .mode-room .act .ai { width: 1.75rem; height: 1.75rem; }
  .mode-room .pname { font-size: 1.2rem; }
  .modal-wrap { align-items: start; }
}
@media (orientation: landscape) and (min-width: 1000px) and (min-height: 600px) {
  .mode-room .panel { align-content: center; }
}
/* ventanas en el celular acostado: más compactas para que entren sin tener que deslizar */
@media (orientation: landscape) and (max-height: 600px) {
  .modal-box { padding: 0.875rem 1rem; }
  .modal { gap: 0.5rem; }
  .modal h2 { font-size: 1.3rem; }
  .egg-pick { padding: 0.375rem 0.25rem; }
  .egg-pick .ep-art { max-width: 3.625rem; }
  .egg-pick small { display: none; }
  .cel-pet, .go-pet { width: 9.375rem; }
  .grave { width: 6rem; }
  .prize { font-size: 1.8rem; }
  .btn.big { padding: .5em 1em; }
}
@media (orientation: landscape) and (max-height: 600px) {
  .g-canvas { width: min(100%, 23.75rem, calc(64vh * 360 / 420)); }
  .mem-grid { grid-template-columns: repeat(6, 1fr); max-width: 32.5rem; }
  .gg-pet { width: min(10rem, 30vh); }
}
/* globito: los textos largos (logros) pasan a dos renglones en vez de salirse del globo */
.bubble { white-space: normal; width: max-content; max-width: min(18.75rem, 86vw); text-align: center; line-height: 1.25; }
.dpet .bubble { max-width: min(16.875rem, calc(100vw - 0.75rem)); }

/* =================================================================
   1.8: monedas, juegos que se desbloquean, ahorro de batería
   ================================================================= */
.packs { display: grid; gap: 0.625rem; }
.pack { display: grid; grid-template-columns: 3.25rem 1fr auto; gap: 0.625rem; align-items: center; background: linear-gradient(135deg, #fff8dc, #fff); border: 2px solid var(--yolk-d); border-radius: 1rem; padding: 0.5rem 0.625rem; }
.pack .item-art { background: #fff3c4; }
.pack .pk-coins { font-family: var(--f-display); font-size: 1.15rem; display: inline-flex; align-items: center; gap: 2px; }
.pack .pk-tag { display: inline-block; font-size: .72rem; font-weight: 800; color: #fff; background: var(--mint); border-radius: 62.4375rem; padding: 1px 0.5rem; margin-left: 0.25rem; vertical-align: 2px; }
.pack .btn { min-width: 6.5em; }
.pack-note { font-size: .78rem; }
.pack-err { color: var(--berry); font-weight: 800; font-size: .85rem; margin: 0; }
.game-card { position: relative; }
.game-card.locked { background: #f6f1ff; }
.game-card.locked .gc-art { filter: saturate(.5); }
.game-card .gc-lock { position: absolute; top: 0.625rem; right: 0.625rem; display: inline-flex; align-items: center; gap: 0.25rem; font-weight: 800; font-size: .85rem; background: #fff; border: 2px solid var(--ink); border-radius: 62.4375rem; padding: 2px 0.625rem; box-shadow: 0 2px 0 var(--ink); }
.game-card .gc-lock .ic { width: 0.9375rem; height: 0.9375rem; }
.game-card .gc-new { position: absolute; top: -8px; left: 0.75rem; font-size: .7rem; font-weight: 800; color: #fff; background: var(--berry); border-radius: 62.4375rem; padding: 1px 0.5rem; border: 2px solid var(--ink); }
.toggle small { display: block; font-size: .76rem; color: var(--ink-soft); font-weight: 600; }
/* Simón dice */
.g-simon { display: grid; gap: 0.625rem; text-align: center; }
.simon { display: grid; grid-template-columns: 1fr 1fr; gap: 0.625rem; width: min(20rem, 78vw); aspect-ratio: 1; margin: 0 auto; }
.simon button { border: 3px solid var(--ink); border-radius: 1.375rem; box-shadow: 0 0.25rem 0 var(--ink); display: grid; place-items: center; padding: 0; opacity: .72; transition: opacity .08s, transform .08s; }
.simon button svg { width: 52%; height: 52%; }
.simon button.on { opacity: 1; transform: scale(1.04); box-shadow: 0 0 0 0.25rem #fff, 0 0.25rem 0 var(--ink); }
.simon button:disabled { cursor: default; }
.simon .s0 { background: #ff8a3d; } .simon .s1 { background: #5b7cff; } .simon .s2 { background: #22b07d; } .simon .s3 { background: #ff5d9e; }
@media (orientation: landscape) and (max-height: 600px) { .simon { width: min(240px, 52vh); } }

/* informe de errores */
.errlog { margin: 0; max-height: 8em; overflow: auto; font-size: .72rem; background: #fff; border: 2px solid var(--line); border-radius: 0.625rem; padding: 0.375rem 0.5rem; white-space: pre-wrap; word-break: break-word; }

/* El panel nunca se corta: si la pantalla es muy baja (o el celular tiene la letra muy grande), el cuarto se
   achica y, en último caso, el panel se puede deslizar. */
.mode-room .panel { max-height: calc(var(--app-h, 100vh) - 9.375rem); overflow-y: auto; overscroll-behavior: contain; }
@media (max-height: 700px) {
  .mode-room .panel { gap: 0.5rem; padding-block: 0.625rem; }
  .mode-room .act { padding: 0.3125rem 2px 0.25rem; }
  .mode-room .act .ai { width: 1.875rem; height: 1.875rem; }
  .mode-room .pname { font-size: 1.25rem; }
  .mode-room .meter .ml { font-size: .62rem; }
}
@media (orientation: landscape) and (max-height: 600px), (orientation: landscape) and (min-width: 1000px) and (min-height: 600px) {
  .mode-room .panel { max-height: none; }
}

/* =================================================================
   1.10: menús más lindos (panel, botones, barras, tienda, ventanas)
   ================================================================= */
/* panel de abajo: tarjeta con manija y sombra suave */
.mode-room .panel { background: linear-gradient(#fffaf1, #fff3e0); box-shadow: 0 -0.5rem 1.25rem rgba(42, 31, 61, .14); }
.mode-room .panel::before { content: ''; position: absolute; left: 50%; top: 0.4rem; width: 2.75rem; height: 0.3rem; margin-left: -1.375rem; border-radius: 1rem; background: rgba(42, 31, 61, .16); }
@media (orientation: landscape) and (max-height: 600px), (orientation: landscape) and (min-width: 1000px) and (min-height: 600px) {
  .mode-room .panel::before { display: none; }
}
.chip.pstage { background: #efe6ff; color: var(--plum); border-radius: 999px; padding: 0.15rem 0.55rem; letter-spacing: .04em; }
.pname { text-shadow: 0 2px 0 rgba(255, 201, 60, .45); }
/* monedas: pastilla dorada con brillo */
.coins { background: linear-gradient(#fff6cf, #ffe38a); position: relative; overflow: hidden; }
.coins::after { content: ''; position: absolute; top: 0; left: 0.6rem; right: 0.6rem; height: 40%; border-radius: 999px; background: linear-gradient(rgba(255, 255, 255, .75), rgba(255, 255, 255, 0)); pointer-events: none; }
/* barras: más gruesas, con degradé y brillo */
.bar { height: 0.7rem; background: #ece2d2; box-shadow: inset 0 1px 2px rgba(42, 31, 61, .15); }
.bar i { background-image: linear-gradient(rgba(255, 255, 255, .38), rgba(255, 255, 255, 0) 55%, rgba(0, 0, 0, .08)); }
.meter .mi { box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .15), 0 2px 0 rgba(42, 31, 61, .18); }
.meter.low .bar { box-shadow: 0 0 0 2px rgba(255, 79, 109, .35), inset 0 1px 2px rgba(42, 31, 61, .15); }
.level .bar.xp { height: 0.8rem; }
.level .bar.xp i { background-image: repeating-linear-gradient(-45deg, rgba(255, 255, 255, .22) 0 0.35rem, transparent 0.35rem 0.7rem), linear-gradient(90deg, var(--plum), #9b7bff); }
.level .lvnum { box-shadow: 0 2px 0 var(--ink); }
/* botones de acción: tarjetitas con su color */
.act { background: linear-gradient(#ffffff, #fbf5ea); border-radius: 1.1rem; --ac: var(--ink); }
.act .ai { box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .08), inset 0 2px 0 rgba(255, 255, 255, .7); transition: transform .12s; }
.act:active .ai { transform: scale(.92); }
.act-food { --ac: #d9601c; } .act-play { --ac: #d6337a; } .act-bath { --ac: #138a80; } .act-clean { --ac: #7a5530; }
.act-sleep { --ac: #3d55d6; } .act-med { --ac: #d32a45; } .act-shop { --ac: #a86d00; } .act-more { --ac: var(--plum); } .act-warm { --ac: #e2531f; }
.act .al { color: var(--ink); }
.act:hover:not(.dim) { border-color: var(--ac); }
.act.dim { filter: grayscale(.6); }
/* hojas (tienda, comida, más…): encabezado claro y secciones con línea */
.sheet { box-shadow: 0 -0.75rem 2rem rgba(42, 31, 61, .25); }
.sheet header { border-bottom: 2px solid var(--line); padding-bottom: 0.6rem; background: linear-gradient(#fffaf1, var(--paper)); border-radius: 1.5rem 1.5rem 0 0; }
.sheet header::before { content: ''; position: absolute; left: 50%; margin-left: -1.375rem; margin-top: -0.55rem; width: 2.75rem; height: 0.3rem; border-radius: 1rem; background: rgba(42, 31, 61, .16); }
.list h4, .more h4 { color: var(--plum-d); }
.list h4::after, .more h4::after { content: ''; flex: 1; height: 2px; background: linear-gradient(90deg, var(--line), transparent); margin-left: 0.25rem; }
.item, .toggle, .bg-card, .ach.on, .pack { box-shadow: 0 2px 0 var(--line); }
.item { transition: transform .1s; }
.item:active { transform: scale(.99); }
.item-art { background: radial-gradient(circle at 40% 35%, #fff, #f6ecd9); }
.btn.primary { background: linear-gradient(#ffd75e, var(--yolk)); }
.pack { background: linear-gradient(135deg, #fff4c2, #fffdf5 60%); }
.game-card { background: linear-gradient(#fff, #fbf5ea); }
.game-card .gc-art { background: radial-gradient(circle at 40% 35%, #fff8dc, #ffe9a6); }
/* ventanas: un resplandor detrás de la mascota en los festejos */
.cel-pet, .go-pet { position: relative; }
.modal.celebrate .cel-pet::before, .game-over .go-pet::before { content: ''; position: absolute; top: -8%; right: 5%; bottom: -8%; left: 5%; border-radius: 50%; background: radial-gradient(circle, rgba(255, 201, 60, .55), rgba(255, 201, 60, 0) 68%); z-index: -1; }
.modal.celebrate, .game-over { isolation: isolate; }
.modal h2 { color: var(--plum-d); }
.modal-box { background: linear-gradient(#fffaf1, var(--paper)); }
/* panel de Windows */
.dcard { box-shadow: 0 6px 0 var(--ink), 0 1rem 2rem rgba(0, 0, 0, .25); background: linear-gradient(#fffaf1, var(--paper)); }
.dcard-head .brand::before { content: ''; display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--yolk); border: 2px solid var(--ink); margin-right: 0.4rem; vertical-align: -1px; }

/* 1.11: porcentajes en las barras, consejo para subir de nivel y hoja "Cómo está y qué hacer" */
button.meter { width: 100%; min-width: 0; appearance: none; background: none; border: 0; padding: 2px; margin: -2px; font: inherit; color: inherit; cursor: pointer; text-align: inherit; border-radius: 0.625rem; -webkit-tap-highlight-color: transparent; }
button.meter:hover { background: rgba(42, 31, 61, .05); }
button.meter:focus-visible { outline: 2px solid var(--plum); outline-offset: 1px; }
.meter .mp { color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 900; }
.meter.low .mp { color: var(--berry); }
.meter .ml { display: flex; flex-wrap: wrap; justify-content: center; column-gap: 0.25em; white-space: nowrap; text-overflow: clip; }
.meter .mn { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.level .lvtip { grid-column: 1 / -1; display: flex; align-items: center; gap: 0.375rem; min-width: 0; margin-top: -0.125rem; padding: 0.25rem 0.5rem; border: 1.5px dashed rgba(91, 63, 168, .45); border-radius: 0.625rem; background: rgba(91, 63, 168, .07); color: var(--ink-soft); font: inherit; font-size: .74rem; font-weight: 800; text-align: left; cursor: pointer; }
.level .lvtip.now { border-style: solid; background: rgba(91, 63, 168, .12); color: var(--ink); }
.level .lt-ic { flex: none; display: grid; place-items: center; color: var(--plum); }
.level .lt-ic .ic { width: 0.9rem; height: 0.9rem; }
.level .lt-tx { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.level .lt-xp { flex: none; background: var(--plum); color: #fff; border-radius: 1rem; padding: 0 0.375rem; font-size: .7rem; }
.level .lt-more { flex: none; color: var(--plum); text-decoration: underline; font-size: .7rem; }
@media (max-width: 380px) { .level .lt-more { display: none; } }
.status { display: grid; gap: 0.625rem; }
.status section { display: grid; gap: 0.3rem; background: #fff; border: 2px solid var(--line); border-radius: 1rem; padding: 0.625rem 0.75rem; }
.status section.focus { border-color: var(--plum); box-shadow: 0 0 0 3px rgba(91, 63, 168, .15); }
.status .st-head { display: flex; align-items: center; gap: 0.5rem; }
.status .st-head .mi { display: grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: 0.5rem; color: #fff; flex: none; }
.status .st-head .mi .ic { width: 1.1rem; height: 1.1rem; }
.status .st-name { flex: 1; font-family: var(--f-display); font-size: 1.05rem; }
.status .st-level .st-head .lvnum { font-family: var(--f-display); background: var(--plum); color: #fff; border-radius: 1rem; padding: 2px 0.625rem; border: 2px solid var(--ink); margin-right: auto; }
.status .st-big { font-family: var(--f-display); font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.status .st-chip { font-size: .7rem; font-weight: 900; border-radius: 1rem; padding: 1px 0.5rem; border: 1.5px solid var(--ink); }
.status .st-chip.ok { background: #c8f2d4; }
.status .st-chip.ask { background: var(--yolk); }
.status .st-chip.urgent { background: var(--berry); color: #fff; }
/* (2.0.7) la barra también: amarilla cuando lo pide (50 % a 15 %) y roja cuando es urgente (menos de 15 %) */
.status .st-row[data-lvl="mid"] .bar i { background-color: #ffbf1f; }
.status .st-row[data-lvl="low"] .bar i { background-color: #ef3f57; }
.status .bar { height: 0.75rem; }
.status .st-level .bar.xp i { background: linear-gradient(90deg, var(--plum), #9b7bff); }
.status p { margin: 0; font-size: .86rem; line-height: 1.35; }
.status .st-todo { font-weight: 800; color: var(--ink); }
.status .st-xpline { font-size: .78rem; color: var(--plum); display: flex; gap: 0.3rem; align-items: flex-start; }
.status .st-xpline .ic { width: 0.9rem; height: 0.9rem; flex: none; margin-top: 0.1rem; }
.status h4 { margin: 0.25rem 0 0; font-size: .82rem; }
.status .st-tips { margin: 0; padding-left: 1.1rem; display: grid; gap: 0.2rem; font-size: .82rem; line-height: 1.35; }
.status .st-xp { display: inline-block; background: var(--plum); color: #fff; border-radius: 1rem; padding: 0 0.375rem; font-size: .72rem; white-space: nowrap; }
.status .st-grow { color: var(--ink-soft); }
.status .btn.small { justify-self: start; }
.btn.small { font-size: .85rem; padding: .4em .85em; display: inline-flex; align-items: center; gap: .35em; }
.btn.small .ic { width: 1rem; height: 1rem; }
.meters { align-items: start; }
/* En Windows el título de la hoja (con el botón de volver) queda fijo arriba al desplazarse */
.dsheet-head { position: sticky; top: -0.625rem; z-index: 2; background: var(--paper); margin: -0.625rem -0.875rem 0; padding: 0.625rem 0.875rem 0.375rem; }
/* con letra grande el texto de abajo no puede achicar la barra: se corta con "…" */
.meter { grid-template-columns: auto minmax(1.75rem, 1fr); }
.meter .ml { min-width: 0; overflow: hidden; }
/* celular parado: abajo de cada barra sólo el número (el nombre está en "Cómo está"); en tablet, nombre y número */
@media (max-width: 599px) { .mode-room .meter .mn { display: none; } }
@media (orientation: landscape) and (max-height: 600px) { .mode-room .meter .mn { display: none; } }
/* Windows: los juegos entran enteros en el panel, sin tener que deslizar (antes el Salto quedaba cortado) */
.dcard .g-canvas { width: min(100%, calc((var(--card-maxh, 600px) - 17rem) * 360 / 420)); }
.dcard .g-hint { margin: 0; font-size: .78rem; }

/* =================================================================
   2.0.2 — Juegos a pantalla completa
   Antes se abrían en una hoja que tapaba sólo una parte (en la tablet quedaban chicos y con letra diminuta;
   con el celular acostado había que desplazar para ver el juego). Ahora ocupan todo, y games.js mide el
   área libre (.g-stage) para agrandar el tablero o el lienzo, incluso si se gira la pantalla.
   ================================================================= */
.sheet-wrap.game { align-items: stretch; background: var(--paper); height: var(--app-h, 100%); bottom: auto; animation: none; }
.sheet-wrap.game .sheet { max-width: none; max-height: none; height: 100%; border: 0; border-radius: 0; box-shadow: none; animation: fade .15s ease-out; }
.sheet-wrap.game .sheet header { border-radius: 0; padding-top: max(0.5rem, env(safe-area-inset-top, 0px)); padding-bottom: 0.4rem; }
.sheet-wrap.game .sheet header::before { display: none; }
.sheet-wrap.game .sheet-body { flex: 1 1 auto; min-height: 0; overflow: hidden; display: flex; flex-direction: column; padding-top: 0.5rem; }
.sheet-wrap.game .game-host { font-size: clamp(1rem, 0.62rem + 1.5vmin, 1.5rem); }
.game-host { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.g-wrap { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 0.5em; text-align: center; }
.g-wrap > * { flex: none; }
.g-wrap > .g-stage { flex: 1 1 auto; min-height: 0; }
.g-stage { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; }
.g-top { margin: 0; gap: 0.4em; flex-wrap: wrap; }
.g-top > span { background: #fff; border: 2px solid var(--line); border-radius: 999px; padding: 0.15em 0.75em; }
.g-hint { font-size: .8em; margin: 0; line-height: 1.3; }
.gg-msg { font-size: 1.15em; }
.g-canvas { max-width: none; aspect-ratio: auto; margin: 0; flex: none; }
.gg-pet { max-width: 100%; }
.g-guess .gg-btns { gap: 0.5em; }
.g-guess .gg-btns .btn { flex: 1; font-size: 1em; min-height: 3em; }
.mem-grid { max-width: none; width: auto; justify-self: auto; }
.mem-card .mem-back { font-size: 1em; }
.simon { max-width: 100%; }
.ttt { max-width: 100%; }
.ttt button { font-size: 1em; }
.ttt-vs { width: 100%; max-width: 32em; grid-template-columns: 1fr 5.5em 1fr; margin-bottom: 0.4em; }
.g-stage.land.g-ttt { flex-direction: row; gap: 1em; }
.g-stage.land .ttt-vs { width: 9em; grid-template-columns: 1fr; grid-template-rows: auto 6em auto; gap: 0.3em; margin: 0; }
.holes, .gol-field { max-width: 100%; }
.game-host > .game-over { margin: auto; width: min(100%, 26rem); }
.sheet-wrap.game .game-over h3 { font-size: 1.7em; }
.sheet-wrap.game .go-pet { width: min(14rem, 40vmin); }
/* lugar muy bajo (celular acostado): sin el texto de ayuda y con el título más chico */
@media (max-height: 30rem) {
  .sheet-wrap.game .sheet header { padding-top: max(0.25rem, env(safe-area-inset-top, 0px)); padding-bottom: 0.25rem; }
  .sheet-wrap.game .sheet h3 { font-size: 1.1rem; }
  .sheet-wrap.game .sheet .x { width: 2.25rem; height: 2.25rem; }
  .sheet-wrap.game .sheet-body { padding-top: 0.25rem; padding-bottom: max(0.4rem, env(safe-area-inset-bottom, 0px)); }
  .sheet-wrap.game .g-wrap { gap: 0.3em; }
  .sheet-wrap.game .g-hint { display: none; }
}
/* Windows: el juego ocupa toda la tarjeta */
.dcard.gaming { width: calc(22.5rem + var(--game-extra, 0px)); } /* (2.0.7) más ancho para jugar */
.dcard.gaming .dcard-body { overflow: hidden; }
.dcard.gaming .game-host { height: calc(var(--card-maxh, 600px) - 12rem); min-height: 18rem; }
.dcard.gaming .g-top { font-size: .9rem; }

/* (2.0.6) modo Club de Facu: volver a la página del Club */
.club-back .btn { width: 100%; justify-content: center; text-decoration: none; }
.club-link { display: inline-flex; align-items: center; gap: .3rem; margin-top: .7rem; color: var(--plum, #5b3f8c); font-weight: 800; text-decoration: none; }
.club-link .ic { width: 1.1rem; height: 1.1rem; }
