:root {
  --brand: #3a5be0;
  --brand-2: #5b7bf0;
  --brand-soft: #eef1fd;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1b1f27;
  --text-2: #5b6270;
  --sub: #8a909e;
  --line: #eef0f6;
  --ok: #0d9f6e;
  --ok-soft: #e8f8f1;
  --warn: #d97706;
  --warn-soft: #fff4e6;
  --bad: #e5484d;
  --bad-soft: #fdecec;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(24, 39, 75, 0.05);
  --shadow-lg: 0 8px 28px rgba(24, 39, 75, 0.1);
}

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

/*
 * 作者样式里的 display（flex/block）会盖掉浏览器对 [hidden] 的默认 display:none ——
 * 遮罩、toast、底部 tab 都靠 el.hidden 收放，少这一条「处理中…」的遮罩就会永远留在页面上，
 * 把整个应用挡死。必须用 !important 才能压过后面的具体类。
 */
[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
}

/* ==================== 骨架 ==================== */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 560px;
  margin: 0 auto;
  background: var(--bg);
}

.view {
  flex: 1;
  padding: 12px 16px calc(84px + env(safe-area-inset-bottom));
}

/* ==================== 顶栏 ==================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(244, 246, 251, 0.92);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid rgba(238, 240, 246, 0.7);
}

.topbar-inner {
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.brand-text {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.brand-tag {
  font-size: 11px;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 6px;
  padding: 2px 6px;
  white-space: nowrap;
}

.points-pill {
  display: flex;
  align-items: baseline;
  gap: 2px;
  background: #fff;
  border-radius: 999px;
  padding: 4px 12px;
  box-shadow: var(--shadow);
  flex: none;
}

.points-num {
  font-size: 16px;
  font-weight: 700;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}

.points-unit {
  font-size: 11px;
  color: var(--sub);
}

/* ==================== 卡片 ==================== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}

.card-tight {
  padding: 14px 16px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px;
}

.card-sub {
  font-size: 13px;
  color: var(--sub);
  margin: 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 20px 2px 10px;
}

.section-title {
  font-size: 15px;
  font-weight: 600;
}

.section-more {
  font-size: 13px;
  color: var(--brand);
}

/* ==================== 方向条 ==================== */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  margin: 0 -16px;
  padding-left: 16px;
  padding-right: 16px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: none;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  color: var(--text-2);
  background: #fff;
  box-shadow: var(--shadow);
  transition: all 0.15s;
  white-space: nowrap;
}

.chip.on {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(58, 91, 224, 0.28);
}

/* ==================== 入口卡 ==================== */
.entries {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 4px;
}

.entry {
  background: #fff;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  text-align: left;
  position: relative;
  overflow: hidden;
  transition: transform 0.12s;
}

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

.entry-ico {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  margin-bottom: 10px;
}

.entry-ico.a {
  background: var(--brand-soft);
  color: var(--brand);
}

.entry-ico.b {
  background: var(--ok-soft);
  color: var(--ok);
}

.entry-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}

.entry-desc {
  font-size: 12px;
  color: var(--sub);
  line-height: 1.45;
}

.entry-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 11px;
  color: var(--sub);
  background: var(--bg);
  border-radius: 999px;
  padding: 2px 8px;
}

/* ==================== 按钮 ==================== */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 500;
  transition: transform 0.12s, opacity 0.12s;
}

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

.btn[disabled] {
  opacity: 0.45;
  pointer-events: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 6px 18px rgba(58, 91, 224, 0.26);
}

.btn-ghost {
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow);
}

.btn-quiet {
  background: transparent;
  color: var(--sub);
  font-size: 14px;
  padding: 10px;
}

.btn-stack {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

/* ==================== 题目 ==================== */
.q-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.tag {
  font-size: 11px;
  border-radius: 6px;
  padding: 2px 7px;
  background: var(--bg);
  color: var(--sub);
}

.tag.essay {
  background: var(--brand-soft);
  color: var(--brand);
}

.tag.choice {
  background: var(--ok-soft);
  color: var(--ok);
}

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

.q-body {
  font-size: 14px;
  color: var(--text-2);
  white-space: pre-wrap;
  margin: 0;
}

.options {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.option {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  text-align: left;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  transition: all 0.15s;
}

.option:active {
  background: #fafbfe;
}

.option.on {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.option-key {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid #d5dae6;
  color: var(--sub);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  margin-top: 1px;
}

.option.on .option-key {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.option-text {
  flex: 1;
  font-size: 14.5px;
  line-height: 1.5;
}

.answer-box {
  margin-top: 16px;
}

.answer-input {
  width: 100%;
  min-height: 160px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  font-size: 15px;
  line-height: 1.7;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
}

.answer-input:focus {
  border-color: var(--brand);
}

.answer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  color: var(--sub);
}

.answer-count.over {
  color: var(--bad);
}

/* ==================== 结果 ==================== */
.score-hero {
  display: flex;
  align-items: center;
  gap: 18px;
}

.score-ring {
  flex: none;
  width: 92px;
  height: 92px;
  position: relative;
}

.score-ring svg {
  transform: rotate(-90deg);
}

.score-ring-txt {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-val {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.score-unit {
  font-size: 10px;
  color: var(--sub);
  margin-top: 2px;
}

.score-side {
  flex: 1;
  min-width: 0;
}

.score-status {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.score-hint {
  font-size: 12.5px;
  color: var(--sub);
  line-height: 1.5;
}

.badge-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 15px;
  font-weight: 600;
}

.badge.ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.badge.bad {
  background: var(--bad-soft);
  color: var(--bad);
}

.badge-ico {
  font-size: 16px;
}

.dims {
  display: grid;
  gap: 12px;
  margin-top: 4px;
}

.dim-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 5px;
}

.dim-name {
  color: var(--text-2);
}

.dim-score {
  font-variant-numeric: tabular-nums;
  color: var(--sub);
  font-size: 12.5px;
}

.dim-score b {
  color: var(--text);
  font-size: 13.5px;
}

.bar {
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  transition: width 0.5s ease;
}

.dim-comment {
  font-size: 12px;
  color: var(--sub);
  margin-top: 5px;
  line-height: 1.5;
}

.ai-comment {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-2);
  white-space: pre-wrap;
  margin: 0;
}

.point-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.point-list li {
  display: flex;
  gap: 8px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-2);
}

.point-list .mark {
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 3px;
}

.mark.good {
  background: var(--ok-soft);
  color: var(--ok);
}

.mark.todo {
  background: var(--warn-soft);
  color: var(--warn);
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 14px 0;
}

.analysis {
  font-size: 14px;
  line-height: 1.75;
  color: var(--text-2);
  white-space: pre-wrap;
  margin: 0;
}

.answer-key {
  display: inline-block;
  background: var(--ok-soft);
  color: var(--ok);
  border-radius: 6px;
  padding: 1px 8px;
  font-weight: 600;
  font-size: 13px;
}

.points-note {
  font-size: 12.5px;
  color: var(--sub);
  line-height: 1.55;
  margin: 10px 0 0;
}

.points-note b {
  color: var(--brand);
}

/* ==================== 回答列表 ==================== */
.ans-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #dbe3ff, #eef1fd);
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ans-name {
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ans-lv {
  font-size: 10.5px;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 4px;
  padding: 1px 5px;
  font-weight: 400;
}

.ans-time {
  font-size: 11.5px;
  color: var(--sub);
  margin-top: 1px;
}

.ans-score {
  margin-left: auto;
  font-size: 19px;
  font-weight: 700;
  color: var(--ok);
  font-variant-numeric: tabular-nums;
  flex: none;
}

.ans-score small {
  font-size: 10px;
  font-weight: 400;
  color: var(--sub);
  margin-left: 1px;
}

.ans-body {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-2);
  white-space: pre-wrap;
  margin: 0;
}

.ans-foot {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--sub);
}

.vote {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.vote.on {
  color: var(--brand);
}

/* ==================== 排行榜 ==================== */
.rank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--line);
}

.rank-row:last-child {
  border-bottom: 0;
}

.rank-no {
  width: 26px;
  flex: none;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--sub);
  font-variant-numeric: tabular-nums;
}

.rank-no.top1 {
  color: #e8a10c;
}

.rank-no.top2 {
  color: #8d97a8;
}

.rank-no.top3 {
  color: #c1784a;
}

.rank-name {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-me {
  font-size: 10.5px;
  color: var(--brand);
  border: 1px solid var(--brand);
  border-radius: 4px;
  padding: 0 4px;
  margin-left: 6px;
}

.rank-pts {
  font-size: 15px;
  font-weight: 700;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
  flex: none;
}

/* ==================== 我的 ==================== */
.me-head {
  background: linear-gradient(135deg, #3a5be0, #6b83f2);
  border-radius: 18px;
  padding: 20px;
  color: #fff;
  margin-bottom: 12px;
  box-shadow: 0 8px 24px rgba(58, 91, 224, 0.24);
}

.me-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.me-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  flex: none;
}

.me-name {
  font-size: 17px;
  font-weight: 600;
}

.me-lv {
  font-size: 12px;
  opacity: 0.82;
  margin-top: 2px;
}

.me-pts {
  margin-left: auto;
  text-align: right;
  flex: none;
}

.me-pts b {
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.me-pts span {
  font-size: 11px;
  opacity: 0.82;
  display: block;
  margin-top: -2px;
}

.progress {
  margin-top: 16px;
}

.progress-bar {
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: #fff;
  transition: width 0.5s ease;
}

.progress-txt {
  font-size: 11.5px;
  opacity: 0.82;
  margin-top: 6px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  text-align: center;
}

.stat-num {
  font-size: 19px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 11.5px;
  color: var(--sub);
  margin-top: 1px;
}

.rec-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  width: 100%;
}

.rec-row:last-child {
  border-bottom: 0;
}

.rec-main {
  flex: 1;
  min-width: 0;
}

.rec-title {
  font-size: 13.5px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.rec-meta {
  font-size: 11.5px;
  color: var(--sub);
  margin-top: 3px;
}

.rec-score {
  font-size: 16px;
  font-weight: 700;
  flex: none;
  font-variant-numeric: tabular-nums;
}

.rec-score small {
  font-size: 10px;
  font-weight: 400;
  color: var(--sub);
}

/* ==================== 备案号（网站首页底部，法规要求） ==================== */
.icp-bar {
  margin: 22px 0 2px;
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
  color: var(--sub);
  opacity: 0.85;
}

.icp-bar a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.icp-bar a:hover,
.icp-bar a:active {
  color: var(--brand);
  border-bottom-color: currentColor;
}

/* ==================== 底部 tab ==================== */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  max-width: 560px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.96);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0 9px;
  color: var(--sub);
  font-size: 11px;
  transition: color 0.15s;
}

.tab-ico {
  font-size: 17px;
  line-height: 1;
}

.tab.on {
  color: var(--brand);
  font-weight: 600;
}

/* ==================== 启动 / 空态 ==================== */
.boot {
  padding: 100px 20px;
  text-align: center;
}

.boot-spinner {
  width: 26px;
  height: 26px;
  margin: 0 auto 14px;
  border: 2.5px solid var(--brand-soft);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.boot-text {
  font-size: 13px;
  color: var(--sub);
  margin: 0;
}

.empty {
  padding: 56px 20px;
  text-align: center;
  color: var(--sub);
  font-size: 13.5px;
}

.empty-ico {
  font-size: 34px;
  opacity: 0.35;
  margin-bottom: 10px;
}

/* ==================== Toast / Loading ==================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 108px;
  transform: translateX(-50%);
  z-index: 60;
  background: rgba(27, 31, 39, 0.9);
  color: #fff;
  font-size: 13.5px;
  padding: 10px 18px;
  border-radius: 10px;
  max-width: 80vw;
  text-align: center;
  animation: toast-in 0.2s ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
}

.loading-mask {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(24, 30, 45, 0.34);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.loading-card {
  background: #fff;
  border-radius: 18px;
  padding: 26px 24px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  max-width: 300px;
  width: 100%;
}

.loading-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px;
}

.loading-sub {
  font-size: 12.5px;
  color: var(--sub);
  margin: 0;
  min-height: 18px;
}

/* ==================== 意见反馈 ==================== */
.fb-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.fb-item:last-child {
  border-bottom: 0;
}

.fb-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.fb-type,
.fb-state {
  font-size: 11.5px;
  border-radius: 999px;
  padding: 2px 9px;
}

.fb-type {
  color: var(--brand);
  background: var(--brand-soft);
}

.fb-state {
  color: var(--warn);
  background: var(--warn-soft);
}

.fb-state.done {
  color: var(--ok);
  background: var(--ok-soft);
}

.fb-content {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.fb-reply {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-word;
}

/* 复用 textarea 的 .answer-input，但联系方式是单行输入框 */
input.answer-input.fb-contact {
  min-height: auto;
  height: 46px;
  margin-top: 10px;
  padding: 0 14px;
  resize: none;
}
