:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #1f2733;
  --muted: #6b7686;
  --line: #e3e8f0;
  --brand: #305496;
  --brand-d: #24417a;
  --merge: #f4b0b0;
  --merge-d: #b23b3b;
  --possible: #ffe699;
  --possible-d: #9a7b15;
  --passed: #c6e0b4;
  --passed-d: #4f7a2e;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
header {
  padding: 32px 20px 8px;
  text-align: center;
}
header h1 { margin: 0; font-size: 28px; }
.sub { color: var(--muted); margin: 6px 0 0; }
main { max-width: 1080px; margin: 0 auto; padding: 16px 20px 40px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  margin: 16px 0;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .04);
}

.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  padding: 8px 14px; border-radius: 9px; cursor: pointer; font-weight: 600;
}
.tab.active { color: #fff; background: var(--brand); border-color: var(--brand); }
.tabpane { display: none; }
.tabpane.active { display: block; }

.drop {
  display: block; border: 2px dashed var(--line); border-radius: 12px;
  padding: 30px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.dragover { border-color: var(--brand); background: #f7faff; }
.drop.loading {
  border-color: var(--brand); color: var(--brand);
  background-image: linear-gradient(90deg, transparent, rgba(48, 84, 150, .10), transparent);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.drop.loading .drop-icon { animation: bob .9s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

.filestatus { margin-top: 10px; display: flex; align-items: center; gap: 10px; min-height: 18px; }
.spinner {
  width: 16px; height: 16px; flex: none; border: 2px solid #c9d3e6;
  border-top-color: var(--brand); border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.progress { flex: 1; max-width: 220px; height: 6px; background: #e9eef7; border-radius: 4px; overflow: hidden; }
.progress .bar {
  display: block; height: 100%; width: 40%; background: var(--brand);
  border-radius: 4px; animation: indet 1.1s ease-in-out infinite;
}
@keyframes indet {
  0% { margin-left: -40%; }
  100% { margin-left: 100%; }
}
.drop-icon { font-size: 34px; margin-bottom: 8px; }
.muted { color: var(--muted); font-size: 13px; }
#fileName { margin-top: 10px; }

textarea {
  width: 100%; min-height: 150px; resize: vertical; padding: 12px;
  border: 1px solid var(--line); border-radius: 10px; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.controls {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 16px; margin-top: 18px;
}
.thr { display: flex; align-items: center; gap: 10px; font-weight: 600; flex-wrap: wrap; }
.thr input[type=range] { accent-color: var(--brand); }
.badge {
  background: var(--brand); color: #fff; border-radius: 7px; padding: 2px 8px;
  font-variant-numeric: tabular-nums; font-size: 13px;
}
.btns { display: flex; gap: 10px; }
button { font: inherit; }
.primary {
  background: var(--brand); color: #fff; border: none; padding: 10px 18px;
  border-radius: 9px; cursor: pointer; font-weight: 700;
}
.primary:hover { background: var(--brand-d); }
.ghost {
  background: #fff; color: var(--brand); border: 1px solid var(--line);
  padding: 10px 16px; border-radius: 9px; cursor: pointer; font-weight: 600;
}
.ghost:hover { border-color: var(--brand); }

.error {
  margin-top: 14px; padding: 10px 14px; border-radius: 9px;
  background: #fde8e8; color: #9b1c1c; border: 1px solid #f6c5c5;
}

.notice-info {
  margin: 0 0 14px; padding: 10px 14px; border-radius: 9px;
  background: #fff7e6; color: #8a5a00; border: 1px solid #f3d9a0; font-size: 13px;
}
.summary { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.stat {
  flex: 1; min-width: 130px; background: #f7faff; border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px;
}
.stat .n { font-size: 24px; font-weight: 800; }
.stat .l { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }

.legend { color: var(--muted); font-size: 13px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.chip.merge { background: var(--merge); color: var(--merge-d); }
.chip.possible { background: var(--possible); color: var(--possible-d); }
.chip.passed { background: var(--passed); color: var(--passed-d); }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.filters { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.check { color: var(--ink); display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.check input { accent-color: var(--brand); }

.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--brand); color: #fff; position: sticky; top: 0; font-weight: 600; white-space: nowrap; }
tbody tr td { background: transparent; }
tbody tr.groupstart td { border-top: 2px solid #9fb0d0; }
td.ws { font-family: ui-monospace, Menlo, Consolas, monospace; white-space: nowrap; }
td.note { font-weight: 700; white-space: nowrap; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

footer { text-align: center; color: var(--muted); font-size: 13px; padding: 0 20px 30px; }
