/* lessonRecorder — dark theme, consistent with GCAP tools */
:root {
  --bg: #0b1220; --card: #131c2e; --line: rgba(158, 178, 204, .18);
  --fg: #e8eef9; --muted: #9fb0c8; --primary: #4c8dff;
  --ok: #3dd68c; --warn: #f0b429; --bad: #ff7b72;
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: radial-gradient(900px 500px at 80% -10%, rgba(76, 141, 255, .14), transparent 60%),
    linear-gradient(160deg, #0b1220, #101a2e 60%, #0b1220);
}
.top { display: flex; justify-content: space-between; gap: 16px; padding: 28px 24px 6px;
  max-width: 1080px; margin: 0 auto; flex-wrap: wrap; align-items: flex-start; }
.hdr-right { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.userchip { display: flex; gap: 8px; align-items: center; background: rgba(76, 141, 255, .1);
  border: 1px solid rgba(76, 141, 255, .35); border-radius: 999px; padding: 5px 8px 5px 12px; font-size: 12px; }
.userchip b { color: var(--primary); }
.overlay { position: fixed; inset: 0; z-index: 200; background: rgba(7, 11, 20, .75);
  backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; }
.overlay[hidden] { display: none; }
.authcard { width: min(92vw, 430px); text-align: center; }
.authcard h2 { margin: 6px 0 4px; }
.authcard p { color: var(--muted); font-size: 13px; margin: 4px 0 16px; line-height: 1.5; }
#gButton { display: flex; justify-content: center; min-height: 44px; }
#authMsg { margin-top: 12px; }
.kicker { color: var(--primary); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
h1 { margin: 6px 0 4px; font-size: 26px; }
.sub { color: var(--muted); margin: 0; max-width: 760px; font-size: 14px; line-height: 1.5; }
.badge { border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 12px; color: var(--muted); }
.badge.ok { color: var(--ok); border-color: rgba(61, 214, 140, .5); }
main { max-width: 1080px; margin: 0 auto; padding: 12px 24px 40px; display: grid; gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 18px 20px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mode { background: rgba(11, 18, 32, .5); color: var(--fg); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px; cursor: pointer; text-align: left; font-size: 14px; font-weight: 600;
  display: flex; flex-direction: column; gap: 4px; }
.mode .ico { font-size: 22px; }
.mode .hint { font-weight: 400; color: var(--muted); font-size: 12px; line-height: 1.4; }
.mode.active { border-color: var(--primary); background: rgba(76, 141, 255, .12); }
.row { display: flex; gap: 20px; flex-wrap: wrap; align-items: center; margin-top: 12px; font-size: 13px; }
.switch { display: flex; gap: 8px; align-items: center; cursor: pointer; color: var(--muted); }
.title-row { margin-top: 14px; }
.title-row label { font-weight: 600; }
#titleInput { flex: 1; min-width: 200px; background: rgba(11, 18, 32, .6); color: var(--fg);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.btn { background: var(--primary); color: #fff; border: 0; border-radius: 10px; cursor: pointer;
  font-size: 14px; font-weight: 700; padding: 11px 22px; }
.btn:hover { background: #3d7cef; }
.btn.live { background: var(--bad); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.note { font-size: 13px; color: var(--muted); margin-top: 10px; line-height: 1.5; }
.note.err { color: var(--bad); }
.preview video { width: 100%; max-width: 560px; max-height: 320px; background: #000; border-radius: 10px; }
.preview-meta { display: flex; gap: 12px; align-items: center; margin-top: 10px; font-size: 13px; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: #555; }
.live-dot.on { background: var(--bad); box-shadow: 0 0 10px var(--bad); }
#timer { font-variant-numeric: tabular-nums; color: var(--muted); }
.t-head { display: flex; align-items: center; gap: 10px; }
.t-head h2 { margin: 0; font-size: 15px; }
.spacer { flex: 1; }
.mini { background: rgba(76, 141, 255, .15); color: var(--primary); border: 1px solid rgba(76, 141, 255, .4);
  border-radius: 8px; padding: 5px 10px; cursor: pointer; font-size: 12px; }
.mini:hover { background: rgba(76, 141, 255, .25); }
.cap-state { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; padding: 3px 8px;
  border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.cap-state.on { color: var(--ok); border-color: rgba(61, 214, 140, .5); }
.t-box { margin-top: 10px; background: rgba(11, 18, 32, .5); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; min-height: 90px; max-height: 260px; overflow: auto;
  font-size: 14px; line-height: 1.6; white-space: pre-wrap; }
.placeholder { color: var(--muted); }
.pip { position: fixed; bottom: 18px; right: 18px; width: 220px; background: #000; border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden; box-shadow: 0 10px 40px rgba(0, 0, 0, .6); z-index: 50; }
.pip-bar { display: flex; justify-content: space-between; background: rgba(11, 18, 32, .9); padding: 4px 8px;
  font-size: 11px; color: var(--muted); cursor: move; }
.pip-x { cursor: pointer; }
.pip video { width: 100%; display: block; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(80px);
  background: #0a0f1c; color: var(--fg); border: 1px solid var(--primary); border-radius: 10px;
  padding: 10px 16px; font-size: 13px; opacity: 0; transition: .3s; pointer-events: none; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.list a { color: var(--primary); }
.result a { color: var(--ok); }
@media (max-width: 760px) { .grid3 { grid-template-columns: 1fr; } }

/* ============ mobile-safe additions (keep AFTER base rules) ============ */
.mode.disabled { opacity: .45; cursor: not-allowed; }
#titleInput { font-size: 16px; } /* prevent iOS auto-zoom on focus */
body { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
@media (max-width: 700px) {
  .top { padding: 20px 14px 4px; }
  h1 { font-size: 20px; }
  .hdr-right { width: 100%; justify-content: space-between; }
  .userchip { max-width: 100%; flex-wrap: wrap; }
  .mode { flex-direction: row; align-items: center; gap: 10px; }
  .mode .ico { font-size: 26px; }
  .title-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .btn { min-height: 48px; }
  #recBtn { width: 100%; }
  .mini { min-height: 40px; }
  .row { gap: 12px; align-items: flex-start; flex-direction: column; }
  .preview video { max-height: 38vh; }
  .t-box { max-height: 38vh; }
  .pip { width: min(46vw, 200px); right: calc(10px + env(safe-area-inset-right));
    bottom: calc(12px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(24px + env(safe-area-inset-bottom)); width: min(92vw, 420px);
    font-size: 13px; }
  .card { padding: 14px; }
}
