/* El Trencito — base: colores (tres paletas que eligen los papás), tipografía, escenario, botones, hojas (sheets) y
   avisos. Todo bajo html.trencito (prototipo aislado). Madera clara, pasteles y texto café cálido sobre crema
   (contraste ≥ 4.5:1). La paleta llega como clase en <html>: pal-rosa | pal-azul | pal-neutra. */
.trencito {
  --ink: #3A2A22; --ink-2: #6A5446; --cream: #FFFDF7; --cream-2: #F6EEDF; --line: #EADCC6; --wood: #E9C796; --wood-d: #B98650;
  --primary: #2D6FB5; --primary-2: #225A95; --on-primary: #FFFFFF; --soft: #E2EFFB; --trim: #6FA8DC; --rug: #BFDCF3; --wall: #EAF3FB; --accent: #F4A9C0;
  --shadow: 0 12px 34px rgba(58, 42, 34, .22);
  --radius: 24px;
  --font-d: "Fredoka", "Nunito", system-ui, sans-serif;
  --font-b: "Nunito", "Fredoka", system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
}
.trencito.pal-rosa { --primary: #C83F78; --primary-2: #A52D61; --soft: #FDE3EC; --trim: #E97AA4; --rug: #F6C3D3; --wall: #FBEAF0; --accent: #7FC8E8; }
.trencito.pal-neutra { --primary: #7A5C34; --primary-2: #5E4626; --soft: #F2EADB; --trim: #A8C3A0; --rug: #E8DCC4; --wall: #F6F1E6; --accent: #A8C3A0; }
.trencito *, .trencito *::before, .trencito *::after { box-sizing: border-box; }
.trencito body { height: 100%; overflow: hidden; color: var(--ink); font: 400 16px/1.45 var(--font-b); -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
/* ---------- escritorio: el cuarto de juegos, difuminado, alrededor del teléfono ---------- */
.trencito .room { position: fixed; inset: 0; z-index: 0; overflow: hidden; background:
  linear-gradient(180deg, var(--wall) 0%, var(--wall) 52%, #E9C796 52.2%, #DDB582 100%); }
.trencito .room::before { /* tapete, juguetes y luz de la ventana desenfocados */
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(ellipse 46% 16% at 50% 76%, var(--rug), transparent 72%), radial-gradient(ellipse 12% 22% at 12% 58%, rgba(255, 255, 255, .8), transparent 70%),
    radial-gradient(circle at 18% 72%, #F2C14E 0 22px, transparent 26px), radial-gradient(circle at 84% 70%, #E66A6A 0 26px, transparent 30px), radial-gradient(circle at 76% 80%, #7DBB86 0 18px, transparent 22px), radial-gradient(circle at 26% 84%, var(--trim) 0 20px, transparent 24px);
  filter: blur(10px); }
.trencito .app { position: fixed; inset: 0; z-index: 1; overflow: hidden; isolation: isolate; transition: opacity .5s ease; }
/* (mismo marco de teléfono que los demás diseños: Misión Estrella, El Nido, Caja Musical…) */
@media (min-width: 560px) and (min-height: 560px) {
  .trencito .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 10px #FFFDF7, 0 0 0 12px rgba(58, 42, 34, .12), 0 30px 80px rgba(58, 42, 34, .32); }
}
.trencito.is-showcase .app { inset: 0 !important; width: auto !important; height: auto !important; transform: none !important; border-radius: 0 !important; box-shadow: none !important; }
.trencito .stage { position: absolute; inset: 0; overflow: hidden; background: linear-gradient(180deg, var(--wall), var(--rug)); }
.trencito .gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
.trencito .poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.trencito.is-ready .poster { animation: tren-fade-out .5s ease .2s forwards; }
@keyframes tren-fade-out { to { opacity: 0; visibility: hidden; } }
.trencito .veil { position: absolute; inset: 0; background: var(--cream); opacity: 0; pointer-events: none; transition: opacity .22s ease; z-index: 3; }
.trencito .veil.is-on { opacity: 1; }
.trencito .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.trencito .noscript { position: fixed; inset: auto 16px 16px; padding: 16px; border-radius: 16px; background: var(--cream); color: var(--ink); }
.trencito .ui { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.trencito .ui > * { pointer-events: auto; }
.trencito button { font: inherit; color: inherit; }
.trencito :focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }

/* (sólo para generar la imagen OG: ?showcase=1&still=1&og=1) */
.trencito .og-title { position: absolute; left: 0; right: 0; top: 30px; z-index: 4; text-align: center; color: var(--primary); text-shadow: 0 3px 0 #fff, 0 6px 22px rgba(255, 255, 255, .9); pointer-events: none; }
.trencito .og-title p { margin: 0; font: 700 42px/1 var(--font-d); color: var(--ink); }
.trencito .og-title strong { display: block; margin-top: 6px; font: 700 78px/1 var(--font-d); }

/* ---------- botones ---------- */
.trencito .gbtn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border: 2px solid var(--line); border-radius: 999px; background: var(--cream); color: var(--ink); font: 700 16px/1.1 var(--font-d); text-decoration: none; cursor: pointer; box-shadow: 0 3px 0 rgba(58, 42, 34, .12); transition: transform .12s ease, box-shadow .12s ease, background .2s; }
.trencito .gbtn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(58, 42, 34, .12); }
.trencito .gbtn.is-primary { border-color: transparent; background: var(--primary); color: var(--on-primary); box-shadow: 0 4px 0 var(--primary-2), 0 8px 18px rgba(58, 42, 34, .2); }
.trencito .gbtn.is-primary:active { box-shadow: 0 1px 0 var(--primary-2); }
.trencito .gbtn.is-soft { background: rgba(255, 253, 247, .75); }
.trencito .gbtn.is-big { min-height: 54px; font-size: 18px; padding: 0 24px; }
.trencito .gbtn.is-small { min-height: 44px; font-size: 15px; }
.trencito .gbtn[disabled] { opacity: .5; cursor: default; }
.trencito .round-btn { display: inline-grid; place-items: center; width: 48px; height: 48px; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 253, 247, .94); color: var(--ink); cursor: pointer; box-shadow: 0 4px 14px rgba(58, 42, 34, .22); }
.trencito .round-btn[disabled] { opacity: .4; cursor: default; }

/* ---------- hojas (confirmación, información) ---------- */
.trencito .sheet { position: fixed; inset: 0; z-index: 30; display: flex; align-items: flex-end; justify-content: center; background: rgba(58, 42, 34, 0); pointer-events: auto; transition: background .35s ease; }
.trencito .sheet.is-on { background: rgba(58, 42, 34, .22); }
.trencito .sheet.is-rsvp.is-on { background: rgba(58, 42, 34, 0); } /* (el vagón 3D se ve arriba) */
.trencito .sheet-panel { display: flex; flex-direction: column; width: min(560px, 100%); max-height: min(78dvh, 720px); border-radius: var(--radius) var(--radius) 0 0; background: var(--cream); box-shadow: var(--shadow); transform: translateY(105%); transition: transform .38s cubic-bezier(.2, .9, .25, 1.05); overflow: hidden; padding-bottom: var(--safe-b); }
.trencito .sheet.is-on .sheet-panel { transform: none; }
.trencito .sheet.is-rsvp .sheet-panel { max-height: min(60dvh, 640px); }
.trencito .sheet.is-details .sheet-panel { max-height: 92dvh; }
.trencito .sh-head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 16px 8px 20px; border-bottom: 1px solid var(--line); }
.trencito .sh-head > div:first-child, .trencito .sh-titles { flex: 1; min-width: 0; }
.trencito .sh-head.is-sticky { flex-wrap: wrap; }
.trencito .sh-head .chips { flex-basis: 100%; }
.trencito .kick { margin: 0; font: 700 20px/1.2 var(--font-d); color: var(--ink); }
.trencito .sub { margin: 2px 0 0; font-size: 14px; color: var(--ink-2); }
.trencito .sh-titles h2 { margin: 2px 0 0; font: 700 24px/1.15 var(--font-d); }
.trencito .sh-body, .trencito .rv-body { flex: 1; overflow: auto; padding: 12px 20px 16px; overscroll-behavior: contain; }
.trencito .sh-bar { display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 10px 16px 14px; border-top: 1px solid var(--line); background: var(--cream); }
.trencito .sh-bar .dead { margin: 0; text-align: center; font-size: 14px; font-weight: 700; color: var(--ink-2); }
.trencito .c-close { flex: none; width: 44px; height: 44px; box-shadow: none; background: var(--cream-2); }
.rm.trencito .sheet-panel { transition: opacity .2s ease; transform: none; opacity: 0; }
.rm.trencito .sheet.is-on .sheet-panel { opacity: 1; }

/* ---------- avisos ---------- */
.trencito .toast { position: fixed; left: 50%; top: calc(var(--safe-t) + 74px); z-index: 40; max-width: min(92vw, 400px); padding: 12px 18px; border-radius: 18px; background: var(--cream); color: var(--ink); font: 700 16px/1.3 var(--font-d); text-align: center; box-shadow: var(--shadow); transform: translate(-50%, -12px); opacity: 0; transition: opacity .3s ease, transform .3s ease; pointer-events: none; }
.trencito .toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.trencito .notice { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(58, 42, 34, .4); opacity: 0; transition: opacity .25s ease; pointer-events: auto; }
.trencito .notice.is-on { opacity: 1; }
.trencito .notice-card { width: min(380px, 100%); padding: 22px 20px 18px; border-radius: var(--radius); background: var(--cream); text-align: center; box-shadow: var(--shadow); }
.trencito .notice-card h2 { margin: 8px 0 6px; font: 700 22px/1.2 var(--font-d); }
.trencito .notice-card p { margin: 0 0 10px; color: var(--ink-2); }
.trencito .notice-ic { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: #DDF3E2; color: #2E7D46; }
.trencito .notice-msg { margin: 0 0 14px; padding: 12px; border-radius: 14px; background: #fff; text-align: left; white-space: pre-wrap; font: 600 14px/1.45 var(--font-b); color: var(--ink); max-height: 30dvh; overflow: auto; }
.trencito .notice-card .gbtn { width: 100%; }

/* ---------- visor de fotos ---------- */
.trencito .viewer { position: fixed; inset: 0; z-index: 45; background: rgba(40, 30, 24, .94); opacity: 0; transition: opacity .25s ease; pointer-events: auto; transform: translateY(var(--drag, 0)); }
.trencito .viewer.is-on { opacity: 1; }
.trencito .v-track { display: flex; width: 100%; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.trencito .v-track::-webkit-scrollbar { display: none; }
.trencito .v-slide { flex: 0 0 100%; height: 100%; margin: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 64px 16px 72px; scroll-snap-align: center; }
.trencito .v-frame { max-width: 100%; max-height: calc(100% - 40px); padding: 10px; border-radius: 26px; background: #fff; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); }
.trencito .v-frame img { display: block; max-width: min(92vw, 720px); max-height: calc(100dvh - 190px); border-radius: 18px; object-fit: contain; }
.trencito .v-slide figcaption { color: var(--cream); font: 700 18px/1.2 var(--font-d); }
.trencito .v-count { position: absolute; left: 50%; bottom: calc(var(--safe-b) + 22px); margin: 0; transform: translateX(-50%); color: var(--cream); font-weight: 700; }
.trencito .v-nav { position: absolute; top: 50%; transform: translateY(-50%); }
.trencito .v-prev { left: 12px; } .trencito .v-next { right: 12px; }
.trencito .v-close { position: absolute; top: calc(var(--safe-t) + 12px); right: 12px; }

/* ---------- dentro del marco de escritorio: las alturas que en el celular son de la pantalla son del marco ---------- */
@media (min-width: 560px) and (min-height: 560px) {
  .trencito .sheet-panel { max-height: min(78%, 720px); }
  .trencito .sheet.is-rsvp .sheet-panel { max-height: min(60%, 640px); }
  .trencito .sheet.is-details .sheet-panel { max-height: 92%; }
  .trencito .notice-msg { max-height: 30%; }
  .trencito .v-frame img { max-width: calc(min(430px, 100vw - 32px) - 64px); max-height: calc(min(932px, 100dvh - 40px) - 190px); }
}
