:root {
  --fondo: #000;
  --panel: #111;
  --borde: #2a2a2a;
  --texto: #fff;
  --tenue: #9a9a9a;
  --verde: #3dff8b;
  --ambar: #ffc43d;
  --rojo: #ff3b3b;
  --azul: #4da3ff;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fondo); color: var(--texto); }
body {
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: max(10px, env(safe-area-inset-top)) 12px max(16px, env(safe-area-inset-bottom));
  max-width: 820px; margin: 0 auto;
}
button { font: inherit; color: inherit; cursor: pointer; }

.barra { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.estado { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--tenue); }
.punto { width: 12px; height: 12px; border-radius: 50%; background: #555; }
.escuchando .punto { background: var(--rojo); box-shadow: 0 0 0 0 var(--rojo); animation: latido 1.4s infinite; }
.escuchando #estadoTxt { color: var(--texto); }
@keyframes latido { 0% { box-shadow: 0 0 0 0 #ff3b3b88; } 100% { box-shadow: 0 0 0 12px #ff3b3b00; } }
.meta { display: flex; gap: 6px; }
.chip { font-size: 12px; padding: 3px 8px; border: 1px solid var(--borde); border-radius: 999px; color: var(--tenue); font-variant-numeric: tabular-nums; }
#modo { color: var(--ambar); border-color: var(--ambar); }

.etapas { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; scrollbar-width: none; }
.etapas button {
  flex: none; background: var(--panel); border: 1px solid var(--borde); border-radius: 10px;
  padding: 8px 12px; font-size: 14px; color: var(--tenue);
}
.etapas button.activa { background: var(--texto); color: #000; border-color: var(--texto); font-weight: 700; }
.etapas button.sugerida:not(.activa) { border-color: var(--azul); color: var(--azul); }

.tarjeta {
  background: var(--panel); border: 2px solid var(--borde); border-radius: 18px;
  padding: 16px 18px 18px; min-height: 210px; transition: border-color .2s;
}
.tarjeta.pensando { border-color: var(--azul); }
.tarjeta.nueva { animation: destello .6s; }
.tarjeta.panico { border-color: var(--rojo); background: #1a0505; }
@keyframes destello { from { border-color: var(--verde); } }
.tarjeta-cab { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.etiqueta { font-size: 12px; letter-spacing: .12em; font-weight: 800; color: var(--verde); }
.panico .etiqueta { color: var(--rojo); }
.etapa-detectada { font-size: 12px; color: var(--azul); font-weight: 700; }
.di { font-size: clamp(24px, 6.2vw, 38px); line-height: 1.22; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.ojo { margin: 14px 0 0; font-size: clamp(16px, 4vw, 20px); color: var(--ambar); font-weight: 600; min-height: 1.4em; }
.ojo:not(:empty)::before { content: "⚠ "; }

.acciones { display: grid; grid-template-columns: 2fr 1fr 1.3fr; gap: 8px; margin: 12px 0; }
.acciones button { border-radius: 14px; border: 0; min-height: 64px; font-weight: 800; font-size: 17px; }
.btn-escuchar { background: var(--verde); color: #000; }
.escuchando .btn-escuchar { background: #fff; color: #000; }
.btn-sec { background: var(--panel); border: 1px solid var(--borde) !important; }
.btn-panico { background: var(--rojo); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.btn-panico small { font-size: 11px; font-weight: 600; opacity: .85; }
.acciones button:active { transform: scale(.97); }

.checklist { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 14px; }
.checklist label { position: relative; }
.checklist input { position: absolute; opacity: 0; }
.checklist span {
  display: block; text-align: center; font-size: 13px; padding: 8px 4px; border-radius: 10px;
  border: 1px dashed #444; color: var(--tenue); cursor: pointer; user-select: none;
}
.checklist input:checked + span { border: 1px solid var(--verde); color: var(--verde); }
.checklist input:checked + span::before { content: "✓ "; }
.checklist input:focus-visible + span { outline: 2px solid var(--azul); }

.guion { border-top: 1px solid var(--borde); padding-top: 10px; }
.guion h2 { font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--tenue); margin: 0 0 8px; }
.guion-texto { color: #d8d8d8; font-size: 15px; }
.guion-texto p { margin: 0 0 10px; }
.guion-texto .rotulo { color: var(--tenue); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; margin: 12px 0 4px; }
.guion-texto .literal { color: #fff; font-size: 17px; border-left: 3px solid var(--verde); padding-left: 10px; }

.transcripcion { margin-top: 14px; border: 1px solid var(--borde); border-radius: 12px; padding: 10px 12px; }
.transcripcion summary { cursor: pointer; color: var(--tenue); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.interim { font-weight: 400; color: #666; font-style: italic; }
.trans-texto { max-height: 200px; overflow-y: auto; font-size: 14px; color: #bbb; margin: 8px 0; }
.trans-texto div { padding: 2px 0; border-bottom: 1px solid #1a1a1a; }
.trans-texto time { color: #555; font-size: 11px; margin-right: 6px; font-variant-numeric: tabular-nums; }
.simular { display: flex; gap: 6px; }
.simular input, .simular select {
  background: #0a0a0a; color: var(--texto); border: 1px solid var(--borde); border-radius: 8px; padding: 10px; font: inherit; font-size: 14px;
}
.simular input { flex: 1; min-width: 0; }
.nota { font-size: 12px; color: #666; margin: 8px 0 0; }

@media (max-width: 520px) {
  .acciones { grid-template-columns: 1fr 1fr; }
  .btn-escuchar { grid-column: 1 / -1; }
  .checklist { grid-template-columns: 1fr 1fr; }
}
