:root {
  --red: #D90917;
  --red-dark: #b10712;
  --wine: #991824;
  --wine-dark: #5e0d15;
  --pink: #EE7979;
  --pink-soft: #fde8e8;
  --gray: #878787;
  --gray-soft: #e4e4e6;
  --background: #f2f2f3;
  --surface: #ffffff;
  --text: #231F20;
  --muted: #6f6f72;
  --border: #e1e1e4;
  --radius: 22px;
  --shadow: 0 10px 30px rgba(35, 31, 32, 0.08);
  --font-display: "Baloo 2", "Nunito", "Segoe UI", sans-serif;
  font-family: "Nunito", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 0%, rgba(238, 121, 121, 0.18), transparent 40%),
    radial-gradient(circle at 100% 100%, rgba(217, 9, 23, 0.08), transparent 45%),
    var(--background);
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  line-height: 1.1;
  margin: 0 0 8px;
}

h1 {
  font-size: clamp(30px, 6vw, 42px);
}

h2 {
  font-size: clamp(22px, 4.5vw, 30px);
}

.hidden {
  display: none !important;
}

/* ---------- Opciones: colores de la paleta ---------- */
.opt-a { --opt: var(--red); --opt-ink: #fff; }
.opt-b { --opt: var(--wine); --opt-ink: #fff; }
.opt-c { --opt: var(--pink); --opt-ink: var(--wine-dark); }
.opt-d { --opt: var(--gray); --opt-ink: #fff; }
.opt-none { --opt: var(--gray-soft); --opt-ink: var(--muted); }

/* ---------- Barra superior ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px max(18px, calc((100vw - 1200px) / 2));
  background: #fff;
  color: var(--red);
  border-bottom: 6px solid var(--red);
  box-shadow: 0 4px 0 var(--wine);
  position: relative;
  z-index: 2;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-check {
  width: 30px;
  height: 38px;
  fill: none;
  stroke: var(--red);
  stroke-width: 11;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-word {
  display: flex;
  flex-direction: column;
  font-family: "Exo 2", var(--font-display);
  font-weight: 800;
  line-height: 0.95;
}

.brand-word strong {
  font-size: 23px;
  letter-spacing: 0.2px;
}

.brand-word > span {
  font-size: 19px;
}

.brand-word b {
  display: inline-block;
  margin-left: 2px;
  padding: 1px 6px 2px;
  border-radius: 6px;
  background: var(--red);
  color: #fff;
  font-size: 15px;
  vertical-align: 2px;
}

.topbar-label {
  margin-left: auto;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
}

/* ---------- Layout ---------- */
.container {
  width: min(100% - 32px, 1200px);
  margin: 28px auto 40px;
  flex: 1;
}

.panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 2px solid var(--border);
}

.join-panel,
#participantView {
  max-width: 560px;
  margin: 0 auto;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.8px;
}

.muted {
  color: var(--muted);
}

label,
.builder-label {
  display: block;
  margin: 16px 0 6px;
  font-weight: 800;
  font-size: 14px;
}

input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--background);
  font-size: 16px;
  transition: border-color 0.2s, background 0.2s;
}

input:focus {
  outline: none;
  border-color: var(--red);
  background: #fff;
}

.button {
  border: 0;
  border-radius: 16px;
  padding: 14px 20px;
  font-weight: 800;
  font-size: 16px;
  transition: transform 0.12s, box-shadow 0.12s, background 0.2s;
}

.button:not(:disabled):active {
  transform: translateY(3px);
}

.button-primary {
  background: var(--red);
  color: #fff;
  box-shadow: 0 5px 0 var(--wine);
}

.button-primary:not(:disabled):active {
  box-shadow: 0 2px 0 var(--wine);
}

.button-dark {
  background: var(--wine);
  color: #fff;
  box-shadow: 0 5px 0 var(--wine-dark);
}

.button-secondary {
  background: var(--gray-soft);
  color: var(--text);
  box-shadow: 0 5px 0 #c9c9cc;
}

.button-ghost {
  background: transparent;
  color: var(--muted);
  border: 2px dashed var(--border);
}

.join-panel form .button-primary,
.button-big {
  width: 100%;
  margin-top: 22px;
  font-size: 18px;
  padding: 16px;
}

.error {
  min-height: 20px;
  color: var(--red);
  font-weight: 700;
}

.feedback {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--wine);
  font-weight: 700;
  text-align: center;
}

/* ---------- Ingreso: sala y rol ---------- */
select {
  width: 100%;
  padding: 14px 44px 14px 16px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23D90917' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") right 16px center / 14px no-repeat,
    var(--background);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  appearance: none;
  cursor: pointer;
}

select:focus {
  outline: none;
  border-color: var(--red);
  background-color: #fff;
}

select:invalid {
  color: #8d8d91;
}

.role-avatar {
  width: 46px;
  height: 46px;
}

/* El ingreso cabe en una pantalla, sin scroll. */
.login-mode footer {
  display: none;
}

.login-mode .container {
  margin: 14px auto;
}

.login-mode #stepData {
  padding: 18px 20px 14px;
}

.login-mode #stepData h1 {
  font-size: clamp(26px, 5.5vw, 34px);
  margin-bottom: 2px;
}

.login-mode #stepData > p.muted {
  margin: 0 0 4px;
  font-size: 14px;
}

.login-mode #stepData label,
.login-mode #stepData .builder-label {
  margin: 10px 0 5px;
}

.login-mode #stepData input,
.login-mode #stepData select {
  padding-top: 11px;
  padding-bottom: 11px;
}

.login-mode .role-card {
  padding: 10px 8px;
}

.login-mode #dataSubmit {
  margin-top: 16px;
}

.login-mode .error {
  min-height: 0;
  margin: 8px 0 0;
}

@media (max-height: 700px) {
  .login-mode .topbar {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .login-mode #stepData > p.muted,
  .login-mode .role-card small {
    display: none;
  }

  .login-mode .role-avatar,
  .login-mode .role-icon {
    width: 36px;
    height: 36px;
    font-size: 24px;
  }
}
.locked-field {
  position: relative;
}

.locked-field input {
  padding-right: 48px;
  color: var(--muted);
  font-weight: 800;
  letter-spacing: 1.5px;
  background: var(--gray-soft);
  border-style: dashed;
  cursor: not-allowed;
  opacity: 1;
  -webkit-text-fill-color: var(--muted);
}

.locked-field span {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
}

.role-choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.role-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 14px 10px;
  border: 3px solid var(--border);
  border-radius: 18px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 4px 0 var(--border);
  transition: border-color 0.15s, background 0.15s, transform 0.15s, box-shadow 0.15s;
}

.role-card strong {
  font-family: var(--font-display);
  font-size: 19px;
  line-height: 1.1;
}

.role-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.role-card.selected {
  border-color: var(--red);
  background: color-mix(in srgb, var(--pink) 12%, #fff);
  box-shadow: 0 4px 0 var(--red);
  transform: translateY(-2px);
}

.role-icon {
  font-size: 30px;
  line-height: 1.2;
}

.role-card.selected .role-icon {
  animation: boing 0.5s cubic-bezier(.3, 1.8, .5, 1);
}

.fac-greeting {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.fac-greeting > div {
  display: flex;
  flex-direction: column;
}

.fac-greeting strong {
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1.1;
}

.fac-greeting small {
  color: var(--muted);
  font-weight: 700;
}

.fac-greeting .button {
  margin-left: auto;
}

.connecting {
  text-align: center;
  font-weight: 800;
  padding: 40px 0;
  animation: pulse 1.2s infinite;
}

/* ---------- Editor de casos ---------- */
.picker-editor {
  margin-top: 14px;
}

.editor-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.editor-head h1 {
  font-size: clamp(28px, 4vw, 38px);
}

.editor-head p.muted {
  margin: 0;
}

.editor-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 16px;
  align-items: start;
}

.editor-list {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 12px;
  padding: 16px;
}

.editor-cases {
  display: grid;
  gap: 8px;
}

.editor-case {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  text-align: left;
}

.editor-case strong {
  font-family: var(--font-display);
  font-size: 17px;
  line-height: 1.15;
}

.editor-case small {
  color: var(--muted);
  font-weight: 700;
}

.editor-case b {
  color: var(--red);
}

.editor-case.active {
  border-color: var(--red);
  background: color-mix(in srgb, var(--pink) 12%, #fff);
}

.editor-empty {
  text-align: center;
  padding: 50px 20px;
  color: var(--muted);
  font-weight: 800;
}

#editorForm {
  display: grid;
  gap: 16px;
}

.ed-section h2 {
  font-size: 22px;
  margin: 0;
}

.ed-section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.ed-file {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  font-family: Consolas, monospace;
}

details.ed-section summary {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  cursor: pointer;
  list-style: none;
}

details.ed-section summary::before {
  content: "▸";
  color: var(--red);
  font-weight: 800;
  transition: transform 0.2s;
}

details[open].ed-section summary::before {
  transform: rotate(90deg);
}

.ed-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 14px;
}

.ed-wide {
  grid-column: 1 / -1;
}

.ed-field {
  display: block;
  margin: 12px 0 0;
  font-size: 13px;
  font-weight: 800;
}

.ed-field small {
  color: var(--muted);
  font-weight: 700;
}

.ed-field input,
.ed-field textarea,
.ed-option textarea,
.ed-stage-title,
.ed-style-head input {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--background);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
}

.ed-field textarea,
.ed-option textarea {
  resize: vertical;
  line-height: 1.45;
}

.case-editor textarea:focus,
.case-editor input:focus {
  outline: none;
  border-color: var(--red);
  background: #fff;
}

.ed-stages {
  display: grid;
  gap: 14px;
  margin-top: 8px;
}

.ed-stage {
  padding: 16px;
  border-radius: 18px;
  border: 2px solid var(--border);
  background: #fcfcfd;
}

.ed-stage-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ed-stage-num {
  width: 38px;
  height: 42px;
  flex: none;
  display: grid;
  place-items: center;
  background: var(--red);
  color: #fff;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}

.ed-stage-title {
  margin-top: 0 !important;
  font-family: var(--font-display);
  font-size: 18px !important;
  font-weight: 700 !important;
}

.ed-tools {
  display: flex;
  gap: 4px;
  flex: none;
}

.ed-tools button {
  width: 36px;
  height: 36px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font-weight: 800;
}

.ed-tools button:not(:disabled):hover {
  border-color: var(--red);
  color: var(--red);
}

.ed-options {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.ed-option {
  display: grid;
  grid-template-columns: auto 1fr 170px;
  gap: 10px;
  align-items: center;
}

.ed-option textarea {
  margin-top: 0;
}

.ed-option .option-letter {
  width: 36px;
  height: 40px;
  font-size: 18px;
}

.ed-option select {
  padding: 10px 34px 10px 12px;
  font-size: 14px;
  font-weight: 700;
  background-position: right 12px center;
}

.ed-add {
  width: 100%;
  margin-top: 14px;
  border: 2px dashed #c9c9cc;
}

.ed-styles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.ed-style {
  padding: 14px;
  border-radius: 16px;
  border: 2px solid var(--border);
  background: #fcfcfd;
}

.ed-style-head {
  display: grid;
  grid-template-columns: 56px 1fr 48px;
  gap: 8px;
  align-items: center;
}

.ed-style-head input {
  margin-top: 0;
}

.ed-style-head .ed-emoji {
  text-align: center;
  font-size: 20px;
  padding: 8px 4px;
}

.ed-style-head input[type="color"] {
  height: 44px;
  padding: 4px;
  cursor: pointer;
}

.editor-savebar {
  position: sticky;
  bottom: 12px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  border: 2px solid var(--border);
  box-shadow: 0 10px 30px rgba(35, 31, 32, 0.15);
}

.ed-status {
  flex: 1;
  min-width: 180px;
  font-weight: 800;
  font-size: 14px;
  color: var(--muted);
}

.ed-status.pending { color: var(--wine); }
.ed-status.ok { color: #1f7a4d; }
.ed-status.error { color: var(--red); }

@media (max-width: 900px) {
  .editor-layout {
    grid-template-columns: 1fr;
  }

  .editor-list {
    position: static;
  }

  .ed-option {
    grid-template-columns: auto 1fr;
  }

  .ed-option select {
    grid-column: 2;
  }

  .ed-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Creador de avatar ---------- */
.builder-preview {
  position: relative;
  display: grid;
  place-items: center;
  margin: 8px 0 4px;
  padding: 18px;
  border-radius: 20px;
  background:
    repeating-linear-gradient(45deg, transparent 0 14px, rgba(217, 9, 23, 0.05) 14px 28px),
    var(--pink-soft);
}

.avatar-stage {
  width: 170px;
  height: 170px;
}

.dice-button {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 14px;
  background: #fff;
  font-size: 24px;
  box-shadow: 0 4px 0 var(--gray-soft);
  transition: transform 0.3s;
}

.dice-button:hover {
  transform: rotate(25deg);
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice-chip {
  padding: 10px 16px;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: #fff;
  font-weight: 800;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}

.choice-chip.selected {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
  transform: scale(1.05);
}

.swatch {
  width: 42px;
  height: 42px;
  border: 3px solid #fff;
  border-radius: 12px;
  box-shadow: 0 0 0 2px var(--border);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  transition: transform 0.15s;
}

.swatch.selected {
  transform: scale(1.18);
  box-shadow: 0 0 0 3px var(--red);
  clip-path: none;
  border-radius: 50%;
}

.builder-actions {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  margin-top: 24px;
}

/* ---------- Avatares ---------- */
.avatar-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.av-eyes {
  transform-box: fill-box;
  transform-origin: center;
  animation: blink 4.5s infinite;
}

.mood-thinking .av-eyes {
  animation-duration: 3s;
}

/* ---------- Participante ---------- */
.player-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px 14px 10px 10px;
  border-radius: 20px;
  background: var(--surface);
  border: 2px solid var(--border);
}

.player-avatar {
  width: 56px;
  height: 56px;
  flex: none;
  cursor: pointer;
  border-radius: 16px;
  background: var(--pink-soft);
  padding: 4px;
}

.player-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.player-info strong {
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-bar .button-small {
  flex: none;
}

.player-info span {
  color: var(--muted);
  font-size: 13px;
}

.status-pill {
  margin-left: auto;
  flex: none;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--pink-soft);
  color: var(--wine);
  font-size: 12px;
  font-weight: 800;
}

.status-pill.offline {
  background: var(--gray-soft);
  color: var(--muted);
  animation: pulse 1.2s infinite;
}

.stage-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 0 0 16px;
  flex-wrap: wrap;
}

.stage-dot {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--gray-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  transition: transform 0.2s;
}

.stage-dot.done {
  background: #cfcfd2;
  color: #fff;
}

.stage-dot.current {
  background: var(--red);
  color: #fff;
  transform: scale(1.2);
  animation: pulse 1.6s infinite;
}

.stage-dot.chosen {
  background: var(--opt);
  color: var(--opt-ink);
}

.player-screen {
  text-align: center;
  padding: 30px 24px;
}

.screen-avatar {
  position: relative;
  width: 150px;
  height: 150px;
  margin: 0 auto 14px;
}

.idle-bounce {
  animation: bounce 2.2s ease-in-out infinite;
}

.listening {
  animation: sway 2.4s ease-in-out infinite;
}

.sound-wave {
  position: absolute;
  right: -34px;
  top: 50%;
  display: flex;
  gap: 4px;
  align-items: center;
  height: 40px;
  transform: translateY(-50%);
}

.sound-wave i {
  width: 6px;
  height: 100%;
  border-radius: 3px;
  background: var(--red);
  animation: wave 1s ease-in-out infinite;
}

.sound-wave i:nth-child(2) { animation-delay: 0.15s; background: var(--wine); }
.sound-wave i:nth-child(3) { animation-delay: 0.3s; background: var(--pink); }
.sound-wave i:nth-child(4) { animation-delay: 0.45s; background: var(--gray); }

.listen-title {
  margin: 14px 0 4px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--wine);
}

.trophy-icon {
  position: absolute;
  right: -18px;
  top: -10px;
  font-size: 46px;
  animation: bounce 1.4s ease-in-out infinite;
}

.path-badges {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 16px 0;
}

.path-badge {
  width: 44px;
  height: 50px;
  display: grid;
  place-items: center;
  align-content: center;
  background: var(--opt, var(--gray-soft));
  color: var(--opt-ink, var(--muted));
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  animation: pop-in 0.5s both;
  animation-delay: calc(var(--i) * 0.12s + 0.3s);
}

.path-badge small {
  font-size: 10px;
  opacity: 0.8;
}

.chosen-card {
  margin: 12px 0;
  padding: 14px 16px;
  border-radius: 16px;
  border: 3px solid var(--opt);
  background: color-mix(in srgb, var(--opt) 10%, #fff);
  font-weight: 700;
  text-align: left;
}

.match {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: var(--red);
  margin: 6px 0 14px;
}

.mini-bars {
  display: grid;
  gap: 8px;
  margin: 10px 0 16px;
}

.mini-bar {
  display: grid;
  grid-template-columns: auto 1fr 44px;
  align-items: center;
  gap: 10px;
  opacity: 0.7;
}

.mini-bar.mine {
  opacity: 1;
  font-size: 17px;
}

.mini-track {
  height: 12px;
  border-radius: 999px;
  background: var(--gray-soft);
  overflow: hidden;
}

.mini-fill {
  height: 100%;
  width: var(--w);
  border-radius: inherit;
  background: var(--opt);
  animation: grow 0.9s cubic-bezier(.2, .8, .2, 1) both;
  transition: width 0.5s;
}

.room-counter {
  text-align: center;
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
}

/* ---------- Sala de espera ---------- */
.lobby {
  display: grid;
  gap: 16px;
}

.profile-card {
  position: relative;
  padding: 0 20px 20px;
  overflow: hidden;
  text-align: center;
  animation: pop-in 0.45s cubic-bezier(.3, 1.5, .5, 1) both;
}

.profile-banner {
  height: 92px;
  margin: 0 -20px;
  padding: 12px;
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  background:
    repeating-linear-gradient(-45deg, transparent 0 16px, rgba(255, 255, 255, 0.08) 16px 32px),
    linear-gradient(135deg, var(--red), var(--wine));
}

.banner-logout {
  margin-right: auto;
  padding: 6px 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--wine);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.profile-banner .status-pill {
  margin: 0;
  background: rgba(255, 255, 255, 0.92);
}

.profile-avatar {
  display: block;
  width: 136px;
  height: 136px;
  margin: -64px auto 6px;
  padding: 10px;
  border: 5px solid #fff;
  border-radius: 34px;
  background: var(--pink-soft);
  box-shadow: 0 8px 20px rgba(153, 24, 36, 0.25);
  animation: bounce 2.6s ease-in-out infinite;
  touch-action: manipulation;
}

.profile-avatar.jump { animation: jump 0.6s cubic-bezier(.3, 1.6, .5, 1); }
.profile-avatar.spin { animation: spin 0.7s cubic-bezier(.3, 1.4, .5, 1); }
.profile-avatar.wiggle { animation: wiggle 0.6s ease-in-out; }

.profile-reactions {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.profile-reactions span {
  position: absolute;
  top: 120px;
  font-size: 30px;
  animation: float-up 1.4s ease-out both;
}

.profile-card h2 {
  margin: 6px 0 2px;
}

.profile-card > p {
  margin: 0;
}

.profile-tags {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.tag {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--background);
  font-size: 13px;
  font-weight: 800;
}

.profile-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  animation: pulse 1.6s infinite;
}

.button-small {
  padding: 9px 14px;
  font-size: 14px;
  box-shadow: 0 3px 0 #c9c9cc;
}

.decision-zone {
  border: 3px dashed #d4d4d8;
  background: #fbfbfc;
}

.zone-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.zone-head h3 {
  font-size: 20px;
  margin: 0;
}

.zone-head p.muted {
  margin: 4px 0 0;
  font-size: 14px;
}

.zone-lock {
  font-size: 28px;
  animation: wiggle 2.8s ease-in-out infinite;
}

.ghost-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 16px 0 10px;
}

.ghost {
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background:
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent) -100% 0 / 60% 100% no-repeat,
    color-mix(in srgb, var(--opt) 18%, #fff);
  color: color-mix(in srgb, var(--opt) 70%, #fff);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  animation: shimmer 2.2s infinite;
}

.ghost:nth-child(2) { animation-delay: 0.2s; }
.ghost:nth-child(3) { animation-delay: 0.4s; }
.ghost:nth-child(4) { animation-delay: 0.6s; }

.waiting-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
  font-size: 14px;
}

.dots {
  display: inline-flex;
  gap: 4px;
}

.dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  animation: bounce-dot 1.2s infinite;
}

.dots i:nth-child(2) { animation-delay: 0.15s; }
.dots i:nth-child(3) { animation-delay: 0.3s; }

.mini-game {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 2px dashed var(--border);
}

.game-head {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 14px;
  margin-bottom: 8px;
}

.score {
  font-weight: 800;
  color: var(--wine);
}

.score b {
  display: inline-block;
}

.game-area {
  position: relative;
  height: 220px;
  overflow: hidden;
  border-radius: 16px;
  background:
    radial-gradient(circle, rgba(135, 135, 135, 0.18) 1.5px, transparent 1.5px) 0 0 / 18px 18px,
    var(--pink-soft);
  touch-action: manipulation;
  user-select: none;
}

.hex-bubble {
  position: absolute;
  bottom: -70px;
  border: 0;
  padding: 0;
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  animation: rise var(--dur) linear forwards;
  -webkit-tap-highlight-color: transparent;
}

.hex-bubble.special {
  background: linear-gradient(135deg, #ffd166, #f4a300);
  color: var(--wine);
}

.hex-bubble.popped {
  animation-play-state: paused;
  scale: 1.8;
  opacity: 0;
  pointer-events: none;
  transition: scale 0.25s ease-out, opacity 0.25s ease-out;
}

.score-float {
  position: absolute;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--red);
  pointer-events: none;
  animation: score-up 0.8s ease-out forwards;
}

.roster-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.roster-item {
  width: 58px;
  text-align: center;
  animation: drop-in 0.55s cubic-bezier(.3, 1.6, .5, 1) both;
}

.roster-item svg {
  width: 50px;
  height: 50px;
}

.roster-item small {
  display: block;
  font-size: 11px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roster-item.me small {
  color: var(--red);
  font-weight: 800;
}

/* ---------- Selector de casos ---------- */
.case-picker {
  margin-bottom: 16px;
}

.case-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.case-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 16px 18px;
  border: 3px solid var(--border);
  border-radius: 18px;
  background: #fff;
  text-align: left;
  color: var(--text);
  box-shadow: 0 5px 0 var(--border);
  animation: slide-up 0.45s both;
  animation-delay: calc(var(--i) * 0.08s);
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.case-card:hover {
  border-color: var(--red);
  box-shadow: 0 5px 0 var(--red);
  transform: translateY(-2px);
}

.case-icon {
  width: 54px;
  height: 60px;
  display: grid;
  place-items: center;
  background: var(--red);
  color: #fff;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}

.case-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.case-body strong {
  font-family: var(--font-display);
  font-size: 21px;
  line-height: 1.1;
}

.case-body span,
.case-body small {
  color: var(--muted);
  font-weight: 700;
}

.case-go {
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--red);
  color: #fff;
  font-weight: 800;
  white-space: nowrap;
}

.case-current {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.case-current span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.case-current strong {
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.1;
}

.no-case .fac-grid {
  grid-template-columns: 1fr;
}

/* ---------- Decisión ---------- */
.decision-screen h2 {
  margin-bottom: 18px;
}

.options-list {
  display: grid;
  gap: 12px;
}

.option-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px;
  border: 3px solid var(--border);
  border-radius: 18px;
  background: #fff;
  text-align: left;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.35;
  color: var(--text);
  box-shadow: 0 5px 0 var(--border);
  animation: slide-up 0.45s both;
  animation-delay: calc(var(--i) * 0.08s);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s, transform 0.15s;
}

.option-card:hover {
  border-color: var(--opt);
}

.option-card.selected {
  border-color: var(--opt);
  background: color-mix(in srgb, var(--opt) 12%, #fff);
  box-shadow: 0 5px 0 var(--opt);
  transform: translateY(-2px);
}

.option-card.tap {
  animation: tap 0.3s;
}

.option-letter {
  width: 44px;
  height: 48px;
  flex: none;
  display: grid;
  place-items: center;
  background: var(--opt);
  color: var(--opt-ink);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}

.option-check {
  position: absolute;
  top: -10px;
  right: -8px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--opt);
  color: var(--opt-ink);
  font-weight: 800;
  transform: scale(0);
  transition: transform 0.25s cubic-bezier(.3, 1.8, .5, 1);
}

.option-card.sent .option-check {
  transform: scale(1);
}

/* ---------- Facilitador ---------- */
#facilitatorLogin {
  margin-top: 20px;
}

.fac-header {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: stretch;
  margin-bottom: 16px;
}

.join-card {
  flex: 1 1 300px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 16px 22px;
  border-radius: var(--radius);
  background: var(--red);
  color: #fff;
  box-shadow: 0 6px 0 var(--wine);
}

.join-card span {
  font-weight: 700;
  opacity: 0.9;
}

.join-card strong {
  font-family: var(--font-display);
  font-size: clamp(24px, 3.4vw, 36px);
  line-height: 1.1;
  word-break: break-all;
}

.join-card b {
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 2px;
}

.fac-stats {
  display: flex;
  gap: 12px;
  flex: 1 1 320px;
}

.stat-chip {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 2px solid var(--border);
}

.stat-chip strong {
  font-family: var(--font-display);
  font-size: 40px;
  line-height: 1;
  color: var(--red);
}

.stat-chip span {
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
}

.control-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-bottom: 16px;
  padding: 16px 20px;
}

.control-bar .stage-dots {
  margin: 0 0 0 auto;
}

.control-bar .feedback {
  width: 100%;
  margin: 0;
  min-height: 0;
}

.control-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.fac-grid {
  display: grid;
  grid-template-columns: minmax(300px, 400px) 1fr;
  gap: 16px;
  align-items: start;
}

.projection .fac-grid {
  grid-template-columns: 1fr;
}

.projection .script-panel {
  display: none;
}

.script-panel {
  position: sticky;
  top: 16px;
}

.script-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.phase-badge {
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--gray-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.phase-story { background: var(--pink-soft); color: var(--wine); }
.phase-open { background: var(--red); color: #fff; animation: pulse 1.4s infinite; }
.phase-closed { background: var(--wine); color: #fff; }

.narration {
  font-size: 17px;
  line-height: 1.6;
  white-space: pre-line;
}

.script-question {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 2px dashed var(--border);
}

.script-question h3 {
  font-size: 19px;
}

.live-options {
  display: grid;
  gap: 10px;
}

.live-option {
  display: grid;
  grid-template-columns: auto 1fr 32px;
  gap: 10px;
  align-items: center;
}

.live-option .option-letter {
  width: 34px;
  height: 38px;
  font-size: 17px;
}

.live-option p {
  margin: 0 0 5px;
  font-size: 13px;
  line-height: 1.35;
}

.live-option b {
  font-family: var(--font-display);
  font-size: 22px;
  text-align: right;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.arena {
  min-height: 380px;
  background:
    radial-gradient(circle, rgba(135, 135, 135, 0.16) 1.5px, transparent 1.5px) 0 0 / 22px 22px,
    var(--surface);
}

.arena-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 14px;
}

.arena-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 0;
  font-weight: 700;
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px 10px;
  border-radius: 18px;
  background: #fff;
  border: 2px solid var(--border);
  text-align: center;
  transition: border-color 0.3s, opacity 0.3s, filter 0.3s;
}

.tile.enter {
  animation: drop-in 0.6s cubic-bezier(.3, 1.6, .5, 1) both;
}

.tile.pop {
  animation: celebrate 0.7s cubic-bezier(.3, 1.6, .5, 1);
}

.tile-face {
  width: 78px;
  height: 78px;
}

.tile.thinking .tile-face {
  animation: sway 2.6s ease-in-out infinite;
}

.tile.answered {
  border-color: var(--red);
  background: color-mix(in srgb, var(--pink) 10%, #fff);
}

.tile.offline {
  opacity: 0.55;
  filter: grayscale(1);
}

.tile-name {
  margin-top: 6px;
  max-width: 100%;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-site {
  max-width: 100%;
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-bubble {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 30px;
  height: 26px;
  display: none;
  place-items: center;
  padding: 0 7px;
  border-radius: 13px 13px 13px 3px;
  font-weight: 800;
  font-size: 14px;
}

.tile.thinking .tile-bubble {
  display: grid;
  background: var(--gray-soft);
  color: var(--muted);
}

.tile.thinking .tile-bubble::after {
  content: "•••";
  letter-spacing: 1px;
  animation: pulse 1s infinite;
}

.tile.answered .tile-bubble {
  display: grid;
  background: var(--red);
  color: #fff;
}

.tile.answered .tile-bubble::after {
  content: "✓";
}

.tile.offline .tile-bubble {
  display: grid;
  background: var(--gray-soft);
  color: var(--muted);
}

.tile.offline .tile-bubble::after {
  content: "zZ";
}

.tile-remove {
  display: none;
  position: absolute;
  top: 6px;
  left: 6px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: var(--text);
  color: #fff;
  font-weight: 800;
  line-height: 1;
}

.tile-remove:hover {
  background: var(--red);
}

/* En línea: aparece al pasar el mouse. Desconectado o en pantallas táctiles: siempre visible. */
.tile:hover .tile-remove,
.tile:focus-within .tile-remove,
.tile.offline .tile-remove {
  display: block;
}

@media (hover: none) {
  .tile-remove {
    display: block;
  }
}

.tile.leaving {
  animation: leave 0.35s ease-in forwards;
  pointer-events: none;
}

@keyframes leave {
  to { opacity: 0; transform: scale(0.5) translateY(20px); }
}

.arena-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
}

.group-col {
  padding: 14px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--opt) 9%, #fff);
  border: 3px solid var(--opt);
  animation: slide-up 0.5s both;
  animation-delay: calc(var(--c) * 0.12s);
}

.group-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.group-head strong {
  display: block;
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1;
}

.group-head span {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  color: var(--opt);
}

.opt-c .group-head span {
  color: var(--wine);
}

.group-text {
  margin: 10px 0;
  font-size: 13px;
  line-height: 1.35;
  color: var(--muted);
}

.group-people {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.group-avatar {
  width: 54px;
  text-align: center;
  animation: drop-in 0.5s cubic-bezier(.3, 1.6, .5, 1) both;
  animation-delay: calc(var(--c) * 0.12s + var(--i) * 0.06s + 0.2s);
}

.group-avatar svg {
  width: 48px;
  height: 48px;
}

.group-avatar small {
  display: block;
  font-size: 10px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Resultados ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(35, 31, 32, 0.55);
}

.modal-card {
  width: min(100%, 820px);
  max-height: 88vh;
  overflow-y: auto;
  animation: pop-in 0.35s both;
}

.result-section {
  display: grid;
  gap: 10px;
  padding: 16px 0;
  border-top: 2px dashed var(--border);
}

.result-section h3,
.result-section p.muted {
  margin: 0;
}

.modal-card {
  width: min(100%, 1000px);
}

.modal-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.modal-actions .button {
  padding: 10px 14px;
}

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  padding: 5px;
  border-radius: 16px;
  background: var(--background);
  overflow-x: auto;
}

.tab {
  flex: 1;
  padding: 10px 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}

.tab.active {
  background: #fff;
  color: var(--red);
  box-shadow: 0 3px 0 var(--border);
}

.tab-panel {
  animation: pop-in 0.35s both;
}

.results-subtitle {
  margin: 26px 0 12px;
  font-size: 21px;
}

.results-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.results-kpis div {
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--background);
}

.results-kpis strong {
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1;
  color: var(--red);
}

.results-kpis span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.style-tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--s, var(--gray)) 16%, #fff);
  color: color-mix(in srgb, var(--s, var(--gray)) 75%, #000);
  border: 1.5px solid color-mix(in srgb, var(--s, var(--gray)) 45%, #fff);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.style-tag.mixed {
  --s: var(--gray);
}

.style-hero {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--s), color-mix(in srgb, var(--s) 65%, #000));
  color: #fff;
  animation: pop-in 0.5s both;
}

.style-hero .eyebrow {
  color: rgba(255, 255, 255, 0.85);
  margin: 0;
}

.style-hero h3 {
  font-size: 28px;
  margin: 2px 0 4px;
}

.style-hero p {
  margin: 0;
}

.style-hero-emoji {
  font-size: 56px;
  animation: bounce 2s ease-in-out infinite;
}

.style-hero strong {
  font-family: var(--font-display);
  font-size: 48px;
}

.conclusion-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.conclusion-list li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 2px solid var(--border);
  background: #fff;
  animation: slide-up 0.45s both;
  animation-delay: calc(var(--i) * 0.07s);
}

.conclusion-icon {
  font-size: 26px;
}

.conclusion-list strong {
  font-family: var(--font-display);
  font-size: 18px;
}

.conclusion-list p {
  margin: 2px 0 0;
  line-height: 1.45;
}

.style-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.style-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border-radius: 18px;
  border: 3px solid var(--s);
  background: color-mix(in srgb, var(--s) 7%, #fff);
  animation: slide-up 0.45s both;
  animation-delay: calc(var(--i) * 0.08s);
}

.style-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.style-card-head strong {
  display: block;
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1;
}

.style-card-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.style-emoji {
  display: grid;
  place-items: center;
  width: 46px;
  height: 50px;
  flex: none;
  background: #fff;
  font-size: 24px;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}

.style-emoji.small {
  width: 30px;
  height: 33px;
  font-size: 16px;
  background: var(--background);
}

.style-desc,
.style-line {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
}

.style-people {
  margin-top: auto;
  padding-top: 8px;
  border-top: 2px dashed color-mix(in srgb, var(--s) 30%, #fff);
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

.style-avatars {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: 6px;
}

.style-avatars span {
  width: 30px;
  height: 30px;
}

.style-avatars em {
  align-self: center;
  font-style: normal;
}

.site-list,
.people-list {
  display: grid;
  gap: 8px;
}

.site-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--background);
}

.reflection-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
  font-weight: 700;
  line-height: 1.45;
}

.result-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.level-badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: var(--gray-soft);
  color: var(--muted);
}

.level-consenso { background: var(--red); color: #fff; }
.level-tendencia { background: var(--pink-soft); color: var(--wine); }
.level-dividida { background: var(--wine); color: #fff; }

.person-row {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) auto minmax(140px, auto);
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 14px;
  background: var(--background);
}

.person-avatar {
  width: 42px;
  height: 42px;
}

.person-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.person-info span,
.person-style small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.person-path {
  display: flex;
  gap: 4px;
}

.path-chip {
  width: 26px;
  height: 29px;
  display: grid;
  place-items: center;
  background: var(--opt, var(--gray-soft));
  color: var(--opt-ink, var(--muted));
  font-size: 12px;
  font-weight: 800;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}

.person-style {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

.my-style {
  margin: 18px 0;
  padding: 18px;
  border-radius: 20px;
  border: 3px solid var(--s);
  background: color-mix(in srgb, var(--s) 8%, #fff);
  text-align: left;
  animation: pop-in 0.5s 0.9s both;
}

.my-style-name {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.my-style-name span {
  font-size: 40px;
  animation: bounce 1.8s ease-in-out infinite;
}

.my-style-name strong {
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 1.1;
  color: color-mix(in srgb, var(--s) 80%, #000);
}

.my-style > p {
  margin: 4px 0;
  font-size: 14px;
}

.my-style .mini-bars {
  margin-bottom: 0;
}

.finish-logo {
  justify-content: center;
  margin: -6px 0 18px;
  color: var(--red);
}

.share-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 18px 0 8px;
}

.share-ig,
.share-ws {
  color: #fff;
  font-size: 15px;
  padding: 14px 10px;
  text-decoration: none;
  text-align: center;
}

.share-ig {
  background: linear-gradient(45deg, #f09433, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888);
  box-shadow: 0 5px 0 #8a1260;
}

.share-ws {
  background: #25D366;
  box-shadow: 0 5px 0 #128C7E;
}

.share-modal {
  width: min(100%, 440px);
  text-align: center;
}

.share-modal img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 58vh;
  margin: 12px auto 16px;
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.share-modal-actions {
  display: grid;
  gap: 10px;
}

.share-modal-actions a {
  text-decoration: none;
}

@media (max-width: 360px) {
  .share-actions {
    grid-template-columns: 1fr;
  }
}

.mini-bar.style-bar {
  grid-template-columns: 128px 1fr 48px;
  font-size: 14px;
}

.mini-bar.style-bar b {
  text-align: right;
}

.style-bar-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
}

@media (max-width: 640px) {
  .style-hero {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .person-row {
    grid-template-columns: auto 1fr;
  }

  .person-path,
  .person-style {
    grid-column: 1 / -1;
    align-items: flex-start;
  }
}

@media print {
  body * {
    visibility: hidden;
  }

  #resultsPanel,
  #resultsPanel * {
    visibility: visible;
  }

  #resultsPanel {
    position: absolute;
    inset: 0;
    display: block;
    background: #fff;
  }

  #resultsPanel .modal-card {
    max-height: none;
    overflow: visible;
    box-shadow: none;
    border: 0;
  }

  #resultsPanel .tab-panel.hidden {
    display: block !important;
  }

  .modal-actions,
  .tabs {
    display: none !important;
  }

  * {
    animation: none !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ---------- Confeti ---------- */
.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 50;
}

.confetti span {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 14px;
  border-radius: 2px;
  animation: fall linear both;
}

/* ---------- Pie ---------- */
footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 18px max(18px, calc((100vw - 1200px) / 2));
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

/* ---------- Animaciones ---------- */
.pop-in { animation: pop-in 0.45s cubic-bezier(.3, 1.5, .5, 1) both; }
.boing { animation: boing 0.5s cubic-bezier(.3, 1.8, .5, 1); }
.jump { animation: jump 0.6s cubic-bezier(.3, 1.6, .5, 1); }

@keyframes pop-in {
  from { opacity: 0; transform: scale(0.9) translateY(12px); }
  to { opacity: 1; transform: none; }
}

@keyframes boing {
  0% { transform: scale(0.8); }
  60% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@keyframes jump {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-16px) rotate(-8deg); }
  70% { transform: translateY(0) scale(1.08, 0.92); }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes sway {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(4deg); }
}

@keyframes wave {
  0%, 100% { transform: scaleY(0.3); }
  50% { transform: scaleY(1); }
}

@keyframes blink {
  0%, 92%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(0.1); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

@keyframes tap {
  50% { transform: scale(0.96); }
}

@keyframes drop-in {
  from { opacity: 0; transform: translateY(-24px) scale(0.6); }
  to { opacity: 1; transform: none; }
}

@keyframes celebrate {
  0% { transform: scale(1); }
  30% { transform: scale(1.15) translateY(-10px) rotate(-4deg); }
  60% { transform: scale(0.96) rotate(3deg); }
  100% { transform: none; }
}

@keyframes spin {
  from { transform: rotate(0) scale(1); }
  50% { transform: rotate(200deg) scale(0.9); }
  to { transform: rotate(360deg) scale(1); }
}

@keyframes wiggle {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-12deg); }
  40% { transform: rotate(10deg); }
  60% { transform: rotate(-6deg); }
  80% { transform: rotate(4deg); }
}

@keyframes float-up {
  from { opacity: 1; transform: translate(0, 0) scale(0.6); }
  to { opacity: 0; transform: translate(var(--drift), -120px) scale(1.3); }
}

@keyframes shimmer {
  to { background-position: 200% 0, 0 0; }
}

@keyframes bounce-dot {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

@keyframes rise {
  to { transform: translate(var(--drift), -310px) rotate(40deg); }
}

@keyframes score-up {
  to { transform: translate(-50%, -40px); opacity: 0; }
}

@keyframes grow {
  from { width: 0; }
}

@keyframes fall {
  to {
    transform: translate(var(--drift), 105vh) rotate(var(--spin));
  }
}

@media (max-width: 860px) {
  .fac-grid {
    grid-template-columns: 1fr;
  }

  .script-panel {
    position: static;
  }

  .control-bar .stage-dots {
    margin: 0;
  }
}

@media (max-width: 520px) {
  .container {
    margin-top: 20px;
  }

  .panel {
    padding: 20px 16px;
  }

  .topbar-label {
    display: none;
  }

  .option-card {
    font-size: 14px;
    padding: 14px 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
