.lobby-home { background: #061312; }

.lobby-hero {
  position: relative;
  min-height: min(760px, calc(100dvh - 44px));
  display: grid;
  place-items: center;
  padding: clamp(2.5rem, 7vw, 6rem) clamp(1rem, 5vw, 4rem);
  overflow: hidden;
  isolation: isolate;
  background-image:
    linear-gradient(90deg, rgba(1, 8, 10, 0.96), rgba(2, 11, 14, 0.72) 52%, rgba(2, 10, 13, 0.34)),
    url("/public/assets/enchanted-forest.jpg");
  background-position: center 24%;
  background-size: cover;
}

.lobby-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 28% 24%, rgba(58, 116, 164, 0.16), transparent 32%),
    linear-gradient(0deg, #061312 0%, transparent 24%);
}

.lobby-shell {
  width: min(100%, 980px);
  padding: clamp(1.25rem, 4vw, 2.25rem);
  border: 1px solid rgba(212, 179, 104, 0.26);
  border-radius: 30px;
  background: rgba(3, 18, 16, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.lobby-shell .brand {
  margin-bottom: 0.85rem;
  font-size: clamp(1.9rem, 4vw, 3rem);
}

.lobby-shell h1 {
  max-width: 13ch;
  margin-bottom: 0.9rem;
  font-size: clamp(2.7rem, 6vw, 5.8rem);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.lobby-lede {
  max-width: 640px;
  margin-bottom: 1.8rem;
  color: #d0d2ca;
  font-size: clamp(1rem, 1.7vw, 1.22rem);
  line-height: 1.55;
}

.lobby-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.lobby-create-form { margin: 0; }

.lobby-action {
  width: 100%;
  min-height: 190px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 0.45rem;
  padding: clamp(1.25rem, 3vw, 1.8rem);
  border: 1px solid var(--line);
  border-radius: 24px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.lobby-action:hover { transform: translateY(-2px); }
.lobby-action:active { transform: translateY(0); }

.lobby-join {
  background: linear-gradient(145deg, rgba(12, 59, 48, 0.96), rgba(6, 31, 27, 0.96));
  border-color: rgba(104, 173, 130, 0.56);
}

.lobby-create {
  background: linear-gradient(145deg, rgba(78, 60, 25, 0.94), rgba(38, 30, 16, 0.96));
  border-color: rgba(212, 179, 104, 0.66);
}

.lobby-action-kicker {
  margin-bottom: auto;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.lobby-action strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3.4rem);
  font-weight: 500;
  line-height: 1;
}

.lobby-action > span:last-child {
  max-width: 28ch;
  color: #c8cbc3;
  line-height: 1.45;
}

.lobby-join-entry {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid rgba(104, 173, 130, 0.46);
  border-radius: 18px;
  background: rgba(3, 20, 17, 0.9);
}

.lobby-join-entry[hidden] { display: none; }

.lobby-join-entry label {
  display: block;
  margin-bottom: 0.6rem;
  font-size: 0.82rem;
  font-weight: 750;
}

.lobby-join-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
}

.lobby-join-row input {
  min-width: 0;
  min-height: 50px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.8rem 1rem;
  background: rgba(1, 13, 12, 0.8);
  color: var(--ink);
}

.lobby-join-message {
  min-height: 1.25em;
  margin: 0.65rem 0 0;
  color: #d9b7b4;
  font-size: 0.8rem;
}

.lobby-secondary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  color: #9da69e;
  font-size: 0.8rem;
}

.lobby-secondary .text-button { font-size: 0.8rem; }

@media (max-width: 720px) {
  .lobby-hero {
    min-height: calc(100dvh - 44px);
    align-items: start;
    padding: 1rem;
    background-position: 62% top;
  }

  .lobby-shell {
    margin-top: clamp(0.25rem, 5vh, 2rem);
    padding: 1.1rem;
    border-radius: 22px;
  }

  .lobby-shell h1 { max-width: 12ch; }
  .lobby-lede { margin-bottom: 1.25rem; }
  .lobby-actions { grid-template-columns: 1fr; gap: 0.75rem; }
  .lobby-action { min-height: 142px; border-radius: 20px; }
  .lobby-action strong { font-size: clamp(2rem, 10vw, 3rem); }
  .lobby-join-row { grid-template-columns: 1fr; }
  .lobby-join-row .primary-button { width: 100%; }
  .lobby-secondary { justify-content: center; text-align: center; }
}

/* Portrait games remain compact but scroll naturally instead of being forced
   into one viewport. */
@media (max-width: 760px) and (orientation: portrait) {
  body[data-page="game"] {
    height: auto;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body[data-page="game"] .app {
    height: auto;
    min-height: 100dvh;
    grid-template-rows: 1fr;
    overflow: visible;
  }

  .game-page {
    height: auto;
    min-height: 100dvh;
    display: block;
    overflow: visible;
    padding-bottom: calc(40px + env(safe-area-inset-bottom));
  }

  .players-strip {
    margin: 0 -8px;
    padding-left: 8px;
    padding-right: 8px;
  }

  .life-section {
    display: block;
    padding: 0.35rem 0 0;
  }

  .life-control {
    height: auto;
    min-height: 0;
  }

  .life-abacus {
    height: auto;
    min-height: 120px;
    grid-template-rows: auto 12px;
  }

  .life-dial {
    height: auto;
    min-height: 120px;
    grid-template-rows: auto 28px;
  }

  .commander-panel {
    margin-top: 12px;
  }

  .commander-panel[open] .commander-list {
    position: static;
    padding: 0 0.75rem 0.5rem;
    border: 0;
    border-top: 1px solid rgba(212, 179, 104, 0.16);
    border-radius: 0;
    box-shadow: none;
  }

  .notes-section {
    display: block;
    margin-top: 12px;
    padding: 1rem;
    overflow: visible;
  }

  .notes-heading-row {
    margin-bottom: 0.75rem;
  }

  .prompt-options:not(:empty) {
    padding-top: 0.8rem;
  }

  .note-details {
    height: auto;
    margin-top: 0.8rem;
  }

  .quick-note {
    min-height: 0;
    grid-template-rows: auto auto;
    margin-top: 1rem;
  }

  .quick-note textarea {
    height: auto;
    min-height: 76px;
    resize: vertical;
  }

  .note-form-actions {
    height: auto;
    margin-top: 0.8rem;
  }

  .form-message {
    min-height: 1.2em;
    height: auto;
    margin-top: 0.6rem;
    overflow: visible;
    transform: none;
  }

  .log-section {
    min-height: 0;
    margin-top: 12px;
    padding: 1rem;
    overflow: visible;
  }

  .game-log li:nth-child(n + 2) {
    display: grid;
  }

  .game-log p {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }

  .host-controls {
    margin-top: 12px;
    padding: 0.75rem;
  }
}
