:root {
  color-scheme: dark;
  --space-1: 0.5rem;
  --space-2: 0.75rem;
  --space-3: 1rem;
  --space-4: 1.25rem;
  --radius: 6px;
  --border: #2a2a2a;
  --muted: #b3b3b3;
  --text: #ffffff;
  --accent: #e50914;
  --accent-press: #b20710;
  --success: #46d369;
  --danger: #ff6b6b;
}

body {
  font-family: "Helvetica Neue", "Segoe UI", Arial, sans-serif;
  margin: 0;
  padding: 1rem;
  padding-bottom: 2.75rem;
  background: #0b0b0b;
  color: var(--text);
}

.hidden {
  display: none;
}

input,
button,
select {
  font-size: 1rem;
  padding: 0.625rem 0.75rem;
  margin: 0.5rem 0;
  width: 100%;
  box-sizing: border-box;
  border-radius: var(--radius);
  min-height: 44px;
}

#lobby,
#movie-entry,
#quiz,
#results {
  max-width: 600px;
  margin: auto;
  background: #0f0f0f;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.15rem 1rem 1rem;
}

.info-card {
  max-width: 600px;
  margin: 0.75rem auto 0;
  background: #0f0f0f;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.15rem 1rem 1rem;
}

.info-card details {
  margin: 0;
}

.info-card summary {
  cursor: pointer;
  font-weight: 700;
  color: #f1f1f1;
  margin: 0;
  padding: 0;
}

h1 {
  margin-top: 0;
  margin-bottom: 0.9rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.lobby-subtitle {
  margin: -0.35rem 0 1rem;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.35;
}

label {
  display: block;
  margin-bottom: 0.25rem;
  color: #e5e5e5;
}

.rules-inline {
  margin: 0.6rem 0 0;
  color: var(--muted);
  line-height: 1.35;
  font-size: 0.92rem;
}

.rules-inline p {
  margin: 0 0 0.4rem;
}

.rules-inline p:last-child {
  margin-bottom: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  background: rgba(20, 20, 20, 0.9);
}

th,
td {
  border: 1px solid var(--border);
  padding: 0.5rem;
  text-align: left;
}

th {
  background: linear-gradient(180deg, #222 0%, #191919 100%);
  color: #f5f5f5;
}

th:last-child,
td:last-child {
  text-align: center;
}

button {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-press) 100%);
  color: #fff;
  border: 1px solid #7a0d12;
  cursor: pointer;
  font-weight: 700;
  transition: filter 140ms ease, transform 120ms ease;
}

button:hover:not(:disabled) {
  filter: brightness(1.07);
  transform: translateY(-1px);
}

button:disabled {
  background: #2e2e2e;
  color: #8f8f8f;
  border-color: #3c3c3c;
  cursor: not-allowed;
}

input,
select {
  background: #2b2b2b;
  color: #fff;
  border: 1px solid #5c5c5c;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(229, 9, 20, 0.35);
}

.error-text {
  color: var(--danger);
}

.quiz-movie {
  margin: 0 0 var(--space-3);
  color: #d6d6d6;
  font-size: 1.1rem;
  font-weight: 650;
}

.quiz-fields {
  margin: 0;
  padding-left: 1.25rem;
}

.quiz-fields li {
  margin-bottom: var(--space-3);
}

.quiz-fields label {
  margin-bottom: var(--space-1);
  font-weight: 600;
}

.field-error {
  margin-top: 0.35rem;
  margin-bottom: 0;
  font-size: 0.85rem;
  color: var(--danger);
  min-height: 1em;
}

.site-meta {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  color: #8f8f8f;
  background: rgba(0, 0, 0, 0.92);
  border-top: 1px solid var(--border);
  text-align: center;
  z-index: 1000;
}

.mark-correct {
  color: var(--success);
  font-weight: 700;
}

.mark-incorrect {
  color: var(--danger);
  font-weight: 700;
}

.movie-link {
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.movie-link:hover {
  color: #ffdbdd;
}

.results-cards {
  display: none;
}

.result-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #121212;
  padding: 0.75rem;
  margin: 0.65rem 0;
}

.result-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.result-card-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.3rem 0;
  font-size: 0.95rem;
}

.result-card-key {
  color: var(--muted);
  flex: 0 0 auto;
}

.result-card-value {
  text-align: right;
  flex: 1 1 auto;
  word-break: break-word;
}

#searchResults {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.search-options {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.search-option {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  background: #141414;
  cursor: pointer;
}

.search-option:hover {
  border-color: #4a4a4a;
  background: #181818;
}

.search-option input[type="radio"] {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
  min-height: 0;
  accent-color: var(--accent);
}

.search-option.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(229, 9, 20, 0.35);
  background: #1a1213;
}

.search-option-title {
  font-weight: 650;
  line-height: 1.25;
  word-break: break-word;
}

.search-option-meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

@media (max-width: 600px) {
  body {
    padding: 0.75rem;
    padding-bottom: 2.75rem;
  }

  #lobby,
  #movie-entry,
  #quiz,
  #results {
    padding: 0.95rem 0.8rem 0.8rem;
    border-radius: 8px;
  }

  .info-card {
    margin-top: 0.6rem;
    padding: 0.95rem 0.8rem 0.8rem;
    border-radius: 8px;
  }

  h1 {
    font-size: 2rem;
    line-height: 1.1;
    margin-bottom: 0.75rem;
  }

  label {
    font-size: 0.97rem;
    line-height: 1.35;
  }

  .quiz-movie {
    font-size: 1rem;
  }

  .quiz-fields {
    padding-left: 1rem;
  }

  .quiz-fields li {
    margin-bottom: 0.85rem;
  }

  .site-meta {
    font-size: 0.68rem;
  }

  #results table {
    display: none;
  }

  .results-cards {
    display: block;
  }
}
