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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  min-height: 100vh;
  min-height: -webkit-fill-available;
  padding: 24px 16px;
  padding-top: max(24px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  color: #1d1d1f;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  word-break: keep-all;
  overflow-wrap: break-word;
}

html {
  height: -webkit-fill-available;
}

.container {
  max-width: 560px;
  margin: 0 auto;
}

.card {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  padding: 28px 20px;
  margin-bottom: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.card-header {
  text-align: center;
  margin-bottom: 24px;
}

.card-header h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}

.card-header p {
  font-size: 14px;
  color: #6e6e73;
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  color: #1d1d1f;
  margin-bottom: 12px;
}

.question-label {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 10px;
  line-height: 1.6;
}

.question-group {
  margin-bottom: 20px;
}

.radio-group, .checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.radio-option, .checkbox-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1.5px solid #e5e5ea;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 15px;
  line-height: 1.5;
  -webkit-user-select: none;
  user-select: none;
}

.radio-option:active, .checkbox-option:active {
  transform: scale(0.98);
  background: rgba(0, 122, 255, 0.06);
}

.radio-option.selected, .checkbox-option.selected {
  border-color: #007aff;
  background: rgba(0, 122, 255, 0.08);
}

.radio-option input, .checkbox-option input {
  margin-top: 3px;
  min-width: 18px;
  min-height: 18px;
  accent-color: #007aff;
}

textarea {
  width: 100%;
  min-height: 88px;
  border: 1.5px solid #e5e5ea;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 16px;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}

textarea:focus {
  outline: none;
  border-color: #007aff;
}

select {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid #e5e5ea;
  border-radius: 12px;
  font-size: 16px;
  font-family: inherit;
  background: #fff;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236e6e73'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  cursor: pointer;
}

select:focus {
  outline: none;
  border-color: #007aff;
}

.hidden { display: none; }

.path-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 6px;
  margin-bottom: 8px;
}

.path-badge.all { background: #e8f0fe; color: #1a73e8; }
.path-badge.path-a { background: #e6f4ea; color: #1e8e3e; }
.path-badge.path-b { background: #fef3e0; color: #e65100; }

.submit-btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 14px;
  background: #007aff;
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  -webkit-appearance: none;
}

.submit-btn:active { opacity: 0.75; transform: scale(0.98); }
.submit-btn:disabled { opacity: 0.4; cursor: not-allowed; }

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

.success-msg h2 {
  font-size: 20px;
  margin-bottom: 8px;
}

.success-msg p {
  color: #6e6e73;
  font-size: 14px;
}

/* iOS-specific adjustments */
@supports (-webkit-touch-callout: none) {
  select, textarea, input {
    font-size: 16px; /* prevent iOS zoom on focus */
  }
}

@media (max-width: 390px) {
  .card { padding: 24px 16px; }
  .radio-option, .checkbox-option { padding: 12px 14px; }
}

.error-toast {
  position: fixed;
  bottom: max(24px, env(safe-area-inset-bottom, 24px));
  left: 50%;
  transform: translateX(-50%);
  background: #ff3b30;
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  animation: fadeInUp 0.3s ease;
  box-shadow: 0 4px 12px rgba(255, 59, 48, 0.3);
}

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