:root {
  --bg: #f6f8f5;
  --panel: #ffffff;
  --text: #1f2933;
  --muted: #64748b;
  --line: #dce5dc;
  --primary: #2f6f5e;
  --primary-dark: #245748;
  --primary-soft: #e4f1ec;
  --warning: #f59e0b;
  --shadow: 0 18px 45px rgba(28, 55, 45, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(93, 168, 136, 0.18), transparent 34rem),
    linear-gradient(180deg, #f9fbf8 0%, var(--bg) 38%, #eef4ef 100%);
  min-height: 100vh;
}

body.eye-care {
  --bg: #eef3e5;
  --panel: #fbfcf7;
  --text: #253226;
  --muted: #66755f;
  --line: #cfdbc4;
  --primary: #4f7942;
  --primary-dark: #3f6334;
  --primary-soft: #e2ecd8;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.hero {
  padding: 24px clamp(18px, 5vw, 72px) 46px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 56px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: #fff;
  background: var(--primary);
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(47, 111, 94, 0.25);
}

.hero-content {
  max-width: 880px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 18px;
  font-size: clamp(34px, 6vw, 64px);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

h2 {
  margin-bottom: 14px;
  font-size: 24px;
}

.hero-text {
  max-width: 700px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.9;
}

.hero-actions,
.toolbar,
.section-title,
.question-meta,
.card-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.primary-button,
.secondary-button,
.ghost-button,
.chip,
.answer-button,
.favorite-button {
  border: 0;
  border-radius: 999px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.primary-button,
.secondary-button {
  padding: 13px 20px;
  font-weight: 700;
}

.primary-button {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 14px 30px rgba(47, 111, 94, 0.22);
}

.secondary-button {
  color: var(--primary-dark);
  background: var(--primary-soft);
}

.ghost-button {
  padding: 10px 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.chip:hover,
.answer-button:hover,
.favorite-button:hover {
  transform: translateY(-1px);
}

.layout {
  display: grid;
  grid-template-columns: minmax(240px, 310px) minmax(0, 1fr);
  gap: 24px;
  padding: 0 clamp(18px, 5vw, 72px) 48px;
}

.panel,
.question-card,
.random-card {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(220, 229, 220, 0.86);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.stats-panel {
  align-self: start;
  position: sticky;
  top: 20px;
  padding: 24px;
}

.stats-grid {
  display: grid;
  gap: 12px;
}

.stats-grid div {
  padding: 16px;
  background: var(--primary-soft);
  border-radius: 20px;
}

.stats-grid strong {
  display: block;
  color: var(--primary-dark);
  font-size: 32px;
  line-height: 1;
}

.stats-grid span,
.tip,
.filter-label,
.footer,
.question-meta,
.answer,
.empty-state {
  color: var(--muted);
}

.tip {
  margin: 18px 0 0;
  line-height: 1.8;
}

.main-panel {
  min-width: 0;
}

.toolbar {
  align-items: stretch;
  flex-direction: column;
  padding: 22px;
  margin-bottom: 22px;
}

.search-box {
  display: grid;
  gap: 8px;
}

.search-box span,
.filter-label {
  font-size: 13px;
  font-weight: 700;
}

input[type="search"] {
  width: 100%;
  padding: 14px 16px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  outline: none;
}

input[type="search"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(47, 111, 94, 0.12);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.chip {
  padding: 8px 13px;
  color: var(--primary-dark);
  background: #fff;
  border: 1px solid var(--line);
}

.chip.active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.section-title {
  justify-content: space-between;
  margin: 20px 0 14px;
}

.section-title h2 {
  margin-bottom: 0;
}

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

.question-card,
.random-card {
  padding: 22px;
}

.question-card h3,
.random-card h3 {
  margin-bottom: 12px;
  font-size: 19px;
  line-height: 1.65;
}

.question-meta {
  flex-wrap: wrap;
  margin-bottom: 16px;
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 10px;
  color: var(--primary-dark);
  background: var(--primary-soft);
  border-radius: 999px;
  font-weight: 700;
}

.difficulty {
  color: #8a5d0a;
  background: #fff5d6;
}

.card-actions {
  flex-wrap: wrap;
}

.answer-button,
.favorite-button {
  padding: 9px 14px;
  font-weight: 700;
}

.answer-button {
  color: #fff;
  background: var(--primary);
}

.favorite-button {
  color: var(--primary-dark);
  background: var(--primary-soft);
}

.favorite-button.active {
  color: #8a5d0a;
  background: #fff1c2;
}

.answer {
  display: none;
  margin: 16px 0 0;
  padding: 16px;
  background: #f8faf7;
  border: 1px solid var(--line);
  border-radius: 18px;
  line-height: 1.9;
}

.question-card.open .answer,
.random-card.open .answer {
  display: block;
}

.random-card {
  margin-bottom: 22px;
  border-color: rgba(47, 111, 94, 0.26);
}

.random-card::before {
  content: "随机练习";
  display: inline-flex;
  margin-bottom: 10px;
  padding: 5px 10px;
  color: var(--primary-dark);
  background: var(--primary-soft);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.hidden {
  display: none !important;
}

.empty-state {
  padding: 36px;
  text-align: center;
  background: rgba(255, 255, 255, 0.68);
  border: 1px dashed var(--line);
  border-radius: 24px;
}

.footer {
  padding: 0 clamp(18px, 5vw, 72px) 36px;
  font-size: 14px;
}

code {
  padding: 2px 6px;
  color: var(--primary-dark);
  background: var(--primary-soft);
  border-radius: 6px;
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .stats-panel {
    position: static;
  }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 560px) {
  .topbar,
  .hero-actions,
  .section-title {
    align-items: stretch;
    flex-direction: column;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .primary-button,
  .secondary-button,
  .ghost-button {
    width: 100%;
  }
}
