/* KYNERIX APP — a creative space, not a store front: warm paper, a box of bright colours, ink outlines and
   hard shadows like stickers, a soft wonky serif for titles, a rounded sans for text, a handwritten hand
   for little notes, and doodles. Light by default; a night of purple ink when the phone is in dark mode.
   Phone first: a tab bar with a raised «Crear»; from 768 px a side rail and wider grids. */
:root {
  --paper: #fdf6ea; --paper-2: #ffffff; --paper-3: #f7ead6; --grain: rgba(60, 40, 20, .045);
  --text: #2a1f3d; --muted: #6f6684; --edge: #2a1f3d; --soft-edge: rgba(42, 31, 61, .14);
  --coral: #ff6b5b; --sun: #ffc94a; --mint: #36cfa5; --violet: #7c5cff; --sky: #4cb3ff; --pink: #ff8fc7;
  --coral-soft: #ffe1dc; --sun-soft: #fff1c9; --mint-soft: #d5f7ec; --violet-soft: #e7e0ff; --sky-soft: #dbf0ff; --pink-soft: #ffe3f1;
  --on-color: #ffffff; --ok: #12a37b; --bad: #e0404f;
  --font-display: 'Fraunces', Georgia, serif; --font-ui: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif; --font-hand: 'Caveat', 'Comic Sans MS', cursive;
  --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px);
  --radius: 20px; --tabbar: 70px; --pop: 3px 3px 0 var(--edge); --pop-big: 5px 5px 0 var(--edge);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #17122a; --paper-2: #221a3a; --paper-3: #2c2350; --grain: rgba(255, 255, 255, .03);
    --text: #f8efe1; --muted: #b7accc; --edge: #0a0614; --soft-edge: rgba(248, 239, 225, .14);
    --coral-soft: #4a2633; --sun-soft: #4a3d1e; --mint-soft: #173f37; --violet-soft: #2f2560; --sky-soft: #183a55; --pink-soft: #4a2241;
    --pop: 3px 3px 0 #05030b; --pop-big: 5px 5px 0 #05030b;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; color: var(--text); font-family: var(--font-ui); font-size: 15.5px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
/* Paper: a faint dotted grain under everything. */
body { min-height: 100dvh; background: var(--paper); background-image: radial-gradient(var(--grain) 1px, transparent 1.2px); background-size: 14px 14px; -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.1; }
h1 { font-family: var(--font-display); font-size: 36px; font-weight: 800; letter-spacing: -.01em; font-variation-settings: 'SOFT' 100, 'WONK' 1; }
h2 { font-family: var(--font-display); font-size: 28px; font-weight: 800; font-variation-settings: 'SOFT' 100, 'WONK' 1; }
h3 { font-family: var(--font-hand); font-size: 25px; font-weight: 700; color: var(--coral); margin: 20px 0 6px; transform: rotate(-1.5deg); transform-origin: left; }
:focus-visible { outline: 3px solid var(--violet); outline-offset: 2px; }
.i { flex-shrink: 0; }
.faint { color: var(--muted); }
.small { font-size: 13.5px; }
.center { text-align: center; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: 12px; }
.row.end { justify-content: flex-end; }
.row.wrap { flex-wrap: wrap; }
/* Little notes in a handwriting, a touch tilted. */
.eyebrow { margin: 0 0 2px; font-family: var(--font-hand); font-size: 24px; font-weight: 700; line-height: 1; color: var(--coral); transform: rotate(-2deg); transform-origin: left; display: inline-block; }
.lede { margin: 6px 0 0; color: var(--muted); max-width: 60ch; font-size: 16px; }
.boot, .loading { min-height: 50dvh; display: grid; place-items: center; }
.spinner { width: 30px; height: 30px; border-radius: 50%; border: 4px solid var(--sun-soft); border-top-color: var(--coral); border-right-color: var(--violet); animation: spin .8s linear infinite; }
.spinner.sm { width: 18px; height: 18px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- buttons, chips, tags: stickers */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px;
  border-radius: 14px; border: 2px solid var(--edge); background: var(--paper-2); color: var(--text); box-shadow: var(--pop);
  font-weight: 800; text-decoration: none; cursor: pointer; transition: transform .12s ease, box-shadow .12s ease;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--edge); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--edge); }
.btn:disabled { opacity: .5; cursor: default; transform: none; box-shadow: var(--pop); }
.btn.primary { background: var(--coral); color: var(--on-color); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn.ghost:hover { color: var(--text); transform: none; }
.btn.sm { min-height: 38px; padding: 0 12px; font-size: 14px; border-radius: 12px; }
.btn.big { min-height: 54px; padding: 0 26px; font-size: 17px; border-radius: 16px; box-shadow: var(--pop-big); }
.btn.icon-only { padding: 0; width: 38px; }
.btn.danger { background: var(--bad); color: var(--on-color); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 15px; border-radius: 999px; border: 2px solid var(--edge); background: var(--paper-2); font-size: 14.5px; font-weight: 800; cursor: pointer; }
.chip.on { background: var(--sun); color: #2a1f3d; box-shadow: var(--pop); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; border: 1.5px solid var(--edge); background: var(--paper-3); font-size: 12.5px; font-weight: 800; white-space: nowrap; color: var(--text); }
.tag.free { background: var(--mint); color: #12352c; }
.tag.price { background: var(--sun); color: #3a2a00; }
.tag.owned { background: var(--sky-soft); }
.tag.ok { background: var(--mint-soft); color: var(--ok); }
.tag.bad { background: var(--coral-soft); color: var(--bad); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 0; }

/* ---------------------------------------------------------------- shell */
.shell { min-height: 100dvh; }
.main { padding: calc(18px + var(--safe-top)) 16px calc(var(--tabbar) + 30px + var(--safe-bottom)); max-width: 1180px; margin: 0 auto; }
.nav {
  position: fixed; left: 10px; right: 10px; bottom: calc(8px + var(--safe-bottom)); z-index: 20; height: var(--tabbar);
  display: flex; align-items: center; background: var(--paper-2); border: 2px solid var(--edge); border-radius: 24px; box-shadow: var(--pop);
}
.nav-brand { display: none; }
.nav-item { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 800; }
.nav-item.on { color: var(--violet); }
.nav-item.on .i { transform: scale(1.12) rotate(-6deg); transition: transform .2s ease; }
/* «Crear»: the raised round button of the bar. */
.nav-item[href="#/create"] { color: var(--text); }
.nav-item[href="#/create"] .i { box-sizing: content-box; width: 26px; height: 26px; padding: 13px; margin-top: -30px; border-radius: 50%; border: 2px solid var(--edge); background: var(--coral); color: #fff; box-shadow: var(--pop); }
.nav-item[href="#/create"].on .i { background: var(--violet); transform: rotate(-8deg); }
@media (min-width: 768px) {
  .shell { display: grid; grid-template-columns: 236px 1fr; }
  .nav { position: sticky; top: 0; left: auto; right: auto; bottom: auto; height: 100dvh; flex-direction: column; align-items: stretch; gap: 6px; padding: calc(22px + var(--safe-top)) 14px 20px; border: 0; border-right: 2px solid var(--edge); border-radius: 0; box-shadow: none; background: var(--paper-2); }
  .nav-brand { order: -2; display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; text-decoration: none; font-family: var(--font-display); font-size: 27px; font-weight: 800; font-variation-settings: 'SOFT' 100, 'WONK' 1; }
  .nav-brand img { width: 40px; height: 40px; transform: rotate(-6deg); }
  .nav-item { flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 11px 12px; border-radius: 14px; border: 2px solid transparent; font-size: 15.5px; }
  .nav-item.on { background: var(--violet-soft); border-color: var(--edge); color: var(--text); box-shadow: var(--pop); }
  .nav-item[href="#/create"] { order: -1; margin: 0 0 12px; background: var(--coral); color: #fff; border-color: var(--edge); box-shadow: var(--pop); }
  .nav-item[href="#/create"] .i { padding: 0; margin: 0; width: 22px; height: 22px; border: 0; background: none; box-shadow: none; }
  .nav-item[href="#/create"].on { background: var(--violet); color: #fff; }
  .main { padding: calc(30px + var(--safe-top)) 36px 48px; width: 100%; }
}

/* ---------------------------------------------------------------- pages */
.page { display: grid; gap: 22px; }
.page.narrow { max-width: 660px; }
/* Page titles get a hand-drawn underline. */
.page-head { display: grid; justify-items: start; gap: 2px; }
.page-head h1 { display: inline-block; padding-bottom: 8px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 14'%3E%3Cpath d='M3 9c30-6 60-7 95-4s70 4 99-3' fill='none' stroke='%23ff6b5b' stroke-width='5' stroke-linecap='round'/%3E%3C/svg%3E") left bottom / min(100%, 220px) 12px no-repeat; }
.empty { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 44px 16px; color: var(--muted); }
.empty h2 { color: var(--text); }
.empty p { margin: 0; max-width: 40ch; }
.empty-art { width: 84px; height: 84px; border-radius: 26px; display: grid; place-items: center; background: var(--sun); color: #3a2a00; border: 2px solid var(--edge); box-shadow: var(--pop); transform: rotate(-6deg); }

/* A cover: the place where the game starts, framed like a picture card. */
.cover { position: relative; overflow: hidden; background: var(--violet-soft); }
.cover img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.cover-empty { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-size: 64px; font-weight: 800; color: var(--violet); background: repeating-linear-gradient(45deg, var(--violet-soft) 0 12px, var(--sky-soft) 12px 24px); }

/* The grid of games */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (min-width: 600px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; } }
@media (min-width: 1300px) { .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.card { --tint: var(--sky); display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden; background: var(--paper-2); border: 2px solid var(--edge); box-shadow: var(--pop); transition: transform .15s ease, box-shadow .15s ease; }
.card:nth-child(4n+1) { --tint: var(--coral); }
.card:nth-child(4n+2) { --tint: var(--mint); }
.card:nth-child(4n+3) { --tint: var(--violet); }
.card:nth-child(4n+4) { --tint: var(--sun); }
.card:hover { transform: translate(-2px, -3px) rotate(-.6deg); box-shadow: var(--pop-big); }
.card.off { opacity: .6; }
.card .cover { aspect-ratio: 3 / 4; border-bottom: 2px solid var(--edge); }
.card-link { display: block; }
.card-body { display: grid; gap: 6px; padding: 10px 12px 12px; border-top: 6px solid var(--tint); margin-top: -2px; }
.card-title { font-family: var(--font-display); font-size: 19px; font-weight: 800; line-height: 1.15; text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 700; }
.card .btn { margin-top: 4px; }

/* A large banner: what to continue, or what the store features. A sticker star on the corner. */
.hero { position: relative; display: block; min-height: 230px; border-radius: 28px; overflow: hidden; border: 2px solid var(--edge); box-shadow: var(--pop-big); text-decoration: none; color: #fff; }
.hero-bg { position: absolute; inset: 0; }
.hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(124, 92, 255, .05) 0%, rgba(42, 31, 61, .45) 45%, rgba(42, 31, 61, .92) 100%); }
.hero::before { content: '✦'; position: absolute; z-index: 2; top: 12px; right: 14px; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; background: var(--sun); color: #3a2a00; border: 2px solid var(--edge); font-size: 22px; transform: rotate(12deg); box-shadow: 2px 2px 0 var(--edge); }
.hero-body { position: relative; z-index: 1; display: grid; gap: 8px; justify-items: start; padding: 120px 20px 20px; }
.hero-body h2 { color: #fff; font-size: 32px; }
.hero-body p { margin: 0; max-width: 52ch; text-shadow: 0 1px 8px rgba(0, 0, 0, .55); }
.hero-body .clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hero-body h2, .hero-body .eyebrow { text-shadow: 0 2px 12px rgba(0, 0, 0, .6); }
.hero-body .eyebrow { color: var(--sun); }
.hero.link:hover { transform: rotate(-.4deg); }
.hero-bg .cover-empty { display: none; }
@media (min-width: 768px) {
  .hero { min-height: 290px; }
  .hero::after { background: linear-gradient(90deg, rgba(42, 31, 61, .94) 0%, rgba(42, 31, 61, .62) 45%, rgba(124, 92, 255, .08) 80%); }
  .hero-bg img { object-position: 50% 40%; }
  .hero-body { padding: 52px 36px; max-width: 540px; }
}

/* Store filters */
.filters { display: grid; gap: 12px; }
.search { display: flex; align-items: center; gap: 8px; height: 50px; padding: 0 16px; border-radius: 16px; border: 2px solid var(--edge); background: var(--paper-2); color: var(--muted); box-shadow: var(--pop); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 16px; font-weight: 600; }
@media (min-width: 768px) { .filters { grid-template-columns: minmax(240px, 360px) 1fr; align-items: center; } }

/* A game's page */
.page > .back { justify-self: start; margin-left: -8px; }
.detail-grid { display: grid; gap: 22px; }
.detail-cover { aspect-ratio: 4 / 3; border-radius: 26px; border: 2px solid var(--edge); box-shadow: var(--pop-big); transform: rotate(-1deg); }
.detail-body h1 { font-size: 40px; }
.detail-action { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 18px; }
.price-note { color: var(--muted); font-size: 14px; font-weight: 700; }
.blurb { font-size: 18px; font-weight: 700; margin: 0 0 10px; }
.intro { white-space: pre-line; margin: 0; }
.warn { color: var(--bad); margin: 12px 0 0; font-weight: 700; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 22px 0 0; }
.facts div { padding: 12px 14px; border-radius: 16px; background: var(--paper-2); border: 2px dashed var(--soft-edge); }
.facts div:nth-child(3n+1) { background: var(--sun-soft); }
.facts div:nth-child(3n+2) { background: var(--mint-soft); }
.facts div:nth-child(3n) { background: var(--sky-soft); }
.facts dt { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.facts dd { margin: 2px 0 0; font-weight: 800; }
@media (min-width: 900px) {
  .detail-grid { grid-template-columns: minmax(280px, 400px) 1fr; gap: 40px; align-items: start; }
  .detail-cover { aspect-ratio: 3 / 4; position: sticky; top: 30px; }
  .facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Buying: a sheet from the bottom on a phone, a dialog in the middle on larger screens */
.sheet-back { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; background: rgba(42, 31, 61, .45); animation: fade .2s ease; }
.sheet { width: 100%; max-width: 470px; display: grid; gap: 14px; padding: 24px 20px calc(22px + var(--safe-bottom)); border-radius: 28px 28px 0 0; background: var(--paper); border: 2px solid var(--edge); border-bottom: 0; animation: rise .25s ease; }
@media (min-width: 600px) { .sheet-back { align-items: center; } .sheet { border-radius: 28px; border-bottom: 2px solid var(--edge); box-shadow: var(--pop-big); } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }
.cover.mini { width: 58px; height: 74px; border-radius: 12px; flex-shrink: 0; border: 2px solid var(--edge); }

/* Playing: the game fills the screen under a thin bar */
.play { position: fixed; inset: 0; display: flex; flex-direction: column; background: #000; }
.play-bar { display: flex; align-items: center; gap: 8px; height: calc(50px + var(--safe-top)); padding: var(--safe-top) 8px 0; background: var(--paper); border-bottom: 2px solid var(--edge); }
.play-title { flex: 1; min-width: 0; text-align: center; font-family: var(--font-display); font-size: 19px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.play-frame { flex: 1; width: 100%; border: 0; background: #0b1119; }
/* A world on an older version of the game: said under the bar, with «Pasar a la versión nueva» for its owner */
.version-note { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; padding: 8px 10px 8px 14px; background: var(--sun-soft); color: var(--text); border-bottom: 2px solid var(--edge); font-size: 14px; line-height: 1.35; }
.version-note .grow { flex: 1 1 220px; min-width: 0; }

/* Panels (profile, prices, sharing…) */
.panel { padding: 18px 20px; border-radius: 22px; background: var(--paper-2); border: 2px solid var(--edge); box-shadow: var(--pop); }
.panel h3 { margin-top: 0; }
.panel .field { margin-bottom: 4px; }
.panel p { margin: 6px 0; }
.avatar { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; background: var(--pink); color: #3d0f25; border: 2px solid var(--edge); font-family: var(--font-display); font-size: 28px; font-weight: 800; transform: rotate(-5deg); }
.panel.row p { margin: 0; }
.devices { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.devices li { display: flex; align-items: center; gap: 10px; font-weight: 700; }

/* Signing in: a sticker card over blobs of colour */
.login { position: relative; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; overflow: hidden; }
.login-glow { position: absolute; inset: 0; pointer-events: none; opacity: .9;
  background: radial-gradient(circle at 12% 18%, var(--sun) 0 70px, transparent 71px), radial-gradient(circle at 88% 12%, var(--mint) 0 46px, transparent 47px),
    radial-gradient(circle at 92% 78%, var(--coral) 0 90px, transparent 91px), radial-gradient(circle at 8% 88%, var(--violet) 0 56px, transparent 57px),
    radial-gradient(circle at 70% 40%, var(--sky-soft) 0 140px, transparent 141px); }
.login-card { position: relative; width: 100%; max-width: 430px; display: grid; gap: 14px; padding: 30px 24px; border-radius: 30px; background: var(--paper); border: 2px solid var(--edge); box-shadow: 7px 7px 0 var(--edge); transform: rotate(-.6deg); }
.login-logo { width: 64px; height: 64px; transform: rotate(-8deg); }
.login-card h1 { font-size: 36px; }
.login-card .lede { margin: 0 0 6px; }
.login-card p { margin: 0; }
.field { display: grid; gap: 6px; font-size: 14px; font-weight: 800; color: var(--text); }
.field input, .field textarea { padding: 0 14px; border-radius: 14px; border: 2px solid var(--edge); background: var(--paper-2); color: var(--text); font-size: 16px; font-weight: 600; }
.field input { height: 50px; }
.field input:focus, .field textarea:focus { box-shadow: var(--pop); border-color: var(--violet); }
/* The keyboard's focus stays visible on fields too (the mouse's is the border and the shadow). */
.field input:focus-visible, .field textarea:focus-visible { outline: 3px solid var(--violet); outline-offset: 2px; }
.field small { font-weight: 600; }
.form-error { color: var(--bad); font-size: 14px; font-weight: 800; }

/* Toasts: little stickers */
.toasts { position: fixed; left: 50%; bottom: calc(var(--tabbar) + 24px + var(--safe-bottom)); transform: translateX(-50%); z-index: 50; display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { padding: 12px 16px; border-radius: 16px; background: var(--paper-2); border: 2px solid var(--edge); box-shadow: var(--pop); font-weight: 800; animation: pop .3s cubic-bezier(.3, 1.6, .5, 1); }
.toast.ok { background: var(--mint); color: #0f2f27; }
.toast.bad { background: var(--coral); color: #fff; }
@keyframes pop { from { transform: scale(.8) rotate(-3deg); opacity: 0; } }
@media (min-width: 768px) { .toasts { bottom: 26px; } }
body:has(.wiz-foot) .toasts { bottom: calc(var(--tabbar) + 92px + var(--safe-bottom)); }
@media (min-width: 768px) { body:has(.wiz-foot) .toasts { bottom: 96px; } }

/* Confetti (lib/ui.js): a little celebration when something is made, bought or shared */
.confetti { position: fixed; z-index: 60; top: -14px; width: 10px; height: 14px; border: 1.5px solid var(--edge); border-radius: 3px; pointer-events: none; animation: fall 1.7s ease-in forwards; }
@keyframes fall { to { transform: translate(var(--dx), 105vh) rotate(var(--rot)); } }

/* ---------------------------------------------------------------- creating a game */
.make-hero { position: relative; overflow: hidden; display: grid; gap: 10px; justify-items: start; padding: 26px 22px; border-radius: 28px; border: 2px solid var(--edge); box-shadow: var(--pop-big);
  background: radial-gradient(circle at 100% 0%, var(--sun) 0 90px, transparent 91px), radial-gradient(circle at 92% 100%, var(--mint-soft) 0 120px, transparent 121px), var(--pink-soft); }
.make-hero::after { content: ''; position: absolute; right: 18px; top: 22px; width: 70px; height: 70px; pointer-events: none; transform: rotate(14deg);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 70 70'%3E%3Cpath d='M35 4l7 21 22 1-17 13 6 22-18-12-18 12 6-22L6 26l22-1z' fill='%23fff' stroke='%232a1f3d' stroke-width='3' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; }
.make-hero h1, .make-hero p { margin: 0; position: relative; z-index: 1; max-width: 80%; }
.steps { font-family: var(--font-hand); font-size: 21px; font-weight: 700; color: var(--violet); }
.creations { display: grid; gap: 12px; }
/* «Mis juegos»: a creation and, once published, its play button beside it. */
.made { display: grid; gap: 8px; }
.made > .btn { justify-self: end; }
.creation { display: flex; align-items: center; gap: 12px; padding: 13px 15px; border-radius: 20px; background: var(--paper-2); border: 2px solid var(--edge); box-shadow: var(--pop); text-decoration: none; transition: transform .12s ease; }
.creation:hover { transform: translate(-1px, -2px) rotate(-.4deg); }
.creation p { margin: 2px 0 0; }
.creation-art { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; background: var(--sun); color: #3a2a00; border: 2px solid var(--edge); flex-shrink: 0; transform: rotate(-6deg); }
.bar { height: 12px; border-radius: 999px; background: var(--paper-3); border: 2px solid var(--edge); overflow: hidden; margin-top: 8px; }
.bar > div { height: 100%; border-radius: inherit; background: repeating-linear-gradient(-45deg, var(--coral) 0 10px, #ff8a7d 10px 20px); background-size: 28px 28px; transition: width .6s ease; animation: stripes 1s linear infinite; }
@keyframes stripes { to { background-position: 28px 0; } }
.bar.big { height: 18px; margin: 14px 0 8px; }
.file-btn { position: relative; overflow: hidden; margin: 6px 0; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.quote { display: flex; align-items: center; gap: 6px; color: var(--ok); margin: 8px 0 0; font-weight: 800; }
.kinds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 12px 0 16px; }
.kind { display: grid; gap: 4px; text-align: left; padding: 12px 14px; border-radius: 16px; border: 2px solid var(--edge); background: var(--paper-2); cursor: pointer; }
.kind span { font-size: 13px; color: var(--muted); }
.kind.on { background: var(--sun-soft); box-shadow: var(--pop); }
.panel.go { display: grid; gap: 10px; justify-items: start; background: var(--sun-soft); }
.panel.go h3 { margin: 0; font-family: var(--font-display); font-size: 24px; font-weight: 800; color: var(--text); transform: none; }
.panel.free-beta { background: var(--sun-soft); }
.panel.free-beta p { margin: 6px 0 0; max-width: 65ch; }

/* ---------------------------------------------------------------- the guided path */
.wizard { padding-bottom: 96px; }
.wiz-head { display: flex; align-items: center; justify-content: space-between; margin-left: -8px; }
.wiz-head .faint { font-family: var(--font-hand); font-size: 21px; font-weight: 700; color: var(--violet); }
.bar.wiz-bar { margin: -10px 0 0; }
.wiz-body { display: grid; gap: 14px; }
.wiz-body h2 { font-size: 31px; }
.wiz-body .lede { margin: -6px 0 4px; }
.wiz-body h3 { margin: 12px 0 0; }
.wiz-foot {
  position: fixed; left: 10px; right: 10px; bottom: calc(var(--tabbar) + 16px + var(--safe-bottom)); z-index: 15; display: flex; justify-content: space-between; gap: 10px;
  padding: 10px 12px; background: var(--paper-2); border: 2px solid var(--edge); border-radius: 20px; box-shadow: var(--pop);
}
.wiz-foot .btn.primary { min-width: 140px; }
@media (min-width: 768px) { .wiz-foot { left: 260px; right: 24px; bottom: 18px; } }
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.choices.one { grid-template-columns: 1fr; }
.choices.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 420px) { .choices { grid-template-columns: 1fr; } .choices.three { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* Each choice a sticker of its own colour once picked. */
.choice { --pick: var(--sun-soft); display: flex; align-items: flex-start; gap: 12px; padding: 14px; text-align: left; border-radius: 18px; border: 2px solid var(--edge); background: var(--paper-2); cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; }
.choice:nth-child(5n+2) { --pick: var(--mint-soft); }
.choice:nth-child(5n+3) { --pick: var(--sky-soft); }
.choice:nth-child(5n+4) { --pick: var(--pink-soft); }
.choice:nth-child(5n+5) { --pick: var(--violet-soft); }
.choice:hover { transform: translate(-1px, -1px); box-shadow: var(--pop); }
.choice.on { background: var(--pick); box-shadow: var(--pop-big); transform: rotate(-.7deg); }
.choice.on::after { content: '✓'; margin-left: auto; flex-shrink: 0; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--coral); color: #fff; border: 2px solid var(--edge); font-weight: 900; }
.choice-body { display: grid; gap: 4px; min-width: 0; }
.choice-body b { font-size: 16.5px; font-weight: 900; }
.choice-body span { font-size: 14px; color: var(--muted); font-weight: 600; }
.choice-body em { font-family: var(--font-hand); font-size: 21px; font-style: normal; line-height: 1.15; color: var(--violet); }
.choice-icon { width: 52px; height: 52px; flex-shrink: 0; border-radius: 16px; display: grid; place-items: center; background: var(--coral); color: #fff; border: 2px solid var(--edge); transform: rotate(-6deg); }
.choice:nth-child(2) .choice-icon { background: var(--violet); transform: rotate(5deg); }
.choice.pic { flex-direction: column; gap: 10px; }
.style-pic { display: block; width: 100%; aspect-ratio: 600 / 662; border-radius: 12px; border: 2px solid var(--edge); overflow: hidden; }
.style-pic.custom { display: grid; place-items: center; background: repeating-linear-gradient(135deg, var(--paper-2) 0 10px, var(--sun-soft) 10px 20px); color: var(--text); }
.style-pic img, .style-preview img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.style-preview { margin: 6px 0 18px; border: 2.5px solid var(--edge); border-radius: var(--radius); overflow: hidden; box-shadow: var(--pop-big); aspect-ratio: 600 / 662; max-height: 62dvh; position: relative; }
.style-preview figcaption { position: absolute; left: 10px; bottom: 10px; width: fit-content; max-width: calc(100% - 20px); background: var(--paper-2); border: 2px solid var(--edge); border-radius: 12px; padding: 4px 10px; font-size: 13px; line-height: 1.35; }
/* Phones: the chosen style large on top, the others as thumbnails beside their text. */
@media (max-width: 620px) { .choice.pic { flex-direction: row; align-items: center; } .choice.pic .style-pic { width: 104px; flex-shrink: 0; border-radius: 10px; } }
.swatch { width: 48px; height: 48px; flex-shrink: 0; border-radius: 14px; border: 2px solid var(--edge); transform: rotate(-4deg); }
.field textarea { padding: 10px 14px; font-family: var(--font-ui); resize: vertical; }
.field.q span { font-size: 15px; }
/* The story's questions: three lines at least (a phone shows the whole example), growing with the answer. */
textarea.grow-text { min-height: calc(3 * 1.5em + 24px); max-height: 50dvh; line-height: 1.5; field-sizing: content; resize: none; }
/* The story is written on lined paper. */
textarea.story { min-height: 46dvh; padding: 14px 16px; font-family: var(--font-display); font-size: 19px; line-height: 29px; background: var(--paper-2) repeating-linear-gradient(transparent 0 28px, var(--soft-edge) 28px 29px); background-position: 0 13px; }
.meter { display: grid; gap: 6px; }
.meter .bar { margin: 0; }
.ok-text { color: var(--ok); font-weight: 800; }
.tips { background: var(--sky-soft); }
.tips summary { cursor: pointer; font-weight: 900; }
.tips ul { margin: 8px 0 0; padding-left: 22px; display: grid; gap: 6px; }
.ai-help { display: grid; gap: 8px; background: var(--violet-soft); }
.ai-help p { margin: 0; }
.facts.sum { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.next { list-style: none; margin: 10px 0 14px; padding: 0; display: grid; gap: 10px; }
.next a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--paper); border: 2px solid var(--edge); text-decoration: none; color: var(--violet); transition: transform .12s ease; }
.next a:hover { transform: translate(-1px, -1px); box-shadow: var(--pop); }
.next b { display: block; color: var(--text); font-weight: 900; }
.next-n { width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; background: var(--sun); color: #3a2a00; border: 2px solid var(--edge); font-weight: 900; }
.next li:nth-child(2) .next-n { background: var(--mint); }
.next li:nth-child(3) .next-n { background: var(--sky); }
.next li:nth-child(4) .next-n { background: var(--pink); }

/* Sharing a creation */
.panel.share { display: grid; gap: 10px; justify-items: start; background: var(--mint-soft); }
.panel.share h3 { margin: 0; }
.invites { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; width: 100%; }
.invites li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 12px; border-radius: 14px; background: var(--paper-2); border: 2px solid var(--edge); }
.invites li .grow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; }
.invites li b { overflow-wrap: anywhere; }
.invites .confirm { width: 100%; }
.invite .make-hero .intro { white-space: pre-line; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* The tutorial, waiting to be played: a welcome at the top of the library */
.welcome { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 20px; border-radius: 26px; border: 2px solid var(--edge); box-shadow: var(--pop-big);
  background: radial-gradient(circle at 0% 100%, var(--mint-soft) 0 90px, transparent 91px), var(--sun-soft); }
.welcome h2, .welcome p { margin: 0; }
.welcome p:not(.eyebrow) { color: var(--muted); max-width: 48ch; }
.welcome-art { width: 64px; height: 64px; flex-shrink: 0; display: grid; place-items: center; border-radius: 20px; background: var(--violet); color: #fff; border: 2px solid var(--edge); font-size: 30px; transform: rotate(-8deg); box-shadow: var(--pop); }
.tag.tutorial { background: var(--violet); color: #fff; }

/* «Que la IA lo termine todo»: the offer when paying, the upsell on a creation, and its progress */
.finish-offer { display: flex; align-items: flex-start; gap: 14px; width: 100%; padding: 16px; text-align: left; border-radius: 22px; border: 2px solid var(--edge); background: var(--paper-2); box-shadow: var(--pop); cursor: pointer; }
.finish-offer.on { background: linear-gradient(120deg, var(--violet-soft), var(--pink-soft)); box-shadow: var(--pop-big); transform: rotate(-.5deg); }
.finish-offer b { display: block; font-size: 17px; font-weight: 900; }
.finish-offer .grow > span { display: block; font-size: 13.5px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.finish-spark { font-size: 30px; }
.finish-price { font-weight: 900; padding: 3px 10px; border-radius: 999px; background: var(--sun); color: #3a2a00; border: 1.5px solid var(--edge); white-space: nowrap; }
.finish-check { width: 30px; height: 30px; flex-shrink: 0; display: grid; place-items: center; border-radius: 10px; border: 2px solid var(--edge); background: var(--paper-2); font-weight: 900; }
.finish-offer.on .finish-check { background: var(--coral); color: #fff; }
.finish-upsell { display: grid; gap: 10px; justify-items: start; background: linear-gradient(120deg, var(--violet-soft), var(--pink-soft)); }
.finish-upsell h2, .finish-upsell p { margin: 0; }
.finish-progress { display: grid; gap: 8px; background: var(--violet-soft); }
.finish-progress.done { background: var(--mint-soft); }
.finish-progress h2 { margin: 0; }
.finish-steps { margin: 6px 0 0; }
.finish-step { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--paper-2); border: 2px solid var(--soft-edge); }
.finish-steps li.now .finish-step { border-color: var(--edge); box-shadow: var(--pop); }
.finish-steps li.past .next-n { background: var(--mint); }
.finish-steps li:not(.past):not(.now) { opacity: .6; }
.finish-step b { display: block; color: var(--text); }

/* Asking before deleting or removing, in place. */
.confirm { display: grid; gap: 8px; padding: 10px 12px; border-radius: 14px; border: 2px dashed var(--bad); background: var(--coral-soft); }
.confirm p { margin: 0; font-weight: 700; }
.card-body .remove { justify-self: start; min-height: 30px; padding: 0 6px; font-size: 13px; }
/* A creation that failed: why, try again, or the editor. */
.failed-box { display: grid; gap: 8px; margin-top: 10px; }
.failed-box p { margin: 0; }
.editor-link { display: grid; gap: 6px; justify-items: start; margin-top: 8px; }
.editor-link p { margin: 0; max-width: 60ch; }
.manage .row { margin-top: 6px; }
.stats p { margin: 6px 0 0; }
.login-card .consent a, .login-card .field small a { color: inherit; font-weight: 800; }
.dev-note { margin: 0; padding: 8px 12px; border-radius: 12px; border: 1.5px dashed var(--edge); background: var(--sun-soft); color: var(--text); font-weight: 700; }
textarea[name=emails] { width: 100%; }
.stack { display: grid; gap: 10px; }
.sheet:focus { outline: none; } /* the dialog itself takes the focus when it opens; its buttons show theirs */
.row.center { justify-content: center; }

/* Installing the app (no app stores: a PWA): the library's card, and the steps of #/install */
.install-card { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; padding: 14px 16px; border-radius: 22px; border: 2px dashed var(--edge); background: var(--violet-soft); }
.install-card p { margin: 0; flex: 1 1 180px; min-width: 0; font-weight: 800; line-height: 1.35; }
.install-card .row { gap: 6px; margin-left: auto; }
.install-art { width: 46px; height: 46px; flex-shrink: 0; display: grid; place-items: center; border-radius: 14px; background: var(--violet); color: #fff; border: 2px solid var(--edge); box-shadow: var(--pop); transform: rotate(-6deg); }
.install-page .login-card { max-width: 470px; }
.install-page .login-card > .btn { justify-self: stretch; }
.install-steps { list-style: none; margin: 4px 0; padding: 0; display: grid; gap: 10px; }
.install-steps li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; background: var(--paper-2); border: 2px solid var(--edge); box-shadow: var(--pop); }
.install-steps b { display: block; line-height: 1.25; }
.install-steps .grow > span { display: block; font-size: 13.5px; color: var(--muted); }
.install-n { width: 28px; height: 28px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%; background: var(--sun); color: #2a1f3d; border: 2px solid var(--edge); font-weight: 900; font-size: 14px; }
.install-ico { width: 40px; height: 40px; flex-shrink: 0; display: grid; place-items: center; border-radius: 12px; background: var(--sky-soft); color: var(--text); }
.install-note { margin: 0; padding: 10px 12px; border-radius: 14px; border: 2px dashed var(--coral); background: var(--coral-soft); font-weight: 700; }

/* ---------------------------------------------------------------- several games (worlds) of one game */
.worlds-head { display: flex; align-items: center; gap: 14px; }
.worlds-head h1 { margin: 0; font-size: 30px; line-height: 1.1; }
.world-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.world-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 12px 14px; border-radius: 18px; background: var(--paper-2); border: 2px solid var(--edge); box-shadow: var(--pop); }
.world-row .grow { display: grid; gap: 2px; }
.world-row .grow b { overflow-wrap: anywhere; }
.world-icon { width: 42px; height: 42px; flex-shrink: 0; display: grid; place-items: center; border-radius: 14px; border: 2px solid var(--edge); background: var(--sky-soft); transform: rotate(-4deg); }
.world-row.group .world-icon { background: var(--pink-soft); }
.world-row.open .world-icon { background: var(--mint-soft); }
.world-actions { width: 100%; justify-content: flex-end; }
.world-actions .confirm { width: 100%; }
@media (min-width: 560px) { .world-actions { width: auto; margin-left: auto; } .world-actions .confirm { width: auto; } }
.new-world h2 { margin: 0; }
.stepper { display: inline-flex; align-items: center; gap: 12px; }
.stepper-n { min-width: 2.2ch; text-align: center; font-family: var(--font-display); font-size: 30px; font-weight: 800; }
.card .worlds-link { justify-self: start; margin-top: 0; }
.play-title { display: grid; line-height: 1.1; }
.play-title b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.play-world { font-family: var(--font-ui); font-size: 12.5px; font-weight: 700; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.group .make-hero .seats { font-weight: 800; color: var(--text); }
.note-ok { background: var(--mint-soft); font-weight: 800; }
.link-box { padding: 12px; border-radius: 16px; border: 2px dashed var(--soft-edge); background: var(--paper); }
.link-text { display: block; padding: 8px 10px; border-radius: 10px; background: var(--paper-3); font-size: 13px; overflow-wrap: anywhere; user-select: all; }
.group-invite h4 { margin: 8px 0 0; }
.sum-worlds { margin-top: 10px; }
