:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #667085;
  --line: #dde3ea;
  --blue: #1f6feb;
  --blue-dark: #174ea6;
  --green: #16805a;
  --amber-bg: #fff4d6;
  --amber-line: #ffd36a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.page {
  width: min(100%, 480px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 14px 14px calc(32px + env(safe-area-inset-bottom));
}

.loading,
.empty-state,
.error-card {
  margin: 24px 0;
  padding: 22px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  line-height: 1.7;
  text-align: center;
}

.home-hero {
  padding: 22px 4px 16px;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.home-hero h1 {
  margin: 0 0 18px;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: 0;
}

.search-form {
  display: grid;
  grid-template-columns: 1fr 78px;
  gap: 8px;
}

.search-form.compact {
  grid-template-columns: 1fr 68px;
}

.search-input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0 13px;
  outline: none;
}

.search-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.12);
}

.search-button,
.primary-button,
.outline-button,
.ask-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 0;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
}

.search-button:active,
.primary-button:active,
.ask-link:active {
  background: var(--blue-dark);
}

.section,
.panel,
.detail-card,
.ask-page {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.section-title {
  margin: 0 0 12px;
  font-size: 17px;
  line-height: 1.35;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.category-card {
  min-height: 82px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  border: 1px solid #d6e2f2;
  border-radius: 8px;
  background: #f8fbff;
}

.category-card strong {
  font-size: 17px;
}

.category-code {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #e7f0ff;
  color: var(--blue);
  font-weight: 800;
}

.question-list {
  display: grid;
  gap: 10px;
}

.question-item {
  display: grid;
  gap: 9px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.question-title {
  font-weight: 700;
  line-height: 1.55;
}

.question-meta,
.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: #e8f6ef;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}

.ask-panel {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-radius: 8px;
  background: #edf4ff;
  color: #24415f;
}

.ask-link {
  min-width: 96px;
  padding: 0 14px;
}

.top-bar {
  min-height: 48px;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 2;
  margin: -14px -14px 10px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 248, 251, 0.96);
  backdrop-filter: blur(10px);
}

.top-bar strong {
  text-align: center;
  font-size: 17px;
}

.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  font-size: 26px;
  line-height: 1;
}

.home-link {
  color: var(--blue);
  font-size: 14px;
  text-align: right;
}

.count-line {
  margin-bottom: 12px;
  color: var(--muted);
}

.inline-filter {
  margin-top: 8px;
}

.detail-card {
  line-height: 1.78;
}

.detail-title {
  margin: 12px 0 14px;
  font-size: 22px;
  line-height: 1.35;
  letter-spacing: 0;
}

.metric-card {
  margin: 14px 0;
  padding: 12px;
  border: 1px solid var(--amber-line);
  border-radius: 8px;
  background: var(--amber-bg);
}

.metric-card h2 {
  margin: 0 0 8px;
  font-size: 16px;
}

.metric-row,
.term-row,
.step-row {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 8px;
  line-height: 1.75;
}

.metric-row + .metric-row,
.term-row + .term-row,
.step-row + .step-row {
  margin-top: 10px;
}

.term-row,
.step-row {
  border: 1px solid #e7edf4;
  background: #fafcff;
}

.highlight {
  border-color: var(--amber-line);
  background: var(--amber-bg);
}

.answer-heading {
  margin: 22px 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #edf4ff;
  font-size: 16px;
  line-height: 1.5;
}

.answer-paragraph {
  margin: 12px 0;
  line-height: 1.78;
  white-space: pre-wrap;
}

.answer-blocks {
  display: grid;
  gap: 10px;
}

.image-grid {
  display: grid;
  gap: 10px;
}

.image-grid img,
.image-missing {
  width: 100%;
  min-height: 128px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f2f5f8;
}

.image-grid img {
  display: block;
  object-fit: cover;
}

.image-missing {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  color: var(--muted);
}

.image-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.86);
}

.image-overlay img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 8px;
  background: #fff;
}

.link-list,
.related-list {
  display: grid;
  gap: 8px;
}

.outline-button {
  justify-content: flex-start;
  padding: 10px 12px;
  border: 1px solid #bfd5f5;
  background: #f7fbff;
  color: var(--blue);
  text-align: left;
}

.tag-link {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f2f5f8;
  line-height: 1.5;
}

.ask-page {
  text-align: center;
}

.ask-page h1 {
  margin: 8px 0;
  font-size: 24px;
}

.ask-page p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.8;
}

.primary-button {
  width: 100%;
}

@media (max-width: 360px) {
  .page {
    padding-inline: 10px;
  }

  .home-hero h1 {
    font-size: 25px;
  }

  .category-grid {
    gap: 8px;
  }

  .category-card {
    padding: 12px 10px;
  }
}
