/* Ciberimaginario AR — estilos comunes (reproductor, portada, backoffice, acceso) */
:root {
  --bg: #0B1626;
  --surface: #12223A;
  --surface-2: #19304F;
  --line: #24406A;
  --text: #E8F2FA;
  --muted: #9FB3C8;
  --accent: #22B8E6;
  --on-accent: #04121C;
  --ok: #3DDC97;
  --ko: #FF7A7A;
  --warn: #FFC857;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.5; -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; min-height: 100dvh; }
a { color: var(--accent); }
img { max-width: 100%; }
h1 { font-size: clamp(1.6rem, 6vw, 2.3rem); line-height: 1.15; margin: .2em 0 .5em; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 .5em; }
h3 { font-size: 1.05rem; margin: .2em 0 .6em; }
p { margin: 0 0 .9em; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.kicker { text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; font-weight: 700; color: var(--accent); margin: 0; }
.lead { font-size: 1.1rem; color: var(--muted); }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4em; font: inherit; font-weight: 650; font-size: 1rem;
  padding: .75em 1.2em; border-radius: 999px; border: 1px solid var(--accent); background: transparent; color: var(--text);
  text-decoration: none; cursor: pointer; min-height: 44px; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.ghost { border-color: var(--line); background: var(--surface); }
.btn.small { font-size: .875rem; padding: .45em .9em; min-height: 36px; }
.btn.big { font-size: 1.1rem; padding: .9em 1.5em; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible, a:focus-visible, input:focus-visible, .linkbtn:focus-visible { outline: 3px solid var(--warn); outline-offset: 2px; }
.linkbtn { background: none; border: 0; color: var(--muted); font: inherit; text-decoration: underline; cursor: pointer; padding: 0; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; }

.pill { display: inline-block; font-size: .8rem; font-weight: 700; padding: .25em .7em; border-radius: 999px; background: var(--surface-2); color: var(--text); white-space: nowrap; }
.pill.warn { background: var(--warn); color: #241A00; }
.pill.ok { background: var(--ok); color: #03281A; }
.notice { padding: .7em 1em; border-radius: 10px; background: var(--surface-2); margin: 0 0 1em; }
.notice.err { background: #3A1720; color: #FFD2D2; }
.notice.ok { background: #0F3A2A; color: #CFF7E6; }
.notice.warn { background: #3A3016; color: #FFE7A8; margin: 0; border-radius: 0; text-align: center; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin: 0 0 1rem; }

/* Idioma */
.langswitch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.langbtn { font: inherit; font-size: .8rem; font-weight: 700; background: transparent; color: var(--muted); border: 0; padding: .35em .7em; cursor: pointer; min-height: 32px; }
.langbtn[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

/* ── Reproductor ── */
.pl-head { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: .6rem; padding: .7rem 16px; padding-top: calc(.7rem + env(safe-area-inset-top));
  background: rgba(11, 22, 38, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.pl-title { flex: 1; min-width: 0; color: var(--text); text-decoration: none; font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-main { max-width: 640px; margin: 0 auto; padding: 1.4rem 16px 2rem; }
.pl-loading { text-align: center; padding: 30vh 16px; color: var(--muted); }
.pl-nav { display: flex; justify-content: space-between; gap: .75rem; margin-top: 2rem; position: sticky; bottom: 0; padding: .8rem 0 calc(.8rem + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--bg) 35%); }
.pl-foot { max-width: 640px; margin: 0 auto; padding: 1.5rem 16px calc(2rem + env(safe-area-inset-bottom)); font-size: .78rem; color: var(--muted); border-top: 1px solid var(--line); }
.hero { display: block; border-radius: var(--radius); margin: 0 0 1rem; }
.holo-call { margin: 1.4rem 0; text-align: center; }
.holo-call .btn { width: 100%; box-shadow: 0 0 0 0 rgba(34, 184, 230, .6); animation: pulse 2.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34, 184, 230, .55); } 70% { box-shadow: 0 0 0 16px rgba(34, 184, 230, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 184, 230, 0); } }
@media (prefers-reduced-motion: reduce) { .holo-call .btn { animation: none; } }
.holo-call p { margin-top: .5rem; }
.transcript { margin: 0 0 1rem; padding: .8rem 1rem; border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 10px 10px 0; color: var(--muted); font-style: italic; }
.place-name { font-weight: 650; }

.roles { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: .75rem; }
.role { display: flex; gap: .9rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.role.mine { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.role h2 { margin: 0 0 .2em; }
.role p { color: var(--muted); margin-bottom: .6em; }
.role-icon { font-size: 1.8rem; line-height: 1; }

.progress { display: flex; align-items: center; gap: .7rem; color: var(--muted); font-size: .9rem; }
.progress .bar { flex: 1; height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress .bar span { display: block; height: 100%; background: var(--ok); }
.stations { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: .6rem; }
.station-card { display: flex; align-items: center; gap: .9rem; padding: .9rem 1rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; }
.station-card.locked { opacity: .55; }
.station-card.done { border-color: rgba(61, 220, 151, .5); }
.station-card.final { border-style: dashed; }
.st-num { flex: none; width: 2.4rem; height: 2.4rem; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--surface-2); color: var(--accent); }
.done .st-num { background: var(--ok); color: #03281A; }
.st-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.st-status { flex: none; font-size: .75rem; font-weight: 700; padding: .2em .6em; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.st-status.done { background: rgba(61, 220, 151, .15); color: var(--ok); }
.st-status.found { background: rgba(34, 184, 230, .15); color: var(--accent); }

.clues ol { padding-left: 1.2rem; margin: 0 0 .8rem; }
.clues li { margin-bottom: .5rem; }
.clues li.extra { color: var(--warn); }
.scan { text-align: center; }
.scan-icon { font-size: 3rem; line-height: 1; margin: .2rem 0 .6rem; color: var(--accent); }

.questions { list-style: none; padding: 0; margin: 0; }
.question.ok { border-color: rgba(61, 220, 151, .6); }
.question.ko { border-color: rgba(255, 122, 122, .6); }
.options { list-style: none; padding: 0; margin: 0 0 .9rem; display: grid; gap: .5rem; }
.options label { display: flex; gap: .7rem; align-items: flex-start; padding: .75rem .85rem; border-radius: 10px; background: var(--surface-2); border: 1px solid transparent; cursor: pointer; }
.options input { margin-top: .2rem; width: 1.15rem; height: 1.15rem; accent-color: var(--accent); flex: none; }
.options li.right label { border-color: var(--ok); background: rgba(61, 220, 151, .12); }
.options li.wrongpick label { border-color: var(--ko); background: rgba(255, 122, 122, .12); }
.verdict { font-weight: 750; }
.question.ok .verdict { color: var(--ok); }
.question.ko .verdict { color: var(--ko); }
.explanation { color: var(--muted); }
.success { text-align: center; border-color: var(--ok); background: linear-gradient(180deg, rgba(61, 220, 151, .12), var(--surface)); }

.toast { position: fixed; left: 50%; bottom: calc(1.2rem + env(safe-area-inset-bottom)); transform: translate(-50%, 150%); z-index: 50; background: var(--ok); color: #03281A;
  font-weight: 700; padding: .7em 1.2em; border-radius: 999px; transition: transform .25s ease; max-width: calc(100% - 32px); text-align: center; }
.toast.bad { background: var(--ko); color: #2A0606; }
.toast.show { transform: translate(-50%, 0); }

/* ── Personaje sobre la cámara ── */
.holo { position: fixed; inset: 0; z-index: 100; background: radial-gradient(circle at 50% 40%, #0b2a44, #05080f); display: none; }
.holo.open { display: block; }
body.holo-open { overflow: hidden; }
.holo-cam, .holo-gl { position: absolute; inset: 0; width: 100%; height: 100%; }
.holo-cam { object-fit: cover; }
.holo-gl { touch-action: none; }
.holo-top { position: absolute; left: 16px; right: 16px; top: calc(14px + env(safe-area-inset-top)); text-align: center; text-shadow: 0 1px 3px #000; pointer-events: none; }
.holo-name { font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: #9FE6FF; margin: 0 0 .4rem; }
.holo-caption { font-size: 1.05rem; line-height: 1.35; min-height: 2.8em; margin: 0; }
.holo-status { position: absolute; bottom: calc(118px + env(safe-area-inset-bottom)); left: 16px; right: 16px; margin: 0; text-align: center; font-size: .85rem;
  color: var(--muted); text-shadow: 0 1px 3px #000; pointer-events: none; }
.holo-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center;
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0, 0, 0, .7)); }
.holo-bar .btn { min-height: 42px; font-size: .9rem; padding: .55em 1em; }
.holo-bar .btn.ghost { background: rgba(10, 30, 50, .75); }

/* ── Portada, acceso y backoffice ── */
.site-head { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; padding: .9rem 16px; border-bottom: 1px solid var(--line); }
.site-head .langswitch, .site-head .btn { flex: none; }
@media (max-width: 520px) { #who { display: none; } }
.brand { white-space: nowrap; display: inline-flex; align-items: center; gap: .5rem; color: var(--text); text-decoration: none; font-weight: 800; letter-spacing: .01em; }
.brand em { font-style: normal; color: var(--accent); }
.spacer { flex: 1; }
.page { max-width: 960px; margin: 0 auto; padding: 2rem 16px 3rem; }
.narrow { max-width: 440px; margin: 0 auto; }
.site-foot { border-top: 1px solid var(--line); padding: 1.5rem 16px 2.5rem; color: var(--muted); font-size: .85rem; text-align: center; }
.site-foot a { color: var(--muted); }
.field { display: block; margin: 0 0 1rem; }
.field > span { display: block; font-weight: 650; margin-bottom: .3rem; }
.field .hint { font-weight: 400; color: var(--muted); font-size: .85rem; margin-top: .3rem; }
input[type=email], input[type=password], input[type=text], select { width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: .7em .8em; min-height: 44px; }

.xp-list { list-style: none; padding: 0; display: grid; gap: 1rem; }
.xp { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; }
.xp h2 { margin-bottom: .2em; }
.xp .meta { color: var(--muted); font-size: .9rem; display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: .8rem; }
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-top: 1rem; }
.qr-card { background: #fff; color: #0B1626; border-radius: 12px; padding: .9rem; text-align: center; break-inside: avoid; }
.qr-card img { width: 100%; height: auto; display: block; }
.qr-card strong { display: block; margin: .3rem 0; }
.qr-card a { color: #0B1626; font-size: .8rem; }
.users-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.users-table th, .users-table td { text-align: left; padding: .55rem .4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.invite-form { display: grid; gap: .6rem; grid-template-columns: 1fr; margin-top: 1rem; }
@media (min-width: 720px) { .invite-form { grid-template-columns: 1.2fr 1fr .8fr auto; align-items: end; } .invite-form .field { margin: 0; } }
.break { word-break: break-all; }

@media print {
  body { background: #fff; color: #000; }
  .site-head, .site-foot, .no-print, .xp .actions, .xp .meta, #users { display: none !important; }
  .xp { border: 0; background: #fff; }
  .qr-grid { grid-template-columns: repeat(2, 1fr); }
}
