/* HomeworkOS · 扫码页共享样式（学生端 + 管理端复用） */

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  background: #171a22; color: #e9eef7; min-height: 100vh;
  display: flex; flex-direction: column; align-items: center;
}
.container { width: 100%; max-width: 480px; padding: 12px; }

.topbar {
  width: 100%; max-width: 480px; padding: 12px 16px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.topbar .brand { display: flex; align-items: center; gap: 8px; }
.topbar .logo {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: white;
}

.scan-card {
  background: #1f2430; border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px; padding: 20px; margin-top: 12px; text-align: center;
}
.scan-title { font-size: 17px; font-weight: 600; margin-bottom: 4px; }
.scan-sub { font-size: 12px; color: #7f8aa0; margin-bottom: 16px; }
.btn-scan {
  width: 100%; padding: 12px; border: none; border-radius: 12px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  background: #2a6b3f; color: white;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-scan:active { transform: scale(0.98); }
.divider {
  display: flex; align-items: center; gap: 10px; margin: 14px 0;
  color: #5a6478; font-size: 11px;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: rgba(255,255,255,0.06);
}
.input-group { display: flex; gap: 8px; }
.input-group input {
  flex: 1; min-width: 0; padding: 11px 12px; border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12); background: #161a22;
  color: #e9eef7; font-size: 15px; font-family: var(--font-mono); letter-spacing: 1px;
}
.input-group input::placeholder { color: #5a6478; letter-spacing: normal; font-family: inherit; font-size: 13px; }
.input-group input:focus { outline: none; border-color: var(--accent); }
.btn-query {
  padding: 11px 16px; border: none; border-radius: 10px;
  background: #252b38; color: #dce4f3; font-size: 14px; font-weight: 600;
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
}
.btn-query:hover { background: #2e3545; }

.result-card {
  display: none; background: #1f2430; border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px; padding: 16px; margin-top: 12px;
}
.result-card.visible { display: block; }
.result-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.result-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: white;
}
.result-name { font-size: 16px; font-weight: 600; }
.info-row {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px;
  font-size: 12px; color: #7f8aa0;
}
.info-row .info-tag { background: #161a22; padding: 4px 10px; border-radius: 6px; }
.info-row .info-title-tag {
  background: #161a22; padding: 4px 10px; border-radius: 6px;
  color: #dce4f3; font-weight: 500; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.error-card {
  display: none; background: rgba(229,92,92,0.08); border: 1px solid rgba(229,92,92,0.2);
  border-radius: 12px; padding: 16px; margin-top: 12px; text-align: center;
}
.error-card.visible { display: block; }
.error-card .error-icon { font-size: 28px; margin-bottom: 8px; }
.error-card .error-text { font-size: 14px; color: #e55c5c; }

.loading { display: none; text-align: center; padding: 16px; color: #7f8aa0; font-size: 13px; }
.loading.visible { display: block; }
.spinner {
  width: 22px; height: 22px; border: 2px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite; margin: 0 auto 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.pages-viewer {
  background: #1f2430; border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px; margin-top: 12px; overflow: hidden; display: none;
}
.pages-viewer.visible { display: block; }
.viewer-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 10px 14px; border-bottom: 1px solid rgba(255,255,255,0.06);
}
.viewer-title { font-size: 14px; font-weight: 600; flex-shrink: 0; }
.viewer-header-right {
  display: flex; align-items: center; gap: 10px; min-width: 0;
}
.viewer-status {
  font-size: 11px; padding: 3px 8px; border-radius: 6px;
  background: rgba(var(--accent-rgb), 0.1); color: var(--accent-2);
  white-space: nowrap;
}
.viewer-status.done { background: rgba(93,211,158,0.1); color: #5dd39e; }
.viewer-status.error { background: rgba(229,92,92,0.1); color: #e55c5c; }
/* 菁优原题开关：默认关，开后题旁叠链 */
.jyeoo-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer; user-select: none; flex-shrink: 0;
  font-size: 12px; color: #95a0b5;
}
.jyeoo-toggle input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.jyeoo-toggle-ui {
  width: 32px; height: 18px; border-radius: 999px;
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.1);
  position: relative; transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.jyeoo-toggle-ui::after {
  content: ''; position: absolute; top: 1px; left: 1px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #c5cddc; transition: transform 0.15s, background 0.15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.35);
}
.jyeoo-toggle input:checked + .jyeoo-toggle-ui {
  background: rgba(14, 165, 233, 0.35);
  border-color: rgba(56, 189, 248, 0.55);
}
.jyeoo-toggle input:checked + .jyeoo-toggle-ui::after {
  transform: translateX(14px); background: #7dd3fc;
}
.jyeoo-toggle input:disabled + .jyeoo-toggle-ui { opacity: 0.4; }
.jyeoo-toggle.is-disabled { cursor: not-allowed; opacity: 0.55; }
.jyeoo-toggle-text { font-weight: 600; letter-spacing: 0.02em; }
.jyeoo-toggle input:checked ~ .jyeoo-toggle-text { color: #7dd3fc; }
.pages-container { padding: 12px; max-height: 160vh; overflow-y: auto; }
.page-image-wrap {
  margin-bottom: 10px; border-radius: 8px; overflow: hidden;
  background: #161a22; position: relative;
}
.page-image-wrap:last-child { margin-bottom: 0; }
.page-image-wrap img { width: 100%; display: block; cursor: pointer; }
.page-label {
  position: absolute; top: 6px; left: 6px; z-index: 2;
  background: rgba(0,0,0,0.6); color: white; padding: 3px 6px;
  border-radius: 4px; font-size: 10px;
}
.page-jyeoo-list {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px 8px 10px;
  background: #1a1f2b;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.scan-jyeoo-item {
  display: inline-flex; align-items: center;
  font-size: 12px; font-weight: 600; line-height: 1.3;
  color: #7dd3fc;
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 6px;
  padding: 5px 8px;
  text-decoration: none;
}
.scan-jyeoo-item:hover {
  background: rgba(14, 165, 233, 0.22);
  border-color: rgba(125, 211, 252, 0.55);
  color: #e0f2fe;
}
.viewer-actions {
  display: flex; gap: 8px; padding: 10px 14px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.viewer-btn {
  flex: 1; padding: 10px 14px;
  background: #252b38; border: 1px solid rgba(255,255,255,0.1);
  color: #dce4f3; border-radius: 8px; font-size: 13px;
  cursor: pointer; text-align: center; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.viewer-btn:hover { background: #2e3545; }
.viewer-btn.primary {
  background: rgba(var(--accent-rgb), 0.15); border-color: rgba(var(--accent-rgb), 0.3);
  color: var(--accent-2);
}

.lightbox {
  display: none; position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.95); justify-content: center; align-items: center;
  touch-action: none;
}
.lightbox.active { display: flex; }
.lightbox-img-wrap {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  overflow: hidden; touch-action: none;
}
.lightbox img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
/* 右上角退出：更大、更高对比 */
.lightbox-close {
  position: absolute; top: 12px; right: 12px; z-index: 1003;
  background: rgba(0,0,0,0.55); border: 1.5px solid rgba(255,255,255,0.45); color: #fff;
  width: 44px; height: 44px; border-radius: 50%; font-size: 20px; font-weight: 600;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.45);
  transition: background 0.15s, transform 0.1s;
}
.lightbox-close:hover { background: rgba(229,62,62,0.85); border-color: rgba(255,255,255,0.6); }
.lightbox-close:active { transform: scale(0.94); }
/* 顶部半透明翻页条 */
.lightbox-topbar {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  z-index: 1002;
  display: none; align-items: center; gap: 4px;
  background: rgba(0,0,0,0.55); border: 1px solid rgba(255,255,255,0.14);
  border-radius: 22px; padding: 4px 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.lightbox-topbar.visible { display: flex; }
.lightbox-top-nav {
  background: rgba(255,255,255,0.12); border: none; color: #fff;
  width: 36px; height: 36px; border-radius: 50%; font-size: 20px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, opacity 0.15s;
  padding: 0;
}
.lightbox-top-nav:hover { background: rgba(255,255,255,0.28); }
.lightbox-top-nav:disabled,
.lightbox-top-nav.is-disabled {
  opacity: 0.28; cursor: default; pointer-events: none;
}
.lightbox-counter {
  color: #dce4f3; padding: 0 12px; min-width: 4.5em; text-align: center;
  font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
  user-select: none;
}
/* 两侧中部箭头：拇指区，略透明 */
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  z-index: 1001;
  background: rgba(255,255,255,0.1); border: none; color: rgba(255,255,255,0.85);
  width: 48px; height: 48px; border-radius: 50%; font-size: 24px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, opacity 0.15s;
}
.lightbox-nav:hover { background: rgba(255,255,255,0.26); color: #fff; }
.lightbox-nav:active { transform: translateY(-50%) scale(0.94); }
.lightbox-prev { left: 12px; }
.lightbox-next { right: 12px; }

/* ── 桌面端加宽适配：电脑上查看答案更舒展 ── */
@media (min-width: 768px) {
  .container { max-width: 720px; padding: 20px 24px; }
  .topbar { max-width: 720px; }
  .scan-card { padding: 24px; }
  .pages-viewer { margin-top: 16px; }
  .pages-container { padding: 16px; }
  .page-image-wrap { margin-bottom: 14px; }
}
