/* ==========================================================================
   SpeakifAI · sistema visual tipo app
   Fondo degradé vivo, superficies de vidrio, botones con volumen y un shell
   de app (barra superior compacta + pestañas inferiores). Dos temas:
   noche (por defecto) y día, elegidos con html[data-ui].
   ========================================================================== */

:root {
  --font-display: 'Fredoka', 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --bg-a: #12082b; --bg-b: #2e1067; --bg-c: #6a23d8; --bg-d: #d53f8c;
  --ink: #ffffff;
  --ink-2: rgba(255, 255, 255, .80);
  --ink-3: rgba(255, 255, 255, .60);
  --glass: rgba(255, 255, 255, .11);
  --glass-2: rgba(255, 255, 255, .17);
  --glass-3: rgba(255, 255, 255, .24);
  --glass-b: rgba(255, 255, 255, .22);
  --solid: #241052;          /* menús y hojas: fondo opaco */
  --field: rgba(255, 255, 255, .95);
  --field-ink: #24124d;
  --shade: rgba(9, 0, 30, .42);

  --yellow: #ffd23f; --pink: #ff4fa3; --green: #2ed573; --red: #ff5a6a;
  --blue: #4dabf7; --violet: #8b5cf6; --orange: #ff9f1a; --cyan: #22d3ee;
  --accent: var(--yellow);
  --primary: #7c4dff;

  --r-sm: 12px; --r: 18px; --r-lg: 26px; --r-xl: 32px;
  --shadow: 0 18px 50px rgba(10, 0, 40, .45);
  --shadow-sm: 0 6px 18px rgba(10, 0, 40, .28);
  --appbar-h: 58px;
  --tabbar-h: 70px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --page-max: 720px;
  --ease-pop: cubic-bezier(.2, 1.4, .4, 1);
  --ease-out: cubic-bezier(.2, .9, .3, 1);

  color-scheme: dark;
}

html[data-ui="day"] {
  --bg-a: #f6efff; --bg-b: #ecdcff; --bg-c: #ffd9ec; --bg-d: #d9ecff;
  --ink: #23124a;
  --ink-2: rgba(35, 18, 74, .78);
  --ink-3: rgba(35, 18, 74, .55);
  --glass: rgba(255, 255, 255, .72);
  --glass-2: rgba(255, 255, 255, .86);
  --glass-3: rgba(124, 77, 255, .14);
  --glass-b: rgba(124, 77, 255, .18);
  --solid: #ffffff;
  --field: #ffffff;
  --field-ink: #23124a;
  --shade: rgba(60, 20, 120, .16);
  --shadow: 0 18px 50px rgba(80, 40, 160, .18);
  --shadow-sm: 0 6px 18px rgba(80, 40, 160, .14);
  color-scheme: light;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  background: var(--bg-a);
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
  scroll-padding-top: calc(var(--appbar-h) + var(--safe-top) + 12px);
}
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: transparent;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
  overflow-x: hidden;
}
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink);
  margin: 0 0 .6rem;
  letter-spacing: .1px;
}
h1 { font-size: clamp(1.8rem, 6vw, 2.4rem); }
h2 { font-size: clamp(1.45rem, 5vw, 1.9rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.08rem; }
p { margin: 0 0 .75rem; }
a { color: var(--yellow); text-decoration: none; font-weight: 700; }
html[data-ui="day"] a { color: #6d28d9; }
a:hover { color: inherit; opacity: .9; text-decoration: none; }
img { max-width: 100%; }
small, .small { font-size: .85em; }
hr { border: 0; border-top: 1px solid var(--glass-b); margin: 1.25rem 0; }
::selection { background: rgba(255, 210, 63, .45); }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; border-radius: 8px; }
.text-muted, .muted { color: var(--ink-3) !important; }
.text-center { text-align: center; }
.hidden, [hidden] { display: none !important; }
.visually-hidden, .sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- fondo vivo ---------- */
.app-bg {
  position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
  background: linear-gradient(150deg, var(--bg-a) 0%, var(--bg-b) 38%, var(--bg-c) 72%, var(--bg-d) 100%);
}
.app-bg .blob {
  position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55;
  animation: blob-drift 22s ease-in-out infinite alternate;
}
.app-bg .b1 { width: 55vmax; height: 55vmax; left: -18vmax; top: -20vmax; background: #7c3aed; }
.app-bg .b2 { width: 45vmax; height: 45vmax; right: -16vmax; top: 18vh; background: #ec4899; animation-delay: -7s; }
.app-bg .b3 { width: 40vmax; height: 40vmax; left: 10vw; bottom: -22vmax; background: #3b82f6; animation-delay: -14s; opacity: .35; }
html[data-ui="day"] .app-bg .blob { opacity: .35; }
html[data-ui="day"] .app-bg .b1 { background: #c4b5fd; }
html[data-ui="day"] .app-bg .b2 { background: #fbcfe8; }
html[data-ui="day"] .app-bg .b3 { background: #bae6fd; }
.app-bg .bubbles span {
  position: absolute; bottom: -40px; border-radius: 50%; background: rgba(255, 255, 255, .16);
  animation: bubble-up linear infinite;
}
html[data-ui="day"] .app-bg .bubbles span { background: rgba(124, 77, 255, .12); }
@keyframes blob-drift {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(6vw, 5vh, 0) scale(1.12); }
}
@keyframes bubble-up {
  0% { transform: translateY(0) scale(.6); opacity: 0; }
  10% { opacity: 1; }
  100% { transform: translateY(-115vh) scale(1.1); opacity: 0; }
}

/* ---------- barra superior ---------- */
.appbar {
  position: sticky; top: 0; z-index: 40;
  height: calc(var(--appbar-h) + var(--safe-top));
  padding: var(--safe-top) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(180deg, rgba(18, 8, 43, .72), rgba(18, 8, 43, .35));
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  view-transition-name: appbar;
}
html[data-ui="day"] .appbar {
  background: linear-gradient(180deg, rgba(255, 255, 255, .82), rgba(255, 255, 255, .55));
  border-bottom-color: rgba(124, 77, 255, .12);
}
.appbar-brand { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--ink); }
.appbar-brand img { height: 34px; width: auto; display: block; }
.appbar-brand .wordmark {
  font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; letter-spacing: .2px;
  background: linear-gradient(90deg, var(--yellow), var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
html[data-ui="day"] .appbar-brand .wordmark { background: linear-gradient(90deg, #7c3aed, #db2777); -webkit-background-clip: text; background-clip: text; }
.appbar-title {
  flex: 1; min-width: 0; font-family: var(--font-display); font-weight: 600; font-size: 1.05rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center;
}
.appbar-spacer { flex: 1; }
.appbar-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.icon-btn {
  width: 40px; height: 40px; flex: 0 0 auto; border-radius: 50%; border: 0; padding: 0;
  display: inline-grid; place-items: center; cursor: pointer;
  background: var(--glass); color: var(--ink);
  transition: transform .12s, background .2s;
}
.icon-btn:hover { background: var(--glass-2); }
.icon-btn:active { transform: scale(.9); }
.icon-btn .ic { width: 21px; height: 21px; }
.icon-btn .when-off, .icon-btn.is-muted .when-on { display: none; }
.icon-btn.is-muted .when-off { display: contents; }
.icon-btn .when-on { display: contents; }
.star-pill {
  display: inline-flex; align-items: center; gap: 4px; height: 34px; padding: 0 12px 0 9px;
  border-radius: 999px; background: rgba(255, 210, 63, .16); color: var(--ink);
  font-family: var(--font-display); font-weight: 600; font-size: .98rem; white-space: nowrap;
  border: 1px solid rgba(255, 210, 63, .35);
}
.star-pill .ic { width: 17px; height: 17px; color: var(--yellow); fill: var(--yellow); }
.guest-strip {
  margin: 10px auto 0; width: min(var(--page-max), calc(100% - 24px));
  display: flex; align-items: center; gap: 10px; padding: 9px 14px;
  border-radius: var(--r); background: var(--glass); border: 1px solid var(--glass-b);
  font-size: .9rem; color: var(--ink-2);
}
.guest-strip a { margin-left: auto; white-space: nowrap; }

/* ---------- contenido ---------- */
.app-main {
  width: min(var(--page-max), 100%);
  margin: 0 auto;
  padding: 18px 16px calc(var(--tabbar-h) + var(--safe-bottom) + 28px);
  view-transition-name: page;
  animation: page-in .38s var(--ease-out) both;
}
body.immersive .app-main { padding-bottom: calc(var(--safe-bottom) + 24px); }
body.wide .app-main { width: min(1040px, 100%); }
@keyframes page-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.container, .content-wrapper { width: 100%; max-width: none; padding: 0; margin: 0; }
.row { margin-left: -8px; margin-right: -8px; }
.row > [class*="col"] { padding-left: 8px; padding-right: 8px; }

/* ---------- pestañas inferiores ---------- */
.tabbar {
  position: fixed; z-index: 45; left: 50%; transform: translateX(-50%);
  bottom: calc(10px + var(--safe-bottom));
  width: min(520px, calc(100% - 20px)); height: var(--tabbar-h);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  padding: 0 6px; border-radius: 26px;
  background: rgba(30, 12, 70, .78);
  border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: 0 14px 40px rgba(8, 0, 30, .5);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  view-transition-name: tabbar;
}
html[data-ui="day"] .tabbar { background: rgba(255, 255, 255, .88); border-color: rgba(124, 77, 255, .16); box-shadow: 0 14px 40px rgba(80, 40, 160, .2); }
.tab {
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--ink-3); font-family: var(--font-display); font-weight: 500; font-size: .72rem;
  text-decoration: none; border-radius: 18px; transition: color .2s, transform .12s;
}
.tab .ic { width: 23px; height: 23px; transition: transform .25s var(--ease-pop); }
.tab:hover { color: var(--ink); }
.tab:active { transform: scale(.92); }
.tab.active { color: var(--ink); }
.tab.active .ic { transform: translateY(-2px) scale(1.08); color: var(--yellow); }
html[data-ui="day"] .tab.active .ic { color: #7c3aed; }
.tab.active::after { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--yellow); margin-top: 1px; }
html[data-ui="day"] .tab.active::after { background: #7c3aed; }
.tab.tab-fab { color: #fff; }
.tab.tab-fab .fab {
  width: 54px; height: 54px; border-radius: 19px; display: grid; place-items: center; margin-top: -26px;
  background: linear-gradient(160deg, #ff7cc0, var(--pink) 55%, #d6337f);
  box-shadow: 0 6px 0 #a3195c, 0 14px 30px rgba(255, 79, 163, .45);
  transition: transform .12s, box-shadow .12s;
}
.tab.tab-fab .fab .ic { width: 28px; height: 28px; color: #fff; }
.tab.tab-fab:active .fab { transform: translateY(4px); box-shadow: 0 2px 0 #a3195c, 0 8px 18px rgba(255, 79, 163, .4); }
.tab.tab-fab span:last-child { margin-top: 2px; }
.tab.tab-fab.active::after { display: none; }

/* ---------- hoja inferior (menú "más") ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 80; background: rgba(5, 0, 20, .5);
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.sheet {
  position: fixed; z-index: 81; left: 50%; bottom: 0; width: min(560px, 100%);
  transform: translate(-50%, 105%); transition: transform .34s var(--ease-out);
  background: var(--solid); color: var(--ink);
  border-radius: 28px 28px 0 0; border: 1px solid var(--glass-b); border-bottom: 0;
  padding: 10px 16px calc(18px + var(--safe-bottom));
  box-shadow: 0 -20px 60px rgba(0, 0, 0, .45);
  max-height: 86dvh; overflow-y: auto;
}
.sheet-open .app-sheet-backdrop { opacity: 1; pointer-events: auto; }
.sheet-open .app-sheet { transform: translate(-50%, 0); }
.sheet-grip { width: 44px; height: 5px; border-radius: 3px; background: var(--glass-3); margin: 0 auto 12px; }
.sheet h3 { font-size: 1.05rem; margin: 6px 4px 10px; color: var(--ink-2); }
.sheet-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.sheet-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 14px;
  border-radius: 16px; border: 0; background: var(--glass); color: var(--ink);
  font-family: var(--font-display); font-weight: 500; font-size: 1.02rem; text-align: left; cursor: pointer;
}
.sheet-item:hover { background: var(--glass-2); color: var(--ink); }
.sheet-item .ic { width: 22px; height: 22px; color: var(--ink-2); }
.sheet-item.danger { color: #ff9aa5; }
html[data-ui="day"] .sheet-item.danger { color: #c81e4a; }
.sheet-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.chip-btn {
  flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 14px; border-radius: 14px; border: 2px solid var(--glass-b); background: transparent;
  color: var(--ink); font-family: var(--font-display); font-weight: 500; cursor: pointer;
}
.chip-btn.on { background: var(--yellow); border-color: var(--yellow); color: #2b1b4d; }
.chip-btn .ic { width: 19px; height: 19px; }

/* ---------- toasts ---------- */
.toasts {
  position: fixed; z-index: 90; left: 50%; transform: translateX(-50%);
  top: calc(var(--appbar-h) + var(--safe-top) + 8px);
  width: min(520px, calc(100% - 24px)); display: grid; gap: 8px; pointer-events: none;
}
.toast-msg {
  pointer-events: auto; display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 18px; background: #fff; color: #23124a;
  font-weight: 700; box-shadow: 0 12px 30px rgba(0, 0, 0, .3);
  animation: toast-in .4s var(--ease-pop) both;
}
.toast-msg.out { animation: toast-out .25s ease-in both; }
.toast-msg::before { content: '✨'; font-size: 1.1rem; }
.toast-msg.success::before { content: '✅'; }
.toast-msg.error::before, .toast-msg.danger::before { content: '⚠️'; }
.toast-msg.warning::before { content: '💡'; }
.toast-msg.info::before { content: '💬'; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-16px) scale(.95); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-10px) scale(.97); } }
.flashes-container { display: none; }

/* ---------- conexión ---------- */
.conn-banner {
  position: fixed; z-index: 95; left: 50%; transform: translate(-50%, -150%);
  top: calc(var(--safe-top) + 8px); padding: 7px 16px; border-radius: 999px;
  background: var(--red); color: #fff; font-weight: 800; font-size: .88rem;
  box-shadow: var(--shadow-sm); transition: transform .3s var(--ease-out);
}
.conn-banner.show { transform: translate(-50%, 0); }

/* ---------- superficies ---------- */
.card, .section, .lobby-card, .auth-card, .form-section, .ranking-card, .mobile-result-card,
.mobile-game-card, .room-card, .panel, .glass {
  background: var(--glass);
  border: 1px solid var(--glass-b);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--ink);
}
.card, .section, .lobby-card, .form-section, .panel, .glass { padding: 20px 18px; margin-bottom: 14px; }
.card .card-body { padding: 0; }
.card .card-header, .card .card-footer { background: transparent; border-color: var(--glass-b); padding: 0 0 12px; }
.card .card-footer { padding: 12px 0 0; }
.section + .section { margin-top: 0; }
.panel-pop { animation: pop-in .45s var(--ease-pop) both; }
@keyframes pop-in { from { opacity: 0; transform: scale(.9) translateY(16px); } to { opacity: 1; transform: none; } }
.auth-card { max-width: 440px; margin: 8px auto 16px; padding: 26px 22px; }

.page-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 4px 2px 16px;
}
.page-header h1, .page-header h2 { margin: 0; }
.page-header-title { display: flex; align-items: center; gap: 10px; }
.page-header-subtitle { color: var(--ink-3); font-size: .95rem; margin: 2px 0 0; }
.page-footer-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }

/* ---------- botones ---------- */
.btn {
  --btn-bg: var(--glass-2); --btn-edge: rgba(0, 0, 0, .28); --btn-ink: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 20px; border: 0; border-radius: 16px;
  font-family: var(--font-display); font-weight: 600; font-size: 1.02rem; line-height: 1.15;
  color: var(--btn-ink) !important; background: var(--btn-bg);
  box-shadow: 0 5px 0 var(--btn-edge);
  cursor: pointer; text-decoration: none !important; user-select: none; white-space: normal;
  transition: transform .08s, box-shadow .08s, filter .2s, opacity .2s;
}
.btn:hover { filter: brightness(1.07); }
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--btn-edge); }
.btn:focus { box-shadow: 0 5px 0 var(--btn-edge); }
.btn:disabled, .btn.disabled { opacity: .55; cursor: not-allowed; filter: saturate(.6); }
.btn .ic { width: 20px; height: 20px; }
.btn-primary { --btn-bg: linear-gradient(180deg, #ff7cc0, var(--pink)); --btn-edge: #b51d68; --btn-ink: #fff; }
.btn-success { --btn-bg: linear-gradient(180deg, #4ce38b, var(--green)); --btn-edge: #139a4b; --btn-ink: #06361a; }
.btn-danger { --btn-bg: linear-gradient(180deg, #ff7f8c, var(--red)); --btn-edge: #b3243a; --btn-ink: #fff; }
.btn-warning { --btn-bg: linear-gradient(180deg, #ffe17a, var(--yellow)); --btn-edge: #c79a00; --btn-ink: #3d2a00; }
.btn-info { --btn-bg: linear-gradient(180deg, #7cc4ff, var(--blue)); --btn-edge: #1f6fb5; --btn-ink: #fff; }
.btn-secondary, .btn-light, .btn-dark { --btn-bg: var(--glass-2); --btn-edge: rgba(0, 0, 0, .25); --btn-ink: var(--ink); }
html[data-ui="day"] .btn-secondary, html[data-ui="day"] .btn-light { --btn-bg: #fff; --btn-edge: rgba(80, 40, 160, .22); }
.btn-violet { --btn-bg: linear-gradient(180deg, #a78bfa, var(--violet)); --btn-edge: #5b21b6; --btn-ink: #fff; }
.btn[class*="btn-outline-"], .btn-link, .btn-ghost {
  --btn-bg: transparent; --btn-edge: transparent; --btn-ink: var(--ink);
  border: 2px solid var(--glass-b); box-shadow: none;
}
.btn[class*="btn-outline-"]:active:not(:disabled), .btn-link:active, .btn-ghost:active { transform: scale(.97); box-shadow: none; }
.btn-outline-danger { --btn-ink: #ff9aa5; border-color: rgba(255, 90, 106, .45); }
html[data-ui="day"] .btn-outline-danger { --btn-ink: #c81e4a; }
.btn-link { border: 0; text-decoration: underline !important; min-height: auto; padding: 4px 8px; }
.btn-sm { min-height: 36px; padding: 6px 13px; font-size: .9rem; border-radius: 12px; box-shadow: 0 3px 0 var(--btn-edge); }
.btn-sm:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--btn-edge); }
.btn-lg, .big-cta { min-height: 56px; font-size: 1.2rem; border-radius: 18px; padding: 12px 24px; }
.btn-block, .btn-wide, .w-100.btn { width: 100%; display: flex; }
.btn + .btn { margin-left: 0; }

/* ---------- formularios ---------- */
label { font-weight: 700; color: var(--ink-2); margin-bottom: .35rem; display: inline-block; }
.form-group { margin-bottom: 14px; }
.form-control, input[type="text"], input[type="email"], input[type="password"], input[type="search"],
input[type="number"], input[type="date"], input[type="url"], input[type="tel"], textarea, select {
  width: 100%; min-height: 48px; padding: 11px 14px;
  font: 600 1rem/1.4 var(--font-body); color: var(--field-ink);
  background: var(--field); border: 3px solid transparent; border-radius: 16px;
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, .06); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea, textarea.form-control { min-height: 110px; resize: vertical; line-height: 1.5; }
.form-control:focus, input:focus, textarea:focus, select:focus {
  border-color: var(--yellow); box-shadow: 0 0 0 4px rgba(255, 210, 63, .22); color: var(--field-ink); background: var(--field);
}
html[data-ui="day"] .form-control:focus, html[data-ui="day"] input:focus, html[data-ui="day"] textarea:focus, html[data-ui="day"] select:focus {
  border-color: #8b5cf6; box-shadow: 0 0 0 4px rgba(139, 92, 246, .2);
}
.form-control::placeholder, input::placeholder, textarea::placeholder { color: rgba(36, 18, 77, .45); font-weight: 600; }
.form-control-sm { min-height: 38px; padding: 6px 10px; font-size: .92rem; border-radius: 12px; }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; min-height: 0; accent-color: var(--pink); vertical-align: middle; }
input[type="range"] { accent-color: var(--yellow); min-height: 0; padding: 0; background: transparent; box-shadow: none; border: 0; }
input[type="color"] { width: 44px; height: 38px; min-height: 0; padding: 2px; border-radius: 10px; }
input[type="file"] { min-height: 0; background: transparent; color: var(--ink); border: 0; box-shadow: none; padding: 6px 0; }
.form-text, .help-text { color: var(--ink-3); font-size: .86rem; }
.form-check { display: flex; align-items: center; gap: 8px; padding-left: 0; }
.form-check-input { position: static; margin: 0; }
.form-check-label { margin: 0; font-weight: 600; }
.invalid-feedback { color: #ffb3bd; }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.form-section h4 { margin-bottom: 12px; }
.number-field { display: flex; align-items: center; gap: 8px; }
.number-field input[type="number"] { text-align: center; max-width: 110px; }
.number-field .step-btn {
  width: 44px; height: 44px; border-radius: 14px; border: 0; background: var(--glass-2); color: var(--ink);
  font: 700 1.3rem var(--font-display); cursor: pointer; box-shadow: 0 4px 0 rgba(0, 0, 0, .25);
}
.number-field .step-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, .25); }
input[type="number"]::-webkit-inner-spin-button { opacity: .6; }

/* tarjetas de opción (crear sala) */
.radio-cards, .checkbox-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.radio-card, .checkbox-card, .checkbox-grid .checkbox-item {
  position: relative; display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
  padding: 14px; border-radius: 18px; cursor: pointer; min-height: 0;
  background: var(--glass); border: 2px solid var(--glass-b); color: var(--ink);
  transition: transform .15s, border-color .15s, background .15s;
}
.radio-card:hover, .checkbox-card:hover { transform: translateY(-2px); background: var(--glass-2); }
.radio-card input[type="radio"], .checkbox-card input[type="checkbox"] { position: absolute; top: 12px; right: 12px; }
.radio-card:has(input:checked), .radio-card.active, .checkbox-card:has(input:checked), .checkbox-card.active {
  border-color: var(--yellow); background: rgba(255, 210, 63, .14); box-shadow: 0 0 0 4px rgba(255, 210, 63, .14);
}
html[data-ui="day"] .radio-card:has(input:checked), html[data-ui="day"] .checkbox-card:has(input:checked) { border-color: #8b5cf6; background: rgba(139, 92, 246, .1); }
.choice-media, .choice-icon { font-size: 1.6rem; line-height: 1; }
.choice-icon img, .choice-media img { width: 34px; height: 34px; }
.choice-text { display: flex; flex-direction: column; gap: 2px; }
.choice-title { font-family: var(--font-display); font-weight: 600; font-size: 1rem; }
.choice-desc { color: var(--ink-3); font-size: .84rem; line-height: 1.35; font-weight: 600; }
.checkbox-grid small { color: var(--ink-3); }

/* ---------- avisos, badges ---------- */
.alert {
  border-radius: var(--r); border: 1px solid var(--glass-b); background: var(--glass); color: var(--ink);
  padding: 13px 16px; margin-bottom: 14px; font-weight: 600;
}
.alert-success { background: rgba(46, 213, 115, .16); border-color: rgba(46, 213, 115, .45); }
.alert-danger, .alert-error { background: rgba(255, 90, 106, .16); border-color: rgba(255, 90, 106, .45); }
.alert-warning { background: rgba(255, 210, 63, .16); border-color: rgba(255, 210, 63, .45); }
.alert-info { background: rgba(77, 171, 247, .16); border-color: rgba(77, 171, 247, .45); }
.alert .close { color: var(--ink); text-shadow: none; opacity: .7; }
.info-note { padding: 12px 14px; border-radius: var(--r); background: var(--glass); color: var(--ink-2); }
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 999px;
  font-family: var(--font-display); font-weight: 600; font-size: .78rem; line-height: 1;
  white-space: nowrap; background: var(--glass-2); color: var(--ink); border: 0;
}
.badge-primary { background: var(--violet); color: #fff; }
.badge-success { background: var(--green); color: #053b1b; }
.badge-warning { background: var(--yellow); color: #4a3500; }
.badge-danger { background: var(--red); color: #fff; }
.badge-info { background: var(--blue); color: #04223d; }
.badge-secondary, .badge-neutral, .badge-light { background: var(--glass-2); color: var(--ink); }
.badge-dark { background: rgba(0, 0, 0, .35); color: #fff; }
.privacy-badge.public { background: var(--green); color: #053b1b; }
.privacy-badge.private-link { background: var(--yellow); color: #4a3500; }
.privacy-badge.private-invite { background: var(--blue); color: #04223d; }
.age-badge { background: rgba(77, 171, 247, .22); color: var(--ink); }
.tag { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: .75rem; font-weight: 800; background: var(--glass-2); }
.tag-host { background: var(--yellow); color: #4a3500; }
.tag-ready { background: var(--green); color: #053b1b; }
.tag-notready { background: var(--glass-2); color: var(--ink-2); }
.host-badge { color: var(--yellow); font-weight: 800; font-size: .85rem; }
.user-stars, .star-badge { display: inline-flex; align-items: center; gap: 3px; font-weight: 800; white-space: nowrap; }
.star-simple { display: inline-block; }
.star-earned-animation { animation: star-pop .6s var(--ease-pop) both; }
@keyframes star-pop { from { transform: scale(0) rotate(-30deg); } to { transform: none; } }

/* ---------- tablas ---------- */
.table, .data-table, .results-table {
  width: 100%; color: var(--ink); background: transparent; border-collapse: separate; border-spacing: 0;
  margin-bottom: 12px; font-size: .95rem;
}
.table th, .table td, .data-table th, .data-table td, .results-table th, .results-table td {
  padding: 10px 12px; border-top: 1px solid var(--glass-b); vertical-align: middle; color: var(--ink);
  background: transparent;
}
.table thead th, .data-table thead th, .results-table th {
  border-top: 0; border-bottom: 2px solid var(--glass-b); color: var(--ink-3);
  font-family: var(--font-display); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .05em;
}
.table-hover tbody tr:hover, .data-table tbody tr:hover, .results-table tr:hover { background: var(--glass); color: var(--ink); }
.table-striped tbody tr:nth-of-type(odd), .data-table tbody tr:nth-child(even) { background: rgba(255, 255, 255, .04); }
.table-responsive { border-radius: var(--r); overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table .cell-muted, .results-table .player-sub { color: var(--ink-3); }
.data-table .name-strong, .results-table .player-name { font-weight: 800; }
.cell-nowrap { white-space: nowrap; }
.current-user-row { background: rgba(255, 210, 63, .12) !important; }
.late-submission, .mobile-late-submission { color: #ffc9a3; font-size: .85rem; }
.feedback-text { display: block; margin-top: 6px; color: var(--ink-3); font-size: .88rem; font-style: italic; }

/* ---------- listas de jugadores ---------- */
.player-list, .room-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.player-list li, .room-list li {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 16px;
  background: var(--glass); border: 1px solid transparent; font-weight: 700; animation: pop-in .3s var(--ease-pop) both;
}
.player-list .current-user { border-color: var(--yellow); }
.player-list .not-ready { opacity: .85; }

/* ---------- tarjetas de sala ---------- */
.room-card { padding: 16px; margin-bottom: 12px; transition: transform .15s; }
.room-card + .room-card { margin-top: 0; }
.room-card:hover { transform: translateY(-2px); }
.room-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.room-header h3 { margin: 0; font-size: 1.2rem; }
.room-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.room-meta { display: flex; gap: 6px 14px; flex-wrap: wrap; margin: 10px 0; color: var(--ink-2); font-size: .9rem; }
.room-meta .meta-item { display: inline-flex; align-items: center; gap: 6px; }
.room-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.room-actions .btn { flex: 1 1 auto; }
.search-form { display: flex; gap: 8px; margin-bottom: 14px; }
.search-input { flex: 1; }

/* tarjetas mobile del historial */
.mobile-game-card { padding: 14px; margin-bottom: 10px; }
.mobile-game-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.mobile-game-name { font-family: var(--font-display); font-weight: 600; }
.mobile-game-stats, .mobile-game-details { display: flex; flex-wrap: wrap; gap: 8px 14px; color: var(--ink-2); font-size: .88rem; margin-top: 8px; }
.mobile-detail-row { display: flex; justify-content: space-between; gap: 10px; width: 100%; border-bottom: 1px solid var(--glass-b); padding: 4px 0; }
.mobile-detail-row:last-child { border-bottom: 0; }
.mobile-detail-label { color: var(--ink-3); }
.mobile-winner { color: var(--yellow); font-weight: 800; }
.mobile-game-actions { margin-top: 10px; }
.mobile-view-btn { display: inline-flex; gap: 6px; align-items: center; }

/* ---------- Bootstrap: piezas sueltas ---------- */
.nav-tabs, .nav-pills { border: 0; gap: 6px; display: flex; flex-wrap: wrap; }
.nav-tabs .nav-link, .nav-pills .nav-link {
  border: 2px solid var(--glass-b) !important; border-radius: 14px !important; color: var(--ink-2); background: transparent;
  font-family: var(--font-display); font-weight: 600; padding: 8px 14px;
}
.nav-tabs .nav-link.active, .nav-pills .nav-link.active, .nav-pills .show > .nav-link {
  background: var(--yellow) !important; border-color: var(--yellow) !important; color: #2b1b4d !important;
}
.list-group-item { background: var(--glass); border-color: var(--glass-b); color: var(--ink); }
.modal-content { background: var(--solid); color: var(--ink); border-radius: var(--r-lg); border: 1px solid var(--glass-b); box-shadow: var(--shadow); }
.modal-header, .modal-footer { border-color: var(--glass-b); }
.modal-backdrop.show { opacity: .6; }
.close { color: var(--ink); text-shadow: none; }
.dropdown-menu { background: var(--solid); border: 1px solid var(--glass-b); border-radius: 16px; box-shadow: var(--shadow); }
.dropdown-item { color: var(--ink); font-weight: 600; }
.dropdown-item:hover { background: var(--glass-2); color: var(--ink); }
.progress { background: var(--glass-2); border-radius: 999px; height: 10px; }
.progress-bar { background: linear-gradient(90deg, var(--yellow), var(--pink)); border-radius: 999px; }
.spinner-border { width: 1.6rem; height: 1.6rem; border-width: .22em; color: var(--yellow) !important; }
.bg-light, .bg-white { background: var(--glass) !important; color: var(--ink) !important; }
.text-dark { color: var(--ink) !important; }
.text-primary { color: var(--yellow) !important; }
html[data-ui="day"] .text-primary { color: #6d28d9 !important; }
.text-success { color: var(--green) !important; }
.text-danger { color: #ff8a97 !important; }
.text-warning { color: var(--yellow) !important; }
.border, .border-top, .border-bottom { border-color: var(--glass-b) !important; }
details > summary { cursor: pointer; font-family: var(--font-display); font-weight: 600; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: '▸'; display: inline-block; margin-right: 8px; transition: transform .2s; }
details[open] > summary::before { transform: rotate(90deg); }
code, pre { color: var(--yellow); background: rgba(0, 0, 0, .25); border-radius: 8px; padding: 2px 6px; }

/* ==========================================================================
   Juego
   ========================================================================== */

/* HUD de juego (lobby, ronda, votación, resultados) */
.game-hud {
  display: flex; align-items: center; gap: 10px; margin: 0 0 14px;
}
.round-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 999px;
  background: var(--glass-2); font-family: var(--font-display); font-weight: 600; font-size: .92rem; white-space: nowrap;
}
.round-chip .ic { width: 17px; height: 17px; }
.cat-chip { background: var(--yellow); color: #3a2800; }
.hud-spacer { flex: 1; }

/* jugadores en vivo */
.live-players { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; margin: 0 -2px 6px; scrollbar-width: none; }
.live-players::-webkit-scrollbar { display: none; }
.lp {
  position: relative; flex: 0 0 auto; display: flex; align-items: center; gap: 7px;
  padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--glass); border: 2px solid var(--glass-b);
  font-weight: 800; font-size: .88rem; white-space: nowrap; transition: border-color .25s, background .25s, transform .3s;
}
.lp .av {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: .95rem;
  font-family: var(--font-display); font-weight: 700; color: #fff; background: var(--violet);
}
.lp.me { border-color: var(--yellow); }
.lp.done { background: rgba(46, 213, 115, .2); border-color: rgba(46, 213, 115, .7); }
.lp.done::after {
  content: '✓'; position: absolute; top: -6px; right: -4px; width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center; background: var(--green); color: #053b1b; font-size: 12px; font-weight: 900;
  animation: pop-in .35s var(--ease-pop) both;
}
.lp.bump { animation: bump .6s var(--ease-pop); }
@keyframes bump { 35% { transform: scale(1.14); } }
.lp.away { opacity: .45; }
.answer-progress { font-family: var(--font-display); font-weight: 600; color: var(--ink-2); font-size: .92rem; }

/* tarjeta de consigna */
.prompt-card {
  position: relative; padding: 22px 20px 20px; border-radius: var(--r-xl); margin-bottom: 14px;
  background: #fff; color: #24124d; box-shadow: 0 10px 0 rgba(0, 0, 0, .18), var(--shadow);
  animation: card-in .6s var(--ease-pop) both; overflow: hidden;
}
.prompt-card::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 8px;
  background: linear-gradient(90deg, var(--yellow), var(--pink), var(--violet), var(--blue));
}
.prompt-card .prompt-kicker {
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-display); font-weight: 600;
  font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: #7a6a99; margin-bottom: 8px;
}
.prompt-card .prompt-text {
  font-family: var(--font-display); font-weight: 600; font-size: clamp(1.3rem, 5.2vw, 1.75rem); line-height: 1.25; color: #24124d;
  margin: 0; overflow-wrap: anywhere;
}
.prompt-card .prompt-tools { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.prompt-card .mini-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 0;
  background: #f1eaff; color: #4c2b99; font-weight: 800; font-size: .82rem; cursor: pointer;
}
.prompt-card .mini-btn .ic { width: 16px; height: 16px; }
@keyframes card-in {
  0% { opacity: 0; transform: translateY(60px) rotate(4deg) scale(.92); }
  100% { opacity: 1; transform: none; }
}

/* reloj circular */
.timer-ring {
  --p: 1; --col: var(--green);
  position: relative; width: 66px; height: 66px; flex: 0 0 auto; border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--col) calc(var(--p) * 360deg), rgba(255, 255, 255, .16) 0);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
}
.timer-ring::before { content: ''; position: absolute; inset: 7px; border-radius: 50%; background: var(--solid); }
.timer-ring .t {
  position: relative; font-family: var(--font-display); font-weight: 700; font-size: 1.45rem; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.timer-ring.warn { --col: var(--yellow); }
.timer-ring.danger { --col: var(--red); }
.timer-ring.danger .t { animation: tick-pulse 1s ease-in-out infinite; color: #ffb3bd; }
html[data-ui="day"] .timer-ring.danger .t { color: #c81e4a; }
.timer-ring.done { --p: 0; }
.timer-ring.small { width: 52px; height: 52px; }
.timer-ring.small::before { inset: 6px; }
.timer-ring.small .t { font-size: 1.1rem; }
@keyframes tick-pulse { 50% { transform: scale(1.18); } }
.timer-bar { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, .16); overflow: hidden; }
.timer-bar i { display: block; height: 100%; width: 100%; transform-origin: left; background: linear-gradient(90deg, var(--yellow), var(--pink)); }

/* dock de respuesta */
.answer-dock {
  padding: 14px; border-radius: var(--r-xl); background: var(--glass); border: 1px solid var(--glass-b);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); animation: slide-up .45s var(--ease-out) .15s both;
}
@keyframes slide-up { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }
.mode-switch { display: flex; gap: 6px; padding: 4px; border-radius: 16px; background: rgba(0, 0, 0, .2); margin-bottom: 12px; }
html[data-ui="day"] .mode-switch { background: rgba(124, 77, 255, .1); }
.mode-switch button {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 10px;
  border: 0; border-radius: 12px; background: transparent; color: var(--ink-2);
  font-family: var(--font-display); font-weight: 600; cursor: pointer;
}
.mode-switch button .ic { width: 18px; height: 18px; }
.mode-switch button.on { background: var(--yellow); color: #2b1b4d; box-shadow: 0 3px 0 #c79a00; }
.answer-dock textarea { min-height: 120px; font-size: 1.08rem; }
.char-row { display: flex; justify-content: space-between; align-items: center; margin: 6px 4px 10px; color: var(--ink-3); font-size: .82rem; font-weight: 700; }
.rec-zone { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 10px 0 4px; }
.rec-btn {
  width: 96px; height: 96px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center;
  background: linear-gradient(180deg, #ff7f8c, var(--red)); color: #fff; box-shadow: 0 7px 0 #a01d32, 0 16px 34px rgba(255, 90, 106, .4);
  transition: transform .1s;
}
.rec-btn .ic { width: 40px; height: 40px; }
.rec-btn:active { transform: translateY(5px); box-shadow: 0 2px 0 #a01d32; }
.rec-btn.recording { animation: rec-pulse 1.2s ease-in-out infinite; }
@keyframes rec-pulse { 0%, 100% { box-shadow: 0 7px 0 #a01d32, 0 0 0 0 rgba(255, 90, 106, .55); } 50% { box-shadow: 0 7px 0 #a01d32, 0 0 0 18px rgba(255, 90, 106, 0); } }
.rec-status { font-weight: 800; color: var(--ink-2); }
.rec-zone audio { width: 100%; }
.draw-wrap { border-radius: 20px; overflow: hidden; background: #fff; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .06); }
.draw-wrap canvas { display: block; width: 100%; height: auto; touch-action: none; cursor: crosshair; }
.draw-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.swatch {
  width: 32px; height: 32px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; padding: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
}
.swatch.on { border-color: var(--yellow); transform: scale(1.12); }
.draw-tools input[type="range"] { flex: 1; min-width: 90px; }
.send-btn { margin-top: 4px; }
.send-btn .ic { width: 21px; height: 21px; }

/* poderes */
.powers-bar { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; margin: 12px -2px 0; scrollbar-width: none; }
.powers-bar::-webkit-scrollbar { display: none; }
.power-chip {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 82px; padding: 9px 6px 8px;
  border-radius: 18px; border: 2px solid var(--glass-b); background: var(--glass); color: var(--ink); cursor: pointer;
  font-family: var(--font-display); transition: transform .12s, background .2s;
}
.power-chip:active:not(:disabled) { transform: scale(.94); }
.power-chip .pi { font-size: 1.45rem; line-height: 1.1; }
.power-chip .pn { font-weight: 600; font-size: .74rem; line-height: 1.1; text-align: center; }
.power-chip .pc { font-weight: 700; font-size: .74rem; color: var(--yellow); }
html[data-ui="day"] .power-chip .pc { color: #b45309; }
.power-chip:disabled { opacity: .4; cursor: not-allowed; }
.power-chip.used { border-color: var(--green); background: rgba(46, 213, 115, .18); opacity: 1; }
.power-sheet-target { margin: 10px 0 4px; }
.hint-box {
  margin: 0 0 12px; padding: 12px 14px; border-radius: 18px; font-weight: 700;
  background: rgba(255, 210, 63, .16); border: 1px solid rgba(255, 210, 63, .45); animation: pop-in .4s var(--ease-pop) both;
}

/* estado esperando / evaluando */
.wait-card {
  text-align: center; padding: 26px 18px; border-radius: var(--r-xl); background: var(--glass); border: 1px solid var(--glass-b);
  animation: pop-in .45s var(--ease-pop) both;
}
.wait-card .big-emoji { font-size: 3.2rem; line-height: 1; display: inline-block; animation: bob 2.2s ease-in-out infinite; }
.wait-card h3 { margin: 12px 0 6px; }
.wait-card p { color: var(--ink-2); margin: 0; }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-6deg); } }
.dots::after { content: ''; animation: dots 1.4s steps(4, end) infinite; }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }

/* cuenta regresiva gigante */
.big-countdown {
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; pointer-events: none;
}
.big-countdown span {
  font-family: var(--font-display); font-weight: 700; font-size: min(42vw, 220px); color: #fff; line-height: 1;
  -webkit-text-stroke: 10px #7c4dff; paint-order: stroke fill; text-shadow: 0 12px 0 rgba(0, 0, 0, .2);
  animation: cd-pop .85s var(--ease-pop) both;
}
@keyframes cd-pop { 0% { transform: scale(.2) rotate(-10deg); opacity: 0; } 45% { transform: scale(1.05); opacity: 1; } 80% { opacity: 1; } 100% { transform: scale(1); opacity: 0; } }

/* overlays de carga existentes (lobby/resultados) */
#game-starting-overlay, #loading-overlay, .evaluation-overlay {
  background: radial-gradient(circle at 50% 40%, rgba(124, 77, 255, .55), rgba(10, 0, 35, .92)) !important;
  font-family: var(--font-display) !important; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.evaluation-overlay { position: fixed; inset: 0; z-index: 75; display: none; align-items: center; justify-content: center; color: #fff; }
.evaluation-content { text-align: center; padding: 24px; max-width: 420px; }
.evaluation-spinner { font-size: 3.4rem; animation: bob 2s ease-in-out infinite; display: inline-block; }
.evaluation-progress { height: 8px; width: 220px; margin: 16px auto 0; border-radius: 999px; background: rgba(255, 255, 255, .2); overflow: hidden; }
.evaluation-progress .progress-bar { height: 100%; width: 40%; animation: indet 1.4s ease-in-out infinite; }
@keyframes indet { 0% { transform: translateX(-110%); } 100% { transform: translateX(260%); } }

/* lobby */
.lobby-hero { text-align: center; margin: 4px 0 16px; }
.lobby-hero h1 { margin: 0; font-size: clamp(1.7rem, 7vw, 2.3rem); }
.lobby-hero .desc { color: var(--ink-2); margin: 4px 0 0; }
.lobby-hero .round-chip { margin-top: 10px; }
.lobby-players { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.lobby-player {
  position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 18px;
  background: var(--glass); border: 2px solid var(--glass-b); animation: pop-in .35s var(--ease-pop) both;
}
.lobby-player .av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font: 700 1.1rem var(--font-display); color: #fff; flex: 0 0 auto; }
.lobby-player .nm { flex: 1; min-width: 0; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lobby-player .sub { display: block; font-size: .76rem; font-weight: 700; color: var(--ink-3); }
.lobby-player.ready { border-color: rgba(46, 213, 115, .75); background: rgba(46, 213, 115, .16); }
.lobby-player.ready .sub { color: var(--green); }
.lobby-player.me { box-shadow: 0 0 0 3px rgba(255, 210, 63, .5); }
.lobby-player .crown { position: absolute; top: -10px; left: 8px; font-size: 1.1rem; transform: rotate(-14deg); }
.lobby-status { text-align: center; color: var(--ink-2); font-weight: 700; margin: 14px 0 0; min-height: 1.5em; }
.lobby-countdown { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 14px 0 0; }
.lobby-countdown .lbl { font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; }
.lobby-actions-dock { margin-top: 14px; display: grid; gap: 10px; }
.share-row { display: flex; gap: 8px; margin-top: 10px; }
.share-row .btn { flex: 1; }

/* votación y adivinanza */
.voting-container { max-width: none; padding: 0; }
.voting-info { background: var(--glass); border-radius: var(--r-lg); padding: 16px; margin-bottom: 14px; color: var(--ink); }
.voting-instructions, .voting-progress { color: var(--ink-2); }
.voting-timer { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 16px; }
.timer-display { font-family: var(--font-display); font-weight: 700; font-size: 1.4rem; color: var(--ink); }
.voting-responses { display: grid; gap: 12px; grid-template-columns: 1fr; margin-bottom: 18px; }
@media (min-width: 640px) { .voting-responses { grid-template-columns: 1fr 1fr; } }
.voting-card {
  position: relative; padding: 16px; border-radius: var(--r-lg); background: var(--glass); border: 2px solid var(--glass-b);
  color: var(--ink); transition: transform .15s, border-color .2s; animation: pop-in .4s var(--ease-pop) both;
}
.voting-card:hover { transform: translateY(-2px); border-color: var(--yellow); box-shadow: none; }
.voting-card.own-response { border-style: dashed; opacity: .8; }
.voting-card.voted, .voting-card.selected { border-color: var(--green); background: rgba(46, 213, 115, .16); }
.voting-card-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.own-response-badge { background: var(--yellow); color: #4a3500; border-radius: 999px; padding: 3px 9px; font-size: .75rem; font-weight: 800; }
.voting-card-content, .response-text { font-size: 1.08rem; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.voting-card-actions { margin-top: 12px; }
.vote-btn {
  width: 100%; min-height: 46px; border: 0; border-radius: 14px; cursor: pointer; font: 600 1rem var(--font-display);
  background: linear-gradient(180deg, #ffe17a, var(--yellow)); color: #3d2a00; box-shadow: 0 4px 0 #c79a00;
}
.vote-btn:hover:not(:disabled) { filter: brightness(1.05); }
.vote-btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #c79a00; }
.vote-btn:disabled { opacity: .5; cursor: not-allowed; }
.cannot-vote { color: var(--ink-3); font-weight: 700; text-align: center; }
.vote-message { padding: 12px; border-radius: var(--r); text-align: center; font-weight: 800; }
.vote-message.success { background: rgba(46, 213, 115, .2); }
.vote-message.error { background: rgba(255, 90, 106, .2); }

/* resultados */
.round-podium {
  text-align: center; margin: 0 0 16px; padding: 22px 16px; border-radius: var(--r-xl);
  background: linear-gradient(160deg, rgba(255, 210, 63, .2), rgba(124, 77, 255, .22)); border: 1px solid var(--glass-b);
}
.podium-title { margin: 0 0 10px; font-size: .85rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.podium-crown { font-size: 3rem; line-height: 1; animation: crown-bounce 1.2s ease .3s both; }
.podium-name { font-family: var(--font-display); font-weight: 700; font-size: 2rem; margin-top: 4px; overflow-wrap: anywhere; }
.podium-points { font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; color: var(--yellow); }
html[data-ui="day"] .podium-points { color: #b45309; }
.podium-answer { margin: 12px auto 0; max-width: 560px; font-size: 1.12rem; font-style: italic; font-weight: 700; overflow-wrap: anywhere; color: var(--ink); }
.podium-image { margin-top: 12px; max-width: min(320px, 100%); border-radius: 16px; background: #fff; }
.podium-rest { list-style: none; padding: 0; margin: 14px auto 0; max-width: 420px; }
.podium-rest li { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-radius: 14px; background: var(--glass); margin-top: 6px; font-weight: 800; }
.podium-rest-name { flex: 1; text-align: left; overflow-wrap: anywhere; }
.podium-me { margin: 14px 0 0; font-size: 1.05rem; font-weight: 700; }
.podium-share { margin-top: 14px; }
.reveal { animation: podium-in .5s var(--ease-pop) var(--d, 0s) both; }
@keyframes podium-in { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes crown-bounce { 0% { transform: scale(0) rotate(-20deg); } 60% { transform: scale(1.25) rotate(8deg); } 100% { transform: scale(1); } }
.results-header-meta { color: var(--ink-3); font-weight: 800; font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; }
.challenge-title { font-family: var(--font-display); font-weight: 600; color: var(--yellow) !important; }
.challenge-text { font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; color: var(--ink) !important; }
.ready-system, .final-round-notice { text-align: center; }
#ready-timer { color: var(--yellow) !important; }
.round-detail { margin-top: 16px; padding: 14px 16px; border-radius: var(--r-lg); background: var(--glass); }
.round-detail > summary { padding: 4px 0; }
.mobile-results-container { display: grid; gap: 10px; margin-top: 12px; }
.mobile-result-card { padding: 14px; }
.mobile-result-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.mobile-player-name { font-family: var(--font-display); font-weight: 600; font-size: 1.08rem; display: block; }
.mobile-total-score { color: var(--ink-3); font-size: .85rem; font-weight: 700; }
.mobile-score { font-family: var(--font-display); font-weight: 700; color: var(--yellow); white-space: nowrap; }
html[data-ui="day"] .mobile-score { color: #b45309; }
.mobile-response { margin-top: 8px; }
.mobile-response-text { font-weight: 700; overflow-wrap: anywhere; }
.mobile-feedback { margin-top: 8px; padding: 10px 12px; border-radius: 14px; background: rgba(0, 0, 0, .18); color: var(--ink-2); font-size: .9rem; }
html[data-ui="day"] .mobile-feedback { background: rgba(124, 77, 255, .08); }
.mobile-feedback-label, .mobile-stars-label, .mobile-aspects-label { font-weight: 800; font-size: .8rem; color: var(--ink-3); margin-bottom: 4px; }
.mobile-stars-earned, .mobile-aspects { margin-top: 8px; }
.aspects-grid, .mobile-aspects-grid { display: grid; grid-template-columns: repeat(4, auto); gap: 4px 10px; justify-content: start; }
.aspect-item, .mobile-aspect-item { display: inline-flex; gap: 3px; align-items: center; font-weight: 800; font-size: .85rem; white-space: nowrap; }
.aspect-rankings-section { margin-top: 18px; }
.rankings-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.ranking-card { padding: 14px; }
.ranking-card h4 { font-size: 1rem; }
.ranking-list { display: grid; gap: 6px; }
.ranking-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--glass); }
.ranking-item.gold { background: rgba(255, 210, 63, .22); }
.ranking-item.silver { background: rgba(220, 220, 240, .18); }
.ranking-item.bronze { background: rgba(255, 159, 26, .18); }
.ranking-position { width: 28px; text-align: center; font-weight: 800; }
.ranking-name { font-weight: 800; }
.ranking-score { color: var(--ink-3); font-size: .85rem; font-weight: 700; }
.host-commentary { border-left: 0 !important; background: linear-gradient(140deg, rgba(255, 210, 63, .18), rgba(255, 79, 163, .14)) !important; border-radius: var(--r-lg) !important; }
.fb-toggle, .answer-toggle, .translate-btn {
  background: var(--glass-2) !important; border: 0 !important; color: var(--ink) !important; border-radius: 999px; padding: 1px 8px; font-size: .78rem; cursor: pointer;
}

/* desde el detalle de resultados en escritorio */
@media (max-width: 767px) { .results-table { display: none; } }
@media (min-width: 768px) { .mobile-results-container { display: none; } }

/* ---------- modo inmersivo (pantallas de juego) ---------- */
body.immersive .appbar { background: transparent; border-bottom-color: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
body.immersive .guest-strip { display: none; }

/* ---------- landing / bienvenida ---------- */
.welcome {
  min-height: calc(100dvh - var(--appbar-h) - var(--safe-top) - 40px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px;
}
.welcome-logo {
  font-family: var(--font-display); font-weight: 700; font-size: clamp(2.8rem, 13vw, 4.2rem); line-height: 1;
  display: flex; align-items: center; gap: 12px; justify-content: center; text-shadow: 0 6px 0 rgba(0, 0, 0, .18);
}
.welcome-logo .mark { display: inline-block; animation: bob 2.4s ease-in-out infinite; }
.welcome-logo .word { background: linear-gradient(90deg, var(--yellow), var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; }
html[data-ui="day"] .welcome-logo .word { background: linear-gradient(90deg, #7c3aed, #db2777); -webkit-background-clip: text; background-clip: text; }
.welcome .tagline { font-size: 1.12rem; color: var(--ink-2); max-width: 440px; margin: 8px auto 18px; font-weight: 700; }
.welcome-card { width: min(440px, 100%); padding: 22px 18px; }
.welcome-card form { display: grid; gap: 12px; }
.welcome-card input { text-align: center; font-size: 1.25rem; font-weight: 800; min-height: 56px; }
.welcome-links { display: flex; gap: 10px; margin-top: 14px; }
.welcome-links .btn { flex: 1; }
.welcome-note { color: var(--ink-3); font-size: .88rem; font-weight: 700; margin: 10px 0 0; }
.swipe-cards {
  display: grid; grid-auto-flow: column; grid-auto-columns: min(78%, 300px); gap: 12px; overflow-x: auto;
  scroll-snap-type: x mandatory; padding: 4px 16px 14px; margin: 0 -16px; scrollbar-width: none;
}
.swipe-cards::-webkit-scrollbar { display: none; }
.swipe-cards > * { scroll-snap-align: center; }
.how-card { padding: 18px; border-radius: var(--r-lg); background: var(--glass); border: 1px solid var(--glass-b); text-align: left; }
.how-card .num {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 10px;
  font: 700 1.2rem var(--font-display); background: var(--yellow); color: #3a2800;
}
.how-card h3 { font-size: 1.08rem; margin-bottom: 6px; }
.how-card p { color: var(--ink-2); font-size: .93rem; margin: 0; }
.section-title { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; margin: 26px 2px 12px; }
.faq details { padding: 14px 16px; border-radius: var(--r); background: var(--glass); margin-bottom: 8px; }
.faq details p { margin: 10px 0 0; color: var(--ink-2); }
.scroll-hint { margin-top: 18px; color: var(--ink-3); font-weight: 800; font-size: .85rem; animation: bob 2.4s ease-in-out infinite; }

/* ---------- utilidades ---------- */
.stack { display: grid; gap: 10px; }
.row-gap { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.center { display: flex; align-items: center; justify-content: center; }
.empty-state { text-align: center; padding: 30px 16px; color: var(--ink-2); }
.empty-state .big-emoji { font-size: 3rem; display: block; margin-bottom: 8px; }

/* ---------- transiciones entre pantallas ---------- */
@view-transition { navigation: auto; }
::view-transition-old(page) { animation: vt-out .16s ease-in both; }
::view-transition-new(page) { animation: vt-in .3s var(--ease-out) both; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .2s; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-8px) scale(.99); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(14px); } }

@media (min-width: 900px) {
  .app-main { padding-top: 26px; }
  .appbar { padding-left: max(24px, calc((100vw - 1040px) / 2)); padding-right: max(24px, calc((100vw - 1040px) / 2)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .app-bg .blob, .app-bg .bubbles { display: none; }
}

/* ---------- ajustes de piezas existentes ---------- */
.room-list li.room-card { display: block; padding: 16px; }
.room-list { display: block; }
.pwa-install-banner {
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 20px) !important; border-radius: 22px !important;
  background: var(--solid) !important; color: var(--ink) !important; border: 1px solid var(--glass-b) !important;
  font-family: var(--font-body) !important; box-shadow: var(--shadow) !important; z-index: 60 !important;
}
body.immersive .pwa-install-banner, body:not(:has(.tabbar)) .pwa-install-banner { bottom: calc(var(--safe-bottom) + 14px) !important; }
.pwa-install-text strong { font-family: var(--font-display); font-weight: 600; font-size: 1rem; }
.pwa-install-text span { color: var(--ink-3) !important; }
.preset-card { border-color: var(--glass-b) !important; background: var(--glass) !important; border-radius: 20px !important; }
.preset-card strong { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; }
.preset-card.active { border-color: var(--yellow) !important; background: rgba(255, 210, 63, .14) !important; box-shadow: 0 0 0 4px rgba(255, 210, 63, .14); }
html[data-ui="day"] .preset-card.active { border-color: #8b5cf6 !important; background: rgba(139, 92, 246, .1) !important; }
.preset-picker legend { font-family: var(--font-display); font-weight: 600; color: var(--ink); }
.advanced-options { margin-top: 8px; padding: 12px 14px; border-radius: var(--r); background: rgba(0, 0, 0, .12); }
html[data-ui="day"] .advanced-options { background: rgba(124, 77, 255, .06); }
.advanced-options[open] > summary { margin-bottom: 12px; }
.choice-media { display: flex; align-items: center; gap: 10px; }
img.choice-icon { width: 38px; height: 38px; flex: 0 0 auto; padding: 6px; border-radius: 12px; background: #fff; }
.form-section { background: rgba(0, 0, 0, .1); box-shadow: none; }
html[data-ui="day"] .form-section { background: rgba(124, 77, 255, .05); }
body.immersive .appbar-brand .wordmark { display: none; }
body.immersive .appbar-title { text-align: left; font-size: 1.12rem; }
.final-hero { text-align: center; background: linear-gradient(150deg, rgba(255, 210, 63, .28), rgba(255, 79, 163, .22) 55%, rgba(124, 77, 255, .3)) !important; }
.final-hero h1 { font-size: clamp(2rem, 9vw, 3rem); }
.final-hero .lead { color: var(--ink-2); font-weight: 700; }
.final-hero .d-flex { gap: 10px; }
.final-hero .d-flex .btn { flex: 1 1 200px; }
.winner-badge .badge { font-size: 1.3rem !important; padding: 12px 18px !important; border-radius: 16px !important; }
.rematch-banner { background: rgba(46, 213, 115, .18) !important; border-color: rgba(46, 213, 115, .5) !important; }
.conn-banner { visibility: hidden; }
.conn-banner.show { visibility: visible; }
.modal-body, .modal-title { color: var(--ink); }
/* hojas cerradas: fuera de pantalla e inalcanzables (teclado/lector) */
.sheet { visibility: hidden; transition: transform .34s var(--ease-out), visibility 0s linear .34s; }
.sheet-open .app-sheet, .sheet.open { visibility: visible; transform: translate(-50%, 0); transition: transform .34s var(--ease-out); }
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.tab.tab-fab { color: var(--ink-3); }
.tab.tab-fab.active { color: var(--ink); }
.welcome-logo img.mark { width: clamp(58px, 16vw, 78px); height: auto; border-radius: 24%; box-shadow: 0 10px 0 rgba(0, 0, 0, .18), 0 18px 40px rgba(0, 0, 0, .3); }
.final-hero .d-flex { display: grid !important; grid-template-columns: 1fr; gap: 10px; max-width: 460px; margin: 0 auto; }
.final-hero .d-flex .btn { flex: none; width: 100%; min-height: 50px; margin: 0 !important; }
@media (min-width: 640px) { .final-hero .d-flex { grid-template-columns: 1fr 1fr; max-width: 620px; } }
.room-card h3 { overflow-wrap: anywhere; }
.room-card .room-privacy-info, .room-card .room-age-info { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0; }
.access-link-container { display: flex; gap: 8px; margin-top: 6px; }
.access-link-input { flex: 1; min-width: 0; font-size: .85rem !important; }
/* perfil: contador grande sin desbordar */
.user-stars[style*="1.5em"] { font-size: clamp(1.05rem, 5vw, 1.5em) !important; flex-wrap: wrap; text-align: center; }
/* filas/encabezados con color de Bootstrap: sobre vidrio, en tonos translúcidos */
.thead-light th, .table thead.thead-light th { background: transparent !important; color: var(--ink-3) !important; border-color: var(--glass-b) !important; }
.table-warning, .table-warning > td, .table-warning > th { background: rgba(255, 210, 63, .18) !important; color: var(--ink) !important; }
.table-light, .table-light > td, .table-light > th { background: rgba(255, 255, 255, .08) !important; color: var(--ink) !important; }
.table-secondary, .table-secondary > td, .table-secondary > th { background: rgba(255, 159, 26, .12) !important; color: var(--ink) !important; }
.card-header.bg-white { background: transparent !important; }
.shadow-sm, .shadow-lg, .shadow { box-shadow: var(--shadow-sm) !important; }
