:root {
  --brand-top: #1aa3e8;
  --brand-bottom: #2ecc9b;
  --brand: #17a9c4;
  --text: #1f2d3d;
  --muted: #7a8aa0;
  --bg: #f4f7fb;
  --card: #ffffff;
  --border: #e6ecf3;
  --danger: #e05a4a;
  --radius: 16px;
  --shadow: 0 6px 20px rgba(20, 60, 100, 0.08);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

.app-header {
  text-align: center;
  padding: 28px 16px 20px;
  background: linear-gradient(160deg, var(--brand-top), var(--brand-bottom));
  color: #fff;
  border-bottom-left-radius: 24px;
  border-bottom-right-radius: 24px;
}
.app-logo {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  background: rgba(255, 255, 255, 0.15);
}
.app-header h1 { margin: 10px 0 4px; font-size: 24px; letter-spacing: 1px; }
.tagline { margin: 0; font-size: 14px; opacity: 0.95; }

.container { max-width: 560px; margin: 0 auto; padding: 16px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.card.center { text-align: center; }
.hidden { display: none !important; }

.preview-wrap {
  margin-bottom: 16px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.preview-wrap img { display: block; width: 100%; max-height: 340px; object-fit: contain; background: #fafbfc; }

.actions { display: flex; gap: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  flex: 1;
  transition: transform 0.05s ease, opacity 0.2s ease;
  text-align: center;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: linear-gradient(135deg, var(--brand-top), var(--brand-bottom)); color: #fff; }
.btn-secondary { background: #eef3f8; color: var(--brand); }
.btn-block { width: 100%; margin-top: 16px; flex: none; }
.btn-link {
  background: none;
  color: var(--brand);
  padding: 6px 0;
  font-weight: 600;
  justify-content: flex-start;
  flex: none;
  margin-bottom: 8px;
}

.hint { color: var(--muted); font-size: 13px; text-align: center; margin: 14px 0 0; }

.spinner {
  width: 44px; height: 44px;
  margin: 6px auto 16px;
  border: 4px solid #e6eef6;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.big-emoji { font-size: 48px; margin-bottom: 10px; }

.section-title { font-size: 16px; margin: 0 0 14px; color: var(--text); }

.question-list { list-style: none; margin: 0 0 8px; padding: 0; }
.question-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  background: #fbfdff;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.question-item:active { background: #eef6fd; }
.q-number {
  flex: none;
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand-top), var(--brand-bottom));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
}
.q-text { flex: 1; font-size: 15px; color: var(--text); }
.q-arrow { color: var(--muted); font-size: 20px; }

.answer-block { margin-top: 10px; }
.q-title { font-size: 18px; font-weight: 700; margin: 0 0 12px; }
.type-tag {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-top), var(--brand-bottom));
  padding: 3px 10px;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 6px;
}
.field-label {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: var(--brand);
  background: #e8f6fb;
  padding: 2px 10px;
  border-radius: 999px;
  margin-bottom: 6px;
}
.field-body { white-space: pre-wrap; margin: 0 0 16px; font-size: 15.5px; }
.field-body.answer { font-weight: 600; }

.explain-nav { display: flex; gap: 12px; margin-top: 8px; }

/* ============================ 用户栏 / 登录 / 管理 ============================ */

.user-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.user-email { font-size: 13px; opacity: 0.95; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-btn {
  border: none;
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.bar-btn:active { transform: scale(0.97); }
.bar-btn.danger { background: #f4f7fb; color: var(--danger); }

.text-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  font-size: 16px;
  margin-bottom: 12px;
  outline: none;
  background: #fbfdff;
}
.text-input:focus { border-color: var(--brand); }
.code-input { letter-spacing: 8px; text-align: center; font-size: 22px; font-weight: 700; }

.hint.left { text-align: left; margin: 0 0 14px; }

.auth-links { display: flex; justify-content: space-between; margin-top: 6px; }

.auth-msg {
  margin: 14px 0 0;
  font-size: 14px;
  color: var(--brand);
  text-align: center;
}
.auth-msg.error { color: var(--danger); }

.subsection-title { font-size: 15px; margin: 22px 0 10px; color: var(--text); }

.admin-add { border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 12px;
  cursor: pointer;
}

.admin-user-list { margin-top: 6px; }
.admin-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 10px;
  background: #fbfdff;
}
.au-info { flex: 1; min-width: 0; }
.au-email { font-size: 14px; font-weight: 600; word-break: break-all; }
.au-meta { font-size: 12px; color: var(--muted); }
.au-info .tag { margin-left: 6px; }
.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
  vertical-align: middle;
}
.tag-admin { background: #e8f6fb; color: var(--brand); }
.tag-off { background: #fdecea; color: var(--danger); }

/* 登录 / 注册 标签 */
.auth-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.auth-tab {
  flex: 1;
  padding: 11px;
  border: none;
  border-radius: 10px;
  background: #eef3f8;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.auth-tab.active {
  background: linear-gradient(135deg, var(--brand-top), var(--brand-bottom));
  color: #fff;
}
