:root {
  --qx-ink: #2d2a26;
  --qx-muted: #756f67;
  --qx-paper: #fffdf8;
  --qx-line: #e7ded2;
  --qx-red: #8e342c;
  --qx-red-dark: #70261f;
  --qx-gold: #b98a45;
  --qx-green: #3e7461;
}

html.qx-account-required #root { visibility: hidden; }
body.qx-modal-open { overflow: hidden; }

#qx-account-layer[hidden] { display: none; }
#qx-account-layer { position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center; padding: 18px; color: var(--qx-ink); font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif; }
.qx-account-backdrop { position: absolute; inset: 0; background: rgba(28, 24, 20, .54); backdrop-filter: blur(8px); }
.qx-account-dialog { position: relative; width: min(100%, 480px); max-height: calc(100dvh - 36px); overflow: auto; background: var(--qx-paper); border: 1px solid rgba(185, 138, 69, .42); border-radius: 24px; box-shadow: 0 28px 80px rgba(34, 25, 18, .26); padding: 26px; }
.qx-account-dialog.is-wide { width: min(100%, 820px); }
.qx-account-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 23px; }
.qx-account-brand > span { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; color: #fff; background: var(--qx-red); font: 600 22px/1 serif; box-shadow: inset 0 0 0 4px rgba(255,255,255,.14); }
.qx-account-brand div { display: grid; }
.qx-account-brand b { font-size: 17px; letter-spacing: .08em; }
.qx-account-brand small { color: var(--qx-muted); font-size: 12px; margin-top: 2px; }
.qx-account-close { position: absolute; top: 18px; right: 18px; width: 36px; height: 36px; border: 1px solid var(--qx-line); border-radius: 50%; background: #fff; color: var(--qx-muted); font-size: 24px; line-height: 1; cursor: pointer; }
.qx-account-dialog h2 { margin: 0 0 10px; font: 600 25px/1.35 Georgia, "Songti SC", "STSong", serif; }
.qx-account-description { margin: 0 0 20px; color: var(--qx-muted); font-size: 15px; line-height: 1.75; }
.qx-account-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; margin-bottom: 22px; border-radius: 13px; background: #f2ede5; }
.qx-account-tabs button { min-height: 42px; border: 0; border-radius: 10px; background: transparent; color: var(--qx-muted); font-size: 15px; font-weight: 600; cursor: pointer; }
.qx-account-tabs button.is-active { background: #fff; color: var(--qx-red); box-shadow: 0 3px 12px rgba(58, 42, 27, .08); }
.qx-account-form { display: grid; gap: 15px; }
.qx-account-form label { display: grid; gap: 7px; font-size: 14px; font-weight: 600; }
.qx-account-form input:not([type="checkbox"]) { width: 100%; height: 48px; border: 1px solid #d8cec2; border-radius: 11px; background: #fff; outline: none; padding: 0 14px; font-size: 16px; transition: border-color .2s, box-shadow .2s; }
.qx-account-form input:focus { border-color: var(--qx-gold); box-shadow: 0 0 0 3px rgba(185, 138, 69, .13); }
.qx-account-consent { grid-template-columns: 20px 1fr; align-items: start; gap: 9px !important; color: var(--qx-muted); font-size: 13px !important; font-weight: 400 !important; line-height: 1.65; }
.qx-account-consent input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--qx-red); }
.qx-account-primary, .qx-account-secondary, .qx-account-danger { min-height: 48px; border: 0; border-radius: 11px; padding: 0 18px; font-size: 15px; font-weight: 700; cursor: pointer; }
.qx-account-primary { color: #fff; background: var(--qx-red); box-shadow: 0 8px 18px rgba(142, 52, 44, .18); }
.qx-account-primary:hover { background: var(--qx-red-dark); }
.qx-account-secondary { width: 100%; color: var(--qx-red); background: #f4e9e5; }
.qx-account-danger { color: #fff; background: #a12e25; }
.qx-account-primary:disabled, .qx-account-danger:disabled { opacity: .6; cursor: wait; }
.qx-guest-entry { width: 100%; min-height: 46px; margin-top: 18px; border: 1px solid var(--qx-gold); border-radius: 11px; background: transparent; color: var(--qx-red); font-size: 15px; font-weight: 700; cursor: pointer; }
.qx-account-links { display: flex; justify-content: space-between; margin-top: 18px; }
.qx-account-links button, .qx-account-back { border: 0; background: none; color: var(--qx-red); font-size: 14px; cursor: pointer; }
.qx-account-back { margin: -4px 0 20px; padding: 0; }
.qx-account-footnote { margin: 14px 0 0; color: var(--qx-muted); font-size: 13px; line-height: 1.65; text-align: center; }
.qx-account-alert { margin: 0 0 16px; border-radius: 10px; background: #eef5f1; color: var(--qx-green); padding: 11px 13px; font-size: 14px; line-height: 1.55; }
.qx-account-alert.is-error { background: #f9eae7; color: #9c3028; }
.qx-account-success-mark { display: grid; place-items: center; width: 58px; height: 58px; margin: 2px 0 18px; border-radius: 50%; background: #e6f2ec; color: var(--qx-green); font-size: 30px; font-weight: 800; }
.qx-account-pending-mark { display: grid; place-items: center; width: 64px; height: 64px; margin: 2px 0 20px; border-radius: 22px; background: #f2e7d5; color: var(--qx-red); font: 600 30px/1 serif; }
.qx-recovery-code { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0 8px; padding: 15px 16px; border: 1px dashed var(--qx-gold); border-radius: 12px; background: #fbf5e9; }
.qx-recovery-code code { font-size: 17px; font-weight: 800; letter-spacing: .08em; }
.qx-recovery-code button { border: 0; background: transparent; color: var(--qx-red); font-size: 14px; font-weight: 700; cursor: pointer; }
.qx-recovery-code + .qx-account-footnote { margin-bottom: 18px; text-align: left; }
.qx-account-loader { width: 38px; height: 38px; margin: 5px 0 22px; border: 3px solid #e5ddd2; border-top-color: var(--qx-red); border-radius: 50%; animation: qx-spin .8s linear infinite; }
@keyframes qx-spin { to { transform: rotate(360deg); } }

.qx-profile-heading { display: flex; align-items: center; gap: 13px; margin-bottom: 20px; }
.qx-profile-avatar { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 18px; background: var(--qx-red); color: #fff; font: 600 24px/1 serif; }
.qx-profile-heading span { color: var(--qx-muted); font-size: 13px; }
.qx-profile-heading h2 { margin: 1px 0 0; }
.qx-total-grid { display: grid; grid-template-columns: 1.2fr repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.qx-total-grid > div { display: grid; min-height: 112px; align-content: center; border: 1px solid var(--qx-line); border-radius: 15px; background: #fff; padding: 15px; }
.qx-total-grid > div.is-points { color: #fff; border-color: var(--qx-red); background: var(--qx-red); }
.qx-total-grid span { color: var(--qx-muted); font-size: 13px; }
.qx-total-grid .is-points span, .qx-total-grid .is-points small { color: rgba(255,255,255,.78); }
.qx-total-grid strong { margin: 3px 0; font: 700 28px/1.2 Georgia, serif; }
.qx-total-grid small { color: var(--qx-muted); font-size: 11px; }
.qx-subject-list { display: grid; gap: 12px; }
.qx-subject-card { border: 1px solid var(--qx-line); border-radius: 17px; background: #fff; padding: 18px; }
.qx-subject-card > header { display: flex; justify-content: space-between; align-items: start; gap: 15px; }
.qx-subject-card > header span { color: var(--qx-green); font-size: 12px; font-weight: 700; }
.qx-subject-card h3 { margin: 2px 0 0; font: 600 20px/1.3 Georgia, "Songti SC", serif; }
.qx-subject-card > header > strong { color: var(--qx-red); font-size: 26px; }
.qx-subject-card > header > strong small { margin-left: 4px; color: var(--qx-muted); font-size: 12px; }
.qx-subject-numbers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 15px 0; }
.qx-subject-numbers span { border-radius: 9px; background: #f6f2ec; padding: 9px; color: var(--qx-muted); font-size: 12px; text-align: center; }
.qx-subject-numbers b { display: block; margin-top: 2px; color: var(--qx-ink); font-size: 16px; }
.qx-module-list { border-top: 1px solid var(--qx-line); }
.qx-module-row { display: grid; grid-template-columns: 1fr auto 54px; align-items: center; gap: 10px; border-bottom: 1px solid #efe8df; padding: 10px 2px; font-size: 13px; }
.qx-module-row small { color: var(--qx-muted); text-align: right; }
.qx-subject-card > footer { display: flex; flex-wrap: wrap; gap: 8px 16px; padding-top: 12px; color: var(--qx-muted); font-size: 12px; }
.qx-empty-progress { border: 1px dashed var(--qx-line); border-radius: 14px; padding: 24px; color: var(--qx-muted); font-size: 14px; text-align: center; }
.qx-profile-actions { display: flex; justify-content: space-between; margin-top: 18px; }
.qx-profile-actions button { border: 0; background: none; color: var(--qx-muted); font-size: 13px; cursor: pointer; }
.qx-profile-actions button:last-child { color: #9c3028; }
.qx-privacy-copy { display: grid; gap: 12px; color: var(--qx-muted); font-size: 14px; line-height: 1.75; }
.qx-privacy-copy b { color: var(--qx-ink); }

.qx-account-button { position: fixed; z-index: 9000; top: 18px; right: 18px; display: flex; align-items: center; gap: 9px; min-height: 48px; border: 1px solid rgba(185,138,69,.38); border-radius: 16px; background: rgba(255,253,248,.94); box-shadow: 0 8px 24px rgba(48,36,26,.12); padding: 6px 12px 6px 7px; color: var(--qx-ink); cursor: pointer; backdrop-filter: blur(10px); }
.qx-account-button[hidden] { display: none; }
.qx-account-button > span:last-child { display: grid; text-align: left; }
.qx-account-button b { max-width: 120px; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.qx-account-button small { color: var(--qx-red); font-size: 11px; }
.qx-account-avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--qx-red); color: #fff; font: 600 16px/1 serif; }
.qx-account-toast { position: fixed; z-index: 12000; left: 50%; bottom: 28px; transform: translate(-50%, 16px); border-radius: 999px; background: #292521; color: #fff; padding: 10px 16px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; font-size: 14px; }
.qx-account-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.qx-guest-limit-bar { position: fixed; z-index: 9500; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; align-items: center; justify-content: space-between; gap: 18px; width: min(calc(100% - 28px), 650px); border: 1px solid rgba(185,138,69,.45); border-radius: 16px; background: rgba(255,253,248,.97); box-shadow: 0 16px 48px rgba(40,30,22,.2); padding: 12px 13px 12px 17px; backdrop-filter: blur(10px); }
.qx-guest-limit-bar[hidden] { display: none; }
.qx-guest-limit-bar > span { display: grid; }
.qx-guest-limit-bar b { font-size: 14px; }
.qx-guest-limit-bar small { margin-top: 2px; color: var(--qx-muted); font-size: 12px; }
.qx-guest-limit-bar button { flex: 0 0 auto; min-height: 40px; border: 0; border-radius: 10px; background: var(--qx-red); color: #fff; padding: 0 14px; font-size: 13px; font-weight: 700; cursor: pointer; }
.qx-icp-link { display: block; width: fit-content; margin: 7px auto 0; color: inherit; text-decoration: none; }
.qx-icp-link:hover { color: var(--qx-red); text-decoration: underline; }

/* 分录题改为手动输入科目名称，避免依靠下拉选项猜答案。 */
.account-text-input {
  width: 100%;
  min-height: 42px;
  border: 1px solid #d8cec0;
  border-radius: 9px;
  background: #fffdf9;
  padding: 0 12px;
  color: #292521;
  font-size: 15px;
  outline: none;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.account-text-input::placeholder { color: #9a9187; }
.account-text-input:focus {
  border-color: #a73a2f;
  box-shadow: 0 0 0 3px rgba(167,58,47,.11);
  background: #fff;
}
.account-text-input:disabled { color: #4d4741; background: #f3eee7; }
.journal-manual-note {
  margin: -2px 0 16px;
  color: #766b61;
  font-size: 13px;
  line-height: 1.6;
}
.journal-error-list {
  display: grid;
  gap: 7px;
  margin: 12px 0;
  border-radius: 10px;
  background: rgba(255,255,255,.58);
  padding: 11px 14px 11px 30px;
  color: #7d271f;
  font-size: 14px;
  line-height: 1.55;
  list-style: disc;
}

@media (max-width: 640px) {
  #qx-account-layer { padding: 10px; align-items: end; }
  .qx-account-dialog, .qx-account-dialog.is-wide { width: 100%; max-height: calc(100dvh - 20px); border-radius: 22px 22px 14px 14px; padding: 22px 18px; }
  .qx-account-dialog h2 { font-size: 23px; }
  .qx-account-button { top: auto; right: 12px; bottom: 12px; }
  .qx-total-grid { grid-template-columns: 1fr 1fr; }
  .qx-total-grid > div { min-height: 94px; }
  .qx-subject-numbers { grid-template-columns: 1fr 1fr; }
  .qx-recovery-code { align-items: flex-start; flex-direction: column; }
  .qx-recovery-code code { font-size: 16px; }
  .qx-guest-limit-bar { bottom: 82px; align-items: stretch; flex-direction: column; gap: 10px; }
  .qx-guest-limit-bar button { width: 100%; }
}
