:root {
  --cream: #F7F4EE;
  --burgundy: #5C2635;
  --dark: #211E1A;
  --soft-line: #D4C9BE;
  --white: #FFFFFF;
  --shadow: rgba(33, 30, 26, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', 'Geist', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--cream);
  color: var(--dark);
  line-height: 1.6;
  min-height: 100vh;
}

h1, h2, h3, h4 {
  font-family: 'Instrument Serif', Georgia, serif;
  font-weight: 400;
  color: var(--burgundy);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--burgundy);
  color: var(--white);
}

.btn-primary:hover {
  background: #4a1f2b;
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--white);
  color: var(--burgundy);
  border: 2px solid var(--burgundy);
}

.btn-secondary:hover {
  background: var(--burgundy);
  color: var(--white);
}

.btn-ghost {
  background: transparent;
  color: var(--dark);
}

.btn-ghost:hover {
  background: var(--soft-line);
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.input-group label {
  font-size: 14px;
  font-weight: 500;
  color: var(--dark);
}

.input-group input {
  padding: 14px 16px;
  border: 2px solid var(--soft-line);
  border-radius: 8px;
  font-size: 16px;
  background: var(--white);
  transition: border-color 0.2s;
}

.input-group input:focus {
  outline: none;
  border-color: var(--burgundy);
}

.card {
  background: var(--white);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 20px var(--shadow);
  max-width: 480px;
  width: 100%;
}

.screen {
  display: none;
  min-height: 100vh;
  padding: 24px 16px;
}

.screen.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.logo {
  font-size: 32px;
  margin-bottom: 8px;
}

.tagline {
  font-size: 16px;
  color: var(--dark);
  opacity: 0.7;
  margin-bottom: 40px;
  text-align: center;
}

.room-code {
  font-family: 'Geist Mono', monospace;
  font-size: 36px;
  letter-spacing: 8px;
  color: var(--burgundy);
  background: var(--cream);
  padding: 16px 32px;
  border-radius: 12px;
  border: 2px dashed var(--soft-line);
  margin: 20px 0;
}

.player-list {
  list-style: none;
  width: 100%;
  max-width: 320px;
}

.player-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--cream);
  border-radius: 8px;
  margin-bottom: 8px;
}

.player-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--burgundy);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

.question-card {
  text-align: center;
}

.question-text {
  font-size: 22px;
  margin-bottom: 24px;
  line-height: 1.4;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-btn {
  text-align: left;
  padding: 16px 20px;
  background: var(--white);
  border: 2px solid var(--soft-line);
  border-radius: 12px;
  font-size: 16px;
  transition: all 0.2s;
}

.option-btn:hover:not(:disabled) {
  border-color: var(--burgundy);
  background: #FFF8F9;
}

.option-btn.selected {
  border-color: var(--burgundy);
  background: #FFF0F3;
}

.option-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.option-btn.correct {
  border-color: #27AE60;
  background: #E8F8F0;
}

.option-btn.incorrect {
  border-color: #E74C3C;
  background: #FDF0F0;
}

.results {
  text-align: center;
}

.punchline {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 20px;
  color: var(--burgundy);
  margin: 24px 0;
  padding: 20px;
  background: #FFF8F9;
  border-radius: 12px;
  border-left: 4px solid var(--burgundy);
}

.distribution {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 24px 0;
}

.dist-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dist-label {
  width: 60px;
  font-size: 14px;
  text-align: right;
}

.dist-track {
  flex: 1;
  height: 12px;
  background: var(--soft-line);
  border-radius: 6px;
  overflow: hidden;
}

.dist-fill {
  height: 100%;
  background: var(--burgundy);
  border-radius: 6px;
  transition: width 0.5s ease;
}

.dist-count {
  width: 40px;
  font-weight: 600;
  font-size: 14px;
}

.waiting {
  text-align: center;
  padding: 40px 20px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--soft-line);
  border-top-color: var(--burgundy);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.share-btns {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(33, 30, 26, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--white);
  border-radius: 16px;
  padding: 24px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(33, 30, 26, 0.2);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-title {
  font-size: 18px;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--dark);
  opacity: 0.5;
  padding: 0;
  line-height: 1;
}

.modal-close:hover {
  opacity: 1;
}

/* Toast Animations */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  to {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
}