/* Bleff — estilo "Noche de juego" con Manrope. Modo noche por defecto; modo día con data-theme="light". */
:root {
  --bg: #15121F;
  --surface: #2A2540;
  --card: #221E33;
  --text: #F5F1FF;
  --sub: #D9D2F2;
  --muted: #B8B0D6;
  --accent: #FFB547;
  --on-accent: #15121F;
  --accent-soft: #3A2F1F;
  --off: #4A4466;
  --danger: #FF7A7A;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #FFFFFF;
  --surface: #F1F3F7;
  --card: #F5F7FB;
  --text: #121826;
  --sub: #4B5468;
  --muted: #4B5468;
  --accent: #1F4FD1;
  --on-accent: #FFFFFF;
  --accent-soft: #EEF2FF;
  --off: #B9C0CE;
  --danger: #C42B2B;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-family: Manrope, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, textarea { font-family: inherit; }

.screen {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 24px 22px calc(28px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.grow { flex-grow: 1; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack-lg { display: flex; flex-direction: column; gap: 20px; }

/* Barra superior */
.top { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 44px; }
.pill { padding: 6px 12px; border-radius: 999px; background: var(--surface); color: var(--sub); font-size: 14px; }
.pill.accent { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.icon-btn {
  width: 44px; height: 44px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 999px; border: none; cursor: pointer;
  background: var(--surface); color: var(--accent);
}
.back-btn { color: var(--text); }

/* Texto */
h1 { margin: 0; font-size: 32px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.1; }
.lead { margin: 0; font-size: 16px; line-height: 1.45; color: var(--sub); }
.muted { font-size: 14px; line-height: 1.35; color: var(--muted); }
.label { font-size: 16px; font-weight: 800; }
.kicker { font-size: 14px; font-weight: 600; color: var(--accent); }
.section-title { font-size: 17px; font-weight: 800; }

/* Tarjetas */
.word-card { display: flex; flex-direction: column; gap: 8px; padding: 26px 22px; border-radius: 24px; background: var(--card); }
.word-card .word { margin: 0; font-size: 54px; font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.reveal { display: flex; flex-direction: column; gap: 6px; padding: 20px; border-radius: 22px; background: var(--accent); color: var(--on-accent); }
.reveal .over { font-size: 14px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; }
.reveal .big { font-size: 20px; font-weight: 800; line-height: 1.3; }
.summary { padding: 12px 16px; border-radius: 16px; font-size: 14px; line-height: 1.4; background: var(--surface); color: var(--sub); }
.box { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 20px; background: var(--card); }

/* Formularios */
.input {
  height: 56px; width: 100%; padding: 0 18px; border-radius: 18px;
  font-size: 18px; background: var(--surface); color: var(--text);
  border: 2px solid var(--accent); outline: none;
}
.input::placeholder { color: var(--muted); }
.input.code { height: 64px; font-size: 28px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; border-color: var(--surface); }
.input.code:focus { border-color: var(--accent); }

.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 6px; border-radius: 999px; background: var(--surface); }
.seg button { height: 44px; border: none; border-radius: 999px; cursor: pointer; font-size: 15px; font-weight: 800; background: transparent; color: var(--sub); }
.seg button[aria-checked="true"] { background: var(--accent); color: var(--on-accent); }

.stepper { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stepper .value { display: flex; flex-direction: column; align-items: center; }
.stepper .num { font-size: 44px; font-weight: 800; line-height: 1; }
.stepper.small .num { font-size: 32px; }
.step-btn { width: 52px; height: 52px; display: flex; align-items: center; justify-content: center; border-radius: 999px; border: none; cursor: pointer; background: var(--surface); color: var(--text); }
.step-btn:disabled { opacity: 0.4; cursor: default; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch { flex-shrink: 0; width: 60px; height: 36px; padding: 3px; display: flex; align-items: center; border-radius: 999px; border: none; cursor: pointer; background: var(--off); justify-content: flex-start; }
.switch[aria-checked="true"] { background: var(--accent); justify-content: flex-end; }
.switch .knob { width: 30px; height: 30px; border-radius: 999px; background: #FFFFFF; }
.switch[aria-checked="true"] .knob { background: var(--on-accent); }

/* Botones principales */
.cta {
  height: 60px; width: 100%; flex-shrink: 0; border: none; border-radius: 999px; cursor: pointer;
  font-size: 19px; font-weight: 800; background: var(--accent); color: var(--on-accent);
  display: flex; align-items: center; justify-content: center; text-decoration: none;
}
.cta:disabled { opacity: 0.6; cursor: default; }
.cta-off {
  min-height: 60px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 0 18px; border-radius: 999px; font-size: 16px; background: var(--surface); color: var(--muted);
}
.ghost {
  height: 56px; width: 100%; border-radius: 999px; cursor: pointer; font-size: 17px; font-weight: 800;
  background: transparent; color: var(--accent); border: 2px solid var(--accent);
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.ghost.small { height: 44px; width: auto; padding: 0 18px; font-size: 15px; }
.text-btn {
  align-self: center; min-height: 44px; padding: 0 16px; border: none; background: transparent; cursor: pointer;
  font-size: 15px; font-weight: 600; text-decoration: underline; color: var(--sub);
}
.error { padding: 12px 16px; border-radius: 16px; font-size: 15px; line-height: 1.4; background: var(--surface); color: var(--danger); font-weight: 600; }

/* Listas de jugadores */
.player-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 16px; background: var(--surface); border: 2px solid var(--surface); }
.player-row.me { background: var(--accent-soft); border-color: var(--accent); }
.player-row .name { flex: 1 1 auto; font-size: 17px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 36px; height: 36px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border-radius: 999px; font-size: 16px; font-weight: 800; background: var(--card); color: var(--accent); }
.num-badge { width: 36px; height: 36px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border-radius: 12px; font-size: 17px; font-weight: 800; background: var(--card); color: var(--text); }
.num-badge.first { background: var(--accent); color: var(--on-accent); }
.tag { padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; background: var(--accent); color: var(--on-accent); }
.row-dashed { display: flex; align-items: center; justify-content: center; min-height: 52px; border-radius: 16px; font-size: 14px; color: var(--muted); border: 2px dashed var(--surface); }

/* Unirse a la sala */
.join-card { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 22px; border-radius: 24px; text-align: center; background: var(--card); }
.qr { width: 196px; height: 196px; padding: 12px; background: #FFFFFF; border-radius: 16px; }
.qr svg { display: block; width: 100%; height: 100%; }
.room-code { font-size: 44px; font-weight: 800; letter-spacing: 0.14em; }

/* Inicio */
.home-actions { display: flex; flex-direction: column; gap: 12px; }

/* Aviso flotante */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  padding: 12px 18px; border-radius: 999px; background: var(--text); color: var(--bg); font-weight: 600; font-size: 15px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3); z-index: 10;
}
.conn { font-size: 13px; color: var(--muted); text-align: center; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Ronda ---------- */
.word-card.compact { padding: 20px 22px; gap: 6px; }
.word-card.compact .word { font-size: 44px; }
.real-card { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; border-radius: 20px; background: var(--card); border: 2px solid var(--accent); }
.real-card .w { font-size: 30px; font-weight: 800; line-height: 1; }
.over-accent { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); }
.banner { padding: 14px 18px; border-radius: 18px; font-size: 16px; line-height: 1.35; font-weight: 600; background: var(--surface); color: var(--text); }
.banner.on { background: var(--accent); color: var(--on-accent); }
.banner.soft { background: var(--accent-soft); font-size: 14px; font-weight: 400; }

/* Elegir palabra */
.option { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px 18px; border-radius: 20px; cursor: pointer; text-align: left;
  background: var(--surface); color: var(--text); border: 2px solid var(--surface); width: 100%; }
.option[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.option .w { font-size: 22px; font-weight: 800; line-height: 1.1; }
.option .d { font-size: 15px; line-height: 1.35; color: var(--sub); }

/* Escribir */
.def-area { height: 150px; width: 100%; padding: 16px; resize: none; border-radius: 20px; font-size: 18px; line-height: 1.45;
  background: var(--surface); color: var(--text); border: 2px solid var(--accent); outline: none; }
.def-area::placeholder { color: var(--muted); }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.timer { display: flex; align-items: center; gap: 14px; }
.sent-box { display: flex; flex-direction: column; gap: 8px; padding: 20px; border-radius: 20px; background: var(--surface); }
.sent-box p { margin: 0; font-size: 18px; line-height: 1.45; }

/* Lista de definiciones del lector */
.def-row { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; border-radius: 16px; background: var(--surface); border: 2px solid var(--surface); }
.def-row.hit { background: var(--accent-soft); border-color: var(--accent); }
.def-row .who { font-size: 13px; font-weight: 600; color: var(--muted); }
.def-row .txt { font-size: 15px; line-height: 1.35; }
.def-row .txt.pending { color: var(--muted); font-style: italic; }
.hit-btn { flex-shrink: 0; min-width: 84px; height: 44px; padding: 0 12px; border-radius: 999px; cursor: pointer; font-size: 14px; font-weight: 800;
  background: transparent; color: var(--text); border: 2px solid var(--muted); }
.hit-btn[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* Lectura */
.slot { display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 10px; border-radius: 16px; cursor: pointer; width: 100%; text-align: left;
  color: var(--text); background: var(--surface); border: 2px solid var(--surface); }
.slot.current { background: var(--accent-soft); border-color: var(--accent); }
.slot.read { opacity: 0.6; }
.slot .n { flex-shrink: 0; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 12px; font-size: 22px; font-weight: 800; background: var(--card); }
.slot.current .n { background: var(--accent); color: var(--on-accent); }
.slot .t { font-size: 16px; line-height: 1.4; }
.real-tag { display: block; margin-top: 4px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); }

/* Votación */
.num-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.num-btn { height: 76px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: 18px; cursor: pointer;
  background: var(--surface); color: var(--text); border: 2px solid var(--surface); }
.num-btn .big { font-size: 32px; font-weight: 800; line-height: 1; }
.num-btn .mine { font-size: 11px; font-weight: 600; }
.num-btn.mine-slot { border-style: dashed; border-color: var(--accent); }
.num-btn[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); border-style: solid; }
.num-btn:disabled { cursor: default; opacity: 0.5; }
.num-btn:disabled[aria-pressed="true"] { opacity: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; height: 34px; padding: 0 12px; border-radius: 999px; font-size: 14px; }
.chip.done { font-weight: 800; background: var(--surface); }
.chip.now { font-weight: 800; color: var(--accent); border: 2px solid var(--accent); }
.chip.next { color: var(--muted); border: 2px dashed var(--surface); }

/* Resultados */
.res-def { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-radius: 18px; background: var(--surface); border: 2px solid var(--surface); }
.res-def.real { background: var(--accent-soft); border-color: var(--accent); }
.res-def .head { display: flex; align-items: center; gap: 10px; }
.res-def .n { width: 32px; height: 32px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border-radius: 10px; font-size: 16px; font-weight: 800; background: var(--card); }
.res-def.real .n { background: var(--accent); color: var(--on-accent); }
.res-def .author { font-size: 15px; font-weight: 800; flex: 1 1 auto; }
.res-def .txt { font-size: 15px; line-height: 1.4; }
.pts { padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 800; background: var(--accent); color: var(--on-accent); }
.table { display: flex; flex-direction: column; border-radius: 20px; overflow: hidden; background: var(--surface); }
.table .tr { display: flex; align-items: center; gap: 10px; padding: 12px 16px; }
.table .tr + .tr { border-top: 1px solid var(--bg); }
.table .tr.me { background: var(--accent-soft); }
.table .pos { width: 24px; font-size: 14px; font-weight: 800; color: var(--muted); }
.table .nm { flex: 1 1 auto; font-size: 16px; font-weight: 600; }
.table .delta { width: 44px; text-align: right; font-size: 15px; font-weight: 800; color: var(--muted); }
.table .delta.up { color: var(--accent); }
.table .tot { width: 40px; text-align: right; font-size: 18px; font-weight: 800; }
.reveal-word { display: flex; flex-direction: column; gap: 8px; padding: 22px; border-radius: 24px; background: var(--accent); color: var(--on-accent); }
.reveal-word .over { font-size: 14px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; }
.reveal-word .def { font-size: 22px; font-weight: 800; line-height: 1.3; }
.reveal-word .sub { font-size: 15px; font-weight: 600; }
