/* Guareña: el pueblo ocupa toda la pantalla; la interfaz es un HUD de cristal oscuro a los lados. */
:root {
  color-scheme: dark;
  --noche: #070a14;
  --noche-2: #0d1326;
  --linea: rgba(186, 198, 255, 0.16);
  --cal: #eef0ec;
  --tinta: #0c1122;
  --niebla: #9ba4c8;
  --niebla-2: #6c7598;
  --sodio: #ffa94d;
  --sodio-2: #ffcf91;
  --anil: #34489c;
  --f-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --f-serif: "Instrument Serif", Georgia, serif;
  --f-mono: "Geist Mono", ui-monospace, Menlo, monospace;
  --gutter: clamp(14px, 2.4vw, 32px);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--noche); color: var(--cal); font-family: var(--f-display); font-size: 15px; line-height: 1.5; overflow: hidden; -webkit-font-smoothing: antialiased; padding-top: env(safe-area-inset-top, 0px); }
[hidden] { display: none !important; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--sodio); outline-offset: 3px; border-radius: 4px; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.wlabel { position: absolute; left: 0; top: 0; opacity: 0; white-space: nowrap; font-family: var(--f-mono); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; padding-left: 14px; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6); pointer-events: auto; cursor: pointer; background: none; border: 0; color: var(--cal); text-align: left; }
.wlabel::before { content: ""; position: absolute; left: 0; top: 0.4em; width: 7px; height: 7px; border: 1px solid currentColor; border-radius: 50%; background: rgba(7, 10, 20, 0.5); }
.wlabel b { display: block; font-weight: 500; }
.wlabel span { display: block; opacity: 0.72; font-size: 0.6rem; }
.wlabel:hover { color: var(--sodio); }

.mono { font-family: var(--f-mono); font-size: 0.7rem; letter-spacing: 0.09em; text-transform: uppercase; font-variant-numeric: tabular-nums; }
.glass { border: 1px solid var(--linea); border-radius: 18px; background: rgba(7, 10, 20, 0.72); backdrop-filter: blur(16px) saturate(1.2); -webkit-backdrop-filter: blur(16px) saturate(1.2); }
.btn { display: inline-flex; align-items: center; gap: 0.55rem; padding: 0.7rem 1rem; border-radius: 999px; border: 1px solid var(--linea); background: rgba(7, 10, 20, 0.6); color: var(--cal); font-family: var(--f-mono); font-size: 0.7rem; letter-spacing: 0.09em; text-transform: uppercase; text-decoration: none; cursor: pointer; transition: background 0.2s, border-color 0.2s, color 0.2s; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.btn:hover { border-color: rgba(255, 255, 255, 0.4); }
.btn.primary { background: var(--sodio); border-color: var(--sodio); color: var(--tinta); font-weight: 500; }
.btn.primary:hover { background: var(--sodio-2); }
.btn[aria-pressed="true"] { background: var(--cal); color: var(--tinta); border-color: var(--cal); }

.top { position: fixed; top: env(safe-area-inset-top, 0px); left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 16px var(--gutter); z-index: 10; pointer-events: none; }
.top > * { pointer-events: auto; }
.brand { text-decoration: none; display: inline-flex; gap: 0.45rem; align-items: baseline; font-variation-settings: "wdth" 125; font-weight: 800; font-size: 1.1rem; text-transform: uppercase; letter-spacing: -0.02em; text-shadow: 0 1px 12px rgba(0, 0, 0, 0.4); padding: 6px 14px; border: 1px solid var(--linea); border-radius: 999px; background: rgba(7, 10, 20, 0.55); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); transition: border-color 0.2s; }
.brand:hover { border-color: rgba(255, 255, 255, 0.4); }
.brand em { font-family: var(--f-serif); font-weight: 400; font-style: italic; text-transform: none; letter-spacing: 0; color: var(--sodio); font-size: 1.15rem; }
.top .right { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: flex-end; }

.panel { position: fixed; left: var(--gutter); top: 74px; bottom: var(--gutter); width: min(370px, calc(100vw - 2 * var(--gutter))); z-index: 9; display: flex; flex-direction: column; gap: 0.75rem; overflow-y: auto; scrollbar-width: none; }
.panel::-webkit-scrollbar { display: none; }
.panel .glass { padding: 1.1rem; display: grid; gap: 0.8rem; min-width: 0; }
.panel .glass > * { min-width: 0; }
.kicker { font-family: var(--f-mono); font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--sodio); display: inline-flex; gap: 0.7em; align-items: center; }
.kicker::before { content: ""; width: 1.4em; height: 1px; background: currentColor; }
h1 { margin: 0; font-variation-settings: "wdth" 118; font-weight: 800; font-size: clamp(2.2rem, 4.4vw, 2.9rem); line-height: 0.86; letter-spacing: -0.045em; text-transform: uppercase; }
h1 small { display: block; font-family: var(--f-serif); font-style: italic; font-weight: 400; text-transform: none; letter-spacing: -0.01em; font-size: 0.42em; color: var(--niebla); margin-top: 0.35em; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--linea); border: 1px solid var(--linea); border-radius: 10px; overflow: hidden; }
.facts div { background: var(--noche); padding: 0.55rem 0.6rem; display: grid; gap: 0.1rem; min-width: 0; }
.facts b { font-variation-settings: "wdth" 115; font-weight: 750; font-size: 1.05rem; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.facts span { font-family: var(--f-mono); font-size: 0.56rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--niebla-2); }
.panel p { margin: 0; color: #cdd2e2; font-size: 0.93rem; }
.status { display: flex; justify-content: space-between; gap: 0.6rem; color: var(--niebla); border-top: 1px solid var(--linea); padding-top: 0.75rem; flex-wrap: wrap; }
.status b { color: var(--sodio); font-weight: 500; }
.game h2 { margin: 0; font-variation-settings: "wdth" 112; font-weight: 750; font-size: 1.35rem; letter-spacing: -0.025em; line-height: 1.05; }
.nests { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.nests i { width: 26px; height: 26px; border-radius: 50%; border: 1px dashed var(--niebla-2); display: grid; place-items: center; font-style: normal; font-size: 0.7rem; color: var(--niebla-2); font-family: var(--f-mono); transition: all 0.3s var(--ease-out); }
.nests i.got { border: 1px solid var(--sodio); background: var(--sodio); color: var(--tinta); }
.hint { color: var(--niebla); font-size: 0.86rem; }
.places { display: grid; gap: 0.4rem; }
.places button { display: flex; justify-content: space-between; gap: 1rem; align-items: center; width: 100%; padding: 0.6rem 0.7rem; border-radius: 10px; border: 1px solid var(--linea); background: rgba(255, 255, 255, 0.03); color: var(--cal); font: inherit; font-size: 0.92rem; cursor: pointer; text-align: left; }
.places button:hover { border-color: rgba(255, 169, 77, 0.6); }
.places button span { font-family: var(--f-mono); font-size: 0.6rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--niebla-2); }
.cal { display: grid; gap: 0.35rem; }
.cal div { display: grid; grid-template-columns: 5.6rem 1fr; gap: 0.6rem; font-size: 0.88rem; padding: 0.3rem 0; border-bottom: 1px dashed var(--linea); }
.cal div span:first-child { font-family: var(--f-mono); font-size: 0.66rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--sodio); padding-top: 0.15em; }
details summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
details summary::-webkit-details-marker { display: none; }
details summary::after { content: "+"; font-family: var(--f-mono); color: var(--niebla); }
details[open] summary::after { content: "−"; }

.card { position: fixed; right: var(--gutter); top: 74px; width: min(360px, calc(100vw - 2 * var(--gutter))); z-index: 9; padding: 1.2rem; display: grid; gap: 0.7rem; }
.card h3 { margin: 0; font-variation-settings: "wdth" 115; font-weight: 800; font-size: 1.6rem; line-height: 0.98; letter-spacing: -0.03em; padding-right: 2rem; }
.card p { margin: 0; color: #cdd2e2; font-size: 0.94rem; }
.card .x { position: absolute; top: 0.7rem; right: 0.7rem; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--linea); background: none; color: var(--cal); cursor: pointer; }
.card .src { color: var(--niebla-2); font-family: var(--f-mono); font-size: 0.6rem; letter-spacing: 0.06em; text-transform: uppercase; }

.dock { position: fixed; right: var(--gutter); bottom: var(--gutter); z-index: 9; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; padding: 0.4rem; border-radius: 999px; }
.dock .lab { padding: 0 0.6rem; color: var(--niebla); }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 20px); z-index: 12; padding: 0.8rem 1.1rem; border-radius: 999px; background: var(--sodio); color: var(--tinta); font-family: var(--f-mono); font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0; transition: all 0.4s var(--ease-out); pointer-events: none; white-space: nowrap; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.loading { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: var(--noche); transition: opacity 0.8s; }
.loading div { display: grid; gap: 0.8rem; justify-items: center; }
.loading b { font-variation-settings: "wdth" 125; font-weight: 800; font-size: clamp(3rem, 12vw, 7rem); letter-spacing: -0.05em; line-height: 0.85; text-transform: uppercase; }
.loading span { color: var(--niebla); }
/* (Guareña: su primera imagen, el último fotograma de la portada o su cartel, a toda pantalla; luego se funde con la
   maqueta en el mismo encuadre) */
.loading.relevo { background: #71543e; transition: opacity 0.45s ease; } /* (el relevo, rápido: la cámara ya se mueve) */
.loading.relevo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform-origin: 50% 50%; will-change: transform; user-select: none; -webkit-user-drag: none; }
.err { max-width: 34rem; padding: 2rem var(--gutter); text-align: center; }

@media (max-width: 760px) {
  body { overflow: auto; }
  .panel { position: absolute; top: auto; bottom: auto; left: 0; right: 0; width: auto; margin-top: 62vh; padding: 0 var(--gutter) var(--gutter); overflow: visible; }
  #c, #labels { position: fixed; height: 62vh; }
  .card { top: auto; bottom: var(--gutter); left: var(--gutter); right: var(--gutter); width: auto; position: fixed; }
  .dock { top: calc(62vh - 56px); bottom: auto; right: var(--gutter); }
  .top .right .btn:not(.primary) { display: none; }
}
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

.btn.big { padding: 0.85rem 1.2rem; font-size: 0.74rem; }
.passbar { display: flex; justify-content: space-between; gap: 0.6rem; align-items: center; color: var(--niebla); }
.passbar b { color: var(--sodio); font-weight: 500; }
.sleep { display: inline-flex; gap: 0.5rem; align-items: center; color: var(--niebla); }
.sleep i { width: 8px; height: 8px; border-radius: 50%; background: var(--niebla-2); }
.sleep.on { color: var(--sodio); }
.sleep.on i { background: var(--sodio); box-shadow: 0 0 10px var(--sodio); }

.brand img { display: block; height: 26px; width: auto; }

/* jugar: el juego se carga debajo y toma el relevo con un fundido */
.game-frame { position: fixed; inset: 0; width: 100%; height: 100%; border: 0; z-index: 40; opacity: 0; pointer-events: none; transition: opacity 1.1s ease; background: transparent; color-scheme: normal; }
.game-frame.on { opacity: 1; }
.game-frame.live { pointer-events: auto; }
body.jugando .top, body.jugando .panel, body.jugando .card, body.jugando .dock, body.jugando #labels, body.jugando .toast { opacity: 0 !important; pointer-events: none !important; transition: opacity 0.6s ease; }
body.jugando { overflow: hidden; }
body.jugando #c { height: 100% !important; }

/* en pantallas táctiles, botones de al menos 44 px de alto */
@media (pointer: coarse) { .btn, .brand { min-height: 44px; } .brand { align-items: center; } }

/* jugar: aviso mientras carga el juego, y salida si no carga */
.game-status { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 45; transform: translate(-50%, 8px); opacity: 0; transition: opacity 0.35s ease, transform 0.35s ease; padding: 0.7rem 1.1rem; border-radius: 999px; background: rgba(7, 10, 20, 0.78); border: 1px solid var(--linea); color: var(--cal); font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); max-width: calc(100vw - 32px); text-align: center; }
.game-status.on { opacity: 1; transform: translate(-50%, 0); }
.game-status.fail { border-radius: 16px; text-transform: none; letter-spacing: 0; font-family: var(--f-display); font-size: 0.92rem; display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; justify-content: center; }
.game-status.fail button, .game-status.fail a { font: inherit; color: var(--tinta); background: var(--sodio); border: 0; border-radius: 999px; padding: 0.4rem 0.8rem; cursor: pointer; text-decoration: none; }
.game-status.fail a { background: transparent; color: var(--sodio-2); text-decoration: underline; }
@media (prefers-reduced-motion: reduce) { .game-status { transition: none; } }

/* la cola del pueblo: vecinos apuntados hacia los que lo despiertan */
.queue { display: grid; gap: 0.45rem; margin-bottom: 0.2rem; }
.queue .qt { display: flex; justify-content: space-between; gap: 1rem; font-family: var(--f-mono); font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--niebla); }
.queue .qt b { color: var(--cal); font-weight: 500; }
.queue .qbar { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.queue .qbar i { display: block; height: 100%; width: 0; background: var(--sodio); border-radius: inherit; transition: width 0.8s var(--ease-out); }
