:root {
  --bg: #f4f5f7; --panel: #ffffff; --ink: #1d2433; --sub: #5b6475; --line: #dde1e8; --accent: #1f6feb; --accent-ink: #ffffff;
  --ok: #1a7f37; --warn: #b35900; --ng: #c62828; --rec: #d32f2f; --bar: #c9d3e3; --bar-spool: #9fb3d6; --motion: 211, 47, 47; --cursor: #111827;
  --radius: 10px; --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 2px 8px rgba(0, 0, 0, .04);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --panel: #181b22; --ink: #e8eaf0; --sub: #9aa3b5; --line: #2a2f3a; --accent: #4c8dff; --accent-ink: #0b0d12;
    --ok: #3fb950; --warn: #e3a03a; --ng: #ff6b6b; --rec: #ff5252; --bar: #3a4458; --bar-spool: #55698f; --motion: 255, 90, 90; --cursor: #ffffff;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif; -webkit-text-size-adjust: 100%; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }

.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 700; letter-spacing: .04em; display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--rec); box-shadow: 0 0 0 3px rgba(var(--motion), .18); }
.tabs { display: flex; gap: 4px; overflow-x: auto; }
.tabs a { padding: 6px 12px; border-radius: 999px; text-decoration: none; color: var(--sub); white-space: nowrap; }
.tabs a.on { background: var(--accent); color: var(--accent-ink); }
.notice { margin: 12px 16px 0; padding: 8px 12px; border-radius: var(--radius); background: rgba(227, 160, 58, .14); color: var(--ink); font-size: 13px; }
main { padding: 16px; max-width: 1400px; margin: 0 auto; outline: none; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 18px 0 8px; }
.muted { color: var(--sub); font-size: 13px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }

.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 7px 12px; cursor: pointer; min-height: 38px; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--ng); }
.btn.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=time], select, textarea {
  border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 7px 10px; min-height: 38px; max-width: 100%; }
textarea { width: 100%; min-height: 70px; }
label.field { display: grid; gap: 4px; font-size: 13px; color: var(--sub); }
label.field > input, label.field > select { color: var(--ink); }
label.check { display: inline-flex; gap: 6px; align-items: center; margin-right: 14px; }

.badge { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.badge.ok { color: var(--ok); } .badge.warn { color: var(--warn); } .badge.ng { color: var(--ng); }

/* ライブ */
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.cam { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.cam .vid { position: relative; aspect-ratio: 16 / 9; background: #000; cursor: zoom-in; }
.cam video, .cam .vid img { width: 100%; height: 100%; object-fit: contain; display: block; }
.cam .msg { position: absolute; inset: 0; display: grid; place-items: center; color: #ccc; font-size: 13px; text-align: center; padding: 12px; }
.cam .bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; }
.cam .name { font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.big { position: fixed; inset: 0; z-index: 20; background: #000; display: grid; grid-template-rows: auto 1fr; }
.big .bar { display: flex; gap: 8px; align-items: center; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); color: #fff; }
.big video, .big .stage img { width: 100%; height: 100%; object-fit: contain; }
.big .btn { background: #222; color: #fff; border-color: #444; }

/* 見返し */
.player { display: grid; gap: 12px; }
.screen { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; max-height: 70vh; width: 100%; }
.screen video { width: 100%; height: 100%; object-fit: contain; display: block; }
.screen .msg { position: absolute; inset: 0; display: grid; place-items: center; color: #ccc; text-align: center; padding: 12px; pointer-events: none; }
.clock { font-variant-numeric: tabular-nums; font-size: 20px; font-weight: 700; }
.timeline { position: relative; user-select: none; touch-action: none; }
.timeline canvas { display: block; width: 100%; height: 44px; border-radius: 6px; background: var(--bg); border: 1px solid var(--line); cursor: pointer; }
.timeline.zoom canvas { height: 56px; }
.ticks { display: flex; justify-content: space-between; font-size: 11px; color: var(--sub); font-variant-numeric: tabular-nums; margin-top: 2px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--sub); flex-wrap: wrap; }
.legend i { display: inline-block; width: 12px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }

/* 一覧の表 */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
th { color: var(--sub); font-weight: 500; font-size: 12px; }
.form { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.form .wide { grid-column: 1 / -1; }
.stack { display: grid; gap: 14px; }
.two { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 860px) { .two { grid-template-columns: 1fr; } }
.result { font-size: 13px; white-space: pre-wrap; }

.toast { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 8px 14px; border-radius: 8px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; }

@media (max-width: 600px) {
  main { padding: 12px; }
  .grid { grid-template-columns: 1fr; }
  .top { gap: 8px; }
  .clock { font-size: 17px; }
}

/* 部品に直接書かない見た目（安全の決まりで、ページの中の style は受け付けない） */
.row.head { margin-bottom: 12px; }
.row.head h2, .player .row.head h2 { margin: 0; }
.player .row.head { margin-bottom: 0; }
h3.first { margin-top: 0; }
.row.gap-top { margin-top: 12px; }
.big .stage { position: relative; min-height: 0; }
.big .msg { position: absolute; inset: 0; display: grid; place-items: center; color: #ccc; }
.legend i.sw-rec { background: var(--bar); }
.legend i.sw-spool { background: var(--bar-spool); }
.legend i.sw-motion { background: rgb(var(--motion)); }

/* 第 3 段階：ログイン・上の帯の名前・見られる人・見た記録 */
.who { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
/*
 * ログイン（2026-10-28 所有者「ほかのアプリのログイン画面のデザインや仕様に合わせて」）。
 * 形と色は KDS SIGNAGE の style.css の「ログイン」と同じ（KDS の共通テーマ：濃紺 #132330・オレンジ #e96d2f・青 #1f6fb2）。
 * このアプリの色（--accent など）とは別に、ログイン前の画面の中だけで同じ色の名前を置き直す。
 *   PC … 左に紺の紹介の面・右にログイン／〜900px … 紹介を上に積む／〜600px … 上に紺の帯（説明文とタグは隠す）
 *   開くたびに紹介の面を全画面で流す（.lv-splash。login.js の playSplash）
 */
.login-wrap, .lv-splash, .install-dialog {
  --l-panel: #ffffff; --l-border: #bcc8cf; --l-text: #17212a; --l-dim: #71808c; --l-good: #24956a; --l-bad: #b02a37; --l-warn: #9a6700; --l-warn-bg: #fff8e5;
  --l-accent: #1f6fb2; --l-accent-hover: #185a91; --l-accent-soft: #e8f1fa; --l-accent-strong: #185a91;
}
@media (prefers-color-scheme: dark) {
  .login-wrap, .lv-splash, .install-dialog {
    --l-panel: #18232c; --l-border: #465762; --l-text: #edf2f4; --l-dim: #9baab4; --l-good: #65c79a; --l-bad: #e5534b; --l-warn: #c69026; --l-warn-bg: #2b2416;
    --l-accent: #5aa2e6; --l-accent-hover: #7ab6ee; --l-accent-soft: #1a2b3b; --l-accent-strong: #7ab6ee;
  }
}
body.signed-out .top { display: none; }
body.signed-out main { padding: 0; max-width: none; }
.brand .brand-mark { width: 26px; height: 26px; border-radius: 7px; }
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.08fr .92fr; background: var(--l-panel); color: var(--l-text); }
.login-visual { position: relative; min-height: 100vh; padding: clamp(54px, 9vw, 150px); display: flex; align-items: center; overflow: hidden; color: #fff; background: #132330; }
.login-copy { position: relative; z-index: 2; }
.login-eyebrow { margin: 0; color: #f79561; font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.login-copy h1 { margin: 22px 0 24px; color: #fff; font-size: clamp(38px, 4.2vw, 66px); line-height: 1.27; letter-spacing: -.055em; }
.login-copy > p:not(.login-eyebrow) { margin: 0; color: #aebdc6; font-size: 15px; line-height: 2; }
.login-pills { margin-top: 48px; display: flex; flex-wrap: wrap; gap: 9px; }
.login-pills span { padding: 8px 12px; border: 1px solid rgba(255,255,255,.12); border-radius: 20px; color: #c7d1d7; background: rgba(255,255,255,.04); font-size: 13px; }
.login-panel { min-width: 0; padding: 50px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--l-panel); }
.login { width: min(420px, 100%); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 54px; }
.login-brand strong { font-size: 17px; }
.login-brand .brand-mark { width: 40px; height: 40px; border-radius: 9px; }
.login-secure { margin: 0 0 10px; color: var(--l-good); font-size: 13px; font-weight: 700; }
.login h1 { font-size: 28px; line-height: 1.45; letter-spacing: 0; margin: 0 0 7px; }
.login .sub { color: var(--l-dim); font-size: 15px; margin-bottom: 29px; }
.login label.field { display: block; margin: 18px 0 0; font-size: 14px; font-weight: 700; color: color-mix(in srgb, var(--l-text) 78%, var(--l-dim)); }
.login label.field > input { display: block; margin-top: 8px; }
.login input { width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid var(--l-border); border-radius: 10px; background: var(--l-panel); color: var(--l-text); font-size: 15px; }
.login input:focus { outline: none; border-color: var(--l-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--l-accent) 12%, transparent); }
.login button { width: 100%; min-height: 50px; margin-top: 22px; padding: 0 17px; display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--l-border);
  border-radius: 10px; background: var(--l-panel); color: var(--l-text); font-size: 15px; font-weight: 600; cursor: pointer; transition: background .15s ease, border-color .15s ease, color .15s ease; }
.login button:hover { background: var(--l-accent-soft); border-color: var(--l-accent); color: var(--l-accent-strong); }
.login button:disabled { opacity: .5; cursor: default; }
.login button::after { content: "\2192"; font-size: 19px; font-weight: 400; }
.login button.primary { background: var(--l-accent); border-color: var(--l-accent); color: #fff; box-shadow: 0 7px 18px rgba(31, 111, 178, .22); }
.login button.primary:hover { background: var(--l-accent-hover); border-color: var(--l-accent-hover); color: #fff; }
.login .msg { margin: 14px 0 0; padding: 10px 13px; border-radius: 9px; font-size: 14px; }
.login .msg.ok { background: var(--l-accent-soft); color: var(--l-accent); }
.login .msg.warn { background: var(--l-warn-bg); color: var(--l-warn); }
.login .msg.err { background: rgba(176, 42, 55, .1); color: var(--l-bad); }
.login-build { margin: 16px 0 0; color: var(--l-dim); font-size: 12px; text-align: center; }
.login button.login-install { width: fit-content; min-height: 38px; margin: 26px auto 0; padding: 0 14px; justify-content: center; gap: 7px; max-width: 100%;
  border: 1px solid color-mix(in srgb, var(--l-accent) 45%, transparent); border-radius: 9px; background: var(--l-accent-soft); color: var(--l-accent-strong); font-size: 13.5px; font-weight: 700; }
.login button.login-install:hover { border-color: var(--l-accent); background: color-mix(in srgb, var(--l-accent) 18%, var(--l-panel)); }
.login button.login-install::after { content: none; }
.login button.login-install svg { flex: none; }
.login input[type="search"] { margin-top: 4px; }
.login-names { display: grid; gap: 8px; margin-top: 14px; max-height: min(52vh, 460px); overflow-y: auto; padding: 2px; }
.login .login-names button { margin-top: 0; min-height: 48px; font-weight: 600; }
.login-none { margin: 8px 0; color: var(--l-dim); font-size: 14px; }
.login-chosen { margin-top: 4px; padding: 13px 16px; border: 1px solid var(--l-border); border-radius: 10px; background: var(--l-accent-soft); color: var(--l-accent-strong); font-size: 16px; font-weight: 700; }
.login button.login-alt { margin-top: 12px; border-color: transparent; background: transparent; color: var(--l-dim); justify-content: center; }
.login button.login-alt:hover { color: var(--l-accent-strong); background: var(--l-accent-soft); }
.login button.login-alt::after { content: none; }
.login button.login-passkey { justify-content: center; min-height: 46px; margin-top: 12px; background: transparent; }
.login button.login-passkey::after { content: none; }
.login-passkey-hint { margin: 14px 0 0; color: var(--l-dim); font-size: 12.5px; line-height: 1.7; text-align: center; overflow-wrap: anywhere; }
.login-passkey-hint a { color: var(--l-accent-strong); }
@media (max-width: 900px) {
  .login-wrap { display: block; }
  .login-visual { min-height: auto; padding: 36px 24px 30px; }
  .login-copy h1 { margin: 12px 0 10px; font-size: 30px; }
  .login-copy > p:not(.login-eyebrow) { font-size: 13.5px; line-height: 1.9; }
  .login-pills { margin-top: 16px; }
  .login-panel { min-height: auto; padding: 32px 20px 40px; justify-content: flex-start; }
  .login-brand { margin-bottom: 32px; }
}
@media (max-width: 600px) {
  .login-visual { padding: 18px 20px 16px; padding-top: max(18px, env(safe-area-inset-top)); }
  .login-eyebrow { font-size: 11px; }
  .login-copy h1 { margin: 6px 0 0; font-size: 20px; line-height: 1.4; letter-spacing: -.03em; }
  .login-copy .lv-line { display: inline-block; vertical-align: top; }
  .login-copy > p:not(.login-eyebrow), .login-pills { display: none; }
  .login-panel { padding-top: 22px; }
  .login-brand { margin-bottom: 26px; }
  .login h1 { font-size: 24px; }
}
/* 紹介の見出しの 2 行目の下線と、開いたときの全画面（サイネージと同じ動き） */
.lv-line { display: block; overflow: hidden; padding-bottom: .14em; margin-bottom: -.14em; }
.lv-line > span { display: inline-block; }
.lv-accent { position: relative; }
.lv-accent::after { content: ""; position: absolute; left: .02em; right: .5em; bottom: .02em; height: .08em; border-radius: 2px; background: #f79561; }
.login-visual.lv-splash { position: fixed; inset: 0; z-index: 1000; display: flex !important; justify-content: center; min-height: 100dvh; padding: 32px clamp(28px, 9vw, 150px); cursor: pointer;
  animation: lv-leave .5s ease 3.1s forwards; }
.login-visual.lv-splash.lv-leave-now { animation: lv-leave-now .35s ease forwards; }
.lv-splash .login-copy { width: min(760px, 100%); }
.lv-splash .login-copy h1 { margin: 22px 0 24px; font-size: clamp(32px, 9vw, 72px); line-height: 1.27; letter-spacing: -.055em; }
.lv-splash .login-eyebrow { font-size: 12px; }
.lv-splash .login-copy .lv-line { display: block; }
.lv-splash .login-copy > p:not(.login-eyebrow) { display: block; font-size: 15px; line-height: 2; }
.lv-splash .login-pills { display: flex; margin-top: 40px; }
.lv-splash .lv-line > span { transform: translateY(110%); animation: lv-rise .95s cubic-bezier(.2, .8, .2, 1) .25s forwards; }
.lv-splash .lv-line > span.lv-accent {
  background: linear-gradient(100deg, #fff 38%, #fbc4a6 46%, #f79561 50%, #fbc4a6 54%, #fff 62%) 100% 0 / 260% 100% no-repeat;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: lv-rise .95s cubic-bezier(.2, .8, .2, 1) .43s forwards, lv-shine 1.3s ease-in-out 1.75s forwards;
}
.lv-splash .lv-accent::after { transform: scaleX(0); transform-origin: left center; animation: lv-draw .75s cubic-bezier(.65, 0, .25, 1) 1.2s forwards; }
.lv-splash .login-eyebrow { animation: lv-fade .7s ease .05s both; }
.lv-splash .login-copy > p:not(.login-eyebrow) { animation: lv-fade .8s ease 1.0s both; }
.lv-splash .login-pills span { animation: lv-fade .6s ease both; }
.lv-splash .login-pills span:nth-child(1) { animation-delay: 1.25s; }
.lv-splash .login-pills span:nth-child(2) { animation-delay: 1.35s; }
.lv-splash .login-pills span:nth-child(3) { animation-delay: 1.45s; }
.lv-splash .login-pills span:nth-child(4) { animation-delay: 1.55s; }
@keyframes lv-rise { to { transform: translateY(0); } }
@keyframes lv-draw { to { transform: scaleX(1); } }
@keyframes lv-shine { from { background-position: 100% 0; } to { background-position: 0 0; } }
@keyframes lv-fade { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes lv-leave { to { opacity: 0; visibility: hidden; } }
@keyframes lv-leave-now { to { opacity: 0; visibility: hidden; } }
/* アイコンの作り方の小窓 */
.install-dialog { width: min(520px, calc(100vw - 32px)); border: 1px solid var(--l-border); border-radius: 14px; background: var(--l-panel); color: var(--l-text); padding: 20px; }
.install-dialog::backdrop { background: rgba(9, 18, 24, .55); }
.install-dialog h2 { margin: 0 0 8px; font-size: 18px; }
.install-dialog h3 { margin: 14px 0 4px; font-size: 14px; }
.inst-steps { margin: 0; padding-left: 1.4em; line-height: 1.8; font-size: 14px; }
.inst-more { margin-top: 12px; }
.inst-more summary { cursor: pointer; color: var(--l-accent-strong); font-size: 13.5px; font-weight: 700; }
.row.end { justify-content: flex-end; margin-top: 14px; }
input[type=search] { border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 7px 10px; min-height: 38px; }
.wide-btn { width: 100%; }
.msg { padding: 8px 12px; border-radius: 8px; font-size: 14px; }
.msg.err { background: rgba(198, 40, 40, .12); color: var(--ng); }
.msg.warn { background: rgba(227, 160, 58, .16); color: var(--ink); }
.small { font-size: 12px; }
body.signed-out .top .tabs, body.signed-out .top .who { display: none; }
.session-warn { position: fixed; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 30; background: var(--panel); border: 1px solid var(--warn);
  border-radius: var(--radius); padding: 12px 14px; box-shadow: 0 4px 20px rgba(0, 0, 0, .18); max-width: min(360px, calc(100% - 32px)); display: grid; gap: 8px; }
.session-warn p { margin: 0; }
.big.handoff { background: rgba(0, 0, 0, .55); place-items: center; grid-template-rows: 1fr; padding: 16px; }
.handoff-card { width: min(480px, 100%); }
.handoff-card h2 { margin: 0; }
.viewers { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 4px; }
.checks { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); margin: 8px 0; }
.seg { display: flex; gap: 4px; }
.seg .btn { text-decoration: none; color: var(--ink); display: inline-flex; align-items: center; }
.seg .btn.on { color: var(--accent-ink); }
.scroll { overflow-x: auto; }
@media (max-width: 600px) { .who { margin-left: 0; width: 100%; } }
