*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --border: #dddbd3;
  --text: #1a1a18;
  --muted: #6b6a64;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --warn-bg: #fef9ec;
  --warn-border: #f0c040;
  --success: #16a34a;
  --danger: #dc2626;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a18;
    --surface: #26261f;
    --border: #3a3a30;
    --text: #e8e6de;
    --muted: #9a9890;
    --warn-bg: #2a2410;
    --warn-border: #8a6c10;
  }
}

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

.container {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

header { text-align: center; padding: 16px 0 8px; }
header h1 { font-size: 22px; font-weight: 600; }
header .subtitle { color: var(--muted); font-size: 14px; margin-top: 4px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}

.card h2 { font-size: 15px; font-weight: 600; margin-bottom: 12px; }

.notice {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 13px;
  color: var(--text);
}
.notice strong { display: block; margin-bottom: 8px; font-size: 14px; }
.notice ul { padding-left: 18px; }
.notice li { margin-bottom: 4px; }

input[type="password"], select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
input[type="password"]:focus, select:focus { border-color: var(--accent); }

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 28px;
  text-align: center;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  transition: border-color 0.15s, background 0.15s;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

.file-info {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
  padding: 8px 12px;
  background: var(--bg);
  border-radius: 6px;
}

.hint { font-size: 13px; color: var(--muted); margin: 12px 0 6px; }

.preview-table, #result-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 4px;
  overflow-x: auto;
  display: block;
}
.preview-table th, #result-table-wrap th {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}
.preview-table td, #result-table-wrap td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

button {
  display: inline-block;
  padding: 10px 24px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: background 0.15s, opacity 0.15s;
}

#run-btn {
  width: 100%;
  background: var(--accent);
  color: #fff;
}
#run-btn:hover:not(:disabled) { background: var(--accent-hover); }
#run-btn:disabled { opacity: 0.45; cursor: not-allowed; }

#download-btn {
  margin-top: 16px;
  background: var(--success);
  color: #fff;
}
#download-btn:hover { opacity: 0.88; }

.progress-bar-wrap {
  height: 8px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.3s ease;
}

#progress-text { font-size: 13px; color: var(--muted); margin-bottom: 10px; }

#progress-log {
  max-height: 180px;
  overflow-y: auto;
  font-size: 12px;
  color: var(--muted);
  font-family: monospace;
}
#progress-log .log-line { padding: 2px 0; border-bottom: 1px solid var(--border); }
#progress-log .ok   { color: var(--success); }
#progress-log .fail { color: var(--danger); }

#result-summary { font-size: 14px; margin-bottom: 12px; line-height: 1.8; }

.hidden { display: none !important; }
