/* Marco de fotos: álbum y admin (celular primero). */
@font-face {
  font-family: "Fraunces";
  src: url("/assets/fonts/fraunces.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
:root {
  --bg: #fbf6ef;
  --card: #ffffff;
  --ink: #2b2420;
  --muted: #7a6d63;
  --line: #eadfd2;
  --accent: #c8643b;
  --accent-ink: #ffffff;
  --soft: #f4e8da;
  --ok: #3f8a5a;
  --danger: #b23a3a;
  --shadow: 0 6px 24px rgba(60, 40, 20, 0.12);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1815;
    --card: #27211d;
    --ink: #f3ebe2;
    --muted: #b3a597;
    --line: #3a312b;
    --accent: #e0855c;
    --accent-ink: #1c1815;
    --soft: #322a24;
    --ok: #6cbf8a;
    --danger: #e07070;
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
}
h1, h2, h3 { font-family: "Fraunces", Georgia, serif; font-weight: 600; line-height: 1.15; margin: 0; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.wrap { max-width: 920px; margin: 0 auto; padding: 0 16px 120px; }
.top {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 0 14px;
}
.top h1 { font-size: 26px; flex: 1; min-width: 0; }
.who { color: var(--muted); font-size: 14px; text-align: right; }
.who .link { margin-left: 10px; }
.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; font-size: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border-radius: 999px; border: 0;
  background: var(--accent); color: var(--accent-ink); font-weight: 600; cursor: pointer;
  text-decoration: none; white-space: nowrap;
}
.btn.alt { background: var(--soft); color: var(--ink); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 14px; }
.btn:disabled { opacity: 0.5; cursor: default; }

/* ---------- entrada ---------- */
.hero {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 32px 16px; gap: 18px;
}
.hero .frame {
  width: 120px; height: 96px; border-radius: 10px; border: 8px solid var(--accent);
  background: linear-gradient(160deg, #f6c99a, #e48a5c 60%, #b8573a); box-shadow: var(--shadow);
}
.hero h1 { font-size: 34px; }
.hero p { color: var(--muted); max-width: 30em; margin: 0; }
.gbtn {
  display: inline-flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 24px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font-weight: 600; text-decoration: none; box-shadow: var(--shadow);
}
.gbtn svg { width: 22px; height: 22px; }
.notice {
  background: var(--soft); border-radius: 14px; padding: 14px 16px; max-width: 30em; text-align: left;
}

/* ---------- álbum ---------- */
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 4px;
}
.grid button {
  position: relative; aspect-ratio: 1; padding: 0; border: 0; border-radius: 6px; overflow: hidden;
  background: var(--soft); cursor: pointer;
}
.grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.grid .badge {
  position: absolute; left: 6px; bottom: 6px; background: rgba(0, 0, 0, 0.55); color: #fff;
  font-size: 11px; padding: 2px 7px; border-radius: 99px;
}
.empty { text-align: center; color: var(--muted); padding: 48px 16px; }
.more { display: flex; justify-content: center; padding: 18px; }

.dock {
  position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--bg) 35%); display: flex; justify-content: center;
}
.dock .btn { min-width: 220px; box-shadow: var(--shadow); font-size: 18px; }
.quota { text-align: center; color: var(--muted); font-size: 13px; margin-top: 4px; }

/* cola de subida */
.queue { margin: 4px 0 18px; display: grid; gap: 8px; }
.qrow {
  display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 12px; padding: 8px;
  box-shadow: 0 1px 0 var(--line);
}
.qrow img { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; background: var(--soft); }
.qrow .txt { flex: 1; min-width: 0; font-size: 14px; }
.qrow .bar { height: 5px; border-radius: 9px; background: var(--soft); overflow: hidden; margin-top: 6px; }
.qrow .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.3s; }
.qrow.ok .bar i { background: var(--ok); }
.qrow.bad .txt { color: var(--danger); }

/* visor */
.viewer {
  position: fixed; inset: 0; background: #000; z-index: 20; display: flex; flex-direction: column;
}
.viewer .stage { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; }
.viewer .stage img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer .bar {
  display: flex; gap: 8px; align-items: center; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  color: #fff; background: rgba(0, 0, 0, 0.6); flex-wrap: wrap;
}
.viewer .cap { flex: 1 1 200px; min-width: 0; font-size: 15px; }
.viewer .cap small { display: block; color: #cbbfb3; }
.viewer .x {
  position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: rgba(0, 0, 0, 0.5); color: #fff; font-size: 22px; cursor: pointer;
}
.viewer .nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; border: 0;
  background: rgba(0, 0, 0, 0.35); color: #fff; font-size: 26px; cursor: pointer;
}
.viewer .nav.prev { left: 0; border-radius: 0 10px 10px 0; }
.viewer .nav.next { right: 0; border-radius: 10px 0 0 10px; }

/* modal propio (nunca confirm/prompt/alert) */
.modal-back {
  position: fixed; inset: 0; background: rgba(20, 12, 6, 0.55); z-index: 40;
  display: flex; align-items: flex-end; justify-content: center; padding: 16px;
}
@media (min-width: 600px) { .modal-back { align-items: center; } }
.modal {
  width: 100%; max-width: 420px; background: var(--card); border-radius: 20px; padding: 22px 20px 18px;
  box-shadow: var(--shadow); display: grid; gap: 14px;
}
.modal h3 { font-size: 21px; }
.modal p { margin: 0; color: var(--muted); }
.modal .acts { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.field {
  width: 100%; min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg);
  padding: 0 14px;
}
select.field { padding-right: 8px; }
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 99px; font-size: 14px;
  max-width: calc(100% - 32px); text-align: center;
}

/* ---------- admin ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 14px; }
.tabs button {
  border: 0; background: var(--soft); border-radius: 99px; padding: 9px 16px; cursor: pointer; white-space: nowrap;
}
.tabs button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.card {
  background: var(--card); border-radius: 16px; padding: 16px; margin-bottom: 14px; box-shadow: 0 1px 0 var(--line);
}
.card h2 { font-size: 20px; margin-bottom: 10px; }
.card .hint { color: var(--muted); font-size: 14px; margin: 0 0 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stat { background: var(--soft); border-radius: 12px; padding: 12px; }
.stat b { display: block; font-size: 24px; font-family: "Fraunces", Georgia, serif; }
.stat span { color: var(--muted); font-size: 13px; }
.row {
  display: flex; gap: 10px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap;
}
.row:first-of-type { border-top: 0; }
.row .main { flex: 1 1 180px; min-width: 0; }
.row .main small { display: block; color: var(--muted); overflow-wrap: anywhere; }
.pill { font-size: 12px; padding: 3px 9px; border-radius: 99px; background: var(--soft); white-space: nowrap; }
.pill.on { background: color-mix(in srgb, var(--ok) 20%, transparent); color: var(--ok); }
.pill.off { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.form { display: grid; gap: 10px; }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; gap: 10px; align-items: center; min-height: 44px; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }
.code-input { font-size: 26px; letter-spacing: 0.25em; text-transform: uppercase; text-align: center; }
.agrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.agrid .ph { background: var(--soft); border-radius: 12px; overflow: hidden; }
.agrid img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.agrid .meta { padding: 6px 8px; font-size: 12px; color: var(--muted); }
.agrid .acts { display: flex; gap: 4px; padding: 0 6px 8px; flex-wrap: wrap; }
.agrid .acts .btn { flex: 1; min-height: 34px; padding: 0 8px; font-size: 13px; }
.log { font-size: 13px; color: var(--muted); }
.log div { padding: 6px 0; border-top: 1px solid var(--line); }
