/* ── Reset & Base ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0a0f;
  --surface: rgba(255,255,255,0.05);
  --surface-hover: rgba(255,255,255,0.08);
  --border: rgba(255,255,255,0.10);
  --text: #e8e8f0;
  --text-muted: #7b7b9a;
  --accent: #7c6af7;
  --accent2: #4fc8e9;
  --accent3: #f76a8c;
  --success: #4ade80;
  --error: #f87171;
  --radius: 20px;
  --shadow: 0 8px 40px rgba(0,0,0,0.5);
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── 背景オーブ ──────────────────────────────────────── */
.bg-orbs { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.25;
  animation: orb-float 12s ease-in-out infinite alternate;
}
.orb1 { width: 600px; height: 600px; background: var(--accent); top: -200px; left: -200px; animation-delay: 0s; }
.orb2 { width: 500px; height: 500px; background: var(--accent2); bottom: -150px; right: -100px; animation-delay: -4s; }
.orb3 { width: 400px; height: 400px; background: var(--accent3); top: 40%; left: 50%; transform: translateX(-50%); animation-delay: -8s; }

@keyframes orb-float {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(30px, 30px) scale(1.05); }
}

/* ── Layout ──────────────────────────────────────────── */
.container {
  position: relative; z-index: 1;
  max-width: 680px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ── Header ──────────────────────────────────────────── */
.header { text-align: center; margin-bottom: 2.5rem; }

.logo {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: 2rem; font-weight: 700; letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: .75rem;
}
.logo-icon { font-size: 2rem; filter: drop-shadow(0 0 12px var(--accent)); }

.tagline {
  color: var(--text-muted); font-size: .95rem; line-height: 1.7;
}
.tagline strong { color: var(--text); }

/* ── Card ──────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}
.hidden { display: none !important; }

/* ── ドロップゾーン ──────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 14px;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(124,106,247,.08);
}
.drop-zone.has-file {
  border-color: var(--accent);
  border-style: solid;
}

.drop-icon { font-size: 3rem; margin-bottom: .75rem; }
.drop-text { font-size: 1.05rem; font-weight: 500; margin-bottom: .25rem; }
.drop-sub  { color: var(--text-muted); font-size: .85rem; margin-bottom: .75rem; }
.drop-formats { margin-top: .75rem; font-size: .78rem; color: var(--text-muted); }
.drop-filename { margin-top: .5rem; font-size: .9rem; color: var(--accent2); font-weight: 500; }

/* ── 設定パネル ──────────────────────────────────────── */
.settings { margin: 1.5rem 0 1.25rem; display: flex; flex-direction: column; gap: .9rem; }

.setting-row {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem 1rem;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.setting-row label {
  flex: 1; font-size: .88rem; color: var(--text-muted);
  display: flex; align-items: center; gap: .4rem;
}
.setting-value {
  font-size: .85rem; color: var(--accent2); font-weight: 600;
  min-width: 32px; text-align: right;
}

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  flex: 0 0 130px; height: 4px;
  background: var(--border); border-radius: 99px; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); border: 2px solid #fff; cursor: pointer;
  box-shadow: 0 0 8px var(--accent);
}

select {
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .35rem .6rem; border-radius: 7px;
  font-size: .83rem; cursor: pointer; flex: 0 0 auto;
}

/* ── トグル ──────────────────────────────────────────── */
.toggle { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0;
  background: var(--border); border-radius: 99px; cursor: pointer;
  transition: background .2s;
}
.slider::before {
  content: ''; position: absolute;
  width: 18px; height: 18px; left: 4px; top: 4px;
  background: #fff; border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
.toggle input:checked + .slider { background: var(--accent); }
.toggle input:checked + .slider::before { transform: translateX(20px); }

/* ── バッジ ──────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: .1rem .45rem; font-size: .68rem; font-weight: 600;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 99px; color: #fff; letter-spacing: .04em;
}

/* ── ボタン ──────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .75rem 1.75rem; border-radius: 10px;
  font-family: inherit; font-size: .95rem; font-weight: 600;
  cursor: pointer; border: none; text-decoration: none;
  transition: transform .15s, box-shadow .15s, opacity .15s;
}
.btn:active { transform: scale(.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; width: 100%;
  box-shadow: 0 4px 24px rgba(124,106,247,.4);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 6px 32px rgba(124,106,247,.6); transform: translateY(-1px); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { background: var(--surface-hover); }

/* ── 進捗 ──────────────────────────────────────────── */
.progress-header {
  display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem;
}
.progress-title { font-size: 1.05rem; font-weight: 600; }
.progress-file   { font-size: .82rem; color: var(--text-muted); margin-top: .2rem; }

.spinner {
  flex-shrink: 0;
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.progress-bar-wrap {
  background: rgba(255,255,255,.06);
  border-radius: 99px; height: 8px;
  overflow: hidden; margin-bottom: .5rem;
}
.progress-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 99px;
  transition: width .5s ease;
}
.progress-pct { font-size: .82rem; color: var(--text-muted); text-align: right; margin-bottom: 1rem; }

.log-box {
  background: rgba(0,0,0,.4);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .9rem 1rem;
  max-height: 200px; overflow-y: auto;
  font-size: .8rem; font-family: 'Menlo', 'Consolas', monospace;
  color: var(--text-muted); line-height: 1.6;
  scroll-behavior: smooth;
}
.log-box p { margin-bottom: .15rem; white-space: pre-wrap; }
.log-box p.ok { color: var(--success); }
.log-box p.err { color: var(--error); }

/* ── 完了・エラー ──────────────────────────────────── */
.result-card, .error-card { text-align: center; }

.result-icon { font-size: 3.5rem; margin-bottom: .75rem; }
.result-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 1.5rem; }

.channel-info {
  display: flex; gap: 1rem; justify-content: center; margin-bottom: 2rem;
}
.channel-item {
  flex: 1; max-width: 220px;
  padding: 1rem; border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.03);
}
.channel-item.left  { border-color: var(--accent); }
.channel-item.right { border-color: var(--accent2); }
.ch-label {
  display: inline-block;
  font-size: 1.3rem; font-weight: 800;
  margin-bottom: .3rem;
}
.channel-item.left  .ch-label { color: var(--accent); }
.channel-item.right .ch-label { color: var(--accent2); }
.ch-desc { display: block; font-size: .82rem; color: var(--text-muted); }

.download-btn { margin-bottom: .75rem; }
.reset-btn    { width: 100%; }

.error-msg { color: var(--error); font-size: .9rem; margin-bottom: 1.5rem; white-space: pre-wrap; }

/* ── フッター ──────────────────────────────────────── */
.footer {
  position: relative; z-index: 1;
  text-align: center; padding: 1.5rem;
  color: var(--text-muted); font-size: .8rem;
}
.footer a { color: var(--accent2); text-decoration: none; }
.footer a:hover { text-decoration: underline; }

/* ── レスポンシブ ──────────────────────────────────── */
@media (max-width: 520px) {
  .container { padding: 1.25rem 1rem 3rem; }
  .card { padding: 1.5rem; }
  .channel-info { flex-direction: column; align-items: center; }
  input[type="range"] { flex: 0 0 100px; }
}

/* ── トークン認証 UI ─────────────────────────────────── */
.token-area {
  margin-bottom: 1.25rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,.02);
}
.token-row {
  display: flex; gap: .5rem; margin-bottom: .5rem;
}
.token-row input[type="text"] {
  flex: 1;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .5rem .8rem; border-radius: 8px;
  font-size: .88rem; font-family: monospace;
  outline: none; transition: border-color .2s;
}
.token-row input[type="text"]:focus { border-color: var(--accent); }
.btn-verify {
  padding: .5rem 1rem; border-radius: 8px;
  background: var(--accent); color: #fff;
  font-family: inherit; font-size: .85rem; font-weight: 600;
  border: none; cursor: pointer; flex-shrink: 0;
  transition: opacity .15s;
}
.btn-verify:hover { opacity: .85; }
.token-hint { font-size: .78rem; color: var(--text-muted); }
.token-hint a.pricing-link { color: var(--accent2); text-decoration: none; }
.token-hint a.pricing-link:hover { text-decoration: underline; }
.token-ok { font-size: .82rem; color: var(--success); margin-top: .4rem; font-weight: 600; }
