:root {
  color-scheme: light dark;
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  background: #f4f4f8;
  color: #1a1a1a;
}

.app {
  width: 100%;
  max-width: 480px;
  padding: 2rem 1.5rem;
  text-align: center;
}

h1 {
  margin-bottom: 1.5rem;
}

.view {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

button {
  font-size: 1rem;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
}

button:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

button:hover:not(:disabled) {
  background: #1d4ed8;
}

.join-row {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

input[type="text"] {
  padding: 0.6rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  width: 8rem;
  text-transform: uppercase;
  font-size: 1rem;
  background: #fff;
  color: #1a1a1a;
}

.error {
  color: #dc2626;
  margin-top: 1rem;
}

#lobby-code {
  font-size: 1.4rem;
  letter-spacing: 0.1em;
}

#choice-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

#choice-form[hidden] {
  display: none;
}

.choice {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.4rem;
  width: 10rem;
}

.choice input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.choice:has(input:checked) {
  border-color: #2563eb;
  background: #eff6ff;
}

.choice:has(input:focus-visible) {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

#result-panel {
  margin-top: 1.5rem;
}

#result-text {
  font-size: 1.2rem;
  font-weight: 600;
}

#history-view {
  margin-top: 1.5rem;
  text-align: left;
}

#history-view h2 {
  font-size: 1rem;
  margin: 0 0 0.5rem;
}

#history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 12rem;
  overflow-y: auto;
}

#history-list li {
  padding: 0.4rem 0;
  border-bottom: 1px solid #eee;
}

.leave-link {
  display: block;
  margin: 1.5rem auto 0;
  padding: 0;
  background: none;
  color: #9ca3af;
  font-size: 0.85rem;
  text-decoration: underline;
}

.leave-link[hidden] {
  display: none;
}

.leave-link:hover:not(:disabled) {
  background: none;
  color: #6b7280;
}
