
      :root {
        color-scheme: light;
        --bg: #f5f6f8;
        --panel: #ffffff;
        --ink: #18212f;
        --muted: #667085;
        --line: #d9dee7;
        --blue: #1f64c8;
        --blue-soft: #eef5ff;
        --green: #16724d;
        --green-soft: #edf8f2;
        --amber: #916115;
        --amber-soft: #fff5dd;
        --red: #b42318;
        --red-soft: #fff0ee;
        --chip: #eef2f7;
        --shadow: 0 10px 24px rgba(24, 33, 47, 0.08);
      }

      * {
        box-sizing: border-box;
      }

      body {
        margin: 0;
        background: var(--bg);
        color: var(--ink);
        font-family: Arial, "Microsoft YaHei", sans-serif;
        line-height: 1.55;
      }

      button,
      input,
      select {
        font: inherit;
      }

      button {
        min-height: 40px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: var(--panel);
        color: var(--ink);
        padding: 8px 11px;
      }

      button.primary {
        border-color: var(--blue);
        background: var(--blue);
        color: #fff;
      }

      button.active {
        border-color: var(--blue);
        background: var(--blue-soft);
        color: #123d7a;
      }

      .topbar {
        position: sticky;
        top: 0;
        z-index: 20;
        border-bottom: 1px solid var(--line);
        background: rgba(255, 255, 255, 0.97);
        backdrop-filter: blur(12px);
      }

      .topbar-inner {
        max-width: 1080px;
        margin: 0 auto;
        padding: 12px 14px;
      }

      .title-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        margin-bottom: 10px;
        transition: margin-bottom 0.28s ease;
      }

      h1 {
        margin: 0;
        font-size: 20px;
        line-height: 1.2;
      }

      .title-actions {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-left: auto;
      }

      .count {
        color: var(--muted);
        font-size: 13px;
        white-space: nowrap;
      }

      .home-icon-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 34px;
        min-height: 34px;
        padding: 0;
        color: var(--muted);
      }

      .home-icon-btn svg {
        width: 19px;
        height: 19px;
        stroke: currentColor;
      }

      .auth-status {
        min-height: 34px;
        padding: 6px 10px;
        font-size: 13px;
        white-space: nowrap;
      }

      .account-menu-wrap {
        position: relative;
      }

      .auth-status.icon-only {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 34px;
        min-height: 34px;
        padding: 0;
        color: var(--muted);
      }

      .auth-status svg {
        width: 19px;
        height: 19px;
        stroke: currentColor;
      }

      .account-menu {
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        z-index: 30;
        display: grid;
        width: 148px;
        overflow: hidden;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: var(--panel);
        box-shadow: var(--shadow);
      }

      .account-menu[hidden] {
        display: none;
      }

      .account-menu button {
        width: 100%;
        min-height: 42px;
        border: 0;
        border-radius: 0;
        padding: 9px 12px;
        text-align: left;
      }

      .account-menu button + button {
        border-top: 1px solid var(--line);
      }

      .account-menu button:active {
        background: var(--blue-soft);
      }

      .access-badge {
        display: inline-flex;
        align-items: center;
        min-height: 28px;
        padding: 4px 8px;
        border: 1px solid var(--line);
        border-radius: 999px;
        background: #f8fafc;
        color: var(--muted);
        font-size: 12px;
        white-space: nowrap;
      }

      .filter-toggle {
        display: none;
        min-height: 34px;
        padding: 6px 10px;
        white-space: nowrap;
      }

      .controls {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
        max-height: 260px;
        opacity: 1;
        overflow: hidden;
        transform: translateY(0);
        transform-origin: top;
        transition:
          max-height 0.34s cubic-bezier(0.22, 1, 0.36, 1),
          opacity 0.24s ease,
          transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
        will-change: max-height, opacity, transform;
      }

      .controls[hidden],
      .filter-toggle[hidden] {
        display: none !important;
      }

      .filters {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
      }

      input,
      select {
        width: 100%;
        min-height: 40px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: #fff;
        color: var(--ink);
        padding: 8px 10px;
      }

      .auth-overlay {
        position: fixed;
        inset: 0;
        z-index: 40;
        display: none;
        align-items: center;
        justify-content: center;
        padding: 18px;
        background: rgba(24, 33, 47, 0.42);
      }

      .auth-overlay.open {
        display: flex;
      }

      .auth-dialog {
        width: min(380px, 100%);
        border: 1px solid var(--line);
        border-radius: 8px;
        background: var(--panel);
        box-shadow: var(--shadow);
      }

      .auth-dialog header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 14px 16px;
        border-bottom: 1px solid var(--line);
      }

      .auth-dialog h2 {
        margin: 0;
        font-size: 18px;
      }

      .auth-close {
        width: 34px;
        min-height: 34px;
        padding: 0;
      }

      .auth-form {
        display: grid;
        gap: 12px;
        padding: 16px;
      }

      .auth-form label {
        display: grid;
        gap: 6px;
        font-size: 14px;
        font-weight: 700;
      }

      .auth-message {
        min-height: 22px;
        margin: 0;
        color: var(--muted);
        font-size: 13px;
      }

      .auth-message.error {
        color: var(--red);
      }

      .auth-message.success {
        color: var(--green);
      }

      .auth-help {
        margin: -4px 0 0;
        color: var(--muted);
        font-size: 12px;
      }

      .contact-link {
        color: var(--blue);
        text-decoration: none;
        overflow-wrap: anywhere;
      }

      .auth-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
      }

      .guest-notice-overlay {
        position: fixed;
        inset: 0;
        z-index: 45;
        display: none;
        align-items: center;
        justify-content: center;
        padding: 18px;
        background: rgba(24, 33, 47, 0.42);
      }

      .guest-notice-overlay.open {
        display: flex;
      }

      .guest-notice-dialog {
        display: grid;
        gap: 12px;
        width: min(460px, 100%);
        border: 1px solid var(--line);
        border-radius: 8px;
        background: var(--panel);
        box-shadow: var(--shadow);
        padding: 18px;
      }

      .guest-notice-dialog h2 {
        margin: 0;
        font-size: 18px;
      }

      .guest-notice-dialog p {
        margin: 0;
        color: var(--muted);
        font-size: 14px;
      }

      .guest-notice-dialog ul {
        margin: 0;
        padding-left: 20px;
        color: #374151;
        font-size: 14px;
      }

      .guest-notice-dialog li {
        margin: 5px 0;
      }

      .wrap {
        max-width: 1080px;
        margin: 0 auto;
        padding: 14px;
      }

      .home {
        display: grid;
        gap: 12px;
      }

      .home.hidden,
      .question-list.hidden {
        display: none;
      }

      .home-grid {
        display: grid;
        gap: 12px;
      }

      .home-card {
        display: grid;
        gap: 6px;
        width: 100%;
        min-height: 92px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: var(--panel);
        box-shadow: var(--shadow);
        padding: 14px;
        text-align: left;
      }

      .home-card strong {
        font-size: 17px;
      }

      .home-card span {
        color: var(--muted);
        font-size: 13px;
      }

      .site-footer {
        display: grid;
        gap: 3px;
        border-top: 1px solid var(--line);
        color: var(--muted);
        font-size: 12px;
        padding: 12px 2px 0;
        text-align: center;
      }

      .account-center-body {
        display: grid;
        gap: 10px;
        padding: 16px;
      }

      .account-center-row {
        display: grid;
        gap: 3px;
        border-bottom: 1px solid var(--line);
        padding-bottom: 10px;
      }

      .account-center-row:last-child {
        border-bottom: 0;
        padding-bottom: 0;
      }

      .account-center-row span {
        color: var(--muted);
        font-size: 12px;
      }

      .account-center-row strong {
        overflow-wrap: anywhere;
        font-size: 14px;
      }

      .mode-bar {
        display: none;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        margin-bottom: 12px;
      }

      .mode-bar.active {
        display: flex;
      }

      .exam-config,
      .practice-config {
        display: none;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: var(--panel);
        box-shadow: var(--shadow);
        padding: 14px;
        margin-bottom: 12px;
      }

      .exam-config.active,
      .practice-config.active {
        display: grid;
        gap: 10px;
      }

      .exam-config-grid,
      .practice-config-grid {
        display: grid;
        gap: 8px;
      }

      .exam-config label,
      .practice-config label {
        display: grid;
        gap: 5px;
        color: var(--muted);
        font-size: 13px;
      }

      .mode-title {
        font-weight: 700;
      }

      .mode-subtitle {
        color: var(--muted);
        font-size: 13px;
      }

      .mode-count {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 72px;
        min-height: 40px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: var(--panel);
        color: var(--muted);
        padding: 8px 11px;
        font-size: 13px;
        white-space: nowrap;
      }

      .mode-count[hidden] {
        display: none;
      }

      .question-list {
        display: grid;
        gap: 12px;
      }

      .card {
        border: 1px solid var(--line);
        border-radius: 8px;
        background: var(--panel);
        box-shadow: var(--shadow);
        overflow: hidden;
        content-visibility: auto;
        contain-intrinsic-size: 520px;
      }

      .card-head {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 10px;
        padding: 12px 12px 0;
      }

      .number {
        font-weight: 700;
        font-size: 17px;
      }

      .source {
        color: var(--muted);
        font-size: 12px;
      }

      .favorite-btn {
        min-width: 40px;
        min-height: 40px;
        padding: 5px 9px;
        border-color: transparent;
        background: transparent;
        color: #99a2b3;
        font-size: 24px;
        line-height: 1;
      }

      .favorite-btn.active {
        color: #d79a17;
        background: #fff6dc;
        border-color: #efd28a;
      }

      .card-body {
        padding: 10px 12px 12px;
      }

      .tags {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        margin-bottom: 10px;
      }

      .tag {
        border-radius: 999px;
        background: var(--chip);
        color: #25364d;
        padding: 4px 8px;
        font-size: 12px;
      }

      .tag.unit {
        background: #e9f1ff;
        color: #244a7a;
      }

      .tag.topic {
        background: var(--green-soft);
        color: #245b38;
      }

      .tag.division {
        background: #ede9fe;
        color: #4c3a88;
      }

      .tag.difficulty {
        background: var(--amber-soft);
        color: #7a4d10;
      }

      .tag.problem {
        background: var(--red-soft);
        color: var(--red);
        border: 1px solid #f2b8b2;
      }

      .notice {
        margin: 0 0 10px;
        border: 1px solid #f2b8b2;
        border-radius: 8px;
        background: var(--red-soft);
        color: var(--red);
        padding: 9px 10px;
        font-size: 14px;
      }

      .stem {
        margin: 0 0 10px;
        padding: 10px;
        border-left: 3px solid var(--amber);
        border-radius: 6px;
        background: var(--amber-soft);
        color: #3d2c12;
      }

      .question-text {
        margin: 0 0 10px;
        font-size: 16px;
      }

      .media {
        display: grid;
        justify-items: start;
        gap: 8px;
        margin: 10px 0;
      }

      .media img {
        display: block;
        width: auto;
        max-width: min(100%, 680px);
        max-height: 520px;
        height: auto;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: #fff;
        cursor: zoom-in;
      }

      .options {
        display: grid;
        gap: 7px;
        margin-top: 10px;
      }

      .option {
        display: grid;
        grid-template-columns: 28px 1fr;
        gap: 8px;
        align-items: start;
        width: 100%;
        border: 1px solid #e3e8ef;
        border-radius: 8px;
        padding: 8px;
        background: #fbfcfe;
        color: var(--text);
        font: inherit;
        text-align: left;
        cursor: pointer;
        transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
      }

      .option:active {
        transform: translateY(1px);
      }

      .option:disabled {
        cursor: default;
        opacity: 1;
      }

      .option.selected {
        border-color: var(--blue);
        background: #eef6ff;
        box-shadow: 0 0 0 1px rgba(11, 99, 255, 0.14);
      }

      .option.correct {
        border-color: #7ac09b;
        background: var(--green-soft);
      }

      .option.wrong {
        border-color: #f2b8b2;
        background: var(--red-soft);
      }

      .letter {
        display: inline-grid;
        place-items: center;
        width: 28px;
        height: 28px;
        border-radius: 50%;
        background: #e8edf6;
        color: #27364a;
        font-weight: 700;
      }

      .answer-tools {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 12px;
      }

      .random-panel {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        align-items: center;
        justify-content: space-between;
        margin: 4px 0 18px;
        border: 1px solid #cbd8ea;
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.96);
        box-shadow: 0 10px 28px rgba(19, 34, 56, 0.14);
        padding: 10px;
      }

      .random-panel strong {
        font-size: 14px;
      }

      .random-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
      }

      .summary-metrics {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
      }

      .summary-metrics span {
        display: flex;
        align-items: center;
        justify-content: center;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: #f8fafc;
        padding: 12px 14px;
        font-weight: 700;
        font-size: 16px;
      }

      .summary-panel {
        align-items: stretch;
        flex-direction: column;
      }

      .summary-panel .random-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }

      .summary-panel .random-actions button {
        width: 100%;
      }

      .summary-panel .random-actions [data-action="save-random-wrong"] {
        grid-column: 1 / -1;
      }

      .answer-box,
      .explanation-box {
        margin-top: 10px;
        border-radius: 8px;
        padding: 10px;
      }

      .answer-box {
        border: 1px solid #9ed0b5;
        background: var(--green-soft);
        color: var(--green);
        font-weight: 700;
      }

      .explanation-box {
        border: 1px solid var(--line);
        background: #fbfcff;
      }

      .explanation-box h3 {
        margin: 0 0 6px;
        font-size: 15px;
      }

      .explanation-box p {
        margin: 0 0 8px;
      }

      .steps {
        margin: 0 0 8px;
        padding-left: 22px;
      }

      .steps li {
        margin: 4px 0;
      }

      .trap {
        margin-top: 8px;
        border-left: 3px solid var(--amber);
        background: var(--amber-soft);
        padding: 8px 9px;
        border-radius: 6px;
      }

      .review-note {
        margin-top: 8px;
        border-left: 3px solid var(--red);
        background: var(--red-soft);
        color: var(--red);
        padding: 8px 9px;
        border-radius: 6px;
      }

      .empty,
      .loading {
        padding: 30px 16px;
        text-align: center;
        color: var(--muted);
      }

      .load-more {
        display: flex;
        justify-content: center;
        padding: 8px 0 20px;
      }

      .load-more button {
        border: 1px solid var(--line);
        border-radius: 8px;
        background: #111827;
        color: #ffffff;
        font-weight: 700;
        padding: 12px 18px;
      }

      .modal {
        position: fixed;
        inset: 0;
        z-index: 50;
        display: none;
        padding: 8px;
        background: rgba(0, 0, 0, 0);
        transition: background 0.18s ease;
      }

      .modal.open {
        display: flex;
      }

      .modal.zoom-ready {
        background: rgba(0, 0, 0, 0.62);
      }

      .modal img {
        position: fixed;
        width: auto;
        height: auto;
        background: #fff;
        border-radius: 8px;
        box-shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
        opacity: 0;
        transition:
          opacity 0.2s ease,
          transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
        will-change: transform, opacity;
      }

      .modal.zoom-ready img {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
      }

      .modal button {
        position: fixed;
        top: 14px;
        right: 14px;
        border-color: rgba(255, 255, 255, 0.55);
        background: rgba(255, 255, 255, 0.14);
        color: #fff;
      }

      .katex-display {
        overflow-x: auto;
        overflow-y: hidden;
      }

      @media (min-width: 860px) {
        .controls {
          grid-template-columns: 1.2fr 2.6fr;
          align-items: start;
        }

        .filters {
          grid-template-columns: repeat(5, minmax(0, 1fr));
        }

        .question-list {
          grid-template-columns: repeat(2, minmax(0, 1fr));
        }

        .home-grid {
          grid-template-columns: repeat(2, minmax(0, 1fr));
        }
      }

      @media (max-width: 520px) {
        .filters {
          grid-template-columns: 1fr;
        }

        h1 {
          font-size: 18px;
        }

        .topbar.controls-collapsed .controls {
          max-height: 0;
          opacity: 0;
          transform: translateY(-10px);
          overflow: hidden;
          pointer-events: none;
        }

        .topbar.controls-collapsed .title-row {
          margin-bottom: 0;
        }

        .filter-toggle {
          display: inline-flex;
          align-items: center;
          justify-content: center;
        }
      }
    