:root {
  --ink: #1d2821;
  --ink-soft: #556158;
  --ink-faint: #88918a;
  --paper: #f4f0e7;
  --paper-deep: #e9e3d7;
  --surface: #fffdf8;
  --surface-2: #faf7f0;
  --line: #ddd6c8;
  --line-strong: #c7beae;
  --accent: #9a3428;
  --accent-deep: #76241c;
  --accent-soft: #f5e6e1;
  --sage: #4f6b57;
  --sage-soft: #e7eee7;
  --gold: #a2762d;
  --gold-soft: #f6edda;
  --danger: #a83c35;
  --danger-soft: #f8e8e5;
  --success: #3f6a4c;
  --success-soft: #e9f2ea;
  --sidebar: #203328;
  --sidebar-soft: #2c4737;
  --shadow-sm: 0 8px 24px rgba(51, 40, 24, 0.06);
  --shadow-md: 0 18px 45px rgba(51, 40, 24, 0.11);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color: var(--ink);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 82% 0%, rgba(154, 52, 40, 0.065), transparent 30rem),
    linear-gradient(180deg, #f8f4ec 0%, var(--paper) 35%, #f1ece2 100%);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(154, 52, 40, 0.3);
  outline-offset: 2px;
}

a {
  color: inherit;
}

svg {
  display: block;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  background: var(--paper);
  color: var(--ink-soft);
  transition: opacity 240ms ease, visibility 240ms ease;
}

.boot-screen.hidden {
  opacity: 0;
  visibility: hidden;
}

.boot-screen p {
  margin: 0;
  font-size: 14px;
}

.boot-mark,
.brand-mark {
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--accent);
  color: #fff9ef;
  font-family: var(--serif);
  font-weight: 800;
}

.boot-mark {
  width: 62px;
  height: 62px;
  font-size: 30px;
  box-shadow: var(--shadow-md);
}

.noscript {
  padding: 24px;
  text-align: center;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 30px 20px 22px;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 20% 5%, rgba(255, 255, 255, 0.08), transparent 14rem),
    var(--sidebar);
  color: #f7f2e8;
  overflow: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
}

.brand-mark {
  width: 44px;
  height: 44px;
  font-size: 21px;
  flex: 0 0 auto;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
}

.brand-copy strong {
  display: block;
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: 0.08em;
}

.brand-copy span {
  display: block;
  margin-top: 1px;
  color: rgba(247, 242, 232, 0.58);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.side-nav {
  display: grid;
  gap: 5px;
  margin-top: 34px;
}

.nav-item {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 0 14px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: rgba(247, 242, 232, 0.68);
  cursor: pointer;
  text-align: left;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fffaf0;
  transform: translateX(2px);
}

.nav-item.active {
  background: #f4efe4;
  color: var(--sidebar);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
}

.nav-item svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
}

.nav-label {
  flex: 1;
  font-weight: 600;
}

.nav-count {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.11);
  font-size: 11px;
  font-weight: 700;
}

.nav-item.active .nav-count {
  background: var(--accent);
  color: white;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 26px;
}

.streak-card {
  padding: 15px 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.055);
}

.streak-card-label {
  color: rgba(247, 242, 232, 0.56);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.streak-card-main {
  margin-top: 4px;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.streak-card-main strong {
  font-family: var(--serif);
  font-size: 26px;
}

.streak-card-main span {
  color: rgba(247, 242, 232, 0.7);
  font-size: 12px;
}

.account-card {
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #f7f2e8;
  cursor: pointer;
  text-align: left;
}

.account-card:hover {
  background: rgba(255, 255, 255, 0.06);
}

.account-card > svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  opacity: 0.55;
}

.avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #e8ddc9;
  color: var(--sidebar);
  font-family: var(--serif);
  font-weight: 800;
}

.account-copy {
  min-width: 0;
  flex: 1;
}

.account-copy strong,
.account-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-copy strong {
  font-size: 13px;
}

.account-copy span {
  margin-top: 1px;
  color: rgba(247, 242, 232, 0.52);
  font-size: 10px;
}

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

.mobile-header {
  display: none;
}

.main-content {
  width: min(1180px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 38px clamp(24px, 4vw, 58px) 72px;
}

.view {
  animation: view-in 260ms ease both;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.page-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1.25;
  letter-spacing: 0.02em;
}

.page-subtitle {
  max-width: 660px;
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.page-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.button {
  min-height: 42px;
  padding: 0 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button svg {
  width: 17px;
  height: 17px;
}

.button.primary {
  background: var(--accent);
  color: #fffaf4;
  box-shadow: 0 9px 20px rgba(154, 52, 40, 0.19);
}

.button.primary:hover {
  background: var(--accent-deep);
}

.button.secondary {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.button.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--ink-soft);
}

.button.danger {
  border-color: #edcbc5;
  background: var(--danger-soft);
  color: var(--danger);
}

.button.small {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 12px;
}

.icon-button {
  width: 40px;
  height: 40px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.icon-button.active {
  border-color: #e3b8ab;
  background: var(--accent-soft);
  color: var(--accent);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.85fr);
  gap: 22px;
}

.hero-card {
  position: relative;
  min-height: 300px;
  padding: clamp(28px, 4vw, 44px);
  overflow: hidden;
  display: flex;
  align-items: center;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 45%),
    var(--sidebar);
  color: #fbf6ec;
  box-shadow: var(--shadow-md);
}

.hero-card::after {
  content: "理";
  position: absolute;
  right: -24px;
  bottom: -78px;
  color: rgba(255, 255, 255, 0.035);
  font-family: var(--serif);
  font-size: 260px;
  line-height: 1;
  transform: rotate(-8deg);
  pointer-events: none;
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 520px;
}

.hero-kicker {
  margin: 0 0 10px;
  color: rgba(251, 246, 236, 0.58);
  font-size: 12px;
  letter-spacing: 0.13em;
}

.hero-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(29px, 4vw, 46px);
  line-height: 1.3;
  letter-spacing: 0.02em;
}

.hero-desc {
  max-width: 480px;
  margin: 15px 0 24px;
  color: rgba(251, 246, 236, 0.68);
  font-size: 14px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-actions .primary {
  background: #f0e5d2;
  color: var(--sidebar);
  box-shadow: none;
}

.hero-actions .primary:hover {
  background: #fff7e9;
}

.hero-actions .secondary {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: #fbf6ec;
}

.progress-summary {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

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

.card-heading h2,
.card-heading h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.4;
}

.card-heading span,
.muted {
  color: var(--ink-faint);
  font-size: 12px;
}

.progress-ring-wrap {
  display: flex;
  align-items: center;
  gap: 22px;
}

.progress-ring {
  --progress: 0deg;
  width: 126px;
  height: 126px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: conic-gradient(var(--accent) var(--progress), var(--paper-deep) 0);
}

.progress-ring::before {
  content: "";
  width: 94px;
  height: 94px;
  border-radius: 50%;
  background: var(--surface);
}

.progress-ring-content {
  position: absolute;
  text-align: center;
}

.progress-ring-content strong {
  display: block;
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1.2;
}

.progress-ring-content span {
  display: block;
  margin-top: 3px;
  color: var(--ink-faint);
  font-size: 10px;
}

.progress-ring-shell {
  position: relative;
  display: grid;
  place-items: center;
}

.mini-stats {
  min-width: 0;
  display: grid;
  gap: 13px;
  flex: 1;
}

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

.mini-stat-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line-strong);
}

.mini-stat-dot.mastered {
  background: var(--success);
}

.mini-stat-dot.learning {
  background: var(--gold);
}

.mini-stat-dot.wrong {
  background: var(--danger);
}

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

.mini-stat strong {
  font-size: 13px;
}

.quick-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.quick-card {
  position: relative;
  min-height: 142px;
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.quick-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}

.quick-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--sage-soft);
  color: var(--sage);
}

.quick-icon svg {
  width: 20px;
  height: 20px;
}

.quick-card:nth-child(2) .quick-icon {
  background: var(--accent-soft);
  color: var(--accent);
}

.quick-card:nth-child(3) .quick-icon {
  background: var(--gold-soft);
  color: var(--gold);
}

.quick-card:nth-child(4) .quick-icon {
  background: var(--danger-soft);
  color: var(--danger);
}

.quick-card h3 {
  margin: 14px 0 4px;
  font-family: var(--serif);
  font-size: 17px;
}

.quick-card p {
  margin: 0;
  color: var(--ink-faint);
  font-size: 12px;
}

.quick-arrow {
  position: absolute;
  top: 20px;
  right: 18px;
  color: var(--ink-faint);
}

.section-block {
  margin-top: 24px;
  padding: 24px 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 253, 248, 0.7);
}

.activity-list {
  display: grid;
  gap: 1px;
}

.activity-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(221, 214, 200, 0.7);
}

.activity-row:last-child {
  border-bottom: 0;
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

.activity-dot.wrong {
  background: var(--danger);
}

.activity-dot.fuzzy {
  background: var(--gold);
}

.activity-copy {
  min-width: 0;
}

.activity-copy strong,
.activity-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-copy strong {
  font-size: 13px;
  font-weight: 600;
}

.activity-copy span {
  margin-top: 2px;
  color: var(--ink-faint);
  font-size: 11px;
}

.activity-time {
  color: var(--ink-faint);
  font-size: 11px;
}

.toolbar {
  margin-bottom: 18px;
  padding: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 253, 248, 0.78);
}

.search-field {
  position: relative;
  min-width: 260px;
  flex: 1 1 340px;
}

.search-field svg {
  position: absolute;
  top: 50%;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--ink-faint);
  transform: translateY(-50%);
  pointer-events: none;
}

.search-field input {
  width: 100%;
  height: 44px;
  padding: 0 14px 0 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
}

.select-field {
  min-width: 138px;
  height: 44px;
  padding: 0 35px 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
}

.library-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin: 0 2px 12px;
  color: var(--ink-faint);
  font-size: 12px;
}

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

.question-list-item {
  width: 100%;
  padding: 19px 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  box-shadow: 0 5px 15px rgba(51, 40, 24, 0.035);
  transition: border-color 150ms ease, transform 150ms ease;
}

.question-list-item:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.question-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 8px;
}

.badge {
  min-height: 24px;
  padding: 2px 8px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--paper-deep);
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge.type-single {
  background: var(--sage-soft);
  color: var(--sage);
}

.badge.type-multiple {
  background: var(--gold-soft);
  color: var(--gold);
}

.badge.type-judgment {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge.type-short {
  background: #e9e8f4;
  color: #595684;
}

.badge.status-wrong {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge.status-mastered {
  background: var(--success-soft);
  color: var(--success);
}

.badge.status-learning {
  background: var(--gold-soft);
  color: var(--gold);
}

.question-item-title {
  margin: 0;
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.7;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.question-item-source {
  margin-top: 7px;
  color: var(--ink-faint);
  font-size: 11px;
}

.question-item-right {
  min-width: 62px;
  display: grid;
  place-items: center;
  align-content: center;
  color: var(--ink-faint);
}

.question-number {
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.2;
}

.question-item-right span {
  margin-top: 3px;
  font-size: 10px;
}

.empty-state {
  padding: 70px 24px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: rgba(255, 253, 248, 0.5);
}

.empty-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: var(--paper-deep);
  color: var(--ink-soft);
}

.empty-icon svg {
  width: 26px;
  height: 26px;
}

.empty-state h3 {
  margin: 0 0 5px;
  font-family: var(--serif);
  font-size: 19px;
}

.empty-state p {
  margin: 0 auto;
  max-width: 420px;
  color: var(--ink-faint);
  font-size: 13px;
}

.load-more {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

.study-shell {
  max-width: 880px;
  margin: 0 auto;
}

.study-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  margin-bottom: 22px;
}

.study-header-title {
  min-width: 0;
}

.study-header-title strong,
.study-header-title span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.study-header-title span {
  margin-top: 2px;
  color: var(--ink-faint);
  font-size: 11px;
}

.session-progress {
  height: 5px;
  margin-bottom: 24px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--paper-deep);
}

.session-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 250ms ease;
}

.study-card {
  padding: clamp(24px, 5vw, 48px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.study-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.study-question {
  margin: 20px 0 24px;
  font-family: var(--serif);
  font-size: clamp(20px, 2.5vw, 27px);
  font-weight: 700;
  line-height: 1.65;
  white-space: pre-wrap;
}

.option-list {
  display: grid;
  gap: 11px;
}

.option-item {
  width: 100%;
  min-height: 58px;
  padding: 13px 16px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  cursor: pointer;
  color: var(--ink);
  text-align: left;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.option-item:hover {
  border-color: var(--line-strong);
  background: #fff;
  transform: translateY(-1px);
}

.option-item.selected {
  border-color: #c48678;
  background: var(--accent-soft);
}

.option-item.correct {
  border-color: #91b59b;
  background: var(--success-soft);
}

.option-item.incorrect {
  border-color: #d6a39d;
  background: var(--danger-soft);
}

.option-item.disabled {
  cursor: default;
  transform: none;
}

.option-key {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
}

.option-item.selected .option-key {
  background: var(--accent);
  color: white;
}

.option-item.correct .option-key {
  background: var(--success);
  color: white;
}

.option-item.incorrect .option-key {
  background: var(--danger);
  color: white;
}

.option-text {
  padding-top: 2px;
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.7;
}

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

.judgment-option {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface-2);
  cursor: pointer;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
}

.judgment-option.selected {
  border-color: #c48678;
  background: var(--accent-soft);
  color: var(--accent);
}

.judgment-option.correct {
  border-color: #91b59b;
  background: var(--success-soft);
  color: var(--success);
}

.judgment-option.incorrect {
  border-color: #d6a39d;
  background: var(--danger-soft);
  color: var(--danger);
}

.short-response textarea {
  width: 100%;
  min-height: 150px;
  padding: 16px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.8;
}

.study-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 25px;
}

.study-actions-right {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.answer-panel {
  margin-top: 22px;
  padding: 20px;
  border-left: 3px solid var(--sage);
  border-radius: 0 14px 14px 0;
  background: var(--sage-soft);
}

.answer-panel.wrong {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.answer-panel.neutral {
  border-color: var(--gold);
  background: var(--gold-soft);
}

.answer-status {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  font-weight: 800;
}

.answer-status svg {
  width: 19px;
  height: 19px;
}

.answer-standard {
  margin: 0;
  white-space: pre-wrap;
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.9;
}

.answer-meta {
  margin-top: 12px;
  color: var(--ink-soft);
  font-size: 12px;
}

.grade-row {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.grade-button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  font-weight: 700;
}

.grade-button[data-grade="correct"] {
  color: var(--success);
}

.grade-button[data-grade="fuzzy"] {
  color: var(--gold);
}

.grade-button[data-grade="wrong"] {
  color: var(--danger);
}

.note-box {
  margin-top: 22px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.note-box label {
  display: block;
  margin-bottom: 7px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.note-box textarea {
  width: 100%;
  min-height: 78px;
  padding: 12px 13px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--ink);
}

.study-footer-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 15px;
}

.tool-link {
  min-height: 34px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
  font-size: 12px;
}

.tool-link svg {
  width: 16px;
  height: 16px;
}

.tool-link.active {
  color: var(--accent);
}

.study-complete {
  max-width: 720px;
  margin: 0 auto;
  padding: 56px 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-align: center;
  box-shadow: var(--shadow-md);
}

.complete-mark {
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--success-soft);
  color: var(--success);
}

.complete-mark svg {
  width: 34px;
  height: 34px;
}

.study-complete h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 30px;
}

.study-complete p {
  margin: 8px auto 0;
  color: var(--ink-soft);
}

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

.result-stat {
  padding: 18px 12px;
  border-radius: 14px;
  background: var(--surface-2);
}

.result-stat strong,
.result-stat span {
  display: block;
}

.result-stat strong {
  font-family: var(--serif);
  font-size: 25px;
}

.result-stat span {
  margin-top: 3px;
  color: var(--ink-faint);
  font-size: 11px;
}

.complete-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
  margin-bottom: 22px;
}

.stat-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.stat-card span {
  display: block;
  color: var(--ink-faint);
  font-size: 11px;
}

.stat-card strong {
  display: block;
  margin-top: 6px;
  font-family: var(--serif);
  font-size: 27px;
  line-height: 1.2;
}

.analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.75fr);
  gap: 20px;
}

.chart-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.bar-chart {
  height: 230px;
  display: grid;
  grid-template-columns: repeat(14, minmax(18px, 1fr));
  align-items: end;
  gap: 7px;
  padding-top: 24px;
}

.bar-column {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.bar {
  width: min(24px, 72%);
  min-height: 3px;
  border-radius: 6px 6px 2px 2px;
  background: var(--sage);
}

.bar-label {
  color: var(--ink-faint);
  font-size: 9px;
}

.distribution {
  display: grid;
  gap: 13px;
  margin-top: 22px;
}

.distribution-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 10px;
  font-size: 11px;
}

.distribution-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--paper-deep);
}

.distribution-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--sage);
}

.distribution-row:nth-child(2) .distribution-track span {
  background: var(--gold);
}

.distribution-row:nth-child(3) .distribution-track span {
  background: var(--danger);
}

.settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.72fr);
  gap: 20px;
}

.settings-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.settings-card + .settings-card {
  margin-top: 16px;
}

.settings-card h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 20px;
}

.settings-card p {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.setting-row {
  padding: 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid rgba(221, 214, 200, 0.7);
}

.setting-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.setting-copy strong,
.setting-copy span {
  display: block;
}

.setting-copy strong {
  font-size: 13px;
}

.setting-copy span {
  margin-top: 2px;
  color: var(--ink-faint);
  font-size: 11px;
}

.number-input {
  width: 82px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  text-align: center;
}

.account-panel {
  padding: 28px;
  border-radius: var(--radius-lg);
  background: var(--sidebar);
  color: #f8f3e9;
}

.account-panel .avatar {
  width: 52px;
  height: 52px;
  font-size: 19px;
}

.account-panel-head {
  display: flex;
  align-items: center;
  gap: 13px;
}

.account-panel-copy strong,
.account-panel-copy span {
  display: block;
}

.account-panel-copy strong {
  font-family: var(--serif);
  font-size: 18px;
}

.account-panel-copy span {
  margin-top: 2px;
  color: rgba(248, 243, 233, 0.56);
  font-size: 11px;
}

.account-panel p {
  margin: 18px 0;
  color: rgba(248, 243, 233, 0.68);
  font-size: 12px;
}

.account-panel .button.secondary {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #f8f3e9;
}

.status-dot {
  width: 7px;
  height: 7px;
  display: inline-block;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--gold);
}

.status-dot.online {
  background: #7dbb8a;
}

.status-dot.offline {
  background: #d79a91;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(26, 32, 28, 0.55);
  backdrop-filter: blur(7px);
  animation: fade-in 160ms ease;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.modal {
  width: min(520px, 100%);
  max-height: min(86vh, 820px);
  overflow: auto;
  padding: 28px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.24);
  animation: modal-in 200ms ease;
}

.modal.wide {
  width: min(760px, 100%);
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.modal-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 24px;
}

.modal-head p {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  padding: 4px;
  margin-bottom: 20px;
  border-radius: 12px;
  background: var(--paper-deep);
}

.auth-tab {
  min-height: 38px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  font-weight: 700;
}

.auth-tab.active {
  background: var(--surface);
  box-shadow: 0 3px 10px rgba(51, 40, 24, 0.08);
}

.form-stack {
  display: grid;
  gap: 13px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--ink);
}

.field textarea {
  min-height: 130px;
  padding: 12px 13px;
}

.form-note,
.cloud-note {
  padding: 13px 15px;
  border-radius: 12px;
  background: var(--gold-soft);
  color: #6f5b32;
  font-size: 12px;
}

.cloud-note {
  background: var(--sage-soft);
  color: var(--sage);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 20px;
}

.detail-content {
  display: grid;
  gap: 16px;
}

.detail-question {
  margin: 0;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.75;
  white-space: pre-wrap;
}

.detail-options {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.detail-options li {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  font-family: var(--serif);
}

.detail-options li.correct {
  background: var(--success-soft);
  color: var(--success);
}

.detail-answer {
  padding: 16px;
  border-left: 3px solid var(--sage);
  border-radius: 0 12px 12px 0;
  background: var(--sage-soft);
  white-space: pre-wrap;
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1.85;
}

.share-link-box {
  display: flex;
  gap: 8px;
}

.share-link-box input {
  min-width: 0;
  flex: 1;
}

.toast-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 300;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.toast {
  min-width: 220px;
  max-width: min(380px, calc(100vw - 40px));
  padding: 12px 15px;
  border-radius: 12px;
  background: var(--sidebar);
  color: #fffaf1;
  box-shadow: var(--shadow-md);
  font-size: 12px;
  animation: toast-in 190ms ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.mobile-nav {
  display: none;
}

.loading-inline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1050px) {
  .app-shell {
    grid-template-columns: 218px minmax(0, 1fr);
  }

  .sidebar {
    padding-inline: 14px;
  }

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

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

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

@media (max-width: 760px) {
  body {
    padding-bottom: 74px;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .mobile-header {
    position: sticky;
    top: 0;
    z-index: 20;
    height: 62px;
    padding: 0 17px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(221, 214, 200, 0.8);
    background: rgba(248, 244, 236, 0.94);
    backdrop-filter: blur(10px);
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    font-family: var(--serif);
    font-weight: 800;
  }

  .mobile-brand .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    font-size: 17px;
  }

  .mobile-account {
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
    cursor: pointer;
    font-family: var(--serif);
    font-weight: 800;
  }

  .main-content {
    padding: 24px 16px 44px;
  }

  .page-head {
    display: block;
    margin-bottom: 22px;
  }

  .page-actions {
    margin-top: 16px;
  }

  .page-title {
    font-size: 29px;
  }

  .hero-card {
    min-height: 280px;
    padding: 26px 23px;
  }

  .hero-title {
    font-size: 31px;
  }

  .quick-grid {
    gap: 11px;
  }

  .quick-card {
    min-height: 126px;
    padding: 16px;
  }

  .quick-card h3 {
    font-size: 15px;
  }

  .progress-summary,
  .section-block {
    padding: 20px;
  }

  .progress-ring-wrap {
    gap: 15px;
  }

  .progress-ring {
    width: 112px;
    height: 112px;
  }

  .progress-ring::before {
    width: 84px;
    height: 84px;
  }

  .toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .search-field {
    min-width: 0;
    grid-column: 1 / -1;
  }

  .select-field {
    min-width: 0;
    width: 100%;
  }

  .question-list-item {
    grid-template-columns: minmax(0, 1fr) 42px;
    padding: 16px;
  }

  .question-number {
    font-size: 18px;
  }

  .study-card {
    padding: 22px 17px;
    border-radius: 20px;
  }

  .study-question {
    font-size: 20px;
  }

  .option-item {
    min-height: 54px;
    padding: 11px 12px;
  }

  .study-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .study-actions-right {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .study-actions-right .button {
    width: 100%;
  }

  .study-header {
    gap: 10px;
  }

  .study-header .icon-button {
    width: 36px;
    height: 36px;
  }

  .result-grid {
    gap: 8px;
  }

  .result-stat {
    padding: 14px 8px;
  }

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

  .analytics-grid,
  .settings-layout {
    grid-template-columns: 1fr;
  }

  .bar-chart {
    gap: 3px;
  }

  .settings-card {
    padding: 20px;
  }

  .mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    height: 68px;
    padding: 7px 7px max(7px, env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    border-top: 1px solid var(--line);
    background: rgba(255, 253, 248, 0.96);
    backdrop-filter: blur(12px);
  }

  .mobile-nav-item {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 3px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: var(--ink-faint);
    cursor: pointer;
    font-size: 9px;
  }

  .mobile-nav-item svg {
    width: 20px;
    height: 20px;
  }

  .mobile-nav-item.active {
    color: var(--accent);
    background: var(--accent-soft);
  }

  .modal {
    padding: 22px 18px;
    border-radius: 21px;
  }

  .toast-root {
    right: 13px;
    bottom: 82px;
    left: 13px;
  }

  .toast {
    min-width: 0;
    max-width: none;
  }
}

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

  .progress-ring-wrap {
    display: grid;
    justify-items: center;
  }

  .mini-stats {
    width: 100%;
  }

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

  .select-field {
    grid-column: 1 / -1;
  }

  .judgment-options {
    grid-template-columns: 1fr;
  }

  .complete-actions .button {
    width: 100%;
  }

  .account-panel-head {
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
