/* ============================================================
   Dominó Online — salas, sala previa, frases rápidas y avisos.
   Usa las variables definidas en style.css.
   ============================================================ */

.menu-card--wide {
  width: min(560px, 100%);
  max-height: calc(100vh - 32px);
  overflow-x: hidden;
  overflow-y: auto;
  text-align: left;
}

.menu-card--wide .menu-title {
  text-align: center;
}

.panel {
  padding: 14px 14px 12px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.panel__hint {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text-dim);
}

.rooms-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.rooms-grid .panel {
  min-width: 0;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.check input {
  accent-color: #2fa36e;
  width: 16px;
  height: 16px;
}

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

.code-row input {
  flex: 1;
  width: 100%;
  min-width: 0;
  font: inherit;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.3em;
  text-align: center;
  text-transform: uppercase;
  padding: 8px 6px 8px 14px;
  border-radius: 12px;
  border: 1px solid var(--hairline);
  background: rgba(0, 0, 0, 0.3);
  color: var(--gold);
  outline: none;
}

.code-row input:focus {
  border-color: rgba(242, 201, 119, 0.55);
  box-shadow: 0 0 0 3px rgba(242, 201, 119, 0.12);
}

.code-row .btn {
  padding: 8px 16px;
}

.room-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 150px;
  overflow-y: auto;
}

.room-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--hairline);
  font-size: 13.5px;
}

.room-list li.is-empty {
  color: var(--text-dim);
  border-style: dashed;
  background: transparent;
  justify-content: center;
}

.room-list__host {
  flex: 1;
  font-weight: 600;
}

.room-list__meta {
  font-size: 12px;
  color: var(--text-dim);
}

.form-error {
  margin: 0;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
  text-align: center;
  color: #ffd6cf;
  background: rgba(214, 96, 77, 0.18);
  border: 1px solid rgba(214, 96, 77, 0.4);
}

.form-error.is-info {
  color: #f6e6bd;
  background: rgba(242, 201, 119, 0.12);
  border-color: rgba(242, 201, 119, 0.35);
}

.btn:disabled {
  opacity: 0.6;
  cursor: default;
  transform: none;
  filter: none;
}

/* ---- sala previa ---- */
.room-eyebrow {
  margin: 0;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.room-code {
  display: block;
  width: 100%;
  margin: 0;
  border: 0;
  background-color: transparent;
  font: inherit;
  text-align: center;
  font-size: 58px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.16em;
  padding-left: 0.16em;
  cursor: pointer;
  background-image: linear-gradient(180deg, #fff, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

#btn-copy-link {
  align-self: center;
}

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

.team {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.team h4 {
  margin: 0 0 2px;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.vs {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.seatcard {
  font: inherit;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  border-radius: 14px;
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.06);
  min-height: 66px;
  justify-content: center;
  transition: transform 0.15s, background 0.15s, border-color 0.15s;
}

.seatcard.is-free {
  border-style: dashed;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
}

.seatcard.is-free:hover {
  border-color: rgba(242, 201, 119, 0.6);
  color: var(--text);
  transform: translateY(-2px);
}

.seatcard.is-taken {
  cursor: default;
}

.seatcard.is-me {
  border-color: rgba(242, 201, 119, 0.7);
  background: rgba(242, 201, 119, 0.1);
}

.seatcard.is-partner {
  border-color: rgba(122, 214, 165, 0.6);
  background: rgba(47, 163, 110, 0.14);
}

.seatcard__name {
  font-weight: 600;
  font-size: 15px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seatcard__tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
}

.seatcard__tags i {
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-dim);
}

.seatcard__tags i.tag-host {
  background: rgba(242, 201, 119, 0.2);
  color: var(--gold);
}

.room-config {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---- frases rápidas ---- */
.bubbles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}

.bubble {
  position: absolute;
  padding: 7px 13px;
  border-radius: 14px 14px 14px 4px;
  background: #fffdf6;
  color: #14161c;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
  animation: bubbleIn 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  transition: opacity 0.5s, transform 0.5s;
}

.bubble.is-out {
  opacity: 0;
  transform: translateY(-6px);
}

.bubble--top {
  top: 48px;
  left: 50%;
  margin-left: 60px;
}

.bubble--left {
  left: 12px;
  top: 32%;
}

.bubble--right {
  right: 12px;
  top: 32%;
  border-radius: 14px 14px 4px 14px;
}

.bubble--bottom {
  bottom: 46px;
  left: 50%;
  margin-left: -60px;
}

@keyframes bubbleIn {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
}

.emote-panel {
  position: absolute;
  right: 12px;
  top: 8px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  border-radius: 14px;
  background: rgba(9, 24, 19, 0.94);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-lg);
}

.emote-panel button {
  font: inherit;
  font-size: 13px;
  text-align: left;
  padding: 7px 12px;
  border-radius: 9px;
  border: 0;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
}

.emote-panel button:hover {
  background: rgba(242, 201, 119, 0.22);
}

/* ---- aviso flotante ---- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 120;
  max-width: min(440px, calc(100vw - 32px));
  padding: 11px 18px;
  border-radius: 12px;
  background: rgba(9, 24, 19, 0.96);
  border: 1px solid rgba(242, 201, 119, 0.4);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  text-align: center;
}

/* ---- se cortó la conexión: aviso persistente, no se autooculta ---- */
.conn-banner {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border-radius: 12px;
  background: rgba(43, 18, 12, 0.96);
  border: 1px solid rgba(229, 107, 111, 0.5);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  color: #ffd6cf;
  max-width: min(460px, calc(100vw - 32px));
}

.conn-banner .link-btn {
  color: #ffd6cf;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .rooms-grid {
    grid-template-columns: 1fr;
  }
  .room-code {
    font-size: 46px;
  }
  .teams {
    grid-template-columns: 1fr;
  }
  .vs {
    text-align: center;
  }
}

.screen--rooms,
.screen--room {
  align-items: center;
  justify-content: center;
  padding: 16px;
}

/* ============================ CHAT ============================ */
/* Compartido entre la sala de espera (siempre visible, dentro de la tarjeta)
   y la mesa de juego (panel deslizable, abierto/cerrado con btn-chat). */

.chat-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-radius: 14px;
  border: 1px solid var(--hairline);
  background: rgba(0, 0, 0, 0.22);
  padding: 10px;
}

.chat-box__list {
  list-style: none;
  margin: 0;
  padding: 0 2px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 130px;
  overflow-y: auto;
}

.chat-box__list:empty::after {
  content: 'Nadie ha escrito nada todavía.';
  color: var(--text-dim);
  font-size: 12.5px;
  font-style: italic;
}

.chat-box__row {
  font-size: 13px;
  line-height: 1.4;
  word-break: break-word;
}

.chat-box__row b {
  color: var(--gold-light);
  font-weight: 600;
  margin-right: 5px;
}

.chat-box__row.is-me b {
  color: var(--success);
}

.chat-box__form {
  display: flex;
  gap: 8px;
}

.chat-box__form input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 13.5px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--hairline);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
  outline: none;
}

.chat-box__form input:focus {
  border-color: rgba(242, 201, 119, 0.55);
  box-shadow: 0 0 0 3px rgba(242, 201, 119, 0.12);
}

.chat-box__form .btn {
  padding: 8px 16px;
  font-size: 13px;
}

/* ---- panel de la mesa (se superpone al tablero, no ocupa sitio fijo) ---- */

.chat-panel {
  position: absolute;
  top: 54px;
  right: 12px;
  z-index: 65;
  width: min(280px, calc(100% - 24px));
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: 14px;
  background: rgba(9, 24, 19, 0.96);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-lg);
}

.chat-panel .chat-box__list {
  max-height: 220px;
}

.chat-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.chat-panel__head button {
  border: 0;
  background: none;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 4px;
}

.chat-panel__head button:hover {
  color: var(--text);
}

/* aviso discreto de mensaje sin leer en el botón de chat cerrado */
.icon-btn.has-unread {
  position: relative;
}

.icon-btn.has-unread::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 2px rgba(9, 24, 19, 0.9);
}

@media (max-width: 620px) {
  .chat-panel {
    top: auto;
    bottom: 8px;
    left: 8px;
    right: 8px;
    width: auto;
  }
}
