/* ==========================================================================
   CLOCK LAB - Precision CSS
   清潔・精密・高密度・神経質なインダストリアルデザイン
   ========================================================================== */
:root {
  --bg-color: #08090c;          /* 時計背景色 */
  --text-color: #f1f5f9;        /* 基本文字色 */
  --colon-color: #475569;       /* コロン（:）色 */
  --colon-glow: rgba(56, 189, 248, 0.25);
  --accent-color: #38bdf8;      /* 精密計器スカイブルー */
  --accent-hover: #0284c7;
  --accent-glow: rgba(56, 189, 248, 0.3);
  --panel-bg: rgba(12, 15, 20, 0.95); /* CLOCK LAB パネル背景 */
  --panel-border: rgba(255, 255, 255, 0.08);
  --panel-border-subtle: rgba(255, 255, 255, 0.04);
  --panel-text: #e2e8f0;
  --panel-muted: #64748b;
  
  /* 時計ベースサイズ（各桁 1:1, 500x500px） */
  --digit-size: min(13vw, 150px);
  --colon-width: calc(var(--digit-size) * 0.25);
  --clock-scale: 1.6;

  /* 文字・コロン間隔 */
  --digit-gap: -100px;
  --colon-margin: -2px;

  /* 背景エフェクト */
  --bg-dim: 0.3;
  --bg-blur: 0px;
  --bg-scale: 1;
  
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Monaco, Menlo, Consolas, "Liberation Mono", monospace;
  --transition-speed: 0.2s;
}

/* リセット */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-family);
  user-select: none;
  -webkit-user-select: none;
  transition: background-color var(--transition-speed) ease;
}

/* ==========================================================================
   ドラッグ＆ドロップ受け入れオーバーレイ
   ========================================================================== */
.drag-drop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 14, 0.9);
  backdrop-filter: blur(16px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.drag-drop-overlay.drag-active {
  opacity: 1;
  pointer-events: auto;
}

.drag-drop-card {
  border: 1px dashed rgba(56, 189, 248, 0.6);
  border-radius: 8px;
  padding: 36px 48px;
  text-align: center;
  background: rgba(15, 23, 42, 0.6);
  box-shadow: 0 0 30px rgba(56, 189, 248, 0.15);
  transform: scale(0.97);
  transition: transform 0.2s ease;
}

.drag-drop-overlay.drag-active .drag-drop-card {
  transform: scale(1);
}

.drag-drop-icon {
  color: #38bdf8;
  margin-bottom: 14px;
  display: flex;
  justify-content: center;
}

.drag-drop-card h3 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #f8fafc;
  margin-bottom: 6px;
}

.drag-drop-card p {
  font-size: 12px;
  color: #94a3b8;
}

/* ==========================================================================
   背景メディアレイヤー
   ========================================================================== */
.bg-media-container {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
  opacity: 0;
  filter: blur(var(--bg-blur));
  transform: scale(calc(1.05 * var(--bg-scale, 1)));
  transform-origin: center center;
  transition: opacity 0.4s ease, filter 0.2s ease, transform 0.15s ease-out;
}

.bg-media.active {
  opacity: 1;
}

.bg-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, var(--bg-dim));
  transition: background-color 0.2s ease;
}

/* ==========================================================================
   メイン表示ステージ
   ========================================================================== */
.clock-stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 10;
}

.clock-container {
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(var(--clock-scale));
  transform-origin: center center;
  transition: transform 0.15s ease-out;
  padding: 20px;
}

.digit-pair {
  display: flex;
  align-items: center;
}

.digit-wrapper {
  width: var(--digit-size);
  height: var(--digit-size);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.digit-pair .digit-wrapper + .digit-wrapper {
  margin-left: max(calc(var(--digit-size) * -0.55), calc(var(--digit-size) * 0.04 + var(--digit-gap)));
  transition: margin-left 0.15s ease-out;
}

.clock-container.show-guidelines .digit-wrapper {
  outline: 1px dashed rgba(255, 255, 255, 0.25);
  background-color: rgba(255, 255, 255, 0.02);
}

.clock-container.show-guidelines .separator-colon {
  outline: 1px dashed rgba(56, 189, 248, 0.3);
}

.digit-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* コロン区切り */
.separator-colon {
  width: var(--colon-width);
  height: var(--digit-size);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: calc(var(--digit-size) * 0.28);
  margin: 0 max(calc(var(--digit-size) * -0.4), calc(var(--digit-size) * 0.06 + var(--colon-margin)));
  transition: margin 0.15s ease-out;
  flex-shrink: 0;
  position: relative;
}

.colon-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
  position: absolute;
  inset: 0;
}

.separator-colon.has-custom-colon {
  width: var(--digit-size);
  margin: 0 max(calc(var(--digit-size) * -0.55), calc(var(--digit-size) * 0.04 + var(--colon-margin) + var(--digit-gap)));
}

.separator-colon.has-custom-colon .colon-canvas {
  display: block;
}

.separator-colon.has-custom-colon .colon-dot {
  display: none;
}

.colon-dot {
  width: calc(var(--digit-size) * 0.09);
  height: calc(var(--digit-size) * 0.09);
  background-color: var(--colon-color);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--colon-glow);
  transition: opacity 0.2s ease, background-color var(--transition-speed) ease;
}

.separator-colon.blinking .colon-dot {
  animation: colonBlink 1s infinite steps(1, start);
}

.separator-colon.blinking .colon-canvas {
  animation: colonBlink 1s infinite steps(1, start);
}

@keyframes colonBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.15; }
}

/* ==========================================================================
   トースト通知
   ========================================================================== */
.status-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(15, 23, 42, 0.95);
  color: #f1f5f9;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 12px;
  letter-spacing: 0.02em;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
  z-index: 300;
  backdrop-filter: blur(12px);
  max-width: 85vw;
  text-align: center;
}

.status-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ==========================================================================
   ドロップ案内インジケータ（画面下部・精密なピル型）
   ========================================================================== */
.drop-hint-pill {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  background: rgba(11, 14, 20, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  backdrop-filter: blur(12px);
  color: #94a3b8;
  font-size: 11px;
  letter-spacing: 0.03em;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  transition: all 0.2s ease;
  user-select: none;
}

.drop-hint-pill:hover {
  background: rgba(22, 29, 41, 0.95);
  border-color: #38bdf8;
  color: #f1f5f9;
  transform: translateX(-50%) translateY(-1px);
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.2);
}

.hint-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 6px #38bdf8;
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
}

.hint-svg {
  display: block;
  color: #94a3b8;
}

.drop-hint-pill:hover .hint-svg {
  color: #38bdf8;
}

body.settings-open .drop-hint-pill {
  opacity: 0.2;
  pointer-events: none;
}

/* ==========================================================================
   右上コントロールバー（全画面 ＆ CLOCK LAB）
   ========================================================================== */
.top-controls-bar {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.btn-top-control {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(15, 20, 28, 0.85);
  color: #cbd5e1;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  transition: all 0.2s ease;
  user-select: none;
}

.btn-player-link {
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.3);
}

.btn-player-link:hover {
  background: rgba(56, 189, 248, 0.15) !important;
  border-color: #38bdf8 !important;
  color: #ffffff !important;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.4) !important;
}

.btn-top-control:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: #38bdf8;
  color: #f8fafc;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
}

/* 壁紙モード時・全画面表示時のUI非表示クラス */
body.wallpaper-mode .top-controls-bar,
body.wallpaper-mode .drop-hint-pill,
body.wallpaper-mode .btn-toggle-settings,
body.wallpaper-mode .settings-panel {
  display: none !important;
}

body.fullscreen-clean .top-controls-bar,
body.fullscreen-clean .drop-hint-pill {
  opacity: 0;
  pointer-events: none;
}

/* ==========================================================================
   CLOCK LAB パネル（精密ドロワー）
   ========================================================================== */
.settings-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 360px;
  max-width: 92vw;
  height: 100%;
  background: var(--panel-bg);
  border-left: 1px solid var(--panel-border);
  box-shadow: -10px 0 35px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(24px);
  z-index: 150;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--panel-text);
}

.settings-panel.open {
  transform: translateX(0);
}

.settings-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--panel-border);
  background: rgba(8, 10, 14, 0.4);
}

.settings-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-header h2 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #fff;
}

.settings-badge {
  font-size: 9px;
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.btn-close {
  background: none;
  border: none;
  color: var(--panel-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
  transition: color 0.15s ease;
}

.btn-close:hover {
  color: #fff;
}

/* トップバー */
.settings-top-bar {
  padding: 8px 14px;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid var(--panel-border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.btn-top-mute {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-top-mute:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-top-mute.muted {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.btn-top-mute.muted:hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: #ef4444;
  color: #fff;
}

/* ==========================================================================
   4タブナビゲーション（数字・時計・音・出荷）
   ========================================================================== */
.settings-tabs-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(8, 10, 14, 0.6);
  border-bottom: 1px solid var(--panel-border);
  padding: 4px;
  gap: 3px;
}

.tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 2px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
}

.tab-btn.active {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  font-weight: 600;
}

.tab-svg {
  display: block;
}

.tab-text {
  font-size: 10px;
  letter-spacing: 0.04em;
}

/* ==========================================================================
   タブコンテンツエリア
   ========================================================================== */
.settings-tab-content-area {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px 28px;
  display: flex;
  flex-direction: column;
}

.tab-pane {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.tab-pane.active {
  display: flex;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sub-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--panel-muted);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* セクション区分バッジ（レイアウト / バック） */
.section-badge-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #38bdf8;
  margin-top: 4px;
  margin-bottom: 2px;
}

.section-badge-header::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(56, 189, 248, 0.2);
}

/* ==========================================================================
   ボタン・フォーム要素（清潔・精密）
   ========================================================================== */
.button-group {
  display: flex;
  gap: 6px;
}

.btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  color: var(--panel-text);
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.btn.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.45);
  color: #38bdf8;
  font-weight: 600;
}

.btn-sm {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--panel-text);
  border-radius: 3px;
  font-size: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-sm:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
}

.action-buttons-row {
  display: flex;
  gap: 6px;
}

.btn-action {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 10px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #7dd3fc;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-action:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #fff;
}

.btn-primary-action {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.22), rgba(16, 185, 129, 0.18));
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #bae6fd;
  font-weight: 600;
}

.btn-primary-action:hover {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.32), rgba(16, 185, 129, 0.28));
  border-color: #38bdf8;
  color: #fff;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

.btn-folder-pick {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--panel-border);
  color: var(--panel-text);
}

.btn-folder-pick:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

/* ==========================================================================
   開発室内のドロップゾーン
   ========================================================================== */
.lab-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 12px 10px;
  background: rgba(10, 13, 18, 0.5);
  border: 1px dashed rgba(56, 189, 248, 0.3);
  border-radius: 6px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 2px;
  user-select: none;
}

.lab-dropzone:hover {
  background: rgba(20, 27, 38, 0.7);
  border-color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.15);
}

.drop-svg {
  color: #38bdf8;
  margin-bottom: 2px;
}

.dropzone-text {
  font-size: 11px;
  font-weight: 600;
  color: #e2e8f0;
  letter-spacing: 0.02em;
}

.dropzone-sub {
  font-size: 9.5px;
  color: #64748b;
}

/* セグメント切り替え（WebM / PNG） */
.segmented-control {
  display: flex;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 5px;
  padding: 2px;
  border: 1px solid var(--panel-border);
}

.segmented-control input[type="radio"] {
  display: none;
}

.segmented-control label {
  flex: 1;
  text-align: center;
  padding: 5px 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--panel-muted);
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.15s ease;
}

.segmented-control input[type="radio"]:checked + label {
  background: #0284c7;
  color: #fff;
  box-shadow: 0 1px 4px rgba(2, 132, 199, 0.35);
}

.section-help {
  font-size: 10px;
  color: var(--panel-muted);
  line-height: 1.4;
}

.section-help code {
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: #7dd3fc;
}

/* ==========================================================================
   精密スライダー
   ========================================================================== */
.slider-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.slider-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--panel-text);
}

.value-badge {
  font-size: 10px;
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1px 5px;
  border-radius: 3px;
  color: #38bdf8;
}

.slider-hint {
  font-size: 9.5px;
  color: var(--panel-muted);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #38bdf8;
  border: 1.5px solid #fff;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.6);
  transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

/* ==========================================================================
   マイクロスイッチ
   ========================================================================== */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
}

.setting-subtext {
  font-size: 9.5px;
  color: var(--panel-muted);
  margin-top: 1px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 16px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.12);
  transition: 0.2s;
  border-radius: 10px;
}

.slider::before {
  position: absolute;
  content: "";
  height: 10px;
  width: 10px;
  left: 3px;
  bottom: 3px;
  background-color: #94a3b8;
  transition: 0.2s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #0284c7;
}

input:checked + .slider::before {
  transform: translateX(16px);
  background-color: #fff;
}

/* カラーピッカー */
.color-picker-row {
  display: flex;
  gap: 14px;
}

.color-picker-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  cursor: pointer;
}

.color-picker-row input[type="color"] {
  border: 1px solid var(--panel-border);
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
}

/* ファイルアップロードUI */
.file-upload-box {
  display: flex;
  gap: 6px;
  align-items: center;
}

.btn-file-select {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: #7dd3fc;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-file-select:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: #38bdf8;
  color: #fff;
}

.file-status-text {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--panel-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* セレクトボックス */
.custom-select {
  width: 100%;
  padding: 5px 8px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  color: var(--panel-text);
  font-size: 11px;
  outline: none;
  cursor: pointer;
}

.custom-select option {
  background: #0f172a;
  color: #fff;
}

/* プログレスバー */
.progress-bar-container {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #10b981);
  transition: width 0.25s ease;
}

.status-indicator {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--panel-muted);
}

/* アセット詳細 */
.asset-list-details {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--panel-border-subtle);
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 10.5px;
}

.asset-list-details summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--panel-muted);
  outline: none;
}

.asset-pattern-list {
  list-style: none;
  margin-top: 5px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 120px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 10px;
}

.asset-pattern-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 5px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 2px;
}

.asset-pattern-list li.loaded {
  color: #34d399;
}

.asset-pattern-list li.missing {
  color: #f87171;
}

/* SPECガイドボックス */
.guide-box {
  background: rgba(10, 13, 18, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 8px 10px;
}

.guide-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 4px;
}

.guide-tag {
  font-size: 8px;
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.08em;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 1px 4px;
  border-radius: 2px;
}

.guide-box p {
  font-size: 10px;
  line-height: 1.5;
  color: #cbd5e1;
}

/* ==========================================================================
   12パターン個別管理カードグリッド（読込状況表示 ＆ テスト再生 ＆ 個別ファイル割当）
   ========================================================================== */
.pattern-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 4px;
}

.pat-card {
  display: flex;
  align-items: stretch;
  background: rgba(10, 13, 18, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 5px;
  overflow: hidden;
  transition: all 0.15s ease;
}

.pat-card:hover {
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.1);
}

/* 未読込状態: 落ち着いたグレー/赤系のドットで未配置を明示 */
.pat-card.status-missing {
  border-color: rgba(239, 68, 68, 0.25);
  background: rgba(15, 10, 12, 0.6);
}

.pat-card.status-missing .pat-status-dot {
  background: #ef4444;
  box-shadow: 0 0 5px rgba(239, 68, 68, 0.6);
}

.pat-card.status-missing .pat-label {
  color: #cbd5e1;
}

/* 読込完了状態: グリーン/シアン系のアクティブ表示 */
.pat-card.status-loaded {
  border-color: rgba(52, 211, 153, 0.45);
  background: rgba(10, 24, 20, 0.65);
}

.pat-card.status-loaded .pat-status-dot {
  background: #34d399;
  box-shadow: 0 0 6px rgba(52, 211, 153, 0.8);
}

.pat-card.status-loaded .pat-label {
  color: #ecfdf5;
  font-weight: 700;
}

/* テスト再生ボタン（左側メイン領域） */
.btn-pat-play {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
  min-width: 0;
}

.btn-pat-play:hover {
  background: rgba(255, 255, 255, 0.06);
}

.btn-pat-play:active {
  background: rgba(56, 189, 248, 0.2);
}

.pat-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.pat-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

/* アップロードボタン（右側小さなスロット） */
.btn-pat-upload {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 7px;
  background: rgba(255, 255, 255, 0.03);
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-pat-upload:hover {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
}

.btn-pat-upload:active {
  background: #0284c7;
  color: #fff;
}

/* ==========================================================================
   サウンド階層（秒・分・時）
   ========================================================================== */
.section-divider {
  border: none;
  border-top: 1px solid var(--panel-border);
  margin: 2px 0;
}

.sound-tier-card {
  background: rgba(10, 13, 18, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sound-tier-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-play-sound {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #7dd3fc;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-play-sound:hover {
  background: rgba(56, 189, 248, 0.25);
  color: #fff;
}

.btn-sm-file {
  padding: 4px 6px;
  font-size: 10px;
}

.custom-sound-upload {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* ==========================================================================
   動く壁紙 ガイドモーダル
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  width: 520px;
  max-width: 95vw;
  max-height: 85vh;
  overflow-y: auto;
  background: #0d121b;
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 8px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(56, 189, 248, 0.15);
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.3);
}

.modal-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #38bdf8;
}

.modal-header-title h3 {
  font-size: 13px;
  font-weight: 600;
  color: #f1f5f9;
}

.modal-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 11.5px;
  color: #cbd5e1;
  line-height: 1.6;
}

.guide-platform-block {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 6px;
  padding: 12px 14px;
}

.guide-platform-block h4 {
  font-size: 12px;
  font-weight: 600;
  color: #e2e8f0;
  margin-bottom: 8px;
}

.guide-platform-block ol {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.guide-platform-block p {
  color: #94a3b8;
}

.guide-platform-block code {
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 5px;
  border-radius: 3px;
  color: #38bdf8;
  font-family: var(--font-mono);
  font-size: 11px;
}

/* ==========================================================================
   動画エクスポート モーダル (Video Export)
   ========================================================================== */
.video-export-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.video-export-modal.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.video-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
}

.video-modal-card {
  position: relative;
  width: 480px;
  max-width: 90vw;
  background: #0f172a;
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 14px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 30px rgba(56, 189, 248, 0.15);
  overflow: hidden;
  animation: modalScaleUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleUp {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.video-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: rgba(15, 23, 42, 0.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.video-modal-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.video-modal-title h3 {
  font-size: 15px;
  font-weight: 700;
  color: #f8fafc;
  margin: 0;
  letter-spacing: 0.05em;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  transition: color 0.15s;
}

.btn-close-modal:hover {
  color: #ffffff;
}

.video-modal-body {
  padding: 20px;
}

.export-field-row {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.export-label {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  letter-spacing: 0.05em;
}

.export-select {
  width: 100%;
  padding: 9px 12px;
  background: rgba(2, 6, 23, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: #f1f5f9;
  font-size: 12px;
  outline: none;
  transition: border-color 0.2s;
}

.export-select:focus {
  border-color: #38bdf8;
}

.export-radio-group {
  display: flex;
  gap: 18px;
  font-size: 12px;
  color: #cbd5e1;
}

.export-radio-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

/* 動画時間 指定タブ */
.export-duration-tabs {
  display: flex;
  gap: 6px;
  background: rgba(2, 6, 23, 0.6);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.export-dur-tab {
  flex: 1;
  padding: 7px 10px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.export-dur-tab:hover {
  color: #f1f5f9;
}

.export-dur-tab.active {
  background: #0284c7;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.4);
}

.export-sub-section {
  margin-top: 4px;
}

.custom-sec-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.export-num-input {
  width: 90px;
  padding: 8px 10px;
  background: rgba(2, 6, 23, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 6px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  outline: none;
}

.sec-unit-label {
  font-size: 11px;
  color: #94a3b8;
}

.playlist-info-badge {
  font-size: 11px;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 6px;
  padding: 6px 10px;
  margin-bottom: 6px;
}

.export-calc-preview {
  margin-top: 6px;
  font-size: 11px;
  font-weight: 600;
  color: #a7f3d0;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 6px;
  padding: 6px 10px;
}

.export-info-box {
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 18px;
}

.export-info-box p {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.5;
  margin: 0;
}

.btn-start-render {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(56, 189, 248, 0.35);
  transition: all 0.2s;
}

.btn-start-render:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(56, 189, 248, 0.5);
}

/* レンダリング中 */
.export-progress-section {
  text-align: center;
  padding: 10px 0;
}

.rendering-spinner-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.render-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(56, 189, 248, 0.2);
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.rendering-spinner-wrap h4 {
  font-size: 14px;
  font-weight: 600;
  color: #f8fafc;
  margin: 0;
}

.render-progress-bar-wrap {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.render-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0284c7, #38bdf8);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
  transition: width 0.1s linear;
}

.render-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #94a3b8;
  margin-bottom: 14px;
  font-variant-numeric: tabular-nums;
}

.render-preview-wrap {
  margin-bottom: 16px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #000000;
  display: inline-block;
}

.render-preview-wrap canvas {
  display: block;
  width: 240px;
  height: auto;
}

.btn-cancel-render {
  padding: 6px 16px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #ef4444;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-cancel-render:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #ffffff;
}
