/* Web app de Memora: invitados (unirse y subir) y anfitriones (ver, editar, descargar). */
body { min-height: 100dvh; }
#view { min-height: 100dvh; }
.center { min-height: 100dvh; display: grid; place-items: center; padding: 32px 16px; background: var(--soft); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--blue); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Barra superior */
.top { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 62px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; font-weight: 600; font-size: 19px; letter-spacing: -.03em; }
.brand img { width: 28px; height: 28px; }
.me { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--blue-50) center/cover; color: var(--blue); display: grid; place-items: center; font-weight: 600; font-size: 14px; flex: none; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); display: grid; place-items: center; cursor: pointer; color: var(--ink-2); text-decoration: none; }
.icon-btn:hover { color: var(--ink); border-color: var(--muted); }
.icon-btn svg, .btn svg { width: 18px; height: 18px; }

/* Tarjetas */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); }
.sheet { width: min(440px, 100%); padding: 36px 30px 30px; text-align: center; }
.sheet .logo { height: 34px; width: auto; margin: 0 auto 26px; }
.sheet h1 { font-size: 26px; line-height: 1.15; letter-spacing: -.035em; font-weight: 600; margin: 10px 0 8px; }
.sheet p.lead { color: var(--muted); margin: 0 0 26px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.hint { font-size: 13px; color: var(--muted); margin: 4px 0 0; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 18px 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.btn-social { background: var(--card); border-color: var(--line); color: var(--ink); font-weight: 500; }
.btn-social:hover { border-color: var(--muted); }
.btn-social svg { width: 20px; height: 20px; }
.btn-apple { background: #000; color: #fff; }
:root[data-theme="dark"] .btn-apple { background: #fff; color: #000; }
.gate-art { width: 84px; height: 84px; border-radius: 26px; margin: 0 auto 22px; background: var(--blue-50); color: var(--blue); display: grid; place-items: center; }
.gate-art svg { width: 40px; height: 40px; }

/* Formularios */
form.fields { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; font-weight: 500; color: var(--ink-2); }
.field input, .field textarea, .field select {
  width: 100%; min-height: 50px; padding: 12px 16px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--soft); font-size: 16px; font-weight: 400; color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--blue); box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue) 18%, transparent); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--soft); font-size: 15px; cursor: pointer; }
.switch input { appearance: none; width: 46px; height: 28px; border-radius: 99px; background: var(--line); position: relative; flex: none; cursor: pointer; transition: background .2s; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked { background: var(--blue); }
.switch input:checked::after { transform: translateX(18px); }
.link { background: none; border: 0; padding: 0; color: var(--blue); cursor: pointer; font-size: 14px; text-decoration: none; }
.link b { font-weight: 600; }
.msg { padding: 12px 14px; border-radius: 12px; font-size: 14px; text-align: left; }
.msg.error { background: color-mix(in srgb, var(--error) 12%, transparent); color: var(--error); }
.msg.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.msg.info { background: var(--blue-50); color: var(--blue); }
.legal { font-size: 12px; color: var(--muted); margin-top: 18px; }

/* Inicio */
.page { padding: 32px 0 80px; }
.page h1 { font-size: clamp(28px, 4vw, 38px); letter-spacing: -.04em; font-weight: 600; margin: 0 0 24px; }
.codebar { display: flex; gap: 10px; margin-bottom: 40px; max-width: 520px; }
.codebar input { flex: 1; min-height: 50px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--soft); font-size: 16px; outline: none; }
.codebar input:focus { border-color: var(--blue); }
.section-title { display: flex; align-items: baseline; gap: 10px; font-size: 18px; font-weight: 600; letter-spacing: -.02em; margin: 0 0 16px; }
.section-title span { font-size: 14px; color: var(--muted); font-weight: 400; }
.grid-events { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-bottom: 44px; }
.ev-card { text-decoration: none; overflow: hidden; display: flex; flex-direction: column; transition: transform .2s, box-shadow .2s; }
.ev-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.ev-cover { aspect-ratio: 16 / 10; background: linear-gradient(135deg, var(--blue), #60A5FA) center/cover; position: relative; }
.ev-cover .badges { position: absolute; top: 12px; left: 12px; display: flex; gap: 6px; flex-wrap: wrap; }
.ev-body { padding: 16px 18px 18px; }
.ev-body b { display: block; font-size: 16.5px; letter-spacing: -.02em; font-weight: 600; }
.ev-body small { color: var(--muted); font-size: 13.5px; }
.badge { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: rgba(255,255,255,.92); color: #0F172A; }
.badge.live { background: #D1FAE5; color: #065F46; }
.badge.soon { background: #FEF3C7; color: #92400E; }
.badge.ended { background: #E2E8F0; color: #475569; }
.badge.host { background: var(--blue); color: #fff; }
.empty { padding: 28px; border: 1px dashed var(--line); border-radius: 20px; color: var(--muted); text-align: center; margin-bottom: 44px; }
.empty .btn { margin-top: 14px; }

/* Evento */
.ev-hero { position: relative; min-height: 300px; display: flex; align-items: flex-end; color: #fff; background: linear-gradient(135deg, #1D4ED8, #3B82F6) center/cover; }
.ev-hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(rgba(0,0,0,.15), rgba(0,0,0,.65)); }
.ev-hero .wrap { position: relative; z-index: 1; padding: 80px 0 28px; }
.ev-hero h1 { font-size: clamp(30px, 5vw, 52px); line-height: 1.04; letter-spacing: -.04em; font-weight: 600; margin: 10px 0 12px; text-shadow: 0 2px 16px rgba(0,0,0,.25); }
.ev-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 14.5px; opacity: .95; }
.ev-meta span { display: inline-flex; align-items: center; gap: 7px; }
.ev-meta svg { width: 16px; height: 16px; }
.ev-hero .back { position: absolute; top: 18px; left: 0; z-index: 1; }
.ev-hero .back a { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px 0 10px; border-radius: 99px; background: rgba(0,0,0,.35); backdrop-filter: blur(8px); color: #fff; text-decoration: none; font-size: 14px; }
.ev-hero .back svg { width: 16px; height: 16px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin: 26px 0 20px; }
.toolbar .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.toolbar .btn { min-height: 44px; padding: 0 18px; font-size: 14px; }
.desc { color: var(--ink-2); max-width: 46em; margin: 26px 0 0; white-space: pre-line; }

.drop { display: flex; align-items: center; gap: 18px; padding: 22px; border-radius: 22px; border: 2px dashed color-mix(in srgb, var(--blue) 45%, var(--line)); background: color-mix(in srgb, var(--blue) 5%, var(--card)); cursor: pointer; transition: background .2s, border-color .2s; }
.drop:hover, .drop.over { background: color-mix(in srgb, var(--blue) 10%, var(--card)); border-color: var(--blue); }
.drop .ico { width: 56px; height: 56px; border-radius: 18px; background: var(--blue); color: #fff; display: grid; place-items: center; flex: none; box-shadow: 0 10px 20px -8px rgba(37,99,235,.7); }
.drop .ico svg { width: 26px; height: 26px; }
.drop b { display: block; font-size: 17px; letter-spacing: -.02em; }
.drop small { color: var(--muted); }
.drop input { display: none; }
.progress { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; margin-top: 14px; }
.progress div { height: 100%; width: 0; background: var(--blue); border-radius: 99px; transition: width .2s; }
.notice { display: flex; gap: 12px; align-items: center; padding: 16px 18px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); color: var(--ink-2); font-size: 15px; }
.notice svg { width: 22px; height: 22px; color: var(--blue); flex: none; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin: 24px 0 14px; scrollbar-width: none; }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px 0 6px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); cursor: pointer; white-space: nowrap; font-size: 14px; }
.chip.solo { padding: 0 16px; }
.chip .avatar { width: 26px; height: 26px; font-size: 11px; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.photos button { aspect-ratio: 1; border: 0; padding: 0; border-radius: 12px; overflow: hidden; cursor: zoom-in; background: var(--line); }
.photos img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.photos button:hover img { transform: scale(1.04); }
@media (max-width: 560px) { .photos { grid-template-columns: repeat(3, 1fr); gap: 3px; } .photos button { border-radius: 6px; } }

/* Visor */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(5, 8, 15, .94); display: grid; grid-template-rows: auto 1fr; color: #fff; }
.lightbox header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; gap: 8px; }
.lightbox header .actions { display: flex; gap: 8px; }
.lightbox .icon-btn { background: rgba(255,255,255,.1); border-color: transparent; color: #fff; }
.lightbox .icon-btn:hover { background: rgba(255,255,255,.2); }
.lightbox figure { margin: 0; display: grid; place-items: center; min-height: 0; padding: 0 16px 24px; position: relative; }
.lightbox figure img { max-width: 100%; max-height: calc(100dvh - 100px); object-fit: contain; border-radius: 8px; }
.lightbox .nav-btn { position: absolute; top: 50%; translate: 0 -50%; }
.lightbox .nav-btn.prev { left: 16px; } .lightbox .nav-btn.next { right: 16px; }
.lightbox .count { font-size: 14px; opacity: .8; }

/* Unirse */
.join-cover { aspect-ratio: 16 / 9; border-radius: 18px; background: linear-gradient(135deg, var(--blue), #60A5FA) center/cover; margin: -14px -12px 22px; }
.join-meta { display: flex; flex-direction: column; gap: 8px; text-align: left; margin: 0 0 24px; padding: 16px; border-radius: 16px; background: var(--soft); font-size: 14.5px; color: var(--ink-2); }
.join-meta span { display: flex; align-items: center; gap: 10px; }
.join-meta svg { width: 18px; height: 18px; color: var(--blue); flex: none; }

/* Editar */
.edit { width: min(640px, 100%); margin: 0 auto; padding: 28px 24px; }
.edit h1 { font-size: 26px; letter-spacing: -.035em; margin: 0 0 22px; }
.cover-pick { aspect-ratio: 16 / 9; border-radius: 18px; background: linear-gradient(135deg, var(--blue), #60A5FA) center/cover; display: flex; align-items: flex-end; justify-content: flex-end; padding: 12px; cursor: pointer; }
.cover-pick span { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 99px; background: rgba(0,0,0,.55); color: #fff; font-size: 14px; }
.cover-pick svg { width: 16px; height: 16px; }
.row-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

.snack { position: fixed; left: 50%; bottom: 24px; translate: -50% 0; z-index: 200; background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: 99px; font-size: 14px; box-shadow: var(--shadow-lg); animation: up .25s ease; }
@keyframes up { from { opacity: 0; transform: translateY(10px); } }

.prefs.corner { position: fixed; top: 16px; right: 16px; z-index: 40; }
@media (max-width: 420px) { .top .me .avatar { display: none; } }
