:root {
  color-scheme: dark;
  --bg: #0a0f1d;
  --bg-accent: #121a2e;
  --panel: rgba(14, 20, 37, 0.92);
  --card: rgba(26, 33, 57, 0.95);
  --line: rgba(255, 255, 255, 0.08);
  --text: #eef2ff;
  --muted: #96a3c8;
  --primary: #4cc9f0;
  --primary-strong: #56f0ff;
  --danger: #ff5e7a;
  --success: #6ee7a8;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(76, 201, 240, 0.16), transparent 34%),
    radial-gradient(circle at bottom right, rgba(255, 94, 122, 0.12), transparent 28%),
    linear-gradient(180deg, #08111f 0%, #050910 100%);
}

.app-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.panel {
  width: min(100%, 920px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 32px;
  backdrop-filter: blur(16px);
}

.brand {
  text-align: center;
  margin-bottom: 28px;
}

.eyebrow {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(76, 201, 240, 0.14);
  color: var(--primary-strong);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin: 14px 0 10px;
  font-size: clamp(2rem, 4vw, 3rem);
}

.subtitle,
.muted,
.helper-text {
  color: var(--muted);
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.field span {
  font-weight: 600;
}

input[type="text"],
input[type="number"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 16px 18px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

input[type="text"]:focus,
input[type="number"]:focus {
  border-color: rgba(76, 201, 240, 0.65);
  transform: translateY(-1px);
}

.actions,
.join-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.join-card {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.btn {
  border: none;
  border-radius: 18px;
  padding: 16px 20px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
  min-height: 56px;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  color: #04111c;
  background: linear-gradient(135deg, var(--primary-strong), var(--primary));
  box-shadow: 0 10px 30px rgba(76, 201, 240, 0.3);
}

.btn-secondary {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.status {
  padding: 14px 16px;
  border-radius: 16px;
  margin-bottom: 18px;
  font-weight: 600;
}

.status.error {
  background: rgba(255, 94, 122, 0.14);
  color: #ffb0bd;
  border: 1px solid rgba(255, 94, 122, 0.3);
}

.status.success {
  background: rgba(110, 231, 168, 0.14);
  color: #bdf6d2;
  border: 1px solid rgba(110, 231, 168, 0.3);
}

.hidden {
  display: none !important;
}

.top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 28px;
}

.badge {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(110, 231, 168, 0.16);
  color: var(--success);
  font-weight: 700;
}

.lobby-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 20px;
}

.card,
.game-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}

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

.players-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.player-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.category-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 4px;
}

.category-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
}

.category-option input {
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  transform: none;
  accent-color: var(--primary);
}

.game-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
}

.role-description {
  font-size: 1.05rem;
  margin-bottom: 0;
  max-width: 560px;
}

.role-source {
  color: var(--primary-strong);
  font-weight: 600;
  margin-bottom: 0;
}

.character-panel {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  text-align: left;
  padding: 8px 0;
}

.character-media {
  width: 180px;
  min-width: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.character-image {
  width: 180px;
  height: 180px;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  padding: 12px;
}

.image-fallback {
  width: 180px;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  color: var(--muted);
  text-align: center;
  padding: 10px;
  font-size: 0.95rem;
}

.character-copy {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
  flex: 1;
}

.character-name {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.character-origin {
  margin: 0;
  color: var(--primary-strong);
  font-weight: 700;
}

.character-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.game-actions {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 8px;
}

.game-actions.single-action {
  grid-template-columns: 1fr;
}

.game-tip {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  width: 100%;
}

@media (max-width: 720px) {
  .panel {
    padding: 20px;
    border-radius: 22px;
  }

  .lobby-grid {
    grid-template-columns: 1fr;
  }

  .category-filters {
    grid-template-columns: 1fr;
  }

  .character-panel {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .character-media,
  .image-fallback {
    width: min(100%, 220px);
    min-width: 0;
    min-height: 160px;
  }

  .character-image {
    width: min(100%, 220px);
    height: 220px;
  }

  .character-copy {
    align-items: center;
  }

  .game-actions {
    grid-template-columns: 1fr;
  }

  .top-row {
    flex-direction: column;
  }

  .btn,
  input {
    font-size: 1rem;
  }
}
