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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 18px;
  line-height: 1.6;
  color: #1a1a1a;
  background: #f5f5f0;
  min-height: 100dvh;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

header {
  text-align: center;
  padding: 16px 0;
  border-bottom: 2px solid #e0e0e0;
  margin-bottom: 24px;
}

header h1 {
  font-size: 22px;
  font-weight: 700;
  color: #2c2c2c;
  margin-bottom: 8px;
}

.progress {
  font-size: 14px;
  color: #666;
  font-weight: 500;
}

main {
  flex: 1;
  overflow-y: auto;
}

.welcome {
  text-align: center;
  padding: 64px 16px;
}

.welcome-heading {
  font-size: 24px;
  font-weight: 700;
  color: #2c2c2c;
  margin-bottom: 12px;
}

.welcome-sub {
  font-size: 16px;
  color: #999;
}

.welcome.hidden {
  display: none;
}

.story {
  display: none;
  padding: 8px 0;
}

.story.active {
  display: block;
}

.story-text {
  opacity: 0;
  transition: opacity 0.4s ease-in;
  white-space: pre-wrap;
}

.story-text.visible {
  opacity: 1;
}

.loading {
  display: none;
  text-align: center;
  padding: 48px 0;
  color: #666;
}

.loading.active {
  display: block;
}

.preparing {
  display: none;
  text-align: center;
  padding: 48px 0;
  color: #999;
}

.preparing.active {
  display: block;
}

.waiting {
  display: none;
  text-align: center;
  padding: 48px 0;
  color: #999;
  font-style: italic;
}

.waiting.active {
  display: block;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e0e0e0;
  border-top-color: #333;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

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

.vote-buttons {
  display: none;
  justify-content: center;
  gap: 32px;
  padding: 24px 0;
}

.vote-buttons.active {
  display: flex;
}

.vote-btn {
  font-size: 40px;
  width: 72px;
  height: 72px;
  border: 2px solid #e0e0e0;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}

.vote-btn:active {
  transform: scale(0.92);
}

.vote-btn:focus-visible {
  outline: 2px solid #333;
  outline-offset: 2px;
}

.vote-btn.selected {
  border-color: #333;
  transform: scale(1.1);
}

.vote-btn.dimmed {
  opacity: 0.3;
}

@media (max-width: 400px) {
  body {
    font-size: 16px;
  }

  header h1 {
    font-size: 18px;
  }

  .container {
    padding: 12px;
  }
}
