/*
 * 手話動画録画システム共通CSS
 *
 * 録画ページ（index.html）:
 * ログイン画面、録画フレーム、お手本動画モーダル、操作ボタン、完了・初期化ダイアログ、フッターの表示を定義。
 *
 * 録画データ一覧ページ（videos.php）:
 * body.videos-page 配下で、管理ログイン、動画一覧グリッド、再生カード、操作ボタン、レスポンシブ表示を定義。
 */
:root {
  color-scheme: light;
  --bg: #eef3f8;
  --ink: #17212f;
  --muted: #526274;
  --line: #c8d4e2;
  --accent: #2f6fb8;
  --danger: #b7553c;
  --record: #c95757;
  --stop: #5e6975;
  --success: #087f69;
  --warn: #a96816;
  --surface: #ffffff;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  position: relative;
  isolation: isolate;
  margin: 0;
  min-height: 100svh;
  background: #f5ede1;
  color: var(--ink);
  display: flex;
  flex-direction: column;
}
body:not(.videos-page)::before {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  z-index: -1;
  width: min(992px, calc(100% - 32px));
  background: #fff;
  box-shadow: 0 0 28px rgb(88 72 52 / 0.08);
  content: "";
  transform: translateX(-50%);
}
main {
  width: min(992px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 16px;
  background: #fff;
  box-shadow: 0 0 28px rgb(88 72 52 / 0.08);
}
.app {
  --recorder-frame-width: 800px;
  --recorder-frame-ratio: 800 / 600;
  flex: 1;
  padding-top: 16px;
  padding-bottom: 0;
  background: transparent;
  box-shadow: none;
}
header {
  width: min(100%, var(--recorder-frame-width));
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}
h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 750;
  letter-spacing: 0;
}
.logo-title {
  display: flex;
  align-items: center;
}
.site-logo {
  display: block;
  width: 370px;
  max-width: 100%;
  height: auto;
}
.login-logo {
  width: 370px;
}
.login {
  display: grid;
  flex: 1;
  place-items: center;
  padding: 24px;
}
.login-panel {
  width: min(480px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 50px rgb(92 111 132 / 0.12);
}
.login-panel h1 {
  justify-content: center;
  margin-bottom: 10px;
}
.login-panel .status {
  text-align: center;
}

.login-panel .error {
  color: var(--danger);
  text-align: center;
}
.login-panel .primary {
  display: flex;
  width: fit-content;
  margin-inline: auto;
  margin-top: 14px;
}
.field {
  display: grid;
  gap: 8px;
  margin-top: 22px;
}
label {
  font-size: 14px;
  font-weight: 700;
}
input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  font: inherit;
}
input:focus {
  border-color: var(--accent);
  outline: 3px solid rgb(47 111 184 / 0.2);
}
.status {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
}
.user-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.user-panel {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 8px;
}
.remaining-chip {
  display: none;
  align-items: center;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid #a9d0c5;
  border-radius: 999px;
  background: #e8f6f2;
  color: var(--success);
  font-size: 13px;
  font-weight: 800;
}
.logout-btn,
.admin-reset-btn {
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
}
.admin-reset-btn {
  display: none;
  border-color: #dfb8aa;
  color: var(--danger);
}
.sample-action {
  position: absolute;
  bottom: 114px;
  left: 50%;
  z-index: 3;
  width: min(calc(100% - 28px), 520px);
  display: flex;
  transform: translateX(-50%);
}
.sample-action button {
  width: 100%;
  padding-block: 16px;
}
.sample-action .primary {
  border-color: #228ecf;
  background: #228ecf;
  box-shadow: 0 10px 24px rgb(34 142 207 / 0.28);
}
.sample-btn-content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.sample-btn-content > i {
  flex: 0 0 auto;
  font-size: 24px;
}
#sampleBtn:not(:disabled) {
  animation: sample-attention-pulse 1.2s ease-in-out infinite;
}
#sampleBtn:not(:disabled) .sample-btn-content {
  animation: record-attention-content 1.2s ease-in-out infinite;
}
@keyframes sample-attention-pulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 8px 24px rgb(15 23 42 / 0.22), 0 2px 7px rgb(15 23 42 / 0.12);
  }
  50% {
    transform: scale(1.035);
    box-shadow: 0 0 0 7px rgb(34 142 207 / 0.16), 0 0 24px 8px rgb(34 142 207 / 0.32);
  }
}
.sample-button-copy {
  display: grid;
  gap: 2px;
  line-height: 1.25;
  text-align: center;
}
.sample-button-copy small {
  font-size: 12px;
  font-weight: 700;
}
.sample-action[hidden] {
  display: none;
}
.stage {
  position: relative;
  overflow: hidden;
  width: min(100%, var(--recorder-frame-width));
  margin-inline: auto;
  aspect-ratio: var(--recorder-frame-ratio);
  background: #182231;
  box-shadow: 0 6px 14px rgb(37 52 70 / 0.2), 0 18px 40px rgb(90 112 138 / 0.16);
}
.capture-label {
  position: absolute;
  top: 20px;
  left: 54px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 112px;
  min-height: 32px;
  padding: 7px 10px;
  border-radius: 6px;
  background: #44403f;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
  text-shadow: 0 1px 3px rgb(0 0 0 / 0.35);
}
.capture-idle,
.capture-recording,
.capture-reviewing {
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
}
.capture-idle {
  display: inline-flex;
}
.capture-recording,
.capture-reviewing {
  display: none;
}
.capture-reviewing i {
  color: var(--accent);
  animation: recording-blink 1s ease-in-out infinite;
}
.recording-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f04f5f;
  box-shadow: 0 0 0 3px rgb(240 79 95 / 0.2), 0 0 10px rgb(240 79 95 / 0.75);
  animation: recording-blink 1s ease-in-out infinite;
}
.stage.recording .capture-idle {
  display: none;
}
.stage.recording .capture-recording {
  display: inline-flex;
}
.stage.reviewing .capture-idle {
  display: none;
}
.stage.reviewing .capture-reviewing {
  display: inline-flex;
}
@keyframes recording-blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.25;
  }
}
.viewfinder-corners {
  position: absolute;
  inset: 12px;
  z-index: 2;
  pointer-events: none;
}
.viewfinder-corner {
  position: absolute;
  width: 30px;
  height: 30px;
  filter: drop-shadow(0 1px 3px rgb(0 0 0 / 0.55));
}
.viewfinder-corner.top-left {
  top: 0;
  left: 0;
  border-top: 3px solid rgb(255 255 255 / 0.9);
  border-left: 3px solid rgb(255 255 255 / 0.9);
}
.viewfinder-corner.top-right {
  top: 0;
  right: 0;
  border-top: 3px solid rgb(255 255 255 / 0.9);
  border-right: 3px solid rgb(255 255 255 / 0.9);
}
.viewfinder-corner.bottom-left {
  bottom: 0;
  left: 0;
  border-bottom: 3px solid rgb(255 255 255 / 0.9);
  border-left: 3px solid rgb(255 255 255 / 0.9);
}
.viewfinder-corner.bottom-right {
  right: 0;
  bottom: 0;
  border-right: 3px solid rgb(255 255 255 / 0.9);
  border-bottom: 3px solid rgb(255 255 255 / 0.9);
}
.recorder-shell {
  width: min(100%, var(--recorder-frame-width));
  margin-inline: auto;
}
canvas,
#playback {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #182231;
}
.stage.sample-pending::before {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgb(23 34 48 / 0.45);
  content: "";
  pointer-events: none;
}
#playback {
  display: none;
}
.countdown {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: none;
  place-items: center;
  background: rgb(23 34 48 / 0.45);
  color: #fff;
  font-size: clamp(80px, 18vw, 160px);
  font-weight: 800;
}
.controls {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 0.9fr 0.9fr 1.2fr;
  align-items: stretch;
  gap: 10px;
  margin-top: 12px;
}
button {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgb(85 103 126 / 0.06);
  opacity: 1;
  filter: none;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, opacity 160ms ease, filter 160ms ease;
}
button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: #b9c6d6;
  box-shadow: 0 8px 18px rgb(85 103 126 / 0.12);
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  filter: saturate(0.65);
}
button:not(:disabled) {
  opacity: 1;
  filter: none;
}
.sample-action button,
.record-btn,
.stop-btn,
.send-btn {
  min-height: 62px;
  font-size: 17px;
  padding-inline: 14px;
}
.review-btn,
.redo-btn {
  min-height: 44px;
  align-self: center;
  font-size: 13px;
  padding-inline: 8px;
}
.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 24px rgb(47 111 184 / 0.24);
}
.dialog-ok-btn {
  min-width: 96px;
  min-height: 48px;
  padding: 0 28px;
  border-color: #2f6fb8;
  border-bottom-color: #24548d;
  border-bottom-width: 4px;
  border-radius: 9px;
  box-shadow: 0 8px 16px rgb(47 111 184 / 0.3);
  font-size: 16px;
}
.dialog-ok-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 20px rgb(47 111 184 / 0.34);
}
.dialog-ok-btn:active:not(:disabled) {
  transform: translateY(1px);
  border-bottom-width: 2px;
  box-shadow: 0 5px 10px rgb(47 111 184 / 0.24);
}
.record-btn {
  border-color: var(--record);
  background: var(--record);
  color: #fff;
  font-size: 17px;
  box-shadow: 0 12px 24px rgb(201 87 87 / 0.28);
}
.record-btn.record-attention:not(:disabled) {
  position: relative;
  z-index: 2;
  animation: record-attention-pulse 1.2s ease-in-out infinite;
}
/* お手本動画モーダル終了ボタン：共通ボタン設定より優先 */
body:not(.videos-page) #closeSampleBtn {
  width: auto !important;
  min-height: 36px !important;
  height: auto !important;
  padding: 5px 20px !important;
  border: 1px solid #5f6b78 !important;
  border-radius: 999px !important;
  background: #5f6b78 !important;
  color: #fff !important;
  box-shadow: 0 8px 24px rgb(15 23 42 / 0.22), 0 2px 7px rgb(15 23 42 / 0.12) !important;
}
body:not(.videos-page) #closeSampleBtn:hover:not(:disabled) {
  border-color: #4c5661 !important;
  background: #4c5661 !important;
}
.record-btn-content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.record-btn.record-attention:not(:disabled) .record-btn-content {
  animation: record-attention-content 1.2s ease-in-out infinite;
}
@keyframes record-attention-pulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 8px 24px rgb(15 23 42 / 0.22), 0 2px 7px rgb(15 23 42 / 0.12);
  }
  50% {
    transform: scale(1.035);
    box-shadow: 0 0 0 7px rgb(201 87 87 / 0.16), 0 0 24px 8px rgb(201 87 87 / 0.32);
  }
}
@keyframes record-attention-content {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.9662);
  }
}
.stop-btn {
  border-color: var(--stop);
  background: var(--stop);
  color: #fff;
}
.review-btn {
  border-color: var(--accent);
  color: var(--accent);
}
.redo-btn {
  border-color: #d8b36f;
  color: var(--warn);
}
.send-btn {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}
/* 録画ページ（index.html）のボタンに共通する立体表現 */
body:not(.videos-page) button {
  box-shadow: 0 5px 14px rgb(55 75 98 / 0.3), 0 2px 6px rgb(55 75 98 / 0.3);
}
body:not(.videos-page) button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 9px 22px rgb(55 75 98 / 0.22), 0 3px 8px rgb(55 75 98 / 0.12);
}
body:not(.videos-page) button:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 3px 9px rgb(55 75 98 / 0.16);
}
body:not(.videos-page) .sample-replay-link {
  position: absolute;
  bottom: 35px;
  right: 40px;
  left: auto;
  z-index: 3;
  width: auto;
  min-height: 0;
  padding: 3px 15px;
  border: 0;
  border-radius: 15px;
  background: rgb(34 142 207 / 0.42);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 6px 16px rgb(0 0 0 / 0.5), 0 2px 6px rgb(0 0 0 / 0.34);
  transform: none;
}
body:not(.videos-page) .sample-replay-link[hidden] {
  display: none;
}
body:not(.videos-page) .sample-replay-link:hover:not(:disabled) {
  border: 0;
  background: rgb(34 142 207 / 0.56);
  box-shadow: 0 8px 20px rgb(0 0 0 / 0.58), 0 3px 8px rgb(0 0 0 / 0.38);
  transform: none;
}
body:not(.videos-page) .sample-replay-link:active:not(:disabled) {
  box-shadow: 0 3px 10px rgb(0 0 0 / 0.46);
  transform: none;
}
.danger {
  border-color: #dfb8aa;
  color: var(--danger);
}
/* 録画ページ：青・赤・ニュートラルの3系統に整理したモダン配色 */
body:not(.videos-page) {
  --ui-primary: #228ecf;
  --ui-primary-dark: #1977ad;
  --ui-record: #c95757;
  --ui-record-dark: #ad4747;
  --ui-send: #739f3f;
  --ui-send-dark: #638c34;
  --ui-neutral: #5f6b78;
  --ui-neutral-dark: #4c5661;
  --ui-border: #cbd5df;
}
body:not(.videos-page) button:not(.sample-replay-link) {
  border-radius: 10px;
  box-shadow: 0 8px 24px rgb(15 23 42 / 0.22), 0 2px 7px rgb(15 23 42 / 0.12);
}
body:not(.videos-page) button:not(.sample-replay-link):hover:not(:disabled) {
  box-shadow: 0 9px 20px rgb(15 23 42 / 0.17);
}
body:not(.videos-page) button:not(.sample-replay-link):disabled {
  opacity: 0.4;
  filter: saturate(0.45);
  box-shadow: none;
}
body:not(.videos-page) .primary,
body:not(.videos-page) .sample-action .primary {
  border-color: var(--ui-primary);
  background: var(--ui-primary);
  color: #fff;
}
body:not(.videos-page) .primary:hover:not(:disabled),
body:not(.videos-page) .sample-action .primary:hover:not(:disabled) {
  border-color: var(--ui-primary-dark);
  background: var(--ui-primary-dark);
}
body:not(.videos-page) .record-btn {
  border-color: var(--ui-record);
  background: var(--ui-record);
  color: #fff;
}
body:not(.videos-page) .record-btn:hover:not(:disabled) {
  border-color: var(--ui-record-dark);
  background: var(--ui-record-dark);
}
body:not(.videos-page) .send-btn {
  border-color: var(--ui-send);
  background: var(--ui-send);
  color: #fff;
}
body:not(.videos-page) .send-btn:hover:not(:disabled) {
  border-color: var(--ui-send-dark);
  background: var(--ui-send-dark);
  color: #fff;
}
body:not(.videos-page) .completion-panel > i {
  color: var(--ui-send-dark);
}
body:not(.videos-page) .stop-btn {
  border-color: var(--ui-neutral);
  background: var(--ui-neutral);
  color: #fff;
}
body:not(.videos-page) .stop-btn:hover:not(:disabled) {
  border-color: var(--ui-neutral-dark);
  background: var(--ui-neutral-dark);
}
body:not(.videos-page) .review-btn {
  border-color: var(--ui-primary);
  background: #fff;
  color: var(--ui-primary);
}
body:not(.videos-page) .logout-btn {
  border-color: var(--ui-border);
  background: #fff;
  color: var(--ui-neutral-dark);
}
body:not(.videos-page) .review-btn:hover:not(:disabled) {
  background: #edf7fc;
}
body:not(.videos-page) .logout-btn:hover:not(:disabled) {
  background: #f3f5f7;
}
body:not(.videos-page) .redo-btn {
  border-color: var(--ui-record);
  background: #fff;
  color: var(--ui-record-dark);
}
body:not(.videos-page) .redo-btn:hover:not(:disabled) {
  border-color: var(--ui-record-dark);
  background: #fff1f1;
  color: var(--ui-record-dark);
}
body:not(.videos-page) .danger,
body:not(.videos-page) .admin-reset-btn {
  border-color: #e3b0b0;
  background: #fff;
  color: var(--ui-record-dark);
}
body:not(.videos-page) #closeSampleBtn {
  min-height: 36px;
  padding: 5px 20px;
  border-color: var(--ui-neutral);
  border-radius: 999px;
  background: var(--ui-neutral);
  color: #fff;
}
body:not(.videos-page) #closeSampleBtn:hover:not(:disabled) {
  border-color: var(--ui-neutral-dark);
  background: var(--ui-neutral-dark);
  color: #fff;
}
body:not(.videos-page) .dialog-ok-btn {
  border-color: var(--ui-primary);
  border-bottom-width: 1px;
  background: var(--ui-primary);
  color: #fff;
}
body:not(.videos-page) .remaining-chip {
  border-color: #e5b7b7;
  background: #fff1f1;
  color: var(--ui-record-dark);
}
body:not(.videos-page) .user-chip {
  border-color: var(--ui-border);
  background: #fff;
  color: var(--ui-neutral-dark);
}
.meta {
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}
#cameraVideo {
  display: none;
}
.app[hidden],
.login[hidden],
.modal[hidden] {
  display: none;
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgb(24 34 48 / 0.72);
}
.completion-dialog {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgb(24 34 48 / 0.56);
}
.completion-dialog[hidden] {
  display: none;
}
.completion-panel {
  width: min(520px, 100%);
  padding: 26px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  text-align: center;
  box-shadow: 0 22px 60px rgb(85 103 126 / 0.18);
}
.completion-panel i {
  color: var(--success);
  font-size: 36px;
  margin-bottom: 12px;
}
.completion-panel p {
  margin: 0 0 18px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.7;
}
.password-input {
  width: 100%;
  min-height: 46px;
  margin: 4px 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  font: inherit;
}
.dialog-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}
.modal-panel {
  width: min(960px, 100%);
  max-height: calc(100svh - 36px);
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 8px;
  background: var(--surface);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.modal-head h2 {
  margin: 0;
  font-size: 18px;
}
.sample-video-frame {
  width: 100%;
  max-width: 100%;
  max-height: calc(100svh - 170px);
  aspect-ratio: 4 / 3;
  justify-self: center;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #111827;
}
#sampleVideo {
  width: 100%;
  height: 100%;
  background: #182231;
  object-fit: contain;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.sample-video-frame.blackout #sampleVideo {
  visibility: hidden;
}
.site-footer {
  margin-top: auto;
  padding: 14px 16px 24px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}
.footer-rights {
  margin-left: 10px;
}
/* 横幅1280px以上：高さに応じて録画UIを600～960pxの範囲で連続調整 */
@media (min-width: 1280px) {
  body:not(.videos-page)::before {
    width: min(1040px, calc(100% - 32px));
  }
  .app:not([hidden]) {
    flex: 0 0 auto;
    margin-top: auto;
  }
  main.app:not([hidden]) {
    width: min(1040px, calc(100% - 32px));
  }
  .app:not([hidden]) > header,
  .app:not([hidden]) .stage,
  .app:not([hidden]) .recorder-shell {
    width: min(
      100%,
      clamp(
        min(var(--recorder-frame-width), 600px),
        calc(133.333svh - 426.66px),
        calc(var(--recorder-frame-width) + 160px)
      )
    );
  }
}
@media (max-width: 720px) {
  body {
    background: #fff;
  }
  body:not(.videos-page)::before {
    width: 100%;
    box-shadow: none;
  }
  main {
    width: 100%;
    padding: 18px 16px;
  }
  .app {
    padding-top: 16px;
    padding-bottom: 0;
  }
  .site-logo,
  .login-logo {
    width: 95%;
    max-width: 450px;
    margin-top: 10px;
  }
  .site-logo {
    width: 100%;
  }
  .logo-title > a {
    display: block;
    width: 100%;
    max-width: 450px;
  }
  .logo-title > a .site-logo {
    max-width: none;
  }
  body:not(.videos-page) .sample-replay-link,
  body:not(.videos-page) .sample-replay-link:hover:not(:disabled),
  body:not(.videos-page) .sample-replay-link:active:not(:disabled) {
    right: auto;
    bottom: 20px;
    left: 50%;
    width: max-content;
    max-width: none;
    white-space: nowrap;
    transform: translateX(-50%);
  }
  .capture-label {
    right: auto;
    left: 50%;
    transform: translateX(-50%);
  }
  .logo-title,
  header > div:first-child {
    width: 100%;
    display: flex;
    justify-content: center;
  }
  header,
  .modal-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    justify-items: center;
    text-align: center;
  }
  .user-panel {
    justify-content: center;
  }
  .site-footer {
    display: grid;
    gap: 2px;
  }
  .footer-rights {
    margin-left: 0;
  }
  .controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .record-btn,
  .stop-btn,
  .send-btn {
    grid-column: 1 / -1;
  }
  .review-btn {
    grid-column: 1;
  }
  .redo-btn {
    grid-column: 2;
  }
}
/* 録画データ一覧ページ（videos.php）用CSS */
body.videos-page {
  display: block;
}
body.videos-page main {
  width: min(1152px, calc(100% - 32px));
  padding: 28px 16px;
  background: #fff;
}
body.videos-page header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 18px;
}
body.videos-page p {
  color: var(--muted);
}
body.videos-page .login {
  min-height: 100svh;
}
body.videos-page .login-panel h1,
body.videos-page .login-panel .status {
  text-align: center;
}
body.videos-page .login-panel {
  background: #fff;
}
body.videos-page .login-panel .primary {
  display: flex;
  width: fit-content;
  margin-inline: auto;
  margin-top: 14px;
  border-color: #228ecf;
  border-radius: 10px;
  background: #228ecf;
  color: #fff;
  box-shadow: 0 8px 24px rgb(15 23 42 / 0.22), 0 2px 7px rgb(15 23 42 / 0.12);
}

body.videos-page .login-panel .primary:hover:not(:disabled) {
  border-color: #1977ad;
  background: #1977ad;
  color: #fff;
  box-shadow: 0 8px 24px rgb(15 23 42 / 0.22), 0 2px 7px rgb(15 23 42 / 0.12);
}
body.videos-page input[type="password"] {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  font: inherit;
}
body.videos-page input[type="password"]:focus {
  border-color: var(--accent);
  outline: 3px solid rgb(47 111 184 / 0.2);
}
body.videos-page .header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
body.videos-page .history-actions {
  display: flex;
  margin: 0;
}
body.videos-page .history-download-btn {
  width: auto;
  padding-inline: 14px;
  border-color: #c5d0dc;
  background: #e4e9ef;
  color: #34465a;
  font-weight: 700;
  box-shadow: 0 4px 10px rgb(55 75 98 / 0.12);
}
body.videos-page .history-download-btn:hover:not(:disabled) {
  border-color: #b4c1cf;
  background: #d8e0e8;
  box-shadow: 0 7px 14px rgb(55 75 98 / 0.16);
}

@media (min-width: 761px) {
  body.videos-page main > header {
    width: 100%;
    margin-right: 0;
    margin-left: 0;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 32px;
  }

  body.videos-page .header-actions {
    align-items: stretch;
    margin-top: 0;
    margin-left: auto !important;
  }

  body.videos-page .header-actions form {
    display: flex;
    margin: 0;
  }

  body.videos-page .header-actions button {
    height: 48px;
    min-height: 48px;
    margin: 0;
  }
}

body.videos-page .toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
}

body.videos-page .video-summary-row {
  display: flex;
  align-items: center;
  min-height: 24px;
  margin-bottom: 15px;
}

body.videos-page .video-count {
  margin: 0 15px 0 auto;
  color: var(--muted);
  font-size: 16px;
  text-align: right;
}
/* 録画データ一覧：操作内容を色で判別しやすくする */
body.videos-page .toolbar button {
  flex: 0 0 210px;
  width: 210px;
  min-height: 68px;
  padding: 8px 14px;
  border-color: transparent;
  color: #fff;
  font-weight: 800;
  line-height: 1.35;
  box-shadow: 0 5px 14px rgb(55 75 98 / 0.22);
}
body.videos-page .toolbar button i {
  font-size: 18px;
}
body.videos-page .toolbar button[name^="download_"] {
  background: #477fbd;
}
body.videos-page .toolbar button[name^="download_"]:hover:not(:disabled) {
  border-color: transparent;
  background: #255d9b;
  box-shadow: 0 8px 18px rgb(47 111 184 / 0.3);
}
body.videos-page .toolbar .danger {
  background: #c95f5f;
  color: #fff;
}
body.videos-page .toolbar .danger:hover:not(:disabled) {
  border-color: transparent;
  background: #aa3f3f;
  box-shadow: 0 8px 18px rgb(170 63 63 / 0.28);
}
body.videos-page .toolbar button:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 3px 8px rgb(55 75 98 / 0.2);
}
body.videos-page .delete-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-left: auto;
}
body.videos-page .message {
  margin: 0 0 0 20px;
  color: var(--success);
}
body.videos-page .error {
  color: var(--danger);
}
body.videos-page .empty {
  padding: 28px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
body.videos-page .grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
body.videos-page .item {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgb(85 103 126 / 0.08);
}
body.videos-page .select-row {
  display: flex;
  align-items: start;
  gap: 8px;
}
body.videos-page .select-row input[type="checkbox"] {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 3px 0 0;
  accent-color: var(--accent);
}
body.videos-page .name {
  display: block;
  overflow-wrap: anywhere;
  font-weight: 750;
}
body.videos-page .meta {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}
body.videos-page video {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  background: #182231;
}
@media (max-width: 760px) {
  body.videos-page header {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
  body.videos-page header > div:first-child {
    display: block;
    width: 100%;
  }
  body.videos-page header h1 {
    margin-bottom: 6px;
  }
  body.videos-page header p {
    margin: 0;
  }
  body.videos-page .toolbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: center;
  }
  body.videos-page .toolbar button {
    width: 100%;
    min-width: 0;
  }
  body.videos-page .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  body.videos-page .item {
    padding: 10px;
  }
  body.videos-page .delete-actions {
    display: contents;
    margin-left: 0;
  }
  body.videos-page main {
    width: 100%;
    padding: 18px 16px;
  }
}
/* 録画ページ：ボタンと動画フレームの共通シャドウ */
body:not(.videos-page) button:not(.sample-replay-link),
body:not(.videos-page) .stage {
  box-shadow: 0 8px 24px rgb(15 23 42 / 0.22), 0 2px 7px rgb(15 23 42 / 0.12);
}
body:not(.videos-page) button:not(.sample-replay-link):hover:not(:disabled),
body:not(.videos-page) button:not(.sample-replay-link):active:not(:disabled) {
  box-shadow: 0 8px 24px rgb(15 23 42 / 0.22), 0 2px 7px rgb(15 23 42 / 0.12);
}

/* 両ログイン画面で完全に共通の送信ボタン */
body .login-panel button.primary[type="submit"] {
  display: flex;
  width: fit-content;
  min-height: 48px;
  margin: 14px auto 0;
  padding: 0 16px;
  border: 1px solid #228ecf;
  border-radius: 10px;
  background: #228ecf;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 8px 24px rgb(15 23 42 / 0.22), 0 2px 7px rgb(15 23 42 / 0.12);
}

body .login-panel button.primary[type="submit"]:hover:not(:disabled) {
  border-color: #1977ad;
  background: #1977ad;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgb(15 23 42 / 0.22), 0 2px 7px rgb(15 23 42 / 0.12);
}

body .login-panel button.primary[type="submit"]:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 4px 12px rgb(15 23 42 / 0.18);
}

/* 録画ページ：システム管理モーダル */
.admin-login-password[hidden] {
  display: none;
}
.admin-system-panel {
  width: min(620px, 100%);
  text-align: left;
}
.admin-system-panel h2 {
  margin: 0 0 8px;
  text-align: center;
  font-size: 22px;
  font-weight: 600;
}
.admin-system-panel > .meta {
  margin: 0 0 16px;
  text-align: center;
  font-weight: 400;
}
.admin-system-panel i {
  margin: 0;
  font-size: 18px;
}
.admin-system-panel label {
  font-weight: 500;
}
.admin-system-panel .meta,
.admin-system-panel .error {
  font-weight: 400;
}
.admin-system-menu {
  display: grid;
  gap: 10px;
}
.admin-system-menu button {
  width: 100%;
  justify-content: flex-start;
  min-height: 50px;
  padding-inline: 14px;
  font-size: 15px;
  font-weight: 500;
  box-shadow: 0 2px 8px rgb(15 23 42 / 0.10);
}
.admin-system-menu button:hover:not(:disabled) {
  box-shadow: 0 4px 10px rgb(15 23 42 / 0.13);
}
.admin-system-menu button i {
  flex: 0 0 24px;
  width: 24px;
  font-size: 18px;
  text-align: center;
}
.admin-system-panel .dialog-actions button {
  min-height: 46px;
  font-weight: 500;
  box-shadow: 0 2px 8px rgb(15 23 42 / 0.10);
}
.admin-system-form .field {
  margin-top: 14px;
}
.admin-system-warning {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid #e3b0b0;
  border-radius: 8px;
  background: #fff1f1;
  color: var(--danger);
  font-weight: 500;
  line-height: 1.6;
}
.admin-system-form .error {
  min-height: 1.4em;
  margin: 8px 0 0;
  color: var(--danger);
  text-align: center;
}
.admin-system-close-row {
  margin-top: 14px;
}
.admin-system-form[hidden],
.admin-system-menu[hidden],
.admin-system-warning[hidden],
.admin-system-form .field[hidden] {
  display: none;
}
