/* ============================================================
   Central: viñeta de cómic amable.
   Cielo con garabatos, todo con línea de tinta y sombra dura,
   letra Recursive en modo "casual". Pulsar algo se nota: se hunde,
   rebota y suena.
   ============================================================ */

/* Recursive (licencia OFL, incluida en static/fonts): servida desde el propio portal */
@font-face {
  font-family: "Recursive"; font-style: oblique 0deg 15deg; font-display: swap; font-weight: 300 1000;
  src: url("/static/fonts/recursive-latin-ext-full-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Recursive"; font-style: oblique 0deg 15deg; font-display: swap; font-weight: 300 1000;
  src: url("/static/fonts/recursive-latin-full-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --sky: #bfe3ff;
  --sky-2: #e3f3ff;
  --ink: #1b1f3b;
  --ink-soft: #565b7a;
  --paper: #ffffff;
  --paper-2: #f5f7ff;
  --tomato: #ff5d55;
  --tomato-dark: #d93f38;
  --sun: #ffcf3f;
  --mint: #3fd6a6;
  --grape: #8c6cff;
  --line: 3px;
  --shadow: 0 5px 0 var(--ink);
  --shadow-up: 0 8px 0 var(--ink);
  --shadow-down: 0 1px 0 var(--ink);

  --font: "Recursive", ui-rounded, system-ui, -apple-system, "Segoe UI", sans-serif;
  --casual: "CASL" 1, "MONO" 0, "CRSV" 1;
  --semi: "CASL" .5, "MONO" 0, "CRSV" .5;

  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --out: cubic-bezier(.22, 1, .36, 1);
  color-scheme: light;
}

@view-transition { navigation: auto; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body {
  margin: 0; min-height: 100dvh; overflow-x: clip;
  color: var(--ink);
  font: 450 17px/1.5 var(--font);
  font-variation-settings: var(--semi);
  background:
    url("/static/img/doodles.svg") 0 0 / 360px,
    radial-gradient(90vmax 60vmax at 80% -10%, #fff7c9 0%, transparent 55%),
    linear-gradient(180deg, var(--sky) 0%, var(--sky-2) 100%);
  background-color: var(--sky);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; font-variation-settings: inherit; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 3px solid var(--grape); outline-offset: 3px; border-radius: 10px; }
h1, h2, h3, .display { font-variation-settings: var(--casual); }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* viñeta: el bloque base */
.panel {
  background: var(--paper); color: var(--ink);
  border: var(--line) solid var(--ink); border-radius: 22px;
  box-shadow: var(--shadow);
}
.press { transition: transform .18s var(--spring), box-shadow .18s var(--spring); }
.press:hover { transform: translateY(-3px); box-shadow: var(--shadow-up); }
.press:active, .press.pressed { transform: translateY(4px); box-shadow: var(--shadow-down); transition-duration: .06s; }

/* pegatina */
.sticker {
  display: inline-grid; place-items: center; padding: 4px 11px 5px; border-radius: 999px;
  background: var(--sun); color: var(--ink); border: var(--line) solid var(--ink);
  font: 800 13px/1.1 var(--font); font-variation-settings: var(--casual);
  box-shadow: 0 2px 0 var(--ink); transform: rotate(8deg); white-space: nowrap;
}
.sticker.hot { background: var(--tomato); color: #fff; }
@keyframes sticker-in { 0% { transform: scale(0) rotate(-40deg); } 100% { transform: scale(1) rotate(8deg); } }

/* ---------- barra superior ---------- */
.bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 12px max(24px, calc((100% - 1072px) / 2));
  padding-top: max(12px, env(safe-area-inset-top));
}
.bar::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: rgba(227, 243, 255, .86); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: var(--line) solid var(--ink);
  opacity: var(--bar-bg, 0); transition: opacity .2s;
}
.scrolled .bar { --bar-bg: 1; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 40px; height: 40px; flex: none; transition: transform .4s var(--spring); }
.brand:hover .brand-mark { transform: rotate(-10deg) scale(1.08); }
.brand b { font: 800 23px/1 var(--font); font-variation-settings: var(--casual); letter-spacing: -.01em; }
.nav { display: flex; gap: 6px; margin-left: 8px; }
.nav a { padding: 7px 14px; border-radius: 999px; font-weight: 700; font-size: 15.5px; border: var(--line) solid transparent;
  transition: transform .15s var(--spring), background .15s; }
.nav a:hover { background: rgba(255, 255, 255, .6); transform: translateY(-1px); }
.nav a.on { background: var(--paper); border-color: var(--ink); box-shadow: 0 3px 0 var(--ink); }
.bar .spacer { flex: 1; }

.search-trigger {
  display: flex; align-items: center; gap: 10px; min-width: 220px; padding: 8px 8px 8px 14px; cursor: pointer;
  background: var(--paper); border: var(--line) solid var(--ink); border-radius: 999px; box-shadow: 0 3px 0 var(--ink);
  color: var(--ink-soft); font-size: 15px; font-weight: 600;
}
.search-trigger span { flex: 1; text-align: left; }
kbd { font: 700 12px var(--font); border: 2px solid var(--ink); border-radius: 7px; padding: 1px 6px; background: var(--paper-2); color: var(--ink); }
.round-btn {
  width: 42px; height: 42px; flex: none; display: grid; place-items: center; cursor: pointer; padding: 0;
  background: var(--paper); border: var(--line) solid var(--ink); border-radius: 50%; box-shadow: 0 3px 0 var(--ink);
  transition: transform .15s var(--spring), box-shadow .15s var(--spring);
}
.round-btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.round-btn .off { display: none; }
.muted .round-btn.sound .on { display: none; }
.muted .round-btn.sound .off { display: block; }
.mobile-btn { display: none; }

.avatar {
  width: 42px; height: 42px; flex: none; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  background: hsl(var(--h) 85% 72%); color: var(--ink); border: var(--line) solid var(--ink); box-shadow: 0 3px 0 var(--ink);
  font: 800 17px/1 var(--font); font-variation-settings: var(--casual);
  transition: transform .15s var(--spring), box-shadow .15s var(--spring);
}
.avatar:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }

/* ---------- saludo ---------- */
.hello { padding: 26px 0 4px; }
.hello h1 { margin: 0; font: 850 clamp(36px, 6.2vw, 66px)/1.02 var(--font); font-variation-settings: var(--casual); letter-spacing: -.02em; text-wrap: balance; }
.hello h1 .wave { display: inline-block; transform-origin: 70% 80%; animation: wave 2.2s ease-in-out 1 .6s; }
@keyframes wave { 10%, 30% { transform: rotate(16deg); } 20%, 40% { transform: rotate(-8deg); } 50% { transform: none; } }
.hello > p, .hello > div > p { margin: 12px 0 0; color: var(--ink-soft); font-size: 18px; max-width: 54ch; }

/* ---------- secciones ---------- */
.section { margin-top: 42px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.section h2 { margin: 0; font: 800 25px/1.1 var(--font); font-variation-settings: var(--casual); }
.section-head a { font-weight: 700; font-size: 15px; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }

/* ============================================================
   TARJETAS DE APPS
   ============================================================ */
.grid { display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); }
.app {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; min-width: 0; min-height: 176px;
  padding: 18px; border-radius: 24px;
  background: hsl(var(--h) 92% 78%);
  background-image: radial-gradient(rgba(255, 255, 255, .35) 1.2px, transparent 1.6px);
  background-size: 12px 12px;
}
.app:nth-child(3n+1) { border-radius: 24px 20px 26px 22px; }
.app:nth-child(3n+2) { border-radius: 20px 26px 22px 24px; }
.app-icon {
  width: 66px; height: 66px; display: grid; place-items: center; border-radius: 50%;
  background: var(--paper); border: var(--line) solid var(--ink);
  font-size: 36px; line-height: 1; transition: transform .45s var(--spring);
}
.app-icon b { font: 850 28px/1 var(--font); font-variation-settings: var(--casual); }
.app:hover .app-icon { transform: rotate(-12deg) scale(1.1); }
.app-title { font: 800 20px/1.15 var(--font); font-variation-settings: var(--casual); margin-top: 14px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.app-meta { margin-top: 3px; font-size: 14px; font-weight: 600; opacity: .75; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app .sticker { position: absolute; top: -12px; right: -8px; animation: sticker-in .5s var(--spring) both; animation-delay: calc(var(--i, 0) * 60ms + 450ms); }
.app.launching { animation: launch .32s var(--spring) forwards; }
@keyframes launch { 0% { transform: translateY(4px) scale(.97); } 50% { transform: translateY(-8px) scale(1.06) rotate(-1deg); } 100% { transform: scale(1.03); } }

@keyframes bounce-in { 0% { opacity: 0; transform: translateY(26px) scale(.9); } 100% { opacity: 1; transform: none; } }
.grid > * { animation: bounce-in .55s var(--spring) both; animation-delay: calc(var(--i, 0) * 50ms + 80ms); }

/* baldosas anchas */
.tile { position: relative; display: block; grid-column: span 2; min-height: 176px; padding: 22px; border-radius: 26px; overflow: hidden; }
.tile-title { position: relative; z-index: 1; font: 850 27px/1.05 var(--font); font-variation-settings: var(--casual); }
.tile-sub { position: relative; z-index: 1; margin-top: 6px; font-weight: 650; font-size: 15px; }
.tile.cinema { background: var(--ink); color: #fff; }
.tile.cinema .tile-title { color: var(--sun); max-width: calc(100% - 140px); }
.tile.cinema .tile-sub { color: #c9cdf0; max-width: calc(100% - 140px); }
.tile.cinema::before { /* luces de marquesina */
  content: ""; position: absolute; left: 16px; right: 16px; top: 10px; height: 8px;
  background: radial-gradient(circle, var(--sun) 3px, transparent 3.5px) 0 0 / 18px 8px repeat-x;
  animation: marquee 1.2s steps(2) infinite;
}
@keyframes marquee { 50% { opacity: .35; } }
.tile.cinema .toon-rufino { position: absolute; right: 6px; bottom: -32px; width: 150px; transition: transform .35s var(--spring); }
.tile.cinema:hover .toon-rufino { transform: translateY(-10px) rotate(-4deg); }
.tile.locker { background: var(--mint); display: grid; align-content: end; gap: 10px; }
.tile.locker .tile-title { font-size: 25px; }
.tile.locker .big-emoji { position: absolute; right: 18px; top: 14px; font-size: 54px; transform: rotate(8deg); transition: transform .4s var(--spring); }
.tile.locker:hover .big-emoji { transform: rotate(-6deg) scale(1.1); }
.tile.locker .sticker { position: absolute; top: 18px; right: 84px; }
.meter { height: 16px; border-radius: 999px; background: var(--paper); border: var(--line) solid var(--ink); overflow: hidden; }
.meter i { display: block; height: 100%; min-width: 6px; border-right: var(--line) solid var(--ink);
  background: repeating-linear-gradient(-45deg, var(--sun) 0 8px, #ffbf1f 8px 16px); transition: width .8s var(--out); }
.meter.full i { background: repeating-linear-gradient(-45deg, var(--tomato) 0 8px, var(--tomato-dark) 8px 16px); }

/* ---------- carriles ---------- */
.rail {
  display: grid; grid-auto-flow: column; gap: 22px;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scroll-padding: 0 24px;
  margin: 0 -24px; padding: 10px 24px 22px; scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail > * { scroll-snap-align: start; }
.watch { grid-auto-columns: minmax(290px, 340px); }
.show { display: block; padding: 10px; border-radius: 22px; position: relative; }
.show-art { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 14px; border: var(--line) solid var(--ink); background: var(--grape); }
.show-art img, .poster-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.fallback { position: absolute; inset: 0; display: grid; place-items: center; padding: 12px; text-align: center; color: #fff;
  font: 800 19px/1.15 var(--font); font-variation-settings: var(--casual);
  background: linear-gradient(135deg, hsl(var(--h, 260) 70% 60%), hsl(calc(var(--h, 260) + 50) 75% 50%)); }
.play { position: absolute; left: 12px; bottom: 16px; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: var(--sun); border: var(--line) solid var(--ink); box-shadow: 0 3px 0 var(--ink); transition: transform .3s var(--spring); }
.show:hover .play { transform: scale(1.15) rotate(-8deg); }
.progress { position: absolute; left: 0; right: 0; bottom: 0; height: 8px; background: rgba(27, 31, 59, .55); }
.progress i { display: block; height: 100%; background: var(--tomato); }
.show-caption { padding: 10px 4px 2px; }
.show-caption strong { display: block; font-weight: 800; font-size: 17px; line-height: 1.25; font-variation-settings: var(--casual); }
.show-caption span { color: var(--ink-soft); font-size: 14px; font-weight: 600; }
.show .sticker, .poster .sticker { position: absolute; top: -10px; right: -6px; z-index: 2; }

.posters { grid-auto-columns: 152px; }
.poster { display: block; position: relative; transition: transform .3s var(--spring); }
.poster:hover { transform: translateY(-6px) rotate(-2deg); }
.poster-art { position: relative; aspect-ratio: 2 / 3; overflow: hidden; border-radius: 16px; border: var(--line) solid var(--ink); box-shadow: var(--shadow); background: var(--grape); }
.poster strong { display: block; margin-top: 10px; font-size: 15px; font-weight: 800; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.poster span { color: var(--ink-soft); font-size: 13px; font-weight: 600; }

.leaving { display: flex; flex-wrap: wrap; gap: 10px; }
.leaving li { list-style: none; display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; border-radius: 999px; font-weight: 700; font-size: 15px; }
.leaving .days { display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 6px; border-radius: 999px; background: var(--tomato); color: #fff; border: var(--line) solid var(--ink); font-weight: 850; }
.leaving ul { margin: 0; padding: 0; display: contents; }

/* ---------- barra inferior (móvil) ---------- */
.tabbar { display: none; }
.show-m, .mobile-only { display: none; }

/* ---------- diálogos ---------- */
dialog { border: 0; padding: 0; color: var(--ink); background: transparent; max-width: none; max-height: none; overflow: visible; }
dialog::backdrop { background: rgba(27, 31, 59, .35); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.sheet { width: min(540px, calc(100vw - 32px)); margin: 12vh auto auto; overflow: hidden; }
dialog[open] .sheet { animation: pop .38s var(--spring); }
@keyframes pop { from { opacity: 0; transform: scale(.85) translateY(10px); } }
.grabber { display: none; }
.sheet-head { padding: 20px 22px 4px; }
.sheet-head h3 { margin: 0; font: 800 22px/1.15 var(--font); }
.sheet-head p { margin: 4px 0 0; color: var(--ink-soft); font-size: 15px; font-weight: 600; word-break: break-word; }
.sheet-body { padding: 12px 22px 22px; }
.sheet-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

.pal-input { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: var(--line) solid var(--ink); }
.pal-input input[type=text] { flex: 1; border: 0; outline: 0; background: transparent; color: var(--ink); padding: 0; box-shadow: none; font: 700 20px var(--font); }
.pal-list { list-style: none; margin: 0; padding: 8px; max-height: min(52vh, 440px); overflow: auto; }
.pal-list a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 14px; font-weight: 700; border: var(--line) solid transparent; }
.pal-list a[aria-selected="true"] { background: var(--sky-2); border-color: var(--ink); }
.pal-list .mini { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-size: 19px; flex: none;
  background: hsl(var(--h) 92% 78%); border: var(--line) solid var(--ink); font-weight: 850; }
.pal-list .hint { margin-left: auto; color: var(--ink-soft); font-size: 13px; font-weight: 600; }
.pal-empty { padding: 22px; text-align: center; color: var(--ink-soft); font-weight: 600; }

.me { padding: 26px 22px 22px; text-align: center; }
.me .avatar { width: 84px; height: 84px; font-size: 36px; margin: 0 auto 12px; cursor: default; box-shadow: var(--shadow); }
.me h3 { margin: 0; font: 850 26px/1.1 var(--font); font-variation-settings: var(--casual); }
.me p { margin: 4px 0 18px; color: var(--ink-soft); font-weight: 600; }
.me-actions { display: grid; gap: 10px; }

/* ---------- botones ---------- */
.btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 14px; border: var(--line) solid var(--ink); background: var(--paper); color: var(--ink);
  font: 750 16px var(--font); font-variation-settings: var(--casual); cursor: pointer; box-shadow: 0 4px 0 var(--ink);
  transition: transform .15s var(--spring), box-shadow .15s var(--spring), background .15s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--ink); }
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--ink); transition-duration: .05s; }
.btn.small { padding: 6px 12px; font-size: 14px; border-radius: 11px; box-shadow: 0 3px 0 var(--ink); }
.btn.primary { background: var(--tomato); color: #fff; }
.btn.sunny { background: var(--sun); }
.btn.danger { color: var(--tomato-dark); }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ---------- formularios ---------- */
.field { margin-bottom: 16px; }
.field label, .label { display: block; margin: 0 0 6px; font-size: 14.5px; font-weight: 700; color: var(--ink-soft); }
input[type=text], input[type=password], input[type=date], select {
  width: 100%; padding: 11px 14px; border: var(--line) solid var(--ink); border-radius: 14px; background: var(--paper);
  color: var(--ink); font: 600 17px var(--font); box-shadow: inset 0 3px 0 rgba(27, 31, 59, .06);
}
input:focus, select:focus { outline: 0; box-shadow: 0 0 0 4px var(--sun); }
input[type=file] { width: 100%; color: var(--ink-soft); font: 600 15px var(--font); }
input[type=file]::file-selector-button { margin-right: 12px; padding: 8px 14px; border: var(--line) solid var(--ink); border-radius: 12px; background: var(--sun); color: var(--ink); font: 750 14px var(--font); cursor: pointer; box-shadow: 0 3px 0 var(--ink); }
input[type=checkbox].toggle { appearance: none; width: 50px; height: 30px; border-radius: 999px; border: var(--line) solid var(--ink); background: var(--paper-2); position: relative; cursor: pointer; flex: none; transition: background .2s; vertical-align: middle; }
input[type=checkbox].toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); transition: transform .3s var(--spring); }
input[type=checkbox].toggle:checked { background: var(--mint); }
input[type=checkbox].toggle:checked::after { transform: translateX(20px); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 700; cursor: pointer; margin: 0; }

.notice { padding: 12px 16px; border-radius: 16px; font-weight: 700; margin: 0 0 16px; border: var(--line) solid var(--ink); box-shadow: 0 3px 0 var(--ink); }
.notice.ok { background: #c9f5e6; }
.notice.err { background: #ffd6d3; }

/* ---------- login ---------- */
.login-page { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px 16px; }
.login-card { width: 100%; max-width: 420px; padding: 28px; position: relative; }
.login-card h1 { margin: 0 0 4px; font: 850 34px/1.05 var(--font); font-variation-settings: var(--casual); }
.login-card .lead { color: var(--ink-soft); margin: 0 0 20px; font-weight: 600; }
.login-card .btn { width: 100%; padding: 14px; font-size: 18px; margin-top: 6px; }
.login-card.checking .btn { pointer-events: none; }
.login-card.checking .btn span::after { content: "…"; }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-8px); } 40%, 60% { transform: translateX(8px); }
}
.shake { animation: shake .45s both .2s; }

/* ============================================================
   MIS ARCHIVOS
   ============================================================ */
.files-top { display: grid; grid-template-columns: 1fr 360px; gap: 24px; align-items: end; }
.files-side { display: grid; gap: 16px; }
.capacity { padding: 16px 18px; }
.capacity .label { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; color: var(--ink); }
.tabs { display: flex; gap: 8px; margin: 30px 0 14px; }
.tabs button { padding: 9px 18px; border: var(--line) solid var(--ink); border-radius: 999px; cursor: pointer; background: rgba(255, 255, 255, .55);
  font: 750 16px var(--font); font-variation-settings: var(--casual); transition: transform .2s var(--spring), box-shadow .2s var(--spring); }
.tabs button[aria-selected="true"] { background: var(--paper); box-shadow: 0 4px 0 var(--ink); transform: translateY(-2px); }
.tabs .badge { margin-left: 6px; }
.drawer-panel { padding: 16px; min-height: 240px; }

.dropzone { display: flex; align-items: center; justify-content: center; gap: 14px; width: 100%; padding: 22px; cursor: pointer;
  border: var(--line) dashed var(--ink); border-radius: 18px; background: var(--paper-2); color: var(--ink);
  font: 750 16px var(--font); font-variation-settings: var(--casual); transition: background .15s, transform .25s var(--spring); }
.dropzone:hover { background: #fff6d6; }
.dropzone.over { background: #fff1b8; transform: scale(1.02) rotate(-.5deg); }
.dropzone svg { flex: none; transition: transform .35s var(--spring); }
.dropzone:hover svg, .dropzone.over svg { transform: translateY(-4px); }

.cards { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 12px; }
.card { position: relative; display: grid; grid-template-columns: 50px 1fr auto; align-items: center; gap: 2px 14px;
  padding: 11px 12px; border-radius: 18px; background: var(--paper); border: var(--line) solid var(--ink); box-shadow: 0 3px 0 var(--ink);
  transition: transform .2s var(--spring), box-shadow .2s var(--spring); }
.card:hover { transform: translateY(-2px) rotate(-.3deg); box-shadow: 0 5px 0 var(--ink); }
.card .kind { grid-row: 1 / span 2; width: 50px; height: 50px; display: grid; place-items: center; font-size: 26px; border-radius: 14px;
  background: var(--sky-2); border: var(--line) solid var(--ink); overflow: hidden; }
.card .kind img { width: 100%; height: 100%; object-fit: cover; }
.card .name { min-width: 0; font-weight: 800; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .name a:hover { text-decoration: underline; }
.card .meta { grid-column: 2; font-size: 13.5px; color: var(--ink-soft); font-weight: 600; display: flex; gap: 4px 10px; flex-wrap: wrap; align-items: center; }
.who { display: inline-flex; vertical-align: middle; }
.who span { width: 24px; height: 24px; border-radius: 50%; margin-left: -6px; border: 2px solid var(--ink); display: grid; place-items: center;
  background: hsl(var(--h) 85% 72%); font: 800 11px/1 var(--font); }
.who span:first-child { margin-left: 0; }
.card .actions { grid-row: 1 / span 2; grid-column: 3; display: flex; gap: 4px; }
.iconbtn { width: 40px; height: 40px; border: var(--line) solid transparent; border-radius: 12px; display: grid; place-items: center; cursor: pointer;
  background: transparent; color: var(--ink); transition: background .15s, transform .15s var(--spring), border-color .15s; }
.iconbtn:hover { background: var(--sky-2); border-color: var(--ink); }
.iconbtn:active { transform: scale(.86); }
.iconbtn.danger:hover { background: #ffd6d3; }
.card .uploading { grid-column: 2 / -1; height: 12px; border-radius: 999px; background: var(--paper-2); border: 2px solid var(--ink); overflow: hidden; margin-top: 4px; }
.card .uploading i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(-45deg, var(--mint) 0 8px, #2bbd8f 8px 16px); transition: width .15s;
  animation: stripes .6s linear infinite; background-size: 22px 22px; }
@keyframes stripes { to { background-position: 22px 0; } }
.card > .sticker { position: absolute; right: 70px; top: -10px; animation: sticker-in .45s var(--spring) both; }
.card.error { background: #ffe9e7; }
.card.error .meta { color: var(--tomato-dark); font-weight: 750; }
.files-empty { padding: 30px 10px 14px; text-align: center; color: var(--ink-soft); font-weight: 600; }
.files-empty b { display: block; font: 850 22px/1.2 var(--font); font-variation-settings: var(--casual); color: var(--ink); margin-bottom: 6px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; margin: 0; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-flex; align-items: center; gap: 8px; padding: 5px 13px 5px 5px; border-radius: 999px; background: var(--paper);
  border: var(--line) solid var(--ink); font-weight: 750; font-size: 15px; box-shadow: 0 3px 0 var(--ink);
  transition: transform .2s var(--spring), background .15s, box-shadow .2s var(--spring); }
.chip span i { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font: 800 12px/1 var(--font); font-style: normal;
  background: hsl(var(--h, 200) 85% 72%); border: 2px solid var(--ink); }
.chip input:checked + span { background: var(--sun); transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.chip input:focus-visible + span { outline: 3px solid var(--grape); outline-offset: 2px; }
.chip.plain span { padding: 6px 13px; }

.badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  background: var(--tomato); color: #fff; border: 2px solid var(--ink); font: 800 12px/1 var(--font); }

.toast { position: fixed; left: 50%; bottom: 28px; z-index: 101; transform: translate(-50%, 180%); padding: 12px 18px; font-weight: 750;
  transition: transform .45s var(--spring); white-space: nowrap; border-radius: 999px; }
.toast.show { transform: translate(-50%, 0); }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 100; }

/* ============================================================
   ADMINISTRAR
   ============================================================ */
.jump { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
code { font: 600 .9em ui-monospace, Menlo, monospace; background: rgba(27, 31, 59, .08); padding: 1px 6px; border-radius: 6px; }
.hint { color: var(--ink-soft); font-size: 14px; font-weight: 600; margin: 8px 0 6px; }
.link { font-weight: 750; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.box { margin-bottom: 14px; overflow: hidden; }
.box summary { list-style: none; display: flex; align-items: center; gap: 14px; padding: 14px 16px; cursor: pointer; user-select: none; }
.box summary::-webkit-details-marker { display: none; }
.box .mini { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; flex: none;
  background: hsl(var(--h) 92% 78%); border: var(--line) solid var(--ink); font-weight: 850; }
.box-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.box-title strong { font-size: 17px; font-weight: 800; }
.box-title span { color: var(--ink-soft); font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.box-title .warn { color: var(--tomato-dark); }
.chev { width: 11px; height: 11px; border-right: 3px solid var(--ink); border-bottom: 3px solid var(--ink); transform: rotate(45deg); transition: transform .3s var(--spring); margin-right: 6px; flex: none; }
.box[open] .chev { transform: rotate(-135deg); }
.box-body { padding: 12px 18px 20px; border-top: var(--line) solid var(--ink); background: var(--paper-2); }
.box[open] .box-body { animation: pop .3s var(--out); }
.box.add summary { font: 800 19px var(--font); font-variation-settings: var(--casual); }
.box.add .plus { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--tomato); color: #fff;
  border: var(--line) solid var(--ink); font: 800 26px/1 var(--font); transition: transform .35s var(--spring); flex: none; }
.box.add[open] .plus { transform: rotate(135deg); }
.grid3 { display: grid; grid-template-columns: 2fr 2fr 96px; gap: 0 16px; }
.slug-input { display: flex; align-items: center; border: var(--line) solid var(--ink); border-radius: 14px; background: var(--paper); padding-left: 12px; }
.slug-input span { color: var(--ink-soft); font-weight: 700; }
.slug-input input { border: 0 !important; box-shadow: none !important; padding-left: 2px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { position: relative; cursor: pointer; margin: 0; }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: hsl(var(--h) 92% 78%); border: var(--line) solid var(--ink);
  transition: transform .25s var(--spring); }
.swatch span.auto { width: auto; padding: 0 10px; border-radius: 999px; font-size: 13px; font-weight: 750; background: var(--paper); }
.swatch input:checked + span { transform: scale(1.18) rotate(-8deg); box-shadow: 0 0 0 3px var(--sun); }
.swatch input:focus-visible + span { outline: 3px solid var(--grape); outline-offset: 2px; }
.danger-zone { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; padding-top: 14px; border-top: 2px dashed rgba(27, 31, 59, .25); }
.danger-zone form { margin: 0; }

.sheet-plain { padding: 20px; }
.row { display: grid; grid-template-columns: 1.3fr 2fr 140px; gap: 6px 18px; align-items: center; padding: 12px 0; border-bottom: 2px dashed rgba(27, 31, 59, .18); }
.row:last-of-type { border-bottom: 0; }
.row .who-n { display: flex; align-items: center; gap: 10px; font-weight: 800; min-width: 0; }
.row .who-n i { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font: 800 13px/1 var(--font); font-style: normal;
  background: hsl(var(--h) 85% 72%); border: 2px solid var(--ink); flex: none; }
.row small { display: block; color: var(--ink-soft); font-size: 13px; font-weight: 600; margin-top: 4px; }
.row .meter { height: 12px; }
.gb { display: flex; align-items: center; gap: 6px; }
.gb input { text-align: right; padding: 8px 10px; }
.gb span { color: var(--ink-soft); font-weight: 700; }

/* biblioteca */
.lib-top { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: start; }
.lib-meter { height: 26px; border-radius: 999px; border: var(--line) solid var(--ink); background: var(--paper); overflow: hidden; display: flex; }
.lib-meter i { display: block; height: 100%; }
.lib-meter .m-used { background: repeating-linear-gradient(-45deg, var(--grape) 0 9px, #7656f2 9px 18px); border-right: var(--line) solid var(--ink); }
.lib-meter .m-room { background: #e6defd; }
.lib-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 14px; font-weight: 650; color: var(--ink-soft); }
.lib-legend b { color: var(--ink); }
.lib-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.lib-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; align-items: center; padding: 12px 14px; border-radius: 16px;
  background: var(--paper); border: var(--line) solid var(--ink); box-shadow: 0 3px 0 var(--ink); }
.lib-item .t { min-width: 0; }
.lib-item .t strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; }
.lib-item .t span { color: var(--ink-soft); font-size: 13.5px; font-weight: 600; }
.lib-item .countdown { display: inline-grid; place-items: center; padding: 3px 10px; border-radius: 999px; border: 2px solid var(--ink); font-weight: 800; font-size: 13px; background: var(--paper-2); }
.lib-item .countdown.soon { background: var(--tomato); color: #fff; }
.lib-item .countdown.never { background: var(--mint); }
.lib-item form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; margin: 0; }
.lib-item input[type=date] { width: auto; padding: 6px 10px; font-size: 15px; }
.lib-item .check { font-size: 14px; }
.lib-log { list-style: none; margin: 8px 0 0; padding: 0; font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.lib-log li { padding: 4px 0; }

/* ============================================================
   ELENCO: personajes con bocadillo (se pueden tocar)
   ============================================================ */
.cameo { --size: 150px; display: flex; align-items: flex-end; gap: 14px; }
.toon-btn { flex: none; width: var(--size); padding: 0; border: 0; background: none; cursor: pointer; border-radius: 16px; }
.toon { display: block; width: 100%; height: auto; overflow: visible; transform-origin: 50% 100%; }
.toon .m-happy, .toon .m-angry { display: none; }
.toon.happy .m-normal, .toon.angry .m-normal { display: none; }
.toon.happy .m-happy, .toon.angry .m-angry { display: inline; }
.toon .eyes { transform-box: fill-box; transform-origin: center; animation: blink 5s infinite; }
.toon-tano .eyes { animation-delay: 1.3s; } .toon-pura .eyes { animation-delay: 2.6s; } .toon-rufino .eyes { animation-delay: .7s; }
@keyframes blink { 0%, 93%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.08); } }
.toon .steam { animation: steam 2.4s ease-in-out infinite; }
@keyframes steam { 50% { transform: translateY(-4px); opacity: .25; } }
.cameo .toon { animation: idle 4s ease-in-out infinite; }
@keyframes idle { 50% { transform: translateY(-3px) rotate(-1deg); } }
.cameo.hop .toon { animation: hop .5s var(--spring); }
@keyframes hop { 30% { transform: translateY(-16px) rotate(-5deg) scale(1.05); } 60% { transform: translateY(2px) scale(1.04, .96); } }
.toon.angry { animation: fume .35s linear 3 !important; }
@keyframes fume { 25% { transform: translateX(-3px) rotate(-2deg); } 75% { transform: translateX(3px) rotate(2deg); } }

.bubble { position: relative; flex: 0 1 auto; max-width: 340px; margin: 0 0 calc(var(--size) * .42); padding: 11px 16px 12px;
  background: var(--paper); color: var(--ink); border: var(--line) solid var(--ink); border-radius: 22px; box-shadow: 0 4px 0 var(--ink);
  font-size: 15.5px; font-weight: 600; line-height: 1.4; transform-origin: 0 100%; animation: bubble-in .5s var(--spring) both .3s; }
.bubble::before, .bubble::after { content: ""; position: absolute; bottom: 18px; border-style: solid; }
.bubble::before { left: -16px; border-width: 9px 16px 9px 0; border-color: transparent var(--ink) transparent transparent; }
.bubble::after { left: -10px; border-width: 6px 11px 6px 0; border-color: transparent var(--paper) transparent transparent; margin-bottom: 3px; }
.bubble .who { display: block; margin-bottom: 1px; font: 800 13px/1.3 var(--font); font-variation-settings: var(--casual); color: var(--tomato-dark); }
.bubble .say::after { content: ""; display: inline-block; width: .5em; height: 1em; margin-left: 2px; vertical-align: -2px; background: currentColor; opacity: 0; border-radius: 2px; }
.bubble.typing .say::after { opacity: .6; animation: caret .6s steps(2) infinite; }
@keyframes caret { 50% { opacity: 0; } }
@keyframes bubble-in { from { opacity: 0; transform: scale(.3) rotate(-8deg); } }
.cameo .toon-btn { animation: peek .65s var(--spring) both .1s; }
@keyframes peek { from { opacity: 0; transform: translateY(34px) scale(.85); } }

.hello.with-cameo { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px 26px; }
.hello.with-cameo .cameo { grid-column: 2; grid-row: 1 / span 3; flex-direction: row-reverse; }
.hello.with-cameo .bubble { transform-origin: 100% 100%; }
.hello.with-cameo .bubble::before { left: auto; right: -16px; border-width: 9px 0 9px 16px; border-color: transparent transparent transparent var(--ink); }
.hello.with-cameo .bubble::after { left: auto; right: -10px; border-width: 6px 0 6px 11px; border-color: transparent transparent transparent var(--paper); }
.hello .bubble { font-size: 15.5px; margin: 0 0 calc(var(--size) * .42); max-width: 320px; color: var(--ink); }
.section-cameo { margin: -4px 0 22px; }
.login-page .cameo { --size: 124px; margin-bottom: -16px; position: relative; z-index: 2; width: 100%; max-width: 420px; }
.files-side .cameo { --size: 108px; }

/* ============================================================
   MÓVIL
   ============================================================ */
@media (max-width: 720px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
  .bar { padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); }
  .desktop-only { display: none !important; }
  .mobile-btn { display: grid; }
  .mobile-only { display: inline; }
  body.has-tabbar { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .brand b { font-size: 21px; }
  .hello { padding-top: 14px; }
  .section { margin-top: 32px; }
  .section h2 { font-size: 22px; }

  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .app { min-height: 150px; padding: 14px; border-radius: 22px; }
  .app-icon { width: 56px; height: 56px; font-size: 30px; }
  .app-title { font-size: 17px; margin-top: 10px; }
  .app-meta { display: none; }
  .tile { grid-column: 1 / -1; min-height: 132px; padding: 18px; }
  .tile.cinema .toon-rufino { width: 116px; bottom: -26px; }
  .tile.cinema .tile-title, .tile.cinema .tile-sub { max-width: calc(100% - 106px); }
  .tile-title { font-size: 23px; }

  .rail { margin: 0 -16px; padding: 10px 16px 20px; scroll-padding: 0 16px; gap: 16px; }
  .watch { grid-auto-columns: 80vw; }
  .posters { grid-auto-columns: 34vw; }

  .tabbar {
    display: grid; grid-template-columns: repeat(4, 1fr);
    position: fixed; left: 12px; right: 12px; z-index: 30; bottom: max(12px, env(safe-area-inset-bottom));
    padding: 6px; border-radius: 24px; background: var(--paper); border: var(--line) solid var(--ink); box-shadow: 0 5px 0 var(--ink);
  }
  .tabbar a, .tabbar button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 0 5px;
    border: 0; background: none; border-radius: 18px; cursor: pointer; font: 750 12px var(--font); color: var(--ink-soft); transition: transform .2s var(--spring); }
  .tabbar .on { color: var(--ink); background: var(--sun); }
  .tabbar a:active, .tabbar button:active { transform: scale(.85); }
  .tabbar .tab-avatar { width: 26px; height: 26px; font-size: 12px; border-width: 2px; box-shadow: none; cursor: inherit; }
  .tabbar .badge { position: absolute; top: 0; left: 56%; }

  .sheet { width: 100vw; margin: auto 0 0; border-radius: 26px 26px 0 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom); }
  dialog { width: 100vw; height: 100dvh; }
  dialog[open] { display: flex; }
  dialog[open] .sheet { animation: rise .42s var(--spring); }
  @keyframes rise { from { transform: translateY(100%); } }
  .grabber { display: block; width: 46px; height: 6px; border-radius: 3px; background: var(--ink); opacity: .25; margin: 10px auto 0; }
  .pal-list { max-height: 55dvh; }

  .cameo { --size: 96px; gap: 12px; }
  .bubble, .hello .bubble { font-size: 14.5px; padding: 9px 13px 10px; margin-bottom: calc(var(--size) * .36); }
  .hello.with-cameo { grid-template-columns: 1fr; }
  .hello.with-cameo .cameo { grid-column: 1; grid-row: auto; flex-direction: row; margin-top: 12px; }
  .hello.with-cameo .bubble { transform-origin: 0 100%; }
  .hello.with-cameo .bubble::before { right: auto; left: -16px; border-width: 9px 16px 9px 0; border-color: transparent var(--ink) transparent transparent; }
  .hello.with-cameo .bubble::after { right: auto; left: -10px; border-width: 6px 11px 6px 0; border-color: transparent var(--paper) transparent transparent; }
  .login-page .cameo { --size: 100px; }
  .files-side .cameo { --size: 88px; }

  .files-top { grid-template-columns: 1fr; gap: 14px; }
  .tabs { margin-top: 22px; }
  .tabs button { padding: 8px 14px; font-size: 15px; white-space: nowrap; }
  .drawer-panel { padding: 12px; }
  .card { grid-template-columns: 44px 1fr auto; padding: 10px; gap: 2px 10px; }
  .card .kind { width: 44px; height: 44px; }
  .card .actions .hide-m { display: none; }
  .card .actions .show-m { display: grid; }
  .card > .sticker { right: 50px; }
  .grid3 { grid-template-columns: 1fr 86px; }
  .grid3 > :nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .row { grid-template-columns: 1fr 120px; }
  .row .use { grid-column: 1 / -1; grid-row: 2; }
  .lib-top { grid-template-columns: 1fr; }
  .lib-item { grid-template-columns: 1fr; }
  .lib-item form { justify-content: flex-start; }
  .box-body .btn.primary { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0s !important; }
  @view-transition { navigation: none; }
}
