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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #fafafa;
  color: #1a1a1a;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
}

.container {
  max-width: 480px;
  width: 100%;
  padding: 2rem 1.5rem;
  padding-left: max(1.5rem, env(safe-area-inset-left));
  padding-right: max(1.5rem, env(safe-area-inset-right));
  text-align: center;
}

.title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.logo {
  width: 4rem;
  height: 4rem;
}

h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.subtitle {
  font-size: 0.85rem;
  color: #595959;
  margin-bottom: 2rem;
}

.prompt {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 2rem;
  line-height: 1.3;
}

.input-group {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 2px solid #ddd;
  border-radius: 8px;
  outline: none;
  text-align: center;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

input[type="text"]:focus-visible {
  border-color: #4c8244;
  outline: 3px solid #4c8244;
  outline-offset: -1px;
}

button.submit {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  background: #4c8244;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.2s;
  -webkit-appearance: none;
  appearance: none;
  min-height: 44px;
}

button.submit:focus-visible {
  outline: 3px solid #1a1a1a;
  outline-offset: 2px;
}

button.submit:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.your-answer {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.your-answer strong {
  background: #4c8244;
  color: white;
  padding: 0.15rem 0.6rem;
  border-radius: 4px;
}

.percentage {
  font-size: 2.5rem;
  font-weight: 800;
  color: #4c8244;
  margin: 1rem 0 0.25rem;
}

.percentage-label {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 1rem;
}

.distribution {
  text-align: left;
  margin-top: 2rem;
}

.dist-row {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
  gap: 0.5rem;
}

.dist-label {
  width: 80px;
  flex-shrink: 0;
  font-size: 0.85rem;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dist-track {
  flex: 1;
  min-width: 0;
}

.dist-bar {
  height: 28px;
  background: #ddd;
  border-radius: 4px;
  min-width: 4px;
  transition: width 0.6s ease;
}

.dist-bar.yours {
  background: #4c8244;
}

.dist-count {
  font-size: 0.8rem;
  color: #595959;
  min-width: 30px;
}

button.share {
  padding: 0.75rem 2rem;
  font-size: 1rem;
  font-weight: 700;
  background: #1a1a1a;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 1rem;
  -webkit-appearance: none;
  appearance: none;
  min-height: 44px;
}

button.share:hover {
  background: #333;
}

button.share:focus-visible {
  outline: 3px solid #1a1a1a;
  outline-offset: 2px;
}

.toast {
  position: fixed;
  top: 1rem;
  background: #1a1a1a;
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-size: 0.9rem;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
}

.countdown {
  font-size: 0.85rem;
  color: #595959;
  margin-top: 1rem;
}

.error {
  color: #d32f2f;
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

.hidden {
  display: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

@media (max-width: 360px) {
  .container {
    padding: 1.5rem 1rem;
  }

  .prompt {
    font-size: 1.25rem;
  }

  .dist-label {
    width: 60px;
    font-size: 0.8rem;
  }
}
