/* ガビガビ除去スタジオ — 音声マスタリングスタジオと同じダーク基調 */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #14181d;
  --panel: #1b2129;
  --panel2: #20262e;
  --line: #2a323c;
  --text: #e0e6ec;
  --sub: #9aa5b1;
  --accent: #4fc3f7;
  --primary: #2e7d5b;
  --ok: #8bd17c;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Hiragino Sans", "Yu Gothic UI", sans-serif;
  min-height: 100vh;
}
body.busy { cursor: progress; }

/* ---------- ヘッダー ---------- */
.topbar {
  background: var(--panel);
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h1 { font-size: 18px; margin-bottom: 10px; }
.topbar-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.safe { color: var(--ok); font-size: 12px; }

.ctl { color: var(--sub); font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
select {
  background: var(--panel2); color: var(--text);
  border: 1px solid #313b46; border-radius: 6px;
  padding: 6px 8px; font-size: 13px;
}

.btn {
  background: var(--panel2); color: var(--text);
  border: 1px solid #313b46; border-radius: 6px;
  padding: 8px 14px; font-size: 13px; cursor: pointer;
  transition: background .15s;
}
.btn:hover { background: #2a323c; }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--primary); border-color: #3a9d74; font-weight: bold; }
.btn-primary:hover:not(:disabled) { background: #35916a; }
.btn-ghost { background: transparent; }

/* ---------- メイン ---------- */
main {
  padding: 14px 16px 60px;
  display: flex; flex-direction: column; gap: 14px;
  max-width: 1200px; margin: 0 auto;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
}

/* ---------- 比較ステージ ---------- */
.stage {
  position: relative;
  min-height: 320px;
  display: flex; align-items: center; justify-content: center;
  background: #0f1216;
  border-radius: 8px;
  overflow: hidden;
}
.wrap { position: relative; display: none; line-height: 0; max-width: 100%; }
.stage.ready .wrap { display: block; }
.wrap canvas, .wrap img {
  max-width: 100%;
  max-height: 62vh;
  display: block;
}
.before-clip {
  position: absolute; inset: 0;
  width: 50%;
  overflow: hidden;
}
.before-clip img { max-width: none; height: 100%; width: auto; }
.handle {
  position: absolute; top: 0; bottom: 0; left: 50%;
  width: 2px; background: var(--accent); cursor: ew-resize;
}
.handle::after {
  content: ""; position: absolute; top: 50%; left: -10px;
  width: 22px; height: 22px; margin-top: -11px;
  border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,195,247,.25);
}

.drop {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  border: 2px dashed #39424e; border-radius: 8px; margin: 10px;
  color: var(--sub); text-align: center;
}
.drop.hidden { display: none; }
body.dragging .drop { border-color: var(--accent); color: var(--accent); }
.drop-icon { font-size: 34px; margin-bottom: 8px; }
.drop-title { font-size: 15px; color: var(--text); }
.drop-sub { font-size: 12px; margin-top: 6px; }

.stage-foot {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap;
  margin-top: 10px; font-size: 12px; color: var(--sub);
}
.lab b { color: var(--text); font-weight: normal; }
.note { color: var(--sub); }

/* ---------- 等倍の窓 ---------- */
.zooms { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.zooms figure { margin: 0; }
.zooms figcaption { font-size: 12px; color: var(--sub); margin-bottom: 6px; }
.zooms canvas {
  background: #0f1216;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: block;
  width: 240px; height: 240px;
}
.zoom-note { flex: 1; min-width: 220px; font-size: 12px; color: var(--sub); line-height: 1.8; }
.info { margin-top: 10px; color: var(--text); }
.info b { color: var(--accent); font-weight: normal; }

/* ---------- 説明 ---------- */
.about h2 { font-size: 14px; color: var(--accent); margin-bottom: 8px; }
.about p { font-size: 13px; color: var(--sub); line-height: 1.9; margin-bottom: 8px; }
.about .tip {
  background: var(--panel2); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px; margin-top: 4px;
}

/* ---------- 使い方 ---------- */
.helpmodal {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(8,10,13,.8);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.helpmodal[hidden] { display: none; }
.helpmodal-box {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 20px; max-width: 520px; width: 100%;
}
.helpmodal-box h3 { font-size: 15px; margin-bottom: 12px; color: var(--accent); }
.steps { padding-left: 20px; font-size: 13px; line-height: 2; color: var(--text); }
.helpmodal-box a { color: var(--accent); font-size: 13px; }
.helpmodal-actions { margin-top: 16px; text-align: right; }

/* ---------- 通知 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--panel2); border: 1px solid var(--line);
  color: var(--text); font-size: 13px;
  padding: 10px 16px; border-radius: 8px;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.on { opacity: 1; }

@media (max-width: 700px) {
  .topbar h1 { font-size: 16px; }
  .zooms canvas { width: 160px; height: 160px; }
}
