/* Galería de fotos deportivas — Big Shoulders (títulos) + Instrument Sans (texto). Fuentes con licencia OFL. */
@font-face { font-family: "Big Shoulders"; src: url("/static/fonts/bigshoulders-bold.woff") format("woff"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("/static/fonts/instrumentsans-regular.woff") format("woff"); font-weight: 400 500; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("/static/fonts/instrumentsans-bold.woff") format("woff"); font-weight: 600 700; font-display: swap; }

:root {
  --bg: #121417;
  --surface: #1b1f24;
  --surface-2: #232830;
  --line: #2c333b;
  --text: #eceef0;
  --muted: #9aa3ad;
  --amber: #ffb23e;
  --amber-ink: #1a1100;
  --danger: #ff7a6b;
  --ok: #7ddc9a;
  --radius: 10px;
  --gutter: 12px;
  --gap: 4px;
  --display: "Big Shoulders", "Arial Narrow", "Roboto Condensed", Impact, sans-serif;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
@media (min-width: 700px) { :root { --gutter: 24px; --gap: 6px; } }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 1rem/1.5 var(--sans); -webkit-font-smoothing: antialiased; min-height: 100dvh; }
body.lock { overflow: hidden; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .55rem; min-height: 44px; padding: .55rem 1.1rem; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--text); font-weight: 600; font-size: .95rem; cursor: pointer; text-decoration: none; transition: background-color .15s, border-color .15s; }
.btn:hover { background: var(--surface-2); border-color: #3b444e; }
.btn.primary { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); }
.btn.primary:hover { background: #ffc063; border-color: #ffc063; }
.btn.danger { color: var(--danger); border-color: #4a2a27; }
.btn.danger:hover { background: #2a1917; border-color: #6a3a35; }
.btn.small { min-height: 36px; padding: .3rem .8rem; font-size: .88rem; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn svg, .icon-btn svg { width: 20px; height: 20px; flex: none; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--text); cursor: pointer; }
.icon-btn:hover { background: rgba(255, 255, 255, .1); }

/* ---------- Cabecera + idioma ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 14px var(--gutter); }
.brand { font-weight: 700; font-size: 1rem; letter-spacing: .01em; min-height: 1em; }
.lang { display: flex; gap: .15rem; }
.lang button { background: none; border: 0; padding: .45rem .55rem; min-height: 44px; min-width: 44px; color: var(--muted); font-weight: 600; font-size: .85rem; cursor: pointer; border-bottom: 2px solid transparent; }
.lang button:hover { color: var(--text); }
.lang button[aria-pressed="true"] { color: var(--text); border-bottom-color: var(--amber); }

/* ---------- Portada del álbum ---------- */
.hero { padding: clamp(1.5rem, 6vw, 4rem) var(--gutter) clamp(1.25rem, 4vw, 2.5rem); }
.title { font-family: var(--display); font-weight: 700; text-transform: uppercase; font-size: clamp(3.1rem, 13vw, 9rem); line-height: .86; letter-spacing: .004em; text-wrap: balance; max-width: 16ch; overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; margin-top: 1.1rem; color: var(--muted); font-size: .98rem; }
.actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.5rem; }

/* ---------- Rejilla justificada ---------- */
.grid { padding: 0 var(--gutter) 6rem; }
.sec { font-family: var(--display); font-weight: 700; font-size: clamp(1.5rem, 4vw, 2.1rem); text-transform: uppercase; letter-spacing: .02em; margin: 2rem 0 .8rem; line-height: 1; }
.grid > section:first-child .sec { margin-top: 0; }
.rows { display: flex; flex-direction: column; gap: var(--gap); }
.row { display: flex; gap: var(--gap); }
.ph { position: relative; margin: 0; flex: 0 0 auto; background: var(--surface); overflow: hidden; border-radius: 3px; }
.ph .open { all: unset; display: block; width: 100%; height: 100%; cursor: zoom-in; }
.ph .open:focus-visible { outline: 2px solid var(--amber); outline-offset: -2px; }
.ph img { display: block; width: 100%; height: 100%; object-fit: cover; transition: opacity .25s; }
.ph img:not(.ready) { opacity: 0; }
.ph .chk { position: absolute; top: 8px; left: 8px; width: 30px; height: 30px; display: grid; place-items: center; padding: 0; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .85); background: rgba(10, 12, 14, .45); color: transparent; cursor: pointer; opacity: 0; transition: opacity .15s, background-color .15s; }
.ph .chk svg { width: 16px; height: 16px; }
.ph:hover .chk, .ph:focus-within .chk, .selecting .ph .chk { opacity: 1; }
.ph.selected .chk { opacity: 1; background: var(--amber); border-color: var(--amber); color: var(--amber-ink); }
.ph.selected::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 3px var(--amber); pointer-events: none; border-radius: 3px; }
.selecting .ph .open { cursor: pointer; }
@media (hover: none) { .ph .chk { opacity: 0; } .selecting .ph .chk, .ph.selected .chk { opacity: 1; } }

/* ---------- Barra de selección ---------- */
.bar { position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translate(-50%, 0); z-index: 30; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; justify-content: center; width: max-content; max-width: calc(100% - 24px); padding: .6rem .7rem .6rem 1.1rem; background: rgba(27, 31, 36, .96); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 40px rgba(0, 0, 0, .5); animation: rise .22s ease-out; }
.bar .count { font-weight: 600; margin-right: .3rem; }
@keyframes rise { from { transform: translate(-50%, 24px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* ---------- Visor ---------- */
.lb { position: fixed; inset: 0; z-index: 50; display: grid; grid-template-rows: auto 1fr; background: #0a0b0d; }
.lb-top { display: flex; align-items: center; justify-content: space-between; padding: max(8px, env(safe-area-inset-top)) 10px 8px 18px; gap: 1rem; }
.lb-count { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.lb-tools { display: flex; align-items: center; gap: .4rem; }
.lb-stage { position: relative; min-height: 0; display: grid; place-items: center; padding: 0 0 max(10px, env(safe-area-inset-bottom)); touch-action: pan-y; }
.lb-img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 52px; height: 72px; border: 0; background: transparent; color: var(--text); cursor: pointer; display: grid; place-items: center; opacity: .75; }
.lb-nav:hover { opacity: 1; background: rgba(255, 255, 255, .06); }
.lb-nav.prev { left: 0; border-radius: 0 12px 12px 0; }
.lb-nav.next { right: 0; border-radius: 12px 0 0 12px; }
.lb-nav svg { width: 28px; height: 28px; }
@media (hover: none) { .lb-nav { display: none; } }

/* ---------- Pantallas de acceso / error ---------- */
.gate { max-width: 560px; padding: clamp(2rem, 9vw, 6rem) var(--gutter) 4rem; }
.gate .title { font-size: clamp(2.8rem, 12vw, 6.5rem); }
.gate p.lead { margin-top: 1.1rem; color: var(--muted); max-width: 44ch; }
.gate form { margin-top: 1.6rem; display: grid; gap: .8rem; }
.pw { position: relative; }
.pw input { padding-right: 5.2rem; }
.pw button { position: absolute; right: 4px; top: 4px; bottom: 4px; padding: 0 .9rem; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-weight: 600; font-size: .85rem; cursor: pointer; }
.pw button:hover { color: var(--text); background: var(--surface-2); }
input[type=text], input[type=password], input[type=date], input[type=url], input[type=email], input[type=number], input:not([type]), textarea, select { width: 100%; min-height: 48px; padding: .7rem .95rem; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 1rem; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; border-color: transparent; }
.msg { min-height: 1.4em; font-size: .93rem; color: var(--danger); }
.msg.ok { color: var(--ok); }

/* ---------- Avisos y diálogos ---------- */
.toast { position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 80; max-width: calc(100% - 28px); padding: .75rem 1.1rem; background: var(--surface-2); border: 1px solid #3b444e; border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); font-size: .95rem; animation: fade .2s ease-out; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
dialog { width: min(560px, calc(100% - 24px)); max-height: calc(100dvh - 32px); padding: 0; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
dialog::backdrop { background: rgba(5, 6, 8, .7); }
dialog[open] { display: flex; flex-direction: column; animation: fade .18s ease-out; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.2rem 1.3rem .4rem; }
.dlg-head h2 { font-family: var(--display); font-weight: 700; font-size: 1.9rem; text-transform: uppercase; letter-spacing: .02em; line-height: 1; }
.dlg-body { padding: .6rem 1.3rem 1.2rem; overflow: auto; display: grid; gap: .8rem; }
.dlg-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: .6rem; padding: .9rem 1.3rem 1.2rem; border-top: 1px solid var(--line); }
.push { margin-right: auto; }
.parts { display: grid; gap: .5rem; }
.parts .btn { justify-content: space-between; }

/* ---------- Administración ---------- */
body.admin .top { border-bottom: 1px solid var(--line); padding-top: 10px; padding-bottom: 10px; }
.tabs { display: flex; gap: .2rem; }
.tabs button { background: none; border: 0; padding: .55rem .9rem; min-height: 44px; color: var(--muted); font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; }
.tabs button[aria-current="page"] { color: var(--text); border-bottom-color: var(--amber); }
.tabs button:hover { color: var(--text); }
.wrap { width: min(980px, 100%); margin: 0 auto; padding: clamp(1.2rem, 4vw, 2.4rem) var(--gutter) 5rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.page-head h1 { font-family: var(--display); font-weight: 700; text-transform: uppercase; font-size: clamp(2.4rem, 8vw, 4rem); line-height: .9; }
.notice { padding: .9rem 1.1rem; border: 1px solid #5a4620; background: #2a2212; border-radius: var(--radius); color: #ffd99a; margin-bottom: 1.2rem; font-size: .95rem; }
.empty { padding: 3rem 1rem; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 14px; }
.empty p { max-width: 40ch; margin: 0 auto 1.1rem; }
.links { display: grid; gap: .8rem; }
.link-row { display: grid; grid-template-columns: 96px 1fr; gap: 1rem; padding: .8rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.link-row .cover { width: 96px; height: 96px; border-radius: 8px; background: var(--surface-2); object-fit: cover; display: block; }
.link-row h3 { font-size: 1.12rem; font-weight: 700; overflow-wrap: anywhere; }
.link-row .sub { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.link-row .url { margin-top: .35rem; font-size: .88rem; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: .3rem .55rem; overflow-wrap: anywhere; user-select: all; }
.link-row .stats { display: flex; flex-wrap: wrap; gap: .2rem 1.1rem; color: var(--muted); font-size: .88rem; margin-top: .45rem; }
.link-row .acts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .5rem; }
@media (min-width: 760px) { .link-row { grid-template-columns: 96px 1fr auto; align-items: start; } .link-row .acts { grid-column: auto; flex-direction: column; align-items: stretch; } }
.tag { display: inline-block; padding: .08rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; border: 1px solid var(--line); color: var(--muted); margin-right: .35rem; vertical-align: middle; }
.tag.warn { color: var(--amber); border-color: #5a4620; }
.tag.off { color: var(--danger); border-color: #4a2a27; }
.tag.lock { color: var(--text); }
.field { display: grid; gap: .35rem; }
.field > label, .field > .lbl { font-weight: 600; font-size: .92rem; }
.hint { color: var(--muted); font-size: .86rem; }
.check { display: flex; gap: .7rem; align-items: center; min-height: 44px; cursor: pointer; font-weight: 500; }
.check input { width: 20px; height: 20px; accent-color: var(--amber); }
.crumbs { display: flex; flex-wrap: wrap; gap: .1rem; align-items: center; font-size: .92rem; }
.crumbs button { background: none; border: 0; color: var(--muted); padding: .35rem .4rem; min-height: 36px; cursor: pointer; border-radius: 6px; font-weight: 600; }
.crumbs button:hover { color: var(--text); background: var(--surface-2); }
.crumbs span { color: var(--line); }
.folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; }
.folder { all: unset; box-sizing: border-box; cursor: pointer; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface-2); display: grid; }
.folder:hover { border-color: #46515c; }
.folder:focus-visible { outline: 2px solid var(--amber); }
.folder .th { aspect-ratio: 4 / 3; background: var(--bg); display: grid; place-items: center; color: var(--muted); overflow: hidden; }
.folder .th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.folder .th svg { width: 34px; height: 34px; opacity: .6; }
.folder .nm { padding: .5rem .65rem .1rem; font-weight: 600; font-size: .92rem; overflow-wrap: anywhere; }
.folder .ct { padding: 0 .65rem .55rem; color: var(--muted); font-size: .82rem; }
.pwgen { display: flex; gap: .5rem; flex-wrap: wrap; }
.strength { height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.strength i { display: block; height: 100%; width: 0; background: var(--danger); transition: width .2s, background-color .2s; }
.card { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 1.2rem; display: grid; gap: .9rem; margin-bottom: 1rem; }
.card h2 { font-size: 1.1rem; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .9rem; }
.login { max-width: 460px; margin: 0 auto; padding: clamp(2rem, 10vw, 6rem) var(--gutter); }
.login h1 { font-family: var(--display); font-weight: 700; text-transform: uppercase; font-size: clamp(3rem, 12vw, 5.5rem); line-height: .88; }
.login p.lead { color: var(--muted); margin: 1rem 0 1.4rem; }
.login form { display: grid; gap: .8rem; }

.covers { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: .4rem; max-height: 240px; overflow: auto; padding: 2px; }
.cv { all: unset; box-sizing: border-box; cursor: pointer; aspect-ratio: 1; border-radius: 8px; overflow: hidden; border: 2px solid var(--line); background: var(--bg); display: grid; place-items: center; }
.cv img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cv.on { border-color: var(--amber); }
.cv:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }
.cv .auto { font-size: .78rem; font-weight: 600; color: var(--muted); padding: .2rem; text-align: center; }
.cv.on .auto { color: var(--amber); }
.msg-card { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 1rem 1.1rem; display: grid; gap: .6rem; }
.msg-card.unread { border-color: #5a4620; }
.msg-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .2rem 1rem; align-items: baseline; }
.msg-head h3 { font-size: 1.1rem; }
.msg-head .sub { color: var(--muted); font-size: .88rem; }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.acts.row { display: flex; flex-wrap: wrap; gap: .5rem; }
details.about { border: 1px solid var(--line); border-radius: 10px; padding: .6rem .9rem; }
details.about summary { cursor: pointer; font-weight: 600; min-height: 36px; display: flex; align-items: center; }
details.about[open] { display: grid; gap: .8rem; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ---------- Estadísticas (admin) ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.kpi { display: grid; gap: .15rem; align-content: start; padding: 1.1rem 1.2rem; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.kpi strong { font-family: var(--display, inherit); font-size: 2.6rem; line-height: 1; font-weight: 700; color: var(--amber); letter-spacing: .01em; }
.kpi span { font-weight: 600; }
.kpi small { color: var(--muted); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; margin-bottom: 1rem; align-items: start; }
.grid2 .card, .page-head + .kpis + .card { margin-bottom: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { background: none; border: 0; color: var(--muted); padding: .5rem .85rem; min-height: 40px; font: inherit; font-weight: 600; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--amber); color: var(--amber-ink); }
.chart { display: flex; align-items: flex-end; gap: 2px; height: 150px; margin-top: .6rem; }
.chart .col { flex: 1; height: 100%; display: flex; align-items: flex-end; min-width: 0; }
.chart .col i { display: block; width: 100%; background: var(--amber); border-radius: 2px 2px 0 0; min-height: 0; }
.chart .col:hover i { background: #ffd08a; }
.chart-x { display: flex; justify-content: space-between; color: var(--muted); font-size: .8rem; margin-top: .3rem; }
.chart.hours { height: 90px; gap: 3px; }
.bars { list-style: none; margin: .4rem 0 0; padding: 0; display: grid; gap: .55rem; }
.bars li { display: grid; grid-template-columns: minmax(70px, 38%) 1fr auto; gap: .6rem; align-items: center; font-size: .95rem; }
.bars .bl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars .bt { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.bars .bt i { display: block; height: 100%; background: var(--amber); border-radius: 4px; }
.bars .bv { font-variant-numeric: tabular-nums; text-align: right; }
.bars small { color: var(--muted); margin-left: .3rem; }
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .95rem; }
.tbl th, .tbl td { text-align: right; padding: .55rem .6rem; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl th { color: var(--muted); font-weight: 600; }
.top { flex-wrap: wrap; }
.tabs { overflow-x: auto; max-width: 100%; }
.tabs button { white-space: nowrap; }
.chart { justify-content: flex-end; }
.chart .col { flex: 1 1 0; max-width: 34px; }
/* ---------- Generador y plantilla para compartir ---------- */
.genlen { display: inline-flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .9rem; }
.genlen select { min-height: 40px; padding: .3rem .6rem; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.pwgen { align-items: center; }
.share { display: grid; gap: .6rem; }
.share-row { display: grid; grid-template-columns: 6.2rem 1fr auto; gap: .7rem; align-items: center; padding: .7rem .8rem; background: var(--bg, #121417); border: 1px solid var(--line); border-radius: 10px; }
.share-row .lbl { font-weight: 600; color: var(--muted); }
.share-row .mono { overflow-wrap: anywhere; user-select: all; }
@media (max-width: 520px) { .share-row { grid-template-columns: 1fr auto; } .share-row .lbl { grid-column: 1 / -1; } }
.limbox { display: grid; gap: .5rem; margin-top: .4rem; padding-left: 1.9rem; }
.limbox[hidden] { display: none; }
.limbox .row { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.limbox input[type=number] { width: 7.5rem; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--amber); font: inherit; text-decoration: underline; cursor: pointer; }
