@font-face { font-family: 'Fredoka'; font-weight: 500; font-display: swap; src: url('/fonts/fredoka-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Fredoka'; font-weight: 600; font-display: swap; src: url('/fonts/fredoka-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 700; font-display: swap; src: url('/fonts/nunito-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 700; font-display: swap; src: url('/fonts/jetbrains-mono-latin-700-normal.woff2') format('woff2'); }

:root { --paper: #f7f1e2; --paper-2: #efe6d0; --card: #fffdf7; --ink: #2a2218; --soft: #6d5f49; --line: #ddd0b4; --fire: #ef5b2a; --fire-d: #c9421a; --leaf: #3f9a5a; --danger: #d62828; --forest: #153a2c; }
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: 'Nunito', 'Segoe UI', system-ui, sans-serif; font-weight: 700; font-size: 16px; color: var(--ink); background: radial-gradient(120% 90% at 50% 20%, #2a6a4d 0%, #17412f 55%, #0b2219 100%); min-height: 100vh; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: 'Fredoka', 'Nunito', sans-serif; font-weight: 600; margin: 0; }
.mono { font-family: 'JetBrains Mono', Consolas, monospace; font-weight: 700; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border-radius: 12px; border: 2px solid transparent; font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 17px; cursor: pointer; background: var(--fire); color: #fff; border-color: #ff8a5c; box-shadow: 0 4px 0 var(--fire-d); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--fire-d); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.light { background: var(--card); color: var(--ink); border-color: var(--line); box-shadow: 0 3px 0 rgba(60,40,10,.16); }
.btn.green { background: var(--leaf); border-color: #6fc58a; box-shadow: 0 4px 0 #2b6e40; }
.btn.red { background: var(--danger); border-color: #f07a7a; box-shadow: 0 4px 0 #8f1a1a; }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 15px; border-radius: 10px; }
input[type=text], input[type=email], input[type=password], input[type=number] { width: 100%; height: 46px; padding: 0 14px; border-radius: 12px; border: 2px solid var(--line); background: #fff; outline: none; }
input:focus { border-color: var(--fire); }
label { display: block; font-size: 14px; color: var(--soft); margin: 12px 0 4px; }

/* ---------- pantalla de bloqueo ---------- */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate-inner { display: flex; align-items: flex-end; gap: 12px; max-width: 760px; width: 100%; justify-content: center; }
.gate .robin { width: 190px; flex: none; margin-bottom: -6px; filter: drop-shadow(0 6px 5px rgba(0,0,0,.35)); animation: bob 2.8s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(5px) rotate(-1.2deg); } }
.gate .card, .panel-card { background: var(--card); border: 3px solid #cdbd98; border-radius: 24px; padding: 26px 28px; box-shadow: 0 20px 50px rgba(0,0,0,.45); text-align: center; flex: 1; max-width: 460px; }
.gate h1 { font-size: 28px; }
.gate p { margin: 8px 0 0; color: var(--soft); line-height: 1.4; }
.qrbox { width: 230px; height: 230px; margin: 16px auto 8px; padding: 10px; background: #fff; border: 2px solid var(--line); border-radius: 18px; }
.qrbox svg { width: 100%; height: 100%; display: block; }
.code { font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 36px; letter-spacing: .22em; padding-left: .22em; }
.small { font-size: 14px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #e6a817; margin-right: 6px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.redeem { margin-top: 18px; text-align: left; }
.redeem summary { cursor: pointer; color: var(--soft); font-size: 15px; text-align: center; }
.redeem form { display: flex; gap: 8px; margin-top: 10px; }
.err { color: var(--danger); min-height: 1.2em; font-size: 14px; }
@media (max-width: 640px) { .gate .robin { display: none; } }

/* ---------- panel de admin ---------- */
.shell { max-width: 980px; margin: 0 auto; padding: 18px 16px 60px; }
.topbar { display: flex; align-items: center; gap: 12px; color: #eaf3e6; margin-bottom: 14px; }
.topbar img { width: 44px; }
.topbar h1 { font-size: 24px; flex: 1; }
.topbar .who { font-size: 14px; opacity: .85; }
.gatebar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 14px; border-radius: 16px; background: #e4f4e8; border: 3px solid #8fcfa0; color: #174a2a; }
.gatebar .gb-text { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 2px; }
.gatebar .gb-text b { font-family: 'Fredoka', sans-serif; font-size: 18px; }
.gatebar .gb-text span { font-size: 14px; font-weight: 600; }
.gatebar.off { background: #fde4e4; border-color: #e58a8a; color: #7d1717; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { border: 2px solid rgba(255,255,255,.2); background: rgba(255,255,255,.08); color: #eaf3e6; border-radius: 12px; padding: 8px 18px; font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 16px; cursor: pointer; }
.tabs button.on { background: var(--card); color: var(--ink); border-color: var(--card); }
.panel-card { max-width: none; text-align: left; padding: 22px; margin-bottom: 14px; }
.panel-card h2 { font-size: 21px; margin-bottom: 4px; }
.panel-card .hint { color: var(--soft); font-size: 14px; margin: 0 0 10px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > * { flex: none; }
.row input { flex: 1; min-width: 140px; }
.list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 2px solid var(--line); border-radius: 14px; background: #fff; flex-wrap: wrap; }
.item .main { flex: 1; min-width: 200px; }
.item .main b { font-family: 'JetBrains Mono', monospace; letter-spacing: .1em; }
.item .meta { color: var(--soft); font-size: 13.5px; font-weight: 600; }
.tag { font-size: 12.5px; padding: 2px 10px; border-radius: 999px; background: var(--paper-2); }
.tag.ok { background: #d9f2de; color: #1f6b35; } .tag.pend { background: #fff0c9; color: #8a6200; } .tag.bad { background: #fde0e0; color: #9a1c1c; }
.empty { color: var(--soft); padding: 14px; text-align: center; font-size: 15px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 12px; }
.codecard { border: 2px solid var(--line); border-radius: 16px; padding: 12px; text-align: center; background: #fff; }
.codecard .qr { width: 150px; height: 150px; margin: 0 auto; }
.codecard .qr svg { width: 100%; height: 100%; }
.codecard .c { font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 20px; letter-spacing: .12em; margin-top: 6px; }
.codecard .meta { color: var(--soft); font-size: 13px; margin: 2px 0 8px; }
.codecard.dead { opacity: .5; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.66); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal .box { background: var(--card); border: 3px solid #cdbd98; border-radius: 22px; padding: 24px; width: min(460px, 100%); text-align: center; }
.modal video { width: 100%; border-radius: 14px; background: #000; aspect-ratio: 4 / 3; object-fit: cover; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1d2b23; color: #fff; padding: 10px 18px; border-radius: 12px; z-index: 60; font-size: 15px; }
.toast.err { background: var(--danger); }
@media print {
  body { background: #fff; } .topbar, .gatebar, .tabs, .no-print, .panel-card:not(#printable) { display: none !important; }
  #printable { box-shadow: none; border: 0; } .codecard { break-inside: avoid; } .codecard button { display: none; }
}
