/* 音楽・動画の無音カットツール（Silence Cutter）用スタイルシート */
.sc-tool {
  --sc-accent: #176f79;
  --sc-accent-dark: #11535b;
  --sc-accent-light: #edf7f8;
  --sc-accent-border: #88b4bb;
  --sc-danger: #c92a2a;
  --sc-success: #2b8a3e;
  --sc-text: #182b3d;
  --sc-text-muted: #495057;
  --sc-bg: #f8fafc;
  --sc-border: #dce4ea;
  
  width: 100%;
  max-width: var(--ks-tool-max-width, 960px);
  min-width: 0;
  margin-inline: auto;
  color: var(--sc-text);
  font: 16px/1.6 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  box-sizing: border-box;
}

.sc-tool * {
  box-sizing: border-box;
  min-width: 0;
}

.sc-language {
  margin-bottom: 8px;
  text-align: right;
  font-size: 14px;
}
.sc-language a {
  color: var(--sc-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.sc-language a:hover {
  color: var(--sc-accent-dark);
}

/* カードパネル共通（password-generator と統一） */
.sc-settings,
.sc-results {
  border: 1px solid var(--sc-border);
  border-radius: 16px;
  background: #ffffff;
  padding: 18px 20px;
  box-shadow: 0 8px 24px #203b5b06;
  margin-bottom: 12px;
}
.sc-results:last-child {
  margin-bottom: 0;
}

/* ドロップゾーン（高さを縦にしっかり広げる） */
.sc-drop-zone {
  margin-bottom: 12px;
}
.sc-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--sc-accent-border);
  border-radius: 12px;
  background: var(--sc-accent-light);
  min-height: 420px;
  box-sizing: border-box;
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.sc-drop * {
  pointer-events: none;
}
.sc-drop:hover,
.sc-drop.is-dragover {
  background: #e0f2f4;
  border-color: var(--sc-accent);
}
.sc-drop:focus-visible {
  outline: 3px solid #895ee6;
  outline-offset: 3px;
}
.sc-drop span[aria-hidden="true"] {
  display: block;
  font-size: 44px;
  line-height: 1;
  color: var(--sc-accent);
  margin-bottom: 10px;
}
.sc-drop strong {
  display: block;
  font-size: 18px;
  margin-bottom: 6px;
  color: #182b3d !important;
}
.sc-drop small {
  display: block;
  font-size: 13px;
  color: #556575;
}

/* 検出設定パネル */
.sc-config-fieldset {
  margin: 0 0 10px 0;
  padding: 12px 16px 14px 16px;
  border: 1px solid #d4dfe7;
  border-radius: 10px;
  background: #fafcfd;
}
.sc-tool legend {
  font-weight: 700;
  padding: 0 6px;
  color: #182b3d;
  font-size: 14px;
}
.sc-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  align-items: start;
}
.sc-setting-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 600;
  font-size: 13px;
  color: #243448;
}
.sc-tool select {
  display: block;
  width: 100%;
  min-height: 40px;
  padding: 6px 10px;
  border: 1px solid #a4b5c4;
  border-radius: 7px;
  background: #ffffff;
  color: #182b3d !important;
  font: inherit;
  font-size: 14px;
}
.sc-tool select:focus-visible {
  outline: 2px solid var(--sc-accent);
  outline-offset: 2px;
}

/* 自動化トグル（画像圧縮ツールと完全に統一） */
.sc-automation-row {
  margin: 10px 0;
  display: flex;
  align-items: center;
}
.sc-tool .image-tool__automation {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.4rem;
  color: #31514d !important;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}
.sc-tool .image-tool__automation-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.sc-tool .image-tool__automation-label {
  color: #21534e !important;
  font-weight: 700;
}

/* 操作ボタン（文字色・視認性・無効状態の徹底制御） */
.sc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 8px 0;
}
.sc-tool button,
.sc-tool .sc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  border-radius: 7px;
  border: 1px solid #a4b5c4;
  background: #ffffff;
  color: #182b3d;
  cursor: pointer;
  font: inherit;
  font-weight: 650;
  min-height: 40px;
  font-size: 14px;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}
.sc-tool button:focus-visible,
.sc-tool .sc-btn:focus-visible {
  outline: 3px solid #895ee6;
  outline-offset: 3px;
}

/* 有効状態：処理を開始 & すべてダウンロード は常に背景アクセント色＋純白文字 */
.sc-tool button.sc-start:not(:disabled),
.sc-tool button.sc-download-all:not(:disabled) {
  background: var(--sc-accent) !important;
  color: #ffffff !important;
  border-color: var(--sc-accent) !important;
}
.sc-tool button.sc-start:not(:disabled):hover,
.sc-tool button.sc-download-all:not(:disabled):hover {
  background: var(--sc-accent-dark) !important;
  color: #ffffff !important;
  border-color: var(--sc-accent-dark) !important;
}
.sc-tool button.sc-start:not(:disabled):focus,
.sc-tool button.sc-download-all:not(:disabled):focus,
.sc-tool button.sc-start:not(:disabled):active,
.sc-tool button.sc-download-all:not(:disabled):active {
  color: #ffffff !important;
}

/* 有効状態：処理を停止 */
.sc-tool button.sc-stop:not(:disabled) {
  background: #ffffff !important;
  color: var(--sc-danger) !important;
  border-color: #f87171 !important;
}
.sc-tool button.sc-stop:not(:disabled):hover {
  background: #fef2f2 !important;
  color: #b91c1c !important;
}

/* 無効状態：操作不可であることが明確に分かる統一デザイン */
.sc-tool button:disabled,
.sc-tool .sc-btn:disabled {
  background: #cbd5e1 !important;
  color: #64748b !important;
  border-color: #cbd5e1 !important;
  opacity: 0.6 !important;
  cursor: not-allowed !important;
  pointer-events: none;
}

/* ステータスとプライバシー注記 */
.sc-status {
  font-size: 13px;
  color: #556575;
  margin: 6px 0;
  min-height: 1.4em;
}
.sc-status[data-type="error"] {
  color: var(--sc-danger);
  font-weight: 600;
}
.sc-status[data-type="success"] {
  color: var(--sc-success);
  font-weight: 600;
}
.sc-privacy {
  font-size: 12px;
  color: #6c757d;
  margin-top: 6px;
  border-top: 1px solid #edf2f7;
  padding-top: 6px;
  margin-bottom: 0;
}

/* 結果パネル・ファイル一覧 */
.sc-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid #edf2f7;
}
.sc-results-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #182b3d !important;
}
.sc-results-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.sc-auto-clear-notice {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}
.sc-clear-list {
  font-size: 12px;
  padding: 4px 10px;
  min-height: 30px !important;
  border-radius: 6px;
}

.sc-file-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sc-file-item {
  padding: 12px 14px;
  border: 1px solid #d4dfe7;
  border-radius: 9px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.2s ease, background-color 0.2s ease, opacity 0.3s ease;
}
.sc-file-item[data-status="waiting"] {
  border-color: #cbd5e1;
  background: #f8fafc;
}
.sc-file-item[data-status="processing"] {
  border-color: var(--sc-accent);
  background: #fcfefe;
}
.sc-file-item[data-status="completed"] {
  border-color: #86efac;
  background: #f0fdf4;
}
.sc-file-item[data-status="error"] {
  border-color: #fca5a5;
  background: #fef2f2;
}
.sc-file-item[data-status="canceled"] {
  border-color: #e2e8f0;
  background: #f8fafc;
  opacity: 0.8;
}

/* ファイルヘッダー */
.sc-file-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.sc-file-title-wrap {
  flex: 1 1 auto;
  min-width: 0;
}
.sc-file-name {
  font-weight: 700;
  font-size: 14px;
  color: #182b3d !important;
  overflow-wrap: anywhere;
  margin: 0 0 3px 0;
  line-height: 1.4;
}
.sc-file-meta {
  font-size: 12px;
  color: #495057 !important;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
}
.sc-file-meta * {
  color: inherit;
}

/* バッジ表示 */
.sc-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.sc-badge--forced {
  background: #fef3c7 !important;
  color: #92400e !important;
  border: 1px solid #fde68a;
}
.sc-badge--lossless {
  background: #e0f2fe !important;
  color: #0369a1 !important;
}
.sc-badge--status-waiting {
  background: #e2e8f0 !important;
  color: #334155 !important;
}
.sc-badge--status-processing {
  background: #ccfbf1 !important;
  color: #0f766e !important;
}
.sc-badge--status-completed {
  background: #dcfce7 !important;
  color: #166534 !important;
}
.sc-badge--status-error {
  background: #fee2e2 !important;
  color: #991b1b !important;
}
.sc-badge--status-canceled {
  background: #f1f5f9 !important;
  color: #475569 !important;
}

/* 進捗バー */
.sc-file-progress {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sc-progress-bar {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}
.sc-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--sc-accent);
  transition: width 0.2s ease;
}
.sc-file-item[data-status="completed"] .sc-progress-fill {
  background: var(--sc-success);
}
.sc-file-item[data-status="error"] .sc-progress-fill {
  background: var(--sc-danger);
}
.sc-progress-text {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #495057 !important;
}
.sc-file-item[data-status="error"] .sc-progress-text {
  color: var(--sc-danger) !important;
}
.sc-item-stats {
  font-weight: 600;
  color: #1b4d3e !important;
}

/* ファイル操作ボタン */
.sc-file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.sc-btn-sm {
  padding: 4px 10px;
  font-size: 12px;
  min-height: 32px;
  border-radius: 6px;
  border: 1px solid #a4b5c4;
  background: #ffffff;
  color: #182b3d !important;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
}
.sc-btn-sm:hover:not(:disabled) {
  background: #f1f5f9;
}
.sc-btn-sm:focus-visible {
  outline: 2px solid var(--sc-accent);
  outline-offset: 2px;
}
.sc-btn-sm--primary {
  background: var(--sc-accent) !important;
  color: #ffffff !important;
  border-color: var(--sc-accent) !important;
}
.sc-btn-sm--primary:hover:not(:disabled) {
  background: var(--sc-accent-dark) !important;
}
.sc-btn-sm--danger {
  color: var(--sc-danger) !important;
  border-color: #fca5a5;
}
.sc-btn-sm--danger:hover:not(:disabled) {
  background: #fee2e2;
}
.sc-btn-sm:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* スマートフォン表示最適化 */
@media (max-width: 650px) {
  .sc-settings,
  .sc-results {
    padding: 14px 16px;
    border-radius: 12px;
  }
  .sc-drop {
    min-height: 180px;
    padding: 24px 16px;
  }
  .sc-settings-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .sc-actions button {
    flex: 1 1 100%;
  }
  .sc-file-header {
    flex-direction: column;
  }
  .sc-file-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .sc-results-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .sc-results-header-actions {
    width: 100%;
    justify-content: space-between;
  }
}
