/* Expedición Fósil — base: colores, tipografía, botones, cielo, HUD, libreta de la intro, avisos.
   Todo cuelga de html.xf (la página del prototipo). */
.xf {
  --ink: #3B2414; --ink-2: #6B4A2E; --cream: #FFF6E6; --paper: #FFF1D6; --sand: #E8C894; --ocre: #D9A05B;
  --earth: #9C6436; --terra: #C4502A; --terra-d: #9E3B1A; --amber: #FFB21E; --amber-l: #FFE3A3; --sky: #2BB5B8; --sky-l: #8CE6E0;
  --tape-1: #FFC21A; --tape-2: #F07E1B; --leaf: #5DBB63; --wa: #25D366;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --f-display: "Lilita One", "Nunito", system-ui, sans-serif; --f-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif; --f-type: "Special Elite", "Courier New", monospace;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
}
.xf *, .xf *::before, .xf *::after { box-sizing: border-box; }
.xf body { margin: 0; font-family: var(--f-body); color: var(--ink); overflow: hidden; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
.xf button { font: inherit; color: inherit; }
.xf :focus-visible { outline: 3px solid #1B6FD8; outline-offset: 3px; }
.xf .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.xf .noscript { margin: 24px; font: 700 18px/1.5 var(--f-body); color: var(--ink); background: var(--cream); padding: 16px; border-radius: 12px; }

/* ---------- La app: pantalla completa en el teléfono; marco de teléfono (≤ 430 px) centrado en escritorio ----------
   (mismo marco que los demás demos). Es contenedor de tamaño: dentro se mide en cqw/cqh y con @container, así en el
   marco todo se comporta como en un celular de ese tamaño. */
.xf .app { position: fixed; inset: 0; z-index: 1; overflow: hidden; isolation: isolate; container-type: size; transition: opacity .5s ease; }
@media (min-width: 560px) and (min-height: 560px) {
  /* alrededor, el campamento de la invitación difuminado */
  .xf body::before {
    content: ""; position: fixed; inset: -60px; z-index: 0; pointer-events: none; filter: blur(18px) saturate(.95);
    background:
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 200' preserveAspectRatio='none'%3E%3Cpath d='M0 200V120h60l20-40h110l25 40h90V90l30-30h120l20 50h60v-30h90l25 50h60l20-20h70v160z' fill='%23D98C4A'/%3E%3Cpath d='M0 200v-40h140l30-30h90l30 40h180l40-50h120l30 40h140v40z' fill='%23C9733A'/%3E%3C/svg%3E") 0 51.5% / 100% 30% no-repeat,
      linear-gradient(180deg, #8DE8E1 0%, #4CCDCB 22%, #2BB5B8 40%, #2BB5B8 65.5%, #E9B46C 65.5%, #DDA055 86%, #CF8E45 100%);
  }
  .xf .app { inset: auto; left: 50%; top: 50%; width: min(430px, 100vw - 32px); height: min(932px, 100dvh - 40px); transform: translate(-50%, -50%);
    border-radius: 36px; box-shadow: 0 0 0 1.5px rgba(255, 246, 230, .45), 0 30px 90px rgba(40, 20, 5, .5); }
}
/* vitrina (?showcase=1): la excavación a pantalla completa */
.xf.is-showcase body::before { display: none; }
.xf.is-showcase .app { inset: 0 !important; width: auto !important; height: auto !important; transform: none !important; border-radius: 0 !important; box-shadow: none !important; }

/* ---------- Cielo y campamento ---------- */
.xf .sky { position: absolute; inset: 0; background: linear-gradient(180deg, #8DE8E1 0%, #4CCDCB 34%, #2BB5B8 60%, #2BB5B8 100%); }
.xf .sky::before { /* mesetas lejanas y nubes */
  content: ""; position: absolute; left: 0; right: 0; bottom: 34%; height: 30%;
  background:
    radial-gradient(60px 22px at 18% 18%, rgba(255,255,255,.9) 60%, transparent 62%),
    radial-gradient(44px 18px at 24% 14%, rgba(255,255,255,.9) 60%, transparent 62%),
    radial-gradient(70px 24px at 78% 30%, rgba(255,255,255,.85) 60%, transparent 62%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 200' preserveAspectRatio='none'%3E%3Cpath d='M0 200V120h60l20-40h110l25 40h90V90l30-30h120l20 50h60v-30h90l25 50h60l20-20h70v160z' fill='%23D98C4A'/%3E%3Cpath d='M0 200v-40h140l30-30h90l30 40h180l40-50h120l30 40h140v40z' fill='%23C9733A'/%3E%3C/svg%3E") bottom / 100% 100% no-repeat;
}
.xf .sky::after { /* suelo ocre */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 34.5%;
  background: linear-gradient(180deg, #E9B46C 0%, #DDA055 60%, #CF8E45 100%);
}

.xf .sky::before, .xf .sky::after { transition: opacity .8s ease; }
.xf .is-final.has-3d .sky::before, .xf .is-final.has-3d .sky::after { opacity: 0; }
.xf .stage { position: absolute; inset: 0; }
.xf .gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; pointer-events: none; transition: opacity .5s ease; z-index: 6; }
.xf .gl.is-warm { opacity: .01; }
.xf .gl.is-on { opacity: 1; }
.xf .is-final .gl.is-on { pointer-events: auto; }
.xf .ui { position: absolute; inset: 0; pointer-events: none; z-index: 20; }
.xf .ui > * { pointer-events: auto; }

/* ---------- Botones ---------- */
.xf .gbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px;
  border: 2.5px solid var(--ink); border-radius: 16px; background: var(--cream); color: var(--ink);
  font: 800 16px/1.15 var(--f-body); text-decoration: none; cursor: pointer; box-shadow: 0 4px 0 var(--ink);
  transition: transform .12s ease, box-shadow .12s ease, background-color .2s; touch-action: manipulation; user-select: none;
}
.xf .gbtn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.xf .gbtn[disabled] { opacity: .5; cursor: default; transform: none; box-shadow: 0 2px 0 var(--ink); }
.xf .gbtn.is-primary { background: var(--terra); color: #fff; }
.xf .gbtn.is-amber { background: var(--amber); }
.xf .gbtn.is-wa { background: var(--wa); color: #06301A; }
.xf .gbtn.is-small { min-height: 40px; padding: 0 14px; font-size: 15px; border-radius: 13px; box-shadow: 0 3px 0 var(--ink); }
.xf .gbtn.is-big { min-height: 56px; font-size: 18px; border-radius: 18px; }
.xf .gbtn.is-block { width: 100%; }
.xf .gbtn .bi { display: inline-flex; }
.xf .icon-btn { display: inline-grid; place-items: center; width: 46px; height: 46px; border: 2.5px solid var(--ink); border-radius: 50%; background: rgba(255, 246, 230, .95); color: var(--ink); cursor: pointer; box-shadow: 0 3px 0 var(--ink); padding: 0; }
.xf .icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.xf .nb-link { border: 0; background: none; padding: 10px 6px; min-height: 44px; font: 800 15px var(--f-body); color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ---------- HUD ---------- */
.xf .hud { position: absolute; left: 10px; right: 10px; top: calc(var(--safe-t) + 8px); display: flex; align-items: center; gap: 10px; transition: opacity .4s; }
.xf .hud-title { flex: 1; margin: 0; text-align: center; font: 400 21px/1.1 var(--f-display); color: #fff; text-shadow: 0 2px 0 #1E7F82, 0 0 8px rgba(0, 80, 80, .3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xf [data-phase="intro"] .hud, .xf [data-phase="intro"] .skel, .xf [data-phase="intro"] .dig-bar { opacity: 0; pointer-events: none; }
.xf .is-final .hud-title, .xf .is-finale .hud-title { opacity: 0; }
.xf .is-finale .hud > :not(.sound-btn) { visibility: hidden; }
.xf .is-final .hud > :not(.sound-btn) { visibility: visible; }

/* ---------- Avisos ---------- */
.xf .toast { position: absolute; left: 50%; bottom: calc(var(--safe-b) + 96px); transform: translateX(-50%); max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 14px; background: var(--ink); color: var(--cream); font: 800 15px var(--f-body); box-shadow: 0 8px 20px rgba(40, 20, 5, .35); z-index: 60; animation: xf-toast .3s ease both; }
.xf .toast.is-out { opacity: 0; transition: opacity .3s; }
@keyframes xf-toast { from { opacity: 0; transform: translate(-50%, 10px); } }
.xf .dbg-fps { position: absolute; right: 8px; bottom: calc(var(--safe-b) + 70px); margin: 0; padding: 2px 8px; border-radius: 8px; background: rgba(0, 0, 0, .55); color: #fff; font: 12px ui-monospace, monospace; z-index: 80; pointer-events: none; }

/* ---------- Libreta de campo (intro) ---------- */
.xf .notebook { position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; padding: calc(var(--safe-t) + 16px) 14px calc(var(--safe-b) + 16px); background: radial-gradient(80% 60% at 50% 45%, rgba(60, 30, 8, .1), rgba(60, 30, 8, .55)); opacity: 0; transition: opacity .5s ease; }
.xf .notebook.is-in { opacity: 1; }
.xf .notebook.is-out { opacity: 0; pointer-events: none; transition: opacity .6s ease .15s; }
.xf .nb { position: relative; width: min(92cqw, 420px, calc((100cqh - 40px) * .7)); aspect-ratio: .7; perspective: 1800px; transform: translateY(40px) scale(.94); transition: transform .7s cubic-bezier(.2, .9, .3, 1.1); }
.xf .notebook.is-in .nb { transform: none; }
.xf .notebook.is-out .nb { transform: translateY(70%) rotate(5deg) scale(.9); transition: transform .7s cubic-bezier(.5, 0, .8, .4); }
.xf .nb-spine { position: absolute; left: -6px; top: 10px; bottom: 10px; width: 14px; border-radius: 6px; background: linear-gradient(90deg, #5E2F12, #8A4B22); box-shadow: 0 4px 10px rgba(40, 20, 5, .4); }
.xf .nb-page {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 10px; padding: 22px 20px 16px 30px; border-radius: 8px 20px 20px 8px; overflow: hidden;
  background: linear-gradient(90deg, rgba(196, 80, 42, .28) 0 2px, transparent 2px) 22px 0 / 100% 100% no-repeat, repeating-linear-gradient(180deg, transparent 0 29px, rgba(43, 140, 160, .22) 29px 30px) 0 14px, linear-gradient(170deg, #FFF8E8, #FBEBCB);
  box-shadow: 0 18px 40px rgba(40, 20, 5, .45), inset 0 0 0 1px rgba(120, 80, 40, .2);
}
.xf .nb-kicker { margin: 0; font: 400 13px/1 var(--f-type); color: var(--ink-2); letter-spacing: .04em; }
.xf .nb-title { margin: 4px 0 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.xf .nb-exp { font: 400 clamp(30px, 9cqw, 38px)/1.02 var(--f-display); color: #7A3A12; }
.xf .nb-age { display: inline-block; padding: 2px 14px 4px; border-radius: 12px; background: var(--amber); border: 2.5px solid var(--ink); font: 400 26px/1.1 var(--f-display); color: var(--ink); transform: rotate(-3deg); box-shadow: 0 3px 0 var(--ink); }
.xf .nb-stamp { position: absolute; right: 12px; top: 10px; padding: 3px 8px; border: 3px solid #C4302A; border-radius: 10px; font: 400 17px/1 var(--f-type); text-transform: uppercase; letter-spacing: .06em; color: #C4302A; transform: rotate(-14deg) scale(2.2); opacity: 0; mix-blend-mode: multiply; }
.xf .nb-stamp span { display: block; padding: 3px 4px; border: 1.5px solid #C4302A; border-radius: 6px; }
.xf .nb.is-stamped .nb-stamp { opacity: .88; transform: rotate(-14deg) scale(1); transition: transform .22s cubic-bezier(.5, 0, .9, .5), opacity .1s; }
.xf .nb-text { margin: 4px 0 0; font: 700 16px/1.45 var(--f-body); color: var(--ink); max-width: 30ch; }
.xf .nb-art { flex: 1; min-height: 40px; display: flex; align-items: center; justify-content: flex-start; }
.xf .nb-doodle { width: min(66%, 230px); height: auto; }
.xf .nb-brush { position: absolute; right: 8%; bottom: 140px; width: 52%; transform: rotate(-12deg); filter: drop-shadow(0 6px 4px rgba(40, 20, 5, .35)); transition: transform .5s cubic-bezier(.3, 1.4, .5, 1); }
.xf .nb-brush svg { width: 100%; height: auto; display: block; }
.xf .notebook.is-taking .nb-brush { transform: translate(10%, -70%) rotate(-40deg) scale(1.3); }
.xf .nb-start { width: 100%; position: relative; z-index: 2; }
.xf .nb-links { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; margin-top: -2px; }
.xf .nb-cover { position: absolute; inset: 0; transform-origin: 0 50%; transform-style: preserve-3d; transition: transform 1.15s cubic-bezier(.6, .05, .25, 1), opacity .45s ease .85s; z-index: 3; }
.xf .nb.is-open .nb-cover { transform: rotateY(-172deg); opacity: 0; pointer-events: none; }
.xf .nb-cover-front, .xf .nb-cover-back { position: absolute; inset: 0; border-radius: 8px 20px 20px 8px; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.xf .nb-cover-front {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; color: #F6D9A8;
  background: radial-gradient(90% 70% at 35% 30%, #B5682F, #8A4B22 60%, #6E3818); box-shadow: 0 18px 40px rgba(40, 20, 5, .45), inset 0 0 0 10px rgba(0, 0, 0, .08);
}
.xf .nb-cover-front::before { content: ""; position: absolute; inset: 14px; border: 2px dashed rgba(246, 217, 168, .6); border-radius: 6px 14px 14px 6px; }
.xf .nb-cover-label { padding: 8px 18px; border-radius: 8px; background: #F3DDB4; color: #6E3818; font: 400 24px var(--f-display); box-shadow: inset 0 0 0 2px #8A4B22; }
.xf .nb-cover-print { opacity: .55; }
.xf .nb-cover-name { font: 400 16px var(--f-type); }
.xf .nb-cover-back { transform: rotateY(180deg); background: linear-gradient(90deg, #E7CFA0, #F3E2BE); }
.xf .rm .nb-cover, .xf.rm .nb-cover { display: none; }

/* ---------- Vitrina ---------- */
.xf .showcase-title { position: absolute; left: 0; right: 0; top: 7%; margin: 0; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; z-index: 25; }
.xf .showcase-title span { font: 400 clamp(34px, 7vw, 76px)/1 var(--f-display); color: #fff; text-shadow: 0 4px 0 #7A3A12, 0 0 20px rgba(60, 30, 8, .5); }
.xf .showcase-title small { padding: 4px 16px; border-radius: 999px; background: var(--amber); border: 3px solid var(--ink); font: 400 clamp(18px, 3vw, 30px)/1.2 var(--f-display); color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .xf *, .xf *::before, .xf *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .2s !important; }
}
