:root {
  --fondo: #f3f5f8;
  --panel: #ffffff;
  --borde: #dde3ea;
  --texto: #1f2933;
  --suave: #6b7785;
  --acento: #3a86ff;
  --alerta: #e63946;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #14213d;
  color: #fff;
}
header h1 { margin: 0; font-size: 18px; letter-spacing: .5px; }
header h1 span { color: #8ecae6; font-weight: 400; }

.chip {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #ffffff22;
}
.chip.real { background: #2a9d8f; }
.chip.simulacion { background: #e9a23b; color: #222; }

main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 12px;
  padding: 12px;
  min-height: 0;
}

#mapa { position: relative; min-width: 0; align-self: start; }
#juego {
  width: 100%;
  aspect-ratio: 5 / 3;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--borde);
  background: #e9eef3;
}

#conferencia {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  width: min(560px, calc(100% - 32px));
  max-height: 45%;
  overflow: auto;
  background: #14213df2;
  color: #fff;
  border-radius: 10px;
  padding: 12px 16px;
  box-shadow: 0 8px 24px #0004;
}
.conf-cabecera { display: flex; justify-content: space-between; gap: 8px; }
#conferencia p { white-space: pre-wrap; line-height: 1.45; margin: 8px 0 0; }
#conf-cerrar { background: none; border: 0; color: #fff; cursor: pointer; font-size: 16px; }

#panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  max-height: calc(100vh - 70px);
}
#panel > section {
  background: var(--panel);
  border: 1px solid var(--borde);
  border-radius: 10px;
  padding: 12px;
}
h2 { font-size: 15px; margin: 0 0 8px; display: flex; align-items: center; gap: 6px; }
h3 { font-size: 13px; margin: 14px 0 6px; color: var(--suave); }
.sub { margin: 0 0 8px; color: var(--suave); font-size: 13px; }
.vacio { color: var(--suave); font-size: 13px; margin: 0; }

.contador {
  background: var(--borde);
  border-radius: 999px;
  padding: 0 8px;
  font-size: 12px;
}
.contador.activo { background: var(--alerta); color: #fff; }

.pregunta {
  border-left: 4px solid var(--alerta);
  background: #fff5f5;
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 8px;
}
.pregunta p { margin: 4px 0 8px; font-size: 14px; }
.pregunta .opciones { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.pregunta form { display: flex; gap: 6px; }
.pregunta input { flex: 1; min-width: 0; }

#equipo { list-style: none; margin: 0; padding: 0; }
#equipo li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}
#equipo li:hover, #equipo li.sel { background: #eef4ff; }
.punto { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.estado { margin-left: auto; font-size: 12px; color: var(--suave); }
.estado.esperando { color: var(--alerta); font-weight: 600; }

textarea, input {
  width: 100%;
  font: inherit;
  font-size: 14px;
  padding: 8px;
  border: 1px solid var(--borde);
  border-radius: 6px;
  resize: vertical;
}
.acciones { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
button {
  font: inherit;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--borde);
  background: #fff;
  cursor: pointer;
}
button:hover { border-color: var(--acento); }
button.primario { background: var(--acento); color: #fff; border-color: var(--acento); }

details.entrega {
  border: 1px solid var(--borde);
  border-radius: 6px;
  padding: 6px 8px;
  margin-bottom: 6px;
  font-size: 13px;
}
details.entrega summary { cursor: pointer; font-weight: 600; }
details.entrega pre {
  white-space: pre-wrap;
  font-family: inherit;
  margin: 8px 0 0;
  max-height: 320px;
  overflow: auto;
}

#bitacora { list-style: none; margin: 0; padding: 0; font-size: 12.5px; max-height: 260px; overflow-y: auto; }
#bitacora li { padding: 4px 0; border-bottom: 1px dashed var(--borde); }
#bitacora time { color: var(--suave); margin-right: 4px; }
#bitacora .error { color: var(--alerta); }

@media (max-width: 900px) {
  main { grid-template-columns: 1fr; padding: 8px 16px; }
  #panel { max-height: none; overflow: visible; }
  #conferencia { position: static; transform: none; width: 100%; max-height: none; margin-top: 8px; }
}
