/* Mando de Quizcrypt: provisional (el arte va a la fase de pulido). Pensado para el móvil. */
:root {
  --bg: #0b0910;
  --panel: #17131f;
  --line: #2e2638;
  --text: #ece6d8;
  --subtle: #a39a8c;
  --accent: #d9a441;
  --ok: #5fae6e;
  --ko: #c4473a;
  --terror: #8f1d2c;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 18px/1.4 Georgia, "Times New Roman", serif;
  -webkit-tap-highlight-color: transparent;
}

.screen {
  min-height: 100dvh;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 720px;
  margin: 0 auto;
}

[hidden] { display: none !important; }

h1 {
  font-size: 2.4rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 8vh 0 0;
  text-align: center;
}

.subtle { color: var(--subtle); }
#join > .subtle { text-align: center; margin: 0 0 4vh; }

form { display: flex; flex-direction: column; gap: 16px; }
label { display: flex; flex-direction: column; gap: 6px; color: var(--subtle); font-size: 0.9rem; }

input {
  font: inherit;
  font-size: 1.4rem;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
}
#code { text-transform: uppercase; letter-spacing: 0.4em; text-align: center; font-size: 2rem; }

button {
  font: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  min-height: 56px;
  cursor: pointer;
  touch-action: manipulation;
}
button:active { transform: scale(0.98); }
button:disabled { opacity: 0.45; }
button.big { background: var(--accent); color: #1a1208; border: 0; font-size: 1.3rem; font-weight: bold; min-height: 64px; }

.roles { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 0; color: var(--subtle); }
.roles legend { font-size: 0.9rem; padding: 0 4px; }
.role { flex-direction: row; align-items: center; gap: 10px; font-size: 1rem; color: var(--text); padding: 6px 0; }
.role input { width: 1.2em; height: 1.2em; }
#role { min-height: 0; padding: 0 8px; font-size: 1.1rem; border: 0; background: none; }

.host-line { margin: 0; padding: 8px 12px; border-left: 3px solid var(--accent); font-style: italic; color: var(--text); }
.minimap { width: 100%; max-height: 38vh; display: block; }
#bar { font-size: 0.95rem; }
.minimap .pick { cursor: pointer; animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: 0.55; } to { opacity: 1; } }

.error { color: var(--ko); min-height: 1.4em; text-align: center; }

#bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-variant-numeric: tabular-nums;
}
#clock { color: var(--accent); font-weight: bold; }
#clock.low { color: var(--ko); }

#players {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 0.85rem;
  color: var(--subtle);
}
#players li.turn { font-weight: bold; text-decoration: underline; }
#players li.ghost { opacity: 0.45; }
.dot { display: inline-block; width: 0.7em; height: 0.7em; border-radius: 50%; margin-right: 4px; }

#stage { flex: 1; display: flex; flex-direction: column; justify-content: center; }

.wait { text-align: center; }
.big-text { font-size: 1.4rem; }

.question, .deal { display: flex; flex-direction: column; gap: 10px; }
.q-title { margin: 0; color: var(--accent); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.95rem; }
.q-sub { margin: 0; font-size: 0.9rem; }
.q-text { margin: 4px 0; font-size: 1.25rem; }
.question.terror .q-title { color: #ff6b6b; }
.question.terror { border-left: 4px solid var(--terror); padding-left: 10px; }
.blur .q-text { animation: unblur 4s ease-out forwards; }
@keyframes unblur { from { filter: blur(7px); } to { filter: blur(0); } }

.timer { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.timer > div { height: 100%; width: 100%; background: var(--accent); transform-origin: left; }

.options { display: grid; grid-template-columns: 1fr; gap: 10px; }
.options.two { grid-template-columns: 1fr 1fr; }
.option { text-align: left; font-size: 1.1rem; }
.option .n { color: var(--accent); margin-right: 8px; }
.option.chosen { border-color: var(--accent); }
.option.right { background: color-mix(in srgb, var(--ok) 35%, var(--panel)); border-color: var(--ok); }
.option.wrong { background: color-mix(in srgb, var(--ko) 35%, var(--panel)); border-color: var(--ko); }
.option.right:disabled, .option.wrong:disabled { opacity: 1; }
.option.yes { text-align: center; border-color: var(--ok); }
.option.no { text-align: center; }

.destinations { display: flex; flex-direction: column; gap: 10px; }

.option.removed { text-decoration: line-through; opacity: 0.35; }
.option.revealed { border-color: var(--ok); }
.option.whisper { border-color: #b98cff; box-shadow: 0 0 0 2px #b98cff55 inset; }

.actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-top: 12px; }
.action { min-height: 44px; padding: 8px 10px; font-size: 0.95rem; }
.action.fastidiar { border-color: color-mix(in srgb, var(--ko) 60%, var(--line)); }
.action.ayudar { border-color: color-mix(in srgb, var(--ok) 60%, var(--line)); }

#feed {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.92rem;
  color: var(--subtle);
  max-height: 30vh;
  overflow: hidden;
}
#feed li:first-child { color: var(--text); }
#feed li.host { font-style: italic; }

.status {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  margin: 0;
  padding: 10px 14px;
  border-radius: 8px;
  background: #3a1d1d;
  text-align: center;
}

@media (orientation: landscape) and (max-height: 500px) {
  .screen { gap: 8px; padding-top: max(8px, env(safe-area-inset-top)); padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  #game { display: grid; grid-template-columns: 1.6fr 1fr; grid-template-rows: auto 1fr; max-width: none; }
  #bar, #players { grid-column: 1 / -1; }
  /* Bolsillo en horizontal: el mapa a la derecha, Mortimer y los destinos a la izquierda */
  #stage.pocket { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; align-items: start; }
  #stage.pocket .minimap { grid-column: 2; grid-row: 1 / span 4; max-height: 70vh; }
  #game:has(#stage.pocket) #feed { display: none; }
  #bar { padding: 4px 12px; }
  #feed { max-height: none; }
  .question, .deal { gap: 6px; }
  .q-text { font-size: 1.05rem; margin: 0; }
  .options { grid-template-columns: 1fr 1fr; gap: 8px; }
  .option, button.big { min-height: 44px; padding: 8px 12px; font-size: 1rem; }
  .wait .place, .wait .big-text { margin: 0; font-size: 0.9rem; }
  .q-sub { display: none; }
  /* Público en horizontal: la pregunta a la izquierda y las acciones a la derecha, sin el registro */
  #stage.audience { grid-column: 1 / -1; display: grid; grid-template-columns: 1.5fr 1fr; gap: 6px 14px; align-items: start; }
  #stage.audience > .wait { grid-column: 1 / -1; }
  #game:has(#stage.audience) #feed { display: none; }
  .actions { grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 0; }
  .action { min-height: 36px; padding: 4px 6px; font-size: 0.85rem; }
  #feed { font-size: 0.85rem; }
  h1 { margin-top: 2vh; }
}
