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

[hidden] { display: none !important; }

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: #f4f5f7;
  color: #1f2329;
  line-height: 1.6;
  touch-action: manipulation;
}

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 12px 12px 60px;
}

body.on-welcome .page { max-width: none; padding: 0; }

.welcome-screen {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: flex-start;
  overflow: hidden;
  background: #f6f5f1;
  color: #1f2329;
  padding: 40px 26px;
}
.ws-deco {
  position: absolute;
  top: 11vh;
  right: 26px;
  pointer-events: none;
  animation: ws-in 0.6s ease 0.35s both;
}
.ws-deco-card {
  display: block;
  width: 88px;
  height: 64px;
  border: 1.5px solid #d8d5cd;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.55);
  transform: rotate(7deg);
  position: relative;
}
.ws-deco-card::after {
  content: '';
  position: absolute;
  right: 10px;
  top: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2563eb;
}
.ws-deco-time {
  position: absolute;
  right: 2px;
  bottom: -22px;
  font-family: ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: #a3a099;
}
.ws-grid {
  position: absolute;
  inset: 0 0 auto 0;
  height: 42%;
  background-image: radial-gradient(rgba(20, 20, 20, 0.12) 1px, transparent 1.4px);
  background-size: 20px 20px;
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent);
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent);
  pointer-events: none;
}

.ws-content {
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: 10vh auto 0;
  text-align: left;
}

.ws-visual {
  position: relative;
  height: 118px;
  margin-bottom: 6px;
}
.ws-card {
  position: absolute;
  left: 2px;
  top: 4px;
  width: 152px;
  height: 102px;
  background: #fff;
  border: 1px solid #e7e5df;
  border-radius: 14px;
  box-shadow: 0 14px 32px rgba(20, 20, 20, 0.10);
  padding: 14px;
  animation: ws-card-in 0.7s cubic-bezier(0.2, 0.7, 0.3, 1.25) both, ws-bob 5s ease-in-out 1.2s infinite;
}
@keyframes ws-card-in {
  from { opacity: 0; transform: rotate(-12deg) translateY(16px); }
  to { opacity: 1; transform: rotate(-5deg) translateY(0); }
}
@keyframes ws-bob {
  0%, 100% { transform: rotate(-5deg) translateY(0); }
  50% { transform: rotate(-5deg) translateY(-6px); }
}
.ws-card-play {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.35);
}
.ws-card-play svg { width: 15px; height: 15px; margin-left: 2px; }
.ws-card-line {
  display: block;
  height: 7px;
  border-radius: 4px;
  background: #edebe5;
  margin-top: 8px;
}
.ws-rec {
  position: absolute;
  left: 122px;
  top: 0;
  background: #141414;
  color: #fff;
  font-size: 10px;
  letter-spacing: 1.5px;
  padding: 5px 9px;
  border-radius: 7px;
  display: flex;
  gap: 6px;
  align-items: center;
  font-family: ui-monospace, monospace;
  box-shadow: 0 6px 14px rgba(20, 20, 20, 0.25);
  animation: ws-in 0.5s ease 0.5s both;
}
.ws-rec i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ef4444;
  animation: ws-blink 1.2s steps(1) infinite;
}

.ws-eyebrow {
  font-size: 12px;
  letter-spacing: 2px;
  color: #6b7280;
  margin: 14px 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: ws-in 0.5s ease 0.15s both;
}
.ws-eyebrow::before {
  content: '';
  width: 26px;
  height: 2px;
  background: #2563eb;
  flex-shrink: 0;
}
.ws-content h1 {
  font-size: 29px;
  line-height: 1.35;
  color: #141414;
  margin-bottom: 18px;
  animation: ws-in 0.5s ease 0.28s both;
}
.ws-hl {
  background: linear-gradient(transparent 62%, rgba(37, 99, 235, 0.30) 62%);
  padding: 0 2px;
}
@keyframes ws-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.ws-desc {
  font-size: 14px;
  line-height: 1.95;
  color: #52525b;
  margin-bottom: 28px;
  min-height: 10em;
}
.ws-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: #2563eb;
  margin-left: 2px;
  vertical-align: -0.12em;
  animation: ws-blink 0.9s steps(1) infinite;
}
@keyframes ws-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}
.ws-fade {
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.5s ease, transform 0.5s ease, visibility 0.5s;
}
.ws-fade.show {
  opacity: 1;
  visibility: visible;
  transform: none;
}
.ws-cta {
  width: 100%;
  padding: 15px 15px 15px 22px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: #2563eb;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.32);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: transform 0.15s, opacity 0.5s ease, visibility 0.5s;
}
.ws-cta:active { transform: scale(0.97); }
.ws-cta-arrow {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: transform 0.2s;
}
.ws-cta:hover .ws-cta-arrow { transform: translateX(3px); }
.ws-meta {
  margin-top: 16px;
  font-size: 12px;
  color: #9ca3af;
  text-align: center;
  letter-spacing: 1px;
}

.section {
  background: #fff;
  border-radius: 12px;
  padding: 20px 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.section-title {
  font-size: 17px;
  font-weight: 600;
  color: #1d4ed8;
  padding-bottom: 12px;
  margin-bottom: 8px;
  border-bottom: 1px solid #eef0f3;
}

.question { padding: 16px 0; }
.section > .question:first-child { padding-top: 0; }
.section > .question:last-child { padding-bottom: 0; }
.question + .question { border-top: 1px dashed #eef0f3; }
.question-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
}
.question-title .qno { color: #1d4ed8; margin-right: 6px; }
.question-title .required { color: #dc2626; margin-left: 4px; }
.question-title .hint { font-weight: 400; color: #6b7280; font-size: 13px; }

.option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.option:hover { border-color: #93c5fd; }
.option.checked { border-color: #2563eb; background: #eff6ff; }
.option.disabled { opacity: 0.45; cursor: not-allowed; }
.option input[type="radio"], .option input[type="checkbox"] {
  margin-top: 5px;
  accent-color: #2563eb;
  flex-shrink: 0;
}
.option .opt-label { flex: 1; font-size: 14px; }

.fill-input {
  width: 100%;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 16px;
  font-family: inherit;
}
.fill-input:focus { outline: none; border-color: #2563eb; }

.rank-list { display: flex; flex-direction: column; gap: 8px; }
.rank-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-size: 14px;
}
.rank-item:hover { border-color: #93c5fd; }
.rank-item.ranked { border-color: #2563eb; background: #eff6ff; }
.rank-badge {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px dashed #d1d5db;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #9ca3af;
  flex-shrink: 0;
}
.rank-item.ranked .rank-badge {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}
.rank-actions { margin-top: 10px; }
.btn-link {
  background: none;
  border: none;
  color: #2563eb;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
}

textarea.text-answer {
  width: 100%;
  min-height: 100px;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  resize: vertical;
}
textarea.text-answer:focus { outline: none; border-color: #2563eb; }

.progress-wrap {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #f4f5f7;
  padding: 12px 0;
  margin-bottom: 16px;
}
.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 8px;
}
.progress-info #progress-section-title { font-weight: 600; color: #1d4ed8; }
.progress-track {
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: #2563eb;
  border-radius: 3px;
  width: 0;
  transition: width 0.3s ease;
}

.nav-bar {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}
.btn-secondary {
  flex: 1;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 14px 0;
  font-size: 16px;
  color: #374151;
  cursor: pointer;
}
.btn-secondary:hover { border-color: #2563eb; color: #2563eb; }
.nav-bar .btn-primary { flex: 2; }
.btn-primary {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 14px 24px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover { background: #1d4ed8; }
.btn-primary:disabled { background: #9ca3af; cursor: not-allowed; }

.form-error {
  color: #dc2626;
  font-size: 14px;
  margin-top: 16px;
  text-align: center;
}

.success {
  position: fixed;
  inset: 0;
  background: #f6f5f1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 10;
  padding: 32px;
  overflow: hidden;
}
.success-inner {
  max-width: 420px;
  text-align: center;
  margin-top: 24vh;
  position: relative;
}
.sc-badge {
  width: 88px;
  height: 88px;
  margin: 0 auto 26px;
  animation: sc-pop 0.5s cubic-bezier(0.2, 0.7, 0.3, 1.4) both;
}
@keyframes sc-pop {
  from { opacity: 0; transform: scale(0.5); }
  to { opacity: 1; transform: scale(1); }
}
.sc-badge svg { width: 100%; height: 100%; }
.sc-circle {
  fill: none;
  stroke: #22c55e;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 151;
  stroke-dashoffset: 151;
  animation: sc-draw 0.6s ease 0.15s forwards;
}
.sc-check {
  fill: none;
  stroke: #22c55e;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 36;
  stroke-dashoffset: 36;
  animation: sc-draw 0.35s ease 0.65s forwards;
}
@keyframes sc-draw {
  to { stroke-dashoffset: 0; }
}
.sc-title {
  font-size: 24px;
  color: #141414;
  margin-bottom: 14px;
  animation: ws-in 0.5s ease 0.8s both;
}
.sc-text {
  font-size: 14px;
  line-height: 1.9;
  color: #52525b;
  margin-bottom: 22px;
  animation: ws-in 0.5s ease 0.95s both;
}
.sc-no {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 1px;
  color: #2563eb;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.22);
  border-radius: 999px;
  padding: 7px 16px;
  animation: ws-in 0.5s ease 1.1s both;
}

.question.highlight { animation: flash 1.2s; }
@keyframes flash {
  0%, 60% { background: #fef2f2; }
  100% { background: transparent; }
}

/* ---- admin ---- */
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.admin-header h1 { font-size: 20px; }
.admin-header .count { color: #6b7280; font-size: 14px; }

.response-table {
  width: 100%;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  border-collapse: collapse;
}
.response-table th, .response-table td {
  padding: 12px 16px;
  text-align: left;
  font-size: 14px;
  border-bottom: 1px solid #f1f2f4;
}
.response-table th { background: #f9fafb; color: #6b7280; font-weight: 600; }
.response-table tbody tr { cursor: pointer; }
.response-table tbody tr:hover { background: #eff6ff; }

.empty-state {
  background: #fff;
  border-radius: 12px;
  padding: 60px 20px;
  text-align: center;
  color: #6b7280;
}

.detail-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.detail-meta {
  color: #6b7280;
  font-size: 14px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #eef0f3;
}
.detail-q { padding: 12px 0; border-bottom: 1px dashed #f1f2f4; }
.detail-q:last-child { border-bottom: none; }
.detail-q .qt { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.detail-q .qa { font-size: 14px; color: #374151; }
.detail-q .qa .rank-line { display: block; padding: 2px 0; }
.detail-q .qa .other-text { color: #2563eb; }
.back-btn {
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 8px 20px;
  font-size: 14px;
  cursor: pointer;
  margin-bottom: 16px;
}
.back-btn:hover { border-color: #2563eb; color: #2563eb; }
