:root{
  --ink:#111;
  --muted:#7a7a7a;
  --bg:#ffffff;
  --card:#ffffff;
  --line:#dfe7e5;

  --mint:#43bfa6;
  --mint-2:#2ea98b;
  --mint-weak:rgba(67,191,166,.22);
  --dash:rgba(67,191,166,.6);

  --row:#f2f4f5;
}

*{ box-sizing:border-box; }
body{
  margin:0;
  font-family: system-ui, -apple-system, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  background:var(--bg);
  color:var(--ink);
  line-height:1.45;
}

.wrap{
  max-width: 820px;
  margin: 28px auto 60px;
  padding: 0 16px;
}

.header{
  padding: 8px 2px 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
.header h1{
  margin:0 0 6px;
  font-size: 22px;
  font-weight: 800;
}
.header p{
  margin:0;
  color:var(--muted);
  font-size: 14px;
}

form{
  display:flex;
  flex-direction:column;
  gap: 18px;
}

form.is-locked .q:not(#q9){
  opacity: 0.7;
  pointer-events: none;
}
form.is-locked .q:not(#q9) input,
form.is-locked .q:not(#q9) textarea,
form.is-locked .q:not(#q9) select{
  pointer-events: none;
}

.q{
  background: var(--card);
  border-radius: 14px;
  padding: 18px 16px;
  border: 1px solid var(--line);
}

.qhead{
  display:flex;
  gap: 10px;
  align-items:flex-start;
  margin-bottom: 10px;
}
.qnum{
  min-width: 28px;
  font-weight: 800;
  font-size: 18px;
}
.qtitle{
  font-weight: 800;
  font-size: 18px;
}
.req{
  color: #ff8a00;
  margin-left: 6px;
  font-weight: 900;
}
.help{
  margin: 8px 0 0;
  color:var(--muted);
  font-size: 13px;
}
.help.error{
  color:#b10000;
  background:#ffe9e9;
  border:1px solid #ffb3b3;
  padding: 8px 10px;
  border-radius: 8px;
  font-weight: 700;
}
.help.success{
  color:#0d5a3a;
  background:#e5f6ef;
  border:1px solid #9edbc6;
  padding: 8px 10px;
  border-radius: 8px;
  font-weight: 700;
}

/* Choice blocks (radio list like screenshots) */
.choices{
  display:flex;
  flex-direction:column;
  gap: 10px;
  margin-top: 12px;
}
.choice{
  border: 2px dashed var(--dash);
  border-radius: 10px;
  padding: 12px 14px;
  display:flex;
  align-items:center;
  gap: 12px;
  cursor:pointer;
  user-select:none;
}
.choice:hover{ background: var(--mint-weak); }
.choice input[type="radio"]{
  width: 18px;
  height: 18px;
  accent-color: var(--mint-2);
  flex: 0 0 auto;
}
.choice span{
  color: var(--mint-2);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: .2px;
}

/* Text inputs (underline style) */
.field{ margin-top: 12px; }
.field input{
  width: 100%;
  border: none;
  border-bottom: 2px solid rgba(67,191,166,.55);
  padding: 12px 2px 10px;
  font-size: 16px;
  outline: none;
}
.field input:focus{ border-bottom-color: var(--mint-2); }
.field input:disabled{
  background: #f3f4f4;
  color: #777;
  cursor: not-allowed;
}
.is-hidden{ display:none; }

/* ===== Q13 Desktop matrix ===== */
.matrix-wrap{
  margin-top: 14px;
  overflow:auto;
  border-radius: 12px;
  border: 1px solid var(--line);
}
table.matrix{
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 640px;
  background: #fff;
}
.matrix thead th{
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align:center;
  white-space: nowrap;
}
.matrix thead th:first-child{
  text-align:left;
  padding-left: 12px;
}
.matrix tbody td,
.matrix tbody th{
  border-bottom: 1px solid var(--line);
  padding: 12px 8px;
  font-size: 14px;
}
.matrix tbody tr:nth-child(odd){ background: #f3f5f6; }
.matrix tbody th{
  text-align:left;
  font-weight: 700;
  padding-left: 12px;
  white-space: nowrap;
}
.matrix td{
  text-align:center;
  width: 70px;
}
.matrix input[type="radio"]{
  width: 18px;
  height: 18px;
  accent-color: var(--mint-2);
}

/* ===== Q13 Mobile stacked style ===== */
.q7-mobile{ display:none; margin-top: 14px; }
.q7-item{ margin-top: 16px; }
.q7-item:first-child{ margin-top: 0; }
.q7-item-title{
  font-weight: 800;
  font-size: 18px;
  margin: 0 0 10px;
}
.q7-pill{
  display:flex;
  align-items:center;
  gap: 12px;
  background: var(--row);
  border-radius: 6px;
  padding: 14px 14px;
  margin: 10px 0;
}
.q7-pill input[type="radio"]{
  width: 20px;
  height: 20px;
  accent-color: var(--mint-2);
  flex: 0 0 auto;
}
.q7-pill span{
  font-size: 18px;
  font-weight: 700;
  color: #666;
}

/* RWD switch (手機顯示附圖風格) */
@media (max-width: 640px){
  .matrix-wrap{ display:none; }
  .q7-mobile{ display:block; }
  .actions{
    flex-direction: column;
  }
  .actions button{
    width: 100%;
  }
}

.actions{
  display:flex;
  justify-content:flex-end;
  gap: 10px;
  margin-top: 6px;
}
button{
  border: none;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--mint-2);
  color:#fff;
  font-weight: 800;
  cursor:pointer;
}
button.is-loading{
  position: relative;
}
button.is-loading::after{
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-left: 8px;
  border: 2px solid rgba(255,255,255,0.6);
  border-top-color: #fff;
  border-radius: 50%;
  vertical-align: -3px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin{
  to { transform: rotate(360deg); }
}
button:disabled{
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(.2);
}
button.secondary{
  background:#e9f7f3;
  color: var(--mint-2);
}
.actions .secondary[type="reset"]{
  background:#efe2ff;
  color:#5a22b7;
}
button:hover{ filter: brightness(.98); }

/* Thank you page */
.thankyou-head{
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}
.thankyou-head .qnum{
  font-size: 36px;
  color: var(--mint-2);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--mint-2);
  border: 2px solid var(--mint-2);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.thankyou-status{
  text-align:center;
  font-size: 24px;
  font-weight: 900;
  color: var(--mint-2);
  background: #e9f7f3;
  border: 2px dashed var(--dash);
  border-radius: 12px;
  padding: 12px 16px;
  width: 100%;
}
.status-error{
  background: #ffe9e9;
  border-color: #ffb3b3;
  color: #b10000;
}
.thankyou-head .qnum.status-error{
  background: #b10000;
  border-color: #b10000;
  color: #fff;
}
button.status-error{
  background: #ffe9e9;
  border: 2px solid #ffb3b3;
  color: #b10000;
}
@media (max-width: 640px){
  .thankyou-status{
    font-size: 22px;
  }
}
