:root {
  --ink: #1d1d1f;
  --sub: #6e6e73;
  --line: #e5e5ea;
  --bg: #ffffff;
  --brand: #FFC000;
  --brand-ink: #2b2b2b;
  --rec: #ff3b30;
  --ok: #34c759;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #000; color: var(--ink); overscroll-behavior: none; }
body { font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
[hidden] { display: none !important; }
svg { width: 26px; height: 26px; display: block; }

.screen { position: fixed; inset: 0; overflow: hidden; }
.screen.light { background: var(--bg); }
.screen.dark { background: #000; color: #fff; }

/* ボタン */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 22px; border-radius: 16px; font-weight: 700; font-size: 17px; text-decoration: none; transition: transform .12s, opacity .12s; }
.btn:active { transform: scale(.97); opacity: .85; }
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.ghost { background: rgba(120,120,128,.16); color: inherit; }
.btn.big { width: 100%; min-height: 56px; }
.btn.wide { width: 100%; margin-top: 10px; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* ログイン */
.login-box { max-width: 360px; margin: 0 auto; padding: calc(18vh + var(--safe-t)) 24px 24px; text-align: center; }
.login-icon { width: 88px; height: 88px; border-radius: 22px; }
.login-box h1 { font-size: 30px; margin: 18px 0 6px; letter-spacing: .02em; }
.lead { color: var(--sub); margin: 0 0 36px; }
.err { color: #c62828; font-size: 14px; margin-top: 16px; }

/* 撮る */
#live, #play { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
#live.mirror { transform: scaleX(-1); }
.cam-top { position: absolute; left: 0; right: 0; top: 0; padding: calc(var(--safe-t) + 12px) 16px 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: linear-gradient(rgba(0,0,0,.45), transparent); }
.round { width: 44px; height: 44px; border-radius: 50%; background: rgba(0,0,0,.35); display: grid; place-items: center; margin-left: auto; }
.round svg { width: 24px; height: 24px; }
.pill { height: 34px; padding: 0 14px; border-radius: 17px; background: rgba(0,0,0,.5); font-size: 14px; font-weight: 600; white-space: nowrap; max-width: 62vw; overflow: hidden; text-overflow: ellipsis; position: relative; }
.pill .bar { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--brand); border-radius: 2px; transition: width .3s; }
.pill.ok { background: rgba(52,199,89,.9); color: #fff; }
.pill.warn { background: #fff; color: var(--brand-ink); padding-left: 28px; }
.pill.wait { background: rgba(255,255,255,.92); color: var(--brand-ink); padding-left: 28px; }
.pill.wait::before { content: ""; position: absolute; left: 12px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: #8e8e93; }
.pill.warn::before { content: ""; position: absolute; left: 12px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--rec); }
.timer { position: absolute; left: 50%; transform: translateX(-50%); top: calc(var(--safe-t) + 16px); display: flex; align-items: center; gap: 8px; padding: 4px 12px; border-radius: 8px; background: var(--rec); font-weight: 700; font-variant-numeric: tabular-nums; font-size: 17px; }
.timer i { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }

/* 広告の尺の目印 */
.marks { position: absolute; left: 0; right: 0; top: calc(var(--safe-t) + 60px); display: flex; justify-content: center; gap: 6px; }
.marks span { font-size: 14px; font-weight: 700; padding: 4px 11px; border-radius: 12px; background: rgba(0,0,0,.5); color: rgba(255,255,255,.8); transition: background .25s, color .25s, transform .25s; }
.marks span.now { color: #fff; box-shadow: inset 0 0 0 1.5px var(--brand); animation: nudge 1s infinite; }
.marks span.on { background: var(--brand); color: var(--brand-ink); }
@keyframes nudge { 50% { transform: scale(1.06); } }

.cam-bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 20px 24px calc(var(--safe-b) + 26px); display: flex; align-items: center; justify-content: space-between; background: linear-gradient(transparent, rgba(0,0,0,.5)); }
.side { width: 64px; display: flex; flex-direction: column; align-items: center; gap: 2px; color: #fff; cursor: pointer; }
.side small { font-size: 11px; opacity: .85; }
.rec { width: 82px; height: 82px; border-radius: 50%; border: 5px solid #fff; display: grid; place-items: center; }
.rec i { width: 64px; height: 64px; border-radius: 50%; background: var(--rec); transition: all .2s cubic-bezier(.3,.7,.3,1); }
.rec.on i { width: 30px; height: 30px; border-radius: 7px; }
.rec:active i { transform: scale(.92); }
.rec[disabled] { opacity: .4; }
.rec { position: relative; }
.rec.flash::after { content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 4px solid var(--brand); animation: ring .7s ease-out forwards; }
@keyframes ring { from { opacity: 1; transform: scale(.92); } to { opacity: 0; transform: scale(1.18); } }

.cam-msg { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; padding: 24px; gap: 18px; }
.cam-msg p { margin: 0; color: #fff; white-space: pre-line; line-height: 1.7; }

/* 見る */
.sheet { position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 16px calc(var(--safe-b) + 18px); background: linear-gradient(transparent, rgba(0,0,0,.75) 28%); }
.seek { position: relative; height: 28px; margin: 0 2px 4px; cursor: pointer; touch-action: none; }
.seek::before { content: ""; position: absolute; left: 0; right: 0; top: 12px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.3); }
.seek-fill { position: absolute; left: 0; top: 12px; height: 4px; border-radius: 2px; background: #fff; width: 0; }
#seekMarks i { position: absolute; top: 8px; width: 2px; height: 12px; margin-left: -1px; background: var(--brand); border-radius: 1px; }
.paused { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); width: 76px; height: 76px; border-radius: 50%; background: rgba(0,0,0,.5); color: #fff; display: grid; place-items: center; font-size: 30px; padding-left: 6px; cursor: pointer; }
.info { margin: 0 0 10px; font-size: 14px; color: rgba(255,255,255,.85); text-align: center; }
.info b { color: var(--brand); }
.memo { width: 100%; height: 46px; border-radius: 12px; border: 0; padding: 0 14px; font: inherit; font-size: 16px; background: rgba(255,255,255,.14); color: #fff; margin-bottom: 10px; outline: none; }
.memo::placeholder { color: rgba(255,255,255,.55); }
.memo:focus { background: rgba(255,255,255,.22); }
.row { display: flex; gap: 10px; }
.row .btn { flex: 1; }
.row .btn.primary { flex: 1.6; }
.dark .btn.ghost { background: rgba(255,255,255,.16); color: #fff; }

/* 一覧・メニュー */
.panel { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: flex-end; z-index: 10; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.panel-card { width: 100%; max-width: 560px; margin: 0 auto; background: #fff; color: var(--ink); border-radius: 20px 20px 0 0; padding: 18px 16px calc(var(--safe-b) + 18px); max-height: 80vh; overflow: auto; animation: up .25s cubic-bezier(.3,.7,.3,1); }
@keyframes up { from { transform: translateY(40px); } }
.panel-head { display: flex; align-items: center; justify-content: space-between; font-size: 18px; }
.x { width: 36px; height: 36px; border-radius: 50%; background: #f2f2f7; font-size: 20px; line-height: 1; }
.panel-note { color: var(--sub); font-size: 14px; margin: 4px 0 8px; }
#queueList { list-style: none; margin: 0; padding: 0; }
#queueList li { padding: 12px 0; border-top: 1px solid var(--line); }
#queueList .t { display: flex; justify-content: space-between; gap: 10px; font-size: 15px; }
#queueList .t b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#queueList .s { font-size: 13px; color: var(--sub); margin-top: 2px; }
#queueList .s.bad { color: #c62828; }
#queueList .prog { height: 4px; background: #f2f2f7; border-radius: 2px; margin-top: 8px; overflow: hidden; }
#queueList .prog i { display: block; height: 100%; background: var(--brand); }
#queueList a, #queueList button.mini { font-size: 14px; color: var(--ink); font-weight: 700; text-decoration: underline; text-decoration-color: var(--brand); text-decoration-thickness: 2px; text-underline-offset: 3px; padding: 0; }
.empty { color: var(--sub); text-align: center; padding: 24px 0; }

.toast.low { top: auto; bottom: calc(var(--safe-b) + 150px); }
.toast { position: fixed; left: 50%; top: calc(var(--safe-t) + 64px); transform: translateX(-50%); background: rgba(29,29,31,.92); color: #fff; padding: 10px 18px; border-radius: 14px; font-size: 15px; font-weight: 600; z-index: 20; max-width: 88vw; text-align: center; animation: fade .2s; }
.ai-title { font-size: 14px; color: var(--sub); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
