*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: linear-gradient(165deg, #0c4a6e 0%, #082f49 45%, #0f172a 100%);
  color: #e2e8f0;
  font: 16px/1.5 system-ui, -apple-system, sans-serif;
}

.lobby {
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 20px 64px;
}

.lobby__header {
  text-align: center;
  margin-bottom: 32px;
}

.lobby__header h1 {
  margin: 0 0 8px;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.lobby__tagline {
  margin: 0;
  color: #94a3b8;
}

.lobby__panel {
  animation: lobby-fade-in 0.25s ease;
}

@keyframes lobby-fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lobby__panel h2 {
  margin: 0 0 16px;
  font-size: 1.125rem;
  font-weight: 600;
}

.lobby__card {
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  padding: 20px;
  backdrop-filter: blur(8px);
}

.lobby__columns {
  display: grid;
  gap: 20px;
}

@media (min-width: 720px) {
  .lobby__columns {
    grid-template-columns: 1.2fr 1fr;
  }
}

.lobby__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.lobby__welcome {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: #cbd5e1;
}

.lobby__welcome-color {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 1px solid rgba(248, 250, 252, 0.35);
}

.lobby__welcome strong {
  color: #f1f5f9;
  font-weight: 600;
}

.lobby__card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.lobby__card-header h2 {
  margin: 0;
}

.lobby__form {
  display: grid;
  gap: 14px;
}

.lobby__field {
  display: grid;
  gap: 6px;
}

.lobby__field span {
  font-size: 0.875rem;
  color: #94a3b8;
}

.lobby__field input,
.lobby__field select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.9);
  color: #f8fafc;
  font: inherit;
}

.lobby__field input:focus,
.lobby__field select:focus {
  outline: 2px solid rgba(56, 189, 248, 0.45);
  outline-offset: 1px;
}

.lobby__btn {
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.lobby__btn--primary {
  background: #0284c7;
  color: #f8fafc;
}

.lobby__btn--primary:hover {
  background: #0369a1;
}

.lobby__btn--ghost {
  background: transparent;
  border-color: rgba(148, 163, 184, 0.3);
  color: #cbd5e1;
}

.lobby__btn--ghost:hover {
  background: rgba(148, 163, 184, 0.12);
}

.boat-color-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.boat-color-options {
  display: contents;
}

.boat-color-option {
  position: relative;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 999px;
  border: 2px solid rgba(148, 163, 184, 0.35);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.boat-color-option:hover {
  transform: scale(1.06);
}

.boat-color-option.is-selected {
  border-color: #f8fafc;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.55);
}

.boat-color-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.boat-color-custom-group {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.boat-color-gamut-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 8;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.96);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.boat-color-gamut-popover[hidden] {
  display: none;
}

.boat-color-gamut {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 96px;
}

.boat-color-gamut__plane {
  display: block;
  width: 96px;
  height: 56px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  cursor: crosshair;
  touch-action: none;
}

.boat-color-gamut__hue {
  width: 100%;
  height: 10px;
  margin: 0;
  padding: 0;
  border-radius: 999px;
  appearance: none;
  background: linear-gradient(
    to right,
    #ff0000,
    #ffff00,
    #00ff00,
    #00ffff,
    #0000ff,
    #ff00ff,
    #ff0000
  );
  cursor: pointer;
}

.boat-color-gamut__hue::-webkit-slider-thumb {
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 2px solid #f8fafc;
  background: rgba(15, 23, 42, 0.85);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.35);
}

.boat-color-gamut__hue::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 2px solid #f8fafc;
  background: rgba(15, 23, 42, 0.85);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.35);
}

.boat-color-gamut__hue:focus {
  outline: 2px solid rgba(56, 189, 248, 0.45);
  outline-offset: 2px;
}

.boat-color-custom {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px 0 0;
  border-radius: 999px;
  border: 2px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.72);
  cursor: pointer;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.boat-color-custom.is-selected,
.boat-color-custom.is-open {
  border-color: #f8fafc;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.55);
}

.boat-color-custom input {
  width: 6.75rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: #f8fafc;
  font: inherit;
  line-height: 1;
  cursor: text;
}

.boat-color-custom input:focus {
  outline: none;
}

.boat-color-custom:focus-within {
  border-color: #f8fafc;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.55);
}

.boat-color-preview {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  margin: -2px 0 -2px -2px;
  border-radius: 999px;
  border: 2px solid rgba(148, 163, 184, 0.35);
  background: #60a5fa;
}

.lobby__hint {
  margin: 0;
  color: #94a3b8;
  font-size: 0.9375rem;
}

.lobby__error {
  margin: 20px 0 0;
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(127, 29, 29, 0.45);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fecaca;
}

.race-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.race-list__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(30, 41, 59, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.race-list__info {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.race-list__info strong {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.race-list__meta {
  font-size: 0.8125rem;
  color: #94a3b8;
}
