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

body { font-family: Arial, sans-serif; margin: 0; padding: 0; background-color: #f0f4ff; }

header { background-color: #5b9bd5; color: white; }

.header-inner {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  gap: 12px;
  flex-wrap: wrap;
}

.back-btn {
  display: inline-block;
  background: rgba(255,255,255,0.2);
  color: white;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 0.875rem;
  font-weight: bold;
  white-space: nowrap;
  flex-shrink: 0;
}
.back-btn:hover, .back-btn:active { background: rgba(255,255,255,0.35); }

.header-inner h1 {
  margin: 0;
  font-size: clamp(1rem, 4vw, 1.5rem);
  flex: 1;
  text-align: center;
}

@media (max-width: 400px) {
  .header-inner { flex-direction: column; align-items: flex-start; }
  .header-inner h1 { text-align: left; }
}

/* Container — stacks on mobile */
.container {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  padding: 16px;
}

.survey-form, .preview {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.07);
  flex: 1 1 280px;
  min-width: 0;
  max-width: 460px;
  width: 100%;
}

form { display: flex; flex-direction: column; }
label { font-weight: bold; margin-top: 12px; }

input, select, textarea {
  width: 100%;
  margin-bottom: 6px;
  padding: 12px;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
  background: white;
}

textarea { resize: vertical; min-height: 80px; }

button {
  margin-top: 10px;
  padding: 14px;
  background-color: #5b9bd5;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: bold;
  width: 100%;
  touch-action: manipulation;
}
button:disabled { background-color: #ccc; cursor: not-allowed; }
button:hover:not(:disabled), button:active:not(:disabled) { background-color: #4a87bf; }

.error { color: red; font-size: 13px; display: none; margin-bottom: 6px; }

.preview { display: flex; flex-direction: column; gap: 16px; }
.preview h2 { margin-top: 0; }
.preview-box {
  background: #f0f6ff;
  border-radius: 8px;
  padding: 14px 18px;
  border: 1px solid #cce0f5;
  font-size: 0.95rem;
  line-height: 1.8;
  word-break: break-word;
}

.responses {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px 40px;
}
.responses h2 { margin-bottom: 12px; }

.response-card {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.07);
}

table { width: 100%; border-collapse: collapse; min-width: 440px; }
th, td { border: 1px solid #dde8f5; padding: 10px 14px; text-align: left; font-size: 0.9rem; }
th { background-color: #5b9bd5; color: white; }
tr:nth-child(even) td { background-color: #f5f9ff; }
