/* ═══════════════════════════════════════════════════
   BackDrop — 背景除去ツール
   style.css の設計言語（--ink, --paper, --accent...）を継承
   ═══════════════════════════════════════════════════ */

/* ── Page layout ── */
.backdrop-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 36px 40px 80px;
}

/* ── Hero / catch ── */
.backdrop-main h2.page-title {
  text-align: center;
  margin: 10px 0;
  font-weight: 600;
}
.backdrop-main h3.catch {
  font-size: 15px;
  text-align: center;
  margin: 0 auto 40px;
  color: #555;
  font-weight: normal;
}

/* ── Description block (bottom) ── */
.backdrop-main h2.description {
  font-size: 20px;
  text-align: left;
  margin: 30px 0 10px;
  border-bottom: 1px solid #777;
  padding: 10px;
  color: #444;
}
.backdrop-main h2.description span { color: var(--accent); }
.backdrop-main .description-wrap p {
  font-size: 13px;
  padding: 10px;
  line-height: 1.8;
}

/* ── Main tool card ── */
.bd-card {
  border: 2px solid var(--ink);
  background: #fff;
  padding: 28px 32px;
  margin-bottom: 32px;
  animation: fadeUp 0.4s ease both;
}

/* ── Drop zone ── */
#bd-drop-zone {
  border: 2px dashed var(--ink);
  padding: 56px 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  background: #fff;
}
#bd-drop-zone.dragover {
  background: rgba(200, 75, 47, 0.05);
  border-color: var(--accent);
  border-style: solid;
}
#bd-drop-zone input[type=file] {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer;
  width: 100%; height: 100%;
}
.bd-drop-icon { font-size: 44px; margin-bottom: 10px; opacity: 0.35; }
.bd-drop-title {
  font-family: 'Shippori Mincho', serif;
  font-size: 20px; font-weight: 600; margin-bottom: 6px;
}
.bd-drop-sub { font-size: 11px; color: var(--muted); letter-spacing: 1px; }

/* ── Workspace (hidden until file loaded) ── */
#bd-workspace { display: none; }

/* ── Before/After preview grid ── */
.bd-preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 22px;
}
@media (max-width: 640px) {
  .bd-preview-grid { grid-template-columns: 1fr; }
}

.bd-pcard {
  border: 1.5px solid var(--sand);
  overflow: hidden;
  border-radius: var(--radius);
}
.bd-pcard-header {
  padding: 8px 12px;
  border-bottom: 1px solid var(--sand);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  font-family: 'DM Mono', monospace;
}
.bd-pcard-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 200px; padding: 12px;
}
.bd-pcard-body.checker {
  background-image:
    linear-gradient(45deg, #ddd 25%, transparent 25%),
    linear-gradient(-45deg, #ddd 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ddd 75%),
    linear-gradient(-45deg, transparent 75%, #ddd 75%);
  background-size: 14px 14px;
  background-position: 0 0, 0 7px, 7px -7px, -7px 0;
  background-color: #f0ede7;
}
.bd-pcard-body img {
  max-width: 100%; max-height: 260px;
  object-fit: contain; display: block;
}
.bd-placeholder {
  display: flex; flex-direction: column;
  align-items: center; gap: 10px;
  color: var(--muted); font-size: 11px;
  text-align: center; letter-spacing: 1px;
}

/* ── Controls panel ── */
.bd-controls {
  border: 2px solid var(--ink);
  margin-bottom: 22px;
}
.bd-controls-header {
  padding: 10px 16px;
  border-bottom: 1.5px solid var(--sand);
  font-size: 10px; letter-spacing: 3px; text-transform: uppercase;
  color: var(--muted);
  display: flex; align-items: center; gap: 8px;
}
.bd-controls-header::after {
  content: ''; flex: 1; height: 1px; background: var(--sand);
}
.bd-controls-body {
  padding: 18px 20px;
  display: flex; flex-direction: column; gap: 16px;
}

.bd-ctrl-group { display: flex; flex-direction: column; gap: 8px; }
.bd-ctrl-label {
  font-size: 10px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--muted);
}
.bd-ctrl-row { display: flex; align-items: center; gap: 12px; }

/* Range slider */
.bd-ctrl-row input[type=range] {
  flex: 1; -webkit-appearance: none; appearance: none;
  height: 3px; border-radius: 2px; outline: none; cursor: pointer;
  background: linear-gradient(to right,
    var(--ink) 0%, var(--ink) var(--pct, 25%),
    var(--sand) var(--pct, 25%));
}
.bd-ctrl-row input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--ink);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.bd-ctrl-val {
  font-family: 'DM Mono', monospace;
  font-size: 13px; font-weight: 500;
  min-width: 28px; text-align: right;
}

/* Toggle (reuse Fitly style) */
.bd-toggle-row { display: flex; align-items: center; gap: 10px; }
.bd-toggle-label { font-size: 11px; color: var(--ink); letter-spacing: 0.3px; }

/* Badge */
.bd-badge {
  font-family: 'DM Mono', monospace;
  font-size: 10px; letter-spacing: 1px;
  padding: 2px 8px; border-radius: var(--radius);
}
.bd-badge-wait { background: var(--sand); color: var(--muted); }
.bd-badge-busy { background: rgba(184,147,58,0.15); color: var(--gold); border: 1px solid var(--gold); }
.bd-badge-ok   { background: rgba(45,106,79,0.12); color: var(--green); border: 1px solid var(--green); }
.bd-badge-err  { background: rgba(200,75,47,0.12); color: var(--accent); border: 1px solid var(--accent); }

/* ── Status bar ── */
.bd-status-bar {
  display: flex; align-items: center; gap: 8px;
  margin-top: 14px;
  font-size: 11px; color: var(--muted); letter-spacing: 0.5px;
}
.bd-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--sand); flex-shrink: 0;
  border: 1.5px solid var(--muted);
  transition: background 0.3s;
}
.bd-dot.busy { background: var(--gold); border-color: var(--gold); animation: bdPulse 1s infinite; }
.bd-dot.ok   { background: var(--green); border-color: var(--green); }
.bd-dot.err  { background: var(--accent); border-color: var(--accent); }
@keyframes bdPulse { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ── 完了後フォローノート ── */
.bd-result-note {
  display: none;
  align-items: center; gap: 6px;
  margin-top: 10px;
  font-size: 11px; color: var(--muted);
  letter-spacing: 0.3px;
  opacity: 0; transition: opacity 0.4s;
}
.bd-result-note.is-visible { display: flex; opacity: 1; flex-wrap:wrap; }
.bd-result-note a {
  color: var(--green); text-decoration: underline;
  text-underline-offset: 2px;
}
.bd-result-note a:hover { opacity: 0.75; }

/* ── Action buttons ── */
.bd-action-bar {
  display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap;
}
.bd-btn {
  padding: 10px 22px;
  border: 1.5px solid var(--sand);
  background: transparent;
  font-family: 'DM Mono', monospace;
  font-size: 11px; letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: var(--radius);
  color: var(--muted);
  transition: all 0.18s;
  display: inline-flex; align-items: center; gap: 6px;
}
.bd-btn:hover { border-color: var(--ink); color: var(--ink); }
.bd-btn:active { transform: scale(0.98); }
.bd-btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

.bd-btn-primary {
  background: var(--ink); color: var(--paper);
  border-color: var(--ink);
  position: relative; overflow: hidden;
}
.bd-btn-primary::before {
  content: ''; position: absolute; inset: 0;
  background: var(--accent); transform: translateX(-100%);
  transition: transform 0.3s ease;
}
.bd-btn-primary:hover::before { transform: translateX(0); }
.bd-btn-primary span { position: relative; z-index: 1; }
.bd-btn-primary:hover { color: var(--paper); border-color: var(--accent); }

.bd-btn-download {
  background: var(--green); color: white;
  border-color: var(--green);
}
.bd-btn-download:hover { opacity: 0.85; color: white; border-color: var(--green); }

/* ── Tip box ── */
.bd-tip {
  margin-top: 14px;
  padding: 10px 14px;
  border-left: 3px solid var(--gold);
  background: rgba(184,147,58,0.06);
  font-size: 11px; color: var(--muted);
  line-height: 1.7; letter-spacing: 0.3px;
}

/* ── Progress bar (top of page) ── */
#bd-progress-bar {
  height: 2px; background: var(--accent);
  width: 0%; transition: width 0.3s;
  position: fixed; top: 0; left: 0; z-index: 9998;
  display: none;
}

/* ── Feature cards ── */
.bd-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border: 1px solid #999;
  margin-bottom: 40px;
  animation: fadeUp 0.5s 0.2s ease both;
}
@media (max-width: 700px) {
  .bd-features { grid-template-columns: 1fr; }
}
.bd-feature {
  padding: 22px 15px;
  display: flex;
  gap:10px;
  background: snow;
}
.bd-feature i{
  background: gray;
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 25px;
  color: white;
  border-radius: 3px;
  flex-shrink: 0;
}
.bd-feature + .bd-feature {
  border-left: 1px solid #999;
}
@media (max-width: 700px) {
  .bd-feature + .bd-feature {
    border-left: none;
    border-top: 1px solid #999;
  }
}
.bd-feature-label {
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 8px;
}
.bd-feature-label h3{
  font-weight: bold;
  font-size: 14px;
  padding: 0 5px 5px;
  position: relative;
}
.bd-feature-label h3:before{
  content: "";
  position: absolute;
  left: 5px;
  bottom: 0;
  width: 25%;
  height: 2px;
  background: var(--accent);
}
.bd-feature-text { font-size: 12px; color: var(--ink); line-height: 1.7;
  padding: 5px 5px 0; }


/* ── AI model badge ── */
.bd-model-badge {
  margin-top: 12px;
  display: flex; align-items: center; gap: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 10px; letter-spacing: 1px;
  color: var(--muted);
  padding: 8px 12px;
  background: var(--sand);
  border-radius: var(--radius);
  opacity: 0.85;
}
.bd-model-badge i { color: var(--gold); font-size: 12px; }

/* ── Loading spinner overlay on result panel ── */
.bd-pcard-body.loading::after {
  content: '';
  position: absolute;
  width: 28px; height: 28px;
  border: 2.5px solid var(--sand);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: bdSpin 0.7s linear infinite;
}
@keyframes bdSpin { to { transform: rotate(360deg); } }

/* ── Progress percentage label ── */
.bd-progress-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px; letter-spacing: 1px;
  color: var(--muted); margin-top: 4px;
}


/* ── Page-level overrides (moved from inline <style>) ── */
.backdrop-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 36px 40px 80px;
}
@media (max-width: 500px) { .backdrop-main { padding: 36px 20px 80px; } }
.backdrop-main .description-wrap { margin-top: 60px; }
.backdrop-main .description-wrap ul {
  line-height: 1.8; margin-top: 10px; padding: 0 10px 20px;
}
.backdrop-main .description-wrap ul li {
  list-style-position: inside; font-size: 14px; line-height: 2;
}

/* ── インラインスタイルから抽出 ── */
#bd-orig-size { color: var(--muted); }
#bd-result-canvas { max-width: 100%; max-height: 280px; }
.bd-placeholder i { font-size: 28px; opacity: 0.3; }
.bd-placeholder span { font-size: 10px; }
.bd-share-wrap { text-align: center; margin: 28px 0 6px; }
.bd-affiliate-wrap {
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin: 20px 0 4px;
}
