:root {
  --ink: #262432;
  --muted: #777487;
  --line: #ebe8f1;
  --paper: #ffffff;
  --canvas: #f6f5fa;
  --purple: #6253d9;
  --purple-dark: #4d40ba;
  --purple-soft: #ece9ff;
  --orange: #ef8a4d;
  --success: #2f9b75;
  --danger: #df5d6c;
  --shadow: 0 16px 42px rgba(40, 35, 82, 0.09);
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: #eeedf3;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 4%, rgba(98, 83, 217, 0.1), transparent 24rem),
    #eeedf3;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { color: inherit; }

.app-shell {
  width: min(100%, 560px);
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--canvas);
  box-shadow: 0 0 60px rgba(36, 35, 49, 0.08);
  position: relative;
}

.hidden { display: none !important; }

.login-page {
  min-height: 100dvh;
  padding: calc(36px + env(safe-area-inset-top)) 22px calc(30px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 86% 8%, rgba(255, 255, 255, 0.24), transparent 16rem),
    linear-gradient(165deg, #6253d9 0%, #4e3fb7 45%, #f6f5fa 45.1%);
}

.login-brand {
  color: #fff;
  padding: 10px 4px 46px;
}

.brand-kicker,
.soft-label {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.brand-kicker { color: #ddd8ff; }
.soft-label { color: var(--purple); }

.login-brand h1 {
  max-width: 330px;
  margin: 0;
  font-size: clamp(28px, 8vw, 38px);
  line-height: 1.25;
  letter-spacing: -0.035em;
}

.login-brand p:last-child {
  margin: 13px 0 0;
  color: #ddd8ff;
  font-size: 13px;
}

.login-card {
  margin-top: -6px;
  padding: 25px 21px 20px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 27px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 24px 60px rgba(50, 39, 118, 0.19);
}

.login-card h2 {
  margin: 0 0 5px;
  font-size: 22px;
}

.login-card > p {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.field-label {
  display: block;
  margin: 0 0 8px;
  color: #514e5d;
  font-size: 12px;
  font-weight: 800;
}

.phone-field,
.password-field {
  height: 52px;
  margin-bottom: 16px;
  border: 1px solid #dedbe7;
  border-radius: 15px;
  background: #fbfafc;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.phone-prefix {
  align-self: stretch;
  padding: 0 13px;
  display: grid;
  place-items: center;
  color: var(--purple);
  background: #f0edff;
  border-right: 1px solid #dedbe7;
  font-size: 13px;
  font-weight: 900;
}

.phone-field input,
.password-field input {
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
  padding: 0 14px;
  color: var(--ink);
  background: transparent;
  font-size: 15px;
}

.password-toggle {
  height: 100%;
  border: 0;
  padding: 0 14px;
  color: var(--purple);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 1px 0 18px;
  color: var(--muted);
  font-size: 12px;
}

.remember-row input { accent-color: var(--purple); }

.primary-button,
.secondary-button,
.danger-button {
  min-height: 50px;
  border: 0;
  border-radius: 16px;
  padding: 0 20px;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.primary-button {
  color: #fff;
  background: var(--purple);
  box-shadow: 0 12px 25px rgba(98, 83, 217, 0.2);
}

.primary-button:disabled { opacity: 0.38; box-shadow: none; }
.secondary-button { color: var(--purple); background: var(--purple-soft); }
.danger-button { color: #c84e5f; background: #ffedf0; }
.full-button { width: 100%; }

.primary-button:active,
.secondary-button:active,
.danger-button:active,
.type-card:active,
.quick-card:active,
.option:active { transform: scale(0.985); }

.login-message {
  min-height: 18px;
  margin: 12px 2px 0;
  color: var(--danger);
  font-size: 12px;
  line-height: 1.5;
}

.local-notice {
  margin: 19px 5px 0;
  padding: 13px 14px;
  border: 1px dashed #d9d4eb;
  border-radius: 15px;
  color: #6e697c;
  background: rgba(255, 255, 255, 0.56);
  font-size: 11px;
  line-height: 1.65;
}

.topbar {
  min-height: 76px;
  padding: calc(16px + env(safe-area-inset-top)) 20px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(246, 245, 250, 0.94);
  backdrop-filter: blur(16px);
}

.topbar h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.user-chip {
  min-width: 84px;
  min-height: 43px;
  border: 1px solid #ded9f8;
  border-radius: 14px;
  padding: 6px 10px;
  color: var(--purple);
  background: var(--purple-soft);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
}

.user-chip strong { font-size: 11px; }
.user-chip span { margin-top: 2px; color: #847bb2; font-size: 9px; }

.page-content {
  padding: 8px 18px calc(102px + env(safe-area-inset-bottom));
}

.daily-card {
  min-height: 224px;
  padding: 24px;
  border-radius: 28px;
  color: #fff;
  background:
    radial-gradient(circle at 88% 2%, rgba(255, 255, 255, 0.25), transparent 35%),
    linear-gradient(135deg, #6856df 0%, #5846c6 63%, #4a3ab0 100%);
  box-shadow: 0 20px 45px rgba(78, 65, 191, 0.25);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  position: relative;
  overflow: hidden;
}

.daily-card::after {
  content: "";
  width: 140px;
  height: 140px;
  border: 28px solid rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  position: absolute;
  right: -62px;
  bottom: -68px;
}

.daily-card .soft-label { color: #ddd8ff; }
.daily-card h2 { margin: 9px 0 8px; font-size: 26px; letter-spacing: -0.03em; }
.daily-card p { margin: 0; color: #ddd8ff; font-size: 13px; }

.progress-ring {
  --progress: 0deg;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  display: grid;
  place-content: center;
  align-self: center;
  background: conic-gradient(#ffbd67 var(--progress), rgba(255, 255, 255, 0.16) 0);
  position: relative;
  z-index: 1;
}

.progress-ring::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: #5c49ca;
}

.progress-ring strong,
.progress-ring span { position: relative; z-index: 1; text-align: center; }
.progress-ring strong { font-size: 21px; }
.progress-ring span { color: #ddd8ff; font-size: 10px; }

.daily-action {
  grid-column: 1 / -1;
  width: fit-content;
  min-height: 45px;
  color: #4d3eae;
  background: #fff;
  box-shadow: none;
  position: relative;
  z-index: 1;
}

.section-heading {
  margin: 31px 3px 14px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

.section-heading h2,
.panel-title h2,
.empty-card h2,
.summary-card h2 { margin: 0; font-size: 21px; letter-spacing: -0.02em; }

.text-button {
  border: 0;
  padding: 8px 0;
  color: var(--purple);
  background: transparent;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

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

.type-card {
  min-height: 91px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper);
  box-shadow: 0 8px 22px rgba(36, 35, 49, 0.035);
  display: flex;
  align-items: center;
  gap: 11px;
  text-align: left;
  cursor: pointer;
}

.type-card:last-child { grid-column: 1 / -1; }

.type-symbol {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 900;
}

.tone-violet { background: #ece9ff; color: #6655da; }
.tone-blue { background: #e5f1ff; color: #397ec5; }
.tone-orange { background: #fff0e5; color: #d87436; }
.tone-green { background: #e2f5ed; color: #298664; }
.tone-rose { background: #ffe9ec; color: #d85c6b; }

.type-copy { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.type-copy strong { font-size: 15px; }
.type-copy small,
.quick-card small,
.muted,
.question-meta,
.quiz-header small { color: var(--muted); font-size: 11px; }
.chevron { margin-left: auto; color: #b3afc2; font-size: 22px; }

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

.quick-card {
  min-height: 128px;
  border: 0;
  border-radius: 22px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  text-align: left;
  cursor: pointer;
}

.quick-card.random { color: #4f42b4; background: #e9e6ff; }
.quick-card.error { color: #c35f43; background: #ffebe5; }
.quick-icon { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: rgba(255,255,255,.73); font-weight: 900; }
.quick-card strong { margin-top: 3px; font-size: 15px; }
.quick-card small { color: currentColor; opacity: .72; }

.source-note {
  margin-top: 22px;
  padding: 14px 16px;
  border: 1px dashed #d8d4e5;
  border-radius: 18px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  line-height: 1.6;
}

.source-note span { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; color: var(--purple); background: #fff; font-weight: 900; }

.bottom-nav {
  width: min(100%, 560px);
  height: calc(74px + env(safe-area-inset-bottom));
  padding: 9px 35px env(safe-area-inset-bottom);
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px);
  display: flex;
  justify-content: space-between;
}

.bottom-nav button {
  min-width: 54px;
  border: 0;
  background: transparent;
  color: #aaa6b5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.bottom-nav button span { width: 29px; height: 28px; border-radius: 10px; display: grid; place-items: center; font-size: 15px; font-weight: 900; }
.bottom-nav button.active { color: var(--purple); }
.bottom-nav button.active span { background: var(--purple-soft); }

.panel-title {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fff;
}

.panel-title p { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }

.search-box {
  height: 50px;
  margin: 14px 0;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 9px;
}

.search-box strong { color: var(--purple); font-size: 20px; }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 14px; }

.library-list,
.result-list,
.mistake-list,
.profile-list { display: flex; flex-direction: column; gap: 11px; }

.library-card,
.result-card,
.mistake-card,
.profile-card {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: #fff;
}

.library-card { display: grid; grid-template-columns: auto 1fr; gap: 13px; }
.library-main { min-width: 0; }
.library-title { display: flex; justify-content: space-between; align-items: center; }
.library-title strong { font-size: 15px; }
.library-title span { color: var(--muted); font-size: 11px; }
.thin-progress { height: 6px; margin: 10px 0 7px; border-radius: 99px; overflow: hidden; background: #efedf3; }
.thin-progress span, .quiz-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #7869e4, #9b8ff0); }
.library-foot { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.library-actions { grid-column: 2; display: flex; gap: 8px; }
.mini-button { border: 0; border-radius: 10px; padding: 7px 12px; color: var(--purple); background: #f1effc; font-size: 11px; font-weight: 900; cursor: pointer; }

.result-card,
.mistake-card { text-align: left; position: relative; }
.result-card { width: 100%; cursor: pointer; }
.result-card span,
.mistake-card > span { color: var(--purple); font-size: 10px; font-weight: 900; }
.result-card p,
.mistake-card p { margin: 7px 0 0; color: #4d4958; font-size: 13px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mistake-card { padding-right: 82px; }
.mistake-card button { position: absolute; right: 12px; top: 14px; }

.empty-card,
.summary-card {
  min-height: 390px;
  padding: 40px 24px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.empty-symbol,
.summary-symbol {
  width: 86px;
  height: 86px;
  margin-bottom: 22px;
  border-radius: 28px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #7d6fe8, #5849c5);
  box-shadow: 0 18px 40px rgba(98,83,217,.22);
  font-size: 31px;
  font-weight: 900;
}

.empty-card p,
.summary-card p { max-width: 320px; margin: 9px 0 22px; color: var(--muted); font-size: 13px; line-height: 1.7; }

.profile-list { margin-top: 14px; }
.profile-card h3 { margin: 0 0 7px; font-size: 15px; }
.profile-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.profile-actions { margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.profile-actions.single { grid-template-columns: 1fr; }
.profile-actions button { min-height: 42px; font-size: 12px; }
.account-number { color: var(--purple); font-size: 22px; font-weight: 900; letter-spacing: .03em; }

.quiz-page { min-height: 100dvh; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.quiz-header { min-height: calc(72px + env(safe-area-inset-top)); padding: calc(12px + env(safe-area-inset-top)) 16px 10px; display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; background: rgba(255,255,255,.95); backdrop-filter: blur(16px); }
.icon-button { width: 38px; height: 38px; border: 0; border-radius: 12px; display: grid; place-items: center; color: #5b5767; background: #f2f0f6; font-size: 23px; cursor: pointer; }
.quiz-header > div { display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; }
.quiz-header strong { font-size: 15px; }
.quiz-header .favorite { justify-self: end; }
.quiz-header .favorite.active { color: #d59321; background: #fff2d5; }
.quiz-progress { height: 4px; background: #e4e1ea; }

.question-wrap { padding: 22px 17px 0; }
.question-meta { margin: 0 3px 10px; display: flex; align-items: center; justify-content: space-between; }
.question-type { padding: 6px 10px; border-radius: 99px; font-weight: 900; }
.question-card { padding: 22px 18px; border: 1px solid var(--line); border-radius: 24px; background: #fff; box-shadow: 0 12px 35px rgba(36,35,49,.05); }
.question-card h2 { margin: 0; font-size: 17px; line-height: 1.85; letter-spacing: .005em; white-space: pre-wrap; }
.option-list { margin-top: 22px; display: flex; flex-direction: column; gap: 10px; }
.option { width: 100%; min-height: 58px; padding: 10px 13px; border: 1px solid #e8e5ed; border-radius: 16px; background: #fbfafc; display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 11px; text-align: left; cursor: pointer; }
.option > span { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; color: #6e6a79; background: #efedf3; font-size: 13px; font-weight: 900; }
.option p { margin: 0; color: #4e4b58; font-size: 14px; line-height: 1.55; }
.option.selected { border-color: #8b7de8; background: #f2efff; }
.option.selected > span { color: #fff; background: var(--purple); }
.option.correct { border-color: #77c8aa; background: #eaf8f2; }
.option.correct > span { color: #fff; background: var(--success); }
.option.wrong { border-color: #ed9ba5; background: #fff0f2; }
.option.wrong > span { color: #fff; background: var(--danger); }

.think-panel,
.answer-panel { margin-top: 22px; padding: 16px; border-radius: 17px; }
.think-panel { background: #f5f3fa; }
.think-panel span,
.answer-panel span { display: block; margin-bottom: 7px; color: var(--purple); font-size: 11px; font-weight: 900; }
.think-panel p,
.answer-panel p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.answer-panel strong { display: block; font-size: 14px; line-height: 1.8; white-space: pre-wrap; }
.answer-panel.success { background: #e7f7f0; }
.answer-panel.success span { color: var(--success); }
.answer-panel.danger { background: #fff0f2; }
.answer-panel.danger span { color: var(--danger); }
.answer-panel.neutral { background: #f0edff; }
.answer-panel p { margin-top: 8px; }
.quiz-actions { padding: 16px 2px 0; }
.quiz-actions > button { width: 100%; }
.self-grade { display: grid; grid-template-columns: 1fr 1.25fr; gap: 10px; }
.summary-score { margin: 6px 0 0; display: flex; align-items: baseline; gap: 6px; color: var(--purple); }
.summary-score strong { font-size: 45px; }
.summary-score span { color: var(--muted); font-size: 13px; }
.summary-actions { width: min(100%, 300px); display: grid; gap: 9px; }

.toast {
  max-width: calc(100% - 36px);
  padding: 11px 15px;
  border-radius: 13px;
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  color: #fff;
  background: rgba(39, 36, 52, 0.92);
  box-shadow: var(--shadow);
  font-size: 12px;
  text-align: center;
}

@media (min-width: 700px) {
  .app-shell { min-height: calc(100dvh - 36px); margin-top: 18px; margin-bottom: 18px; border-radius: 28px; overflow: hidden; }
  .bottom-nav { bottom: 18px; border-radius: 0 0 28px 28px; }
  .login-page, .quiz-page { min-height: calc(100dvh - 36px); }
}

@media (max-width: 380px) {
  .type-grid { grid-template-columns: 1fr; }
  .type-card:last-child { grid-column: auto; }
  .daily-card { padding: 20px; }
  .daily-card h2 { font-size: 23px; }
  .bottom-nav { padding-left: 23px; padding-right: 23px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
