:root {
  --bg0: #f3f7f6;
  --bg1: #ffffff;
  --ink: #1a2b2a;
  --muted: #5b6f6d;
  --line: #d7e3e0;
  --teal: #0f766e;
  --teal-soft: #e6f4f2;
  --teal-mid: #b7ddd8;
  --danger: #b42318;
  --radius: 1rem;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(120% 80% at 10% -10%, #d9f3ef 0%, transparent 55%),
    radial-gradient(90% 60% at 100% 0%, #eef6f4 0%, transparent 45%),
    var(--bg0);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
body { padding: var(--safe-t) 0 var(--safe-b); }

.app {
  width: min(28rem, 100%);
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 0 max(1.25rem, env(safe-area-inset-left, 0px)) calc(1.25rem + var(--safe-b)) max(1.25rem, env(safe-area-inset-right, 0px));
}

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.1rem 0.15rem 0.65rem;
  margin: 0;
  position: sticky;
  top: 0;
  z-index: 5;
  background: linear-gradient(to bottom, var(--bg0) 70%, transparent);
}
.brand {
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--teal);
}
.topbar-meta {
  font-size: 0.75rem;
  color: var(--muted);
  max-width: 55%;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main { flex: 1; padding-bottom: 1rem; }
.panel {
  background: var(--bg1);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 0.15rem);
  padding: 1.15rem 1.05rem 1.25rem;
  box-shadow: 0 10px 30px rgba(15, 40, 36, 0.05);
  animation: rise 0.28s ease;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.h1 {
  margin: 0 0 0.45rem;
  font-size: 1.35rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.lead {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}
.muted { color: var(--muted); font-size: 0.86rem; line-height: 1.5; }
.disclaimer {
  margin: 0 0 1rem;
  padding: 0.7rem 0.8rem;
  border-radius: 0.7rem;
  background: #fff8e8;
  border: 1px solid #f0dfb4;
  color: #7a5b14;
  font-size: 0.82rem;
  line-height: 1.5;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
  font-size: 0.86rem;
  color: var(--muted);
}
.input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  padding: 0.78rem 0.85rem;
  font-size: 1rem;
  color: var(--ink);
  background: #fbfcfc;
  outline: none;
}
.input:focus {
  border-color: var(--teal-mid);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 0.75rem;
  padding: 0.72rem 1rem;
  font-size: 0.95rem;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-block { width: 100%; margin-top: 0.35rem; }
.btn-primary {
  background: var(--teal);
  color: #fff;
}
.btn-primary:hover { background: #0d5f59; }
.btn-ghost {
  background: var(--teal-soft);
  color: var(--teal);
  border-color: var(--teal-mid);
  margin-top: 0.55rem;
}
.err {
  margin: 0.75rem 0 0;
  color: var(--danger);
  font-size: 0.86rem;
  line-height: 1.45;
}

.pay-box {
  margin: 0.5rem 0 1rem;
  padding: 0.85rem;
  border-radius: 0.85rem;
  background: var(--teal-soft);
  border: 1px solid var(--teal-mid);
  text-align: center;
}
.pay-qr-host {
  display: flex;
  justify-content: center;
  margin: 0.25rem 0 0.5rem;
}
.pay-qr {
  width: min(220px, 70vw);
  height: auto;
  background: #fff;
  border-radius: 0.65rem;
  padding: 0.5rem;
  border: 1px solid var(--line);
}

.panel-quiz {
  padding-top: 0.9rem;
  background: transparent;
  border: none;
  box-shadow: none;
}
.progress {
  height: 0.35rem;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.45rem;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #14b8a6, var(--teal));
  transition: width 0.2s ease;
}
.progress-text {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.q-card {
  background: var(--bg1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1rem 1.15rem;
  box-shadow: 0 12px 28px rgba(15, 40, 36, 0.06);
  min-height: 14rem;
}
.q-no {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--teal);
  letter-spacing: 0.04em;
}
.q-title {
  margin: 0 0 1rem;
  font-size: 1.08rem;
  line-height: 1.45;
  font-weight: 650;
}
.q-opts {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.q-opt {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fbfcfc;
  border-radius: 0.8rem;
  padding: 0.8rem 0.85rem;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--ink);
  cursor: pointer;
}
.q-opt.is-on {
  border-color: var(--teal);
  background: var(--teal-soft);
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.25);
}
.q-opt-mark {
  flex: 0 0 1.35rem;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  border: 1.5px solid var(--teal-mid);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--teal);
  margin-top: 0.1rem;
  background: #fff;
}
.q-opt.is-on .q-opt-mark {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}
.q-opt-label { flex: 1; }

.quiz-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-top: 0.95rem;
}
.quiz-nav .btn { margin-top: 0; }
#btnSubmit { margin-top: 0.85rem; }

.scores {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.9rem;
}
.reward-box {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--teal-mid);
  background: var(--teal-soft);
}
.reward-msg {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--ink);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  background: var(--teal-soft);
  border: 1px solid var(--teal-mid);
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 650;
}

.report-md {
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--ink);
}
.report-md h1,
.report-md h2,
.report-md h3 {
  margin: 1rem 0 0.4rem;
  line-height: 1.3;
}
.report-md h1 { font-size: 1.15rem; }
.report-md h2 { font-size: 1.05rem; }
.report-md h3 { font-size: 0.98rem; }
.report-md p { margin: 0.4rem 0; }
.report-md ul { margin: 0.35rem 0 0.55rem; padding-left: 1.2rem; }
.report-md li { margin: 0.2rem 0; }
.report-md code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85em;
  background: #f0f4f3;
  padding: 0.05rem 0.3rem;
  border-radius: 0.3rem;
}
.report-md blockquote {
  margin: 0.6rem 0;
  padding: 0.55rem 0.75rem;
  border-left: 3px solid var(--teal-mid);
  background: var(--teal-soft);
  color: var(--muted);
  border-radius: 0 0.5rem 0.5rem 0;
}

.foot {
  text-align: center;
  color: var(--muted);
  font-size: 0.75rem;
  padding: 0.75rem 0 0.25rem;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(1.25rem + var(--safe-b));
  transform: translateX(-50%);
  background: rgba(26, 43, 42, 0.92);
  color: #fff;
  padding: 0.65rem 0.95rem;
  border-radius: 999px;
  font-size: 0.86rem;
  z-index: 40;
  max-width: min(90vw, 22rem);
  text-align: center;
}

@media (min-width: 640px) {
  .app { padding-top: 0.5rem; }
  .q-title { font-size: 1.15rem; }
}
