:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: #d2d2d7;
  --soft: #f0f4f6;
  --accent: #087b96;
  --accent-soft: #e3f1f5;
  --accent-text: #ffffff;
  --danger: #c4314b;
  --radius: 18px;
  --radius-sm: 12px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.progress {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 4px;
  background: transparent;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 0 4px 4px 0;
  transition: width 0.3s ease;
}

.shell {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 16px calc(48px + env(safe-area-inset-bottom));
}

.eyebrow {
  margin: 8px 0 4px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

h1 {
  margin: 0 0 12px;
  font-size: 28px;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

h2 {
  margin: 0 0 4px;
  font-size: 22px;
  line-height: 1.35;
}

.lead {
  margin: 0 0 16px;
  color: var(--muted);
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  margin: 0 0 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.card p {
  margin: 0 0 10px;
}

.card p:last-child {
  margin-bottom: 0;
}

.prize {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--accent-soft);
}

.prize svg {
  flex: none;
  width: 28px;
  height: 28px;
  color: var(--accent);
  margin-top: 2px;
}

.meta {
  color: var(--muted);
  font-size: 14px;
}

.page-head {
  margin: 4px 0 16px;
}

.page-intro {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.question {
  scroll-margin-top: 24px;
}

.q-title {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.5;
}

.q-num {
  color: var(--accent);
  margin-right: 6px;
}

.q-hint {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
}

.q-title + .options,
.q-title + .grid,
.q-title + .field {
  margin-top: 12px;
}

.optional-tag {
  margin-left: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.options {
  display: grid;
  gap: 8px;
}

.option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.option .mark {
  flex: none;
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: background 0.15s, border-color 0.15s;
}

.option.checkbox .mark {
  border-radius: 7px;
}

.option .mark svg {
  width: 14px;
  height: 14px;
  color: var(--accent-text);
  opacity: 0;
}

.option.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.option.selected .mark {
  background: var(--accent);
  border-color: var(--accent);
}

.option.selected .mark svg {
  opacity: 1;
}

.option.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.option:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.counter {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.select-wrap {
  position: relative;
}

select,
input[type='text'],
input[type='email'],
textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  font-size: 16px;
  appearance: none;
}

select {
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

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

select:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: var(--accent);
}

.other-input {
  margin-top: 8px;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid-row {
  display: grid;
  gap: 8px;
}

.grid-label {
  font-size: 15px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), 1fr);
  gap: 6px;
}

.segment {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 6px 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  font-size: 14px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.segment input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segment.selected {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

.segment:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.consent {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  cursor: pointer;
}

.error {
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 14px;
}

.question.has-error {
  box-shadow: 0 0 0 1.5px var(--danger);
}

.actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 22px;
  border: none;
  border-radius: 999px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn[disabled] {
  opacity: 0.5;
  cursor: progress;
}

.btn svg {
  width: 18px;
  height: 18px;
}

.btn-primary {
  flex: 1;
  background: var(--accent);
  color: var(--accent-text);
}

.btn-secondary {
  background: #e8e8ed;
  color: var(--text);
}

.share-box {
  display: grid;
  gap: 12px;
}

.share-link {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--soft);
  font-size: 15px;
  word-break: break-all;
  user-select: all;
}

.share-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.share-actions .btn {
  flex: 1;
  min-width: 128px;
  padding: 0 12px;
  font-size: 16px;
  white-space: nowrap;
}

.ref-count {
  font-size: 15px;
}

.ref-count strong {
  color: var(--accent);
  font-size: 22px;
  margin: 0 2px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(29, 29, 31, 0.9);
  color: #fff;
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.toast.show {
  opacity: 1;
}

.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.footer {
  margin-top: 32px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

@media (min-width: 560px) {
  .shell {
    padding-top: 40px;
  }

  h1 {
    font-size: 34px;
  }

  .grid-row {
    grid-template-columns: 1fr 260px;
    align-items: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

.consent-wrap {
  margin-top: 10px;
}
