
    :root {
      --bg: #EEF2F7;
      --bg-gradient: linear-gradient(180deg, #F7F9FC 0%, #E9EEF5 100%);
      --card: #FFFFFF;
      --card-border: #E4E9F0;
      --primary: #2563EB;
      --primary-glow: rgba(37, 99, 235, 0.16);
      --secondary: #1D4ED8;
      --secondary-glow: rgba(37, 99, 235, 0.16);
      --accent: #2563EB;
      --danger: #EF4444;
      --success: #16A34A;
      --warning: #D97706;
      --text: #1F2937;
      --text-secondary: #6B7280;
      --border: #E4E9F0;
      --safe-bottom: env(safe-area-inset-bottom, 0px);
      --safe-top: env(safe-area-inset-top, 0px);
    }

    * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

    html, body {
      margin: 0;
      padding: 0;
      height: 100%;
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
      background: var(--bg);
      background-image: var(--bg-gradient);
      color: var(--text);
      overscroll-behavior: none;
    }

    #app {
      height: 100%;
      display: flex;
      flex-direction: column;
      position: relative;
    }

    /* Header */
    .header {
      position: sticky;
      top: 0;
      z-index: 20;
      display: flex;
      align-items: center;
      gap: 10px;
      padding: calc(11px + var(--safe-top)) 14px 11px;
      flex-shrink: 0;
      background: linear-gradient(135deg, #2B5F9E 0%, #234E80 100%);
    }

    .header h1 {
      margin: 0;
      flex: 1;
      min-width: 0;
      font-size: 1.2rem;
      font-weight: 700;
      letter-spacing: 0.5px;
      color: #FFFFFF;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .current-class-bar {
      display: flex;
      align-items: center;
      gap: 6px;
      flex-shrink: 0;
      background: rgba(255, 255, 255, 0.16);
      border: 1px solid rgba(255, 255, 255, 0.28);
      border-radius: 18px;
      padding: 5px 6px 5px 13px;
    }

    .current-class-label {
      font-size: 0.92rem;
      font-weight: 600;
      color: #fff;
    }

    .class-switch-btn {
      padding: 5px 11px;
      border-radius: 14px;
      border: none;
      background: #FFFFFF;
      color: #234E80;
      font-size: 0.82rem;
      font-weight: 600;
      cursor: pointer;
      transition: opacity 0.15s;
      white-space: nowrap;
    }

    .class-switch-btn:active {
      opacity: 0.8;
    }

    /* Main content */
    .main, #view {
      flex: 1;
      overflow-y: auto;
      padding: 16px 20px;
      padding-bottom: calc(130px + var(--safe-bottom));
    }
    #view { padding-bottom: calc(20px + var(--safe-bottom)); }

    .page { display: none; }
    .page.active { display: block; }

    /* Card */
    .card {
      background: var(--card);
      border: 1px solid var(--card-border);
      border-radius: 24px;
      padding: 24px;
      box-shadow: 0 8px 32px rgba(16, 24, 40, 0.4);
      margin-bottom: 16px;
      backdrop-filter: blur(16px);
    }

    /* Call page */
    .call-stage {
      min-height: 320px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      text-align: center;
    }

    .call-hint {
      color: var(--text-secondary);
      font-size: 1rem;
      margin-bottom: 12px;
      letter-spacing: 1px;
    }

    .call-name {
      font-size: clamp(3.2rem, 16vw, 6rem);
      font-weight: 800;
      color: var(--text);
      line-height: 1.1;
      margin: 20px 0;
      word-break: keep-all;
      min-height: 1.4em;
      text-shadow: 0 0 40px var(--primary-glow);
    }

    .call-name.placeholder {
      color: rgba(148, 163, 184, 0.25);
      text-shadow: none;
    }

    .call-status {
      font-size: 1rem;
      color: var(--text-secondary);
      margin-bottom: 28px;
    }

    .call-status span {
      color: var(--primary);
      font-weight: 700;
    }

    .btn {
      width: 100%;
      padding: 17px 24px;
      border: none;
      border-radius: 18px;
      font-size: 1.15rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      letter-spacing: 0.5px;
    }

    .btn:active { transform: scale(0.97); }

    .btn-primary {
      background: var(--primary);
      color: #fff;
      box-shadow: 0 4px 14px rgba(37, 99, 235, 0.22);
    }

    .btn-primary:disabled {
      background: #E5E7EB;
      box-shadow: none;
      cursor: not-allowed;
      color: #9CA3AF;
    }

    .btn-secondary {
      background: transparent;
      color: var(--text);
      border: 1px solid var(--border);
      margin-top: 12px;
    }

    .btn-secondary:active {
      background: rgba(148, 163, 184, 0.1);
    }

    .btn-danger {
      background: transparent;
      color: var(--danger);
      border: 1px solid rgba(244, 63, 94, 0.3);
      margin-top: 12px;
    }

    .btn-success {
      background: var(--success);
      color: #fff;
      box-shadow: 0 4px 16px rgba(16, 185, 129, 0.25);
    }

    .chip {
      background: rgba(37, 99, 235, 0.12);
      color: var(--accent);
      padding: 7px 14px;
      border-radius: 20px;
      font-size: 0.9rem;
      font-weight: 500;
      border: 1px solid rgba(37, 99, 235, 0.15);
    }

    .chip-warning {
      background: rgba(245, 158, 11, 0.12);
      color: #FBBF24;
      border-color: rgba(245, 158, 11, 0.2);
    }

    /* List page */
    .list-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 14px;
      padding: 0 4px;
    }

    .list-header h2 {
      margin: 0;
      font-size: 1.15rem;
      font-weight: 600;
    }

    .list-count {
      color: var(--text-secondary);
      font-size: 0.9rem;
    }

    .add-form {
      display: flex;
      gap: 10px;
      margin-bottom: 18px;
    }

    .add-form input {
      flex: 1;
      padding: 14px 16px;
      border: 1px solid var(--border);
      border-radius: 14px;
      font-size: 1rem;
      outline: none;
      background: #FFFFFF;
      color: var(--text);
    }

    .add-form input::placeholder {
      color: var(--text-secondary);
    }

    .add-form input:focus {
      border-color: var(--primary);
      box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    }

    .add-form button {
      padding: 14px 20px;
      border: none;
      border-radius: 14px;
      background: var(--primary);
      color: #fff;
      font-size: 1rem;
      font-weight: 600;
      cursor: pointer;
      box-shadow: 0 4px 14px rgba(37, 99, 235, 0.2);
    }

    .student-list {
      list-style: none;
      margin: 0;
      padding: 0;
    }

    .student-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 16px 18px;
      background: var(--card);
      border: 1px solid var(--card-border);
      border-radius: 16px;
      margin-bottom: 10px;
      box-shadow: 0 4px 16px rgba(16, 24, 40, 0.3);
      gap: 10px;
      backdrop-filter: blur(12px);
    }

    .student-info {
      display: flex;
      align-items: center;
      gap: 12px;
      flex: 1;
      min-width: 0;
    }

    .student-index {
      color: var(--text-secondary);
      font-size: 0.9rem;
      width: 30px;
      text-align: center;
      flex-shrink: 0;
    }

    .student-name-wrap {
      display: flex;
      flex-direction: column;
      gap: 3px;
      min-width: 0;
    }

    .student-name {
      font-size: 1.2rem;
      font-weight: 600;
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .student-score {
      font-size: 0.9rem;
      color: var(--text-secondary);
    }

    .student-score .score-num {
      color: var(--accent);
      font-weight: 600;
    }

    .student-pass {
      display: inline-block;
      margin-left: 10px;
      padding: 2px 8px;
      border-radius: 10px;
      background: rgba(37, 99, 235, 0.12);
      color: var(--accent);
      font-size: 0.75rem;
    }

    .student-called {
      background: rgba(16, 185, 129, 0.15);
      color: var(--success);
      font-size: 0.75rem;
      padding: 3px 9px;
      border-radius: 10px;
      flex-shrink: 0;
    }

    .student-actions {
      display: flex;
      gap: 8px;
      flex-shrink: 0;
    }

    .student-actions button {
      padding: 8px 12px;
      border: none;
      border-radius: 10px;
      font-size: 0.8rem;
      font-weight: 600;
      cursor: pointer;
      white-space: nowrap;
      transition: all 0.15s;
    }

    .btn-mark {
      background: rgba(245, 158, 11, 0.12);
      color: #FBBF24;
      border: 1px solid rgba(245, 158, 11, 0.2);
    }

    .btn-marked {
      background: rgba(16, 185, 129, 0.15);
      color: var(--success);
      border: 1px solid rgba(16, 185, 129, 0.25);
    }

    .btn-delete {
      background: rgba(244, 63, 94, 0.1);
      color: var(--danger);
      border: 1px solid rgba(244, 63, 94, 0.2);
    }

    .btn-edit {
      background: rgba(37, 99, 235, 0.1);
      color: var(--primary);
      border: 1px solid rgba(37, 99, 235, 0.2);
    }

    .empty-tip {
      text-align: center;
      color: var(--text-secondary);
      padding: 48px 16px;
      font-size: 0.95rem;
    }

    /* Settings page */
    .setting-group {
      margin-bottom: 22px;
    }

    .setting-group h3 {
      margin: 0 0 12px;
      font-size: 0.85rem;
      color: var(--text-secondary);
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 1px;
      padding: 0 4px;
    }

    .setting-item {
      background: var(--card);
      border: 1px solid var(--card-border);
      border-radius: 18px;
      padding: 18px;
      margin-bottom: 12px;
      box-shadow: 0 4px 16px rgba(16, 24, 40, 0.3);
      backdrop-filter: blur(12px);
    }

    .setting-item p {
      margin: 0 0 14px;
      font-size: 0.95rem;
      color: var(--text-secondary);
      line-height: 1.6;
    }

    .setting-item p strong {
      color: var(--text);
      font-weight: 600;
    }

    .file-input {
      display: none;
    }

    .link-btn {
      background: none;
      border: none;
      color: var(--accent);
      font-size: 1rem;
      font-weight: 600;
      padding: 0;
      cursor: pointer;
    }

    /* Bottom nav */
    .bottom-nav {
      position: fixed;
      bottom: 0;
      left: 50%;
      transform: translateX(-50%);
      width: 100%;
      max-width: 520px;
      background: #2B5F9E;
      border-top: none;
      display: flex;
      justify-content: space-around;
      padding: 10px 0 calc(44px + var(--safe-bottom));
      box-shadow: 0 -2px 12px rgba(16, 24, 40, 0.2);
      z-index: 100;
    }

    .nav-item {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 5px;
      padding: 6px;
      border: none;
      background: none;
      color: rgba(255, 255, 255, 0.65);
      font-size: 0.72rem;
      cursor: pointer;
      transition: color 0.2s;
      position: relative;
    }

    .nav-item.active {
      color: #FFFFFF;
    }

    .nav-item.active::before {
      content: '';
      position: absolute;
      top: -10px;
      left: 50%;
      transform: translateX(-50%);
      width: 24px;
      height: 3px;
      background: #FFFFFF;
      border-radius: 2px;
    }

    .nav-icon {
      font-size: 1.4rem;
      line-height: 1;
    }

    .nav-badge {
      position: absolute;
      top: 0;
      right: calc(50% - 20px);
      background: var(--danger);
      color: #fff;
      font-size: 0.65rem;
      min-width: 16px;
      height: 16px;
      padding: 0 4px;
      border-radius: 8px;
      display: none;
      align-items: center;
      justify-content: center;
      font-weight: 700;
      box-shadow: 0 2px 8px rgba(244, 63, 94, 0.4);
    }

    .nav-badge.active {
      display: flex;
    }

    /* Modal */
    .modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(17, 24, 39, 0.45);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 200;
      padding: 20px;
      backdrop-filter: blur(4px);
    }

    .modal-overlay.active { display: flex; }

    .modal {
      background: #FFFFFF;
      border: 1px solid var(--card-border);
      border-radius: 24px;
      padding: 26px;
      width: 100%;
      max-width: 340px;
      text-align: center;
      animation: modalIn 0.2s ease-out;
      box-shadow: 0 24px 64px rgba(16, 24, 40, 0.6);
      backdrop-filter: blur(20px);
      /* 内容超高时可滚动，避免确认按钮被顶出屏幕点不到（如考试弹窗的班级/科目复选框） */
      max-height: calc(100vh - 40px);
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
    }

    /* 考试弹窗（班级/科目复选框很多）：标题与底部按钮固定，中间表单区滚动，
       保证「保存」按钮在任何屏幕高度下都看得见、点得到 */
    #examModal .modal {
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }
    #examModal .modal h3 { flex-shrink: 0; }
    #examModal .task-form {
      flex: 1;
      min-height: 0;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
    }
    #examModal .modal-actions { flex-shrink: 0; }

    @keyframes modalIn {
      from { opacity: 0; transform: scale(0.95); }
      to { opacity: 1; transform: scale(1); }
    }

    .modal h3 {
      margin: 0 0 12px;
      font-size: 1.25rem;
      font-weight: 600;
    }

    .modal p {
      margin: 0 0 22px;
      color: var(--text-secondary);
      line-height: 1.6;
    }

    .modal-actions {
      display: flex;
      gap: 12px;
    }

    .modal-actions .btn {
      flex: 1;
      font-size: 1rem;
      padding: 13px;
    }

    /* Class picker sheet */
    .picker-overlay {
      position: fixed;
      inset: 0;
      background: rgba(17, 24, 39, 0.45);
      display: none;
      align-items: flex-end;
      justify-content: center;
      z-index: 250;
    }

    .picker-overlay.active { display: flex; }

    .picker-sheet {
      width: 100%;
      max-width: 520px;
      background: #FFFFFF;
      border-radius: 24px 24px 0 0;
      padding: 18px 0 calc(12px + var(--safe-bottom));
      animation: pickerUp 0.25s ease-out;
    }

    @keyframes pickerUp {
      from { transform: translateY(100%); }
      to { transform: translateY(0); }
    }

    .picker-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 0 20px 14px;
      border-bottom: 1px solid var(--card-border);
    }

    .picker-header h3 {
      margin: 0;
      font-size: 1.1rem;
      color: var(--text);
      font-weight: 600;
    }

    .picker-cancel {
      border: none;
      background: none;
      color: var(--accent);
      font-size: 1rem;
      cursor: pointer;
      padding: 4px 8px;
    }

    .picker-list {
      max-height: 60vh;
      overflow-y: auto;
    }

    .picker-item {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 16px 20px;
      border-bottom: 1px solid var(--card-border);
      color: var(--text);
      cursor: pointer;
      transition: background 0.15s;
    }

    .picker-item.active {
      color: var(--accent);
      font-weight: 600;
    }

    .picker-item:active {
      background: rgba(37, 99, 235, 0.06);
    }

    .picker-count {
      font-size: 0.85rem;
      color: var(--text-secondary);
    }

    .picker-item.active .picker-count {
      color: var(--accent);
    }

    .detail-content {
      text-align: left;
      color: var(--text);
      line-height: 1.6;
      max-height: 50vh;
      overflow-y: auto;
      margin-bottom: 18px;
    }

    .detail-empty {
      color: var(--text-secondary);
      text-align: center;
      padding: 20px 0;
    }

    .detail-task {
      background: #FFFFFF;
      border: 1px solid var(--card-border);
      border-radius: 14px;
      padding: 12px 14px;
      margin-bottom: 10px;
    }

    .detail-task-name {
      font-weight: 600;
      font-size: 1rem;
      margin-bottom: 4px;
    }

    .detail-task-meta {
      font-size: 0.8rem;
      color: var(--text-secondary);
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .detail-task-status {
      padding: 2px 8px;
      border-radius: 10px;
      font-size: 0.75rem;
      font-weight: 600;
    }

    .detail-task-status.pass {
      background: rgba(16, 185, 129, 0.15);
      color: var(--success);
    }

    .detail-task-status.fail {
      background: rgba(244, 63, 94, 0.15);
      color: var(--danger);
    }

    .detail-task-status.score {
      background: rgba(37, 99, 235, 0.15);
      color: var(--accent);
    }

    .detail-section-title {
      font-size: 0.85rem;
      font-weight: 700;
      color: var(--text-secondary);
      letter-spacing: 0.5px;
      margin: 16px 0 10px;
      padding-left: 10px;
      border-left: 3px solid var(--accent);
      text-align: left;
    }

    .modal .detail-task,
    .modal .detail-exam,
    .modal .detail-empty { text-align: left; }

    .detail-exam {
      background: #FFFFFF;
      border: 1px solid var(--card-border);
      border-radius: 14px;
      padding: 12px 14px;
      margin-bottom: 10px;
    }

    .detail-exam-rows {
      display: flex;
      flex-wrap: wrap;
      gap: 6px 14px;
      margin: 6px 0 8px;
    }

    .detail-exam-sub {
      display: inline-flex;
      align-items: baseline;
      gap: 6px;
      font-size: 0.9rem;
    }

    .detail-exam-sub > span:first-child {
      color: var(--text-secondary);
    }

    .detail-exam-score {
      font-weight: 700;
      font-size: 1.15rem;
      color: var(--accent);
    }

    .detail-exam-avg {
      font-size: 0.82rem;
      color: var(--text-secondary);
    }

    /* Toast-like hint (centered, requires tap) */
    .center-toast {
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      background: rgba(17, 24, 39, 0.92);
      color: #fff;
      padding: 14px 24px;
      border-radius: 14px;
      font-size: 1rem;
      z-index: 300;
      display: none;
      pointer-events: none;
      white-space: nowrap;
      border: 1px solid var(--card-border);
      box-shadow: 0 16px 48px rgba(16, 24, 40, 0.5);
      backdrop-filter: blur(12px);
    }

    .center-toast.active { display: block; }

    /* List page menu */
    .list-header-right {
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .list-menu-btn {
      width: 36px;
      height: 36px;
      border-radius: 10px;
      border: 1px solid var(--card-border);
      background: #FFFFFF;
      color: var(--text);
      font-size: 1.3rem;
      line-height: 1;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .list-menu {
      position: absolute;
      top: 48px;
      right: 20px;
      background: #FFFFFF;
      border: 1px solid var(--card-border);
      border-radius: 14px;
      padding: 8px 0;
      min-width: 160px;
      box-shadow: 0 16px 48px rgba(16, 24, 40, 0.5);
      backdrop-filter: blur(20px);
      z-index: 200;
      display: none;
    }

    .list-menu.active { display: block; }

    .list-menu-item {
      padding: 12px 18px;
      color: var(--text);
      font-size: 0.95rem;
      cursor: pointer;
      transition: background 0.15s;
      border: none;
      background: none;
      width: 100%;
      text-align: left;
    }

    .list-menu-item:hover, .list-menu-item:active {
      background: rgba(255, 255, 255, 0.05);
    }

    .list-menu-item.danger {
      color: var(--danger);
    }

    /* Manage page */
    .manage-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 16px;
      padding: 0 4px;
    }

    .manage-header h2 {
      margin: 0;
      font-size: 1.25rem;
    }

    .manage-section-title {
      font-size: 0.95rem;
      font-weight: 600;
      color: var(--text-secondary);
      margin-bottom: 14px;
      padding: 0 2px;
    }

    .manage-class-card {
      margin-bottom: 14px;
      padding: 18px;
    }

    .manage-student-card {
      padding: 18px;
    }

    .class-list {
      display: flex;
      flex-direction: column;
      gap: 10px;
      margin-bottom: 14px;
    }

    .class-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      padding: 12px 14px;
      background: #FFFFFF;
      border: 1px solid var(--card-border);
      border-radius: 16px;
      cursor: pointer;
      transition: all 0.2s;
    }

    .class-item.active {
      border-color: var(--primary);
      background: rgba(37, 99, 235, 0.12);
      box-shadow: 0 0 16px var(--primary-glow);
    }

    .class-item:active {
      transform: scale(0.99);
    }

    .class-item-left {
      display: flex;
      align-items: center;
      gap: 10px;
      flex: 1;
      min-width: 0;
    }

    .class-item-name {
      font-weight: 600;
      font-size: 1rem;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .class-item-count {
      font-size: 0.8rem;
      color: var(--text-secondary);
      white-space: nowrap;
    }

    .class-item-actions {
      display: flex;
      gap: 6px;
      flex-shrink: 0;
    }

    .class-item-actions button {
      padding: 6px 10px;
      border: none;
      border-radius: 10px;
      font-size: 0.75rem;
      font-weight: 600;
      cursor: pointer;
      white-space: nowrap;
      transition: all 0.15s;
    }

    .class-item-actions .btn-edit {
      background: rgba(37, 99, 235, 0.12);
      color: var(--accent);
    }

    .class-item-actions .btn-delete {
      background: rgba(244, 63, 94, 0.1);
      color: var(--danger);
    }

    .manage-add-form input.score-input {
      flex: 0 0 90px;
      text-align: center;
    }

    .manage-add-form.manage-add-form-vertical {
      flex-direction: column;
    }

    .manage-add-form.manage-add-form-vertical input,
    .manage-add-form.manage-add-form-vertical input.score-input {
      flex: 1 1 auto;
      width: 100%;
      text-align: left;
      box-sizing: border-box;
    }

    .manage-add-form button {
      padding: 14px 18px;
      border: none;
      border-radius: 14px;
      background: var(--primary);
      color: #fff;
      font-size: 1rem;
      font-weight: 600;
      cursor: pointer;
      box-shadow: 0 4px 14px rgba(37, 99, 235, 0.2);
      white-space: nowrap;
    }

    .manage-empty-tip {
      text-align: center;
      color: var(--text-secondary);
      padding: 24px 16px;
      font-size: 0.9rem;
    }

    .manage-section-card { margin-bottom: 16px; }
    .data-mgr-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }

    .student-name-clickable {
      cursor: pointer;
      transition: color 0.15s;
    }

    .student-name-clickable:active {
      color: var(--accent);
    }

    /* Pass page */
    .pass-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 16px;
    }

    .pass-header h2 {
      margin: 0;
      font-size: 1.3rem;
    }

    .btn-sm {
      padding: 8px 14px;
      font-size: 0.85rem;
      border-radius: 12px;
    }

    .pass-task-card {
      padding: 16px 20px;
      margin-bottom: 12px;
    }

    .pass-task-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }

    .pass-task-row label {
      color: var(--text-secondary);
      font-size: 0.9rem;
      white-space: nowrap;
    }

    .task-delete-btn {
      width: 36px;
      height: 36px;
      border-radius: 10px;
      border: 1px solid var(--card-border);
      background: rgba(244, 63, 94, 0.1);
      color: var(--danger);
      font-size: 1.1rem;
      line-height: 1;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      transition: all 0.15s;
    }

    .task-delete-btn:active {
      transform: scale(0.95);
      background: rgba(244, 63, 94, 0.2);
    }

    .task-delete-btn:disabled {
      opacity: 0.4;
      cursor: not-allowed;
    }

    .pass-select {
      flex: 1;
      padding: 10px 12px;
      border-radius: 12px;
      border: 1px solid var(--border);
      background: #FFFFFF;
      color: var(--text);
      font-size: 0.95rem;
      outline: none;
    }

    .pass-task-info {
      margin-top: 10px;
      font-size: 0.85rem;
      color: var(--text-secondary);
    }


    .pass-actions {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 12px;
      padding: 0 4px;
    }

    .pass-sort-label {
      font-size: 0.85rem;
      color: var(--text-secondary);
    }

    .pass-list {
      padding-bottom: 20px;
    }
    /* Quick search */
    .search-card {
      padding: 16px 20px;
      margin-bottom: 12px;
    }

    .search-input {
      width: 100%;
      padding: 12px 16px;
      border-radius: 14px;
      border: 1px solid var(--border);
      background: #FFFFFF;
      color: var(--text);
      font-size: 1rem;
      outline: none;
    }

    .search-input::placeholder {
      color: var(--text-secondary);
      opacity: 0.6;
    }

    .search-results {
      margin-top: 12px;
      display: none;
    }

    .search-results.active {
      display: block;
    }

    .search-results-label {
      font-size: 0.85rem;
      color: var(--text-secondary);
      margin-bottom: 8px;
    }

    .search-item {
      background: #F5F7FA;
      border: 1px solid var(--card-border);
      border-radius: 14px;
      padding: 12px 14px;
      margin-bottom: 8px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
    }

    .search-item-name {
      font-weight: 600;
      font-size: 1rem;
      flex: 1;
    }

    .search-item-score {
      width: 70px;
      padding: 7px 10px;
      border-radius: 10px;
      border: 1px solid var(--border);
      background: #FFFFFF;
      color: var(--text);
      font-size: 0.95rem;
      text-align: center;
      outline: none;
    }

    .search-item-btns {
      display: flex;
      gap: 8px;
      flex-shrink: 0;
    }

    .search-item-btns .btn {
      padding: 7px 12px;
      font-size: 0.8rem;
      border-radius: 10px;
      margin-top: 0;
    }


    .pass-item {
      background: var(--card);
      border: 1px solid var(--card-border);
      border-radius: 18px;
      padding: 14px 16px;
      margin-bottom: 10px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      backdrop-filter: blur(12px);
    }

    .pass-item-left {
      display: flex;
      align-items: center;
      gap: 12px;
      flex: 1;
      min-width: 0;
    }

    .pass-item-index {
      width: 26px;
      height: 26px;
      border-radius: 50%;
      background: rgba(148, 163, 184, 0.15);
      color: var(--text-secondary);
      font-size: 0.8rem;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }

    .pass-item-name {
      font-weight: 600;
      font-size: 1rem;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .pass-item-status {
      font-size: 0.8rem;
      padding: 4px 10px;
      border-radius: 20px;
      flex-shrink: 0;
    }

    .pass-item-status.none {
      background: rgba(148, 163, 184, 0.12);
      color: var(--text-secondary);
    }

    .pass-item-status.pass {
      background: rgba(16, 185, 129, 0.15);
      color: var(--success);
    }

    .pass-item-status.fail {
      background: rgba(244, 63, 94, 0.15);
      color: var(--danger);
    }

    .pass-item-score {
      width: 70px;
      padding: 8px 10px;
      border-radius: 12px;
      border: 1px solid var(--border);
      background: #FFFFFF;
      color: var(--text);
      font-size: 0.95rem;
      text-align: center;
      outline: none;
    }

    .pass-btns {
      display: flex;
      gap: 8px;
      flex-shrink: 0;
    }

    .pass-btns .btn {
      padding: 7px 12px;
      font-size: 0.8rem;
      border-radius: 10px;
      margin-top: 0;
    }

    /* Task modal */
    .task-form label {
      display: block;
      margin: 12px 0 6px;
      color: var(--text-secondary);
      font-size: 0.9rem;
    }

    .task-form input, .task-form select {
      width: 100%;
      padding: 12px;
      border-radius: 12px;
      border: 1px solid var(--border);
      background: #FFFFFF;
      color: var(--text);
      font-size: 1rem;
      outline: none;
    }

    /* Back button in header */
    .back-btn {
      flex-shrink: 0;
      background: rgba(255, 255, 255, 0.2);
      border: none;
      color: #fff;
      font-size: 0.9rem;
      padding: 6px 13px;
      border-radius: 14px;
      cursor: pointer;
      display: none;
    }
    .back-btn:active { background: rgba(255, 255, 255, 0.34); }
    /* 显示返回首页按钮：用 flex 垂直居中，并把点击热区抬到 34px（触屏更好按），
       外框视觉大小不变（padding / 字号 / 圆角保持原样） */
    .header.has-back .back-btn {
      display: flex;
      align-items: center;
      min-height: 34px;
    }
    .header.has-back h1 { padding-left: 0; }

    /* Home / Workbench */
    .home-hero {
      display: flex;
      align-items: center;
      gap: 8px;
      background: #fff;
      border: 1px solid var(--card-border);
      border-radius: 14px;
      padding: 11px 16px;
      color: var(--text);
      margin-bottom: 14px;
      box-shadow: 0 2px 10px rgba(16, 24, 40, 0.05);
    }
    .home-hero-date { font-size: 0.95rem; font-weight: 600; color: var(--primary); }
    .home-hero-sub { display: none; }

    .weather-card {
      background: #fff;
      border-radius: 16px;
      padding: 14px;
      margin-top: 14px;
      margin-bottom: 16px;
      color: var(--text);
      box-shadow: 0 4px 14px rgba(16, 24, 40, 0.12);
    }
    .weather-title {
      font-size: 1.05rem;
      font-weight: 700;
      color: var(--text);
      margin-bottom: 10px;
    }
    .weather-period {
      font-size: 0.98rem;
      font-weight: 700;
      color: var(--primary);
      margin-bottom: 8px;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    .weather-period .refresh-tip {
      font-size: 0.7rem;
      color: var(--text-secondary);
      font-weight: 400;
    }
    .weather-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 7px 0;
      border-bottom: 1px solid #EEF2F7;
      font-size: 0.9rem;
    }
    .weather-row:last-child { border-bottom: none; }
    .weather-class { font-weight: 600; }
    .weather-sub { color: var(--text-secondary); }
    .weather-teacher { color: var(--primary); font-weight: 600; }
    .weather-self { color: var(--primary); font-weight: 600; }
    .weather-break { text-align: center; color: #475569; padding: 12px 0; font-weight: 600; }
    .weather-none { color: var(--text-secondary); font-size: 0.85rem; }

    .module-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 16px;
    }
    .module-btn {
      background: #fff;
      border: 1px solid var(--card-border);
      border-radius: 20px;
      padding: 28px 16px;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 12px;
      cursor: pointer;
      box-shadow: 0 4px 16px rgba(16, 24, 40, 0.06);
      transition: transform 0.15s, box-shadow 0.15s;
    }
    .module-btn:active { transform: scale(0.97); box-shadow: 0 2px 8px rgba(16, 24, 40, 0.12); }
    .module-icon { font-size: 2.6rem; line-height: 1; }
    .module-name { font-size: 1.2rem; font-weight: 600; color: var(--text); }
    .module-desc { display: none; }

    /* Timetable */
    .tt-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
    .tt-tab {
      flex: 1;
      padding: 11px;
      border: 1px solid var(--border);
      background: #fff;
      border-radius: 12px;
      font-size: 0.95rem;
      font-weight: 600;
      color: var(--text-secondary);
      cursor: pointer;
    }
    .tt-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
    .tt-picker { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
    .tt-picker select { flex: 1; min-width: 120px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: #fff; color: var(--text); font-size: 0.95rem; }
    .tt-grid { width: 100%; border-collapse: collapse; font-size: 0.8rem; table-layout: fixed; }
    .tt-grid th, .tt-grid td { border: 1px solid var(--card-border); padding: 6px 2px; text-align: center; vertical-align: middle; }
    .tt-grid th { background: #F1F5FB; color: var(--text-secondary); font-weight: 600; }
    .tt-grid th:first-child, .tt-grid td:first-child { width: 70px; min-width: 70px; }
    .tt-grid th:not(:first-child), .tt-grid td:not(:first-child) { width: 12.5%; min-width: 40px; }
    .tt-cell { cursor: pointer; background: #fff; word-break: break-all; }
    .tt-cell.break { background: #F8FAFC; color: var(--text-secondary); }
    .tt-cell .tt-sub { font-weight: 600; color: var(--text); }
    .tt-cell .tt-teacher { display: block; font-size: 0.7rem; color: var(--primary); margin-top: 2px; }
    .tt-cell.empty { color: var(--text-secondary); }
    .tt-cell:active { background: rgba(37, 99, 235, 0.08); }
    .tt-period-name { font-weight: 600; }
    .tt-period-time { display: block; font-size: 0.62rem; color: var(--text-secondary); margin-top: 2px; }
    .tt-self-row { background: #FFF3E0; }
    .tt-self-row .tt-cell { background: #FFF3E0; }
    .tt-self-cell { font-weight: 500; }
    .tt-self-cell .tt-teacher { color: var(--primary); font-weight: 600; font-size: 0.7rem; }
    .tt-wrap { overflow-x: auto; }

    /* Performance */
    .perf-summary { display: flex; flex-direction: column; gap: 10px; }
    .perf-teacher-row {
      display: flex; align-items: center; justify-content: space-between;
      padding: 14px 16px; background: #fff; border: 1px solid var(--card-border);
      border-radius: 14px; box-shadow: 0 4px 16px rgba(16,24,40,0.05);
    }
    .perf-rank { width: 28px; height: 28px; border-radius: 50%; background: rgba(37,99,235,0.12); color: var(--primary); font-weight: 700; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
    .perf-rank.top { background: var(--primary); color: #fff; }
    .perf-teacher-info { flex: 1; margin-left: 12px; min-width: 0; }
    .perf-teacher-name { font-weight: 600; font-size: 1rem; }
    .perf-teacher-sub { font-size: 0.78rem; color: var(--text-secondary); }
    .perf-avg { font-weight: 700; font-size: 1.1rem; color: var(--primary); white-space: nowrap; }
    .exam-card { padding: 16px; }
    .exam-item { display:flex; justify-content: space-between; align-items:center; gap:10px; padding: 13px 14px; background:#fff; border:1px solid var(--card-border); border-radius:14px; margin-bottom:10px; cursor:pointer; }
    .exam-item:active { background: rgba(37,99,235,0.06); }
    .exam-item-main { flex:1; min-width:0; display:flex; align-items:center; justify-content:space-between; gap:8px; }
    .exam-item-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
    .exam-item-actions { display:flex; gap:6px; flex-shrink:0; }
    .exam-btn { padding:8px 12px; border-radius:10px; font-size:0.82rem; font-weight:600; border:1px solid var(--card-border); background:#F8FAFC; color:var(--text-secondary); cursor:pointer; }
    .exam-btn:active { transform: scale(0.96); }
    .exam-btn.del { color:var(--danger); border-color:#FECACA; background:#FEF2F2; }
    .score-entry-grid { width:100%; border-collapse: collapse; font-size:0.85rem; }
    .score-entry-grid th, .score-entry-grid td { border:1px solid var(--card-border); padding:8px 6px; text-align:center; }
    .score-entry-grid input { width: 64px; padding:6px; border-radius:8px; border:1px solid var(--border); text-align:center; font-size:0.9rem; }

    /* ===== 姓名拼音标注（设置页可一键关闭） ===== */
    .py-name { display:inline-flex; align-items:flex-end; vertical-align:bottom; line-height:1; }
    .py-c { display:inline-flex; flex-direction:column; align-items:center; justify-content:flex-end; }
    .py-t { font-size:0.5em; line-height:1.1; font-weight:400; color:var(--text-secondary); letter-spacing:0; margin-bottom:1px; white-space:nowrap; user-select:none; }
    .py-name.py-lg .py-t { font-size:0.2em; margin-bottom:0.08em; }
    .perf-stu-name .py-t { font-size:0.52em; }
    /* 拼音校对弹窗 */
    .py-fix-list { max-height:54vh; overflow-y:auto; }
    .py-fix-row { display:flex; align-items:center; gap:6px; padding:8px 0; border-bottom:1px solid var(--card-border); }
    .py-fix-row:last-child { border-bottom:none; }
    .py-fix-name { flex:0 0 5.8em; font-weight:600; font-size:0.95rem; }
    .py-fix-input { width:4.6em; padding:5px 6px; border-radius:8px; border:1px solid var(--border); font-size:0.82rem; text-align:center; }
    .py-switch-row { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:12px 0; border-bottom:1px solid var(--card-border); }
    .py-switch-row:last-child { border-bottom:none; }
    .py-switch-label { font-size:0.95rem; }
    .py-switch-sub { font-size:0.78rem; color:var(--text-secondary); margin-top:2px; }
    .py-toggle { position:relative; width:46px; height:26px; border-radius:13px; background:#CBD5E1; border:none; cursor:pointer; flex-shrink:0; transition:background .18s; padding:0; }
    .py-toggle.on { background:var(--primary); }
    .py-toggle::after { content:''; position:absolute; top:3px; left:3px; width:20px; height:20px; border-radius:50%; background:#fff; transition:transform .18s; }
    .py-toggle.on::after { transform:translateX(20px); }

  