/* DIFF DUEL — Level 15 */

@font-face { font-family: "Press Start 2P"; font-style: normal; font-weight: 400; font-display: swap; src: url("/press-start-2p.woff2") format("woff2"); }
@font-face { font-family: "Press Start 2P Fallback"; src: local("Courier New"); size-adjust: 166.64%; ascent-override: 60%; descent-override: 0%; line-gap-override: 0%; }

:root {
  --bg: #0a0a12;
  --surface: #12121d;
  --surface-2: #1a1a2a;
  --line: #28283c;
  --text: #e9e9f2;
  --dim: #9aa0b5;
  --cyan: #45f0ff;
  --magenta: #ff3d8b;
  --gold: #ffc857;
  --green: #41ff8b;
  --red: #ff5560;
  --pixel: "Press Start 2P", "Press Start 2P Fallback", "Courier New", monospace;
  --body: -apple-system, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --glow-cyan: 0 0 14px rgba(69, 240, 255, 0.35);
  --space-gutter: clamp(16px, 4vw, 48px);
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(69, 240, 255, 0.05), transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
::selection { background: rgba(69, 240, 255, 0.3); }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.skip-link {
  position: absolute;
  left: 12px; top: -48px;
  z-index: 200;
  background: var(--cyan);
  color: #05050d;
  padding: 10px 16px;
  border-radius: 6px;
  font-family: var(--mono);
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.2s var(--ease-out);
}
.skip-link:focus-visible { transform: translateY(60px); }
:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(69, 240, 255, 0.15);
}
a { color: var(--cyan); }

.site-header {
  padding: 26px var(--space-gutter) 10px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.lab-link {
  align-self: flex-start;
  font-family: var(--pixel);
  font-size: 10px;
  color: var(--dim);
  text-decoration: none;
  padding: 6px 2px;
  transition: color 0.15s, text-shadow 0.15s;
}
.lab-link:hover { color: var(--cyan); text-shadow: var(--glow-cyan); }
.level {
  margin: 0;
  font-family: var(--pixel);
  font-size: 9px;
  letter-spacing: 3px;
  color: var(--gold);
}
.wordmark {
  margin: 6px 0 4px;
  font-family: var(--pixel);
  font-size: clamp(22px, 4.5vw, 34px);
  letter-spacing: 3px;
  color: var(--text);
  text-shadow: 0 0 16px rgba(69, 240, 255, 0.55), 3px 3px 0 var(--magenta);
}
.tagline {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--dim);
}
.cursor { color: var(--cyan); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

main {
  flex: 1;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px var(--space-gutter) 72px;
}
.share-banner {
  border: 1px solid rgba(255, 200, 87, 0.35);
  border-left: 3px solid var(--gold);
  border-radius: 8px;
  background: rgba(255, 200, 87, 0.06);
  color: var(--dim);
  padding: 12px 14px;
  margin-bottom: 16px;
}
.share-banner p { margin: 0; }
.input-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.pane {
  position: relative;
  display: grid;
  gap: 8px;
  min-width: 0;
  color: var(--dim);
  font-family: var(--pixel);
  font-size: 10px;
  letter-spacing: 2px;
}
.pane::before {
  content: "";
  position: absolute;
  top: 27px;
  left: 0;
  width: 28px;
  height: 3px;
  background: var(--red);
  z-index: 1;
}
.pane-b::before { background: var(--cyan); }
textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  background: var(--surface);
  border: 1px solid #5e5e80;
  color: var(--text);
  border-radius: 8px;
  padding: 14px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.45;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
}
textarea.is-over { border-color: var(--gold); box-shadow: inset 0 0 30px rgba(255, 200, 87, 0.08); }
.swap-wrap { display: flex; align-items: center; justify-content: center; }
.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
}
.controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 16px;
}
.panel-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.panel-title {
  margin: 0 0 10px;
  font-family: var(--pixel);
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(69, 240, 255, 0.4);
}
.panel-head .panel-title { margin: 0; }
.btn, .chip {
  min-height: 40px;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: transform 0.12s var(--ease-out), border-color 0.12s, box-shadow 0.12s, color 0.12s;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 10px 14px;
  border-radius: 6px;
}
.btn:hover, .chip:hover {
  border-color: var(--cyan);
  box-shadow: 0 0 12px rgba(69, 240, 255, 0.22);
  transform: translateY(-1px);
}
.btn:active, .chip:active { transform: translateY(1px); }
.btn-primary { background: var(--cyan); border-color: var(--cyan); color: #05050d; }
.chip-row, .inline-actions, .option-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.chip {
  background: var(--bg);
  color: var(--dim);
  font-family: var(--mono);
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 999px;
}
.chip.is-active {
  border-color: var(--cyan);
  color: var(--cyan);
  background: rgba(69, 240, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(69, 240, 255, 0.35);
}
.option-row label, .toggle {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
}
input[type="checkbox"] { accent-color: var(--cyan); width: 18px; height: 18px; }
.json-panel, .result-panel, .export-panel { margin-top: 16px; }
.json-tree, .diff-result {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  font-family: var(--mono);
  font-size: 13px;
}
.json-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(120px, .8fr) 28px minmax(120px, .8fr);
  gap: 10px;
  min-width: 680px;
  padding: 9px 10px;
  border-bottom: 1px solid rgba(40, 40, 60, 0.8);
}
.json-row:last-child { border-bottom: 0; }
.json-row.add { color: var(--green); }
.json-row.remove { color: var(--red); }
.json-row.change { color: var(--gold); }
.stats {
  margin: 0;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--gold);
}
.side-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr);
  min-width: 720px;
  border-bottom: 1px solid rgba(40, 40, 60, 0.8);
}
.side-cell {
  min-height: 28px;
  padding: 5px 8px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border-right: 1px solid rgba(40, 40, 60, 0.8);
}
.side-cell:last-child { border-right: 0; }
.line {
  display: grid;
  grid-template-columns: 36px minmax(260px, 1fr);
  min-width: 620px;
  border-bottom: 1px solid rgba(40, 40, 60, 0.8);
}
.gutter {
  padding: 5px 8px;
  color: var(--dim);
  text-align: center;
  border-right: 1px solid rgba(40, 40, 60, 0.8);
}
.text {
  padding: 5px 8px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.add { background: rgba(65, 255, 139, 0.08); color: var(--green); }
.del { background: rgba(255, 85, 96, 0.09); color: var(--red); }
.chg { background: rgba(255, 200, 87, 0.08); color: var(--gold); }
.mark-add { background: rgba(65, 255, 139, 0.22); color: var(--text); }
.mark-del { background: rgba(255, 85, 96, 0.25); color: var(--text); }
.note, .privacy-note {
  margin: 12px 0 0;
  color: var(--dim);
  font-size: 12px;
}
.privacy-note {
  max-width: 520px;
  text-align: center;
  margin: 18px auto 0;
}

.toasts {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(440px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.22s var(--ease-out) both;
}
.toast-info { border-left-color: var(--cyan); }
.toast-success { border-left-color: var(--green); }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity 0.25s, transform 0.25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

.site-footer {
  border-top: 1px solid var(--line);
  padding: 22px var(--space-gutter);
  text-align: center;
  color: var(--dim);
  font-size: 13px;
}
.site-footer a { color: var(--cyan); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; text-shadow: var(--glow-cyan); }

@media (min-width: 768px) {
  .input-grid { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: stretch; }
  .swap-wrap { padding-top: 28px; }
  .controls { grid-template-columns: 0.8fr 1.4fr 0.8fr; }
}
@media (max-width: 480px) {
  .wordmark { letter-spacing: 1px; }
  textarea { min-height: 180px; }
  .inline-actions .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .cursor { animation: none; }
}
