/* ---------------------------------------------------------------
   Auriculares HIFI · Galería de imágenes
   Tema claro/oscuro con acento dorado. Sin recursos externos.
   --------------------------------------------------------------- */

:root {
  color-scheme: light;

  --bg: #f5f3ed;
  --bg-glow: rgba(201, 162, 39, 0.14);
  --bg-glow-2: rgba(93, 101, 110, 0.07);
  --surface: #fffdf8;
  --surface-2: #efece3;
  --surface-3: #e6e1d4;
  --text: #191a1c;
  --muted: #68675f;
  --border: #e1dccf;
  --border-strong: #cec6b4;

  --accent: #c9a227;
  --accent-strong: #84650f;
  --accent-text: #17181a;
  --accent-soft: #f4ecd4;
  --accent-ring: rgba(201, 162, 39, 0.32);

  --ok: #2d7a4b;
  --ok-soft: #e7f2ea;
  --danger: #b23a3a;
  --danger-soft: #f8e8e6;

  --shadow-sm: 0 1px 2px rgba(25, 26, 28, 0.04), 0 8px 24px rgba(25, 26, 28, 0.05);
  --shadow-md: 0 12px 32px rgba(25, 26, 28, 0.1);
  --shadow-lg: 0 28px 80px rgba(25, 26, 28, 0.2);
  --header-bg: rgba(255, 253, 248, 0.82);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --container: 1120px;
  --logo-height: 3.1rem;

  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono",
    monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0f1113;
  --bg-glow: rgba(216, 178, 74, 0.1);
  --bg-glow-2: rgba(138, 150, 163, 0.06);
  --surface: #171a1d;
  --surface-2: #1e2226;
  --surface-3: #262b30;
  --text: #f2f0ea;
  --muted: #a7a49b;
  --border: #2b3035;
  --border-strong: #3a4047;

  --accent: #d8b24a;
  --accent-strong: #e9ca76;
  --accent-text: #141517;
  --accent-soft: #2b2619;
  --accent-ring: rgba(216, 178, 74, 0.3);

  --ok: #74d09b;
  --ok-soft: #14271c;
  --danger: #ff9a91;
  --danger-soft: #2d1717;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 16px 42px rgba(0, 0, 0, 0.36);
  --shadow-lg: 0 32px 90px rgba(0, 0, 0, 0.52);
  --header-bg: rgba(15, 17, 19, 0.8);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;

    --bg: #0f1113;
    --bg-glow: rgba(216, 178, 74, 0.1);
    --bg-glow-2: rgba(138, 150, 163, 0.06);
    --surface: #171a1d;
    --surface-2: #1e2226;
    --surface-3: #262b30;
    --text: #f2f0ea;
    --muted: #a7a49b;
    --border: #2b3035;
    --border-strong: #3a4047;

    --accent: #d8b24a;
    --accent-strong: #e9ca76;
    --accent-text: #141517;
    --accent-soft: #2b2619;
    --accent-ring: rgba(216, 178, 74, 0.3);

    --ok: #74d09b;
    --ok-soft: #14271c;
    --danger: #ff9a91;
    --danger-soft: #2d1717;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 16px 42px rgba(0, 0, 0, 0.36);
    --shadow-lg: 0 32px 90px rgba(0, 0, 0, 0.52);
    --header-bg: rgba(15, 17, 19, 0.8);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(900px 520px at 88% -10%, var(--bg-glow), transparent 65%),
    radial-gradient(720px 520px at -12% 100%, var(--bg-glow-2), transparent 62%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  line-height: 1.15;
  letter-spacing: -0.025em;
}

h1 {
  font-size: clamp(2rem, 4.5vw, 3.1rem);
  font-weight: 700;
}

h2 {
  font-size: clamp(1.25rem, 2vw, 1.6rem);
  font-weight: 700;
}

a {
  color: var(--accent-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

::selection {
  background: var(--accent);
  color: var(--accent-text);
}

:where(a, button, input, textarea):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform 0.15s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

/* ---------------------------------------------------------------
   Botones y controles
   --------------------------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.72rem 1.15rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset;
  transition:
    transform 0.16s ease,
    filter 0.16s ease,
    background-color 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    opacity 0.16s ease;
}

.button svg {
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.button:hover {
  filter: brightness(1.06) saturate(1.02);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset, var(--shadow-sm);
}

.button:active {
  transform: translateY(1px);
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  filter: none;
  box-shadow: none;
}

.button.ghost {
  border-color: var(--border-strong);
  background: transparent;
  color: var(--text);
  box-shadow: none;
}

.button.ghost:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}

.button--sm {
  padding: 0.55rem 0.9rem;
  font-size: 0.86rem;
}

.button--block {
  width: 100%;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition:
    background-color 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    transform 0.16s ease;
}

.icon-button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.icon-button:active {
  transform: translateY(1px);
}

.icon-button svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle {
  display: none;
}

html.js .theme-toggle {
  display: inline-flex;
}

.theme-toggle__sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle__moon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle__sun {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle__moon {
    display: none;
  }

  :root:not([data-theme]) .theme-toggle__sun {
    display: block;
  }
}

/* ---------------------------------------------------------------
   Cabecera de la app
   --------------------------------------------------------------- */

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(18px) saturate(1.1);
  backdrop-filter: blur(18px) saturate(1.1);
}

@supports not (
  (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))
) {
  .app-header {
    background: var(--surface);
  }
}

.app-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  width: min(100%, var(--container));
  margin: 0 auto;
  padding: 0.85rem clamp(1rem, 3vw, 1.75rem);
}

.app-header__brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  text-decoration: none;
}

.brand__logo {
  width: auto;
  height: var(--logo-height);
}

.brand__logo--dark {
  display: none;
}

:root[data-theme="dark"] .brand__logo--light {
  display: none;
}

:root[data-theme="dark"] .brand__logo--dark {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .brand__logo--light {
    display: none;
  }

  :root:not([data-theme]) .brand__logo--dark {
    display: block;
  }
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  min-width: 0;
}

.header-divider {
  width: 1px;
  height: 1.5rem;
  background: var(--border);
}

.user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.user-email {
  max-width: 18ch;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.86rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ---------------------------------------------------------------
   Contenido principal
   --------------------------------------------------------------- */

.app-main {
  display: flex;
  flex-direction: column;
  gap: clamp(1.6rem, 3.5vw, 2.75rem);
  width: min(100%, var(--container));
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 3vw, 1.75rem) 3rem;
}

.hero {
  padding-top: clamp(0.25rem, 1.5vw, 1rem);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 0.75rem;
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 2rem;
  height: 1px;
  flex: 0 0 auto;
  background: var(--accent);
}

.hero .eyebrow {
  margin-bottom: 1.25rem;
}

.hero h1 {
  margin: 0 0 1.25rem;
}

.hero__text {
  margin: 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.1rem);
}

/* ---------------------------------------------------------------
   Zona de subida
   --------------------------------------------------------------- */

.upload {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: clamp(2rem, 5vw, 3.5rem) 1.5rem;
  overflow: hidden;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-align: center;
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    background-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.dropzone::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(520px 190px at 50% 0%, var(--accent-soft), transparent 72%);
  opacity: 0.75;
  pointer-events: none;
}

.dropzone > * {
  position: relative;
  z-index: 1;
}

.dropzone:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: var(--shadow-md);
  transform: scale(1.005);
}

.dropzone__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  margin-bottom: 0.25rem;
  border: 1px solid var(--accent-ring);
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.dropzone__icon svg {
  width: 1.6rem;
  height: 1.6rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dropzone-title {
  margin: 0;
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  font-weight: 700;
  line-height: 1.2;
}

.dropzone-hint {
  max-width: 46ch;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.dropzone .button {
  margin-top: 0.45rem;
}

.status {
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.status:not(:empty) {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
}

.status:not(:empty)::before {
  content: "";
  flex: 0 0 auto;
  width: 0.5rem;
  height: 0.5rem;
  margin-top: 0.45em;
  border-radius: 50%;
  background: currentColor;
}

.status.ok:not(:empty) {
  border-color: transparent;
  background: var(--ok-soft);
  color: var(--ok);
}

.status.error:not(:empty) {
  border-color: transparent;
  background: var(--danger-soft);
  color: var(--danger);
}

/* ---------------------------------------------------------------
   Galerías
   --------------------------------------------------------------- */

.gallery-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.section-head .eyebrow {
  margin-bottom: 0;
}

.section-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr));
  gap: clamp(0.8rem, 2vw, 1.15rem);
}

.gallery figure {
  position: relative;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: zoom-in;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.gallery figure:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.gallery img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--surface-2);
  object-fit: cover;
  transition: transform 0.3s ease;
}

.gallery figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.8rem 0.7rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.gallery__date,
.gallery__size {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.gallery__date {
  flex: 1 1 auto;
}

.gallery__size {
  flex: 0 0 auto;
  margin-left: auto;
}

.gallery figure::after {
  content: "Ampliar";
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  background: rgba(10, 11, 12, 0.74);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition:
    opacity 0.16s ease,
    transform 0.16s ease;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.gallery figure:focus-visible::after {
  opacity: 1;
  transform: none;
}

@media (hover: hover) {
  .dropzone:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
  }

  .gallery figure:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
  }

  .gallery figure:hover img {
    transform: scale(1.035);
  }

  .gallery figure:hover::after {
    opacity: 1;
    transform: none;
  }
}

.empty {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0;
  padding: 1.1rem 1.25rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--muted);
}

.empty__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--accent-strong);
}

.empty__icon svg {
  width: 1.2rem;
  height: 1.2rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.empty strong {
  display: block;
  margin-bottom: 0.1rem;
  color: var(--text);
  font-size: 0.95rem;
}

.empty > span:last-child {
  font-size: 0.9rem;
}

.gallery-actions {
  display: flex;
  justify-content: center;
  padding-top: 0.25rem;
}

/* ---------------------------------------------------------------
   Visor de imagen y BBCODE
   --------------------------------------------------------------- */

.image-dialog {
  width: min(1180px, 96vw);
  max-width: 1180px;
  max-height: 92vh;
  max-height: 92dvh;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}

.image-dialog::backdrop {
  background: rgba(6, 7, 8, 0.74);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.lightbox {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22rem;
  height: min(80vh, 46rem);
  max-height: 92vh;
  max-height: 92dvh;
  min-height: 32rem;
}

.lightbox__stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  padding: clamp(1rem, 3vw, 2rem);
  overflow: hidden;
  background: var(--surface-2);
}

.lightbox__stage img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  object-fit: contain;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.42);
}

.lightbox__close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition:
    background-color 0.16s ease,
    border-color 0.16s ease,
    transform 0.16s ease;
}

.lightbox__close:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.lightbox__close:active {
  transform: translateY(1px);
}

.lightbox__close svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.lightbox__panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
  min-height: 0;
  padding: clamp(1.25rem, 2.5vw, 1.75rem);
  overflow: auto;
  border-left: 1px solid var(--border);
  background: var(--surface);
}

.lightbox__head {
  padding-right: 2.5rem;
}

.lightbox__head .eyebrow {
  margin-bottom: 0.45rem;
}

.lightbox__title {
  margin: 0 0 0.35rem;
  font-size: clamp(1.3rem, 2vw, 1.55rem);
  letter-spacing: -0.02em;
}

.lightbox__meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.lightbox__meta:empty {
  display: none;
}

.lightbox__code {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.bbcode-label {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
}

.lightbox__code textarea {
  width: 100%;
  min-height: 8rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.55;
  resize: none;
}

.lightbox__code textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.copy-button {
  width: 100%;
  padding: 0.65rem 1rem;
  border-radius: 12px;
}

.copy-button svg {
  width: 1.1rem;
  height: 1.1rem;
}

.copy-button .icon-check,
.copy-button .copy-label--done {
  display: none;
}

.copy-button.copied {
  background: var(--ok);
  color: var(--bg);
}

.copy-button.copied .icon-copy,
.copy-button.copied .copy-label--copy {
  display: none;
}

.copy-button.copied .icon-check {
  display: block;
}

.copy-button.copied .copy-label--done {
  display: inline;
}

.copy-status {
  min-height: 1.1rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.copy-status.ok {
  color: var(--ok);
}

.copy-status.error {
  color: var(--danger);
}

.lightbox__actions {
  display: flex;
  margin-top: auto;
}

.lightbox__actions .button {
  width: 100%;
}

.lightbox__hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.55;
}

body.dialog-open {
  overflow: hidden;
}

/* ---------------------------------------------------------------
   Login y página de error
   --------------------------------------------------------------- */

.auth-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.auth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(100%, var(--container));
  margin: 0 auto;
  padding: 1rem clamp(1rem, 3vw, 1.75rem);
}

.login {
  position: relative;
  display: flex;
  flex: 1 0 auto;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: clamp(1.5rem, 5vw, 3.5rem) 1rem;
}

.login::before {
  content: "";
  position: absolute;
  z-index: 0;
  width: min(78vw, 42rem);
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: 50%;
  box-shadow:
    0 0 0 3.5rem rgba(201, 162, 39, 0.035),
    0 0 0 7rem rgba(201, 162, 39, 0.02);
  pointer-events: none;
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(100%, 28rem);
  padding: clamp(1.5rem, 4vw, 2.25rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.login-card > :last-child {
  margin-bottom: 0;
}

.login-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.4rem;
  height: 3.4rem;
  margin-bottom: 1rem;
  border: 1px solid var(--accent-ring);
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.login-card__icon svg {
  width: 1.55rem;
  height: 1.55rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.login-card .eyebrow {
  margin-bottom: 0.65rem;
}

.login-card h1 {
  margin: 0 0 0.65rem;
  font-size: clamp(1.55rem, 3vw, 2rem);
}

.login-card__lead {
  margin: 0 0 1.4rem;
  color: var(--muted);
  font-size: 0.95rem;
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

#login-form label {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
}

.field {
  position: relative;
}

.field svg {
  position: absolute;
  top: 50%;
  left: 0.9rem;
  width: 1.1rem;
  height: 1.1rem;
  color: var(--muted);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
  transform: translateY(-50%);
}

.field input {
  width: 100%;
  padding: 0.8rem 0.9rem 0.8rem 2.6rem;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 1rem;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.field input::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--accent-ring);
}

.field input:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--surface-2) inset;
  caret-color: var(--text);
}

.login-card .button {
  width: 100%;
}

#login-form .button {
  margin-top: 0.35rem;
}

.login-card #login-status:not(:empty),
.login-card .status.error:not(:empty) {
  margin-top: 1rem;
}

.login-card__hint {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.login-card > p > .button {
  margin-top: 0.5rem;
}

.auth-footer {
  padding: 1.25rem 1rem 1.75rem;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

/* ---------------------------------------------------------------
   Pie de la app
   --------------------------------------------------------------- */

.app-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  width: min(100%, var(--container));
  margin: 0 auto;
  padding: 1.25rem clamp(1rem, 3vw, 1.75rem) 2rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.78rem;
}

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

@media (max-width: 980px) {
  .header-divider {
    display: none;
  }
}

@media (max-width: 900px) {
  .lightbox {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 45vh) minmax(0, 1fr);
    height: min(88vh, 52rem);
    height: min(88dvh, 52rem);
    min-height: 0;
  }

  .lightbox__stage {
    padding: 1rem;
  }

  .lightbox__panel {
    border-top: 1px solid var(--border);
    border-left: 0;
  }
}

@media (max-width: 700px) {
  .app-header__inner {
    gap: 0.6rem;
  }

  .header-tools {
    width: 100%;
    margin-left: 0;
    justify-content: flex-end;
  }
}

@media (max-width: 560px) {
  :root {
    --logo-height: 2.75rem;
  }

  .user-email {
    max-width: 12ch;
  }

  .logout-label {
    display: none;
  }

  #logout {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
  }

  .gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .empty {
    align-items: flex-start;
  }

  .lightbox {
    grid-template-rows: minmax(0, 42vh) minmax(0, 1fr);
    height: 90vh;
    height: 90dvh;
  }

  .lightbox__panel {
    gap: 1rem;
    padding: 1.1rem;
  }

  .lightbox__head {
    padding-right: 2.25rem;
  }

  .lightbox__title {
    font-size: 1.25rem;
  }

  .lightbox__code {
    padding: 0.8rem;
  }

  .lightbox__code textarea {
    min-height: 7rem;
  }

  .lightbox__close {
    top: 0.7rem;
    right: 0.7rem;
    width: 2.2rem;
    height: 2.2rem;
  }

  .app-footer {
    flex-direction: column;
  }
}

@media (max-width: 380px) {
  .user-email {
    max-width: 8ch;
  }

  .brand__logo {
    height: 2.4rem;
  }

  .login-card {
    padding: 1.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
