/* 台灯 */
body { background: var(--bg); min-height: 100vh; overflow-x: hidden; }
kbd {
  display: inline-block; margin-left: 6px; padding: 0 5px; min-width: 18px; height: 18px; line-height: 17px;
  font-family: var(--font); font-size: 11px; border-radius: 5px; border: 1px solid currentColor; opacity: .5; text-align: center;
}

.top {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 10px 18px; background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.top .grow { flex: 1; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo { width: 36px; height: 36px; border-radius: 10px; background: var(--teal-700); color: #fbe7b5; display: flex; align-items: center; justify-content: center; }
.brand b { display: block; font-size: 16px; line-height: 1.2; }
.brand span { font-size: 12px; color: var(--ink-3); }
.dev { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); padding: 6px 12px; border-radius: 16px; background: var(--bg); }
.dev.off { background: var(--amber-bg); color: #8a5d00; }
.src-seg { width: 150px; }
.src-seg button { height: 30px; font-size: 13px; }

.main { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; padding: 14px 18px 18px; align-items: start; }
.left { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.stage {
  position: relative; width: min(100%, calc((100vh - 160px) * 4 / 3)); min-width: 300px; aspect-ratio: 4 / 3; margin: 0 auto;
  border-radius: 18px; overflow: hidden; background: #1d2524; box-shadow: var(--shadow-lg);
}
.stage canvas#scene, .stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.stage .flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.stage .flash.go { animation: shutter .45s ease-out; }
@keyframes shutter { 0% { opacity: .85; } 100% { opacity: 0; } }
.cam-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 40px; color: #fff; font-size: 16px; line-height: 1.7; background: #1d2524; }

.ctrl { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; }
.ctrl .btn.big { min-height: 44px; padding: 0 16px; font-size: 15px; }
.ctrl .btn.active { background: var(--amber-bg); border-color: var(--amber); color: #8a5d00; }
.ctrl-hint { font-size: 13px; color: var(--ink-3); }
.cam-select { max-width: 280px; }

/* 右栏：一句话状态、完成按钮、本次拍到的页 */
.panel {
  display: flex; flex-direction: column; gap: 12px; min-width: 0;
  position: sticky; top: 14px; max-height: calc(100vh - 28px);
}
.say { padding: 18px 18px 16px; border-left: 6px solid var(--teal-600); transition: border-color .2s; }
.say.busy { border-left-color: var(--amber); }
.say.ok { border-left-color: var(--green); }
.say.warn { border-left-color: var(--red); background: #fff9f7; }
.say-main { font-size: 24px; font-weight: 700; line-height: 1.3; letter-spacing: .5px; }
.say-sub { margin-top: 6px; font-size: 14px; color: var(--ink-2); min-height: 21px; }

.done-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 100%;
  min-height: 72px; border: 0; border-radius: 16px; cursor: pointer; flex: none;
  background: linear-gradient(180deg, #e9a21a, #d4870a); color: #fff; box-shadow: 0 6px 18px rgba(212, 135, 10, .35);
  transition: transform .1s, box-shadow .15s;
}
.done-btn b { font-size: 22px; letter-spacing: 4px; }
.done-btn span { font-size: 13px; opacity: .9; }
.done-btn:hover { box-shadow: 0 8px 24px rgba(212, 135, 10, .45); }
.done-btn:active { transform: scale(.98); }
.done-btn:disabled { opacity: .6; cursor: default; }
.done-result { font-size: 14px; padding: 10px 14px; border-radius: 12px; background: var(--green-bg); color: #1f6b3e; line-height: 1.6; flex: none; }
.done-result.none { background: var(--grey-bg); color: var(--ink-2); }
.done-result.warn { background: var(--amber-bg); color: #8a5d00; }
.done-result a { font-weight: 600; }

.pages { display: flex; flex-direction: column; min-height: 140px; flex: 1 1 auto; padding: 12px 12px 6px; }
.pages-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 0 4px 8px; }
.pages-list { overflow-y: auto; min-height: 0; flex: 1; }
.pages-empty { color: var(--ink-3); font-size: 14px; padding: 18px 6px; text-align: center; line-height: 1.7; }
.pg { display: flex; gap: 10px; align-items: center; padding: 8px 4px; border-top: 1px solid var(--line-2); }
.pg:first-child { border-top: 0; }
.pg.flash { animation: pgFlash 1.6s ease-out; }
@keyframes pgFlash { 0% { background: var(--teal-100); } 100% { background: transparent; } }
.pg .th { width: 46px; height: 60px; border-radius: 6px; overflow: hidden; background: var(--bg-deep); flex: none; }
.pg .th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pg .pb { flex: 1; min-width: 0; }
.pg .pt { font-weight: 700; font-size: 15px; }
.pg .pu { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg .ps { margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 13px; color: var(--ink-2); }
.pg .ps .spinner { width: 12px; height: 12px; border-width: 2px; }

.foot { text-align: right; flex: none; }
.admin-link { font-size: 12px; color: var(--ink-3); padding: 4px 6px; }
.admin-link:hover { color: var(--teal-600); }

.sleep { position: fixed; inset: 0; z-index: 50; background: rgba(20, 30, 29, .6); display: flex; align-items: center; justify-content: center; padding: 20px; }
.sleep-box { background: var(--surface); border-radius: 18px; padding: 26px 28px; max-width: 420px; text-align: center; box-shadow: var(--shadow-lg); }
.sleep-box b { font-size: 18px; display: block; }
.sleep-box p { color: var(--ink-2); margin: 8px 0 18px; }

/* 半屏或窄窗口：上下排，画面不超过半屏高，完成按钮在第一屏能点到 */
@media (max-width: 860px) {
  .main { grid-template-columns: 1fr; }
  .stage { width: min(100%, calc(52vh * 4 / 3)); }
  .panel { position: static; max-height: none; }
  .pages-list { max-height: 50vh; }
  .ctrl .btn.big { padding: 0 12px; font-size: 14px; }
  .ctrl kbd { display: none; }
}
