/* REMSCAPE lobby, redesigned (Claude, 2026-07-18).
   Loads after style.css and owns the lobby page. Game shell untouched.
   Composition: slim header, asymmetric split hero (pitch left, hunter
   selection right), full-bleed living key-art band, archive shelf.
   Radius system: interactive = pill, surfaces = 14px, tiles = 10px. */

body.lobby { overflow-x: hidden; }

.lb-shell {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 28px;
}

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

.lb-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 40px 28px 0;
  text-align: center;
}
.lb-mark {
  font-family: var(--serif);
  font-size: clamp(3rem, 7.6vw, 5.75rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.22em;
  margin-right: -0.22em;
  color: var(--text);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.65);
}
.lb-top .featured-progress {
  display: none;
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--faint);
}
.lb-name input::placeholder {
  color: rgba(160, 155, 140, 0.55);
  font-style: italic;
}
.lb-name-hint {
  display: block;
  margin-top: 5px;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  color: var(--faint);
}

.lb-legends {
  font: inherit;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: rgba(217, 162, 75, 0.07);
  border: 1px solid rgba(217, 162, 75, 0.45);
  border-radius: 999px;
  padding: 8px 20px;
  cursor: pointer;
}
.lb-legends:hover { background: rgba(217, 162, 75, 0.14); }

/* ---------- hero: pitch left, hunter right ---------- */

.lb-hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 56px;
  align-items: center;
  padding: 64px 28px 72px;
}

.lb-pitch h1 {
  font-family: var(--serif);
  font-size: clamp(3rem, 7.5vw, 5.4rem);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: 0.04em;
  margin: 0 0 20px;
  max-width: min-content;
  color: var(--text);
}
.lb-pitch h1 em {
  font-style: normal;
  color: var(--accent);
}
.lb-sub {
  color: var(--dim);
  font-size: 1.02rem;
  line-height: 1.65;
  margin: 0 0 30px;
  max-width: 46ch;
}
.lb-cta {
  font-size: 1rem;
  padding: 13px 30px;
}
.lb-alt {
  margin: 16px 2px 0;
  font-size: 0.82rem;
}

/* install-the-app button: hidden on desktop, prominent on phones */
.lb-install {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  margin: 12px 0 0;
  padding: 12px 18px;
  font: inherit;
  font-size: 0.92rem;
  color: var(--accent);
  background: rgba(217, 162, 75, 0.08);
  border: 1px solid rgba(217, 162, 75, 0.55);
  border-radius: 999px;
  cursor: pointer;
}
.lb-install:active { transform: translateY(1px); }
.lb-install[hidden] { display: none !important; }
@media (pointer: coarse) {
  .lb-install { display: inline-flex; }
}

.pwa-how {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(5, 4, 6, 0.82);
}
.pwa-how[hidden] { display: none; }
.pwa-card {
  max-width: 380px;
  width: 100%;
  background: #12141c;
  border: 1px solid rgba(217, 162, 75, 0.4);
  border-radius: 14px;
  padding: 22px 22px 18px;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.6);
}
.pwa-card h2 {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 14px;
  color: var(--text);
}
.pwa-step {
  margin: 0 0 10px;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--dim);
}
.pwa-step svg { vertical-align: -2px; color: var(--accent); }
.pwa-step b { color: var(--text); }
.pwa-last { color: var(--faint); font-style: italic; }
.pwa-close {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 11px 18px;
  font: inherit;
  font-size: 0.9rem;
  color: #14100a;
  background: var(--accent);
  border: none;
  border-radius: 999px;
  cursor: pointer;
}
.lb-alt a {
  color: var(--faint);
  text-decoration: none;
  border-bottom: 1px dotted rgba(217, 162, 75, 0.4);
}
.lb-alt a:hover { color: var(--accent); }

/* hunter selection */

.lb-hunter { min-width: 0; }
.lb-portrait {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(217, 162, 75, 0.28);
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.55);
  aspect-ratio: 4 / 4.6;
  max-height: 400px;
  width: 100%;
  transform: perspective(760px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.22s ease;
  will-change: transform;
}
.lb-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  display: block;
  transition: opacity 0.16s ease, transform 0.4s ease;
}
.lb-portrait.lb-swap img {
  opacity: 0;
  transform: scale(1.03);
}
.lb-nameplate {
  position: absolute;
  left: 12px;
  bottom: 12px;
  font-family: var(--serif);
  font-size: 0.92rem;
  letter-spacing: 0.12em;
  color: var(--text);
  background: rgba(10, 11, 16, 0.78);
  border: 1px solid rgba(217, 162, 75, 0.35);
  border-radius: 999px;
  padding: 5px 16px;
  max-width: calc(100% - 24px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lb-hunter .hero-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 0;
}
.lb-hunter .hero-card {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(15, 17, 24, 0.72);
  border-radius: 10px;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  display: block;
  transition: border-color 0.18s ease, transform 0.18s ease;
}
.lb-hunter .hero-card:hover { transform: translateY(-2px); border-color: rgba(217, 162, 75, 0.5); }
.lb-hunter .hero-card.sel {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 10px 22px rgba(0, 0, 0, 0.5);
}
.lb-hunter .hero-thumb {
  display: block;
  aspect-ratio: 3 / 4;
  background-size: cover;
  background-position: top;
  filter: saturate(0.55) brightness(0.82);
  transition: filter 0.18s ease;
}
.lb-hunter .hero-card:hover .hero-thumb,
.lb-hunter .hero-card.sel .hero-thumb { filter: saturate(1) brightness(1); }
.lb-hunter .hero-name {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--dim);
  padding: 6px 4px 7px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lb-hunter .hero-card.sel .hero-name { color: var(--accent); }

.lb-name {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 16px 0 0;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  color: var(--dim);
}
.lb-name input {
  background: rgba(15, 17, 24, 0.8);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 18px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.95rem;
  outline: none;
}
.lb-name input:focus { border-color: var(--accent); }
.lb-hunter .hero-blurb {
  margin: 12px 2px 0;
  font-size: 0.85rem;
  font-style: italic;
  color: var(--faint);
  min-height: 1.3em;
}

/* ---------- living key-art band ---------- */

.lb-band {
  position: relative;
  height: clamp(220px, 34vh, 380px);
  overflow: hidden;
  border-top: 1px solid rgba(217, 162, 75, 0.22);
  border-bottom: 1px solid rgba(217, 162, 75, 0.22);
}
.lb-band img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* the living layer: absolutely stacked over the still, ghosts drifting */
.lb-band-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.lb-band::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(11, 13, 18, 0.5) 0%, rgba(11, 13, 18, 0) 30%, rgba(11, 13, 18, 0) 62%, rgba(11, 13, 18, 0.6) 100%);
  pointer-events: none;
}

/* ---------- archive + footer ---------- */

.lb-lower { padding: 44px 28px 40px; }

/* ---------- the Ledger of Legends ---------- */

.lb-board { margin: 0 0 36px; }
.lb-board h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--text);
}
.lb-board-sub {
  margin: 0 0 16px;
  font-size: 0.82rem;
  color: var(--faint);
}
.lb-board ol {
  list-style: none;
  counter-reset: legend;
  margin: 0;
  padding: 0;
  max-width: 560px;
}
.lb-board li {
  counter-increment: legend;
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 8px 2px;
  border-top: 1px solid rgba(217, 162, 75, 0.14);
  font-size: 0.9rem;
}
.lb-board li::before {
  content: counter(legend);
  min-width: 1.6em;
  font-family: var(--serif);
  color: var(--faint);
  text-align: right;
}
.lb-board li:nth-child(1)::before,
.lb-board li:nth-child(2)::before,
.lb-board li:nth-child(3)::before { color: var(--accent); }
.lb-board b {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-weight: 600;
}
.lb-board .lb-score {
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.lb-board .lb-detail {
  font-size: 0.78rem;
  color: var(--faint);
  white-space: nowrap;
}
@media (max-width: 900px) and (orientation: portrait) {
  .lb-board .lb-detail { display: none; }
}
.lb-lower .archive { margin: 0; }
.lb-lower .archive summary { border-top: none; }

.lb-foot {
  text-align: center;
  color: var(--faint);
  font-size: 0.8rem;
  padding: 30px 0 8px;
}

/* ---------- entrance (reduced-motion collapses to static) ---------- */

@media (prefers-reduced-motion: no-preference) {
  /* backwards fill: holds the hidden state through the delay, then releases
     the element so the portrait's pointer tilt owns transform afterwards */
  .lb-pitch > *,
  .lb-hunter > * {
    animation: lb-rise 0.65s cubic-bezier(0.16, 1, 0.3, 1) backwards;
  }
  .lb-pitch > *:nth-child(1) { animation-delay: 0.05s; }
  .lb-pitch > *:nth-child(2) { animation-delay: 0.13s; }
  .lb-pitch > *:nth-child(3) { animation-delay: 0.21s; }
  .lb-pitch > *:nth-child(4) { animation-delay: 0.29s; }
  .lb-pitch > *:nth-child(5) { animation-delay: 0.37s; }
  .lb-hunter > *:nth-child(1) { animation-delay: 0.18s; }
  .lb-hunter > *:nth-child(2) { animation-delay: 0.26s; }
  .lb-hunter > *:nth-child(3) { animation-delay: 0.34s; }
  .lb-hunter > *:nth-child(4) { animation-delay: 0.42s; }
}
@keyframes lb-rise {
  from { opacity: 0; transform: translateY(14px); }
}

/* ---------- phones, portrait: a tight single column ---------- */

@media (max-width: 900px) and (orientation: portrait) {
  .lb-top { padding: 22px 20px 0; }
  .lb-mark {
    font-size: clamp(1.4rem, 6.8vw, 2.4rem);
    letter-spacing: 0.12em;
    margin-right: -0.12em;
    max-width: 100%;
  }
  .lb-hero {
    grid-template-columns: 1fr;
    gap: 30px;
    padding: 28px 20px 36px;
  }
  .lb-pitch h1 { max-width: none; font-size: 2.5rem; margin-bottom: 12px; }
  .lb-sub { font-size: 0.92rem; margin-bottom: 20px; }
  .lb-cta { width: 100%; justify-content: center; }
  .lb-portrait { max-height: 280px; aspect-ratio: auto; height: 280px; }
  .lb-hunter .hero-grid { gap: 8px; }
  .lb-hunter .hero-name { font-size: 0.62rem; }
  .lb-band { height: clamp(140px, 22vh, 200px); }
  .lb-lower { padding: 26px 16px 26px; }
}

/* ---------- phones, landscape: a one-screen cockpit ---------- */

@media (max-width: 900px) and (orientation: landscape) {
  .lb-top {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    text-align: left;
    padding: 12px 20px 0;
    gap: 14px;
  }
  .lb-mark {
    font-size: 1.05rem;
    letter-spacing: 0.3em;
    margin-right: 0;
  }
  .lb-top .featured-progress { font-size: 0.68rem; }
  .lb-hero {
    grid-template-columns: 1.05fr 0.95fr;
    gap: 24px;
    align-items: start;
    padding: 14px 20px 26px;
  }
  .lb-pitch h1 { font-size: 1.9rem; max-width: none; margin-bottom: 8px; line-height: 1; }
  .lb-sub { font-size: 0.82rem; line-height: 1.5; margin-bottom: 14px; max-width: none; }
  .lb-cta { font-size: 0.88rem; padding: 10px 22px; }
  .lb-alt { margin-top: 10px; font-size: 0.74rem; }
  .lb-hunter {
    display: grid;
    grid-template-columns: 108px minmax(0, 1fr);
    gap: 10px 12px;
    align-items: start;
  }
  .lb-hunter > * { min-width: 0; }
  .lb-hunter .hero-card { min-width: 0; }
  .lb-portrait {
    grid-row: 1 / span 3;
    aspect-ratio: 3 / 4;
    max-height: 170px;
    border-radius: 10px;
  }
  .lb-nameplate { left: 6px; bottom: 6px; font-size: 0.62rem; padding: 3px 9px; }
  .lb-hunter .hero-grid {
    margin: 0;
    gap: 6px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .lb-hunter .hero-thumb { aspect-ratio: 1 / 1.15; }
  .lb-hunter .hero-name { font-size: 0.56rem; padding: 3px 2px 4px; }
  .lb-name { margin: 0; font-size: 0.68rem; gap: 4px; }
  .lb-name input { padding: 7px 14px; font-size: 0.85rem; }
  .lb-hunter .hero-blurb { margin: 0 2px; font-size: 0.72rem; min-height: 1em; }
  .lb-band { height: clamp(120px, 30vh, 170px); }
  .lb-lower { padding: 22px 16px 22px; }
  .lb-foot { padding: 18px 0 6px; font-size: 0.72rem; }
}

@media (prefers-reduced-motion: reduce) {
  .lb-portrait { transform: none !important; transition: none; }
  .lb-band-video { display: none; }
}

/* the roster breathes: a slow ember pulse walks the frames, portraits
   drift a few pixels. The chosen hunter holds steady. */
@media (prefers-reduced-motion: no-preference) {
  .lb-hunter .hero-card:not(.sel) {
    animation: lb-frame-ember 7.5s ease-in-out infinite;
  }
  .lb-hunter .hero-card:nth-child(1) { animation-delay: 0s; }
  .lb-hunter .hero-card:nth-child(2) { animation-delay: 1.9s; }
  .lb-hunter .hero-card:nth-child(3) { animation-delay: 3.8s; }
  .lb-hunter .hero-card:nth-child(4) { animation-delay: 5.7s; }
  .lb-hunter .hero-thumb {
    animation: lb-thumb-drift 12s ease-in-out infinite alternate;
  }
  .lb-hunter .hero-card:nth-child(2) .hero-thumb { animation-delay: 1.4s; }
  .lb-hunter .hero-card:nth-child(3) .hero-thumb { animation-delay: 2.8s; }
  .lb-hunter .hero-card:nth-child(4) .hero-thumb { animation-delay: 4.2s; }
}
@keyframes lb-frame-ember {
  0%, 100% { border-color: var(--line); box-shadow: none; }
  50% { border-color: rgba(217, 162, 75, 0.45); box-shadow: 0 0 14px rgba(217, 162, 75, 0.1); }
}
@keyframes lb-thumb-drift {
  from { background-position: 50% 0%; }
  to { background-position: 50% 12%; }
}
