:root {
  --bg: #fff1f7;
  --surface: #ffffff;
  --surface-strong: #ffe5ef;
  --text: #34232b;
  --muted: #7e6872;
  --rose: #ff5c9b;
  --rose-dark: #d92d78;
  --mint: #4fb99f;
  --line: #f3cada;
  --sun: #ffd45c;
  --lavender: #8d6bff;
  --shadow: 0 18px 44px rgba(214, 45, 120, 0.18);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 6%, rgba(255, 92, 155, .34) 0 120px, transparent 121px),
    radial-gradient(circle at 90% 3%, rgba(255, 212, 92, .42) 0 98px, transparent 99px),
    linear-gradient(180deg, #ffe7f1 0%, #fff6fb 42%, #fff1f7 100%);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

button, input { font: inherit; }
button { cursor: pointer; border: 0; }

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at 20% 10%, rgba(255, 212, 92, .42), transparent 160px),
    linear-gradient(180deg, #ffe4f0, #fff6fb);
}
.login-screen[hidden] { display: none; }
.login-card {
  width: min(100%, 420px);
  padding: 24px;
  border-radius: 28px;
  background: rgba(255,255,255,.92);
  border: 2px solid #fff;
  box-shadow: var(--shadow);
}
.login-card p {
  margin: 10px 0 16px;
  color: var(--muted);
  line-height: 1.6;
}
.login-card input,
.password-form input,
.setting-row select {
  width: 100%;
  height: 50px;
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 0 14px;
  background: #fff;
}
.login-error {
  min-height: 22px;
  margin-top: 10px;
  color: var(--rose-dark);
  font-weight: 800;
}

.app {
  width: min(100%, 820px);
  margin: 0 auto;
  padding: 18px 14px 34px;
}

.file-warning {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #fff2c7;
  color: #7a5410;
  border: 1px solid #f0c75e;
  font-size: 14px;
  font-weight: 800;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 16px;
  border-radius: 26px;
  background: linear-gradient(135deg, rgba(255,255,255,.82), rgba(255,220,235,.94));
  border: 1px solid rgba(255,255,255,.9);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.topbar::after {
  content: "";
  position: absolute;
  width: 150px;
  height: 150px;
  right: -56px;
  top: -54px;
  border-radius: 50%;
  background: rgba(255, 92, 155, .18);
}

h1, h2, p { margin: 0; }
h1 {
  font-size: clamp(34px, 10vw, 56px);
  line-height: 1.02;
  color: var(--rose-dark);
  text-shadow: 0 2px 0 #fff;
}
h2 { font-size: 21px; }
.topbar p, .practice-head p, small { color: var(--muted); }

.streak {
  width: 86px;
  height: 86px;
  border-radius: 28px;
  background: linear-gradient(180deg, #fff, #ffe7f1);
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
  text-align: center;
  border: 2px solid #fff;
  position: relative;
  z-index: 1;
}
.streak span { display: block; font-size: 30px; font-weight: 900; color: var(--rose); }
.streak small { display: block; font-size: 12px; }

.intro, .panel {
  background: rgba(255,255,255,.88);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 24px;
}
.intro {
  margin-top: 14px;
  padding: 15px 17px;
  line-height: 1.75;
  color: #5f4652;
  border-left: 7px solid var(--rose);
}

.task-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.task-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 16px;
  background: #fffafd;
  border: 1px solid var(--line);
}
.task-item strong { color: var(--rose-dark); }
.task-item span { color: var(--muted); font-size: 13px; }
.task-badge {
  padding: 7px 10px;
  border-radius: 999px;
  background: #ffe8f1;
  color: var(--rose-dark);
  font-weight: 900;
  font-size: 13px;
}

.quick-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 14px 0;
}
.quick-grid.compact {
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.quick-grid.compact .entry {
  min-height: 78px;
  padding: 12px;
  border-radius: 18px;
}
.quick-grid.compact .entry span,
.quick-grid.compact .entry small {
  display: none;
}
.quick-grid.compact .entry strong {
  font-size: 14px;
}
.entry {
  min-height: 112px;
  text-align: left;
  padding: 19px;
  border-radius: 24px;
  background: linear-gradient(160deg, #fff 0%, #fff2f7 100%);
  box-shadow: var(--shadow);
  border: 2px solid #fff;
  color: var(--text);
  position: relative;
  overflow: hidden;
}
.entry::after {
  content: "";
  position: absolute;
  right: -22px;
  bottom: -28px;
  width: 96px;
  height: 96px;
  border-radius: 32px;
  background: rgba(255, 92, 155, .12);
  transform: rotate(18deg);
}
.entry.primary { background: linear-gradient(135deg, #ff4f98, #ff8bbb 54%, #ffc2d8); color: #fff; }
.entry:nth-child(2) { background: linear-gradient(145deg, #ffffff 0%, #f2ecff 100%); }
.entry:nth-child(2)::after { background: rgba(141, 107, 255, .14); }
.entry:nth-child(3) { background: linear-gradient(145deg, #ffffff 0%, #fff5cf 100%); }
.entry:nth-child(3)::after { background: rgba(255, 212, 92, .28); }
.entry.active {
  filter: saturate(1.1);
  border-color: var(--rose-dark);
  box-shadow: 0 18px 42px rgba(217, 45, 120, .34);
  transform: translateY(-1px);
}
.entry.active strong { color: var(--rose-dark); }
.entry.primary.active strong { color: #fff; }
.entry span { display: block; font-size: 14px; opacity: .78; margin-bottom: 6px; }
.entry strong { display: block; font-size: 23px; line-height: 1.2; }
.entry small { display: block; margin-top: 10px; color: inherit; opacity: .82; }

.panel { padding: 17px; margin-top: 14px; }
.section-title, .practice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.ghost {
  min-width: 54px;
  padding: 9px 12px;
  border-radius: 16px;
  background: #ffe8f1;
  color: var(--rose-dark);
  border: 1px solid var(--line);
  font-weight: 800;
}
.ghost.wide { width: 100%; margin-top: 10px; height: 50px; }
.timer {
  min-width: 62px;
  text-align: center;
  font-weight: 900;
  color: var(--rose-dark);
  background: #fff0f6;
  border-radius: 14px;
  padding: 9px 10px;
}
.progress {
  height: 10px;
  background: #ffe7f0;
  border-radius: 999px;
  overflow: hidden;
  margin: 16px 0;
}
.progress span { display: block; width: 0%; height: 100%; background: linear-gradient(90deg, var(--rose), var(--mint)); }

.question-list { display: grid; gap: 10px; }
.question {
  display: grid;
  grid-template-columns: 32px 1fr 86px;
  gap: 10px;
  align-items: center;
  background: linear-gradient(180deg, #fff, #fff8fb);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 10px;
}
.question.review { background: #fff7df; border-color: #f2d883; }
.qno { color: var(--muted); font-weight: 700; }
.expr { font-size: 22px; font-weight: 900; letter-spacing: 0; }
.answer {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 14px;
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  background: #fff;
}
.submit {
  width: 100%;
  margin-top: 14px;
  height: 54px;
  border-radius: 20px;
  color: #fff;
  background: linear-gradient(135deg, var(--rose), var(--rose-dark));
  font-weight: 900;
  font-size: 18px;
  box-shadow: 0 14px 28px rgba(217, 45, 120, .28);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}
.result-grid div {
  background: #fff0f6;
  border-radius: 16px;
  padding: 12px 8px;
  text-align: center;
}
.result-grid strong { display: block; color: var(--rose-dark); font-size: 24px; }
.result-grid span { color: var(--muted); font-size: 13px; }

.wrong-list, .wrongbook, .analysis { margin-top: 12px; display: grid; gap: 8px; }
.wrong-item, .analysis p {
  background: #fffafd;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  color: #5c4350;
}

.trend {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 7px;
  align-items: end;
  min-height: 136px;
  margin-top: 14px;
}
.bar {
  display: flex;
  flex-direction: column;
  justify-content: end;
  gap: 6px;
  min-width: 0;
}
.bar span {
  display: block;
  min-height: 8px;
  border-radius: 999px 999px 6px 6px;
  background: linear-gradient(180deg, #ff7eaf, #71cab6);
}
.bar small { text-align: center; font-size: 10px; white-space: nowrap; overflow: hidden; }

.memory-help {
  margin-top: 12px;
  padding: 11px 13px;
  border-radius: 16px;
  background: #fff9df;
  border: 1px solid #f1d77a;
  color: #6e5115;
  font-weight: 800;
  line-height: 1.5;
}
.picture-task {
  margin-top: 14px;
  padding: 16px;
  border-radius: 22px;
  background: linear-gradient(160deg, #fff, #fff3f8);
  border: 1px solid var(--line);
}
.picture-formula {
  font-size: 30px;
  color: var(--rose-dark);
  font-weight: 900;
  margin-bottom: 10px;
}
.picture-groups {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}
.picture-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
}
.picture-row-label {
  min-width: 44px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.picture-icon {
  font-size: 28px;
}
.picture-answer {
  width: 100%;
  height: 52px;
  border-radius: 16px;
  border: 1px solid var(--line);
  text-align: center;
  font-size: 24px;
  font-weight: 900;
}
.picture-feedback {
  margin-top: 10px;
  min-height: 24px;
  color: var(--rose-dark);
  font-weight: 900;
}

.table-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 5px;
  margin-top: 14px;
}
.table-cell {
  min-height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fffafd;
  color: #745463;
  font-size: 12px;
  font-weight: 800;
}
.table-cell.head {
  background: #ffe8f1;
  color: var(--rose-dark);
}
.table-cell.learned {
  background: #e8fbf5;
  color: #277d69;
}
.table-cell.current {
  background: linear-gradient(135deg, var(--rose), var(--rose-dark));
  color: #fff;
  box-shadow: 0 8px 18px rgba(217, 45, 120, .28);
}
.lesson-card {
  margin-top: 14px;
  padding: 16px;
  border-radius: 22px;
  background: linear-gradient(160deg, #fff, #fff0f6);
  border: 1px solid var(--line);
}
.lesson-card h3 { margin: 0 0 6px; color: var(--rose-dark); }
.lesson-card strong {
  display: block;
  font-size: 30px;
  color: var(--rose-dark);
  margin-bottom: 8px;
}
.lesson-card p { line-height: 1.65; color: #5f4652; }
.blocks {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}
.block-row {
  display: flex;
  gap: 6px;
}
.cube {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: linear-gradient(135deg, #ff7aac, #ffd45c);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}
.lesson-tip {
  background: #fff9df;
  border: 1px solid #f1d77a;
  border-radius: 14px;
  padding: 9px 11px;
  margin-top: 8px;
}
.lesson-actions { margin-top: 12px; }
.settings-panel {
  margin-bottom: 20px;
}
.setting-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  color: #5f4652;
  font-weight: 800;
}
.setting-row input[type="checkbox"] {
  width: 24px;
  height: 24px;
  accent-color: var(--rose);
}
.setting-row select {
  width: 160px;
  height: 42px;
}
.password-form {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.setting-note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}
@media (min-width: 720px) {
  .quick-grid { grid-template-columns: repeat(3, 1fr); }
  .entry { min-height: 140px; }
}

@media (min-width: 900px) {
  .app {
    width: min(100%, 1080px);
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 14px;
    align-items: start;
  }
  .topbar,
  .intro,
  .quick-grid,
  #practicePanel,
  #tablePanel,
  #memoryPanel,
  #resultPanel {
    grid-column: 1;
  }
  .today-card,
  .settings-panel {
    grid-column: 2;
  }
  .panel:not(#practicePanel):not(#tablePanel):not(#memoryPanel):not(#resultPanel):not(.today-card):not(.settings-panel) {
    grid-column: 2;
  }
  .topbar { margin-bottom: 0; }
}
