    :root {
      color-scheme: light;
      --bg: #f6f7f9;
      --panel: #ffffff;
      --panel-strong: #fbfcfd;
      --text: #20242a;
      --muted: #626b78;
      --line: #d8dde5;
      --accent: #0f766e;
      --accent-dark: #0b5f59;
      --accent-soft: #193d42;
      --bad: #b42318;
      --good: #087443;
      --header-bg: #1f2933;
      --header-line: #1f2933;
      --correct-bg: #ecfdf5;
      --incorrect-bg: #fef2f2;
      --diff-before-text: #9f1239;
      --diff-before-bg: #fff1f2;
      --diff-before-line: #fecdd3;
      --diff-after-text: #166534;
      --diff-after-bg: #f0fdf4;
      --diff-after-line: #bbf7d0;
      --pre-bg: #f8fafc;
      --favorite-bg: #fff8e1;
      --favorite-line: #f5c542;
      --favorite-text: #8a6d1d;
    }
    body.dark-theme {
      color-scheme: dark;
      --bg: #111724;
      --panel: #1f3140;
      --panel-strong: #24394a;
      --text: #f3f6fa;
      --muted: #9aa7b4;
      --line: #2e4356;
      --header-bg: #001726;
      --header-line: #173044;
      --correct-bg: #123628;
      --incorrect-bg: #3b1f24;
      --diff-before-text: #fecdd3;
      --diff-before-bg: #3b1f24;
      --diff-before-line: #7f1d1d;
      --diff-after-text: #bbf7d0;
      --diff-after-bg: #123628;
      --diff-after-line: #166534;
      --pre-bg: #162534;
      --favorite-bg: #332b16;
      --favorite-line: #f5c542;
      --favorite-text: #f5c542;
    }
    * { box-sizing: border-box; }
    body {
      margin: 0;
      font-family: "Microsoft JhengHei", "Noto Sans TC", system-ui, sans-serif;
      background: var(--bg);
      color: var(--text);
      overflow-x: hidden;
    }
    header {
      position: sticky;
      top: 0;
      z-index: 40;
      min-height: 30px;
      padding: 4px 16px;
      background: var(--header-bg);
      color: white;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      border-bottom: 1px solid var(--header-line);
    }
    h1 {
      margin: 0;
      font-size: 18px;
      font-weight: 700;
      letter-spacing: 0;
    }
    main {
      max-width: 1040px;
      margin: 0 auto;
      padding: 24px;
    }
    footer {
      max-width: 1040px;
      margin: 0 auto;
      padding: 0 24px 24px;
      color: var(--muted);
      font-size: 14px;
      text-align: center;
    }
    .tabs {
      display: flex;
      gap: 8px;
      margin-bottom: 18px;
      flex-wrap: wrap;
    }
    button, input, select {
      font: inherit;
    }
    button {
      border: 1px solid var(--line);
      background: var(--panel);
      color: var(--text);
      border-radius: 6px;
      padding: 10px 14px;
      cursor: pointer;
      min-height: 42px;
      touch-action: manipulation;
    }
    button.primary, .tabs button.active {
      background: var(--accent);
      border-color: var(--accent);
      color: white;
    }
    .button-link {
      min-height: 42px;
      padding: 10px 14px;
      border: 1px solid var(--line);
      border-radius: 6px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      color: var(--text);
      background: var(--panel);
      text-decoration: none;
    }
    .button-link:hover {
      border-color: var(--accent);
    }
    button.primary:hover, .tabs button.active:hover {
      background: var(--accent-dark);
    }
    button:disabled {
      opacity: .55;
      cursor: not-allowed;
    }
    .panel {
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 20px;
      margin-bottom: 18px;
    }
    .row {
      display: flex;
      gap: 12px;
      align-items: center;
      flex-wrap: wrap;
    }
    .field {
      display: grid;
      gap: 6px;
      min-width: 160px;
    }
    label {
      color: var(--muted);
      font-size: 14px;
    }
    input[type="number"] {
      width: 120px;
      border: 1px solid var(--line);
      border-radius: 6px;
      padding: 9px 10px;
    }
    .check-field {
      display: flex;
      align-items: center;
      gap: 8px;
      min-height: 40px;
      color: var(--muted);
      font-size: 14px;
    }
    .check-field input {
      width: 18px;
      height: 18px;
      accent-color: var(--accent);
    }
    .segmented {
      display: inline-flex;
      border: 1px solid var(--line);
      border-radius: 6px;
      overflow: hidden;
      background: var(--panel);
    }
    .segmented label {
      color: var(--text);
      cursor: pointer;
      min-height: 40px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 0 14px;
      border-right: 1px solid var(--line);
      user-select: none;
    }
    .segmented label:last-child {
      border-right: 0;
    }
    .segmented input {
      position: absolute;
      opacity: 0;
      pointer-events: none;
    }
    .segmented label:has(input:checked) {
      background: var(--accent);
      color: white;
    }
    .question {
      font-size: 18px;
      line-height: 1.65;
      margin: 0 0 16px;
      white-space: pre-wrap;
    }
    .meta {
      color: var(--muted);
      font-size: 14px;
      margin-bottom: 12px;
    }
    .question-meta {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }
    .question-meta-text {
      min-width: 0;
    }
    .question-title-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 8px;
    }
    .question-title-row h2 {
      min-width: 0;
      margin: 0;
    }
    .question-actions {
      display: inline-flex;
      align-items: center;
      justify-content: flex-end;
      gap: 6px;
      flex: 0 0 auto;
    }
    .icon-action {
      width: 30px;
      min-height: 30px;
      height: 30px;
      padding: 0;
      border-radius: 50%;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: 16px;
      line-height: 1;
      color: var(--muted);
      background: transparent;
    }
    .icon-action:hover {
      border-color: var(--accent);
      color: var(--accent);
      background: var(--panel-strong);
    }
    .report-button {
      font-weight: 800;
    }
    .edit-button {
      font-size: 15px;
    }
    .small-report-button {
      flex: 0 0 auto;
      min-height: 28px;
      padding: 4px 9px;
      font-size: 12px;
    }
    .option {
      width: 100%;
      text-align: left;
      display: flex;
      align-items: flex-start;
      gap: 12px;
      margin: 8px 0;
      line-height: 1.5;
      min-height: 48px;
    }
    .option-image {
      display: block;
      max-width: min(100%, 360px);
      max-height: 140px;
      object-fit: contain;
    }
    .option-line {
      display: flex;
      align-items: flex-start;
      gap: 10px;
      margin: 8px 0;
      min-width: 0;
    }
    .option.selected {
      border-color: var(--accent);
      outline: 2px solid rgba(15, 118, 110, .2);
    }
    .option.correct {
      border-color: var(--good);
      background: var(--correct-bg);
    }
    .option.incorrect {
      border-color: var(--bad);
      background: var(--incorrect-bg);
    }
    .result.good { color: var(--good); font-weight: 700; }
    .result.bad { color: var(--bad); font-weight: 700; }
    .quiz-page-actions {
      justify-content: space-between;
      margin-top: 16px;
    }
    .quiz-question {
      border-top: 1px solid var(--line);
      padding: 18px 0;
    }
    .quiz-question:first-child {
      border-top: 0;
      padding-top: 0;
    }
    .quiz-question .result {
      margin: 10px 0 0;
      white-space: pre-wrap;
    }
    .image {
      max-width: min(100%, 680px);
      width: auto;
      max-height: 420px;
      border: 1px solid var(--line);
      border-radius: 6px;
      margin: 8px 0 16px;
      display: block;
      object-fit: contain;
      background: #fff;
    }
    details {
      margin: 8px 0 16px;
      color: var(--muted);
    }
    summary {
      cursor: pointer;
      width: fit-content;
      padding: 6px 0;
    }
    .exam-output {
      width: 100%;
      min-height: 360px;
      resize: vertical;
      border: 1px solid var(--line);
      border-radius: 6px;
      padding: 12px;
      line-height: 1.55;
      white-space: pre;
    }
    .hidden { display: none; }
    .summary {
      color: var(--muted);
      font-size: 15px;
    }
    .error-page {
      min-height: 100vh;
      display: grid;
      align-items: center;
    }
    .error-card {
      max-width: 520px;
      margin: 24px auto;
      text-align: center;
    }
    .error-code {
      color: var(--accent);
      font-size: 14px;
      font-weight: 800;
      letter-spacing: .08em;
      text-transform: uppercase;
    }
    .error-card h1,
    .error-card h2 {
      margin: 8px 0 10px;
      font-size: 28px;
      letter-spacing: 0;
    }
    .error-actions {
      display: flex;
      justify-content: center;
      gap: 10px;
      margin-top: 18px;
      flex-wrap: wrap;
    }
    .modal-backdrop {
      position: fixed;
      inset: 0;
      z-index: 50;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 20px;
      background: rgba(15, 23, 42, .45);
    }
    .modal-backdrop.hidden {
      display: none;
    }
    .modal-panel {
      width: min(100%, 420px);
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 18px;
      background: var(--panel);
      box-shadow: 0 18px 44px rgba(0, 0, 0, .22);
    }
    .modal-heading {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 14px;
    }
    .modal-heading h2 {
      margin: 0;
      font-size: 20px;
    }
    .modal-fields {
      display: grid;
      gap: 12px;
    }
    .modal-field-row {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 12px;
    }
    .modal-fields .field,
    .modal-fields input {
      width: 100%;
    }
    .modal-fields .segmented {
      width: 100%;
    }
    .modal-fields .segmented label {
      flex: 1 1 0;
    }
    .toggle-row {
      width: 100%;
      min-height: 44px;
      padding: 0 14px;
      border: 1px solid var(--line);
      border-radius: 6px;
      position: relative;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      color: var(--text);
      background: var(--panel);
      cursor: pointer;
      user-select: none;
    }
    .toggle-row:hover {
      border-color: var(--accent);
    }
    .toggle-row input {
      position: absolute;
      opacity: 0;
      pointer-events: none;
    }
    .toggle-row span {
      display: flex;
      align-items: center;
      justify-content: space-between;
      width: 100%;
      font-weight: 700;
    }
    .toggle-row span::after {
      content: "";
      width: 38px;
      height: 22px;
      border-radius: 999px;
      background: var(--line);
      box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
      transition: background .15s ease;
    }
    .toggle-row span::before {
      content: "";
      position: absolute;
      right: 30px;
      width: 18px;
      height: 18px;
      border-radius: 50%;
      background: white;
      box-shadow: 0 1px 3px rgba(0, 0, 0, .22);
      transition: transform .15s ease;
      z-index: 1;
    }
    .toggle-row:has(input:checked) {
      border-color: var(--accent);
      background: var(--panel-strong);
    }
    .toggle-row:has(input:checked) span::after {
      background: var(--accent);
    }
    .toggle-row:has(input:checked) span::before {
      transform: translateX(16px);
    }
    .modal-actions {
      display: flex;
      justify-content: flex-end;
      gap: 10px;
      margin-top: 16px;
    }
    .modal-copy {
      margin: 0 0 14px;
      line-height: 1.65;
      color: var(--muted);
    }
    .modal-check {
      width: 100%;
      justify-content: flex-start;
    }
    .update-modal {
      width: min(100%, 480px);
      max-height: 60vh;
      display: flex;
      flex-direction: column;
    }
    .update-modal .modal-heading,
    .update-modal .modal-actions {
      flex: 0 0 auto;
    }
    .update-date {
      margin: 0 0 4px;
      color: var(--accent);
      font-size: 14px;
      font-weight: 800;
    }
    .update-list {
      display: grid;
      gap: 10px;
      margin: 0;
      padding-left: 22px;
      color: var(--text);
      line-height: 1.6;
      flex: 1 1 auto;
      min-height: 0;
      overflow-y: auto;
      overscroll-behavior: contain;
      padding-right: 4px;
    }
    .update-list li::marker {
      color: var(--accent);
      font-weight: 800;
    }
    .update-modal .modal-actions {
      justify-content: stretch;
    }
    .update-modal .modal-actions button {
      width: 100%;
    }
    .auth-card {
      max-width: 420px;
      margin: 24px auto;
    }
    .auth-card input, .admin-form input {
      width: 100%;
    }
    .admin-user-form {
      display: grid;
      gap: 12px;
    }
    .admin-user-form-row {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 12px;
      align-items: end;
    }
    .admin-user-form-row .field {
      min-width: 0;
      width: 100%;
    }
    .admin-section {
      padding-top: 18px;
      margin-top: 18px;
      border-top: 1px solid var(--line);
    }
    .admin-section.first {
      padding-top: 0;
      margin-top: 0;
      border-top: 0;
    }
    .profile-summary {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 12px;
      margin-top: 12px;
    }
    .profile-summary > div {
      display: grid;
      gap: 4px;
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 12px;
      background: var(--panel-strong);
      min-width: 0;
    }
    .profile-summary strong {
      overflow-wrap: anywhere;
    }
    .diagnostics-grid {
      margin-bottom: 16px;
    }
    .diagnostics-section {
      margin-top: 16px;
    }
    .status-badge {
      display: inline-flex;
      align-items: center;
      min-height: 24px;
      padding: 2px 8px;
      border-radius: 6px;
      font-size: 0.92rem;
      font-weight: 700;
      border: 1px solid var(--line);
    }
    .status-badge.good {
      color: var(--good);
      background: var(--good-soft);
    }
    .status-badge.bad {
      color: var(--bad);
      background: var(--bad-soft);
    }
    .header-actions {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
      justify-content: flex-end;
      font-size: 13px;
    }
    .header-actions button {
      min-height: 26px;
      padding: 3px 8px;
      font-size: 13px;
    }
    .stats-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
      gap: 12px;
      margin: 12px 0 16px;
    }
    .records-stats {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .stat-box {
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 12px;
      background: var(--panel-strong);
    }
    .stat-value {
      font-size: 24px;
      font-weight: 700;
      margin-top: 4px;
    }
    .record-actions {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      margin: 10px 0 16px;
    }
    .record-paged-section,
    .frequent-wrong-section {
      margin-top: 20px;
    }
    .record-paged-section summary,
    .frequent-wrong-section summary {
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      min-height: 40px;
      padding: 0 14px;
      border: 1px solid var(--line);
      border-radius: 6px;
      background: var(--panel);
      color: var(--text);
      font-weight: 700;
      user-select: none;
    }
    .record-paged-section summary:hover,
    .frequent-wrong-section summary:hover {
      border-color: var(--accent);
      background: var(--panel-strong);
    }
    .exam-card-list {
      display: grid;
      gap: 12px;
      margin-top: 12px;
    }
    .exam-card {
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--panel);
      box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
      overflow: hidden;
    }
    .exam-card-button {
      width: 100%;
      min-height: 0;
      padding: 14px 18px;
      border: 0;
      border-radius: 0;
      background: transparent;
      color: var(--text);
      display: grid;
      gap: 4px;
      text-align: left;
    }
    .exam-card-button:hover {
      background: var(--panel-strong);
    }
    .exam-card-head {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: 14px;
      color: var(--text);
    }
    .exam-card-time {
      font-size: 22px;
      font-weight: 800;
      line-height: 1.2;
      min-width: 0;
    }
    .exam-card-meta {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 14px;
      color: var(--accent);
      font-size: 16px;
      font-weight: 800;
    }
    .exam-card-score {
      display: grid;
      gap: 2px;
      text-align: right;
      white-space: nowrap;
    }
    .exam-card-count-line,
    .exam-card-score-line {
      display: grid;
      grid-template-columns: auto minmax(4ch, auto) auto;
      justify-content: end;
      align-items: baseline;
    }
    .exam-card-count-line {
      grid-template-columns: minmax(3ch, auto) auto minmax(3ch, auto);
    }
    .exam-card-count-value,
    .exam-card-score-value {
      text-align: left;
      font-variant-numeric: tabular-nums;
    }
    .exam-card-detail {
      border-top: 1px solid var(--line);
      padding: 12px 16px 16px;
      background: var(--panel-strong);
    }
    #recordsPanel.record-detail-open > h2,
    #recordsPanel.record-detail-open > button.primary {
      display: none;
    }
    .exam-session-view {
      display: grid;
      gap: 12px;
      margin-top: 0;
    }
    .exam-session-toolbar {
      display: grid;
      grid-template-columns: auto minmax(0, 1fr);
      align-items: center;
      gap: 14px;
      padding: 2px 0 10px;
      border-bottom: 1px solid var(--line);
    }
    .exam-session-toolbar button {
      width: auto;
      min-width: 88px;
      background: var(--bad);
      border-color: var(--bad);
    }
    .exam-session-title {
      min-width: 0;
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: 12px;
    }
    .exam-session-title h3 {
      margin: 0;
      color: var(--accent);
      font-size: 22px;
      line-height: 1.25;
      overflow-wrap: anywhere;
    }
    .exam-session-time {
      color: var(--accent-soft);
      font-size: 20px;
      font-weight: 800;
      white-space: nowrap;
    }
    .exam-session-body {
      min-width: 0;
    }
    .exam-detail-summary {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin: 0 -16px 12px;
      padding: 10px 16px;
      color: var(--accent);
      background: var(--panel);
      border-bottom: 1px solid var(--line);
      font-size: 17px;
      font-weight: 800;
    }
    .exam-detail-summary strong {
      color: var(--good);
      font-weight: 900;
    }
    .exam-session-summary {
      margin: 0;
      border: 1px solid var(--line);
      border-radius: 8px;
    }
    .exam-attempt-list {
      display: grid;
      gap: 12px;
    }
    .exam-attempt-card {
      position: relative;
      min-height: 132px;
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 16px 58px 16px 16px;
      background: var(--panel);
      box-shadow: 0 5px 14px rgba(0, 0, 0, .1);
      overflow: hidden;
    }
    .exam-attempt-card.correct {
      border-left: 5px solid var(--good);
    }
    .exam-attempt-card.incorrect {
      border-color: rgba(180, 35, 24, .32);
      border-left: 5px solid var(--bad);
      background: var(--incorrect-bg);
    }
    .exam-attempt-content {
      min-width: 0;
    }
    .exam-attempt-title-row {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 8px;
    }
    .exam-attempt-title-row h4 {
      margin: 0;
      color: var(--muted);
      font-size: 17px;
      line-height: 1.35;
      letter-spacing: 0;
    }
    .exam-attempt-actions {
      flex: 0 0 auto;
    }
    .exam-attempt-question {
      margin: 0 0 10px;
      color: var(--text);
      font-size: 18px;
      font-weight: 800;
      line-height: 1.65;
      white-space: pre-wrap;
      overflow-wrap: anywhere;
    }
    .exam-attempt-image {
      max-height: 260px;
      margin-bottom: 10px;
    }
    .exam-attempt-options {
      display: grid;
      gap: 6px;
      margin: 0 0 12px;
      font-size: 16px;
      line-height: 1.5;
    }
    .exam-attempt-option {
      display: flex;
      align-items: flex-start;
      gap: 8px;
      min-width: 0;
      overflow-wrap: anywhere;
    }
    .exam-attempt-option strong {
      flex: 0 0 auto;
    }
    .exam-attempt-answers {
      display: grid;
      gap: 4px;
      color: var(--text);
      font-size: 17px;
      font-weight: 800;
      line-height: 1.45;
    }
    .exam-attempt-correct-answer {
      color: var(--accent);
    }
    .exam-attempt-mark {
      position: absolute;
      right: 16px;
      top: 50%;
      transform: translateY(-50%);
      width: 34px;
      height: 34px;
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--good);
      font-size: 40px;
      font-weight: 900;
      line-height: 1;
    }
    .exam-attempt-card.incorrect .exam-attempt-mark {
      color: var(--bad);
      font-size: 48px;
    }
    table {
      width: 100%;
      border-collapse: collapse;
      margin-top: 12px;
    }
    th, td {
      border-bottom: 1px solid var(--line);
      padding: 9px 8px;
      text-align: left;
      vertical-align: top;
      overflow-wrap: anywhere;
    }
    th {
      color: var(--muted);
      font-weight: 700;
      font-size: 14px;
    }
    tr.correct-row td:first-child {
      border-left: 4px solid var(--good);
    }
    tr.incorrect-row td:first-child {
      border-left: 4px solid var(--bad);
    }
    .result-dot {
      display: inline-block;
      width: 10px;
      height: 10px;
      border-radius: 50%;
      margin-right: 8px;
      vertical-align: middle;
    }
    .result-dot.correct {
      background: var(--good);
    }
    .result-dot.incorrect {
      background: var(--bad);
    }
    .exam-detail-row td {
      background: var(--panel-strong);
      padding: 12px;
    }
    .question-item {
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 16px;
      margin-bottom: 14px;
      background: var(--panel);
      box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
    }
    .question-item:first-of-type {
      padding-top: 16px;
    }
    .question-item h2 {
      font-size: 17px;
      margin: 0 0 8px;
      line-height: 1.5;
      letter-spacing: 0;
    }
    .question-item .question-title-row h2 {
      margin: 0;
    }
    .answer-line {
      color: var(--good);
      font-weight: 700;
      margin-top: 8px;
    }
    input[type="text"], input[type="password"], select, textarea {
      border: 1px solid var(--line);
      border-radius: 6px;
      padding: 9px 10px;
      min-height: 40px;
    }
    textarea {
      width: 100%;
      resize: vertical;
      min-height: 78px;
      line-height: 1.5;
    }
    .report-box {
      border-top: 1px solid var(--line);
      margin-top: 14px;
      padding-top: 14px;
    }
    .report-form-field {
      width: 100%;
    }
    .report-form-field textarea {
      min-height: 180px;
    }
    .report-status {
      margin: 8px 0 0;
      color: var(--muted);
      white-space: pre-wrap;
    }
    .resolved-reports {
      margin-top: 16px;
    }
    .resolved-reports summary {
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      min-height: 40px;
      padding: 0 14px;
      border: 1px solid var(--line);
      border-radius: 6px;
      background: var(--panel);
      color: var(--text);
      font-weight: 700;
      user-select: none;
    }
    .resolved-reports summary:hover {
      border-color: var(--accent);
    }
    .admin-editor {
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 12px;
      margin-top: 12px;
      background: var(--panel-strong);
    }
    .admin-editor .option-edit {
      display: grid;
      grid-template-columns: 42px minmax(0, 1fr) minmax(0, 220px) auto;
      gap: 8px;
      align-items: start;
      margin-bottom: 8px;
    }
    .image-path-row {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 8px;
      align-items: center;
    }
    .admin-editor .answer-checks {
      display: flex;
      gap: 12px;
      flex-wrap: wrap;
      margin: 8px 0 12px;
    }
    .editor-actions {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
      margin-top: 10px;
    }
    .edit-log-detail {
      margin-top: 8px;
    }
    .edit-log-detail h4 {
      margin: 0 0 6px;
      font-size: 14px;
    }
    .edit-log-diff {
      width: 100%;
      table-layout: fixed;
    }
    .edit-log-diff code {
      font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
      font-size: 13px;
    }
    .diff-before,
    .diff-after {
      padding: 8px;
      border-radius: 6px;
      white-space: pre-wrap;
      word-break: break-word;
      font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
      font-size: 13px;
      line-height: 1.45;
    }
    .diff-before {
      color: var(--diff-before-text);
      background: var(--diff-before-bg);
      border: 1px solid var(--diff-before-line);
    }
    .diff-after {
      color: var(--diff-after-text);
      background: var(--diff-after-bg);
      border: 1px solid var(--diff-after-line);
    }
    .edit-log-raw {
      margin-top: 12px;
    }
    .edit-log-raw-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 12px;
      margin-top: 8px;
    }
    .edit-log-detail pre {
      margin: 0;
      padding: 10px;
      max-height: 280px;
      overflow: auto;
      border: 1px solid var(--line);
      border-radius: 6px;
      background: var(--pre-bg);
      white-space: pre-wrap;
      word-break: break-word;
      font-size: 13px;
      line-height: 1.45;
    }
    .header-title {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      min-width: 0;
    }
    .theme-toggle {
      width: 28px;
      min-height: 24px;
      height: 24px;
      padding: 0;
      border-radius: 50%;
      color: white;
      border-color: rgba(255, 255, 255, .28);
      background: rgba(255, 255, 255, .08);
      font-size: 15px;
      line-height: 1;
    }
    .home-menu {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
      gap: 14px;
      margin: 18px 0 18px;
    }
    .home-section-title {
      margin: 6px 0 0;
      color: var(--muted);
      font-size: 20px;
      font-weight: 800;
    }
    .menu-card {
      width: 100%;
      min-height: 56px;
      padding: 10px 14px;
      border-radius: 8px;
      background: var(--panel);
      border: 1px solid var(--line);
      display: flex;
      align-items: center;
      gap: 12px;
      text-align: left;
      box-shadow: 0 5px 12px rgba(0, 0, 0, .12);
    }
    .menu-card:hover {
      background: var(--panel-strong);
      border-color: var(--accent);
    }
    .menu-card-icon {
      width: 32px;
      flex: 0 0 32px;
      text-align: center;
      font-size: 24px;
      line-height: 1;
    }
    .menu-card-text {
      font-size: 18px;
      font-weight: 800;
      line-height: 1.2;
    }
    .menu-card-count {
      margin-left: auto;
      color: var(--muted);
      font-size: 14px;
      font-weight: 700;
      white-space: nowrap;
    }
    .manual-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 14px;
      margin-top: 14px;
    }
    .manual-block {
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 16px;
      background: var(--panel-strong);
      min-width: 0;
    }
    .manual-block h3 {
      margin: 0 0 10px;
      color: var(--accent);
      font-size: 18px;
      letter-spacing: 0;
    }
    .manual-block ul {
      display: grid;
      gap: 8px;
      margin: 0;
      padding-left: 22px;
      line-height: 1.6;
    }
    .manual-block li {
      overflow-wrap: anywhere;
    }
    .question-toolbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 10px;
    }
    .question-toolbar h2 {
      margin: 0;
    }
    .title-actions,
    .section-title-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      min-width: 0;
    }
    .title-actions {
      flex: 0 0 auto;
      flex-wrap: wrap;
      justify-content: flex-end;
    }
    .section-title-row {
      margin-top: 24px;
    }
    .section-title-row.first {
      margin-top: 0;
    }
    .section-title-row h2,
    .section-title-row h3 {
      min-width: 0;
      margin: 0;
      overflow-wrap: anywhere;
    }
    .section-title-row h3 {
      font-size: 18px;
      letter-spacing: 0;
    }
    .section-title-row button {
      flex: 0 0 auto;
    }
    .favorite-button.active {
      border-color: var(--favorite-line);
      color: var(--favorite-text);
      background: var(--favorite-bg);
    }
    @media (max-width: 640px) {
      header {
        min-height: 30px;
        padding: 4px 10px;
        gap: 8px;
      }
      h1 { font-size: 16px; }
      main { padding: 8px 10px; }
      footer {
        padding: 0 10px 14px;
        font-size: 12px;
        line-height: 1.45;
      }
      button {
        min-height: 38px;
        padding: 8px 10px;
      }
      .button-link {
        min-height: 38px;
        padding: 8px 10px;
      }
      .panel {
        border-left: 0;
        border-right: 0;
        border-radius: 0;
        margin-left: -10px;
        margin-right: -10px;
        margin-bottom: 10px;
        padding: 12px 10px;
      }
      .tabs {
        gap: 6px;
        margin: 0 -10px 10px;
        padding: 0 10px 3px;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
      }
      .tabs button {
        width: auto;
        flex: 0 0 auto;
        white-space: nowrap;
      }
      .header-actions {
        width: auto;
        justify-content: flex-start;
        gap: 5px;
        font-size: 12px;
      }
      .home-menu {
        grid-template-columns: 1fr;
        gap: 8px;
        margin: 10px 0 12px;
      }
      .home-section-title {
        margin-top: 2px;
        font-size: 18px;
      }
      .menu-card {
        min-height: 44px;
        padding: 7px 10px;
        gap: 9px;
        box-shadow: 0 3px 8px rgba(0, 0, 0, .12);
      }
      .menu-card-icon {
        width: 26px;
        flex-basis: 26px;
        font-size: 22px;
      }
      .menu-card-text {
        font-size: 16px;
      }
      .menu-card-count {
        display: none;
      }
      .manual-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-top: 10px;
      }
      .manual-block {
        padding: 12px;
      }
      .manual-block h3 {
        font-size: 16px;
        margin-bottom: 8px;
      }
      .manual-block ul {
        gap: 6px;
        padding-left: 20px;
        line-height: 1.55;
      }
      .modal-backdrop {
        align-items: center;
        padding: 10px;
      }
      .modal-panel {
        padding: 14px;
      }
      .modal-heading {
        margin-bottom: 10px;
      }
      .modal-heading h2 {
        font-size: 18px;
      }
      .modal-fields {
        gap: 9px;
      }
      .toggle-row {
        min-height: 38px;
        padding: 0 10px;
      }
      .toggle-row span::before {
        right: 26px;
      }
      .modal-copy {
        margin-bottom: 10px;
        line-height: 1.55;
      }
      .update-list {
        gap: 8px;
        padding-left: 20px;
        line-height: 1.5;
      }
      .update-modal .modal-actions {
        grid-template-columns: 1fr;
      }
      .modal-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-top: 12px;
      }
      .modal-field-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
      }
      .header-actions button {
        width: auto;
      }
      .row {
        align-items: stretch;
        gap: 8px;
      }
      .field {
        gap: 4px;
        min-width: 0;
        width: 100%;
        flex: 1 1 100%;
      }
      label,
      .check-field,
      .meta {
        font-size: 13px;
      }
      .check-field {
        min-height: 34px;
        gap: 6px;
      }
      .check-field input {
        width: 17px;
        height: 17px;
      }
      .question-toolbar {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 8px;
        margin-bottom: 8px;
      }
      .question-toolbar h2 {
        min-width: 0;
        overflow-wrap: anywhere;
      }
      .question-toolbar button {
        width: auto;
        max-width: 42vw;
        padding: 8px 10px;
        white-space: nowrap;
      }
      .title-actions {
        gap: 6px;
      }
      .title-actions button,
      .section-title-row button {
        width: auto;
        max-width: 42vw;
        padding: 8px 10px;
        white-space: nowrap;
      }
      .section-title-row {
        gap: 8px;
        margin-top: 18px;
      }
      .range-row,
      .modal-field-row,
      .page-nav-row,
      .action-grid,
      .quiz-page-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
      .range-row .field,
      .modal-field-row .field,
      .browse-filter-row .field {
        width: auto;
        flex: initial;
      }
      .browse-filter-row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
      .browse-filter-row .field:nth-child(1),
      .browse-filter-row .field:nth-child(2) {
        grid-column: 1 / -1;
      }
      .page-nav-row button:nth-child(3) {
        grid-column: 1 / -1;
      }
      .page-nav-row button:nth-child(1),
      .page-nav-row button:nth-child(2) {
        grid-column: auto;
      }
      .quiz-page-actions button:first-child,
      .quiz-page-actions button:nth-child(2) {
        grid-column: auto;
      }
      .quiz-page-actions button.primary,
      #submitQuizBottom {
        grid-column: 1 / -1;
      }
      input[type="number"],
      input[type="text"],
      input[type="password"],
      select,
      textarea {
        width: 100%;
        font-size: 16px;
        min-height: 38px;
        padding: 7px 9px;
      }
      button { width: 100%; }
      .button-link {
        width: 100%;
      }
      .error-page {
        min-height: calc(100vh - 24px);
      }
      .error-card h1,
      .error-card h2 {
        font-size: 24px;
      }
      .error-actions {
        display: grid;
        grid-template-columns: 1fr;
      }
      .question {
        font-size: 16px;
        line-height: 1.55;
        margin-bottom: 10px;
      }
      .question-meta {
        align-items: center;
      }
      .question-title-row {
        align-items: flex-start;
      }
      .small-report-button {
        width: auto;
      }
      .option {
        gap: 8px;
        min-height: 40px;
        margin: 6px 0;
        padding: 8px 10px;
        line-height: 1.45;
      }
      .quiz-question {
        padding: 12px 0;
      }
      .question-item {
        padding: 12px;
        margin-bottom: 10px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
      }
      .question-item:first-of-type {
        padding-top: 12px;
      }
      .question-item h2 {
        font-size: 16px;
        margin-bottom: 6px;
        line-height: 1.4;
      }
      .question-actions {
        gap: 4px;
      }
      .icon-action {
        width: 28px;
        min-height: 28px;
        height: 28px;
      }
      .summary {
        font-size: 13px;
      }
      .option span:last-child,
      .option-line span:last-child {
        min-width: 0;
        overflow-wrap: anywhere;
      }
      .option-image {
        max-width: 100%;
        max-height: 220px;
      }
      .image {
        width: 100%;
        max-height: none;
      }
      .quiz-page-actions {
        justify-content: stretch;
      }
      .segmented {
        display: grid;
        width: 100%;
      }
      .segmented label {
        min-height: 36px;
        padding: 0 10px;
        justify-content: flex-start;
        border-right: 0;
        border-bottom: 1px solid var(--line);
      }
      .segmented label:last-child {
        border-bottom: 0;
      }
      table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
      }
      th, td {
        white-space: normal;
        min-width: 88px;
      }
      .stats-grid { grid-template-columns: 1fr; }
      .profile-summary { grid-template-columns: 1fr; }
      .admin-user-form {
        gap: 8px;
      }
      .admin-user-form-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
      }
      .records-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .stat-box {
        padding: 9px;
      }
      .stat-value {
        font-size: 20px;
      }
      .exam-card-button {
        padding: 10px 12px;
      }
      .exam-card-time {
        font-size: 18px;
      }
      .exam-card-detail {
        padding: 10px 12px 12px;
      }
      .exam-session-view {
        gap: 10px;
      }
      .exam-session-toolbar {
        grid-template-columns: 88px minmax(0, 1fr);
        gap: 10px;
        padding-bottom: 8px;
      }
      .exam-session-toolbar button {
        min-width: 0;
        width: 100%;
      }
      .exam-session-title {
        display: grid;
        gap: 2px;
      }
      .exam-session-title h3 {
        font-size: 18px;
      }
      .exam-session-time {
        font-size: 16px;
        white-space: normal;
      }
      .exam-detail-summary {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        margin: 0 -12px 10px;
        padding: 8px 12px;
        font-size: 15px;
      }
      .exam-session-summary {
        margin: 0;
      }
      .exam-attempt-list {
        gap: 10px;
      }
      .exam-attempt-card {
        min-height: 118px;
        padding: 12px 44px 12px 12px;
        box-shadow: 0 3px 10px rgba(0, 0, 0, .1);
      }
      .exam-attempt-title-row {
        gap: 8px;
        margin-bottom: 6px;
      }
      .exam-attempt-title-row h4 {
        font-size: 15px;
      }
      .exam-attempt-question {
        font-size: 16px;
        line-height: 1.55;
        margin-bottom: 8px;
      }
      .exam-attempt-options {
        gap: 5px;
        margin-bottom: 10px;
        font-size: 15px;
      }
      .exam-attempt-answers {
        font-size: 15px;
      }
      .exam-attempt-actions .icon-action {
        width: 28px;
      }
      .exam-attempt-mark {
        right: 10px;
        width: 28px;
        height: 28px;
        font-size: 34px;
      }
      .exam-attempt-card.incorrect .exam-attempt-mark {
        font-size: 40px;
      }
      .exam-card-head {
        align-items: flex-start;
      }
      .exam-card-meta {
        align-items: flex-start;
        flex-direction: column;
        gap: 2px;
      }
      .exam-card-score {
        text-align: left;
      }
      .exam-card-count-line,
      .exam-card-score-line {
        justify-content: start;
      }
      .admin-editor .option-edit { grid-template-columns: 1fr; }
      .image-path-row { grid-template-columns: 1fr; }
      .edit-log-raw-grid { grid-template-columns: 1fr; }
    }
