:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #202124;
  --muted: #5f6368;
  --line: #dfe3e8;
  --accent: #1a73e8;
  --accent-dark: #1558b0;
  --danger: #c5221f;
  --ok: #188038;
  --warn-bg: #fff8e1;
  --warn-line: #fbbc04;
  --odd: #0b8043;
  --even: #8e24aa;
  --shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Meiryo", "Yu Gothic", system-ui, sans-serif;
  line-height: 1.6;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 18px 50px;
}

header {
  background: linear-gradient(135deg, #ffffff, #edf4ff);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

h1 {
  margin: 0 0 8px;
  font-size: 28px;
  letter-spacing: 0.04em;
}

h2 {
  margin: 0 0 14px;
  font-size: 20px;
}

h3 {
  margin: 8px 0 6px;
  font-size: 18px;
}

.lead {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

button {
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.05s ease, background 0.2s ease, opacity 0.2s ease;
  font-family: inherit;
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.primary,
.merge {
  background: var(--accent);
  color: #fff;
}

.primary:hover:not(:disabled),
.merge:hover:not(:disabled) {
  background: var(--accent-dark);
}

.odd {
  background: var(--odd);
  color: #fff;
}

.even {
  background: var(--even);
  color: #fff;
}

.ghost {
  background: #eef2f7;
  color: var(--text);
}

.small-btn {
  width: auto;
  min-width: 150px;
  padding: 9px 14px;
  font-size: 14px;
}

.drop-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.drop-card {
  border: 2px dashed #c9d6e5;
  border-radius: 16px;
  padding: 20px;
  background: #fbfdff;
  text-align: center;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.1s ease;
  outline: none;
}

.drop-card:hover,
.drop-card:focus {
  border-color: var(--accent);
  background: #f4f8ff;
}

.drop-card.drag-over {
  border-color: var(--accent);
  background: #e8f0fe;
  transform: translateY(-1px);
}

.drop-card input[type="file"] {
  display: none;
}

.drop-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  height: 52px;
  border-radius: 16px;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 0 12px;
}

.odd-card .drop-icon {
  background: linear-gradient(135deg, #0b8043, #34a853);
}

.even-card .drop-icon {
  background: linear-gradient(135deg, #8e24aa, #ba68c8);
}

.drop-card p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
}

.file-count {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

.option-box {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 22px;
  margin-top: 16px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font-size: 14px;
}

.option-box label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.notice {
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 14px;
  color: #4b3a00;
  font-size: 14px;
}

.help-text {
  color: var(--muted);
  font-size: 13px;
  margin: 10px 0 0;
}

.status {
  padding: 12px 14px;
  border-radius: 12px;
  background: #eef2f7;
  border: 1px solid var(--line);
  color: var(--text);
  white-space: pre-wrap;
  min-height: 48px;
  font-size: 14px;
}

.status.ok {
  background: #e6f4ea;
  border-color: #b7dfc2;
  color: var(--ok);
}

.status.error {
  background: #fce8e6;
  border-color: #f6b8b5;
  color: var(--danger);
}

.status.running {
  background: #e8f0fe;
  border-color: #c6dafc;
  color: #174ea6;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
  word-break: break-all;
}

th {
  background: #f1f3f4;
  position: sticky;
  top: 0;
  z-index: 1;
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: 0;
}

.num {
  width: 76px;
  text-align: right;
  color: var(--muted);
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 24px;
}

.badge {
  display: inline-block;
  min-width: 3.5em;
  text-align: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}

.badge.odd-badge {
  background: var(--odd);
}

.badge.even-badge {
  background: var(--even);
}

.log {
  max-height: 260px;
  overflow: auto;
  background: #111827;
  color: #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  white-space: pre-wrap;
}

.site-footer {
  margin: 0;
  padding: 8px 8px 14px;
  text-align: center;
  font-size: 0.9rem;
  color: #1565c0;
  background: #f7fbff;
  border-top: 1px solid #d7e6f8;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: #1565c0;
  text-decoration: none;
  font-weight: 700;
}

.site-footer a:hover {
  color: #0d47a1;
}

.ad-panel {
  max-width: 880px;
  margin: 10px auto 0;
  padding: 0;
  border: 1px solid #d7e6f8;
  border-radius: 10px;
  background: #ffffff;
  overflow: hidden;
}

.ad-panel[hidden] {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}

.ad-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 8px;
  background: #f4f8ff;
  border-bottom: 1px solid #d7e6f8;
}

.ad-label {
  font-size: 0.72rem;
  color: #4f6f91;
  line-height: 1;
}

.ad-wait-text {
  margin-left: auto;
  color: #4f6f91;
  font-size: 0.72rem;
  line-height: 1.2;
}

.ad-close-btn {
  display: none;
  margin: 0 !important;
  padding: 3px 8px !important;
  min-height: 0;
  height: auto;
  line-height: 1.2;
  border: none;
  border-radius: 999px;
  background: #1565c0;
  color: #ffffff;
  font-size: 0.72rem !important;
  font-weight: 700;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.ad-close-btn:hover {
  background: #0d47a1;
}

.ad-close-btn.is-visible {
  display: inline-block;
}

.ad-body {
  padding: 8px;
  background: #ffffff;
}

@media (max-width: 760px) {
  .drop-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  h1 {
    font-size: 23px;
  }

  .wrap {
    padding: 16px 10px 36px;
  }

  .panel,
  header {
    padding: 16px;
    border-radius: 14px;
  }

  .controls button,
  .small-btn {
    width: 100%;
  }
}
