#lobby-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #1a1a2e;
  flex-direction: row;
  align-items: stretch;
}
#lobby-preview { position: relative; flex: 1; min-width: 0; overflow: hidden; background: #24394a; }
#lobby-preview canvas { width: 100%; height: 100%; }
#lobby-menu {
  flex: 0 0 360px;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: max(28px, env(safe-area-inset-top)) 28px max(20px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #ddd;
}
#lobby-menu > * { flex-shrink: 0; }
#lobby-menu h2 { overflow-wrap: anywhere; }
#lobby-menu button, #lobby-menu select { touch-action: manipulation; }
#lobby-menu input[type="range"] { touch-action: pan-y; accent-color: #f0c040; width: 100%; min-height: 28px; }
#lobby-menu button:disabled { opacity: .45; cursor: default; }
.lobby-field label, #lobby-weather label { display: block; color: #aaa; font-size: 12px; margin: 4px 0; }
.lobby-field select { width: 100%; padding: 10px; font-size: 14px; background: #2a2a3e; color: #fff; border: 1px solid #555; border-radius: 8px; }
#lobby-weather { border: 1px solid #44445b; border-radius: 8px; padding: 10px 12px; }
#lobby-weather legend { color: #ddd; font-size: 12px; padding: 0 5px; }
#lobby-weather small { color: #aaa; }
#lobby-weather output { float: right; color: #f0c040; }
.lobby-version { color: #666; font: 10px monospace; margin-top: 20px; }
.preview-toolbar { position: absolute; z-index: 1; left: 16px; top: max(16px, env(safe-area-inset-top)); display: flex; gap: 6px; }
.preview-toolbar button { border: 1px solid #ffffff40; border-radius: 20px; color: #fff; background: #172330c9; padding: 10px 14px; cursor: pointer; touch-action: manipulation; }
.preview-toolbar button[aria-pressed="true"] { border-color: #f0c040; color: #f0c040; }
.lobby-choice-buttons { display: flex; gap: 8px; }
.lobby-choice-buttons button { flex: 1; border: 1px solid #ffffff40; border-radius: 20px; color: #fff; background: #172330c9; padding: 10px 14px; cursor: pointer; }
.lobby-choice-buttons button[aria-pressed="true"] { border-color: #f0c040; color: #f0c040; }
#world-loading { position: fixed; inset: 0; z-index: 3000; background: #1a1a2e; color: #f0c040; flex-direction: column; align-items: center; justify-content: center; gap: 18px; font-size: 18px; }
#world-loading:not([hidden]) { display: flex; }
.world-loading-spinner { width: 40px; height: 40px; border: 3px solid #ffffff30; border-top-color: #f0c040; border-radius: 50%; animation: world-loading-spin .8s linear infinite; }
#world-loading-back { padding: 10px 16px; background: transparent; border: 1px solid #f0c040; border-radius: 8px; color: #f0c040; cursor: pointer; }
@keyframes world-loading-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .world-loading-spinner { animation: none; } }
#preview-status { position: absolute; top: 50%; width: 100%; padding: 12px; text-align: center; color: #fff; }
#preview-caption { position: absolute; bottom: 14px; left: 16px; right: 16px; font-size: 12px; color: #fff; text-shadow: 0 1px 4px #000; pointer-events: none; }
@media (max-width: 700px) {
  #lobby-screen { flex-direction: column; }
  #lobby-preview { flex: 0 0 33.333%; min-height: 0; }
  #lobby-menu { flex: 1 1 0; min-height: 0; padding: 16px max(20px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); }
  #lobby-menu > div { max-width: 360px !important; }
  .preview-toolbar { top: max(8px, env(safe-area-inset-top)); left: 10px; }
  .preview-toolbar button { font-size: 12px; padding: 8px 12px; }
  #preview-caption { left: 10px; bottom: 8px; font-size: 11px; }
}
@media (max-height: 500px) and (min-width: 701px) {
  #lobby-menu { flex-basis: 310px; padding-top: 16px; }
}
