/* =========================================================================
 * Plataforma Brétema · estilo DBV compartido (móvil primero)
 * Azul hielo #E7F6FF · azul eléctrico #0067FF · azul fuerte #0049B8 · ámbar #FFB020 · peligro #D32F2F
 * Playfair Display (títulos) + Manrope (interfaz). Basado en 2026Q1/Rol_Game_IA/styles.css.
 * ========================================================================= */
:root {
  --bg: #E7F6FF;
  --bg-soft: #F5FBFF;
  --surface: #FFFFFF;
  --text: #0B1F3A;
  --muted: #51617A;
  --line: #C8DFF0;
  --primary: #0067FF;
  --primary-strong: #0049B8;
  --primary-soft: #D6EAFF;
  --accent: #FFB020;
  --accent-soft: #FFF1D6;
  --accent-ink: #92400E;
  --danger: #D32F2F;
  --danger-soft: #FFE5E5;
  --success: #0F9D58;
  --success-soft: #DDF5E8;
  --shadow: 0 18px 45px rgba(0, 103, 255, 0.08);
  --shadow-soft: 0 6px 18px rgba(11, 31, 58, 0.06);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-ui: 'Manrope', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 8%, #D6EAFF 0, rgba(214, 234, 255, 0) 55%),
    radial-gradient(circle at 85% 6%, rgba(0, 103, 255, 0.10) 0, rgba(255, 255, 255, 0) 50%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
  background-attachment: fixed;
}
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.01em; margin: 0 0 .4em; line-height: 1.15; }
h1 { font-weight: 800; font-size: 1.9rem; }
h2 { font-weight: 700; font-size: 1.4rem; }
h3 { font-weight: 600; font-size: 1.12rem; }
p { margin: 0 0 .8em; }
a { color: var(--primary); }
small, .small { font-size: .85rem; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.center { text-align: center; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.grow { flex: 1 1 auto; }

/* ── Estructura ── */
.shell { max-width: 560px; margin: 0 auto; padding: 18px 16px 48px; }
.shell--wide { max-width: 1240px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand__name { font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; line-height: 1; }
.brand__sub { font-size: .72rem; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; font-weight: 700; }
.emblem { width: 40px; height: 40px; flex: none; }
.emblem--xl { width: 96px; height: 96px; }

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid rgba(0, 103, 255, 0.07);
  padding: 20px 18px;
}
.card + .card { margin-top: 14px; }
.card--soft { background: var(--bg-soft); box-shadow: var(--shadow-soft); }
.card--accent { border-left: 6px solid var(--accent); }
.card__title { margin-top: 0; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; padding: 4px 11px;
  background: var(--primary-soft); color: var(--primary-strong);
  font-size: .74rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
}
.badge--amber { background: var(--accent-soft); color: var(--accent-ink); }
.badge--green { background: var(--success-soft); color: var(--success); }
.badge--red { background: var(--danger-soft); color: var(--danger); }
.badge--grey { background: #EEF2F6; color: var(--muted); }

/* ── Formularios ── */
label.field { display: block; font-weight: 700; margin-bottom: 14px; }
label.field > span { display: block; margin-bottom: 6px; font-size: .92rem; }
input[type=text], input[type=password], textarea, select {
  width: 100%; font: inherit; color: var(--text);
  padding: 13px 14px; min-height: 48px;
  border: 1.5px solid var(--line); border-radius: var(--radius-md); background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(0, 103, 255, .14); }
textarea { min-height: 96px; resize: vertical; }
input.code-input { text-transform: uppercase; letter-spacing: .14em; font-weight: 800; font-size: 1.25rem; text-align: center; }
.counter { text-align: right; font-size: .78rem; color: var(--muted); margin-top: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 20px;
  border-radius: 999px; border: 0; cursor: pointer;
  font: inherit; font-weight: 800; letter-spacing: .01em; text-decoration: none;
  background: var(--primary); color: #fff;
  box-shadow: 0 10px 22px rgba(0, 103, 255, .22);
  transition: transform .08s, background .15s, box-shadow .15s, opacity .15s;
}
.btn:hover { background: var(--primary-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn--block { width: 100%; }
.btn--ghost { background: #fff; color: var(--primary-strong); border: 1.5px solid var(--line); box-shadow: none; }
.btn--ghost:hover { background: var(--primary-soft); }
.btn--amber { background: var(--accent); color: var(--text); box-shadow: 0 10px 22px rgba(255, 176, 32, .3); }
.btn--amber:hover { background: #F09A00; }
.btn--danger { background: var(--danger); box-shadow: none; }
.btn--danger:hover { background: #B71C1C; }
.btn--sm { min-height: 36px; padding: 6px 14px; font-size: .85rem; }

/* ── Opciones de respuesta (botones grandes para el pulgar) ── */
.question { margin-bottom: 22px; }
.question__text { font-family: var(--font-display); font-weight: 700; font-size: 1.22rem; margin-bottom: 4px; }
.question__hint { font-size: .85rem; color: var(--muted); margin-bottom: 10px; }
.opts { display: grid; gap: 10px; }
.opt {
  display: flex; align-items: flex-start; gap: 12px; width: 100%;
  min-height: 52px; padding: 13px 14px; text-align: left;
  font: inherit; color: var(--text); background: #fff; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: var(--radius-md);
  transition: border-color .12s, background .12s, box-shadow .12s;
}
.opt:hover { border-color: var(--primary); }
.opt__key {
  flex: none; display: inline-grid; place-items: center;
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--primary-soft); color: var(--primary-strong); font-weight: 800;
}
.opt--multi .opt__key { border-radius: 7px; }
.opt.is-selected { border-color: var(--primary); background: #F0F7FF; box-shadow: 0 0 0 3px rgba(0, 103, 255, .12); }
.opt.is-selected .opt__key { background: var(--primary); color: #fff; }
.opt:disabled { cursor: default; opacity: .75; }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.scale .opt { justify-content: center; align-items: center; font-weight: 800; font-size: 1.15rem; padding: 10px 0; }
.scale__labels { display: flex; justify-content: space-between; font-size: .78rem; color: var(--muted); margin-top: 6px; }

/* ── Mensajes ── */
.notice { padding: 12px 14px; border-radius: var(--radius-md); background: var(--primary-soft); color: var(--primary-strong); font-weight: 600; }
.notice--ok { background: var(--success-soft); color: #0B6B3D; }
.notice--warn { background: var(--accent-soft); color: var(--accent-ink); }
.notice--error { background: var(--danger-soft); color: var(--danger); }
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 999px;
  background: var(--text); color: #fff; font-weight: 700; box-shadow: var(--shadow); z-index: 50;
}
.waiting { text-align: center; padding: 28px 8px; }
.waiting .emblem--xl { margin: 0 auto 14px; animation: fog 4s ease-in-out infinite; }
@keyframes fog { 0%, 100% { opacity: 1; } 50% { opacity: .65; } }
.pulse-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--success); margin-right: 6px; animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(15, 157, 88, .5); } 70% { box-shadow: 0 0 0 9px rgba(15, 157, 88, 0); } 100% { box-shadow: 0 0 0 0 rgba(15, 157, 88, 0); } }

/* ── Resultados: barras, media, nube ── */
.results-q { margin-bottom: 22px; }
.results-q__text { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; margin-bottom: 8px; }
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: minmax(90px, 38%) 1fr 64px; gap: 10px; align-items: center; }
.bar__label { font-weight: 600; font-size: .92rem; line-height: 1.25; }
.bar__track { height: 22px; border-radius: 999px; background: var(--primary-soft); overflow: hidden; }
.bar__fill { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--primary), #3D8BFF); transition: width .6s ease; }
.bar.is-top .bar__fill { background: linear-gradient(90deg, #F09A00, var(--accent)); }
.bar__val { font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.bar__val small { display: block; font-weight: 600; color: var(--muted); font-size: .72rem; }
.mean { font-family: var(--font-display); font-size: 2.2rem; font-weight: 800; color: var(--primary-strong); }
.cloud { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; justify-content: center; padding: 8px 0 12px; }
.cloud span { font-family: var(--font-display); font-weight: 700; color: var(--primary-strong); line-height: 1.1; }
.cloud span:nth-child(3n) { color: var(--accent-ink); }
.cloud span:nth-child(4n) { color: var(--text); }
.texts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 420px; overflow: auto; }
.texts li { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 12px; font-size: .95rem; }

/* ── Presentador (16:9, se comparte en Zoom) ── */
body.presenter { overflow-x: hidden; }
.presenter .shell { max-width: 1400px; padding: 28px 40px; }
.presenter .topbar { margin-bottom: 26px; }
.presenter .emblem { width: 54px; height: 54px; }
.presenter .brand__name { font-size: 1.7rem; }
.presenter h1 { font-size: 3rem; }
.presenter .question__text, .presenter .results-q__text { font-size: 1.7rem; }
.presenter .bar { grid-template-columns: minmax(200px, 34%) 1fr 110px; gap: 18px; }
.presenter .bar__label { font-size: 1.25rem; }
.presenter .bar__track { height: 40px; }
.presenter .bar__val { font-size: 1.6rem; }
.presenter .texts li { font-size: 1.15rem; }
.presenter .bars { gap: 14px; }
.join-hero { display: grid; grid-template-columns: 1.2fr .8fr; gap: 40px; align-items: center; }
.join-code {
  font-family: var(--font-ui); font-weight: 800; letter-spacing: .12em;
  font-size: clamp(4rem, 11vw, 9rem); line-height: 1; color: var(--primary-strong);
}
.join-url { font-size: 1.8rem; font-weight: 700; }
.qr { background: #fff; padding: 18px; border-radius: var(--radius-lg); box-shadow: var(--shadow); display: inline-block; }
.qr img, .qr canvas { width: 300px !important; height: 300px !important; }
.stat { display: inline-flex; flex-direction: column; padding: 12px 20px; border-radius: var(--radius-md); background: #fff; box-shadow: var(--shadow-soft); }
.stat__n { font-size: 2.2rem; font-weight: 800; color: var(--primary-strong); line-height: 1; }
.stat__l { font-size: .85rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.corner-code { font-weight: 800; letter-spacing: .1em; color: var(--primary-strong); font-size: 1.3rem; }
.grid-2 { display: grid; gap: 22px; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 899px) { .join-hero { grid-template-columns: 1fr; } }

/* ── Admin ── */
.admin-grid { display: grid; gap: 16px; }
@media (min-width: 1000px) { .admin-grid { grid-template-columns: 360px 1fr; align-items: start; } }
.modbtns { display: flex; flex-wrap: wrap; gap: 8px; }
.modbtns .btn.is-active { background: var(--accent); color: var(--text); }
.poll-list { display: grid; gap: 8px; }
.poll-item { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: var(--radius-md); background: #fff; }
.poll-item.is-current { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 176, 32, .25); }
.poll-item__n { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: var(--primary-soft); color: var(--primary-strong); font-weight: 800; }
.poll-item__title { font-weight: 800; }
.poll-item__sub { font-size: .82rem; color: var(--muted); }
.kbd { display: inline-block; min-width: 22px; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line); border-bottom-width: 2px; background: #fff; font-size: .78rem; font-weight: 800; text-align: center; }
table.simple { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.simple th, table.simple td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.copy { display: flex; gap: 6px; }
.copy input { min-height: 38px; padding: 6px 10px; font-size: .82rem; }
.footer-note { margin-top: 26px; text-align: center; font-size: .78rem; color: var(--muted); }

/* ── Imágenes (assets/img): tamaño fijo para que el diseño no salte al cargar ── */
.emblem { border-radius: 50%; object-fit: cover; }
.hero-img { display: block; width: 100%; height: auto; border-radius: var(--radius-lg); box-shadow: var(--shadow-soft); margin: 0 0 16px; background: var(--primary-soft); }
.presenter .hero-img { height: 210px; object-fit: cover; margin-bottom: 22px; }
@media (max-width: 899px) { .presenter .hero-img { height: auto; } }
