/* ============================================================
   HOTBOX — Phase 3 lobby UI (create + realtime poker table)
   Psychedelic Speakeasy aesthetic — see docs/DESIGN.md
   Extends main.css; reuses --tokens, .card, .btn, .chip, .field.
   ============================================================ */

/* ░░ CREATE TABLE ░░ ------------------------------------------------------- */

.card--create { text-align: left; }

.create-field,
.create-block { margin: 0 0 1.3rem; }

.create-field__label {
  display: block;
  margin: 0 0 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.input--text,
.input--num { font-family: var(--font-body); }
.input--num { font-family: var(--font-mono); text-align: center; }
.field--num { max-width: 7.5rem; }

/* Mode picker cards */
.mode-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem;
}
.mode-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-align: left;
  padding: 1rem 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid rgba(169, 159, 194, 0.2);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--ink-dim);
  transition: transform 0.14s ease, box-shadow 0.18s ease,
              border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}
.mode-card:hover {
  transform: translateY(-2px);
  border-color: rgba(182, 255, 60, 0.4);
  color: var(--ink);
  box-shadow: 0 0 22px rgba(182, 255, 60, 0.14);
}
.mode-card:active { transform: scale(0.98); }
.mode-card--on {
  border-color: var(--acid);
  color: var(--ink);
  background: linear-gradient(180deg, rgba(182, 255, 60, 0.12), rgba(182, 255, 60, 0.03));
  box-shadow: 0 0 28px rgba(182, 255, 60, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.mode-card__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ink);
}
.mode-card--on .mode-card__name {
  color: var(--acid);
  text-shadow: 0 0 16px rgba(182, 255, 60, 0.5);
}
.mode-card__tag { font-size: 0.78rem; line-height: 1.35; }

/* Settings grid */
.settings-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.6rem;
  padding: 1rem 1.2rem;
  background: var(--surface-2);
  border: 1px solid rgba(182, 255, 60, 0.12);
  border-radius: var(--radius);
}
.setting-inline {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.setting-inline__label {
  font-size: 0.85rem;
  color: var(--ink-dim);
  white-space: nowrap;
}
.field--inline { margin: 0; }
.field--inline .input { padding-block: 0.6rem; }

/* Toggle switch */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  user-select: none;
}
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle__track {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: rgba(10, 7, 16, 0.7);
  border: 1px solid rgba(169, 159, 194, 0.3);
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  flex: 0 0 auto;
}
.toggle__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ink-dim);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease;
}
.toggle input:checked + .toggle__track {
  background: linear-gradient(180deg, var(--acid), var(--acid-soft));
  border-color: var(--acid);
  box-shadow: 0 0 18px rgba(182, 255, 60, 0.45);
}
.toggle input:checked + .toggle__track .toggle__thumb {
  transform: translateX(20px);
  background: var(--bg-void);
}
.toggle input:focus-visible + .toggle__track {
  box-shadow: 0 0 0 3px rgba(182, 255, 60, 0.3);
}
.toggle__text { font-size: 0.9rem; color: var(--ink); }

.create-packs { min-height: 2.4rem; }
.create-packs__empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-faint);
}

.create-actions {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.8rem;
  margin-top: 0.4rem;
}

/* ░░ LOBBY ROOM ░░ -------------------------------------------------------- */

.card--lobby { text-align: left; }

.lobby-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}
.lobby-head__meta { display: flex; flex-direction: column; gap: 0.45rem; }
.lobby-title { margin: 0; }
.lobby-mode-pill {
  align-self: flex-start;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--acid);
  padding: 0.3rem 0.7rem;
  border: 1px solid rgba(182, 255, 60, 0.35);
  border-radius: 999px;
  background: rgba(182, 255, 60, 0.06);
}

/* Tap-to-copy code chip */
.lobby-code {
  display: grid;
  justify-items: end;
  gap: 0.1rem;
  padding: 0.6rem 1rem;
  background: var(--surface-2);
  border: 1px solid rgba(182, 255, 60, 0.22);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}
.lobby-code:hover {
  transform: translateY(-2px);
  border-color: rgba(182, 255, 60, 0.5);
  box-shadow: 0 0 24px rgba(182, 255, 60, 0.22);
}
.lobby-code:active { transform: scale(0.98); }
.lobby-code__label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.lobby-code__value {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  color: var(--acid);
  text-shadow: 0 0 18px rgba(182, 255, 60, 0.45);
  line-height: 1;
}
.lobby-code__hint {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  transition: color 0.2s ease;
}
.lobby-code--copied { border-color: var(--acid); box-shadow: 0 0 30px rgba(182, 255, 60, 0.4); }
.lobby-code--copied .lobby-code__hint { color: var(--acid); }
.lobby-code--copied .lobby-code__hint::after { content: " — copied!"; }

/* The oval table */
.lobby-table-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 11;
  max-height: 460px;
  margin: 1.2rem auto 0.4rem;
}
.lobby-felt {
  position: absolute;
  inset: 12% 9%;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 50% 38%, rgba(61, 255, 176, 0.10), transparent 60%),
    radial-gradient(ellipse at center, #0c1f16 0%, #07140d 60%, #050a08 100%);
  border: 2px solid rgba(182, 255, 60, 0.18);
  box-shadow:
    inset 0 0 60px rgba(0, 0, 0, 0.6),
    inset 0 0 0 8px rgba(182, 255, 60, 0.04),
    0 0 50px rgba(182, 255, 60, 0.1);
  display: grid;
  place-items: center;
}
.lobby-felt__ring {
  position: absolute;
  inset: 9%;
  border-radius: 50%;
  border: 1px dashed rgba(182, 255, 60, 0.16);
}
.lobby-felt__brand {
  font-size: clamp(1.1rem, 4vw, 1.8rem);
  font-weight: 700;
  letter-spacing: 0.4em;
  color: rgba(182, 255, 60, 0.14);
  text-shadow: 0 0 26px rgba(182, 255, 60, 0.12);
  pointer-events: none;
}

/* Seats positioned around the oval */
.lobby-table {
  position: absolute;
  inset: 0;
}
.seat {
  position: absolute;
  width: 26%;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
}
/* 6 anchor points around the oval (top-mid, top-right, bottom-right, bottom-mid, bottom-left, top-left) */
.seat[data-seat="0"] { left: 50%; top: 4%; }
.seat[data-seat="1"] { left: 92%; top: 33%; }
.seat[data-seat="2"] { left: 92%; top: 73%; }
.seat[data-seat="3"] { left: 50%; top: 98%; }
.seat[data-seat="4"] { left: 8%;  top: 73%; }
.seat[data-seat="5"] { left: 8%;  top: 33%; }

.seat__inner {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.3rem;
  width: 100%;
}

/* Host-only kick control — a small "×" pinned to the top-right of the pod. */
.seat__kick {
  position: absolute;
  top: -6px;
  right: 14%;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(255, 92, 122, 0.55);
  background: rgba(10, 7, 16, 0.92);
  color: var(--danger);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 0 14px rgba(255, 92, 122, 0.35);
  transition: transform 0.12s ease, box-shadow 0.16s ease, background 0.16s ease;
}
.seat__kick[hidden] { display: none; }
.seat__kick:hover {
  transform: scale(1.12);
  background: rgba(255, 92, 122, 0.18);
  box-shadow: 0 0 20px rgba(255, 92, 122, 0.6);
}
.seat__kick:active { transform: scale(0.92); }
.seat__kick:disabled { opacity: 0.5; cursor: default; }
.seat__bud {
  width: min(86px, 18vw);
  height: min(86px, 18vw);
  display: grid;
  place-items: center;
}

/* Empty seat = dashed "open" slot */
.seat--empty .seat__inner::before {
  content: "open";
  display: grid;
  place-items: center;
  width: min(72px, 16vw);
  height: min(72px, 16vw);
  border-radius: 50%;
  border: 2px dashed rgba(169, 159, 194, 0.35);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: rgba(10, 7, 16, 0.35);
}
.seat--empty .seat__bud,
.seat--empty .seat__name { display: none; }

.seat--filled .seat__bud {
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.5));
  animation: seatBob 5s ease-in-out infinite;
}
.seat--me .seat__bud { filter: drop-shadow(0 0 18px rgba(182, 255, 60, 0.5)); }
@keyframes seatBob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-5px); }
}

.seat__name {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  max-width: 110%;
}
.seat__handle {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--ink);
  background: rgba(10, 7, 16, 0.6);
  border: 1px solid rgba(182, 255, 60, 0.18);
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.seat--me .seat__handle { border-color: var(--acid); color: var(--acid); }
.seat__crown {
  color: var(--rarity-legendary);
  font-size: 0.95rem;
  line-height: 1;
  text-shadow: 0 0 12px rgba(255, 200, 61, 0.7);
}

/* Footer controls */
.lobby-foot {
  display: grid;
  gap: 0.7rem;
  margin-top: 0.6rem;
}
.lobby-host-controls {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.7rem;
}
.lobby-host-controls.hidden,
.lobby-guest-wait.hidden { display: none; }

.lobby-guest-wait {
  text-align: center;
  padding: 0.9rem;
  background: var(--surface-2);
  border: 1px solid rgba(169, 159, 194, 0.2);
  border-radius: var(--radius);
}
.shimmer {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  background: linear-gradient(100deg,
    var(--ink-dim) 30%, var(--acid) 50%, var(--ink-dim) 70%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: shimmerSlide 2.4s linear infinite;
}
@keyframes shimmerSlide {
  0%   { background-position: 200% center; }
  100% { background-position: -200% center; }
}

.btn--leave {
  justify-self: center;
  color: var(--danger);
  border-color: rgba(255, 92, 122, 0.35);
}
.btn--leave:hover {
  color: var(--danger);
  border-color: rgba(255, 92, 122, 0.6);
  box-shadow: 0 0 20px rgba(255, 92, 122, 0.22);
}

/* ░░ Responsive ░░ -------------------------------------------------------- */
@media (max-width: 600px) {
  .mode-cards { grid-template-columns: 1fr; }
  .create-actions { grid-template-columns: 1fr; }
  .lobby-host-controls { grid-template-columns: 1fr; }
  .lobby-table-wrap { aspect-ratio: 1 / 1; }
  .seat { width: 30%; }
}

@media (prefers-reduced-motion: reduce) {
  .seat--filled .seat__bud,
  .shimmer { animation: none; }
  .shimmer {
    -webkit-text-fill-color: var(--ink-dim);
    color: var(--ink-dim);
    background: none;
  }
}
