:root {
  --bg: #f3f6fc;
  --card: #ffffff;
  --ink: #1f2937;
  --sub: #6b7280;
  --muted: #9aa4b2;
  --pri: #2e5496;
  --pri-dark: #1f3864;
  --line: #e6ebf4;
  --soft: #eaf0fa;
  --danger: #d25555;
  --amber: #c98a1e;
  --green: #3fa37a;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #e9eef7;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  justify-content: center;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.phone {
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

@media (min-width: 520px) {
  body {
    background: linear-gradient(160deg, #dfe7f4, #f3f6fc 55%);
  }
  .phone {
    width: 480px;
    flex: 0 0 480px;
    box-shadow: 0 20px 60px rgba(31, 56, 100, 0.14);
  }
}

.main {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 22px 16px 88px;
  -webkit-overflow-scrolling: touch;
}

.main::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

/* header */
.top {
  margin-bottom: 18px;
}

.top-date {
  font-size: 13px;
  color: var(--sub);
  letter-spacing: 0.02em;
}

.top-title {
  margin: 6px 0 0;
  font-size: 24px;
  line-height: 1.25;
  color: var(--ink);
}

.top-title strong {
  color: var(--pri-dark);
  font-size: 30px;
}

/* cards */
.card {
  background: var(--card);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 10px rgba(31, 56, 100, 0.05);
}

.card-title {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--ink);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.card-head .card-title {
  margin: 0;
}

.text-btn {
  border: 0;
  background: none;
  color: var(--pri);
  font-size: 13px;
  font-family: inherit;
  padding: 4px 2px;
  cursor: pointer;
}

.text-btn.danger-text {
  color: var(--danger);
}

.subject-form {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.subject-form input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
  background: #fbfcff;
}

.subject-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.subject-row:last-of-type {
  border-bottom: 0;
}

.subject-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.small-note {
  margin-top: 12px;
  font-size: 12px;
}

.section {
  margin-top: 18px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.section-head h2 {
  margin: 0;
  font-size: 15px;
}

.link {
  color: var(--pri);
  font-size: 13px;
  text-decoration: none;
}

/* hero */
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 18px;
}

.hero-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.hero-num {
  font-size: 40px;
  font-weight: 700;
  color: var(--pri-dark);
  line-height: 1;
}

.hero-label {
  font-size: 14px;
  color: var(--sub);
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 6px;
}

.mini {
  background: var(--card);
  border-radius: 14px;
  padding: 14px 12px;
  text-align: center;
  box-shadow: 0 2px 10px rgba(31, 56, 100, 0.04);
}

.mini span {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: var(--pri-dark);
}

.mini small {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

/* daily study time */
.study-total {
  font-size: 22px;
  font-weight: 700;
  color: var(--pri-dark);
}

.study-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 2px 0 12px;
}

.study-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--sub);
  background: #f4f7fc;
  border-radius: 999px;
  padding: 4px 10px;
}

.study-chip i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.quick-row select {
  flex: 1 0 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
  background: #fbfcff;
}

.mini-btn {
  flex: 1;
  border: 0;
  border-radius: 10px;
  background: var(--soft);
  color: var(--pri);
  font-size: 13px;
  font-family: inherit;
  padding: 9px 6px;
  cursor: pointer;
}

.mini-btn:active {
  background: #dfe8f7;
}

.undo-time {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

/* buttons */
.btn {
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  background: var(--soft);
  color: var(--pri);
  transition: transform 0.08s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn.primary {
  background: var(--pri);
  color: #fff;
}

.btn.primary:disabled {
  background: #c9d4e6;
  color: #f4f7fc;
}

.btn.ghost {
  background: #f4f7fc;
  color: var(--pri);
  border: 1px solid #dce4f1;
}

.btn.danger {
  background: #fdecec;
  color: var(--danger);
}

.btn.block {
  display: block;
  width: 100%;
  margin-top: 12px;
}

.center {
  text-align: center;
  margin-top: 16px;
}

.center .btn {
  text-decoration: none;
  display: inline-block;
}

.block-label {
  display: block;
  text-align: center;
  margin-top: 10px;
  cursor: pointer;
}

/* mistake list */
.item {
  padding: 14px 16px;
  cursor: pointer;
}

.item:active {
  background: #fbfcff;
}

.item-top {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--sub);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.item-subject {
  font-weight: 600;
  color: var(--ink);
}

.item-node {
  color: var(--sub);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 45%;
}

.item-due {
  margin-left: auto;
  color: var(--muted);
  flex: 0 0 auto;
}

.item-due.due {
  color: var(--danger);
}

.item-stem {
  margin: 8px 0 10px;
  font-size: 14px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  font-size: 11px;
  color: var(--sub);
  background: #f4f7fc;
  border-radius: 999px;
  padding: 3px 9px;
}

/* chips */
.chips {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.chip {
  border: 0;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-family: inherit;
  background: var(--card);
  color: var(--sub);
  cursor: pointer;
}

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

/* empty */
.empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--sub);
}

.empty.small {
  padding: 28px 16px;
}

.empty p {
  margin: 0 0 8px;
}

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

/* review */
.progress {
  height: 6px;
  border-radius: 3px;
  background: #e6edf8;
  overflow: hidden;
  margin-bottom: 16px;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--pri);
  border-radius: 3px;
  transition: width 0.2s ease;
}

.question-stem {
  font-size: 16px;
  line-height: 1.65;
  margin: 10px 0 0;
}

.question-img {
  width: 100%;
  border-radius: 12px;
  margin-top: 12px;
}

.answer {
  background: #fbfcfe;
  border: 1px solid var(--line);
}

.answer-label {
  font-size: 12px;
  color: var(--pri);
  font-weight: 600;
  margin: 10px 0 4px;
}

.answer-label:first-child {
  margin-top: 0;
}

.hint {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 10px;
}

.rate-label {
  text-align: center;
  font-size: 13px;
  color: var(--sub);
  margin: 18px 0 10px;
}

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

.rate {
  border: 0;
  border-radius: 12px;
  padding: 12px 0;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}

.rate.again {
  background: #fdecec;
  color: var(--danger);
}

.rate.hard {
  background: #fff5e3;
  color: var(--amber);
}

.rate.good {
  background: var(--soft);
  color: var(--pri);
}

.rate.easy {
  background: #e8f4ee;
  color: var(--green);
}

.center-link {
  display: block;
  text-align: center;
  margin-top: 20px;
}

/* stats */
.bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
  font-size: 13px;
}

.bar-name {
  width: 76px;
  flex: 0 0 auto;
  color: var(--sub);
}

.bar {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: #eef2f9;
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  border-radius: 4px;
}

.bar-num {
  width: 26px;
  text-align: right;
  color: var(--muted);
}

.callout {
  background: #fff8ea;
  border-left: 4px solid var(--amber);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.6;
  color: #6b531f;
  margin-top: 6px;
}

/* settings */
.input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
  background: #fbfcff;
  margin-bottom: 10px;
}

.version {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 24px;
}

/* nav */
.nav {
  position: relative;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  z-index: 20;
}

.nav-item {
  text-align: center;
  padding: 8px 0;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  border-radius: 12px;
}

.nav-item.active {
  color: var(--pri);
  font-weight: 600;
  background: var(--soft);
}

/* fab */
.fab {
  position: absolute;
  right: 18px;
  bottom: calc(84px + env(safe-area-inset-bottom));
  border: 0;
  border-radius: 999px;
  padding: 13px 20px;
  background: var(--pri);
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  box-shadow: 0 10px 24px rgba(31, 56, 100, 0.28);
  cursor: pointer;
  z-index: 15;
}

/* modal */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 32, 54, 0.36);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 40;
}

.sheet {
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  padding: 18px 18px calc(24px + env(safe-area-inset-bottom));
}

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

.sheet-head h2 {
  margin: 0;
  font-size: 17px;
}

.icon-btn {
  border: 0;
  background: #f1f5fb;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  color: var(--sub);
  cursor: pointer;
}

.form label {
  display: block;
  font-size: 12px;
  color: var(--sub);
  margin: 12px 0 6px;
}

.form input,
.form select,
.form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
  background: #fbfcff;
}

.form textarea {
  resize: vertical;
}

.preview {
  width: 100%;
  border-radius: 10px;
  margin-top: 8px;
}

.hidden {
  display: none;
}

.detail-stem {
  font-size: 15px;
  line-height: 1.65;
}

.detail-img {
  width: 100%;
  border-radius: 12px;
  margin: 10px 0;
}

.sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.sheet-actions .btn {
  flex: 1;
}

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: rgba(31, 41, 55, 0.92);
  color: #fff;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 999px;
  z-index: 60;
  white-space: nowrap;
}

@media (max-width: 380px) {
  .hero-num {
    font-size: 34px;
  }
  .top-title {
    font-size: 21px;
  }
}

/* ---------- today: ring, tasks, week, insight ---------- */

.ring-card {
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  padding: 18px 16px 36px;
}

.ring-wrap {
  position: relative;
  width: 112px;
  height: 112px;
  flex: 0 0 auto;
}

.ring {
  width: 112px;
  height: 112px;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: #e6edf8;
  stroke-width: 10;
}

.ring-fg {
  fill: none;
  stroke: var(--pri);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.4s ease;
}

.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ring-center strong {
  font-size: 19px;
  color: var(--pri-dark);
}

.ring-center span {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.ring-info {
  flex: 1;
  min-width: 0;
}

.ring-goal {
  font-size: 13px;
  color: var(--sub);
}

.ring-percent {
  font-size: 22px;
  font-weight: 700;
  color: var(--pri-dark);
  margin: 4px 0;
}

.ring-stats {
  font-size: 12px;
  color: var(--sub);
  margin-bottom: 6px;
}

.ring-log {
  position: absolute;
  right: 14px;
  bottom: 10px;
}

.tasks {
  margin-top: 4px;
}

.task {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 8px;
  box-shadow: 0 2px 10px rgba(31, 56, 100, 0.04);
}

.check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #c8d2e2;
  background: transparent;
  flex: 0 0 auto;
  cursor: pointer;
  position: relative;
}

.check.on {
  background: var(--pri);
  border-color: var(--pri);
}

.check.on::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 3px;
  width: 5px;
  height: 9px;
  border: 2px solid #fff;
  border-top: 0;
  border-left: 0;
  transform: rotate(45deg);
}

.task-main {
  flex: 1;
  min-width: 0;
}

.task-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}

.task-meta {
  font-size: 12px;
  color: var(--muted);
}

.task.done .task-title {
  color: var(--muted);
  text-decoration: line-through;
}

.play {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: var(--soft);
  position: relative;
  cursor: pointer;
  flex: 0 0 auto;
}

.play::after {
  content: "";
  position: absolute;
  left: 13px;
  top: 10px;
  border-left: 11px solid var(--pri);
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
}

.add-row {
  width: 100%;
  border: 1px dashed #d5deec;
  background: transparent;
  border-radius: 14px;
  padding: 12px;
  color: var(--pri);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}

.week-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 2px 0 10px;
}

.week-line strong {
  font-size: 26px;
  color: var(--pri-dark);
}

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

.week-card .bar {
  display: block;
  width: 100%;
}

.week-note {
  margin-top: 8px;
  font-size: 12px;
}

.due-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.due-title {
  font-size: 18px;
  font-weight: 700;
}

.insight-title {
  font-size: 12px;
  color: var(--pri);
  font-weight: 600;
  margin-bottom: 6px;
}

.insight-card p {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.6;
}

/* ---------- mistakes: thumbnail cards ---------- */

.item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
}

.thumb {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: #f4f7fc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--muted);
  overflow: hidden;
  flex: 0 0 auto;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-body {
  flex: 1;
  min-width: 0;
}

.item-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}

.item-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.summary-card {
  margin-top: 4px;
  font-size: 13px;
}

.min-grid {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.field-label {
  display: block;
  font-size: 12px;
  color: var(--sub);
  margin: 8px 0 6px;
}

.switch-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--sub);
  line-height: 1.5;
  margin: 10px 0;
}

.switch-line input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--pri);
}



