:root {
  --ink: #151b18;
  --muted: #647067;
  --paper: #f7f4ec;
  --panel: #fffdf7;
  --line: #ded5c4;
  --accent: #087969;
  --accent-dark: #06594e;
  --danger: #c7442e;
  --good: #e5f4e6;
  --bad: #fae7df;
  --shadow: 0 12px 34px rgba(44, 35, 21, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(8, 121, 105, 0.07) 1px, transparent 1px),
    linear-gradient(rgba(8, 121, 105, 0.05) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  color: #fff;
  background: var(--accent);
  font-weight: 700;
  cursor: pointer;
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.app-shell {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
}

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
}

h1,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: 0;
}

.icon-button {
  flex: 0 0 auto;
  min-width: 82px;
  background: var(--ink);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.stats div,
.practice-panel,
.question-card {
  border: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.94);
  box-shadow: var(--shadow);
}

.stats div {
  min-height: 74px;
  border-radius: 8px;
  padding: 12px 10px;
}

.stats strong {
  display: block;
  font-size: 24px;
  line-height: 1;
}

.stats span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.practice-panel {
  border-radius: 8px;
  padding: 12px;
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f0e8d9;
}

.mode-tabs button {
  min-height: 40px;
  color: var(--muted);
  background: transparent;
}

.mode-tabs .active {
  color: #fff;
  background: var(--ink);
}

.question-card {
  min-height: 340px;
  margin: 12px 0;
  border-radius: 8px;
  padding: 18px;
}

.question-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.tag {
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--accent-dark);
  background: #e7f1ea;
  font-size: 12px;
  font-weight: 800;
}

.question-title {
  margin: 0 0 18px;
  font-size: 21px;
  line-height: 1.6;
  letter-spacing: 0;
}

.options {
  display: grid;
  gap: 10px;
}

.option {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-height: 54px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf6ec;
  line-height: 1.55;
  cursor: pointer;
}

.option input {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  accent-color: var(--accent);
}

.text-answer {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--ink);
  background: #fffaf0;
  font-size: 16px;
}

.empty {
  display: grid;
  place-items: center;
}

.empty-text {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
}

.actions {
  position: sticky;
  bottom: max(10px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 1fr 1fr 86px;
  gap: 8px;
  padding-top: 2px;
}

.secondary-button {
  color: var(--accent-dark);
  background: #e7f1ea;
}

.danger-button {
  background: var(--danger);
}

.feedback {
  min-height: 58px;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  color: var(--muted);
  background: #f0e8d9;
  line-height: 1.65;
}

.feedback.correct {
  color: #0f5e37;
  background: var(--good);
}

.feedback.wrong {
  color: #8b2f20;
  background: var(--bad);
}

@media (min-width: 720px) {
  .app-shell {
    padding-top: 30px;
  }

  h1 {
    font-size: 42px;
  }

  .question-card {
    min-height: 380px;
    padding: 24px;
  }

  .question-title {
    font-size: 24px;
  }

  .actions {
    position: static;
    grid-template-columns: 1fr 1fr 120px;
  }
}

@media (max-width: 360px) {
  .app-shell {
    padding-left: 10px;
    padding-right: 10px;
  }

  h1 {
    font-size: 26px;
  }

  .actions {
    grid-template-columns: 1fr 1fr 76px;
  }

  button {
    padding: 0 10px;
  }
}
