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

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface2: #252525;
  --border: #333;
  --accent: #fe2c55;
  --accent-dim: #c4003e;
  --text: #e8e8e8;
  --text-muted: #888;
  --success: #4caf50;
  --warn: #ff9800;
  --error: #f44336;
  --radius: 8px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  padding: 24px 16px;
}

/* ===== レイアウト ===== */
.container {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
h1 span { color: var(--accent); }

/* ===== カード ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

/* ===== モード切替 ===== */
.mode-group {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}
.mode-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
}
.mode-group input[type="radio"] { accent-color: var(--accent); }

/* ===== 入力欄 ===== */
.input-wrap {
  display: flex;
  gap: 10px;
}
input[type="text"] {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.15s;
}
input[type="text"]:focus { border-color: var(--accent); }
input[type="text"]::placeholder { color: var(--text-muted); }

/* ===== ボタン ===== */
button {
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  transition: background 0.15s, opacity 0.15s;
}
#btn-start {
  background: var(--accent);
  color: #fff;
  white-space: nowrap;
}
#btn-start:hover { background: var(--accent-dim); }
#btn-start:disabled { opacity: 0.5; cursor: not-allowed; }

#btn-download {
  display: none;
  background: var(--success);
  color: #fff;
  width: 100%;
  padding: 12px;
  font-size: 15px;
}
#btn-download:hover { background: #388e3c; }
#btn-download.visible { display: block; }

/* ===== 進捗ログ ===== */
#log-section { display: none; }
#log-section.visible { display: block; }

.log-header {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#log-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}
#log-list::-webkit-scrollbar { width: 4px; }
#log-list::-webkit-scrollbar-track { background: transparent; }
#log-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.log-item {
  background: var(--surface2);
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 13px;
  line-height: 1.5;
}
.log-item.success { border-left: 3px solid var(--success); }
.log-item.info    { border-left: 3px solid #2196f3; }
.log-item.warn    { border-left: 3px solid var(--warn); }
.log-item.error   { border-left: 3px solid var(--error); }

.log-sub {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 2px;
}

/* ===== ファイル選択 ===== */
.file-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.file-label input[type="file"] { display: none; }
#file-name {
  flex: 1;
  background: var(--surface2);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 14px;
  padding: 10px 14px;
  transition: border-color 0.15s;
}
.file-label:hover #file-name { border-color: var(--accent); color: var(--text); }
#file-name.selected { color: var(--text); border-style: solid; border-color: var(--success); }

#btn-start-retry {
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--radius);
  white-space: nowrap;
}
#btn-start-retry:hover { background: var(--accent-dim); }
#btn-start-retry:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== トースト ===== */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: #333;
  color: #fff;
  border-radius: 24px;
  padding: 10px 24px;
  font-size: 13px;
  transition: transform 0.3s ease;
  pointer-events: none;
  z-index: 999;
}
#toast.show { transform: translateX(-50%) translateY(0); }
