:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #d7dce5;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --danger: #b91c1c;
  --ok: #047857;
  --warn-bg: #fff7ed;
  --warn-line: #fed7aa;
  --shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 32px;
  background: linear-gradient(135deg, #111827, #1f2937);
  color: #fff;
}

h1,
h2,
p {
  margin: 0;
}

.header-main {
  min-width: 0;
}

.top-link {
  display: inline-flex;
  align-items: center;
  margin-bottom: 10px;
  color: #bfdbfe;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.top-link::before {
  content: "←";
  margin-right: 6px;
}

.top-link:hover,
.top-link:focus-visible {
  color: #ffffff;
  text-decoration: underline;
}

h1 {
  font-size: clamp(24px, 4vw, 36px);
  letter-spacing: 0.02em;
}

h2 {
  margin-bottom: 14px;
  font-size: 18px;
}

.lead {
  margin-top: 6px;
  color: #d1d5db;
}

.version {
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  color: #e5e7eb;
  font-size: 13px;
}

.layout {
  width: min(1180px, calc(100% - 24px));
  margin: 18px auto 40px;
}

.notice {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid var(--warn-line);
  border-radius: 14px;
  background: var(--warn-bg);
}

.notice strong {
  flex: 0 0 auto;
  color: #9a3412;
}

.card {
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.file-grid,
.settings-grid,
.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.file-box,
.settings-grid label {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfcff;
}

.file-label {
  font-weight: 700;
}

.file-info {
  color: var(--muted);
  word-break: break-all;
}

input[type="file"],
input[type="number"],
select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.hint {
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
}

.button-row,
.section-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.section-title-row {
  justify-content: space-between;
}

button {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

button:hover:not(:disabled) {
  border-color: #9ca3af;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

button.primary:hover:not(:disabled) {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

.progress-wrap {
  overflow: hidden;
  height: 12px;
  margin-top: 14px;
  border-radius: 999px;
  background: #e5e7eb;
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.15s ease-out;
}

.status-text {
  margin-top: 8px;
  color: var(--muted);
}

.summary-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcff;
}

.summary-item .label {
  color: var(--muted);
  font-size: 12px;
}

.summary-item .value {
  margin-top: 4px;
  font-weight: 700;
  word-break: break-all;
}

.summary-ok {
  color: var(--ok);
}

.summary-ng {
  color: var(--danger);
}

.table-wrap {
  overflow: auto;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

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

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

th {
  background: #f3f4f6;
  color: #374151;
  font-weight: 700;
  white-space: nowrap;
}

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

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge-add {
  background: #dcfce7;
  color: #166534;
}

.badge-delete {
  background: #fee2e2;
  color: #991b1b;
}

.badge-change {
  background: #fef3c7;
  color: #92400e;
}

.detail-panel {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #111827;
  color: #e5e7eb;
}

.detail-panel h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

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

.dump-box {
  min-width: 0;
}

.dump-title {
  margin-bottom: 6px;
  color: #cbd5e1;
  font-weight: 700;
}

pre {
  overflow: auto;
  max-height: 360px;
  margin: 0;
  padding: 10px;
  border-radius: 10px;
  background: #030712;
  color: #e5e7eb;
  font-family: "Cascadia Mono", "Consolas", monospace;
  font-size: 12px;
  line-height: 1.55;
}

.hidden {
  display: none !important;
}

@media (max-width: 760px) {
  .app-header {
    padding: 22px 16px;
  }

  .file-grid,
  .settings-grid,
  .summary-grid,
  .dump-grid {
    grid-template-columns: 1fr;
  }

  .notice {
    align-items: flex-start;
    flex-direction: column;
  }
}
