/* ═══════════════════════════════════════════════════════════
   LOBBY STYLES
   ═══════════════════════════════════════════════════════════ */

html:has(body.lobby-body) {
  overflow-y: auto;
  overflow-x: hidden;
}

.lobby-body {
  position: relative;
  min-height: 100vh;
  height: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  font-family: Georgia, serif;
  color: var(--parchment-light, #ede0b8);
  margin: 0;
  padding: 60px 20px 80px;
  box-sizing: border-box;
  overflow-y: visible;
  overflow-x: hidden;
}

.lobby-body::before,
.lobby-body::after { display: none; }

/* ── BACKGROUNDS ─────────────────────────────────────────── */
#map-bg {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding-top: 72.97%;
  background: url('map_image.png') center top / 100% auto no-repeat;
  opacity: 0.56;
  filter: sepia(0.4) saturate(0.8);
  z-index: 0;
  pointer-events: none;
}

#map-bg-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 30%, rgba(20,12,2,0.35) 0%, rgba(6,4,1,0.72) 100%);
  z-index: 0;
  pointer-events: none;
}

#bg-brighthelm {
  position: absolute;
  left: 0; right: 0;
  top: 72.97vw;
  padding-top: 57.14%;
  background: url('verdantholm_brighthelm.png') center top / 100% auto no-repeat;
  opacity: 0.38;
  filter: sepia(0.4) saturate(0.8);
  z-index: 0;
  pointer-events: none;
}

#bg-creation-myth {
  position: absolute;
  left: 0; right: 0;
  top: calc(72.97vw + 57.14vw);
  padding-top: 137.04%;
  background: url('verdantholm_creation_myth.png') center top / 100% auto no-repeat;
  opacity: 0.38;
  filter: sepia(0.4) saturate(0.8);
  z-index: 0;
  pointer-events: none;
}

#bg-trade-caravan {
  position: absolute;
  left: 0; right: 0;
  top: calc(72.97vw + 57.14vw + 137.04vw);
  padding-top: 57.14%;
  background: url('verdantholm_trade_caravan.png') center top / 100% auto no-repeat;
  opacity: 0.38;
  filter: sepia(0.4) saturate(0.8);
  z-index: 0;
  pointer-events: none;
}

#bg-grimforge {
  position: absolute;
  left: 0; right: 0;
  top: calc(72.97vw + 57.14vw + 137.04vw + 57.14vw);
  padding-top: 57.14%;
  background: url('verdantholm_grimforge.png') center top / 100% auto no-repeat;
  opacity: 0.38;
  filter: sepia(0.4) saturate(0.8);
  z-index: 0;
  pointer-events: none;
}

/* ── FRAME ───────────────────────────────────────────────── */
.lobby-body .screen-border {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  box-shadow:
    inset 0 0 80px rgba(180,120,20,0.12),
    inset 0 0 160px rgba(100,60,10,0.2);
}

.lobby-body .screen-border::before {
  content: '';
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(180,120,20,0.35);
  border-radius: 2px;
}

.lobby-body .screen-border::after {
  content: '';
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(140,90,15,0.18);
  border-radius: 1px;
}

.screen-border .corner {
  position: absolute;
  width: 52px;
  height: 52px;
  border-color: rgba(212,160,23,0.55);
  border-style: solid;
}
.screen-border .corner-tl { top: 10px; left: 10px;  border-width: 2px 0 0 2px; }
.screen-border .corner-tr { top: 10px; right: 10px; border-width: 2px 2px 0 0; }
.screen-border .corner-bl { bottom: 10px; left: 10px;  border-width: 0 0 2px 2px; }
.screen-border .corner-br { bottom: 10px; right: 10px; border-width: 0 2px 2px 0; }

.screen-border .edge-gem {
  position: absolute;
  width: 8px; height: 8px;
  background: rgba(212,160,23,0.45);
  transform: rotate(45deg);
}
.screen-border .gem-top    { top: 9px;    left: 50%; margin-left: -4px; }
.screen-border .gem-bottom { bottom: 9px; left: 50%; margin-left: -4px; }
.screen-border .gem-left   { left: 9px;   top: 50%;  margin-top: -4px; }
.screen-border .gem-right  { right: 9px;  top: 50%;  margin-top: -4px; }

/* ── LAYOUT ──────────────────────────────────────────────── */
#lobby-app {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 960px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
}

#lobby-title,
#lobby-card {
  width: 100%;
  max-width: 500px;
}

/* ── TITLE ───────────────────────────────────────────────── */
#lobby-title {
  text-align: center;
  padding-top: 12px;
}

#lobby-title h1 {
  font-size: 3rem;
  color: #d4a017;
  letter-spacing: 0.28em;
  margin: 0 0 8px;
  text-shadow:
    0 0 30px rgba(212,160,23,0.7),
    0 0 80px rgba(212,160,23,0.3),
    0 3px 8px rgba(0,0,0,0.95);
}

/* Decorative rule under title */
#lobby-title h1::after {
  content: '';
  display: block;
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #d4a017, transparent);
  margin: 10px auto 0;
}

#lobby-title p {
  font-size: 0.78rem;
  color: #9a7840;
  letter-spacing: 0.14em;
  margin: 0 0 8px;
  font-style: italic;
}

#lobby-tagline {
  font-size: 0.75rem;
  color: #6a5830;
  letter-spacing: 0.06em;
  margin: 0 0 20px;
  font-family: Georgia, serif;
}

.lobby-nav {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.nav-link {
  color: #c8a050;
  font-size: 0.72rem;
  text-decoration: none;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: Georgia, serif;
  cursor: pointer;
  padding: 7px 16px;
  border: 1px solid #5a3a10;
  border-radius: 3px;
  background: rgba(10, 7, 2, 0.7);
  backdrop-filter: blur(4px);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.nav-link:hover {
  color: #d4a017;
  border-color: #d4a017;
  background: rgba(30, 18, 4, 0.85);
}

/* ── CARD ────────────────────────────────────────────────── */
#lobby-card {
  background: linear-gradient(165deg, #1c1408 0%, #120d03 60%, #0e0902 100%);
  border: 1px solid rgba(120,80,20,0.6);
  border-radius: 6px;
  padding: 40px 36px;
  width: 100%;
  box-shadow:
    0 12px 60px rgba(0,0,0,0.8),
    0 2px 0 rgba(212,160,23,0.06),
    inset 0 1px 0 rgba(212,160,23,0.08),
    inset 0 0 40px rgba(0,0,0,0.4);
  position: relative;
  min-height: 260px;
}

/* Inner hairline border */
#lobby-card::before {
  content: '';
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(100,65,15,0.25);
  border-radius: 4px;
  pointer-events: none;
}

/* Subtle top accent line */
#lobby-card::after {
  content: '';
  position: absolute;
  top: 0; left: 20%; right: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212,160,23,0.4), transparent);
  border-radius: 1px;
}

/* ── SCREENS ─────────────────────────────────────────────── */
.lobby-screen {
  display: none;
  flex-direction: column;
  gap: 20px;
  align-items: center;
}
.lobby-screen.active { display: flex; }

.lobby-screen h2 {
  font-size: 1rem;
  color: #c8a050;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin: 0;
  text-align: center;
}

/* Divider line under screen title */
.lobby-screen h2::after {
  content: '';
  display: block;
  width: 40px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212,160,23,0.35), transparent);
  margin: 8px auto 0;
}

/* ── INPUTS ──────────────────────────────────────────────── */
#lobby-card input[type="text"] {
  width: 100%;
  max-width: 300px;
  background: rgba(8,6,2,0.7);
  border: 1px solid rgba(90,58,16,0.8);
  border-bottom: 1px solid rgba(160,100,20,0.5);
  border-radius: 3px;
  color: #ede0b8;
  font-family: Georgia, serif;
  font-size: 1rem;
  padding: 12px 16px;
  text-align: center;
  outline: none;
  letter-spacing: 0.12em;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#lobby-card input[type="text"]:focus {
  border-color: rgba(212,160,23,0.7);
  box-shadow: 0 0 0 2px rgba(212,160,23,0.07), 0 2px 12px rgba(0,0,0,0.4);
}
#input-code {
  text-transform: uppercase;
  font-size: 1.5rem;
  letter-spacing: 0.28em;
  max-width: 260px;
}

/* ── BUTTONS ─────────────────────────────────────────────── */
.lobby-btn-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.lobby-btn {
  background: linear-gradient(180deg, #2a1e0a 0%, #1e1506 100%);
  border: 1px solid rgba(120,80,20,0.6);
  color: #b89040;
  font-family: Georgia, serif;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 12px 28px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 150px;
  position: relative;
}
.lobby-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 3px;
  opacity: 0;
  background: rgba(212,160,23,0.04);
  transition: opacity 0.15s;
}
.lobby-btn:hover {
  border-color: rgba(212,160,23,0.6);
  color: #d4a017;
  box-shadow: 0 0 16px rgba(212,160,23,0.08);
}
.lobby-btn:hover::before { opacity: 1; }

.lobby-btn.confirm {
  background: linear-gradient(180deg, #1e2e0e 0%, #141f08 100%);
  border-color: rgba(80,120,40,0.6);
  color: #88c048;
}
.lobby-btn.confirm:hover {
  border-color: rgba(120,180,60,0.7);
  color: #a8d860;
  box-shadow: 0 0 16px rgba(100,180,40,0.08);
}

.lobby-btn.cancel {
  opacity: 0.65;
  min-width: 100px;
}
.lobby-btn.cancel:hover { opacity: 1; }

/* ── ROOM CODE ───────────────────────────────────────────── */
#room-code-display, #room-code-joined {
  font-size: 2.4rem;
  letter-spacing: 0.4em;
  color: #d4a017;
  font-weight: bold;
  text-align: center;
  background: rgba(8,6,2,0.7);
  border: 1px solid rgba(90,58,16,0.7);
  border-radius: 4px;
  padding: 14px 28px;
  cursor: pointer;
  user-select: all;
  transition: border-color 0.2s, box-shadow 0.2s;
  text-shadow: 0 0 20px rgba(212,160,23,0.4);
  width: 100%;
  box-sizing: border-box;
}
#room-code-display:hover, #room-code-joined:hover {
  border-color: rgba(212,160,23,0.6);
  box-shadow: 0 0 20px rgba(212,160,23,0.08);
}

/* ── PLAYER LIST ─────────────────────────────────────────── */
.player-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.player-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(8,6,2,0.5);
  border: 1px solid rgba(50,35,10,0.8);
  border-radius: 3px;
  padding: 9px 14px;
  font-size: 0.8rem;
  transition: border-color 0.15s;
}
.player-entry:hover {
  border-color: rgba(90,58,16,0.8);
}

.player-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 6px currentColor;
}

.player-name { flex: 1; color: #c8a050; letter-spacing: 0.04em; }
.player-badge {
  font-size: 0.6rem;
  color: #6a4a18;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.player-badge.host { color: #d4a017; }
.player-badge.bot  { color: #5a8a9a; }

/* ── BOT SELECTOR ────────────────────────────────────────── */
.bot-selector {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin: 4px 0;
  width: 100%;
}

.bot-selector label {
  font-size: 0.68rem;
  color: #7a5a28;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.bot-count-row {
  display: flex;
  align-items: center;
  gap: 24px;
}

.bot-btn {
  width: 38px;
  height: 38px;
  background: linear-gradient(180deg, #1e1608 0%, #160f04 100%);
  border: 1px solid rgba(90,58,16,0.7);
  color: #b89040;
  font-size: 1.1rem;
  line-height: 1;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
}
.bot-btn:hover {
  border-color: rgba(212,160,23,0.6);
  color: #d4a017;
  box-shadow: 0 0 10px rgba(212,160,23,0.06);
}

#bot-count-display {
  font-size: 2.4rem;
  font-weight: bold;
  color: #d4a017;
  min-width: 2.5ch;
  text-align: center;
  text-shadow: 0 0 20px rgba(212,160,23,0.4);
  line-height: 1;
}

.bot-hint { max-width: 300px; }

/* ── HINTS & MISC ────────────────────────────────────────── */
.lobby-hint {
  font-size: 0.7rem;
  color: #6a4a18;
  text-align: center;
  font-style: italic;
  margin: 0;
  line-height: 1.6;
}

#lore-divider {
  text-align: center;
  padding: 60px 0 12px;
}

#lore-divider h2 {
  font-size: 1.6rem;
  color: #d4a017;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0 0 10px;
  text-shadow: 0 0 30px rgba(212,160,23,0.4);
}

#lore-divider h2::before,
#lore-divider h2::after {
  content: '—';
  margin: 0 14px;
  color: #5a3a10;
}

.beta-note {
  margin-top: 24px;
  padding: 14px 18px;
  border: 1px solid #3a2a10;
  border-left: 3px solid #d4a017;
  background: rgba(20, 14, 4, 0.6);
  border-radius: 3px;
  font-size: 0.82rem;
  color: #9a7840;
  line-height: 1.7;
}
.beta-note strong { color: #c8a050; }

.lore-reminder {
  font-size: 0.8rem;
  color: #6a4a18;
  text-align: center;
  font-style: italic;
  margin: 4px 0 0;
  line-height: 1.65;
  border-top: 1px solid rgba(42,30,8,0.8);
  padding-top: 16px;
  width: 100%;
}
.lore-reminder a {
  color: #b89040;
  text-decoration: none;
  border-bottom: 1px dotted rgba(90,58,16,0.6);
  transition: color 0.15s, border-color 0.15s;
}
.lore-reminder a:hover {
  color: #d4a017;
  border-color: #d4a017;
}

.lobby-error {
  color: #d04828;
  font-size: 0.76rem;
  text-align: center;
  letter-spacing: 0.04em;
}

/* ── WAITING PULSE ───────────────────────────────────────── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
#waiting-msg { animation: pulse 2.4s ease-in-out infinite; }

/* ── MUSIC CREDIT ────────────────────────────────────────── */
#music-credit {
  position: fixed;
  bottom: 8px;
  right: 12px;
  font-family: Georgia, serif;
  font-size: 0.6rem;
  color: #3a2a10;
  letter-spacing: 0.05em;
  pointer-events: none;
  z-index: 10;
}

/* ── Footer ─────────────────────────────────────────────── */
#lobby-footer {
  text-align: center;
  padding: 40px 20px 60px;
  border-top: 1px solid #2a1a08;
}

#footer-inner p {
  font-size: 0.78rem;
  color: #a08050;
  font-family: Georgia, serif;
  font-style: italic;
  margin: 0 0 12px;
  text-shadow: 0 1px 6px rgba(0,0,0,0.95);
}

#footer-inner strong {
  color: #c8a050;
}

#donate-link {
  display: inline-block;
  padding: 9px 22px;
  border: 1px solid #5a3a10;
  border-radius: 3px;
  background: rgba(10, 7, 2, 0.7);
  color: #c8a050;
  font-family: Georgia, serif;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-decoration: none;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
#donate-link:hover {
  color: #d4a017;
  border-color: #d4a017;
  background: rgba(30, 18, 4, 0.85);
}

/* ── Contact Button ──────────────────────────────────────── */
#contact-btn {
  display: inline-block;
  padding: 9px 22px;
  border: 1px solid #5a3a10;
  border-radius: 3px;
  background: rgba(10, 7, 2, 0.7);
  color: #c8a050;
  font-family: Georgia, serif;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
#contact-btn:hover {
  color: #d4a017;
  border-color: #d4a017;
  background: rgba(30, 18, 4, 0.85);
}

/* ── Contact Modal ───────────────────────────────────────── */
#contact-modal {
  position: fixed;
  inset: 0;
  z-index: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.82);
}
#contact-box {
  position: relative;
  background: #0e0c08;
  border: 1px solid #5a4818;
  border-radius: 6px;
  padding: 32px 36px;
  text-align: center;
  box-shadow: 0 0 60px rgba(180,130,20,0.12);
  max-width: 360px;
  width: 90%;
}
#contact-close {
  position: absolute;
  top: 10px; right: 14px;
  background: none;
  border: none;
  color: #7a6030;
  font-size: 1rem;
  cursor: pointer;
  transition: color 0.2s;
}
#contact-close:hover { color: #c0a050; }
#contact-title {
  font-family: Georgia, serif;
  font-size: 1rem;
  color: #d4a017;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
#contact-text {
  font-size: 0.8rem;
  color: #7a6040;
  font-style: italic;
  margin-bottom: 16px;
  line-height: 1.6;
}
#contact-email {
  display: inline-block;
  color: #c8a050;
  font-family: Georgia, serif;
  font-size: 0.85rem;
  text-decoration: none;
  border-bottom: 1px dotted #5a3a10;
  transition: color 0.2s, border-color 0.2s;
}
#contact-email:hover {
  color: #d4a017;
  border-color: #d4a017;
}
