@layer existing {
  :root {
    --bg: #eef1ea;
    --paper: #fffdf7;
    --paper-2: #fbf8ef;
    --ink: #22251f;
    --muted: #6b7266;
    --line: #e2dccb;
    --green: #2e6f61;
    --green-deep: #245a4f;
    --green-soft: #dcece5;
    --gold: #d8a03b;
    --gold-soft: #f8ebc8;
    --red: #d86a52;
    --red-soft: #f8dfda;
    --teal: #3f7887;
    --shadow: 0 18px 46px rgba(39, 38, 30, 0.12);
  }

  .course-unit-filter {
    display: grid;
    gap: 8px;
    margin: 12px 0;
  }
  .course-detail {
    margin-top: 18px;
    font-size: 17px;
    line-height: 1.85;
    overflow-wrap: anywhere;
  }
  .course-detail h4 {
    color: var(--green);
    margin: 24px 0 8px;
  }
  .course-detail ul,
  .course-detail ol {
    padding-left: 1.5em;
  }
  .course-detail li {
    margin: 8px 0;
  }
  .course-example {
    padding: 12px;
    background: var(--green-soft);
    border-radius: 10px;
  }
  .course-question {
    min-width: 0;
    margin: 18px 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px;
  }
  .course-question legend {
    max-width: 100%;
    padding: 0 4px;
    font-weight: 600;
  }
  .course-question label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-height: 44px;
    padding: 8px 0;
    cursor: pointer;
  }
  .course-question input[type="radio"] {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    min-height: 20px;
    margin: 6px 0 0;
  }
  .course-answer {
    padding: 10px;
    background: var(--gold-soft);
    border-radius: 8px;
  }
  .course-sources {
    margin-top: 24px;
    color: var(--muted);
    font-size: 14px;
  }
  .course-sources summary {
    cursor: pointer;
    min-height: 44px;
  }
  .course-detail,
  #coursePractice {
    scroll-margin-top: 85px;
  }
  .course-word-list {
    display: grid;
    gap: 10px;
  }
  .course-word {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
  }
  .course-word strong {
    color: var(--green);
  }
  .course-word > span {
    overflow-wrap: anywhere;
  }
  .course-word button {
    margin-left: auto;
  }

  * {
    box-sizing: border-box;
  }

  [hidden] {
    display: none !important;
  }

  body {
    margin: 0;
    min-height: 100dvh;
    background: var(--bg);
    color: var(--ink);
    font-family: "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
    font-size: 16px;
  }

  button,
  input,
  select {
    font: inherit;
  }

  input,
  textarea,
  select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffdf7;
    color: var(--ink);
    outline: 0;
  }

  input,
  select {
    min-height: 42px;
    padding: 0 12px;
  }

  textarea {
    resize: vertical;
    padding: 11px 12px;
  }

  input:focus,
  textarea:focus,
  select:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(46, 111, 97, 0.12);
  }

  button {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .stage {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    padding: 34px 22px;
  }

  .brief {
    display: none;
  }

  .brief-mark {
    width: 64px;
    height: 64px;
    margin-bottom: 18px;
  }

  .kicker {
    margin: 0 0 6px;
    color: var(--green);
    font-size: 12px;
    font-weight: 800;
  }

  h1,
  h2,
  h3,
  p {
    letter-spacing: 0;
  }

  h1,
  h2,
  h3 {
    margin: 0;
  }

  h1 {
    font-size: 48px;
    line-height: 1.05;
  }

  .brief p {
    color: var(--muted);
    line-height: 1.8;
  }

  .brief-list {
    display: grid;
    gap: 10px;
    margin-top: 22px;
  }

  .brief-list span {
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 253, 247, 0.76);
  }

  .phone {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(100%, 500px);
    height: min(920px, calc(100dvh - 48px));
    min-height: min(680px, calc(100dvh - 48px));
    overflow: hidden;
    border: 1px solid #d5d0c1;
    border-radius: 18px;
    background: var(--paper-2);
    box-shadow: var(--shadow);
  }

  .app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 22px 20px 14px;
    background: #fbf8ef;
    border-bottom: 1px solid var(--line);
  }

  .grade-picker {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 0 0 5px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 800;
  }

  .grade-picker select {
    width: auto;
    min-width: 138px;
    min-height: 34px;
    padding: 0 26px 0 9px;
    font-size: 14px;
  }

  .app-header h2 {
    font-size: 25px;
  }

  .header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .mode-switch,
  .link-btn {
    min-height: 36px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    color: var(--green);
    font-size: 13px;
    font-weight: 800;
  }

  .mode-switch {
    padding: 0 10px;
    white-space: nowrap;
  }

  .screen {
    display: none;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 16px 24px;
  }

  .screen.active {
    display: block;
  }

  .profile-band,
  .hero-card,
  .panel,
  .scan-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    box-shadow: 0 3px 12px rgba(38, 36, 28, 0.045);
  }

  .profile-band {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 112px;
    padding: 18px;
    background: linear-gradient(135deg, #fffdf7, #e8f2ed);
  }

  .profile-band span,
  .profile-band strong {
    display: block;
  }

  .profile-band span {
    color: var(--muted);
    font-size: 14px;
  }

  .profile-band strong {
    margin-top: 5px;
    font-size: 23px;
  }

  .ring {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: conic-gradient(var(--green) 68%, #dfe1d8 0);
  }

  .ring span {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: var(--paper);
    color: var(--ink);
    font-weight: 900;
  }

  .quick-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
    margin: 12px 0;
  }

  .quick-grid button {
    display: grid;
    place-items: center;
    gap: 6px;
    min-height: 76px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    color: var(--ink);
    font-size: 13px;
    font-weight: 800;
  }

  .quick-icon {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--green-soft);
    color: var(--green);
  }

  .dashboard-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
  }

  .dashboard-strip div {
    min-height: 64px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
  }

  .dashboard-strip span,
  .archive-item span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
  }

  .dashboard-strip strong {
    display: block;
    margin-top: 5px;
    font-size: 18px;
  }

  .hero-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 132px;
    gap: 12px;
    padding: 16px;
  }

  .hero-card p,
  .plain-text,
  .feedback,
  .method-list span,
  .paper-list span,
  .lesson-meta,
  .analysis-box p {
    color: var(--muted);
    line-height: 1.6;
  }

  .hero-card svg {
    width: 100%;
    align-self: center;
  }

  .primary {
    min-height: 42px;
    padding: 0 14px;
    border: 1px solid var(--green);
    border-radius: 8px;
    background: var(--green);
    color: #fff9ea;
    font-weight: 900;
  }

  .primary.full {
    width: 100%;
  }

  .hero-card .primary {
    grid-column: 1 / -1;
  }

  .panel,
  .scan-card {
    margin-top: 12px;
    padding: 16px;
  }

  .compact-panel {
    margin-top: 0;
    margin-bottom: 12px;
  }

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

  .catalog-panel-head {
    display: block;
  }

  .catalog-title {
    margin-bottom: 10px;
  }

  .catalog-panel-head .poem-library-filters,
  .catalog-panel-head .hanzi-filters {
    width: 100%;
    min-width: 0;
  }

  .catalog-panel-head .panel-tools select,
  .catalog-panel-head .poem-library-filters select {
    width: 128px;
    max-width: 128px;
    min-width: 0;
    min-height: 34px;
    height: 34px;
    padding: 0 8px;
    font-size: 13px;
  }

  .catalog-panel-head .poem-library-filters label,
  .catalog-panel-head .hanzi-filters label {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    min-width: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
  }

  .catalog-panel-head .poem-library-filters label > span,
  .catalog-panel-head .hanzi-filters label > span {
    flex: 0 0 auto;
  }

  .filter-result-summary {
    display: block;
    margin-top: 9px;
  }

  .panel-tools {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
  }

  .panel-tools select {
    min-width: 92px;
  }

  .pill {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 9px;
    border-radius: 999px;
    background: var(--green-soft);
    color: var(--green);
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
  }

  .pill.danger {
    background: var(--red-soft);
    color: #a83e2b;
  }

  .tasks {
    display: grid;
    gap: 10px;
  }

  .tasks label {
    display: grid;
    grid-template-columns: 22px 1fr;
    gap: 8px;
    line-height: 1.5;
  }

  .checkin-list {
    display: grid;
    gap: 10px;
  }

  .checkin-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffaf0;
  }

  .checkin-item.done {
    border-color: rgba(46, 111, 97, 0.32);
    background: var(--green-soft);
  }

  .checkin-item strong,
  .checkin-item span {
    display: block;
  }

  .checkin-item span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
  }

  .scan-art {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 170px;
    margin-bottom: 12px;
    overflow: hidden;
    border: 1px dashed #c9bfae;
    border-radius: 8px;
    background:
      linear-gradient(#fffaf0 0 0) padding-box,
      repeating-linear-gradient(
        0deg,
        rgba(46, 111, 97, 0.08) 0 2px,
        transparent 2px 24px
      );
    color: var(--muted);
    font-weight: 800;
  }

  .scan-art img {
    position: absolute;
    inset: 0;
    display: none;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .scan-art img.show {
    display: block;
  }

  #photoInput {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
  }

  .scan-input-grid {
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 8px;
    margin: 10px 0;
  }

  .scan-line {
    position: absolute;
    left: 18px;
    right: 18px;
    top: 34px;
    height: 3px;
    border-radius: 999px;
    background: var(--red);
    animation: scan 2.2s ease-in-out infinite;
  }

  @keyframes scan {
    0%,
    100% {
      transform: translateY(0);
    }
    50% {
      transform: translateY(94px);
    }
  }

  .ai-flow {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
  }

  .ai-flow span {
    min-height: 38px;
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff9ec;
    color: var(--muted);
    font-size: 13px;
  }

  .ai-flow .done {
    border-color: #bdd4c9;
    background: var(--green-soft);
    color: var(--green);
    font-weight: 900;
  }

  .analysis-box,
  .feedback {
    padding: 12px;
    border-radius: 8px;
    background: #fff9ec;
  }

  .clickable {
    cursor: pointer;
    color: var(--green);
    text-decoration: underline;
    text-underline-offset: 3px;
  }
  .clickable:hover {
    color: var(--green-deep);
  }

  .hanzi-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .hanzi-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    min-height: 70px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--paper);
  }
  .hanzi-list-open {
    width: 100%;
    text-align: left;
    cursor: pointer;
  }
  .hanzi-list-open:hover {
    border-color: var(--green);
    background: var(--green-soft);
  }
  .hanzi-list-open:focus-visible {
    outline: 2px solid var(--green);
    outline-offset: 2px;
  }
  .hanzi-list-char {
    flex: 0 0 38px;
    font-size: 26px;
    font-weight: 900;
    color: var(--green-deep);
    text-align: center;
  }
  .hanzi-list-info {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
  }
  .hanzi-list-pinyin {
    display: block;
    font-size: 13px;
    color: var(--muted);
  }
  .hanzi-list-words {
    display: block;
    margin-top: 3px;
    font-size: 12px;
    color: var(--ink);
    overflow-wrap: anywhere;
  }
  .hanzi-list-arrow {
    color: var(--muted);
    font-size: 22px;
  }
  .hanzi-word-char {
    color: var(--green);
  }
  .hanzi-empty {
    grid-column: 1 / -1;
  }
  .primary-word-entry {
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--paper);
  }
  .hanzi-list.primary-word-list {
    grid-template-columns: minmax(0, 1fr);
  }
  .primary-word-heading {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 12px;
  }
  .primary-word-heading strong {
    color: #245a4f;
    font-size: 18px;
    writing-mode: horizontal-tb;
    overflow-wrap: anywhere;
  }
  #homeworkDocumentWarnings {
    white-space: pre-line;
  }
  #homeworkOcrDrafts pre {
    max-height: 300px;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font: inherit;
    font-size: 13px;
  }
  #homeworkOcrDrafts summary {
    padding: 12px 0;
    color: var(--green);
    cursor: pointer;
  }
  #homeworkResultGrid p {
    white-space: pre-wrap;
  }
  #homeworkResultGrid article > small {
    display: block;
    margin-top: 5px;
    color: var(--muted);
  }
  #homeworkResultGrid ol {
    margin: 6px 0;
    padding-left: 22px;
    line-height: 1.7;
  }
  #homeworkResultGrid .homework-wrong {
    border-left: 4px solid var(--red);
  }
  #homeworkResultGrid .homework-review {
    border-left: 4px solid var(--gold);
  }
  #homeworkResultGrid .homework-correct {
    border-left: 4px solid var(--green);
  }
  .homework-review-note {
    color: #815b12;
  }
  .primary-word-heading span {
    color: var(--muted);
    font-size: 13px;
  }
  .primary-word-context {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
    overflow-wrap: anywhere;
  }
  .primary-word-entry dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px 12px;
    margin: 8px 0 0;
  }
  .primary-word-entry dl > div {
    min-width: 0;
  }
  .primary-word-entry dt {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
  }
  .primary-word-entry dd {
    margin: 1px 0 0;
    font-size: 12px;
    line-height: 1.4;
    overflow-wrap: anywhere;
    white-space: pre-line;
  }
  .primary-word-entry dl > div:first-child {
    grid-column: 1 / -1;
  }
  .primary-chinese-pager {
    margin-top: 12px;
  }
  .primary-chinese-detail {
    min-width: 0;
  }
  .primary-chinese-detail .panel-head {
    align-items: center;
    margin-bottom: 6px;
  }
  .primary-chinese-detail h4 {
    margin: 0;
    font-size: 20px;
  }
  .primary-character-context {
    padding: 5px 0 8px;
    color: var(--muted);
    font-size: 12px;
    border-bottom: 1px solid var(--line);
  }
  .primary-character-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 14px;
    margin: 0;
  }
  .primary-character-fields > div {
    min-width: 0;
    padding: 6px 0;
    border-bottom: 1px solid var(--line);
  }
  .primary-character-fields dt {
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
  }
  .primary-character-fields dd {
    margin: 0;
    color: var(--ink);
    font-size: 13px;
    line-height: 1.4;
    overflow-wrap: anywhere;
    white-space: pre-line;
  }
  .primary-character-fields > div.wide {
    grid-column: 1 / -1;
  }
  .primary-stroke-section {
    padding-top: 10px;
  }
  .primary-stroke-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }
  .primary-stroke-heading h5 {
    margin: 0;
    font-size: 17px;
  }
  .primary-stroke-heading span {
    color: var(--muted);
    font-size: 13px;
  }
  .primary-stroke-board {
    position: relative;
    width: min(100%, 250px);
    aspect-ratio: 1;
    margin: 8px auto;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 6px;
    background-color: #fff;
    background-image:
      linear-gradient(
        90deg,
        transparent 49.7%,
        #e7e3d9 49.8%,
        #e7e3d9 50.2%,
        transparent 50.3%
      ),
      linear-gradient(
        transparent 49.7%,
        #e7e3d9 49.8%,
        #e7e3d9 50.2%,
        transparent 50.3%
      ),
      linear-gradient(
        45deg,
        transparent 49.8%,
        #f0ede6 49.9%,
        #f0ede6 50.1%,
        transparent 50.2%
      ),
      linear-gradient(
        -45deg,
        transparent 49.8%,
        #f0ede6 49.9%,
        #f0ede6 50.1%,
        transparent 50.2%
      );
  }
  .primary-stroke-board svg {
    isolation: isolate;
  }
  .primary-stroke-guide {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #eeeae1;
    font-family: serif;
    font-size: 190px;
    line-height: 1;
    user-select: none;
  }
  .primary-stroke-board svg {
    position: absolute;
    inset: 5%;
    width: 90%;
    height: 90%;
    overflow: visible;
  }
  .primary-stroke-outline {
    fill: #e7e3da;
  }
  .primary-stroke-shape {
    fill: #c85e42;
    opacity: 0;
  }
  .primary-stroke-line {
    fill: none;
    stroke: #c85e42;
    stroke-width: 42;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .primary-stroke-caption {
    min-height: 24px;
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-line;
  }
  .hanzi-read {
    flex: 0 0 auto;
  }

  .scan-result-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 10px;
  }

  .scan-result-grid article {
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffdf7;
  }

  .scan-result-grid span {
    display: block;
    color: var(--green);
    font-size: 12px;
    font-weight: 900;
  }

  .scan-result-grid p {
    margin: 5px 0 0;
    color: var(--ink);
    line-height: 1.55;
  }

  .steps-list {
    display: grid;
    gap: 9px;
    margin: 0;
    padding-left: 20px;
    line-height: 1.6;
  }

  .wrong-animation-section {
    margin: 12px 0;
  }
  .wrong-animation-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
  }
  .wrong-animation-heading h4 {
    margin: 0;
    font-size: 17px;
  }
  .wrong-animation-heading .subtle-line {
    margin: 3px 0 0;
    font-size: 12px;
  }
  .wrong-animation-board {
    position: relative;
    min-height: 290px;
    overflow: hidden;
    padding: 14px 14px 64px;
    border: 1px solid #b9c8c6;
    border-radius: 8px;
    background-color: #fffefa;
    background-image:
      linear-gradient(rgba(64, 132, 149, 0.1) 1px, transparent 1px),
      linear-gradient(90deg, rgba(64, 132, 149, 0.1) 1px, transparent 1px);
    background-size: 22px 22px;
  }
  .wrong-animation-board-top {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    border-bottom: 2px solid #d86a52;
    color: #315c62;
    font-size: 13px;
  }
  .wrong-animation-board-top strong {
    flex: 1;
    font-size: 14px;
  }
  .wrong-animation-board-top small {
    color: var(--muted);
    font-size: 12px;
  }
  .wrong-animation-question {
    margin: 16px 0 12px;
    color: #283b3b;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.55;
    overflow-wrap: anywhere;
  }
  .wrong-animation-writing {
    min-height: 62px;
    display: flex;
    align-items: center;
    color: #24383c;
    font-size: 20px;
    font-weight: 800;
    line-height: 1.55;
    overflow-wrap: anywhere;
  }
  .wrong-animation-board.is-writing .wrong-animation-writing {
    animation: board-write 0.48s ease both;
  }
  .wrong-animation-mark {
    display: table;
    max-width: 100%;
    margin: 4px 0 8px auto;
    padding: 3px 9px;
    border: 2px solid var(--red);
    border-radius: 50%;
    color: #a84130;
    font-size: 14px;
    font-weight: 800;
    transform: rotate(-3deg);
    animation: board-mark 0.3s ease both;
  }
  .wrong-animation-narration {
    min-height: 24px;
    margin: 4px 0;
    color: #315c62;
    font-size: 14px;
    line-height: 1.55;
  }
  .wrong-animation-hint {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 7px 10px;
    border-radius: 6px;
    background: #e8f3ee;
    color: #285c50;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.4;
  }
  .wrong-animation-hint span:first-child {
    flex: 0 0 25px;
    color: #3280a0;
    font-size: 22px;
    text-align: center;
  }
  .wrong-animation-controls {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 64px;
    gap: 6px;
    margin-top: 8px;
  }
  .wrong-animation-controls button {
    min-width: 0;
    min-height: 44px;
    padding: 4px 6px;
    white-space: nowrap;
  }
  @keyframes board-write {
    from {
      clip-path: inset(0 100% 0 0);
      opacity: 0.55;
    }
    to {
      clip-path: inset(0);
      opacity: 1;
    }
  }
  @keyframes board-mark {
    from {
      transform: rotate(-3deg) scale(0.75);
      opacity: 0;
    }
    to {
      transform: rotate(-3deg) scale(1);
      opacity: 1;
    }
  }
  @media (prefers-reduced-motion: reduce) {
    .wrong-animation-board.is-writing .wrong-animation-writing,
    .wrong-animation-mark {
      animation: none;
    }
  }

  .question {
    margin: 8px 0 12px;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.55;
  }

  .quiz-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin: -4px 0 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
  }

  .options,
  .paper-list,
  .lesson-list,
  .method-list,
  .report-list,
  .archive-list {
    display: grid;
    gap: 9px;
  }

  .option,
  .paper-list button,
  .method-list button,
  .toggle-row,
  .mini-action {
    min-height: 48px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff9ec;
    color: var(--ink);
    text-align: left;
  }

  .option.selected {
    border-color: var(--green);
    background: var(--green-soft);
  }

  .feedback {
    margin: 12px 0 0;
    border-left: 4px solid var(--gold);
  }

  .subject-tabs {
    position: sticky;
    top: -16px;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    padding: 0 0 12px;
    background: #f7f3e8;
  }

  .subject-tabs button {
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    color: var(--muted);
    font-weight: 800;
  }

  .subject-tabs button.active {
    border-color: var(--green);
    background: var(--green);
    color: #fff9ea;
  }

  .lesson-card {
    display: grid;
    grid-template-columns: 82px 1fr;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
  }

  .lesson-thumb {
    display: grid;
    place-items: center;
    min-height: 72px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--green-soft), var(--gold-soft));
    color: var(--green);
    font-weight: 900;
  }

  .lesson-card h3 {
    font-size: 16px;
  }

  .lesson-title-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: 8px;
  }

  .lesson-status {
    display: inline-grid;
    place-items: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: #f0ede2;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    white-space: nowrap;
  }

  .lesson-status.learned {
    background: var(--gold-soft);
    color: #8a5c0d;
  }

  .lesson-status.done {
    background: var(--green-soft);
    color: var(--green);
  }

  .lesson-meta {
    margin: 5px 0 0;
    font-size: 13px;
  }

  .mini-action {
    min-height: 34px;
    margin-top: 9px;
    padding: 0 10px;
    color: var(--green);
    font-size: 13px;
    font-weight: 900;
    text-align: center;
  }

  .lesson-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .paper-list button,
  .method-list button {
    display: grid;
    gap: 4px;
    font-weight: 900;
  }

  .paper-list button.active {
    border-color: var(--green);
    background: var(--green-soft);
    color: var(--green);
  }

  .paper-list span,
  .method-list span {
    font-size: 13px;
    font-weight: 400;
  }

  .paper-actions {
    display: flex;
    gap: 8px;
    align-items: center;
  }

  .exam-start-panel {
    border-color: #cfdccf;
  }

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

  .exam-start-grid div {
    min-height: 68px;
    padding: 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff9ec;
  }

  .exam-start-grid span,
  .exam-result-list span,
  .exam-result-list em {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
    line-height: 1.5;
  }

  .exam-start-grid strong {
    display: block;
    margin-top: 6px;
    font-size: 16px;
  }

  .paper-feedback-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: 10px;
  }

  .paper-feedback-row .feedback {
    margin-top: 12px;
  }

  .exam-result-list {
    display: grid;
    gap: 9px;
    margin-top: 12px;
  }

  .grade4-filterbar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 10px 0;
  }

  .grade4-filterbar select {
    min-width: 0;
    font-size: 14px;
  }

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

  .grade-question-card {
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
  }

  .grade-question-card h4 {
    margin: 8px 0;
    font-size: 15px;
  }
  .grade-question-card > p {
    white-space: pre-wrap;
    line-height: 1.6;
  }
  .grade-question-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
  }
  .grade-question-meta span {
    padding: 3px 7px;
    border-radius: 6px;
    background: #eef1ea;
  }
  .grade-question-options {
    display: grid;
    gap: 5px;
    padding-left: 24px;
  }
  .grade-answer-details {
    margin-top: 10px;
    padding-top: 9px;
    border-top: 1px solid var(--line);
    line-height: 1.55;
  }
  .grade-answer-details summary {
    min-height: 36px;
    color: var(--green);
    cursor: pointer;
    font-weight: 800;
  }
  .grade-answer-details p {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }
  .grade-read-aloud {
    margin: 4px 0 8px;
  }
  .grade-tts-status {
    display: block;
    color: var(--muted);
    font-size: 13px;
  }
  .grade-tts-audio {
    display: block;
    width: 100%;
    margin-top: 8px;
  }
  .tts-reader {
    margin: 12px 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffdf7;
  }
  .tts-reader label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
  }
  .tts-reader textarea {
    width: 100%;
    min-height: 72px;
  }
  .tts-reader-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
  }
  .tts-reader audio {
    display: block;
    width: 100%;
    margin-top: 10px;
  }
  .tts-global-player {
    position: fixed;
    right: 14px;
    bottom: max(14px, env(safe-area-inset-bottom));
    z-index: 30;
    display: grid;
    gap: 7px;
    width: min(390px, calc(100vw - 28px));
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffdf7;
    box-shadow: var(--shadow);
  }
  .tts-global-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 40px;
  }
  .tts-global-head span {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 14px;
    font-weight: 700;
  }
  .tts-global-close {
    flex: 0 0 42px;
    width: 42px;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font-size: 24px;
    line-height: 1;
  }
  .tts-global-player audio {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 40px;
  }
  .tts-global-head span {
    color: var(--muted);
  }
  .grade4-practice-actions,
  .grade-library-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
  }
  .grade-library-pager span {
    color: var(--muted);
    font-size: 14px;
  }

  .exam-result-list article {
    padding: 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff9ec;
  }

  .exam-result-list p {
    margin: 7px 0;
    line-height: 1.5;
  }

  .subtle-line {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }

  .english-practice-panel {
    border-color: #cfdccf;
    background: #fbf8ef;
  }

  .english-vocabulary-panel {
    border-top: 3px solid var(--green);
  }
  .english-vocabulary-filters,
  .english-vocabulary-tools {
    display: grid;
    grid-template-columns: minmax(80px, 0.45fr) minmax(0, 2fr);
    gap: 8px;
    margin: 10px 0;
  }
  .english-vocabulary-filters input {
    min-width: 0;
  }
  .english-vocabulary-tools {
    grid-template-columns: minmax(0, 2fr) minmax(80px, 1fr);
  }
  .english-vocabulary-tools button {
    grid-column: 1 / -1;
  }
  .english-vocabulary-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 12px;
    align-items: start;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
  }
  .english-vocabulary-word {
    display: grid;
    gap: 3px;
    min-width: 0;
  }
  .english-vocabulary-word strong {
    overflow-wrap: anywhere;
  }
  .english-vocabulary-word small,
  .english-vocabulary-item > p {
    color: var(--muted);
  }
  .english-vocabulary-item > p {
    grid-column: 1;
    margin: 0;
    line-height: 1.45;
  }
  .english-vocabulary-item .mini-action {
    grid-column: 2;
    grid-row: 1 / span 2;
    min-height: 40px;
  }
  .vocabulary-row-actions {
    grid-column: 2;
    grid-row: 1 / span 2;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
  }
  .vocabulary-row-actions .mini-action {
    min-height: 48px;
    padding: 7px 9px;
  }
  .english-vocabulary-quiz {
    margin: 12px 0;
    padding: 12px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }
  .vocabulary-quiz-target {
    min-height: 44px;
    font-size: 19px;
    font-weight: 700;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
  }
  .vocabulary-answer-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }
  .compact-tool-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .vocabulary-answer-review {
    display: grid;
    gap: 8px;
    margin: 12px 0;
  }
  .vocabulary-answer-review article {
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
  }
  .vocabulary-answer-review p {
    margin: 4px 0;
    color: var(--muted);
  }
  .vocabulary-answer-review small {
    display: block;
    margin-top: 4px;
  }
  @media (max-width: 560px) {
    .english-vocabulary-filters {
      grid-template-columns: 76px minmax(0, 1fr);
    }
    .english-vocabulary-tools {
      grid-template-columns: minmax(0, 1fr) 76px;
    }
    .compact-tool-row {
      justify-content: flex-start;
    }
  }

  .english-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
    gap: 8px;
    margin-bottom: 10px;
  }

  .english-type-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
  }

  .english-type-tabs button {
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    color: var(--muted);
    font-weight: 900;
  }

  .english-type-tabs button.active {
    border-color: var(--green);
    background: var(--green);
    color: #fff9ea;
  }

  .english-study-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    max-height: 288px;
    overflow: auto;
    padding-right: 2px;
  }

  .english-study-card {
    display: grid;
    gap: 4px;
    min-height: 88px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
  }

  .english-study-card strong {
    color: var(--green);
    font-size: 16px;
    line-height: 1.2;
    overflow-wrap: anywhere;
  }

  .english-study-card span {
    color: var(--ink);
    line-height: 1.35;
  }

  .english-study-card small {
    color: var(--muted);
    line-height: 1.35;
  }

  .card-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .card-feedback {
    min-height: 18px;
  }

  .english-quiz-panel {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
  }

  .english-quiz-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: 10px;
  }

  .english-quiz-actions .feedback {
    margin-top: 0;
  }

  .reward-row,
  .tool-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    margin-top: 10px;
  }

  /* 听写练习：两个输入框等宽 */
  .dictation-inputs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    align-items: end;
    margin-top: 10px;
  }

  .dictation-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
  }

  .dictation-field-label {
    font-size: 12px;
    color: var(--muted);
  }

  .dictation-input {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .dictation-input.dictation-target {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(216, 160, 59, 0.16);
  }

  .dictation-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
  }

  .dictation-actions > button {
    min-height: 42px;
  }

  .dictation-photo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
  }

  .dictation-photo img {
    width: 84px;
    height: 84px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--line);
  }

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

  @media (max-width: 560px) {
    .dictation-inputs {
      grid-template-columns: minmax(0, 1fr);
    }
  }

  .interactive-tabs {
    position: sticky;
    top: -16px;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
    padding: 0 0 10px;
    background: #f7f3e8;
  }

  .interactive-topbar {
    position: sticky;
    top: -16px;
    z-index: 4;
    padding-bottom: 4px;
    background: #f7f3e8;
  }
  .interactive-topbar .reward-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 3px 10px;
    margin-top: 0;
    padding: 6px 10px;
  }
  .interactive-topbar .reward-panel .panel-head {
    flex: 1 1 180px;
    margin: 0;
    gap: 8px;
  }
  .interactive-topbar .reward-panel .panel-head > div {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
    flex-wrap: wrap;
  }
  .interactive-topbar .reward-panel .panel-head h3 {
    font-size: 15px;
  }
  .interactive-topbar .reward-panel .subtle-line {
    font-size: 12px;
  }
  .interactive-topbar .reward-row {
    display: flex;
    gap: 8px;
    margin: 0;
  }
  .interactive-topbar .reward-row span {
    padding: 0;
    border: 0;
    background: transparent;
    font-size: 13px;
  }
  .interactive-topbar .interactive-tabs {
    position: static;
    padding-bottom: 0;
  }

  .interactive-tabs button {
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    color: var(--muted);
    font-size: 13px;
    font-weight: 900;
  }

  .interactive-tabs button.active {
    border-color: var(--green);
    background: var(--green);
    color: #fff9ea;
  }

  .interactive-subtabs {
    display: flex;
    gap: 6px;
    margin: 0 0 7px;
    overflow-x: auto;
  }
  .interactive-subtabs button {
    flex: 1 0 110px;
    min-height: 36px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--paper);
    color: var(--green);
    font-weight: 800;
  }
  .interactive-subtabs button.active {
    border-color: var(--green);
    background: var(--green);
    color: #fff;
  }
  .poem-library-filters,
  .hanzi-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    min-width: min(100%, 420px);
  }
  .panel-tools.hanzi-filters {
    margin-left: 0;
  }
  .catalog-panel-head .hanzi-filters label {
    gap: 4px;
    font-size: 12px;
  }
  .panel[data-interactive-section="chinese"] {
    margin-top: 4px;
    padding: 10px;
  }
  .panel[data-interactive-section="chinese"] .filter-result-summary {
    margin-top: 5px;
    font-size: 12px;
  }
  .panel[data-interactive-section="chinese"] .hanzi-list {
    gap: 6px;
  }
  .catalog-panel-head .hanzi-filters input[type="search"] {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    padding: 6px 9px;
    font-size: 12px;
  }
  .panel[data-interactive-section="chinese"] .hanzi-list-item {
    min-height: 62px;
    padding: 7px;
    gap: 6px;
  }
  .panel[data-interactive-section="chinese"] .hanzi-list-char {
    flex-basis: 32px;
    font-size: 24px;
  }
  .poem-library-filters label {
    display: grid;
    gap: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }
  .poem-translation {
    padding-top: 12px;
    border-top: 1px solid var(--line);
  }
  .poem-translation strong {
    display: block;
    margin-bottom: 6px;
    color: var(--green-deep);
  }
  .poem-translation p,
  .poem-detail-content {
    white-space: pre-line;
    line-height: 1.85;
  }
  .poem-detail-tabs {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    padding: 8px 0 4px;
    border-bottom: 1px solid var(--line);
  }
  .poem-detail-tabs button {
    min-width: 0;
    min-height: 38px;
    padding: 6px 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    color: var(--muted);
    font-weight: 800;
    white-space: normal;
    line-height: 1.25;
  }
  .poem-detail-tabs button.active {
    border-color: var(--green);
    background: var(--green);
    color: #fff;
  }
  .poem-detail-content {
    min-height: 130px;
    padding: 14px 4px;
    color: var(--ink);
  }
  .primary-english-filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 8px 0;
  }
  .primary-english-word-list {
    display: grid;
    gap: 8px;
  }
  .primary-english-word {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 8px;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid var(--line);
  }
  .primary-english-word > div {
    display: flex;
    align-items: baseline;
    gap: 16px;
    min-width: 0;
    flex-wrap: wrap;
  }
  .primary-english-word strong {
    overflow-wrap: anywhere;
    font-size: 17px;
  }
  .primary-english-word small {
    color: var(--muted);
    font-size: 13px;
  }
  .homework-photo-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }
  .homework-photo-actions .file-action {
    min-width: 110px;
    justify-content: center;
  }
  .primary-english-word p {
    grid-column: 1;
    margin: 0;
    color: var(--ink);
    line-height: 1.5;
  }
  .primary-english-word button {
    grid-column: 2;
    grid-row: 1 / span 2;
    min-width: 56px;
  }
  .primary-english-words-panel[hidden],
  #englishPhrasesPanel[hidden] {
    display: none !important;
  }

  .interactive-tabs button[data-interactive-tab="vocabulary"] {
    white-space: nowrap;
  }

  .poem-board {
    display: grid;
    gap: 12px;
    margin-top: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffaf0;
  }

  .poem-board strong,
  .poem-board span {
    display: block;
  }

  .poem-board span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
  }

  .poem-lines {
    margin: 0;
    white-space: pre-line;
    color: var(--ink);
    font-size: 18px;
    font-weight: 800;
    line-height: 1.9;
  }

  .knowledge-detail-grid {
    display: grid;
    gap: 10px;
    margin-top: 12px;
  }

  .knowledge-detail-grid article {
    display: grid;
    gap: 5px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
  }

  .knowledge-detail-grid span {
    color: var(--muted);
    line-height: 1.65;
  }

  .reward-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-height: 34px;
  }

  .reward-row span {
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff9ec;
    color: var(--green);
    font-weight: 900;
    text-align: center;
  }

  .step-editor {
    display: grid;
    gap: 8px;
    margin: 10px 0;
  }

  .step-result {
    display: grid;
    gap: 8px;
    margin-top: 10px;
  }

  .step-result article {
    display: grid;
    gap: 5px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff9ec;
  }

  .step-result article.ok {
    border-color: var(--green);
    background: var(--green-soft);
  }

  .step-result article.risk {
    border-color: var(--red);
    background: var(--red-soft);
  }

  .step-result span {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
  }

  .hanzi-board {
    display: grid;
    grid-template-columns: 86px 1fr;
    gap: 12px;
    align-items: center;
    margin: 10px 0;
  }

  .hanzi-board > strong {
    display: grid;
    place-items: center;
    min-height: 86px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--green-soft);
    color: var(--green);
    font-size: 52px;
  }

  .hanzi-board span,
  .hanzi-board p {
    display: block;
    margin: 0 0 6px;
    line-height: 1.5;
  }

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

  .tool-grid button {
    display: grid;
    gap: 4px;
    min-height: 58px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff9ec;
    color: var(--ink);
    font-weight: 900;
    text-align: left;
  }

  .tool-grid button.active {
    border-color: var(--green);
    background: var(--green-soft);
    color: var(--green-deep);
  }

  .tool-grid span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }

  .calculator-display {
    width: 100%;
    min-height: 48px;
    margin-bottom: 8px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    color: var(--ink);
    font-size: 22px;
    font-weight: 900;
    text-align: right;
  }

  .calculator-keypad {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .calculator-keypad button {
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff9ec;
    color: var(--ink);
    font-size: 16px;
    font-weight: 900;
  }

  .calculator-keypad button[data-calc-key="="] {
    background: var(--green);
    color: white;
  }

  .rule-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 10px 0;
  }

  .rule-grid label,
  .inline-check {
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }

  .rule-grid select,
  .rule-grid input {
    min-width: 0;
  }

  .inline-check {
    grid-template-columns: auto 1fr;
    align-items: center;
    margin: 4px 0 10px;
  }

  .segmented {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin: 10px 0;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff9ec;
  }

  .segmented button {
    min-height: 34px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font-weight: 900;
  }

  .segmented button.active {
    background: var(--green);
    color: white;
  }

  .tool-panel {
    margin-top: 10px;
  }

  .mini-game-board {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
  }

  .mini-game-board button {
    min-height: 48px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff9ec;
    color: var(--ink);
    font-weight: 900;
  }

  .mini-game-board button.done {
    border-color: var(--green);
    background: var(--green-soft);
    color: var(--green);
  }

  .mini-game-board[data-kind="word"],
  .mini-game-board[data-kind="hanzi"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .mini-game-board button {
    padding: 8px;
    overflow-wrap: anywhere;
  }
  .mini-game-board button.selected {
    border-color: var(--green);
    background: var(--green-soft);
    box-shadow: inset 0 0 0 1px var(--green);
  }

  .option.answered:not(.selected) {
    border-color: var(--red);
    background: var(--red-soft);
  }

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

  .map button {
    min-height: 48px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-weight: 900;
  }

  .map .ok {
    background: var(--green-soft);
    color: var(--green);
  }

  .map .warn {
    background: var(--gold-soft);
    color: #8a5c0d;
  }

  .map .risk {
    background: var(--red-soft);
    color: #a83e2b;
  }

  .map button.active {
    outline: 3px solid rgba(46, 111, 97, 0.2);
    border-color: var(--green);
  }

  .bars {
    display: grid;
    gap: 12px;
  }

  .bars div {
    display: grid;
    grid-template-columns: 54px 1fr 42px;
    align-items: center;
    gap: 8px;
  }

  .bars b {
    display: block;
    height: 10px;
    border-radius: 999px;
    background: var(--teal);
  }

  .bars em {
    color: var(--muted);
    font-style: normal;
    font-weight: 800;
  }

  .setting-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
  }

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

  .setting-row span {
    color: var(--muted);
  }

  .setting-row strong {
    text-align: right;
  }

  .range {
    width: 100%;
    accent-color: var(--green);
  }

  .toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin: 8px 0 4px;
    font-weight: 900;
  }

  .toggle-row b {
    color: var(--muted);
  }

  .toggle-row.active {
    border-color: #bdd4c9;
    background: var(--green-soft);
    color: var(--green);
  }

  .toggle-row.active b {
    color: var(--green);
  }

  .admin-grid,
  .admin-form,
  .admin-list,
  .source-list {
    display: grid;
    gap: 10px;
  }

  .form-row.two {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .ai-generate-form,
  .generated-preview {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff9ec;
  }

  .admin-form h4,
  .source-box h4 {
    margin: 0;
    font-size: 16px;
  }

  .field-label,
  .parent-task-form label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-weight: 800;
  }

  .period-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
  }

  .period-switch button {
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font-weight: 800;
  }

  .period-switch button.active {
    border-color: var(--green);
    background: var(--green);
    color: #fff;
  }

  .inline-status {
    min-height: 22px;
    margin: 8px 0;
    color: var(--muted);
    font-size: 14px;
  }

  .parent-metrics,
  .parent-scores {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
  }

  .parent-metric,
  .parent-score {
    min-height: 76px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
  }

  .parent-metric span,
  .parent-score span {
    display: block;
    color: var(--muted);
    font-size: 14px;
  }

  .parent-metric strong,
  .parent-score strong {
    display: block;
    margin-top: 5px;
    font-size: 20px;
  }

  .chart-wrap {
    margin-top: 14px;
    padding: 12px 8px;
    border-bottom: 1px solid var(--line);
  }

  .chart-wrap canvas {
    display: block;
    width: 100%;
    height: 180px;
  }

  .chart-legend {
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 13px;
  }

  .chart-legend span:first-child::before,
  .chart-legend span:last-child::before {
    display: inline-block;
    width: 9px;
    height: 9px;
    margin-right: 6px;
    border-radius: 50%;
    background: var(--teal);
    content: "";
  }

  .chart-legend span:last-child::before {
    background: var(--gold);
  }

  .parent-subsection {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
  }

  .parent-list {
    display: grid;
    gap: 8px;
  }

  .parent-list-item {
    display: grid;
    gap: 4px;
    padding: 10px;
    border-left: 3px solid var(--teal);
    background: #f4f7f3;
    line-height: 1.45;
  }

  .parent-list-item.alert {
    border-color: var(--red);
  }
  .parent-list-item.unread {
    background: var(--gold-soft);
  }
  .parent-list-item small {
    color: var(--muted);
    font-size: 13px;
  }
  .parent-empty {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
  }

  .parent-task-form {
    display: grid;
    gap: 10px;
    margin-top: 12px;
  }

  .parent-task-form label {
    color: var(--ink);
  }

  @media (max-width: 380px) {
    .parent-metrics,
    .parent-scores {
      grid-template-columns: 1fr 1fr;
    }
  }

  .source-box {
    display: grid;
    gap: 10px;
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff9ec;
  }

  .source-box .panel-head {
    margin-bottom: 0;
  }

  .source-item {
    display: grid;
    gap: 4px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
  }

  .source-item span,
  .source-item small {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
  }

  .admin-item {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff9ec;
  }

  .admin-item span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
  }

  .admin-item button {
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    color: #a83e2b;
    font-size: 12px;
    font-weight: 900;
  }

  .admin-item b {
    color: var(--green);
    font-size: 12px;
  }

  .generated-empty {
    background: var(--paper);
  }

  .archive-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 5px 10px;
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff9ec;
    color: var(--ink);
    text-align: left;
  }

  .archive-item strong,
  .archive-item span {
    min-width: 0;
  }

  .archive-item span {
    grid-column: 1 / -1;
  }

  .archive-item b {
    color: var(--green);
    font-size: 12px;
  }

  .dict-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    grid-column: 1 / -1;
  }

  .report-list button {
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff9ec;
    color: var(--ink);
    line-height: 1.5;
    text-align: left;
    font-weight: 800;
  }

  .report-list button.active {
    border-color: var(--green);
    background: var(--green-soft);
    color: var(--green);
  }

  .bottom-nav {
    position: sticky;
    bottom: 0;
    z-index: 15;
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-auto-rows: 62px;
    gap: 4px;
    padding: 8px 10px max(8px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--paper);
    box-shadow: 0 -2px 8px rgba(34, 37, 31, 0.06);
  }

  .bottom-nav button {
    min-width: 0;
    min-height: 48px;
    padding: 0 4px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 14px;
    font-weight: 900;
    line-height: 1.2;
    white-space: nowrap;
  }

  .bottom-nav button.active {
    background: var(--green-soft);
    color: var(--green);
  }

  .bottom-nav button:focus-visible,
  .hub-link:focus-visible,
  .primary:focus-visible,
  .mini-action:focus-visible,
  .link-btn:focus-visible {
    outline: 3px solid rgba(46, 111, 97, 0.34);
    outline-offset: 2px;
  }

  .toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translate(-50%, 20px);
    opacity: 0;
    padding: 12px 16px;
    border-radius: 8px;
    background: var(--ink);
    color: #fff9ea;
    transition: all 0.2s ease;
    pointer-events: none;
  }

  .toast.show {
    transform: translate(-50%, 0);
    opacity: 1;
  }

  .auth-overlay {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(34, 37, 31, 0.48);
    backdrop-filter: blur(8px);
  }

  .auth-overlay.hidden {
    display: none;
  }

  .auth-card {
    width: min(100%, 420px);
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--paper);
    box-shadow: var(--shadow);
  }

  .auth-card h2 {
    font-size: 26px;
  }

  .auth-form {
    display: grid;
    gap: 10px;
    margin: 16px 0 10px;
  }

  .auth-hint,
  .auth-error {
    margin: 8px 0 0;
    font-size: 13px;
    line-height: 1.5;
  }

  .auth-hint {
    color: var(--muted);
  }

  .auth-error {
    min-height: 20px;
    color: #a83e2b;
    font-weight: 800;
  }

  .primary:active,
  .mode-switch:active,
  .link-btn:active,
  .quick-grid button:active,
  .bottom-nav button:active,
  .option:active,
  .paper-list button:active,
  .method-list button:active,
  .toggle-row:active,
  .mini-action:active,
  .admin-item button:active {
    transform: scale(0.98);
  }

  button:disabled {
    cursor: progress;
    opacity: 0.68;
  }

  @media (max-width: 900px) {
    .stage {
      display: block;
      min-height: 100dvh;
      padding: 0;
    }

    .phone {
      width: 100%;
      height: 100dvh;
      min-height: 100dvh;
      border: 0;
      border-radius: 0;
      padding-top: env(safe-area-inset-top);
    }

    .primary-nav {
      bottom: 0;
    }
  }

  @media (max-width: 380px) {
    .quick-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hero-card {
      grid-template-columns: 1fr;
    }

    .hero-card svg {
      max-width: 160px;
      justify-self: center;
    }

    .ai-flow,
    .map {
      grid-template-columns: 1fr;
    }

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

    .grade4-filterbar {
      grid-template-columns: 1fr 1fr;
    }
    .bottom-nav {
      grid-auto-rows: 54px;
      gap: 2px;
      padding: 5px 5px max(5px, env(safe-area-inset-bottom));
    }
    .bottom-nav button {
      min-height: 48px;
      padding: 0 2px;
      font-size: 13px;
    }

    .app-header {
      align-items: center;
      gap: 8px;
    }

    .header-actions {
      flex: 0 0 auto;
      flex-direction: row;
      flex-wrap: nowrap;
      gap: 4px;
    }

    .mode-switch {
      min-height: 32px;
      padding: 0 7px;
      font-size: 12px;
    }

    .english-toolbar,
    .english-quiz-actions,
    .paper-feedback-row,
    .exam-start-grid {
      grid-template-columns: 1fr;
    }

    .english-study-list {
      grid-template-columns: 1fr;
      max-height: 360px;
    }
  }

  @media (min-width: 901px) {
    .screen {
      padding: 18px 20px 28px;
    }
    .profile-band {
      margin-top: 12px;
    }
  }

  /* Keep the main catalogue visible and reachable on narrow screens. */
  .grade-library-entry {
    margin-top: 0;
    border-color: var(--green);
    background: #eef6f0;
  }
  .grade-library-entry p {
    color: var(--muted);
    line-height: 1.5;
  }
  .grade-library-entry .primary {
    padding: 10px 14px;
  }
  .grade-entry-subjects {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .grade-entry-subjects button {
    min-height: 44px;
    border: 1px solid var(--green);
    border-radius: 8px;
    background: var(--paper);
    color: var(--green);
    font-weight: 800;
  }
  .bottom-nav {
    z-index: 15;
  }
  .primary-nav {
    position: sticky;
    top: auto;
    bottom: 0;
    inset-inline: auto;
    border-radius: 0;
  }
  .primary-nav button {
    min-width: 0;
  }
  .visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .parent-account-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
  }
  .task-knowledge-field {
    margin: 12px 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
  }
  .task-knowledge-choices {
    display: grid;
    gap: 6px;
    max-height: 260px;
    overflow-y: auto;
  }
  .task-knowledge-choices label {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
  }
  .task-knowledge-choices input {
    width: 20px;
    min-height: 20px;
  }
  .task-knowledge-field legend {
    padding: 0 6px;
    font-weight: 800;
  }
  .task-open-button {
    min-height: 38px;
    margin-top: 8px;
  }
  .knowledge-subject-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin: 10px 0;
  }
  .knowledge-subject-tabs button {
    flex: 1 0 82px;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    color: var(--green);
    font-weight: 800;
  }
  .knowledge-subject-tabs button.active {
    background: var(--green);
    color: white;
  }
  .knowledge-methods-legacy {
    display: none !important;
  }
  #methodList {
    display: none !important;
  }
  .home-task-row {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
  }
  .home-task-row button {
    min-width: 82px;
  }
  .home-task-title {
    overflow-wrap: anywhere;
  }
  .checkin-task-actions {
    display: grid;
    justify-items: end;
    gap: 6px;
  }
  .written-answer-label {
    display: grid;
    gap: 7px;
    margin: 12px 0;
    font-weight: 700;
  }
  .written-answer-label textarea {
    width: 100%;
    min-height: 58px;
  }
  .question-written-feedback {
    display: block;
    color: var(--green);
    font-size: 14px;
  }
  .knowledge-detail-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .knowledge-detail-actions button {
    min-height: 42px;
  }
  .grade4-test-actions {
    margin-top: 12px;
  }
  #paperQuestionPanel,
  #examStartPanel {
    scroll-margin-top: 12px;
  }
  @media (max-width: 420px) {
    .app-header {
      align-items: flex-start;
      padding: 14px 12px 10px;
      gap: 8px;
    }
    .header-actions {
      max-width: 156px;
      gap: 4px;
    }
    .mode-switch {
      padding: 0 7px;
      font-size: 12px;
    }
    .grade-picker select {
      min-width: 120px;
    }
  }
  .primary-nav {
    top: auto;
    bottom: 0;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    border-bottom: 0;
  }

  .hub-intro {
    margin-top: 0;
    padding: 18px;
    border-color: rgba(46, 111, 97, 0.2);
    background: linear-gradient(135deg, #fffdf7, #e8f2ed);
  }
  .hub-intro h2 {
    margin: 2px 0 4px;
    font-size: 21px;
    line-height: 1.35;
  }
  .hub-intro .plain-text {
    margin: 0;
  }
  .hub-group {
    padding: 14px;
  }
  .hub-group .panel-head {
    margin-bottom: 10px;
  }
  .hub-link-grid {
    display: grid;
    gap: 8px;
  }
  .hub-link {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 16px;
    align-items: center;
    gap: 11px;
    width: 100%;
    min-height: 66px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    color: var(--ink);
    text-align: left;
  }
  .hub-link-icon {
    display: grid;
    place-items: center;
    width: 40px;
    aspect-ratio: 1;
    border-radius: 10px;
    background: var(--green-soft);
    color: var(--green);
    font-size: 17px;
    font-weight: 900;
  }
  .hub-link-icon.gold {
    background: var(--gold-soft);
    color: #8a6515;
  }
  .hub-link-icon.teal {
    background: #dbe9ee;
    color: var(--teal);
  }
  .hub-link-icon.red {
    background: var(--red-soft);
    color: #a83e2b;
  }
  .hub-link > span:nth-child(2) {
    display: grid;
    gap: 2px;
    min-width: 0;
  }
  .hub-link strong {
    font-size: 14px;
    line-height: 1.35;
  }
  .hub-link small {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
  }
  .hub-link > b {
    color: #aaa38f;
    font-size: 20px;
    font-weight: 500;
  }
  .hub-link:active {
    background: #f3f7f2;
  }
  @media (max-width: 900px) {
    .primary-nav {
      position: sticky;
      top: auto;
      bottom: 0;
    }
  }

  .material-list,
  .material-cards {
    display: grid;
    gap: 10px;
  }
  .material-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 12px;
    overflow-wrap: anywhere;
  }
  .material-card h4 {
    margin: 4px 0 8px;
    line-height: 1.45;
  }
  .material-card p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--muted);
  }
  .material-card .mini-action {
    width: 100%;
    text-align: center;
  }
  .material-page-image {
    display: block;
    width: 100%;
    height: auto;
    margin-top: 12px;
    border: 1px solid var(--line);
  }
  #materialReader {
    scroll-margin-top: 12px;
  }
  #materialOriginal {
    display: block;
    margin: 10px 0;
    text-align: center;
    text-decoration: none;
  }
  #materialAudio {
    width: 100%;
    margin: 14px 0;
  }
  #materialText {
    max-height: 400px;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font: inherit;
    line-height: 1.6;
  }
  #materialPageTools label {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
  }
  #materialPageNumber {
    width: 62px;
    min-width: 0;
    padding: 0 5px;
  }
  #materialPageTools {
    flex-wrap: wrap;
  }
  .material-vocab-card {
    padding: 10px;
    background: var(--green-soft);
    border-radius: 8px;
  }
  .material-vocab-card strong,
  .material-vocab-card span {
    display: block;
    line-height: 1.6;
  }
  .material-vocab-card small {
    color: var(--muted);
  }
  #materialQuiz {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
  }

  .qbank-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
    gap: 8px;
    margin: 12px 0;
  }
  .qbank-stat {
    display: grid;
    gap: 4px;
    padding: 10px;
    border-bottom: 2px solid var(--teal);
    background: #f5f8f5;
  }
  .qbank-stat span {
    color: var(--muted);
    font-size: 13px;
  }
  .qbank-stat strong {
    color: var(--green);
    font-size: 20px;
  }
  .qbank-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 8px;
  }
  .qbank-paper-list,
  .qbank-item-list {
    display: grid;
    gap: 8px;
  }
  .qbank-paper-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 11px 0;
    border-bottom: 1px solid var(--line);
  }
  .qbank-paper-row strong,
  .qbank-paper-row span,
  .qbank-paper-row small {
    display: block;
  }
  .qbank-paper-row span {
    margin-top: 4px;
    color: var(--green);
    font-size: 13px;
  }
  .qbank-paper-row small {
    margin-top: 3px;
    color: var(--muted);
    line-height: 1.45;
  }
  .qbank-item-row {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }
  .qbank-item-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    color: var(--muted);
    font-size: 12px;
  }
  .qbank-item-meta strong {
    color: var(--green);
    font-size: 14px;
  }
  .qbank-item-stem {
    margin-top: 8px;
    line-height: 1.65;
  }
  .qbank-question-image {
    display: block;
    max-width: min(100%, 420px);
    max-height: 260px;
    object-fit: contain;
    margin: 8px 0;
    border: 1px solid var(--line);
    background: #fff;
  }
  .qbank-table {
    display: grid;
    overflow-x: auto;
    margin-top: 8px;
  }
  .qbank-table > div {
    display: flex;
    min-width: max-content;
  }
  .qbank-table span {
    min-width: 72px;
    padding: 6px 9px;
    border: 1px solid var(--line);
    text-align: center;
  }
  .qbank-options {
    padding-left: 24px;
  }
  .qbank-options li {
    margin: 4px 0;
  }
  .qbank-item-row details {
    margin-top: 8px;
    border-top: 1px dashed var(--line);
    padding-top: 7px;
  }
  .qbank-item-row details summary {
    color: var(--green);
    cursor: pointer;
  }
  .qbank-item-row details p {
    line-height: 1.6;
  }
  .qbank-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
  }
  .qbank-tags span {
    padding: 2px 7px;
    border-radius: 6px;
    background: #eaf3ec;
    color: var(--green);
    font-size: 12px;
  }
  @media (max-width: 480px) {
    .qbank-paper-row {
      grid-template-columns: 1fr;
    }
    .qbank-paper-row button {
      justify-self: start;
    }
  }

  .library-content-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .library-content-tabs button {
    min-height: 46px;
    border: 1px solid var(--green);
    border-radius: 8px;
    color: var(--green);
    background: var(--paper);
    font-weight: 800;
  }
  .library-content-tabs button.active {
    color: #fff;
    background: var(--green);
  }

  .user-management-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .user-management-toolbar input {
    flex: 1 1 160px;
    min-width: 0;
  }
  .managed-user-list {
    display: grid;
    gap: 12px;
  }
  .managed-user-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    overflow-wrap: anywhere;
  }
  .managed-user-card p {
    margin: 7px 0;
  }
  .managed-user-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
  }
  .managed-user-actions .ai-on {
    color: white;
    background: var(--green);
  }
  .managed-user-actions button {
    min-height: 44px;
  }
  .user-delete {
    color: #a13524;
  }
  #userEditor label:not(.user-toggle),
  #userPasswordForm label {
    display: grid;
    gap: 6px;
  }
  #userEditor .user-toggle {
    display: flex;
    gap: 8px;
    align-items: center;
    min-height: 44px;
  }
  #userEditor .user-toggle input {
    width: 22px;
    height: 22px;
    min-height: 22px;
    margin: 0;
  }
  #userEditor fieldset {
    border: 1px solid var(--line);
    padding: 12px;
    display: grid;
    gap: 8px;
  }
  #userEditorPanel,
  #userPasswordPanel {
    scroll-margin-top: 12px;
  }
}

* {
  box-sizing: border-box;
}
:root {
  --bg: #eef1ea;
  --paper: #fffdf7;
  --paper-2: #fbf8ef;
  --ink: #22251f;
  --muted: #6b7266;
  --line: #e2dccb;
  --green: #2e6f61;
  --green-deep: #245a4f;
  --green-soft: #dcece5;
  --gold: #d8a03b;
  --gold-soft: #f8ebc8;
  --red: #d86a52;
  --red-soft: #f8dfda;
  --blue: #3f7887;
  --blue-soft: #e2eef0;
  --shadow: 0 18px 46px rgba(39, 38, 30, 0.12);
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  font-size: 15px;
  background:
    radial-gradient(900px 500px at 0% 0%, #e6eee8 0%, transparent 60%),
    var(--bg);
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  border: 0;
  background: none;
}
h1,
h2,
h3,
h4,
p {
  margin: 0;
}
.stage {
  display: grid;
  place-items: center;
  padding: 24px;
}
.phone {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 430px;
  height: min(880px, calc(100vh - 48px));
  background: var(--paper);
  border: 1px solid #ded8c6;
  border-radius: 30px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 18px 12px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  z-index: 5;
}
.topbar .kicker {
  color: var(--green);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
}
.topbar h1 {
  font-size: 21px;
  letter-spacing: -0.04em;
  margin-top: 2px;
}
.grade-chip {
  padding: 6px 10px;
  border-radius: 20px;
  background: var(--green-soft);
  color: var(--green-deep);
  font-size: 11px;
  font-weight: 700;
  border: 1px solid #c6ded3;
}
.grade-chip.admin {
  background: var(--gold-soft);
  color: #8a6117;
  border-color: #eed7a1;
}
.screens {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 16px 76px;
  scroll-behavior: smooth;
}
.screens::-webkit-scrollbar {
  width: 0;
}
.screen {
  display: none;
}
.screen.active {
  display: block;
  animation: fade 0.18s ease-out;
}
@keyframes fade {
  from {
    opacity: 0.5;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 6px 16px rgba(39, 38, 30, 0.04);
}
.sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 2px 9px;
}
.sec-head:first-child {
  margin-top: 0;
}
.sec-head h2 {
  font-size: 15px;
  letter-spacing: -0.02em;
}
.sec-head .link {
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
}
.tag {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
}
.tag.yw {
  background: var(--gold-soft);
  color: #8a6117;
}
.tag.sx {
  background: var(--blue-soft);
  color: #33636e;
}
.tag.yy {
  background: var(--red-soft);
  color: #a24d3a;
}
.tag.gray {
  background: #f0eee5;
  color: var(--muted);
}
.tag.ok {
  background: var(--green-soft);
  color: var(--green-deep);
}
.primary {
  background: var(--green);
  color: #fffdf7;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 6px 14px rgba(46, 111, 97, 0.18);
}
.outline {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--green-deep);
}
.full {
  width: 100%;
  display: block;
  text-align: center;
}
.mini {
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}
.task-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid #f0ece0;
}
.task-row:last-child {
  border-bottom: 0;
}
.check {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid #cfc9b6;
  background: #fff;
  color: transparent;
  font-size: 13px;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.check.done {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.task-main strong {
  display: block;
  font-size: 13px;
}
.task-main span {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
  margin-top: 3px;
}
.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}
.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 8px;
  text-align: center;
}
.stat b {
  display: block;
  font-size: 19px;
  letter-spacing: -0.03em;
  color: var(--green-deep);
}
.stat b small {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  margin-left: 2px;
}
.stat span {
  display: block;
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 4px;
}
.advice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  padding: 11px 0;
  border-bottom: 1px dashed #ece7d9;
  font-size: 11.5px;
  line-height: 1.6;
}
.advice:last-child {
  border-bottom: 0;
}
.advice p {
  color: #4d5348;
}
.advice b {
  color: var(--ink);
}
.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
}
.quick {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 4px;
  text-align: center;
}
.quick .qi {
  width: 32px;
  height: 32px;
  margin: 0 auto 7px;
  border-radius: 10px;
  background: var(--green-soft);
  color: var(--green-deep);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 12px;
}
.quick span {
  font-size: 11px;
  font-weight: 600;
}
.quick:nth-child(2) .qi {
  background: var(--gold-soft);
  color: #8a6117;
}
.quick:nth-child(3) .qi {
  background: var(--blue-soft);
  color: #33636e;
}
.quick:nth-child(4) .qi {
  background: var(--red-soft);
  color: #a24d3a;
}
.tutor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.tile {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 13px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
}
.tile .ti {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 10px;
  background: var(--green-soft);
  color: var(--green-deep);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 12px;
}
.tile strong {
  font-size: 13px;
}
.tile.gold .ti {
  background: var(--gold-soft);
  color: #8a6117;
}
.tile.blue .ti {
  background: var(--blue-soft);
  color: #33636e;
}
.tile.red .ti {
  background: var(--red-soft);
  color: #a24d3a;
}
.fixed-tabs {
  position: sticky;
  top: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 6px;
  margin: -2px 0 12px;
  background: rgba(255, 253, 247, 0.96);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.fixed-tabs button {
  padding: 9px 4px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: transparent;
}
.fixed-tabs button.active {
  background: var(--green);
  color: #fff;
}
.level-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.level {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 10px 4px;
  text-align: center;
}
.level b {
  display: block;
  font-size: 12px;
}
.level small {
  display: block;
  font-size: 9.5px;
  color: var(--muted);
  margin-top: 3px;
}
.level.locked {
  opacity: 0.45;
}
.level.cur {
  border-color: var(--green);
  background: var(--green-soft);
}
.q-box {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 15px;
  margin-top: 12px;
}
.q-stem {
  font-size: 15.5px;
  line-height: 1.7;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.q-meta {
  display: flex;
  gap: 6px;
  margin-bottom: 9px;
  flex-wrap: wrap;
}
.opt {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  font-size: 13px;
}
.opt em {
  font-style: normal;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--paper-2);
  display: grid;
  place-items: center;
  font-size: 11px;
  color: var(--muted);
  flex: 0 0 20px;
}
.opt.sel {
  border-color: var(--green);
  background: var(--green-soft);
}
.opt.ok {
  border-color: var(--green);
  background: #eaf6ef;
}
.opt.bad {
  border-color: var(--red);
  background: var(--red-soft);
}
.answer-line {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 11px;
}
.calc-input {
  flex: 1;
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 16px;
  font-weight: 700;
}
.feedback {
  font-size: 12px;
  line-height: 1.6;
  margin-top: 10px;
  padding: 10px;
  border-radius: 9px;
  background: var(--paper-2);
  color: var(--muted);
}
.feedback.ok {
  background: #eaf6ef;
  color: var(--green-deep);
}
.feedback.bad {
  background: var(--red-soft);
  color: #a24d3a;
}
.pbar {
  height: 5px;
  border-radius: 4px;
  background: #eee9db;
  overflow: hidden;
  margin: 4px 0 12px;
}
.pbar i {
  display: block;
  height: 100%;
  background: var(--green);
  transition: width 0.25s;
}
.filter-bar {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
select {
  appearance: none;
  padding: 9px 28px 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b7266'/%3E%3C/svg%3E")
    no-repeat right 10px center;
  font-size: 12px;
  font-weight: 600;
}
.reset-btn {
  font-size: 10.5px;
  color: var(--muted);
  padding: 8px 0;
  white-space: nowrap;
  text-decoration: underline;
}
.wrong-row {
  position: relative;
  width: 100%;
  text-align: left;
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 26px 11px 12px;
  margin-bottom: 8px;
}
.wr-top {
  display: flex;
  gap: 5px;
  align-items: center;
  margin-bottom: 6px;
}
.wr-top .date {
  margin-left: auto;
  font-size: 10px;
  color: #a3a89b;
}
.wr-stem {
  display: block;
  font-size: 12.5px;
  color: #3c4237;
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wr-arrow {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #b7bcaa;
  font-size: 18px;
}
.empty {
  padding: 34px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 12px;
}
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 0 2px;
  font-size: 11px;
  color: var(--muted);
}
.pager button {
  padding: 6px 11px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 11px;
  color: var(--green-deep);
  font-weight: 600;
}
.pager button:disabled {
  opacity: 0.4;
  color: var(--muted);
}
.detail .row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 8px;
  font-size: 12px;
  line-height: 1.6;
  padding: 8px 0;
  border-bottom: 1px dashed #efeadb;
}
.detail .row:last-child {
  border-bottom: 0;
}
.detail .row .k {
  color: var(--muted);
  font-size: 11px;
}
.detail .row .v {
  color: #333a2f;
}
.detail .stem-v {
  font-weight: 700;
  font-size: 13.5px;
}
.tag-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.analysis {
  background: #f6f3e7;
  border-radius: 9px;
  padding: 10px;
  font-size: 12px;
  line-height: 1.7;
  color: #4b5145;
  margin-top: 10px;
}
.tool-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.tool {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 3px 9px;
  text-align: center;
}
.tool .tic {
  width: 29px;
  height: 29px;
  margin: 0 auto 6px;
  border-radius: 9px;
  background: var(--green-soft);
  color: var(--green-deep);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
}
.tool span {
  display: block;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.35;
}
.tool:nth-child(2) .tic,
.tool:nth-child(7) .tic {
  background: var(--gold-soft);
  color: #8a6117;
}
.tool:nth-child(5) .tic,
.tool:nth-child(6) .tic {
  background: var(--blue-soft);
  color: #33636e;
}
.tool:nth-child(8) .tic {
  background: var(--red-soft);
  color: #a24d3a;
}
.file-list {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}
.file-item {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  font-size: 11px;
}
.file-item b {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-item small {
  margin-left: auto;
  color: var(--muted);
  white-space: nowrap;
}
.sim-result {
  margin-top: 11px;
  padding: 12px;
  border-radius: 10px;
  background: #f4f1e5;
  font-size: 12px;
  line-height: 1.7;
}
.sim-result b {
  color: var(--green-deep);
}
.profile-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
}
.avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--gold-soft);
  color: #7c5713;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 16px;
}
.profile-card strong {
  display: block;
  font-size: 15px;
}
.profile-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 3px;
}
.setting-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid #f2eee2;
}
.setting-row:last-child {
  border-bottom: 0;
}
.setting-row strong {
  display: block;
  font-size: 12.5px;
}
.setting-row small {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
  margin-top: 3px;
  line-height: 1.5;
}
.setting-row select {
  max-width: 150px;
}
.user-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f2eee2;
  font-size: 12px;
}
.user-item:last-child {
  border-bottom: 0;
}
.user-item b {
  font-weight: 600;
}
.user-item small {
  color: var(--muted);
  font-size: 10px;
  display: block;
  margin-top: 2px;
}
.tabbar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  background: var(--paper);
  border-top: 1px solid var(--line);
  padding: 7px 4px calc(7px + env(safe-area-inset-bottom));
  z-index: 6;
}
.tabbar button {
  padding: 5px 0 4px;
  display: grid;
  justify-items: center;
  gap: 3px;
  color: #8a9082;
  font-size: 10.5px;
  font-weight: 600;
}
.tabbar button .nicon {
  width: 23px;
  height: 23px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  background: #f1eee2;
  color: #7d8377;
}
.tabbar button.active {
  color: var(--green-deep);
}
.tabbar button.active .nicon {
  background: var(--green);
  color: #fffdf7;
  box-shadow: 0 5px 12px rgba(46, 111, 97, 0.28);
}
.fab-wrap {
  position: absolute;
  pointer-events: none;
  right: 14px;
  bottom: 74px;
  z-index: 7;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
}
.fab-menu {
  display: grid;
  gap: 7px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: 0.18s;
}
.fab-menu.open {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}
.fab-item {
  display: flex;
  align-items: center;
  gap: 7px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 7px 12px 7px 7px;
  font-size: 11px;
  font-weight: 600;
  box-shadow: 0 8px 18px rgba(39, 38, 30, 0.12);
}
.fab-item em {
  font-style: normal;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green-deep);
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 800;
}
.fab-main {
  pointer-events: auto;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--green);
  color: #fffdf7;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(46, 111, 97, 0.32);
  display: grid;
  place-items: center;
}
.fab-main span {
  font-size: 9px;
  line-height: 1.1;
  text-align: center;
  font-weight: 600;
}
.backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 34, 27, 0.42);
  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
  z-index: 20;
  border-radius: 29px;
}
.backdrop.show {
  opacity: 1;
  pointer-events: auto;
}
.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 86%;
  overflow-y: auto;
  background: var(--paper);
  border-radius: 20px 20px 0 0;
  padding: 16px 18px 26px;
  transform: translateY(102%);
  transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 21;
  box-shadow: 0 -20px 46px rgba(20, 30, 25, 0.18);
}
.sheet.show {
  transform: translateY(0);
}
.sheet.dictation-sheet {
  position: fixed;
  inset: 0;
  width: 100vw;
  max-height: none;
  height: 100dvh;
  border-radius: 0;
  padding: max(20px, env(safe-area-inset-top)) 22px max(28px, env(safe-area-inset-bottom));
  transform: translateY(102%);
}
.sheet.dictation-sheet.show { transform: translateY(0); }
.backdrop.dictation-backdrop { position:fixed; inset:0; border-radius:0; }
.dictation-player { display:grid; grid-template-columns:1fr 1.2fr 1fr; gap:10px; margin:18px 0 12px; }
.dictation-player button { min-height:46px; }
.dictation-answer-list { display:grid; gap:8px; margin:14px 0; }
.dictation-answer-list > div { display:flex; justify-content:space-between; gap:12px; padding:10px 12px; border:1px solid var(--line); border-radius:10px; background:#fff; }
.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.sheet-head h2 {
  font-size: 18px;
  letter-spacing: -0.03em;
}
.sheet-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #efece0;
  color: #5f6559;
  font-size: 16px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
}
.sheet-list {
  display: grid;
  gap: 8px;
}
.sheet-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  text-align: left;
}
.sheet-row strong {
  display: block;
  font-size: 12.5px;
}
.sheet-row small {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
  margin-top: 3px;
  line-height: 1.5;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 9px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 11px;
  cursor: pointer;
}
.chip.sel {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.pick {
  display: grid;
  gap: 9px;
  margin-top: 6px;
}
.pick button {
  padding: 14px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13px;
  font-weight: 600;
}
.toast {
  position: absolute;
  left: 50%;
  top: 64px;
  transform: translate(-50%, -10px);
  background: #25322c;
  color: #fff;
  font-size: 12px;
  padding: 10px 16px;
  border-radius: 20px;
  opacity: 0;
  pointer-events: none;
  transition: 0.22s;
  z-index: 26;
  max-width: 78%;
  text-align: center;
  box-shadow: 0 8px 20px rgba(20, 30, 25, 0.18);
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.word-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-top: 8px;
}
.word {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 4px;
  text-align: center;
  background: #fff;
}
.word b {
  display: block;
  font-size: 14px;
}
.word small {
  display: block;
  color: var(--muted);
  font-size: 9.5px;
  margin-top: 2px;
}
.poem {
  border-left: 3px solid var(--green-soft);
  padding: 2px 0 2px 10px;
  margin-bottom: 11px;
  font-size: 12px;
  line-height: 1.75;
}
.poem b {
  display: block;
  font-size: 13px;
  color: var(--green-deep);
}
.poem small {
  color: var(--muted);
  font-size: 10.5px;
}
.quiz-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}
.timer-display {
  font-size: 44px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: center;
  color: var(--green-deep);
  padding: 14px 0;
}
.calc-display {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 20px;
  font-weight: 700;
  text-align: right;
  min-height: 52px;
  overflow-wrap: anywhere;
}
.keypad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin-top: 9px;
}
.keypad button {
  padding: 13px 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  font-size: 16px;
  font-weight: 700;
}
.keypad button.fn {
  background: var(--paper-2);
  color: var(--muted);
  font-size: 14px;
}
.keypad button.eq {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}
.step-result {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.7;
}
.step-line {
  padding: 9px 10px;
  border-radius: 9px;
  background: #fff;
  border: 1px solid var(--line);
}
.dict-item {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.7;
}
.dict-item b {
  font-size: 14px;
  color: var(--green-deep);
  margin-right: 6px;
}
.game-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.gcell {
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  padding: 6px;
  line-height: 1.4;
  display: grid;
  place-items: center;
  text-align: center;
}
.gcell.revealed {
  background: var(--green-soft);
  color: var(--green-deep);
  border-color: #bcd8ca;
}
.gcell.matched {
  background: var(--gold-soft);
  color: #7c5713;
  border-color: #ecd9a9;
}
.period-switch {
  display: flex;
  gap: 4px;
  background: #f2efe3;
  padding: 3px;
  border-radius: 8px;
}
.period-switch button {
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
}
.period-switch button.active {
  background: #fff;
  color: var(--green-deep);
  box-shadow: 0 2px 6px rgba(39, 38, 30, 0.08);
}
.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.metric {
  background: var(--paper-2);
  border-radius: 10px;
  padding: 10px 11px;
}
.metric b {
  display: block;
  font-size: 18px;
  color: var(--green-deep);
  letter-spacing: -0.03em;
}
.metric b small {
  font-size: 10px;
  color: var(--muted);
  margin-left: 2px;
  font-weight: 600;
}
.metric span {
  display: block;
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 3px;
}
.bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 74px;
  margin-top: 10px;
  padding-top: 6px;
  border-bottom: 1px solid #eee9db;
}
.bars i {
  flex: 1;
  height: 100%;
  min-width: 3px;
  background: var(--green-soft);
  border-radius: 3px 3px 0 0;
  position: relative;
}
.bars i b {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--green);
  border-radius: 3px 3px 0 0;
}
.bars-axis {
  display: flex;
  justify-content: space-between;
  font-size: 9.5px;
  color: #a3a89b;
  margin-top: 4px;
}
.board-sub {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed #ece7d9;
}
.board-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: #4d5348;
}
.board-line b {
  color: var(--green-deep);
  font-weight: 700;
}
.control-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 9px 0;
}
.control-row span {
  font-size: 12.5px;
}
.control-row strong {
  font-size: 11.5px;
  color: var(--green-deep);
  font-weight: 700;
}
.range {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 3px;
  background: #e6e2d3;
  margin: 2px 0 8px;
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 2px 6px rgba(46, 111, 97, 0.3);
}
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  font-size: 11.5px;
  margin: 8px 0;
}
.toggle-row b {
  font-size: 10.5px;
  color: var(--muted);
  padding: 3px 8px;
  border-radius: 10px;
  background: #f1eee2;
}
.toggle-row.active {
  border-color: #bcd8ca;
  background: var(--green-soft);
}
.toggle-row.active b {
  color: var(--green-deep);
  background: #fff;
}
.paper-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f2eee2;
}
.paper-row:last-child {
  border-bottom: 0;
}
.paper-row strong {
  display: block;
  font-size: 12.5px;
}
.paper-row small {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
  margin-top: 3px;
}
.paper-row .down {
  display: flex;
  gap: 5px;
}
.paper-row .down button {
  padding: 7px 9px;
  border-radius: 8px;
  font-size: 10.5px;
  font-weight: 700;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--green-deep);
  white-space: nowrap;
}
.check-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px dashed #ece7d9;
}
.check-row:last-child {
  border-bottom: 0;
}
.check-row .cb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid #cfc9b6;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  color: transparent;
  background: #fff;
}
.check-row.done .cb {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.check-row .lbl {
  font-size: 12.5px;
  line-height: 1.5;
}
.check-row .lbl small {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
  margin-top: 2px;
}
.check-row .go {
  font-size: 10.5px;
  color: var(--green);
  font-weight: 700;
  white-space: nowrap;
}
.task-row {
  cursor: pointer;
}
@media (max-width: 900px) {
  .stage {
    display: block;
    padding: 0;
  }
  .phone {
    width: 100%;
    height: 100dvh;
    border-radius: 0;
    border: 0;
    box-shadow: none;
  }
  .backdrop {
    border-radius: 0;
  }
}
@media (min-width: 901px) and (max-height: 820px) {
  .phone {
    height: calc(100vh - 40px);
  }
}

.phone {
  max-width: none;
  margin: 0;
  padding: 0;
}
.stage {
  grid-template-columns: 1fr;
  min-height: 100dvh;
}
.screen {
  position: static;
  height: auto;
  overflow: visible;
  padding: 0;
}
.screens {
  display: block;
}
.topbar,
.tabbar {
  position: relative;
  inset: auto;
}
.sheet {
  z-index: 22;
}
.backdrop {
  z-index: 21;
}
.fab-wrap {
  z-index: 8;
}
.toast {
  z-index: 30;
}
.auth-overlay {
  z-index: 40;
}
.auth-form input {
  width: 100%;
}
.auth-card {
  max-width: 360px;
}
.auth-card h2 {
  margin: 5px 0 18px;
}
.task-row {
  width: 100%;
  text-align: left;
}
.sheet input:not([type="range"]),
.sheet select {
  max-width: 100%;
}
.sheet .sheet-row small {
  white-space: pre-line;
}
.sheet .q-stem,
.detail .v,
.analysis {
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.tabbar {
  padding-bottom: max(5px, env(safe-area-inset-bottom));
}
.screen:not(.active) {
  display: none;
}
.grade-chip {
  min-height: 32px;
}
.tool,
.quick,
.tabbar button {
  min-height: 44px;
}
button:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}
.sheet:not(.show) {
  visibility: hidden;
}
.sheet.show {
  visibility: visible;
}
.auth-overlay.hidden,
[hidden] {
  display: none !important;
}
.card audio {
  width: 100%;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.connection-status {position:fixed;top:8px;left:50%;transform:translateX(-50%);z-index:100;max-width:calc(100vw - 24px);padding:9px 14px;border-radius:10px;background:#245a4f;color:#fffdf7;font-size:13px;box-shadow:0 3px 12px #0002}

.aligned-setting { grid-template-columns: 88px minmax(0,1fr); text-align:left; }
.aligned-setting select, .aligned-setting input { width:100%; max-width:100%; min-width:0; text-align:left; text-align-last:left; justify-self:start; }
.section-action { font:inherit; font-weight:700; color:var(--ink); padding:0; text-align:left; }
.materials-page {max-width:760px;margin:0 auto;padding:18px;}
.materials-page header {display:flex;align-items:center;justify-content:space-between;gap:12px;}
.materials-page .filter-bar {flex-wrap:wrap;margin:16px 0;}
.materials-page .card {margin:12px 0;}
.materials-page .download-actions {display:flex;gap:10px;flex-wrap:wrap;margin-top:12px;}
.materials-page a {color:var(--green);}

#screen-my select, #sheet select, #screen-my input, #sheet input { text-align: left; text-align-last: left; }

.materials-page a.primary { color: var(--paper); text-decoration: none; }
.answer-line .primary { white-space: nowrap; }

/* v69: controls and inline tools retain the existing palette. */
#account-settings, #screen-my .section-action, #screen-my [data-act="materials-download"],
#sheet .aligned-setting { text-align:left; }
#task-selection {font-size:12px;color:var(--muted);margin:8px 0;}
#task-points .chip.sel::before {content:"✓";font-weight:700;}
#screen-my .filter-bar {grid-template-columns:minmax(0,1fr) minmax(0,1fr);}
#task-date {grid-column:1 / -1;min-width:0;}
.tool-panel {grid-column:1 / -1;min-width:0;text-align:left;margin:4px 0 10px;}
.tool-panel .sheet-head {position:static;}
.tool-panel .keypad {display:grid;grid-template-columns:repeat(4,minmax(0,1fr));}
.tool-panel .keypad button {min-height:44px;}
.tool-panel .analysis {text-align:left;}
.tool[aria-expanded="true"] {border-color:var(--green);background:var(--green-soft);}
.dict-speak {display:inline-block;margin-inline-start:4ch;}
.materials-page {font-size:13px;text-align:left;padding:14px;}
.materials-page h1 {font-size:21px;}
.materials-page .card {padding:10px 12px;margin:8px 0;text-align:left;}
.materials-page .card strong {font-size:13px;line-height:1.5;}
.materials-page .card p {font-size:12px;margin:5px 0;}
.materials-page .download-actions {gap:6px;margin-top:7px;}
.materials-page .download-actions .mini, .materials-page .download-actions .primary {font-size:12px;padding:5px 9px;border-radius:6px;min-height:30px;text-align:left;}
.materials-page .filter-bar {grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:8px;}
.materials-page .filter-bar label, .materials-page select {text-align:left;text-align-last:left;min-width:0;}
.materials-page .filter-bar select {width:100%;font-size:12px;}
.materials-page #material-search {grid-column:1 / -1;font-size:12px;min-width:0;}

/* v70: tools open below the complete toolbar; compact search and assessment. */
#screen-tools > .tool-panel {margin:10px 0 0;}
#tool-panel .sheet-head {margin:0 0 8px;padding:0;min-height:28px;}
#tool-panel .sheet-head h2 {margin:0;}
#tool-panel .answer-line {display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;margin:0;align-items:center;}
#tool-panel .answer-line input {min-width:0;width:100%;margin:0;}
#tool-panel .answer-line button {white-space:nowrap;min-width:54px;flex-shrink:0;text-align:center;}
#tool-panel .query-hint {width:calc(100% - 62px);max-width:100%;min-height:36px;margin:8px auto 0;padding:8px 12px;border:1px solid var(--line);border-radius:8px;background:var(--paper-2);text-align:center;font-size:13px;}
#tool-panel .calc-display, #tool-panel .keypad button, #tool-panel .step-total {text-align:center;}
.exam-heading {display:flex;align-items:center;gap:10px;margin-bottom:10px;}
.exam-heading h2 {font-size:16px;margin:0;white-space:nowrap;}
.exam-heading select {width:88px;min-width:0;}
.exam-heading > span {margin-left:auto;font-size:11px;color:var(--muted);}
.exam-units {position:relative;margin:0 0 12px;}
.exam-units summary {display:block;cursor:pointer;padding:9px 30px 9px 11px;border:1px solid var(--line);border-radius:9px;background:#fff;font-size:12px;list-style:none;}
.exam-units summary::-webkit-details-marker {display:none;}
.exam-units summary::after {content:"▾";position:absolute;right:12px;top:8px;}
.exam-units[open] summary::after {content:"▴";}
.unit-options {position:absolute;z-index:5;top:100%;left:0;right:0;max-height:220px;overflow:auto;background:#fff;border:1px solid var(--line);border-radius:9px;box-shadow:0 5px 14px #0002;padding:6px;}
.unit-options label {display:flex;align-items:center;gap:8px;text-align:left;font-size:12px;padding:8px 6px;cursor:pointer;}
.unit-options input[type="checkbox"] {appearance:auto;width:16px;height:16px;min-height:0;margin:0;flex:0 0 16px;accent-color:var(--green);}

/* 保留题库题干/选项/答案中的换行，避免多行算式或阅读材料被压成一行 */
.grade-question-stem,
.grade-question-options li,
.grade-answer-details p,
.grade-answer-details li,
.qbank-question-text,
.qbank-question-options li,
.qbank-answer,
.qbank-analysis {
  white-space: pre-wrap;
}
#screen-my [data-act="materials-download"] strong { text-align: left; justify-self: start; }
#screen-my [data-act="materials-download"] span { text-align: left; justify-self: start; }

/* 五年级数学题库：题干/选项里的原卷配图 */
.q-stem .qbank-question-image,
.grade-question-stem .qbank-question-image,
.grade-question-options .qbank-question-image,
.opt .qbank-question-image {
  display: block;
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
  margin: 6px 0;
  background: #fff;
}
.opt .qbank-question-image { display: inline-block; max-height: 160px; vertical-align: middle; }
.judge-options { display: flex; gap: 10px; }
.judge-options .opt { width: auto; flex: 1; justify-content: center; }
.bank5-hint { color: var(--muted); font-size: 12px; margin-top: 8px; }

/* 原卷切图：句中的“的/分数/算式”按正文大小；独立图表保持可读并可点开大图 */
.qbank-question-image.inline-img {
  display: inline-block !important;
  height: auto !important;
  width: auto !important;
  max-width: 100% !important;
  max-height: 1.7em !important;
  vertical-align: middle;
  margin: 0 2px !important;
  border: 0 !important;
  background: transparent !important;
}
.qbank-question-image.figure-img {
  display: block !important;
  height: auto !important;
  width: auto !important;
  max-width: 100% !important;
  max-height: 180px !important;
  margin: 6px auto !important;
  background: #fff;
}
.opt .qbank-question-image.figure-img { max-height: 64px !important; margin: 4px auto !important; }
.opt .qbank-question-image.inline-img { max-height: 1.7em !important; }
.grade-question-options .qbank-question-image.figure-img { max-height: 80px !important; margin: 4px 0 !important; }
.bank5-nav { margin-top: 10px; flex-wrap: wrap; }
.bank5-nav button { flex: 1; min-width: 88px; }
.grade-question-options { list-style: none; padding-left: 0; }
.grade-question-options li { display: flex; align-items: flex-start; gap: 8px; }
.grade-question-options li em {
  font-style: normal;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--paper-2);
  display: grid;
  place-items: center;
  font-size: 11px;
  color: var(--muted);
}
