* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(180deg, #eef2ff 0%, #f8fafc 280px, #f8fafc 100%);
  color: #1f2937;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
a { color: #2563eb; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }

/* ============ 通用 ============ */
.app-header {
  position: sticky; top: 0; z-index: 50;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  padding: 14px 18px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 2px 12px rgba(37,99,235,.18);
}
.app-header h1 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: .5px; }
.app-header .sub { font-size: 12px; opacity: .85; }
.app-header .spacer { flex: 1; }
.app-header .who { font-size: 13px; opacity: .9; }
.app-header button.logout {
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.35);
  color: #fff; padding: 6px 12px; border-radius: 8px; font-size: 12px;
}

.tabs {
  display: flex; gap: 6px; padding: 10px 14px; background: #fff;
  border-bottom: 1px solid #e5e7eb; position: sticky; top: 56px; z-index: 40;
}
.tabs .tab {
  flex: 1; text-align: center;
  padding: 9px 8px; border-radius: 10px; font-size: 14px; font-weight: 600;
  color: #475569; background: #f1f5f9; border: 1px solid transparent;
  transition: all .15s ease;
}
.tabs .tab.active { background: #2563eb; color: #fff; box-shadow: 0 4px 12px rgba(37,99,235,.25); }

.container { max-width: 920px; margin: 0 auto; padding: 14px; }

.card {
  background: #fff; border-radius: 14px; padding: 14px;
  box-shadow: 0 2px 14px rgba(15,23,42,.05);
  border: 1px solid #eef2f7;
  margin-bottom: 12px;
}
.card h3 { margin: 0 0 10px; font-size: 15px; font-weight: 700; }
.card .meta { font-size: 12px; color: #6b7280; }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.tight { gap: 6px; }
.spread { display:flex; justify-content: space-between; align-items: center; gap: 8px; }

.btn {
  border: 0; border-radius: 10px; padding: 10px 14px;
  font-size: 14px; font-weight: 600;
  background: #2563eb; color: #fff;
  transition: transform .06s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { background: #1d4ed8; }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: #e2e8f0; color: #1f2937; }
.btn.secondary:hover { background: #cbd5e1; }
.btn.warn { background: #ef4444; }
.btn.warn:hover { background: #dc2626; }
.btn.ghost { background: transparent; color: #2563eb; }
.btn.ghost:hover { background: #eff6ff; }
.btn.small { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn.block { width: 100%; }

input, select, textarea {
  width: 100%; padding: 10px 12px; font-size: 14px;
  border: 1px solid #d1d5db; border-radius: 10px; background: #fff;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: 0; border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,.18);
}
label { font-size: 13px; color: #374151; font-weight: 600; display: block; margin: 8px 0 4px; }

.field { margin-bottom: 10px; }

/* ============ 登录 ============ */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: radial-gradient(ellipse at top, #c7d2fe 0%, #eef2ff 35%, #f8fafc 100%);
}
.login-card {
  width: 100%; max-width: 380px;
  background: #fff; border-radius: 20px;
  box-shadow: 0 18px 48px rgba(37,99,235,.18);
  padding: 28px 22px;
}
.login-logo {
  width: 64px; height: 64px; border-radius: 18px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 30px; font-weight: 800;
  margin: 0 auto 14px; box-shadow: 0 8px 20px rgba(124,58,237,.35);
}
.login-card h2 { text-align: center; margin: 0 0 4px; font-size: 22px; }
.login-card .tip { text-align: center; color: #6b7280; font-size: 13px; margin-bottom: 18px; }

.role-pick { display: flex; gap: 8px; margin-bottom: 16px; }
.role-pick button {
  flex: 1; padding: 12px 8px; border-radius: 12px; border: 2px solid #e5e7eb;
  background: #fff; color: #475569; font-weight: 700; font-size: 14px;
}
.role-pick button.active {
  border-color: #2563eb; background: #eff6ff; color: #1d4ed8;
}

/* ============ 上传双按钮 ============ */
.upload-choices { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.upload-choices .pick {
  flex: 1; min-width: 140px;
  padding: 14px 12px; border-radius: 12px;
  background: #fff; border: 2px dashed #cbd5e1;
  color: #1f2937; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.upload-choices .pick.camera { background: linear-gradient(135deg,#d1fae5,#a7f3d0); border-color: #10b981; color: #065f46; }
.upload-choices .pick.album  { background: linear-gradient(135deg,#fef3c7,#fde68a); border-color: #f59e0b; color: #92400e; }
.upload-choices .pick:active { transform: scale(.98); }
.upload-choices .pick .ic { font-size: 18px; }

.dropzone {
  border: 2px dashed #cbd5e1; border-radius: 14px; padding: 18px;
  text-align: center; color: #64748b; font-size: 13px;
  background: #fafbff; cursor: pointer;
}
.dropzone.has-file { border-style: solid; border-color: #2563eb; background: #eff6ff; color: #1d4ed8; }

.preview { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.preview .thumb {
  width: 96px; height: 96px; border-radius: 10px; overflow: hidden;
  background: #f1f5f9; border: 1px solid #e5e7eb; position: relative;
}
.preview .thumb img { width: 100%; height: 100%; object-fit: cover; }
.preview .thumb.audio {
  display: flex; align-items: center; justify-content: center; padding: 8px;
  background: linear-gradient(135deg,#fef3c7,#fde68a); color: #92400e; font-size: 12px; font-weight: 700;
  text-align: center;
}
.preview .thumb .del {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; border: 0; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}

/* ============ toast ============ */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: rgba(15,23,42,.92); color: #fff; padding: 10px 16px;
  border-radius: 999px; font-size: 13px; z-index: 9999;
  box-shadow: 0 8px 20px rgba(0,0,0,.18);
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.toast.success { background: #16a34a; }
.toast.error { background: #dc2626; }

/* ============ modal ============ */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.55);
  display: none; align-items: center; justify-content: center;
  z-index: 200; padding: 16px;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 16px; padding: 18px;
  width: 100%; max-width: 460px;
  box-shadow: 0 18px 48px rgba(15,23,42,.25);
  max-height: 88vh; overflow: auto;
}
.modal h3 { margin: 0 0 10px; font-size: 17px; }
.modal .actions { display: flex; gap: 8px; margin-top: 14px; justify-content: flex-end; }

/* ============ 列表卡片 ============ */
.list-empty {
  text-align: center; color: #94a3b8; padding: 36px 12px; font-size: 14px;
}

.q-card {
  background: #fff; border-radius: 14px; padding: 12px;
  border: 1px solid #eef2f7; margin-bottom: 10px;
  box-shadow: 0 2px 10px rgba(15,23,42,.04);
  display: flex; gap: 10px;
}
.q-card .pic {
  width: 80px; height: 80px; border-radius: 10px; overflow: hidden;
  flex: 0 0 auto; background: #f1f5f9;
}
.q-card .pic img { width: 100%; height: 100%; object-fit: cover; }
.q-card .info { flex: 1; min-width: 0; }
.q-card .info .name { font-size: 14px; font-weight: 700; color: #1f2937; line-height: 1.35; }
.q-card .info .meta { font-size: 12px; color: #6b7280; margin-top: 2px; }
.q-card .info .badges { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.q-card .info .snippet { font-size: 12px; color: #475569; margin-top: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.badge {
  display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 999px;
  background: #eff6ff; color: #1d4ed8; font-weight: 700;
}
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.ok   { background: #dcfce7; color: #166534; }
.badge.star { background: #fde68a; color: #92400e; }
.badge.new  { background: #fee2e2; color: #b91c1c; }

/* ============ 详情 ============ */
.detail-grid { display: grid; gap: 10px; }
.detail-section h4 {
  margin: 6px 0 6px; font-size: 13px; color: #6b7280; font-weight: 700;
  display: flex; align-items: center; gap: 6px;
}
.detail-section .content {
  background: #f8fafc; border-radius: 10px; padding: 10px;
  border: 1px solid #e2e8f0;
}
.detail-section .content img { max-width: 100%; border-radius: 8px; }
.detail-section .content audio { width: 100%; }
.detail-section .content pre {
  margin: 0; font-family: inherit; white-space: pre-wrap; word-break: break-word;
}

/* ============ 筛选栏 ============ */
.filter-bar {
  background: #fff; border: 1px solid #eef2f7; border-radius: 12px;
  padding: 10px; margin-bottom: 10px;
}
.filter-bar .line { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-bar select, .filter-bar input { padding: 8px 10px; font-size: 13px; }
.filter-bar label.inline { display: inline-flex; align-items: center; gap: 4px; margin: 0; font-size: 13px; font-weight: 600; }
.chip-toggle {
  display: inline-flex; gap: 6px;
}
.chip-toggle .chip {
  padding: 6px 12px; border-radius: 999px; border: 1px solid #d1d5db;
  background: #fff; font-size: 13px; font-weight: 600; color: #475569;
}
.chip-toggle .chip.active { background: #2563eb; color: #fff; border-color: #2563eb; }

/* ============ 班级/学生 列表 ============ */
.class-card {
  background: #fff; border-radius: 12px; padding: 12px;
  border: 1px solid #eef2f7; margin-bottom: 8px;
  display: flex; align-items: center; gap: 10px;
}
.class-card .name { flex: 1; font-weight: 700; font-size: 15px; }
.class-card .count { font-size: 12px; color: #6b7280; }
.student-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; background: #fff; border-radius: 10px;
  border: 1px solid #eef2f7; margin-bottom: 6px;
}
.student-row .name { flex: 1; font-weight: 600; }
.student-row .tag {
  font-size: 11px; padding: 2px 7px; border-radius: 999px; background: #fef3c7; color: #92400e;
}
.student-row .tag.ok { background: #dcfce7; color: #166534; }

@media (max-width: 640px) {
  .app-header h1 { font-size: 16px; }
  .tabs .tab { font-size: 13px; padding: 8px 6px; }
  .q-card .pic { width: 64px; height: 64px; }
}

/* 提交中遮罩 */
.busy-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.55);
  display: none; align-items: center; justify-content: center; z-index: 300;
}
.busy-mask.show { display: flex; }
.busy-box {
  background: #fff; padding: 18px 22px; border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0,0,0,.25); text-align: center; min-width: 220px;
}
.busy-box .spin {
  width: 32px; height: 32px; border: 3px solid #dbeafe; border-top-color: #2563eb;
  border-radius: 50%; margin: 0 auto 10px; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 录音按钮 */
.rec-btn {
  width: 96px; height: 96px; border-radius: 50%;
  background: #fff; border: 4px solid #ef4444;
  display: inline-flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 2px;
  cursor: pointer; transition: transform .12s ease;
  box-shadow: 0 6px 18px rgba(239,68,68,.18);
}
.rec-btn:active { transform: scale(.96); }
.rec-btn .rec-dot {
  width: 26px; height: 26px; border-radius: 50%;
  background: #ef4444; transition: all .15s ease;
}
.rec-btn.recording { border-color: #dc2626; box-shadow: 0 0 0 8px rgba(239,68,68,.15), 0 6px 18px rgba(239,68,68,.25); }
.rec-btn.recording .rec-dot {
  border-radius: 5px; width: 22px; height: 22px;
  animation: pulse 1s ease-in-out infinite;
}
.rec-btn .rec-label {
  font-size: 11px; color: #475569; font-weight: 700; margin-top: 2px;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .55; } }
