/* lobby.css — the deck codex, staged.
 *
 * A character-select stage, not a wall of blocks: a large hero signature
 * card (full face + foil + A/H pill) with the deck's details beside it, a
 * compact codex rail of 17 tabs at the bottom, and a living atmosphere —
 * the card-back artwork drifting behind a vignette, rising embers, and a
 * breathing glow that re-tints to the selected deck's colors.
 *
 * Theming: JS stamps --lobby-a/--lobby-b (the deck's color accents) plus
 * soft rgba variants on #lobby; the halo, glow, eyebrow and Begin button
 * all read them, so switching decks visibly re-themes the screen.
 *
 * Retired (never regress): the old grid of 17 identical 232px blocks and
 * the `.lobby__sig` in-page thumbnail. The hero is a HERO-SCALE showcase
 * (close-up scale, full face), not a thumbnail covering a block.
 */

#lobby {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  align-items: center;
  padding: 28px 44px 14px;
  overflow: hidden;
  background:
    radial-gradient(ellipse 90% 60% at 50% -10%, #332b1d 0%, rgba(28, 23, 16, 0) 62%),
    linear-gradient(180deg, #1d1811 0%, #120e09 55%, #0a0805 100%);
  color: #e8d9b0;
  isolation: isolate;
}

/* ---------------- atmosphere ---------------- */

.lobby__backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.lobby__art {
  position: absolute;
  inset: -6%;
  background: url('../data/art/card-back.jpg') center / cover no-repeat;
  opacity: 0.13;
  transform: scale(1.05);
  animation: lobby-drift 90s ease-in-out infinite alternate;
  will-change: transform;
}
@keyframes lobby-drift {
  from { transform: scale(1.05) translate3d(-1.5%, -1%, 0); }
  to   { transform: scale(1.12) translate3d(1.5%, 1%, 0); }
}
.lobby__backdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 72% 56% at 50% 42%, rgba(0, 0, 0, 0) 0%, rgba(6, 4, 2, 0.58) 100%),
    linear-gradient(180deg, rgba(8, 6, 3, 0.5) 0%, rgba(8, 6, 3, 0) 24%,
      rgba(8, 6, 3, 0) 68%, rgba(6, 4, 2, 0.78) 100%);
}
.lobby__glow {
  position: absolute;
  left: 50%;
  top: 40%;
  width: 920px;
  height: 720px;
  transform: translate(-50%, -50%);
  background:
    radial-gradient(ellipse 46% 46% at 42% 46%, var(--lobby-a-soft, rgba(232, 201, 106, 0.2)) 0%, transparent 70%),
    radial-gradient(ellipse 46% 46% at 60% 58%, var(--lobby-b-soft, rgba(138, 184, 230, 0.16)) 0%, transparent 72%);
  animation: lobby-breathe 6s ease-in-out infinite;
}
@keyframes lobby-breathe {
  0%, 100% { opacity: 0.72; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.07); }
}
.lobby__embers { position: absolute; inset: 0; }
.lobby__ember {
  position: absolute;
  bottom: -10px;
  left: var(--ex, 50%);
  width: var(--es, 4px);
  height: var(--es, 4px);
  border-radius: 50%;
  background: radial-gradient(circle, #ffe6ac 0%, var(--lobby-a, #e8c96a) 55%, transparent 100%);
  opacity: 0;
  animation: lobby-ember var(--ed, 12s) linear infinite;
  animation-delay: var(--edelay, 0s);
}
@keyframes lobby-ember {
  0% { opacity: 0; transform: translate3d(0, 0, 0) scale(0.6); }
  12% { opacity: 0.55; }
  60% { opacity: 0.28; }
  100% { opacity: 0; transform: translate3d(var(--edx, 0px), -74vh, 0) scale(1.1); }
}

/* ---------------- header ---------------- */

.lobby__back {
  position: absolute;
  top: clamp(14px, 2.6vh, 28px);
  left: clamp(18px, 2.6vw, 38px);
  z-index: 2;
  font-family: 'Radley', Georgia, serif;
  font-size: 16px;
  letter-spacing: 0.03em;
  color: #d9c48a;
  padding: 9px 18px;
  border: 1px solid rgba(201, 168, 106, 0.38);
  border-radius: 10px;
  cursor: pointer;
  background: rgba(30, 24, 14, 0.5);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.lobby__back:hover {
  border-color: rgba(232, 217, 176, 0.75);
  background: rgba(52, 42, 26, 0.6);
  transform: translateY(-1px);
}
.lobby__back:focus-visible { outline: 2px solid #f4e9c9; outline-offset: 3px; }

.lobby__header {
  position: relative;
  z-index: 1;
  text-align: center;
  padding-top: 4px;
}
.lobby__eyebrow {
  margin-bottom: 6px;
  font-family: Verdana, sans-serif;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--lobby-a, #e8c96a);
  opacity: 0.8;
  text-shadow: 0 0 12px var(--lobby-glow, transparent);
}
.lobby__title {
  font-family: 'Radley', Georgia, 'Times New Roman', serif;
  font-weight: 400;
  font-size: 46px;
  line-height: 1;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  background: linear-gradient(180deg, #fdf6da 0%, #e6cd8e 44%, #b8924c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.75));
  user-select: none;
}
.lobby__rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 360px;
  max-width: 70vw;
  margin: 14px auto 0;
}
.lobby__rule::before,
.lobby__rule::after {
  content: '';
  flex: 1;
  height: 1px;
}
.lobby__rule::before { background: linear-gradient(90deg, transparent, rgba(201, 168, 106, 0.55)); }
.lobby__rule::after { background: linear-gradient(90deg, rgba(201, 168, 106, 0.55), transparent); }
.lobby__rule i {
  width: 7px;
  height: 7px;
  transform: rotate(45deg);
  background: linear-gradient(135deg, #f0dda6, #a8823e);
  box-shadow: 0 0 8px rgba(232, 201, 106, 0.5);
}
.lobby__sub {
  margin-top: 12px;
  font-family: 'EB Garamond', Georgia, serif;
  font-style: italic;
  font-size: 16px;
  color: #a89a76;
  letter-spacing: 0.02em;
}

/* ---------------- hero stage ---------------- */

.lobby__stage {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(28px, 5vw, 84px);
  min-height: 0;
  padding: 8px 0;
}
.lobby__hero {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lobby__hero-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lobby__hero-card .card {
  width: 316px;
  height: 442px;
  pointer-events: none;
}
.lobby__halo {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 560px;
  height: 560px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, var(--lobby-glow, rgba(232, 201, 106, 0.3)) 0%, transparent 62%);
  animation: lobby-halo 5.5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes lobby-halo {
  0%, 100% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.95; transform: translate(-50%, -50%) scale(1.06); }
}
.lobby__card--reveal { animation: lobby-card-in 0.5s cubic-bezier(0.2, 0.8, 0.3, 1); }
@keyframes lobby-card-in {
  from { opacity: 0; transform: translateY(16px) scale(0.965); filter: brightness(1.7); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: brightness(1); }
}

/* ---------------- deck details ---------------- */

.lobby__details {
  position: relative;
  flex: 0 1 400px;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}
.lobby__eyebrow {
  font-family: Verdana, sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--lobby-a, #e8c96a);
  opacity: 0.85;
  text-shadow: 0 0 12px var(--lobby-glow, transparent);
}
.lobby__deck-name {
  font-family: 'Radley', Georgia, serif;
  font-weight: 400;
  font-size: 40px;
  line-height: 1.05;
  color: #f4e9c9;
  text-shadow: 0 3px 18px rgba(0, 0, 0, 0.8);
}
.lobby__colors { display: flex; gap: 8px; }
.lobby__pip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font: bold 12px Verdana, sans-serif;
  color: #26180a;
  box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.5);
}
.lobby__pip--W { background: radial-gradient(circle at 35% 30%, #fdf3d0, #d9c48a 70%); }
.lobby__pip--P { background: radial-gradient(circle at 35% 30%, #dcc6f4, #a678d8 70%); color: #241033; }
.lobby__pip--B { background: radial-gradient(circle at 35% 30%, #6d6d78, #2c2c34 70%); color: #d8d8e2; }
.lobby__pip--R { background: radial-gradient(circle at 35% 30%, #ffb27d, #d95a2b 70%); color: #3a1405; }
.lobby__pip--G { background: radial-gradient(circle at 35% 30%, #b8e889, #5f9c3c 70%); color: #17300a; }
.lobby__arch {
  font-family: 'EB Garamond', Georgia, serif;
  font-style: italic;
  font-size: 18px;
  line-height: 1.5;
  color: #c6b58c;
}
.lobby__champion {
  font-family: Verdana, sans-serif;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #9a8a64;
}
.lobby__stats { display: flex; gap: 26px; margin-top: 4px; }
.lobby__stat { display: flex; flex-direction: column; gap: 2px; }
.lobby__stat b {
  font-family: 'Radley', Georgia, serif;
  font-weight: 400;
  font-size: 24px;
  line-height: 1;
  color: #efe3c0;
}
.lobby__stat i {
  font-style: normal;
  font-family: Verdana, sans-serif;
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #8d7f5d;
}
.lobby__bar { margin-top: 12px; }
.lobby__begin {
  font-family: 'Radley', Georgia, serif;
  font-size: 21px;
  letter-spacing: 0.06em;
  white-space: nowrap;
  color: #241705;
  padding: 14px 42px;
  border: 1px solid rgba(255, 240, 200, 0.55);
  border-radius: 12px;
  cursor: pointer;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0) 46%),
    linear-gradient(180deg, var(--lobby-a, #e8d9b0), var(--lobby-b, #c9ab6e));
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.55),
    0 0 22px var(--lobby-glow, rgba(232, 201, 106, 0.25)),
    inset 0 1px 0 rgba(255, 244, 214, 0.8);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.lobby__begin:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.06);
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.6),
    0 0 30px var(--lobby-glow, rgba(232, 201, 106, 0.4)),
    inset 0 1px 0 rgba(255, 244, 214, 0.9);
}
.lobby__begin:active:not(:disabled) { transform: translateY(0); }
.lobby__begin:disabled {
  opacity: 0.38;
  cursor: default;
  filter: saturate(0.5);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}
.lobby__begin:focus-visible { outline: 2px solid #f4e9c9; outline-offset: 3px; }

/* ---------------- codex rail ---------------- */

.lobby__rail {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: stretch;
  gap: 10px;
  width: 100%;
  padding: 20px 12px 14px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 30px, #000 calc(100% - 30px), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 30px, #000 calc(100% - 30px), transparent 100%);
}
.lobby__rail::-webkit-scrollbar { display: none; }
.lobby__rail-sep {
  flex: 0 0 auto;
  width: 1px;
  margin: 8px 6px;
  background: linear-gradient(180deg, transparent, rgba(201, 168, 106, 0.4), transparent);
}
.lobby__deck {
  position: relative;
  flex: 0 0 auto;
  width: 152px;
  min-height: 74px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px 14px;
  border: 1px solid rgba(201, 168, 106, 0.2);
  border-radius: 11px;
  background: linear-gradient(180deg, rgba(66, 55, 39, 0.42), rgba(23, 18, 11, 0.62));
  cursor: pointer;
  text-align: left;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}
.lobby__deck::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 7px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--deck-accent, #c9a86a), var(--deck-accent-2, #c9a86a));
  opacity: 0.32;
  transition: opacity 0.16s ease, box-shadow 0.16s ease;
}
.lobby__deck:hover {
  transform: translateY(-3px);
  border-color: rgba(232, 217, 176, 0.45);
  background: linear-gradient(180deg, rgba(84, 70, 48, 0.5), rgba(30, 24, 14, 0.66));
}
.lobby__deck:hover::after { opacity: 0.7; }
.lobby__deck--chosen {
  transform: translateY(-6px);
  border-color: var(--deck-accent, #d6ba80);
  background: linear-gradient(180deg, rgba(96, 79, 52, 0.55), rgba(34, 26, 15, 0.7));
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.5), 0 0 20px var(--deck-accent, rgba(214, 186, 128, 0.4));
}
.lobby__deck--chosen::after { opacity: 1; box-shadow: 0 0 12px var(--deck-accent, #d6ba80); }
.lobby__deck:focus-visible { outline: 2px solid #e8d9b0; outline-offset: 2px; }
.lobby__deck .lobby__name {
  font-family: 'Radley', Georgia, serif;
  font-weight: 400;
  font-size: 14.5px;
  color: #e8d9b0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 124px;
}
.lobby__deck .lobby__colors { gap: 4px; }
.lobby__deck .lobby__pip {
  width: 14px;
  height: 14px;
  font-size: 8px;
  box-shadow: inset 0 -1px 2px rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* ---------------- hint ---------------- */

.lobby__hint {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding-top: 2px;
  font-family: Verdana, sans-serif;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #8d7f5d;
}
.lobby__hint b { color: #d9c48a; font-weight: 700; }
.lobby__hint i { font-style: normal; opacity: 0.5; }

/* ---------------- responsive ---------------- */

@media (max-height: 840px) {
  .lobby__title { font-size: 38px; }
  .lobby__hero-card .card { width: 272px; height: 381px; }
  .lobby__halo { width: 480px; height: 480px; }
  .lobby__deck-name { font-size: 34px; }
  .lobby__stage { gap: 40px; }
}
@media (max-height: 700px) {
  #lobby { padding: 16px 30px 8px; }
  .lobby__title { font-size: 30px; }
  .lobby__rule { margin-top: 10px; }
  .lobby__sub { font-size: 13px; margin-top: 8px; }
  .lobby__hero-card .card { width: 224px; height: 314px; }
  .lobby__halo { width: 380px; height: 380px; }
  .lobby__deck-name { font-size: 28px; }
  .lobby__arch { font-size: 15px; }
  .lobby__stat b { font-size: 19px; }
  .lobby__begin { font-size: 17px; padding: 10px 30px; }
  .lobby__deck { width: 138px; min-height: 66px; }
  .lobby__rail { padding: 16px 12px 10px; }
}
@media (max-width: 1080px) {
  .lobby__stage { gap: 26px; }
  .lobby__details { flex-basis: 340px; }
  .lobby__hero-card .card { width: 272px; height: 381px; }
  .lobby__deck-name { font-size: 32px; }
  .lobby__begin { padding: 12px 30px; font-size: 19px; }
}
@media (max-width: 860px) {
  .lobby__stage { flex-direction: column; gap: 18px; }
  .lobby__details { align-items: center; text-align: center; flex-basis: auto; }
  .lobby__stats { justify-content: center; }
  .lobby__hero-card .card { width: 216px; height: 302px; }
  .lobby__halo { width: 380px; height: 380px; }
}

/* ---------------- reduced motion ---------------- */

@media (prefers-reduced-motion: reduce) {
  .lobby__art,
  .lobby__glow,
  .lobby__halo,
  .lobby__card--reveal { animation: none; }
  .lobby__ember { display: none; }
  .lobby__deck,
  .lobby__begin { transition: none; }
}
