:root {
  --green: #385828;
  --green-dark: #2a431e;
  --green-soft: #e8efe4;
  --orange: #E87A30;
  --orange-dark: #c9631f;
  --orange-soft: #fdf0e6;
  --white: #FFFFFF;
  --ivory: #F8F9FA;
  --text: #1F2937;
  --muted: #6B7280;
  --line: #E5E7EB;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(31, 41, 55, 0.08);
  font-family: 'Poppins', 'Nunito', 'Inter', system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--ivory); color: var(--text); font-size: 16px; line-height: 1.45; -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; }
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  border: 0; border-radius: 999px; padding: .85em 1.4em; font-weight: 600;
  cursor: pointer; transition: transform .08s, background .2s, opacity .2s;
  background: var(--line); color: var(--text);
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--orange); color: var(--white); }
.btn-primary:hover:not(:disabled) { background: var(--orange-dark); }
.btn-green { background: var(--green); color: var(--white); }
.btn-green:hover:not(:disabled) { background: var(--green-dark); }
.btn-ghost { background: transparent; border: 2px solid var(--line); }
.btn-danger { background: #fee2e2; color: #991b1b; }
.btn-block { width: 100%; padding: 1.05em 1.4em; font-size: 1.08rem; }
.btn-sm { padding: .45em .9em; font-size: .88rem; }

.field { display: block; margin-bottom: 1.1rem; }
.field > span { display: block; font-weight: 600; margin-bottom: .4rem; }
.input, .textarea {
  width: 100%; border: 2px solid var(--line); border-radius: 12px; padding: .8em 1em;
  background: var(--white); color: var(--text); outline: none; transition: border-color .2s;
}
.input:focus, .textarea:focus { border-color: var(--orange); }
.textarea { min-height: 150px; resize: vertical; }
.hint { color: var(--muted); font-size: .88rem; }
.error { color: #b91c1c; font-size: .92rem; min-height: 1.2em; margin: .4rem 0; }

.card { background: var(--white); color: var(--text); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; }
.tag { display: inline-flex; align-items: center; gap: .4em; border-radius: 999px; padding: .35em .9em; font-weight: 600; font-size: .9rem; }
.tag-orange { background: var(--orange); color: var(--white); }
.tag-green { background: var(--green); color: var(--white); }
.dot { width: .6em; height: .6em; border-radius: 50%; display: inline-block; background: #d1d5db; }
.dot.on { background: #22c55e; }

.wordcloud { display: flex; flex-wrap: wrap; gap: .3em .8em; align-items: center; justify-content: center; }
.wordcloud span { font-weight: 700; line-height: 1.1; }

/* ---------- Participante (móvil) ---------- */
.mobile { max-width: 520px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.hero { background: var(--green); color: var(--white); text-align: center; padding: 2rem 1rem 2.6rem; border-radius: 0 0 28px 28px; }
.hero img { width: 150px; height: 150px; object-fit: cover; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(255,255,255,.25); }
.hero h1 { font-size: 1.35rem; margin-top: .8rem; margin-bottom: .2rem; }
.hero p { margin: 0; opacity: .85; }
.screen { flex: 1; padding: 1.25rem; }
.join-card { margin-top: -1.6rem; }
.topbar { display: flex; align-items: center; gap: .6rem; padding: .8rem 1.25rem; background: var(--white); border-bottom: 1px solid var(--line); }
.topbar img { width: 38px; height: 38px; object-fit: cover; border-radius: 50%; background: var(--green); }
.topbar .who { margin-left: auto; color: var(--muted); font-size: .9rem; }
.anon { display: flex; align-items: center; gap: .4em; color: var(--green); font-weight: 600; font-size: .92rem; margin: .5rem 0 1rem; }
.counter { text-align: right; font-size: .85rem; color: var(--muted); }
.situation-title { font-size: 1.25rem; margin: .8rem 0 1rem; }

.waiting { position: relative; text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 60vh; overflow: hidden; }
.waiting .bg-logo { position: absolute; inset: 0; margin: auto; width: 80%; max-width: 360px; aspect-ratio: 1; object-fit: cover; border-radius: 50%; opacity: .07; pointer-events: none; }
.flame { width: 84px; height: 84px; animation: flicker 1.6s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes flicker { 0%, 100% { transform: scale(1) rotate(-2deg); } 50% { transform: scale(1.08) rotate(2deg); } }
.waiting h2 { color: var(--green); font-size: 1.4rem; margin-top: 1rem; }
.pulse-text { animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
.speaker-banner { background: var(--orange); color: var(--white); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; font-weight: 700; font-size: 1.15rem; animation: pop .5s ease; }
@keyframes pop { from { transform: scale(.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.mirror { background: #f3f4f6; border: 2px solid var(--orange); border-radius: 14px; padding: .9rem 1rem; font-size: .92rem; text-align: left; }
.mirror + .mirror { margin-top: .7rem; }
.mirror.after { border-color: var(--green); background: var(--green-soft); }
.mirror b { display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: .25rem; }
.mirror-wrap { width: 100%; margin-top: 1.5rem; position: relative; z-index: 1; }
.locked-mirror { display: flex; gap: .6rem; align-items: center; background: #f3f4f6; border: 2px dashed #d1d5db; border-radius: 14px; padding: .8rem 1rem; color: var(--muted); font-size: .9rem; margin-bottom: 1rem; }

.flash { animation: flash .8s ease 2; }
@keyframes flash { 50% { background: var(--orange-soft); } }

/* ---------- Moderador ---------- */
.admin { max-width: 1200px; margin: 0 auto; padding: 1rem; }
.admin-header { display: flex; flex-wrap: wrap; gap: .8rem 1.2rem; align-items: center; background: var(--green); color: var(--white); border-radius: var(--radius); padding: .9rem 1.2rem; margin-bottom: 1rem; }
.admin-header img { width: 46px; height: 46px; border-radius: 50%; background: var(--green); object-fit: cover; box-shadow: 0 0 0 2px rgba(255,255,255,.3); }
.admin-header .brand { font-weight: 800; font-size: 1.15rem; display: flex; align-items: center; gap: .6rem; }
.admin-header .stat { font-size: .92rem; opacity: .95; }
.admin-header .spacer { flex: 1; }
.phase-switch { display: inline-flex; background: rgba(255,255,255,.15); border-radius: 999px; padding: 4px; }
.phase-switch button { border: 0; background: transparent; color: var(--white); padding: .45em 1em; border-radius: 999px; font-weight: 600; cursor: pointer; }
.phase-switch button.active { background: var(--orange); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }
.panel h2 { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--green); margin-bottom: .9rem; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.row .input { flex: 1; min-width: 180px; }
.sit-list { list-style: none; padding: 0; margin: 0; }
.sit-list li { display: flex; align-items: center; gap: .6rem; padding: .6rem .2rem; border-bottom: 1px solid var(--line); }
.sit-list li:last-child { border-bottom: 0; }
.sit-list .num { width: 1.8em; height: 1.8em; border-radius: 50%; background: var(--green-soft); color: var(--green); font-weight: 700; display: grid; place-items: center; flex: none; }
.sit-list .title { flex: 1; }
.sit-list .meta { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.sit-list li.active { background: var(--orange-soft); border-radius: 10px; }
.live { color: var(--orange); font-weight: 700; }
.speakers { list-style: none; padding: 0; margin: .8rem 0 0; }
.speakers li { background: var(--orange-soft); color: var(--text); border-left: 4px solid var(--orange); padding: .55rem .8rem; border-radius: 8px; margin-bottom: .4rem; font-weight: 600; }
.feed { list-style: none; padding: 0; margin: 0; max-height: 420px; overflow: auto; }
.feed li { background: var(--ivory); color: var(--text); border-radius: 10px; padding: .6rem .8rem; margin-bottom: .45rem; }
.users-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.users-table th, .users-table td { text-align: left; padding: .45rem .4rem; border-bottom: 1px solid var(--line); }
.users-table th { color: var(--muted); font-weight: 600; font-size: .8rem; }
.scroll { max-height: 360px; overflow: auto; }
.login { max-width: 380px; margin: 12vh auto; text-align: center; }
.login img { width: 120px; height: 120px; margin-bottom: 1rem; border-radius: 50%; object-fit: cover; background: var(--green); }
.toast { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--white); padding: .7rem 1.1rem; border-radius: 999px; box-shadow: var(--shadow); z-index: 10; }
details summary { cursor: pointer; font-weight: 600; }

/* ---------- Proyección ---------- */
.display { min-height: 100vh; background: var(--green); color: var(--white); display: flex; flex-direction: column; padding: 2.5vh 3vw; overflow: hidden; }
.display header { display: flex; align-items: center; gap: 1.2vw; font-size: 2.2vh; }
.display header img { width: 9vh; height: 9vh; border-radius: 50%; background: var(--green); object-fit: cover; box-shadow: 0 0 0 .3vh rgba(255,255,255,.3); }
.display header .phase { margin-left: auto; }
.display main { flex: 1; display: flex; align-items: center; justify-content: center; }
.reg { display: grid; grid-template-columns: auto 1fr; gap: 4vw; align-items: center; width: 100%; }
.reg .qr { background: var(--white); border-radius: 3vh; padding: 2vh; width: 52vh; height: 52vh; }
.reg .qr img { width: 100%; height: 100%; }
.reg .url { font-size: 2.6vh; text-align: center; margin-top: 1.4vh; opacity: .9; word-break: break-all; }
.reg .big { font-size: 13vh; font-weight: 800; line-height: 1; color: var(--orange); }
.reg .names { display: flex; flex-wrap: wrap; gap: 1vh; margin-top: 2vh; max-height: 34vh; overflow: hidden; }
.reg .names span { background: rgba(255,255,255,.14); border-radius: 999px; padding: .6vh 1.6vh; font-size: 2.4vh; }
.disp-situation { text-align: center; max-width: 80vw; }
.disp-situation .tag { font-size: 3vh; padding: 1vh 2.4vh; }
.disp-situation h1 { font-size: 8vh; margin: 3vh 0; }
.disp-situation .count { font-size: 3.4vh; opacity: .9; }
.draw { text-align: center; width: 100%; }
.draw h1 { font-size: 5vh; margin-bottom: 5vh; }
.draw .cards { display: flex; gap: 3vw; justify-content: center; flex-wrap: wrap; perspective: 1000px; }
.flip { width: 26vw; height: 34vh; position: relative; transform-style: preserve-3d; transition: transform .9s cubic-bezier(.3,1.4,.5,1); }
.flip.revealed { transform: rotateY(180deg); }
.flip > div { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 3vh; display: grid; place-items: center; padding: 2vh; }
.flip .front { background: var(--orange); font-size: 14vh; font-weight: 800; }
.flip .back { background: var(--white); color: var(--green); transform: rotateY(180deg); font-size: 5vh; font-weight: 800; text-align: center; }
.roulette { font-size: 6vh; font-weight: 800; color: var(--orange); min-height: 8vh; margin-bottom: 3vh; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 3vw; width: 100%; height: 100%; }
.compare section { background: rgba(255,255,255,.08); border-radius: 3vh; padding: 3vh; display: flex; flex-direction: column; }
.compare section.with { background: var(--white); color: var(--green); }
.compare h2 { font-size: 3.6vh; text-align: center; margin-bottom: 2vh; }
.compare .wordcloud { flex: 1; align-content: center; }
.empty { opacity: .7; font-size: 2.6vh; text-align: center; }
