/* Isla Cubo — base: tokens, marco tipo teléfono, pergamino escalonado y botones de madera/caramelo.
   Todo scopeado bajo .ic (clase del <html> de este prototipo). */

:root {
  --cream: #FFF6E5;
  --cream-2: #F6E6C8;
  --brown: #5B3A1E;
  --brown-2: #7A4A26;
  --wood: #C98E5A;
  --wood-side: #8A5A2B;
  --caramel: #F6B04A;
  --caramel-side: #C4761F;
  --mint: #9BE564;
  --mint-side: #5FA83A;
  --sky-btn: #7FD1F7;
  --sky-btn-side: #3F9CC8;
  --berry: #FF6B6B;
  --berry-side: #C94747;
  --gold: #FFD23F;
  --accent: #4CC9F0;
  --text: #3A2410;
  --muted: #7A5B3E;

  --f-title: "Bungee", "Arial Black", system-ui, sans-serif;
  --f-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;

  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --step: 7px;
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --smooth: cubic-bezier(.22, .8, .24, 1);
}

.ic,
.ic body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
.ic body {
  font-family: var(--f-body);
  color: var(--text);
  background: linear-gradient(180deg, var(--sky-top, #FFD6A5), var(--sky-bottom, #A0D8F1));
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
.ic *, .ic *::before, .ic *::after { box-sizing: border-box; }
:where(.ic) button { font: inherit; color: inherit; }
:where(.ic) img, :where(.ic) svg { display: block; }
.ic [hidden] { display: none !important; }

/* ---------- Marco ---------- */
.frame {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: linear-gradient(180deg, var(--sky-top, #FFD6A5), var(--sky-bottom, #A0D8F1));
  transition: background 1s;
}
.frame-cloud { position: absolute; display: none; opacity: .85; animation: drift 120s linear infinite; }
.frame-cloud i { position: absolute; background: #fff; border-radius: 10px; box-shadow: inset 0 -6px 0 rgba(160, 190, 220, .35); }
@keyframes drift { from { transform: translateX(-12vw); } to { transform: translateX(12vw); } }
.app {
  position: relative;
  width: 100%;
  height: 100%;
  margin: 0 auto;
  overflow: hidden;
  isolation: isolate;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
@media (min-width: 560px) {
  .frame-cloud { display: block; }
  .app {
    width: 430px;
    height: min(932px, calc(100dvh - 40px));
    margin-top: max(20px, calc((100dvh - 932px) / 2));
    border-radius: 34px;
    border: 5px solid var(--brown);
    box-shadow: 0 10px 0 var(--brown), 0 30px 70px rgba(58, 36, 16, .35);
  }
}

/* ---------- Cielo y mundo ---------- */
.sky {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(180deg, var(--sky-top, #FFD6A5) 0%, var(--sky-bottom, #A0D8F1) 100%);
}
.stars {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .6s;
  background-image:
    radial-gradient(2px 2px at 12% 18%, #fff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 30% 8%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 52% 22%, #fff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 70% 12%, #fff 50%, transparent 51%),
    radial-gradient(2.5px 2.5px at 86% 26%, #FFF3B0 50%, transparent 51%), radial-gradient(1.5px 1.5px at 20% 36%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 44% 40%, #fff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 78% 44%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 8% 52%, #FFF3B0 50%, transparent 51%), radial-gradient(1.5px 1.5px at 62% 6%, #fff 50%, transparent 51%);
}
.world-layer { position: absolute; inset: 0; z-index: 1; }
.world-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.world-fade { position: absolute; inset: 0; background: var(--sky-bottom, #fff); opacity: 0; pointer-events: none; transition: opacity .22s; }
.world-fade.is-on { opacity: 1; }

/* ---------- Pergamino con esquinas escalonadas ---------- */
.parch {
  --s: var(--step);
  position: relative;
  color: var(--text);
  background: var(--brown);
  clip-path: polygon(var(--s) 0, calc(100% - var(--s)) 0, calc(100% - var(--s)) var(--s), 100% var(--s), 100% calc(100% - var(--s)), calc(100% - var(--s)) calc(100% - var(--s)), calc(100% - var(--s)) 100%, var(--s) 100%, var(--s) calc(100% - var(--s)), 0 calc(100% - var(--s)), 0 var(--s), var(--s) var(--s));
}
.parch::before {
  content: "";
  position: absolute;
  inset: 3px;
  z-index: 0;
  background: var(--parch-bg, var(--cream));
  clip-path: polygon(var(--s) 0, calc(100% - var(--s)) 0, calc(100% - var(--s)) var(--s), 100% var(--s), 100% calc(100% - var(--s)), calc(100% - var(--s)) calc(100% - var(--s)), calc(100% - var(--s)) 100%, var(--s) 100%, var(--s) calc(100% - var(--s)), 0 calc(100% - var(--s)), 0 var(--s), var(--s) var(--s));
}
.parch > * { position: relative; z-index: 1; }

/* ---------- Botones de bloque (madera y caramelo) ---------- */
.bb {
  --face: var(--caramel);
  --side: var(--caramel-side);
  --ink: var(--brown);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  min-width: 44px;
  padding: 10px 16px 9px;
  border: 2px solid var(--brown);
  border-radius: 7px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .35) 0 18%, rgba(255, 255, 255, 0) 18%), var(--face);
  color: var(--ink);
  box-shadow: 0 5px 0 var(--side), 0 5px 0 2px var(--brown);
  font-family: var(--f-body);
  font-weight: 900;
  font-size: 17px;
  line-height: 1.1;
  text-decoration: none;
  cursor: pointer;
  transform: translateY(0);
  transition: transform .1s var(--smooth), box-shadow .1s var(--smooth);
  -webkit-appearance: none;
  appearance: none;
}
.bb:active, .bb.is-down { transform: translateY(5px); box-shadow: 0 0 0 var(--side), 0 0 0 2px var(--brown); }
.bb svg { flex: none; }
.bb-wood { --face: var(--wood); --side: var(--wood-side); --ink: #FFF6E5; }
.bb-cream { --face: var(--cream); --side: #D9C2A0; }
.bb-mint { --face: var(--mint); --side: var(--mint-side); }
.bb-sky { --face: var(--sky-btn); --side: var(--sky-btn-side); }
.bb-berry { --face: var(--berry); --side: var(--berry-side); --ink: #FFF6E5; }
.bb-block { display: flex; width: 100%; }
.bb-lg { min-height: 58px; font-size: 19px; }
.bb-round { width: 46px; height: 46px; min-height: 46px; padding: 0; border-radius: 50%; }
.bb-round:active { transform: translateY(4px); }

.ic button:focus-visible, .ic a:focus-visible, .ic input:focus-visible, .ic [tabindex]:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}
.title { font-family: var(--f-title); font-weight: 400; letter-spacing: .01em; }

.pop { animation: pop .42s var(--spring); }
@keyframes pop { 0% { scale: 1; } 40% { scale: .88; } 75% { scale: 1.08; } 100% { scale: 1; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Toast ---------- */
.toast-root { position: absolute; left: 0; right: 0; top: calc(var(--sat) + 74px); z-index: 60; display: flex; justify-content: center; pointer-events: none; }
.toast { padding: 12px 18px; font-weight: 900; font-size: 16px; animation: toast-in .5s var(--spring) both; }
.toast.is-out { animation: toast-out .35s ease-in both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-20px) scale(.92); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-16px); } }

.rm *, .rm *::before, .rm *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
