@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("/fonts/manrope-var.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #f6f3ee;
  --paper-2: #efebe3;
  --card: #fffefb;
  --ink: #17221f;
  --ink-2: #33413b;
  --muted: #69736d;
  --faint: #8c938d;
  --line: rgba(23, 34, 31, .1);
  --line-strong: rgba(23, 34, 31, .18);
  --green: #245c4b;
  --green-700: #1b4a3c;
  --green-50: #e9efe4;
  --lime: #d7ed72;
  --lime-600: #c5df58;
  --coral: #ed8e70;
  --coral-700: #a9523b;
  --danger: #b0442c;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(23, 34, 31, .05), 0 2px 8px rgba(23, 34, 31, .04);
  --shadow: 0 1px 2px rgba(23, 34, 31, .04), 0 12px 32px -8px rgba(23, 34, 31, .12);
  --shadow-lg: 0 30px 80px -20px rgba(23, 34, 31, .3);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Manrope", "Inter", system-ui, sans-serif;
  --gutter: clamp(16px, 4vw, 40px);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(215, 237, 114, .22), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(36, 92, 75, .07), transparent 60%),
    var(--paper);
  background-attachment: fixed;
  color: var(--ink);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, video { display: block; max-width: 100%; }
a { color: inherit; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 1.15em; height: 1.15em; flex: 0 0 auto; display: inline-block; vertical-align: -.2em; }
:focus-visible { outline: 2.5px solid var(--green); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--lime); color: var(--ink); }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 750; letter-spacing: -.035em; line-height: 1.08; color: var(--ink); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(246, 243, 238, .78);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { max-width: 1240px; height: 68px; margin: 0 auto; padding: 0 var(--gutter); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--font-display); font-size: 20px; font-weight: 800; letter-spacing: -.04em; }
.brand-mark { width: 32px; height: 32px; display: grid; place-items: center; padding: 0 2px 3px 0; border-radius: 10px; background: var(--green); color: #fff; font-size: 19px; letter-spacing: -.08em; box-shadow: inset 0 -2px 0 rgba(0,0,0,.15); transition: transform .3s var(--ease); }
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.05); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.nav-chip { white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 13px; border: 0; border-radius: 999px; background: transparent; color: var(--ink-2); font-size: 13.5px; font-weight: 600; transition: background .2s; }
.nav-chip:hover { background: rgba(23, 34, 31, .06); color: var(--green); }
.account-menu { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 5px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255, 254, 251, .9); }
.account-avatar { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(135deg, var(--green), #3a7a64); color: #fff; font-family: var(--font-display); font-size: 13px; font-weight: 800; }
.account-label { max-width: 140px; overflow: hidden; color: var(--ink-2); font-size: 13.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.logout-button { width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--muted); transition: background .2s, color .2s; }
.logout-button svg { width: 17px; height: 17px; }
.logout-button:hover { background: rgba(23, 34, 31, .07); color: var(--danger); }

/* ---------- Buttons & fields ---------- */
.button {
  min-height: 46px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -.005em;
  text-decoration: none;
  white-space: nowrap;
  transition: transform .18s var(--ease), background .2s, box-shadow .2s, border-color .2s, color .2s;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:active:not(:disabled) { transform: translateY(0) scale(.98); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button-dark { background: var(--ink); color: #fff; box-shadow: 0 6px 18px -6px rgba(23, 34, 31, .5); }
.button-dark:hover:not(:disabled) { background: var(--green); box-shadow: 0 10px 24px -8px rgba(36, 92, 75, .55); }
.button-light { border-color: var(--line-strong); background: rgba(255, 254, 251, .7); color: var(--ink); }
.button-light:hover:not(:disabled) { border-color: var(--ink); background: var(--card); }
.button-lime { background: var(--lime); color: var(--ink); }
.button-lime:hover:not(:disabled) { background: #e3f58c; box-shadow: 0 10px 26px -10px rgba(215, 237, 114, .9); }
.button-ghost-light { border-color: rgba(255,255,255,.22); background: transparent; color: rgba(255,255,255,.9); }
.button-ghost-light:hover:not(:disabled) { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.4); }
.button-sm { min-height: 38px; padding: 0 15px; font-size: 13.5px; }
.button-lg { min-height: 52px; padding: 0 24px; font-size: 15px; }
.button-full { width: 100%; }
.button .icon { width: 17px; height: 17px; }
.is-loading { opacity: .7; pointer-events: none; }
.text-button { padding: 0; border: 0; background: transparent; color: var(--green); font-weight: 600; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; text-decoration-color: rgba(36, 92, 75, .35); transition: text-decoration-color .2s; }
.text-button:hover { text-decoration-color: currentColor; }

.field {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  outline: none;
  background: var(--card);
  color: var(--ink);
  font-size: 15px;
  transition: border-color .2s, box-shadow .2s;
}
.field::placeholder { color: #a3a9a3; }
.field:hover { border-color: rgba(23, 34, 31, .3); }
.field:focus { border-color: var(--green); box-shadow: 0 0 0 4px rgba(36, 92, 75, .12); }
.field[readonly] { color: var(--muted); background: var(--paper); }
.field-lg { height: 52px; font-size: 16px; }
.code-field { font-family: var(--font-display); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.code-field::placeholder { letter-spacing: .12em; font-weight: 600; }
.field-label, .stack-form label { display: block; margin: 0 0 7px; color: var(--ink-2); font-size: 13.5px; font-weight: 600; }
.stack-form { display: grid; gap: 10px; }
.stack-form label:not(.sr-only) { margin: 6px 0 -3px; }
.form-message { min-height: 20px; margin: 12px 0 0; color: var(--danger); font-size: 13.5px; }
.form-message:empty { min-height: 0; margin: 0; }
.inline-row { display: flex; gap: 8px; }
.inline-row .field { flex: 1; min-width: 0; }

.eyebrow { display: inline-flex; align-items: center; gap: 10px; margin: 0 0 16px; color: var(--green); font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.eyebrow::before { content: ""; width: 22px; height: 1.5px; background: currentColor; border-radius: 2px; }
.eyebrow-center { justify-content: center; }
.hint { color: var(--muted); font-size: 13.5px; }
.card { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card); box-shadow: var(--shadow); }
.badge-icon { width: 54px; height: 54px; display: grid; place-items: center; margin: 0 auto 18px; border-radius: 18px; background: var(--lime); color: var(--green); box-shadow: 0 8px 22px -8px rgba(160, 190, 60, .8); }
.badge-icon .icon { width: 26px; height: 26px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 14px; font-weight: 500; text-decoration: none; transition: color .2s, gap .2s; }
.back-link:hover { color: var(--green); gap: 7px; }

/* ---------- Dialog (account) ---------- */
.sheet-dialog { width: min(440px, calc(100% - 32px)); max-width: none; max-height: calc(100% - 32px); overflow-y: auto; padding: 34px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card); color: var(--ink); box-shadow: var(--shadow-lg); }
.sheet-dialog[open] { animation: sheet-in .35s var(--ease); }
.sheet-dialog::backdrop { background: rgba(17, 26, 23, .45); backdrop-filter: blur(6px); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.account-dialog h2 { margin: 0 0 10px; font-size: 30px; }
.account-description { margin-bottom: 18px; color: var(--muted); font-size: 14.5px; line-height: 1.6; }
.account-dialog .stack-form .button { margin-top: 10px; }
.dialog-close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--paper); color: var(--ink-2); transition: background .2s, transform .2s; }
.dialog-close:hover { background: var(--paper-2); transform: rotate(90deg); }
.account-mode-toggle { display: block; margin: 16px auto 0; font-size: 14px; }
.account-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--faint); font-size: 13px; }
.account-divider::before, .account-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.google-login { gap: 11px; }
.google-mark { width: 18px; height: 18px; flex: 0 0 auto; }

/* ---------- Layout ---------- */
main { width: 100%; max-width: 1240px; flex: 1; margin: 0 auto; padding: 0 var(--gutter); }
.site-footer { width: 100%; max-width: 1240px; margin: 0 auto; padding: 28px var(--gutter); display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); color: var(--faint); font-size: 13.5px; }
.footer-brand { color: var(--green); font-family: var(--font-display); font-size: 15px; font-weight: 800; letter-spacing: -.03em; }

/* ---------- Home ---------- */
.home-view { display: grid; grid-template-columns: 1.05fr 1fr; align-items: center; column-gap: 56px; padding: clamp(40px, 7vw, 88px) 0 56px; animation: fade-up .6s var(--ease) both; }
@keyframes fade-up { from { opacity: 0; transform: translateY(14px); } }
.hero-copy { max-width: 560px; }
.hero-copy h1 { margin: 0 0 22px; font-size: clamp(42px, 5vw, 66px); font-weight: 800; letter-spacing: -.045em; line-height: 1.02; }
.hero-copy h1 span { color: var(--green); background: linear-gradient(90deg, var(--green), #3d8a6f); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero-description { max-width: 470px; margin-bottom: 30px; color: var(--muted); font-size: 17.5px; line-height: 1.65; }
.create-room-form { max-width: 500px; }
.create-room-row { display: flex; gap: 6px; padding: 6px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--card); box-shadow: var(--shadow); transition: border-color .2s, box-shadow .2s; }
.create-room-row:focus-within { border-color: var(--green); box-shadow: var(--shadow), 0 0 0 4px rgba(36, 92, 75, .12); }
.create-room-row .field { flex: 1; min-width: 0; height: 52px; padding: 0 18px; border: 0; border-radius: 999px; background: transparent; box-shadow: none; }
.create-room-row .button { flex: 0 0 auto; }
.no-account { display: flex; align-items: center; gap: 8px; margin: 16px 0 0 4px; color: var(--muted); font-size: 14px; }
.no-account .icon { color: var(--green); width: 15px; height: 15px; }

.hero-art { position: relative; height: 420px; }
.art-glow { position: absolute; width: 340px; height: 340px; top: 40px; left: 50%; margin-left: -190px; border-radius: 50%; background: radial-gradient(circle at 40% 40%, #e4ecc8, #d2dfb4 60%, transparent 72%); }
.photo { position: absolute; width: 220px; height: 278px; overflow: hidden; border: 9px solid #fffefb; border-bottom-width: 32px; border-radius: 6px; box-shadow: 0 28px 50px -18px rgba(37, 55, 46, .35), 0 2px 6px rgba(37, 55, 46, .08); transition: transform .6s var(--ease); }
.photo-back { top: 58px; left: calc(50% - 210px); transform: rotate(-11deg); background: linear-gradient(160deg, #f8cc8f 0 42%, #b4c897 42% 65%, #607a64 65%); }
.photo-front { top: 80px; left: calc(50% - 30px); transform: rotate(8deg); background: linear-gradient(160deg, #f4b783 0 46%, #597c6a 46% 100%); }
.hero-art:hover .photo-back { transform: rotate(-15deg) translate(-12px, -6px); }
.hero-art:hover .photo-front { transform: rotate(11deg) translate(10px, -4px); }
.photo-sun { position: absolute; top: 28px; right: 34px; width: 47px; height: 47px; border-radius: 50%; background: #fbe0a4; }
.photo-hill { position: absolute; right: -25px; bottom: 26px; width: 220px; height: 130px; border-radius: 50% 50% 0 0; background: #748e6a; transform: rotate(-12deg); }
.photo-person { position: absolute; z-index: 1; bottom: 34px; left: 78px; width: 50px; height: 104px; border-radius: 28px 28px 12px 12px; background: #d77f61; }
.photo-person::before { content: ""; position: absolute; top: -34px; left: 7px; width: 36px; height: 39px; border-radius: 50%; background: #bd795e; }
.photo-wave { position: absolute; right: -40px; bottom: -3px; width: 230px; height: 82px; border-radius: 50% 50% 0 0; background: #416a5e; transform: rotate(-8deg); }
.photo-label { position: absolute; z-index: 3; bottom: -24px; left: 12px; color: #4a544c; font-family: var(--font-display); font-size: 12px; font-weight: 600; }
.art-sticker { position: absolute; top: 14px; right: calc(50% - 230px); z-index: 4; width: 96px; height: 96px; display: grid; place-content: center; border-radius: 50%; background: var(--lime); color: #33411f; text-align: center; font-family: var(--font-display); font-size: 12.5px; font-weight: 800; line-height: 1.15; transform: rotate(9deg); box-shadow: 0 12px 24px -10px rgba(120, 150, 30, .6); animation: sticker-float 6s ease-in-out infinite; }
@keyframes sticker-float { 50% { transform: rotate(4deg) translateY(-6px); } }
.art-caption { position: absolute; right: calc(50% - 200px); bottom: 6px; color: var(--faint); font-family: var(--font-display); font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }

.how-it-works { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 48px 0 0; padding: 0; list-style: none; }
.how-it-works li { display: flex; gap: 14px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255, 254, 251, .6); transition: background .2s, transform .25s var(--ease); }
.how-it-works li:hover { background: var(--card); transform: translateY(-2px); }
.step-number { flex: 0 0 auto; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--green-50); color: var(--green); font-family: var(--font-display); font-size: 13px; font-weight: 800; }
.how-it-works strong { display: block; font-family: var(--font-display); font-size: 16px; font-weight: 700; letter-spacing: -.02em; }
.how-it-works p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.saved-rooms-panel { grid-column: 1 / -1; margin-top: 48px; }
.saved-rooms-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.saved-room-card { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 8px 8px 8px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-sm); transition: border-color .2s, box-shadow .2s, transform .2s var(--ease); }
.saved-room-card:hover { border-color: rgba(36, 92, 75, .35); box-shadow: var(--shadow); transform: translateY(-2px); }
.saved-room-open { min-width: 0; flex: 1; padding: 8px 0; border: 0; background: transparent; color: var(--ink); text-align: left; }
.saved-room-open strong { display: block; overflow: hidden; font-family: var(--font-display); font-size: 16px; font-weight: 700; letter-spacing: -.02em; text-overflow: ellipsis; white-space: nowrap; }
.saved-room-open span { display: block; margin-top: 2px; color: var(--faint); font-size: 13px; }
.saved-room-remove, .saved-room-code { flex: 0 0 auto; height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; transition: background .2s, color .2s, border-color .2s; }
.saved-room-code { color: var(--green); border-color: rgba(36, 92, 75, .25); }
.saved-room-code:hover { background: var(--green-50); }
.saved-room-remove:hover { color: var(--danger); border-color: rgba(176, 68, 44, .3); background: #fbefea; }

/* ---------- Created ---------- */
.created-view { max-width: 640px; margin: clamp(32px, 6vw, 64px) auto; animation: fade-up .5s var(--ease) both; }
.created-card { padding: clamp(26px, 5vw, 44px); text-align: center; }
.created-card h2 { margin-bottom: 10px; font-size: clamp(28px, 4vw, 36px); }
.created-card h2 span { color: var(--green); }
.created-help { max-width: 440px; margin: 0 auto 26px; color: var(--muted); font-size: 15px; line-height: 1.6; }
.code-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; text-align: left; }
.code-block { padding: 16px 18px; border: 1px solid rgba(36, 92, 75, .18); border-radius: var(--radius); background: linear-gradient(180deg, #f3f6ec, #edf2e5); }
.code-block-access { border-color: rgba(169, 82, 59, .2); background: linear-gradient(180deg, #fbf4ee, #f7ece4); }
.code-label { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.code-label .icon { width: 14px; height: 14px; }
.code-value { color: var(--green); font-family: var(--font-display); font-size: clamp(19px, 2.6vw, 25px); font-weight: 800; letter-spacing: .08em; overflow-wrap: anywhere; user-select: all; }
.code-block-access .code-value { color: var(--coral-700); }
.share-row { display: flex; gap: 8px; margin: 18px 0 12px; }
.share-row .field { flex: 1; min-width: 0; font-size: 14px; }
.created-actions { display: grid; grid-template-columns: 1fr 1.3fr; gap: 8px; }

/* ---------- Gate ---------- */
.room-gate { max-width: 480px; margin: clamp(32px, 7vw, 72px) auto; padding: clamp(26px, 5vw, 40px); text-align: center; animation: fade-up .5s var(--ease) both; }
.room-gate h1 { margin: 0 0 10px; font-size: clamp(28px, 4vw, 34px); }
.gate-text { margin: 0 auto 24px; max-width: 380px; color: var(--muted); font-size: 15px; line-height: 1.6; }
.room-gate .code-field { height: 54px; text-align: center; font-size: 18px; }
.recover-access-toggle { margin: 18px 0 0; font-size: 14px; }
.room-gate #room-recover-form { margin-top: 14px; }
.room-gate > .back-link { margin-top: 18px; }

/* ---------- Room ---------- */
.room-view { padding: 28px 0 72px; }
#room-content { animation: fade-up .45s var(--ease) both; }
.room-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.room-heading-copy { min-width: 0; }
.room-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin-top: 14px; }
.room-heading h1 { margin: 0; font-size: clamp(30px, 4.4vw, 48px); overflow-wrap: anywhere; }
.status-chip { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 13px; border-radius: 999px; background: rgba(23, 34, 31, .06); color: var(--ink-2); font-size: 13.5px; font-weight: 600; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.status-chip.is-open { background: var(--lime); color: var(--ink); }
.status-chip.is-open .status-dot { background: var(--green); box-shadow: 0 0 0 0 rgba(36, 92, 75, .5); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(36, 92, 75, 0); } 100% { box-shadow: 0 0 0 0 rgba(36, 92, 75, 0); } }
.room-heading-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.room-codes-panel { margin: -6px 0 22px; padding: 18px; animation: fade-up .3s var(--ease) both; }
.room-codes-recovery-form label { display: block; margin-bottom: 10px; color: var(--muted); font-size: 14px; }

.room-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 16px; }
.panel { position: relative; min-height: 240px; padding: 26px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card); box-shadow: var(--shadow-sm); overflow: hidden; }
.panel-kicker { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.panel-topline { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.counter-panel { background: linear-gradient(160deg, #eef3e6 0%, #e4ecd9 100%); border-color: rgba(36, 92, 75, .12); }
.counter-panel::after { content: ""; position: absolute; right: -60px; bottom: -80px; width: 240px; height: 240px; border-radius: 50%; background: radial-gradient(circle, rgba(215, 237, 114, .55), transparent 70%); pointer-events: none; }
.privacy-pill { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; background: rgba(255, 255, 255, .75); color: var(--green); font-size: 13px; font-weight: 600; }
.privacy-pill .icon { width: 14px; height: 14px; }
.total-count { position: relative; z-index: 1; display: flex; align-items: baseline; gap: 12px; margin: 22px 0 18px; }
.total-count > span:first-child { font-family: var(--font-display); font-size: clamp(56px, 7vw, 76px); font-weight: 800; letter-spacing: -.05em; line-height: .9; font-variant-numeric: tabular-nums; }
.total-count > span:last-child { color: var(--muted); font-size: 16px; font-weight: 500; }
.count-details { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 10px; }
.count-details > div { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; background: rgba(255, 255, 255, .6); color: var(--muted); font-size: 14px; }
.count-details strong { color: var(--ink); font-size: 15px; font-variant-numeric: tabular-nums; }
.count-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: rgba(36, 92, 75, .12); color: var(--green); }
.count-icon .icon { width: 15px; height: 15px; }
.count-icon-video { background: rgba(237, 142, 112, .18); color: var(--coral-700); }
.counter-foot { position: relative; z-index: 1; margin: 20px 0 0; color: var(--muted); font-size: 14px; }

.unlock-panel { background: var(--ink); border-color: var(--ink); color: #fff; }
.unlock-panel::before { content: ""; position: absolute; right: -80px; top: -90px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(215, 237, 114, .22), transparent 70%); pointer-events: none; }
.unlock-panel .panel-kicker { color: rgba(255, 255, 255, .55); }
.unlock-panel h2 { margin: 12px 0 8px; color: #fff; font-size: 28px; }
.unlock-text { max-width: 360px; margin-bottom: 18px; color: rgba(255, 255, 255, .68); font-size: 14.5px; line-height: 1.55; }
.unlock-panel form { position: relative; display: flex; gap: 8px; }
.unlock-panel .field { flex: 1 1 auto; height: 48px; min-width: 0; border-color: rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .06); color: #fff; }
.unlock-panel .field::placeholder { color: rgba(255, 255, 255, .35); }
.unlock-panel .field:focus { border-color: var(--lime); box-shadow: 0 0 0 4px rgba(215, 237, 114, .15); }
.unlock-panel .field:disabled { opacity: .5; }
.viewer-state { margin: 14px 0 0; color: rgba(255, 255, 255, .5); font-size: 13.5px; }
.viewer-state.is-open { color: var(--lime); font-weight: 600; }
.unlock-panel #close-viewer { margin-top: 16px; }
.unlock-panel.viewer-open h2::after { content: " Ya lo es."; color: var(--lime); }

.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section-heading .eyebrow { margin-bottom: 10px; }
.section-heading h2 { margin: 0; font-size: clamp(26px, 3vw, 32px); }
.upload-section, .my-files-section, .gallery-section { margin-top: 56px; }
.subtle-note { max-width: 680px; margin: -6px 0 18px; color: var(--muted); font-size: 14px; line-height: 1.6; }

/* ---------- Upload ---------- */
.drop-zone { position: relative; min-height: 180px; display: grid; place-content: center; justify-items: center; gap: 12px; padding: 28px; border: 1.5px dashed rgba(36, 92, 75, .3); border-radius: var(--radius-lg); background: rgba(255, 254, 251, .6); text-align: center; cursor: pointer; transition: background .2s, border-color .2s, transform .2s var(--ease); }
.drop-zone:hover { border-color: var(--green); background: var(--card); }
.drop-zone.dragging { border-color: var(--green); border-style: solid; background: var(--green-50); transform: scale(1.01); }
.drop-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 16px; background: var(--green); color: #fff; box-shadow: 0 10px 24px -10px rgba(36, 92, 75, .7); transition: transform .3s var(--ease); }
.drop-icon .icon { width: 24px; height: 24px; }
.drop-zone:hover .drop-icon, .drop-zone.dragging .drop-icon { transform: translateY(-4px); }
.drop-zone p { margin: 0; color: var(--muted); font-size: 14.5px; }
.drop-zone p strong { display: block; margin-bottom: 3px; color: var(--ink); font-family: var(--font-display); font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.selection-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin-top: 14px; }
.selection-item { min-width: 0; display: flex; align-items: center; gap: 12px; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-sm); animation: fade-up .3s var(--ease) both; }
.selection-item .thumbnail { width: 56px; height: 56px; flex: 0 0 auto; overflow: hidden; border-radius: 10px; background: var(--green-50); }
.selection-item .thumbnail img, .selection-item .thumbnail video { width: 100%; height: 100%; object-fit: cover; }
.file-info { min-width: 0; flex: 1; }
.file-info strong { display: block; overflow: hidden; color: var(--ink); font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.file-info span { display: block; margin-top: 2px; color: var(--faint); font-size: 13px; }
.remove-selection { width: 32px; height: 32px; flex: 0 0 auto; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--paper); color: var(--muted); transition: background .2s, color .2s; }
.remove-selection:hover { background: #fbefea; color: var(--danger); }
.remove-selection .icon { width: 15px; height: 15px; }
.upload-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; padding: 14px 14px 14px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-sm); }
.upload-progress-wrap { flex: 1; min-width: 0; }
.upload-summary-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.upload-summary-actions:empty { display: none; }
.queue-item .thumbnail { display: grid; place-items: center; color: var(--green); }
.queue-item .thumbnail .icon { width: 22px; height: 22px; }
.queue-progress { height: 4px; margin-top: 7px; overflow: hidden; border-radius: 999px; background: var(--paper-2); }
.queue-progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--green); transition: width .2s linear; }
.queue-item:not(.is-uploading) .queue-progress { display: none; }
.queue-item.is-done { border-color: rgba(36, 92, 75, .3); }
.queue-item.is-done .file-info span { color: var(--green); }
.queue-item.is-error { border-color: rgba(176, 68, 44, .35); background: #fff7f4; }
.queue-item.is-error .file-info span { color: var(--danger); white-space: normal; }
.queue-item.is-leaving { opacity: 0; transform: scale(.97); transition: opacity .4s, transform .4s; }
.queue-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; }
.upload-actions p { margin: 0; color: var(--muted); font-size: 14px; }
.upload-progress { height: 6px; margin-top: 8px; overflow: hidden; border-radius: 999px; background: var(--paper-2); }
.upload-progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green), #4c9a7d); transition: width .2s linear; }

/* ---------- My files ---------- */
.my-files-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 10px; }
.owned-item { min-width: 0; display: flex; align-items: center; gap: 14px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-sm); transition: box-shadow .2s, border-color .2s; }
.owned-item:hover { border-color: rgba(36, 92, 75, .22); box-shadow: var(--shadow); }
.owned-item .media-tile { flex: 0 0 auto; width: 92px; height: 92px; aspect-ratio: 1; border-radius: 12px; }
.owned-item .media-tile img, .owned-item .media-tile video { position: absolute; inset: 0; }
.owned-item .tile-label { display: none; }
.owned-item .tile-badge { top: 5px; left: 5px; height: 20px; padding: 0 6px 0 5px; font-size: 10.5px; }
.owned-item .tile-play { width: 32px; height: 32px; margin: -16px 0 0 -16px; }
.owned-item .tile-play .icon { width: 14px; height: 14px; }
.owned-item .tile-fallback { padding: 6px; font-size: 11px; text-align: center; }
.owned-content { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.owned-name { position: relative; display: block; margin: -4px -8px 0; }
.owned-name .icon { position: absolute; top: 50%; right: 8px; width: 15px; height: 15px; margin-top: -7.5px; color: var(--faint); pointer-events: none; transition: opacity .2s; }
.owned-name input:focus + .icon { opacity: 0; }
.owned-name input:disabled { opacity: .6; }
.owned-content input { display: block; width: 100%; min-width: 0; height: 34px; padding: 0 30px 0 8px; border: 1px solid transparent; border-radius: 8px; outline: none; background: transparent; color: var(--ink); font-size: 15px; font-weight: 600; text-overflow: ellipsis; transition: border-color .2s, background .2s; }
.owned-content input:hover { background: var(--paper); }
.owned-content input:focus { border-color: var(--green); background: #fff; box-shadow: 0 0 0 3px rgba(36, 92, 75, .1); }
.owned-meta { margin: 0 0 8px; color: var(--faint); font-size: 13px; }
.owned-actions { display: flex; gap: 6px; }
.small-action { height: 32px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--ink-2); font-size: 13px; font-weight: 600; white-space: nowrap; transition: background .2s, color .2s, border-color .2s; }
.small-action:hover { border-color: rgba(36, 92, 75, .35); background: var(--green-50); color: var(--green); }
.small-action.danger:hover { border-color: rgba(176, 68, 44, .3); background: #fbefea; color: var(--danger); }
.empty-files { grid-column: 1 / -1; padding: 32px 20px; border: 1.5px dashed var(--line-strong); border-radius: var(--radius); color: var(--muted); font-size: 14.5px; text-align: center; }

/* ---------- Media tiles (gallery + my files) ---------- */
.media-tile { position: relative; display: block; width: 100%; padding: 0; overflow: hidden; border: 0; border-radius: var(--radius); background: linear-gradient(135deg, #e4e9dc, #d9e0d0); cursor: zoom-in; isolation: isolate; }
.media-tile::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.45) 50%, transparent 70%) -200% 0 / 200% 100%; animation: shimmer 1.4s infinite; }
.media-tile.is-ready::before { display: none; }
@keyframes shimmer { to { background-position: 200% 0; } }
.media-tile img, .media-tile video { width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: rotate(var(--rot, 0deg)); transition: opacity .4s, transform .6s var(--ease); }
.media-tile.is-ready img, .media-tile.is-ready video { opacity: 1; }
.media-tile:hover img, .media-tile:hover video { transform: rotate(var(--rot, 0deg)) scale(1.045); }
.media-tile::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(10, 16, 14, .6)); opacity: 0; transition: opacity .25s; pointer-events: none; }
.media-tile:hover::after, .media-tile:focus-visible::after { opacity: 1; }
.media-tile:focus-visible { outline-offset: 3px; }
.tile-badge { position: absolute; z-index: 2; top: 10px; left: 10px; display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px 0 7px; border-radius: 999px; background: rgba(10, 16, 14, .6); color: #fff; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.tile-badge .icon { width: 12px; height: 12px; }
.tile-play { position: absolute; z-index: 2; top: 50%; left: 50%; width: 52px; height: 52px; display: grid; place-items: center; margin: -26px 0 0 -26px; border-radius: 50%; background: rgba(255, 255, 255, .9); color: var(--ink); box-shadow: 0 8px 24px rgba(0, 0, 0, .25); transition: transform .25s var(--ease), opacity .25s; }
.tile-play .icon { width: 20px; height: 20px; margin-left: 2px; }
.media-tile:hover .tile-play { transform: scale(1.1); }
.media-tile.is-previewing .tile-play { opacity: 0; }
.tile-label { position: absolute; z-index: 2; right: 0; bottom: 0; left: 0; padding: 0 12px 10px; overflow: hidden; color: #fff; font-size: 13px; font-weight: 500; text-align: left; text-overflow: ellipsis; white-space: nowrap; opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .25s var(--ease); }
.media-tile:hover .tile-label, .media-tile:focus-visible .tile-label { opacity: 1; transform: none; }
.tile-fallback { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; }

.gallery-hero { position: relative; display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 20px; padding: clamp(22px, 4vw, 34px); margin-bottom: 18px; overflow: hidden; border-radius: var(--radius-lg); background: var(--green); color: #fff; box-shadow: 0 20px 50px -24px rgba(36, 92, 75, .7); }
.gallery-hero::before { content: ""; position: absolute; right: -60px; top: -120px; width: 340px; height: 340px; border-radius: 50%; background: radial-gradient(circle, rgba(215, 237, 114, .4), transparent 70%); pointer-events: none; }
.gallery-hero > * { position: relative; }
.gallery-hero .eyebrow { color: var(--lime); margin-bottom: 10px; }
.gallery-hero h2 { margin: 0 0 6px; color: #fff; font-size: clamp(28px, 3.6vw, 40px); }
.gallery-hero .hint { margin: 0; color: rgba(255, 255, 255, .72); }
.gallery-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.gallery-hero .button-light { border-color: rgba(255, 255, 255, .3); background: rgba(255, 255, 255, .08); color: #fff; }
.gallery-hero .button-light:hover:not(:disabled) { border-color: #fff; background: rgba(255, 255, 255, .14); }
.gallery-hero .button-dark { background: var(--lime); color: var(--ink); box-shadow: 0 10px 26px -10px rgba(215, 237, 114, .8); }
.gallery-hero .button-dark:hover:not(:disabled) { background: #e5f68f; }
.gallery-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.segmented { display: inline-flex; padding: 4px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255, 254, 251, .7); }
.segment { height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 13.5px; font-weight: 600; transition: background .2s, color .2s; }
.segment span { margin-left: 2px; color: var(--faint); font-weight: 500; font-variant-numeric: tabular-nums; }
.segment:hover { color: var(--ink); }
.segment.is-active { background: var(--ink); color: #fff; }
.segment.is-active span { color: rgba(255, 255, 255, .6); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 44vw), 1fr)); gap: 10px; }
.gallery .media-tile { aspect-ratio: 1; animation: tile-in .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 25ms); }
@keyframes tile-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.gallery-empty { grid-column: 1 / -1; padding: 40px; color: var(--muted); text-align: center; }

/* ---------- Toast ---------- */
.toast { position: fixed; z-index: 100; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); max-width: min(520px, calc(100vw - 32px)); padding: 13px 18px; border-radius: 14px; background: var(--ink); color: #fff; font-size: 14.5px; font-weight: 500; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transform: translate(-50%, 16px); transition: opacity .25s, transform .35s var(--ease); }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast.is-error { background: #7d2f1f; }
.toast.success-message::before { content: "✓"; margin-right: 8px; color: var(--lime); font-weight: 800; }

/* ======================================================
   Viewer
   ====================================================== */
.viewer {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: #070b0a;
  color: #fff;
  font-size: 14px;
  user-select: none;
  -webkit-user-select: none;
}
.viewer::backdrop { background: #070b0a; }
.viewer[open] { display: block; animation: viewer-in .3s ease both; }
@keyframes viewer-in { from { opacity: 0; } }
html:has(.viewer[open]) { overflow: hidden; }
html.viewer-is-open { overflow: hidden; }
.viewer.chrome-hidden { cursor: none; }

.viewer-ambient { position: absolute; inset: -10%; z-index: 0; background-position: center; background-size: cover; filter: blur(70px) saturate(1.5) brightness(.45); opacity: 0; transform: scale(1.1); transition: opacity .7s ease, background-image .7s ease; pointer-events: none; }
.viewer-ambient.is-visible { opacity: 1; }
.viewer-ambient::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at center, transparent 30%, rgba(7, 11, 10, .65)); }

.viewer-stage { position: absolute; inset: 0; z-index: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: none; }
.viewer-media { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.viewer-media img, .viewer-media video {
  flex: 0 0 auto;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
  object-position: center;
  opacity: 0;
  transform-origin: 50% 50%;
  transition: opacity .35s ease, transform .35s var(--ease);
  -webkit-user-drag: none;
}
.viewer-media .is-loaded { opacity: 1; }
/* Entrada y giro del vídeo, igual que en la foto. */
.viewer-media video { --shift: 0px; --rot: 0deg; transform: translateX(var(--shift)) rotate(var(--rot)); }
.viewer-media video.is-entering-next { --shift: 28px; }
.viewer-media video.is-entering-prev { --shift: -28px; }
.viewer-media video.is-loaded { --shift: 0px; }
/* Giro, entrada y zoom de la foto combinados en una sola transformación. */
.viewer-media img { --shift: 0px; --tx: 0px; --ty: 0px; --rot: 0deg; --zoom: 1; cursor: zoom-in; transform: translate(calc(var(--shift) + var(--tx)), var(--ty)) rotate(var(--rot)) scale(var(--zoom)); }
.viewer-media img.is-entering-next { --shift: 28px; }
.viewer-media img.is-entering-prev { --shift: -28px; }
.viewer-media img.is-loaded { --shift: 0px; }
.viewer-media img.is-zoomed { cursor: grab; transition: transform .3s var(--ease), opacity .35s; }
.viewer-media img.is-panning { transition: opacity .35s; }
.viewer-tool:disabled { opacity: .35; pointer-events: none; }
.viewer-zoom-level { min-width: 54px; padding: 0 6px; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.viewer-media video { cursor: pointer; background: transparent; }
.viewer-stage:focus { outline: none; }

.viewer-loader { position: absolute; top: 50%; left: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px; border: 3px solid rgba(255, 255, 255, .15); border-top-color: var(--lime); border-radius: 50%; animation: spin .8s linear infinite; pointer-events: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.viewer-center-play { position: absolute; z-index: 3; top: 50%; left: 50%; width: 84px; height: 84px; display: grid; place-items: center; margin: -42px 0 0 -42px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .92); color: var(--ink); box-shadow: 0 16px 40px rgba(0, 0, 0, .4); transition: transform .2s var(--ease), background .2s; }
.viewer-center-play:hover { transform: scale(1.06); background: var(--lime); }
.viewer-center-play .icon { width: 32px; height: 32px; margin-left: 4px; }

.chrome { transition: opacity .35s ease, transform .35s var(--ease); }
.viewer.chrome-hidden .chrome { opacity: 0; pointer-events: none; }
.viewer.chrome-hidden .viewer-top { transform: translateY(-10px); }
.viewer.chrome-hidden .viewer-bottom { transform: translateY(10px); }

.viewer-top { position: absolute; z-index: 5; top: 0; right: 0; left: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: max(14px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) 40px max(20px, env(safe-area-inset-left)); background: linear-gradient(180deg, rgba(5, 8, 7, .72), rgba(5, 8, 7, .3) 60%, transparent); }
.viewer-meta { min-width: 0; display: flex; align-items: center; gap: 12px; }
.viewer-counter { flex: 0 0 auto; height: 28px; display: inline-flex; align-items: center; padding: 0 11px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .12); color: #fff; font: inherit; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .02em; cursor: pointer; transition: background .2s; }
.viewer-counter:hover { background: rgba(255, 255, 255, .22); }
.viewer-jump { flex: 0 0 auto; height: 28px; display: inline-flex; align-items: center; gap: 6px; padding: 0 10px 0 4px; border-radius: 999px; background: rgba(255, 255, 255, .18); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.viewer-jump input { width: 4.2em; height: 22px; padding: 0 6px; border: 0; border-radius: 999px; background: #fff; color: var(--ink); font: inherit; font-size: 13px; font-weight: 700; text-align: center; -moz-appearance: textfield; }
.viewer-jump input::-webkit-outer-spin-button, .viewer-jump input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.viewer-jump input:focus { outline: 2px solid var(--lime); outline-offset: 1px; }
.viewer-title { min-width: 0; overflow: hidden; color: rgba(255, 255, 255, .88); font-size: 14.5px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.viewer-tools { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; }
.viewer-tool { min-width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 10px; border: 0; border-radius: 999px; background: transparent; color: #fff; font-size: 13.5px; font-weight: 600; text-decoration: none; transition: background .2s, color .2s; }
.viewer-tool:hover { background: rgba(255, 255, 255, .14); }
.viewer-tool .icon { width: 20px; height: 20px; }
.viewer-tool[aria-pressed="true"] { background: var(--lime); color: var(--ink); }
.viewer-tool-label { padding: 0 14px 0 12px; }
.viewer-tool-label .icon { width: 16px; height: 16px; }
.viewer-slide-progress { position: absolute; left: 0; right: 0; top: 0; height: 3px; pointer-events: none; }
.viewer-slide-progress span { display: block; width: 0; height: 100%; background: var(--lime); }
.viewer-slide-progress span.is-running { animation: slide-progress linear forwards; animation-duration: var(--slide-duration, 6s); }
@keyframes slide-progress { from { width: 0; } to { width: 100%; } }

.viewer-nav { position: absolute; z-index: 4; top: 50%; width: 56px; height: 56px; display: grid; place-items: center; margin-top: -28px; border: 1px solid rgba(255, 255, 255, .14); border-radius: 50%; background: rgba(10, 16, 14, .45); color: #fff; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: background .2s, transform .2s var(--ease), opacity .35s; }
.viewer-nav:hover { background: rgba(255, 255, 255, .2); }
.viewer-nav:active { transform: scale(.94); }
.viewer-nav .icon { width: 24px; height: 24px; }
.viewer-nav-prev { left: max(18px, env(safe-area-inset-left)); }
.viewer-nav-next { right: max(18px, env(safe-area-inset-right)); }

.viewer-bottom { position: absolute; z-index: 5; right: 0; bottom: 0; left: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 48px max(20px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); background: linear-gradient(0deg, rgba(5, 8, 7, .78), rgba(5, 8, 7, .35) 60%, transparent); pointer-events: none; }
.viewer-bottom > * { pointer-events: auto; }
.viewer-video-controls { width: min(860px, 100%); display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid rgba(255, 255, 255, .1); border-radius: 999px; background: rgba(15, 22, 20, .6); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.viewer-video-controls .viewer-tool { min-width: 38px; height: 38px; padding: 0; }
.viewer-video-time { min-width: 42px; color: rgba(255, 255, 255, .8); font-size: 13px; font-variant-numeric: tabular-nums; text-align: center; }
.viewer-range { --fill: 0%; height: 20px; margin: 0; flex: 1; min-width: 40px; background: transparent; cursor: pointer; -webkit-appearance: none; appearance: none; }
.viewer-range::-webkit-slider-runnable-track { height: 4px; border-radius: 999px; background: linear-gradient(90deg, var(--lime) var(--fill), rgba(255, 255, 255, .22) var(--fill)); }
.viewer-range::-moz-range-track { height: 4px; border-radius: 999px; background: rgba(255, 255, 255, .22); }
.viewer-range::-moz-range-progress { height: 4px; border-radius: 999px; background: var(--lime); }
.viewer-range::-webkit-slider-thumb { width: 14px; height: 14px; margin-top: -5px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(215, 237, 114, .25); -webkit-appearance: none; appearance: none; transition: transform .15s; }
.viewer-range::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: #fff; }
.viewer-range:hover::-webkit-slider-thumb { transform: scale(1.2); }
.viewer-range:focus-visible { outline: none; }
.viewer-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 5px rgba(215, 237, 114, .6); }
.viewer-volume { flex: 0 0 90px; }

.viewer-strip { width: 100%; max-width: 100%; display: flex; gap: 6px; padding: 4px 2px 2px; overflow-x: auto; scroll-behavior: smooth; scrollbar-width: none; justify-content: safe center; }
.viewer-strip::-webkit-scrollbar { display: none; }
.strip-thumb { position: relative; flex: 0 0 auto; width: 64px; height: 64px; padding: 0; overflow: hidden; border: 2px solid transparent; border-radius: 10px; background: rgba(255, 255, 255, .08); opacity: .55; transition: opacity .2s, border-color .2s, transform .2s var(--ease); }
.strip-thumb:hover { opacity: .9; }
.strip-thumb.is-active { border-color: var(--lime); opacity: 1; transform: translateY(-2px); }
.strip-thumb img { width: 100%; height: 100%; object-fit: cover; transform: rotate(var(--rot, 0deg)); }
.strip-thumb .icon { position: absolute; top: 50%; left: 50%; width: 20px; height: 20px; margin: -10px 0 0 -10px; color: #fff; filter: drop-shadow(0 1px 3px rgba(0,0,0,.6)); }
.viewer-hints { margin: 0; color: rgba(255, 255, 255, .45); font-size: 12px; text-align: center; }
.viewer-hints kbd { display: inline-block; min-width: 22px; margin: 0 2px; padding: 1px 6px; border: 1px solid rgba(255, 255, 255, .2); border-bottom-width: 2px; border-radius: 6px; color: rgba(255, 255, 255, .75); font-family: inherit; font-size: 11px; text-align: center; }
.viewer-hints kbd + kbd { margin-left: 0; }
@media (hover: none) { .viewer-hints { display: none; } }

/* ---------- Responsive ---------- */

/* ---------- Secciones plegables ---------- */
.section-heading-side { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; }
.section-count { color: var(--faint); font-size: .6em; font-weight: 600; vertical-align: middle; }
.collapse-toggle { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink-2); font-size: 13.5px; font-weight: 600; white-space: nowrap; transition: background .2s, border-color .2s, color .2s; }
.collapse-toggle:hover { border-color: rgba(36, 92, 75, .35); color: var(--green); }
.collapse-toggle .icon { width: 16px; height: 16px; transition: transform .25s var(--ease); }
.collapse-toggle[aria-expanded="false"] .icon { transform: rotate(-90deg); }
.is-collapsed .section-body { display: none; }
.gallery-section.is-collapsed .gallery-hero { margin-bottom: 0; }

/* ---------- Etiquetas ---------- */
.tile-tags { position: absolute; z-index: 2; right: 8px; bottom: 8px; left: 8px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; pointer-events: none; transition: opacity .2s; }
.tile-tag { max-width: 100%; overflow: hidden; padding: 2px 8px; border-radius: 999px; background: rgba(255, 254, 251, .92); color: var(--ink); font-size: 11px; font-weight: 600; line-height: 1.5; text-overflow: ellipsis; white-space: nowrap; }
.media-tile:hover .tile-tags, .media-tile:focus-visible .tile-tags { opacity: 0; }
.owned-item .tile-tags { display: none; }
.owned-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: -4px 0 8px; }
.owned-tags:empty { display: none; }
.owned-tags .tile-tag { background: var(--green-50); color: var(--green); }
.tag-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink-2); font-size: 13px; font-weight: 600; white-space: nowrap; transition: background .2s, color .2s, border-color .2s; }
.tag-chip span { color: var(--faint); font-weight: 500; font-variant-numeric: tabular-nums; }
.tag-chip:hover { border-color: rgba(36, 92, 75, .35); color: var(--green); }
.tag-chip.is-active { border-color: var(--ink); background: var(--ink); color: #fff; }
.tag-chip.is-active span { color: rgba(255, 255, 255, .6); }
.tag-chip.is-remove::after { content: "×"; font-weight: 700; opacity: .6; }
.tag-chip.is-remove:hover { border-color: rgba(176, 68, 44, .3); background: #fbefea; color: var(--danger); }
.tag-hint { margin: 0; color: var(--muted); font-size: 13.5px; }
.segment-toggle { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink-2); font-size: 13.5px; font-weight: 600; white-space: nowrap; transition: background .2s, color .2s, border-color .2s; }
.segment-toggle .icon { width: 15px; height: 15px; }
.segment-toggle:hover { border-color: rgba(36, 92, 75, .35); color: var(--green); }
.segment-toggle[aria-pressed="true"] { border-color: var(--green); background: var(--green-50); color: var(--green); }
.gallery-group-title { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 10px; margin: 18px 0 2px; color: var(--ink); font-family: var(--font-display); font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.gallery-group-title:first-child { margin-top: 0; }
.gallery-group-title span { color: var(--faint); font-size: 14px; font-weight: 500; }
.tag-dialog { width: min(520px, calc(100% - 32px)); }
.tag-editor-list { display: flex; flex-wrap: wrap; gap: 6px; min-height: 36px; }
.tag-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-quick:empty { display: none; }
.tag-quick-label { width: 100%; margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.viewer-meta { flex-wrap: wrap; }

/* ---------- Descarga por etiquetas ---------- */
.download-dialog { width: min(520px, calc(100% - 32px)); }
.choice-group { margin: 0; padding: 0; border: 0; }
.choice-group legend { margin: 0 0 8px; padding: 0; color: var(--ink-2); font-size: 13.5px; font-weight: 600; }
.choice { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 8px; color: var(--ink); font-size: 14.5px; cursor: pointer; }
.choice input { margin: 3px 0 0; accent-color: var(--green); }
.choice small { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.download-tags { margin: 2px 0 0 26px; }
.download-tags:empty { display: none; }
.download-tags.is-muted { opacity: .55; }

/* ---------- Selección múltiple ---------- */
.tile-check { position: absolute; z-index: 3; top: 8px; right: 8px; width: 26px; height: 26px; display: none; place-items: center; border: 2px solid rgba(255, 255, 255, .95); border-radius: 50%; background: rgba(10, 16, 14, .35); color: transparent; box-shadow: 0 2px 8px rgba(0, 0, 0, .25); transition: background .2s, color .2s; }
.tile-check .icon { width: 15px; height: 15px; }
.is-selecting .tile-check { display: grid; }
.is-selecting .media-tile { cursor: pointer; }
.is-selecting .media-tile::after { opacity: 0; }
.media-tile.is-selected { outline: 3px solid var(--green); outline-offset: 2px; }
.media-tile.is-selected .tile-check { background: var(--green); color: #fff; }
.owned-item.is-selected { border-color: var(--green); box-shadow: 0 0 0 3px rgba(36, 92, 75, .15); }
.selection-bar { position: fixed; z-index: 95; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px); padding: 10px 10px 10px 18px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); box-shadow: var(--shadow-lg); transform: translateX(-50%); }
.selection-count { color: var(--ink); font-size: 14px; font-weight: 600; white-space: nowrap; }
.selection-actions { display: flex; align-items: center; gap: 6px; }
.tag-chip.is-removed { text-decoration: line-through; opacity: .55; }
.tag-chip.is-new { border-style: dashed; color: var(--green); }
.viewer-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.viewer-tags .tile-tag { background: rgba(255, 255, 255, .16); color: #fff; }

@media (max-width: 900px) {
  .home-view { grid-template-columns: 1fr; }
  .hero-copy { max-width: 620px; }
  .hero-art { height: 360px; margin-top: 24px; }
  .how-it-works { margin-top: 24px; }
  .room-grid { grid-template-columns: 1fr; }
  .panel { min-height: 0; }
}
@media (max-width: 680px) {
  :root { font-size: 15px; }
  .topbar-inner { height: 60px; }
  .nav-chip { padding: 0 10px; }
  .account-label { display: none; }
  .hero-description { font-size: 16px; }
  .create-room-row { padding: 5px; }
  .create-room-row .field { height: 46px; padding: 0 14px; font-size: 16px; }
  .create-room-row .button { min-height: 46px; padding: 0 16px; font-size: 14.5px; }
  .hero-art { width: 100%; height: 420px; margin: 8px 0 -125px; transform: scale(.7); transform-origin: center top; }
  .art-caption { display: none; }
  .how-it-works { grid-template-columns: 1fr; gap: 10px; }
  .code-pair { grid-template-columns: 1fr; }
  .created-actions { grid-template-columns: 1fr; }
  .share-row, .inline-row { flex-direction: column; }
  .share-row .button, .inline-row .button { width: 100%; }
  .room-heading { flex-direction: column; align-items: stretch; }
  .room-heading-actions { justify-content: flex-start; }
  .room-heading-actions .button { flex: 1; }
  .section-heading { flex-direction: column; align-items: flex-start; gap: 8px; }
  .unlock-panel form { flex-direction: column; }
  .unlock-panel .field { flex: none; width: 100%; }
  .unlock-panel .button { width: 100%; }
  .gallery-hero { flex-direction: column; align-items: stretch; }
  .gallery-actions { flex-direction: column-reverse; }
  .gallery-actions .button { width: 100%; }
  .gallery { gap: 6px; }
  .gallery .media-tile { border-radius: 10px; }
  .tile-label { display: none; }
  .upload-actions { flex-direction: column; align-items: stretch; }
  .owned-item { gap: 12px; padding: 8px; }
  .owned-item .media-tile { width: 84px; height: 84px; }
  .site-footer { flex-direction: column; align-items: flex-start; gap: 4px; }

  .viewer-top { padding-bottom: 28px; }
  .viewer-tool { min-width: 40px; height: 40px; padding: 0 8px; }
  .viewer-tool-label span { display: none; }
  .viewer-tool-label { padding: 0 8px; }
  .viewer-title { display: none; }
  .viewer-nav { width: 44px; height: 44px; margin-top: -22px; background: rgba(10, 16, 14, .35); }
  .viewer-nav .icon { width: 20px; height: 20px; }
  .viewer-nav-prev { left: 8px; }
  .viewer-nav-next { right: 8px; }
  .viewer-volume { display: none; }
  .viewer-video-controls { gap: 4px; padding: 4px 6px; }
  .viewer-video-time { min-width: 36px; font-size: 12px; }
  .strip-thumb { width: 52px; height: 52px; }
  .viewer-hints { display: none; }
}
@media (max-width: 420px) {
  .nav-chip-label { display: none; }
  .nav-chip { width: 38px; padding: 0; justify-content: center; }
  .topbar-actions { gap: 4px; }
  .viewer-tools { gap: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media (max-width: 680px) {
  .tile-tags { display: none; }
  .section-heading-side { width: 100%; justify-content: space-between; }
  .viewer-tags { display: none; }
}
@media (max-width: 680px) {
  .selection-bar { flex-direction: column; align-items: stretch; gap: 8px; width: calc(100vw - 32px); padding: 12px; border-radius: 18px; }
  .selection-actions { justify-content: space-between; }
  .gallery-toolbar .segment-toggle, .section-heading-side .segment-toggle { height: 36px; }
}
