:root {
  --paper: #f7f2e9;
  --paper-strong: #fffaf1;
  --ink: #1f2521;
  --muted: #69736d;
  --line: #ddd3c5;
  --jade: #2f7868;
  --jade-dark: #21584c;
  --cinnabar: #b64732;
  --gold: #b18a43;
  --mist: #e9efe7;
  --white: #ffffff;
  --shadow: 0 12px 30px rgba(43, 36, 26, 0.12);
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

body {
  min-height: 100vh;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

#app {
  width: 100%;
}

.shell {
  min-height: 100vh;
  padding: 0 0 86px;
  background:
    linear-gradient(180deg, rgba(255, 250, 241, 0.92), rgba(247, 242, 233, 0.98)),
    repeating-linear-gradient(135deg, rgba(177, 138, 67, 0.04) 0 1px, transparent 1px 10px);
}

.phone {
  width: min(100vw, 430px);
  min-height: 100vh;
  margin: 0 auto;
  background: linear-gradient(180deg, rgba(255, 250, 241, 0.96), rgba(247, 242, 233, 0.99));
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
  position: relative;
}

.app-header {
  padding: 22px 18px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 0;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.brand-name {
  margin: 0;
  font-family: var(--serif);
  font-size: 29px;
  line-height: 1.2;
  font-weight: 900;
  color: #171b18;
}

.brand-name span {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-left: 5px;
  border-radius: 3px;
  background: #9f2d22;
  color: #fffaf1;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  font-size: 10px;
  vertical-align: 9px;
}

.brand-sub {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.user-pill {
  max-width: 140px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border: 1px solid rgba(177, 138, 67, 0.34);
  border-radius: 999px;
  background: rgba(255, 250, 241, 0.82);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.content {
  padding: 0 14px 18px;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px 14px;
  background: linear-gradient(135deg, #f7f2e9 0%, #efe4d3 100%);
}

.login-panel {
  position: relative;
  overflow: hidden;
  width: min(calc(100vw - 68px), 430px);
  padding: 22px;
  background: var(--paper-strong);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.login-panel::before {
  content: "";
  display: block;
  width: 54px;
  height: 4px;
  margin-bottom: 18px;
  border-radius: 999px;
  background: var(--gold);
}

.login-panel h1 {
  margin: 0 0 6px;
  font-size: 28px;
  color: var(--jade-dark);
}

.login-panel .intro {
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.7;
  font-size: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 12px 0;
}

.field span {
  font-size: 13px;
  color: var(--muted);
}

.input,
.textarea,
.select {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  border-radius: 8px;
  padding: 11px 12px;
  outline: none;
}

.textarea {
  min-height: 112px;
  resize: vertical;
  line-height: 1.6;
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--jade);
  box-shadow: 0 0 0 3px rgba(47, 120, 104, 0.12);
}

.primary-btn,
.ghost-btn,
.danger-btn,
.text-btn {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 10px 14px;
  font-weight: 700;
}

.primary-btn {
  background: linear-gradient(180deg, #2f7868, #21584c);
  color: white;
  box-shadow: 0 8px 18px rgba(33, 88, 76, 0.18);
}

.primary-btn:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.58);
  color: var(--jade-dark);
  border-color: var(--line);
}

.danger-btn {
  background: rgba(182, 71, 50, 0.1);
  color: var(--cinnabar);
  border-color: rgba(182, 71, 50, 0.22);
}

.text-btn {
  background: transparent;
  color: var(--jade-dark);
  padding-inline: 8px;
}

.full {
  width: 100%;
}

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

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

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

.mini-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.mini-stat {
  min-height: 68px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.hero-panel,
.overview-panel,
.plan-panel,
.quick-panel {
  margin-top: 4px;
  padding: 12px;
  border: 1px solid rgba(221, 211, 197, 0.78);
  border-radius: 10px;
  background: rgba(255, 250, 241, 0.78);
  box-shadow: 0 8px 18px rgba(43, 36, 26, 0.06);
}

.mini-stat strong {
  display: block;
  font-size: 21px;
  line-height: 1;
  margin-bottom: 8px;
}

.mini-stat span {
  color: var(--muted);
  font-size: 11px;
}

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

.stat {
  min-height: 76px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stat strong {
  display: block;
  font-family: var(--serif);
  font-size: 30px;
  line-height: 1;
  margin-bottom: 7px;
}

.stat em {
  margin-left: 4px;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  font-style: normal;
}

.stat span {
  color: var(--muted);
  font-size: 12px;
}

.section {
  margin-top: 18px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

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

.section-note {
  color: var(--muted);
  font-size: 12px;
}

.item-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item {
  width: 100%;
  text-align: left;
  padding: 13px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.ring-stat {
  display: grid;
  justify-items: center;
  gap: 5px;
  min-width: 0;
}

.ring {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background:
    radial-gradient(circle at center, var(--paper-strong) 55%, transparent 56%),
    conic-gradient(var(--jade-dark) var(--pct), rgba(221, 211, 197, 0.9) 0);
}

.ring strong {
  font-family: var(--serif);
  font-size: 17px;
}

.ring-stat span,
.ring-stat small {
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.ring-stat small {
  color: #8d7d66;
}

.plan-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 9px;
  min-height: 32px;
  color: var(--muted);
  font-size: 12px;
}

.plan-row strong {
  color: var(--ink);
  font-size: 11px;
  text-align: right;
}

.plan-track {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: #ded3c3;
}

.plan-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--jade-dark);
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-top: 12px;
}

.quick-card {
  min-height: 72px;
  display: grid;
  place-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--ink);
  text-align: center;
}

.quick-card strong {
  font-size: 14px;
}

.quick-card span {
  color: var(--muted);
  font-size: 11px;
}

.quick-card.hot strong {
  color: var(--cinnabar);
}

.item.active {
  border-color: rgba(47, 120, 104, 0.6);
  box-shadow: 0 0 0 3px rgba(47, 120, 104, 0.1);
}

.item-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  font-weight: 800;
  line-height: 1.4;
}

.item-desc {
  color: var(--muted);
  line-height: 1.55;
  font-size: 13px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--mist);
  color: var(--jade-dark);
  font-size: 12px;
  line-height: 1.3;
}

.tag.hot {
  background: rgba(182, 71, 50, 0.12);
  color: var(--cinnabar);
}

.flashcard {
  min-height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255, 250, 241, 0.96), rgba(250, 244, 233, 0.98)),
    linear-gradient(135deg, transparent 70%, rgba(47, 120, 104, 0.08));
  border: 1px solid var(--line);
  border-radius: 10px;
}

.study-card {
  margin-top: 10px;
  box-shadow: 0 10px 24px rgba(43, 36, 26, 0.08);
}

.card-face {
  min-height: 176px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 12px;
  text-align: center;
}

.card-face.answered {
  min-height: 128px;
}

.flash-label {
  color: var(--muted);
  font-size: 12px;
}

.flash-front {
  margin: 0;
  font-family: var(--serif);
  font-size: 25px;
  line-height: 1.55;
  font-weight: 800;
}

.flash-back {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.flash-back strong {
  display: block;
  margin-bottom: 8px;
}

.flash-back p {
  margin: 0;
  line-height: 1.7;
}

.grade-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin-top: 12px;
}

.grade-btn {
  min-height: 56px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink);
  padding: 7px 4px;
}

.grade-btn strong,
.grade-btn span {
  display: block;
}

.grade-btn span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.grade-btn.forgot {
  color: var(--cinnabar);
}

.grade-btn.easy {
  color: var(--jade-dark);
}

.card-reveal {
  justify-self: center;
  color: #8b7a62;
}

.subpage-head {
  min-height: 44px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.subpage-head .section-title {
  text-align: center;
}

.back-btn {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
}

.review-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.review-progress span {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--jade-dark) 28%, #ded3c3 28%);
}

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  width: min(calc(100% - 18px), 410px);
  height: 62px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 7px;
  border: 1px solid rgba(139, 116, 82, 0.26);
  border-radius: 14px;
  background: rgba(255, 250, 241, 0.94);
  box-shadow: 0 10px 24px rgba(43, 36, 26, 0.16);
  backdrop-filter: blur(14px);
  z-index: 10;
}

.tabbar.five-tabs {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.tab {
  display: grid;
  place-items: center;
  gap: 2px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  padding: 0 3px;
}

.tab b {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(47, 120, 104, 0.08);
  color: var(--jade-dark);
  font-size: 11px;
}

.tab.active {
  background: transparent;
  color: var(--jade-dark);
}

.tab.active b {
  background: var(--jade-dark);
  color: white;
}

.empty,
.notice {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  line-height: 1.7;
  background: rgba(255, 255, 255, 0.45);
}

.notice {
  border-style: solid;
  background: rgba(47, 120, 104, 0.08);
  color: var(--jade-dark);
}

.empty.small {
  padding: 12px;
  font-size: 13px;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.generated-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.generated-card {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
}

.maker-panel {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 250, 241, 0.82);
}

.segment-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.segment {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--muted);
  font-weight: 700;
}

.segment.active {
  border-color: rgba(47, 120, 104, 0.45);
  color: var(--jade-dark);
  background: rgba(47, 120, 104, 0.08);
}

.source-textarea {
  min-height: 174px;
}

.compact-textarea {
  min-height: 84px;
}

.example-box {
  padding: 10px;
  border: 1px solid rgba(221, 211, 197, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
}

.example-box strong,
.example-box p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.check-card {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
  color: var(--ink);
  font-size: 13px;
}

.generated-card textarea {
  min-height: 74px;
}

.case-panel {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.66);
}

.case-strip {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.case-strip button {
  flex: 0 0 auto;
  max-width: 180px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 11px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.case-strip button.active {
  border-color: rgba(47, 120, 104, 0.55);
  background: rgba(47, 120, 104, 0.1);
  color: var(--jade-dark);
}

.case-card,
.answer-panel,
.diagnostic-panel {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 250, 241, 0.82);
}

.case-card h3 {
  margin: 8px 0 10px;
  font-size: 17px;
}

.case-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.case-meta strong {
  color: var(--jade-dark);
}

.answer-panel h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

.choice-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  margin: 10px 0;
}

.choice-row > strong {
  padding-top: 7px;
  font-size: 13px;
}

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

.choice-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice-chip {
  position: relative;
  min-height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.66);
  color: var(--ink);
  font-size: 12px;
  text-align: center;
}

.choice-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-chip:has(input:checked) {
  border-color: rgba(47, 120, 104, 0.72);
  background: rgba(47, 120, 104, 0.1);
  color: var(--jade-dark);
  box-shadow: 0 0 0 2px rgba(47, 120, 104, 0.08);
}

.diagnostic-count {
  width: 100%;
  margin: 0 0 10px;
  color: var(--jade-dark);
  text-align: center;
  font-weight: 800;
}

.diagnostic-panel {
  padding: 12px;
}

.diagnostic-grid {
  display: grid;
  gap: 4px;
}

.tongue-visual {
  min-height: 238px;
  display: grid;
  place-items: center;
  margin: 8px 0 10px;
  padding: 12px;
  border: 1px solid rgba(182, 71, 50, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 0 0 6px rgba(255, 250, 241, 0.9);
}

.mouth-shape {
  position: relative;
  width: min(240px, 82%);
  height: 182px;
  overflow: hidden;
  border-radius: 46% 46% 38% 38%;
  background:
    radial-gradient(ellipse at 50% 4%, #f6efe7 0 18%, transparent 19%),
    linear-gradient(180deg, #4a1415 0 18%, #7b2b2c 19% 35%, #f4b6aa 36% 100%);
  box-shadow: 0 10px 20px rgba(43, 36, 26, 0.16);
}

.mouth-shape::before {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  top: 0;
  height: 34px;
  border-radius: 0 0 18px 18px;
  background: #fff8f0;
}

.tongue-shape {
  position: absolute;
  left: 19%;
  right: 19%;
  bottom: -4px;
  height: 142px;
  border-radius: 48% 48% 44% 44%;
  background:
    linear-gradient(90deg, transparent 48%, rgba(163, 67, 64, 0.22) 49% 51%, transparent 52%),
    radial-gradient(circle at 36% 26%, rgba(255, 238, 232, 0.75), transparent 12%),
    radial-gradient(circle at 66% 45%, rgba(255, 238, 232, 0.48), transparent 14%),
    linear-gradient(180deg, #f6b8ae 0%, #e88882 100%);
  border: 1px solid rgba(136, 49, 48, 0.22);
}

.case-panel h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.admin-json {
  min-height: 190px;
  font-size: 12px;
  line-height: 1.5;
}

.case-line {
  margin: 8px 0;
  color: var(--muted);
  line-height: 1.65;
}

.case-line strong {
  color: var(--ink);
}

.case-action {
  margin-top: 12px;
}

.stack-gap {
  margin-top: 10px;
}

.tool-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.tool-row .ghost-btn,
.tool-row .primary-btn,
.tool-row .danger-btn {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.compact-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.compact-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
}

.compact-card strong {
  display: block;
  line-height: 1.45;
}

.compact-card p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.tongue-card {
  min-height: 150px;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 8px;
  margin: 12px 0;
  padding: 18px;
  border: 1px solid rgba(182, 71, 50, 0.18);
  border-radius: 8px;
  background: radial-gradient(circle at 50% 42%, rgba(182, 71, 50, 0.24), rgba(255, 255, 255, 0.46) 62%);
}

.tongue-card span {
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--cinnabar);
  font-size: 12px;
}

.pulse-wave {
  width: 100%;
  height: 132px;
  margin: 10px 0;
  color: var(--jade);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
}

.check-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  margin: 8px 0 14px;
}

.score {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  color: var(--cinnabar);
  font-weight: 900;
}

.score strong {
  font-size: 34px;
  line-height: 1;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  transform: translateX(-50%);
  width: min(calc(100% - 40px), 360px);
  padding: 11px 14px;
  border-radius: 999px;
  background: rgba(31, 37, 33, 0.92);
  color: white;
  text-align: center;
  font-size: 13px;
  z-index: 20;
}

.loading {
  opacity: 0.72;
  pointer-events: none;
}

.hidden {
  display: none !important;
}

@media (min-width: 760px) {
  .shell {
    padding-top: 28px;
  }

  .phone {
    min-height: calc(100vh - 56px);
  }
}
