:root {
  --bg: #0b1020;
  --bg-elev: #141a32;
  --bg-card: #1a2142;
  --bg-card-hover: #222a54;
  --border: #2a3566;
  --text: #e7eaf6;
  --text-muted: #9aa3c7;
  --text-sub: #6b7499;
  --accent: #4f8cff;
  --accent-2: #7c5cff;
  --gold: #ffd26b;
  --green: #35d399;
  --orange: #ff9660;
  --red: #ff6677;
  --chip-S: linear-gradient(135deg, #ff5a6a, #ff9660);
  --chip-A: linear-gradient(135deg, #ffb347, #ffd26b);
  --chip-B: linear-gradient(135deg, #4f8cff, #7c5cff);
  --chip-C: linear-gradient(135deg, #6b7499, #9aa3c7);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-feature-settings: "palt";
}

/* ===== Hero ===== */
.hero {
  padding: 60px 24px 40px;
  background:
    radial-gradient(1200px 400px at 20% -10%, rgba(79,140,255,0.25), transparent 60%),
    radial-gradient(900px 400px at 90% 10%, rgba(124,92,255,0.22), transparent 60%),
    linear-gradient(180deg, #0b1020 0%, #0e1430 100%);
  border-bottom: 1px solid var(--border);
}
.hero-inner { max-width: 1400px; margin: 0 auto; }
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.brand-badge {
  background: linear-gradient(135deg, #4f8cff, #7c5cff);
  color: white;
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
}
.brand-sub {
  color: var(--text-sub);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.hero h1 {
  margin: 0 0 20px;
  font-size: clamp(28px, 4vw, 52px);
  line-height: 1.25;
  font-weight: 900;
  letter-spacing: -0.01em;
}
.hero-kicker {
  display: block;
  color: var(--text-muted);
  font-size: 0.6em;
  font-weight: 500;
  margin-bottom: 4px;
}
.hero-main {
  display: block;
  background: linear-gradient(135deg, #fff 0%, #a7bdff 60%, #d4b9ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-lead {
  font-size: clamp(15px, 1.4vw, 18px);
  color: var(--text-muted);
  margin: 0;
  max-width: 720px;
}
.hero-lead strong {
  color: var(--gold);
  font-weight: 700;
}

/* ===== Stats Banner ===== */
.stats-banner {
  max-width: 1400px;
  margin: 32px auto 24px;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  gap: 20px;
  align-items: center;
}
.stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px 28px;
  position: relative;
}
.stat.highlight {
  background: linear-gradient(135deg, rgba(79,140,255,0.15), rgba(124,92,255,0.18));
  border: 1px solid rgba(124,92,255,0.5);
  box-shadow: 0 10px 40px rgba(124,92,255,0.2);
}
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.stat-value {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 6px;
}
.num {
  font-size: 54px;
  font-weight: 900;
  color: var(--text);
  line-height: 1;
}
.stat.highlight .num {
  background: linear-gradient(135deg, #ffd26b, #ff9660);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.unit {
  font-size: 16px;
  color: var(--text-muted);
  font-weight: 500;
}
.stat-sub {
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.5;
}
.stat-arrow {
  text-align: center;
  color: var(--text-muted);
}
.arrow-line {
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  margin: 0 auto 6px;
}
.arrow-label {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--text-sub);
  margin-bottom: 4px;
}
.arrow-head {
  color: var(--accent-2);
  font-size: 14px;
}
.stat-delta {
  background: linear-gradient(135deg, rgba(255,92,106,0.2), rgba(255,150,96,0.15));
  border: 1px solid rgba(255,150,96,0.4);
  border-radius: 16px;
  padding: 20px 24px;
  text-align: center;
}
.delta-num {
  font-size: 36px;
  font-weight: 900;
  color: var(--orange);
  line-height: 1;
}
.delta-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===== Controls ===== */
.controls {
  max-width: 1400px;
  margin: 24px auto 16px;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.controls-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.view-toggle {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
}
.view-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 10px 18px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.view-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  box-shadow: 0 4px 14px rgba(79,140,255,0.4);
}
.view-btn:not(.active):hover {
  color: var(--text);
  background: var(--bg-card-hover);
}
.controls-right {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.controls-right select,
.controls-right input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  min-width: 140px;
}
.controls-right input {
  min-width: 220px;
}
.controls-right select:focus,
.controls-right input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ===== Result Summary ===== */
.result-summary {
  max-width: 1400px;
  margin: 0 auto 16px;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
}
.result-count strong { color: var(--text); font-size: 15px; }
.dot { margin: 0 8px; color: var(--text-sub); }
.legend {
  display: flex;
  gap: 14px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}
.chip {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 4px;
}
.chip-S { background: var(--chip-S); }
.chip-A { background: var(--chip-A); }
.chip-B { background: var(--chip-B); }
.chip-C { background: var(--chip-C); }

/* ===== List ===== */
.list-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px 40px;
}
.list-container.view-enriched {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}
.list-container.view-original {
  display: block;
}
.list-container.view-split {
  display: block;
}

/* ---- Enriched Card ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(124,92,255,0.5);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.card-name {
  font-weight: 700;
  font-size: 16px;
  line-height: 1.3;
  margin-bottom: 4px;
}
.card-meta {
  font-size: 12px;
  color: var(--text-sub);
}
.priority-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-weight: 900;
  font-size: 18px;
  color: white;
  flex-shrink: 0;
}
.priority-S { background: var(--chip-S); box-shadow: 0 4px 12px rgba(255,90,106,0.4); }
.priority-A { background: var(--chip-A); color: #1a1a1a; }
.priority-B { background: var(--chip-B); }
.priority-C { background: var(--chip-C); }

.card-score-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.score-bar {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
}
.score-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  border-radius: 3px;
}
.score-num {
  font-weight: 700;
  font-size: 14px;
  color: var(--gold);
  min-width: 40px;
  text-align: right;
}

.card-summary {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.tag {
  background: rgba(79,140,255,0.12);
  color: #8aaeff;
  border: 1px solid rgba(79,140,255,0.3);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}
.tag.hot {
  background: rgba(255,150,96,0.15);
  color: var(--orange);
  border-color: rgba(255,150,96,0.4);
}
.card-angle {
  background: rgba(255,255,255,0.03);
  border-left: 3px solid var(--gold);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.card-angle-label {
  font-size: 10px;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.1em;
  margin-bottom: 3px;
}
.card-angle-text {
  color: var(--text);
  font-weight: 500;
}

/* ---- Spreadsheet View ---- */
.list-container.view-spreadsheet {
  display: block;
  padding: 0;
  max-width: none;
}
.sheet-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: auto;
  max-height: calc(100vh - 200px);
  position: relative;
  margin: 0 24px;
}
.sheet {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
  width: max-content;
  min-width: 100%;
}
.sheet-group-row th {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.12em;
  border-bottom: 2px solid var(--border);
}
.sheet-group-before {
  background: #13192e;
  color: var(--text-sub);
  text-align: left;
}
.sheet-group-after {
  background: linear-gradient(135deg, rgba(79,140,255,0.22), rgba(124,92,255,0.22));
  color: #c7d2ff;
  text-align: left;
}
.sheet-group-after .group-label {
  background: linear-gradient(135deg, #ffd26b, #ff9660);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 900;
}
.sheet-head-row th {
  position: sticky;
  top: 38px;
  z-index: 2;
  padding: 10px 12px;
  font-weight: 600;
  font-size: 11px;
  text-align: left;
  letter-spacing: 0.03em;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.sheet-head-row th.before {
  background: #0f1428;
  color: var(--text-sub);
}
.sheet-head-row th.after {
  background: #1a2244;
  color: #a7bdff;
}
.sheet-head-row th.num { text-align: right; }
.sheet-head-row th.center { text-align: center; }

.sheet tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
  white-space: nowrap;
  font-size: 12.5px;
}
.sheet-row { cursor: pointer; transition: background 0.12s; }
.sheet-row:hover td.before { background: rgba(255,255,255,0.035); }
.sheet-row:hover td.after { background: rgba(124,92,255,0.08); }

.sheet td.before { background: rgba(255,255,255,0.012); color: var(--text); }
.sheet td.after { background: rgba(79,140,255,0.045); color: var(--text); }
.sheet td.name { font-weight: 700; color: #fff; }
.sheet td.num { text-align: right; font-variant-numeric: tabular-nums; }
.sheet td.center { text-align: center; }
.sheet td.small { font-size: 11.5px; }
.sheet td.muted { color: var(--text-muted); }
.sheet td.mono { font-family: 'SF Mono', Consolas, monospace; font-size: 11.5px; color: var(--text-muted); }
.sheet td.accent { color: #8aaeff; }
.sheet td.wide { max-width: 240px; white-space: normal; line-height: 1.45; }
.sheet td.angle { color: var(--gold); font-weight: 500; }

/* Priority pill */
.priority-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 26px;
  padding: 0 8px;
  border-radius: 6px;
  font-weight: 900;
  font-size: 12px;
  color: white;
}
.priority-pill.priority-S { background: var(--chip-S); box-shadow: 0 0 0 1px rgba(255,90,106,0.3); }
.priority-pill.priority-A { background: var(--chip-A); color: #1a1a1a; }
.priority-pill.priority-B { background: var(--chip-B); }
.priority-pill.priority-C { background: var(--chip-C); }

/* Score cell */
.score-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}
.score-bar-mini {
  width: 50px;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
}
.score-fill-mini {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  border-radius: 2px;
}
.score-cell span {
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  min-width: 24px;
  text-align: right;
}

/* Stars */
.stars { color: var(--gold); font-size: 11px; letter-spacing: 1px; }
.stars-dim { color: rgba(255,210,107,0.25); }

/* Mini tag */
.mini-tag {
  display: inline-block;
  background: rgba(79,140,255,0.12);
  color: #a7bdff;
  border: 1px solid rgba(79,140,255,0.3);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10.5px;
  margin-right: 4px;
  margin-bottom: 2px;
  white-space: nowrap;
}
.mini-tag.hot {
  background: rgba(255,150,96,0.15);
  color: var(--orange);
  border-color: rgba(255,150,96,0.4);
}

/* Hint */
.sheet-hint {
  padding: 16px 24px;
  font-size: 13px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.02);
  border-top: 1px solid var(--border);
  text-align: center;
}
.sheet-hint strong { color: var(--gold); }

.sheet-note {
  padding: 14px 20px;
  background: rgba(255,150,96,0.08);
  color: var(--orange);
  font-size: 13px;
  border-bottom: 1px solid rgba(255,150,96,0.2);
}

.sheet.original-only th,
.sheet.original-only td {
  background: #0f1428;
}
.sheet.original-only tbody td {
  color: var(--text-muted);
}
.sheet.original-only tbody td.name { color: var(--text); font-weight: 600; }

/* ---- Split Comparison ---- */
.split-row {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
  margin-bottom: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.split-before {
  padding: 16px;
  background: rgba(255,255,255,0.02);
  border-right: 1px solid var(--border);
}
.split-before-label,
.split-after-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--text-sub);
  margin-bottom: 8px;
}
.split-before-label { color: var(--text-sub); }
.split-after-label {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.split-before-data {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.8;
}
.split-before-data strong {
  color: var(--text);
  font-weight: 600;
}
.split-after {
  padding: 16px;
  cursor: pointer;
}
.split-after:hover { background: var(--bg-card-hover); }

/* ===== Modal ===== */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 20, 0.75);
  backdrop-filter: blur(6px);
}
.modal-panel {
  position: relative;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: min(900px, 92vw);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 40px 80px rgba(0,0,0,0.6);
}
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 22px;
  cursor: pointer;
  z-index: 10;
}
.modal-close:hover { background: rgba(255,255,255,0.1); }

.modal-hero {
  padding: 32px 36px 24px;
  background:
    radial-gradient(600px 200px at 20% 0%, rgba(79,140,255,0.15), transparent),
    radial-gradient(500px 200px at 100% 0%, rgba(124,92,255,0.15), transparent);
  border-bottom: 1px solid var(--border);
}
.modal-hero h2 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 800;
}
.modal-hero-meta {
  color: var(--text-muted);
  font-size: 13px;
}
.modal-priority-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.modal-score-big {
  font-size: 42px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--gold), var(--orange));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
}
.modal-body {
  padding: 24px 36px 32px;
}
.modal-section {
  margin-bottom: 28px;
}
.modal-section h3 {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.modal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 24px;
}
.modal-kv {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.modal-kv .k {
  font-size: 11px;
  color: var(--text-sub);
  letter-spacing: 0.05em;
}
.modal-kv .v {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}
.modal-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.modal-list li {
  background: rgba(255,255,255,0.03);
  padding: 10px 14px;
  border-radius: 8px;
  border-left: 3px solid var(--accent);
  font-size: 13px;
  color: var(--text);
}
.modal-list li.hot {
  border-left-color: var(--orange);
  background: rgba(255,150,96,0.06);
}
.message-box {
  background: linear-gradient(180deg, rgba(79,140,255,0.08), rgba(124,92,255,0.05));
  border: 1px solid rgba(124,92,255,0.3);
  border-radius: 12px;
  padding: 18px 20px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--text);
  white-space: pre-wrap;
}
.before-after-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.ba-panel {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.ba-panel h4 {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0 0 10px;
  color: var(--text-sub);
}
.ba-panel.after h4 {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.ba-list { font-size: 12px; color: var(--text-muted); line-height: 1.8; }
.ba-list strong { color: var(--text); }
.field-count {
  display: inline-block;
  background: rgba(255,255,255,0.06);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  margin-left: 6px;
}
.ba-panel.after .field-count {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
}

/* ===== AI Process Button ===== */
.ai-process-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  background: linear-gradient(135deg, #4f8cff 0%, #7c5cff 50%, #ff6ec4 100%);
  background-size: 200% 200%;
  animation: gradientShift 3s ease infinite;
  border: none;
  border-radius: 12px;
  color: white;
  font-family: inherit;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  box-shadow:
    0 6px 20px rgba(124,92,255,0.4);
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}
.ai-process-btn.replay {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  box-shadow: none;
  animation: none;
  padding: 9px 16px;
  font-weight: 600;
  font-size: 13px;
}
.ai-process-btn.replay::before { display: none; }
.ai-process-btn.replay:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text);
  transform: none;
}
.ai-process-btn.replay .ai-process-sub { display: none; }
.ai-process-btn::before {
  content: "";
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
  animation: shimmer 2.5s infinite;
}
@keyframes shimmer { 0%, 100% { left: -100%; } 50% { left: 100%; } }
@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.ai-process-btn:hover {
  transform: translateY(-2px);
  box-shadow:
    0 12px 32px rgba(124,92,255,0.5),
    0 0 0 6px rgba(124,92,255,0.15);
}
.ai-process-icon {
  font-size: 18px;
  filter: drop-shadow(0 0 6px rgba(255,255,255,0.4));
}
.ai-process-main {
  font-size: 14px;
  letter-spacing: 0.03em;
}
.ai-process-sub {
  font-size: 10px;
  font-weight: 500;
  opacity: 0.9;
  letter-spacing: 0.03em;
  padding: 2px 8px;
  background: rgba(255,255,255,0.18);
  border-radius: 999px;
}
.ai-process-arrow { font-size: 12px; margin-left: 2px; }

.view-btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  margin-left: 8px;
}

/* ===== AI Processing Overlay ===== */
.ai-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ai-overlay[hidden] { display: none; }
.ai-overlay-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(800px 600px at 50% 50%, rgba(124,92,255,0.35), transparent 70%),
    rgba(5, 8, 20, 0.92);
  backdrop-filter: blur(10px);
}
.ai-overlay-panel {
  position: relative;
  background: linear-gradient(180deg, rgba(30,40,80,0.8), rgba(15,20,45,0.95));
  border: 1px solid rgba(124,92,255,0.4);
  border-radius: 24px;
  padding: 40px 50px;
  width: min(600px, 90vw);
  text-align: center;
  box-shadow: 0 40px 100px rgba(0,0,0,0.6);
}
.ai-brain-wrap {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto 24px;
}
.ai-brain {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  background: linear-gradient(135deg, rgba(79,140,255,0.3), rgba(124,92,255,0.3));
  border-radius: 50%;
  border: 2px solid rgba(124,92,255,0.6);
  animation: brainBob 1.2s ease-in-out infinite;
  z-index: 3;
}
.ai-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(124,92,255,0.6);
  animation: pulseRing 1.8s ease-out infinite;
}
.ai-pulse-2 { animation-delay: 0.6s; }
@keyframes pulseRing {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(2.2); opacity: 0; }
}
@keyframes brainBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.ai-title {
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(135deg, #fff, #a7bdff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 10px;
}
.ai-step-label {
  font-size: 15px;
  color: var(--gold);
  font-weight: 600;
  min-height: 24px;
  margin-bottom: 24px;
  letter-spacing: 0.02em;
}
.ai-progress-wrap {
  margin-bottom: 20px;
}
.ai-progress-bar {
  height: 10px;
  background: rgba(255,255,255,0.08);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 10px;
}
.ai-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4f8cff 0%, #7c5cff 50%, #ff6ec4 100%);
  background-size: 200% 100%;
  animation: gradientShift 2s linear infinite;
  border-radius: 5px;
  transition: width 0.3s ease;
  box-shadow: 0 0 16px rgba(124,92,255,0.5);
}
.ai-progress-count {
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.ai-progress-count span {
  color: var(--text);
  font-weight: 700;
  font-size: 15px;
}
.ai-log {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  height: 110px;
  overflow: hidden;
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 11px;
  line-height: 1.7;
  color: var(--text-muted);
  text-align: left;
}
.ai-log div {
  animation: logFadeIn 0.3s ease-out;
}
.ai-log div.accent { color: #8aaeff; }
.ai-log div.success { color: var(--green); }
@keyframes logFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Row reveal animation ===== */
.sheet-row.reveal {
  opacity: 0;
  animation: rowReveal 0.5s ease-out forwards;
}
.sheet-row.reveal td.after {
  position: relative;
}
.sheet-row.reveal td.after::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(124,92,255,0.4), transparent);
  animation: aiCellSweep 0.8s ease-out forwards;
  pointer-events: none;
}
@keyframes rowReveal {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes aiCellSweep {
  0% { opacity: 1; transform: translateX(-30%); }
  100% { opacity: 0; transform: translateX(30%); }
}

/* ===== Footer ===== */
.footer {
  padding: 24px;
  text-align: center;
  color: var(--text-sub);
  font-size: 12px;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}
.footer-sub {
  font-size: 11px;
  margin-top: 4px;
  color: #555e7e;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .stats-banner { grid-template-columns: 1fr; gap: 12px; }
  .stat-arrow { display: none; }
  .controls { flex-direction: column; }
  .controls-right { width: 100%; }
  .controls-right select,
  .controls-right input { min-width: 0; flex: 1; }
  .modal-grid { grid-template-columns: 1fr; }
  .before-after-grid { grid-template-columns: 1fr; }
  .split-row { grid-template-columns: 1fr; }
  .split-before { border-right: none; border-bottom: 1px solid var(--border); }
}
