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

:root {
  --bg: #f4f1ec;
  --surface: #fffdf9;
  --border: #d6cfc4;
  --border-focus: #2a5c8f;
  --text: #1a1612;
  --text-muted: #7a7167;
  --accent: #2a5c8f;
  --accent-light: #e8f0f8;
  --error: #c0392b;
  --error-bg: #fdf0ee;
  --success: #1a7a4a;
  --success-bg: #e8f5ee;
  --radio-active: #2a5c8f;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Microsoft JhengHei', '微軟正黑體', 'PingFang TC', 'Heiti TC', sans-serif;
  font-weight: 400;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 16px;
}

.page-wrap {
  width: 100%;
  max-width: 680px;
}

.page-header {
  margin-bottom: 40px;
}

.page-header .label {
  font-family: 'Courier New', 'Courier', monospace;
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.page-header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.page-header .subtitle {
  margin-top: 8px;
  font-size: 14px;
  color: var(--text-muted);
}

.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.06);
}

.form-section {
  margin-bottom: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.form-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.section-title {
  font-family: 'Courier New', 'Courier', monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.field {
  margin-bottom: 20px;
}

.field:last-child { margin-bottom: 0; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}

label .req {
  color: var(--accent);
  margin-left: 2px;
  font-weight: 700;
}

input[type="text"],
input[type="tel"],
input[type="email"],
textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  background: #fff;
  font-family: 'Microsoft JhengHei', '微軟正黑體', 'PingFang TC', sans-serif;
  font-size: 14px;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  -webkit-appearance: none;
}

input:focus, textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(42,92,143,0.1);
}

input.error, textarea.error {
  border-color: var(--error);
  background: var(--error-bg);
}

textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

.field-error {
  font-size: 12px;
  color: var(--error);
  margin-top: 5px;
  display: none;
}

.field-error.show { display: block; }

/* Radio group */
.radio-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.radio-item {
  position: relative;
}

.radio-item input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
}

.radio-item label {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 400;
  text-align: center;
  background: #fff;
  transition: all 0.15s;
  margin-bottom: 0;
  line-height: 1.3;
}

.radio-item input:checked + label {
  border-color: var(--radio-active);
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 500;
}

.radio-item label:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.radio-item input:focus-visible + label {
  box-shadow: 0 0 0 3px rgba(42,92,143,0.2);
}

/* Submit */
.submit-area { margin-top: 32px; }

.btn-submit {
  width: 100%;
  padding: 13px 24px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: 'Microsoft JhengHei', '微軟正黑體', 'PingFang TC', sans-serif;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  position: relative;
}

.btn-submit:hover { background: #1f4a73; box-shadow: 0 4px 12px rgba(42,92,143,0.3); }
.btn-submit:active { transform: translateY(1px); }
.btn-submit:disabled { background: #b0bec5; cursor: not-allowed; box-shadow: none; }

.btn-submit .spinner {
  display: none;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto;
}

.btn-submit.loading .btn-text { display: none; }
.btn-submit.loading .spinner { display: block; }

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

/* Alert */
.alert {
  display: none;
  padding: 14px 18px;
  border-radius: 8px;
  font-size: 14px;
  margin-top: 16px;
  border: 1px solid transparent;
}

.alert.show { display: block; }
.alert.success { background: var(--success-bg); color: var(--success); border-color: #b2dfcc; }
.alert.error { background: var(--error-bg); color: var(--error); border-color: #f5c6c0; }

.alert strong { display: block; font-weight: 600; margin-bottom: 4px; }

@media (max-width: 520px) {
  .form-card { padding: 24px 20px; }
  .field-row { grid-template-columns: 1fr; }
  .radio-grid { grid-template-columns: 1fr 1fr; }
}
