:root {
  --jf-accent:      #06b6d4;
  --jf-accent-2:    #0891b2;
  --jf-accent-soft: rgba(6, 182, 212, 0.14);
  --jf-accent-line: rgba(6, 182, 212, 0.55);
  --jf-surface:     rgba(255, 255, 255, 0.03);
  --jf-surface-2:   rgba(255, 255, 255, 0.05);
  --jf-border:      rgba(255, 255, 255, 0.08);
  --jf-border-str:  rgba(255, 255, 255, 0.16);
  --jf-text:        rgba(255, 255, 255, 0.88);
  --jf-text-dim:    rgba(255, 255, 255, 0.55);
  --jf-radius:      14px;
  --jf-mono:        'JetBrains Mono', 'Cascadia Code', 'Fira Mono', monospace;

  /* Syntax colours */
  --jf-c-key:    #93c5fd;   /* blue-300: object keys */
  --jf-c-str:    #86efac;   /* green-300: string values */
  --jf-c-num:    #fdba74;   /* orange-300: numbers */
  --jf-c-bool:   #67e8f9;   /* cyan-300: true/false */
  --jf-c-null:   rgba(255,255,255,0.35);
  --jf-c-brace:  rgba(255,255,255,0.75);
  --jf-c-punct:  rgba(255,255,255,0.45);

  /* Diff colours */
  --jf-diff-add: rgba(34, 197, 94, 0.14);
  --jf-diff-rem: rgba(239, 68, 68, 0.14);
  --jf-diff-add-bar: #22c55e;
  --jf-diff-rem-bar: #ef4444;
}

/* ---------- Shell ---------- */
.jf-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.1rem 1.25rem 3rem;
}
.jf-back {
  color: var(--jf-text-dim);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.2s;
}
.jf-back:hover { color: var(--jf-accent); }

/* ---------- Hero ---------- */
.jf-hero { text-align: center; padding: 1.4rem 0 1.1rem; }
.jf-hero-kicker {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--jf-accent);
  margin-bottom: 0.45rem;
}
.jf-hero-title {
  font-size: clamp(1.7rem, 3.4vw, 2.6rem);
  font-weight: 800;
  margin: 0 0 0.5rem;
  background: linear-gradient(135deg, var(--jf-accent), var(--jf-accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.jf-hero-sub {
  color: var(--jf-text-dim);
  margin: 0 auto;
  max-width: 640px;
  font-size: 0.96rem;
  line-height: 1.5;
}
.jf-hero-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
}
.jf-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.74rem;
  color: var(--jf-text-dim);
  border: 1px solid var(--jf-border);
  background: var(--jf-surface);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
}
.jf-chip-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: linear-gradient(135deg, var(--jf-accent), var(--jf-accent-2));
  box-shadow: 0 0 8px rgba(6, 182, 212, 0.6);
}

/* ---------- Operation tab bar ---------- */
.jf-op-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.8rem 0 0.55rem;
}
.jf-op-tab {
  appearance: none;
  border: 1px solid var(--jf-border-str);
  background: var(--jf-surface-2);
  color: var(--jf-text-dim);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.42rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.jf-op-tab:hover { color: #fff; border-color: var(--jf-border-str); }
.jf-op-tab.active {
  background: linear-gradient(135deg, var(--jf-accent), var(--jf-accent-2));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.3);
}

/* ---------- Options bar ---------- */
.jf-opts-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--jf-border);
  border-radius: 10px;
  background: var(--jf-surface);
  margin-bottom: 0.75rem;
  min-height: 42px;
}
.jf-opts-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}
.jf-opts-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--jf-text-dim);
}
.jf-opts-check {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--jf-text);
  cursor: pointer;
}
.jf-opts-check input { accent-color: var(--jf-accent); width: 14px; height: 14px; }
.jf-opts-hint {
  font-size: 0.74rem;
  color: var(--jf-text-dim);
}

.jf-select, .jf-input {
  padding: 0.3rem 0.55rem;
  border-radius: 7px;
  border: 1px solid var(--jf-border-str);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 0.8rem;
  outline: none;
  font-family: inherit;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.jf-input { width: 100%; box-sizing: border-box; }
.jf-select:focus, .jf-input:focus {
  border-color: var(--jf-accent-line);
  box-shadow: 0 0 0 3px var(--jf-accent-soft);
}
.jf-select option { background: #0b1220; }

/* ---------- Workspace ---------- */
.jf-workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  align-items: start;
}

/* ---------- Panels ---------- */
.jf-panel {
  border: 1px solid var(--jf-border);
  border-radius: var(--jf-radius);
  background:
    radial-gradient(circle at 100% 0%, rgba(6, 182, 212, 0.05), transparent 50%),
    var(--jf-surface);
  display: flex;
  flex-direction: column;
  min-height: 520px;
}
.jf-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--jf-border);
  gap: 0.5rem;
  flex-wrap: wrap;
}
.jf-panel-head-left {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex: 1;
  min-width: 0;
}
.jf-panel-title {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--jf-text-dim);
  white-space: nowrap;
}
.jf-panel-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}
.jf-char-count {
  font-size: 0.66rem;
  color: var(--jf-text-dim);
  white-space: nowrap;
}

/* ---------- Detect badge ---------- */
.jf-detect-badge {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  background: var(--jf-accent-soft);
  border: 1px solid var(--jf-accent-line);
  color: var(--jf-accent);
}

/* ---------- Stat chips ---------- */
.jf-stat-chips {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.jf-stat-chip {
  font-size: 0.62rem;
  font-weight: 600;
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  background: var(--jf-surface-2);
  border: 1px solid var(--jf-border);
  color: var(--jf-text-dim);
  white-space: nowrap;
}

/* ---------- Editor areas ---------- */
.jf-editor {
  flex: 1;
  font-family: var(--jf-mono);
  font-size: 0.83rem;
  line-height: 1.6;
  padding: 0.75rem;
  box-sizing: border-box;
  border: none;
  outline: none;
  background: transparent;
  color: var(--jf-text);
  tab-size: 2;
}
.jf-editor-input {
  resize: vertical;
  min-height: 480px;
  color: #fff;
  white-space: pre;
  overflow: auto;
}
.jf-editor-input::placeholder { color: var(--jf-text-dim); font-style: italic; }

.jf-editor-output {
  overflow: auto;
  min-height: 480px;
  position: relative;
}
.jf-pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--jf-text);
  counter-reset: line;
}
.jf-pre.nowrap { white-space: pre; word-break: normal; overflow-x: auto; }

/* Line numbers via counter */
.jf-pre.lined .jf-line {
  display: block;
  padding-left: 3rem;
  position: relative;
  counter-increment: line;
}
.jf-pre.lined .jf-line::before {
  content: counter(line);
  position: absolute;
  left: 0;
  width: 2.4rem;
  text-align: right;
  color: rgba(255, 255, 255, 0.2);
  user-select: none;
  font-size: 0.72em;
  padding-top: 0.05em;
}

/* ---------- Syntax highlight colours ---------- */
.jf-key  { color: var(--jf-c-key);   }
.jf-str  { color: var(--jf-c-str);   }
.jf-num  { color: var(--jf-c-num);   }
.jf-bool { color: var(--jf-c-bool);  }
.jf-null { color: var(--jf-c-null);  }
.jf-punc { color: var(--jf-c-punct); }

/* ---------- Diff colours ---------- */
.jf-line.diff-add { background: var(--jf-diff-add); }
.jf-line.diff-rem { background: var(--jf-diff-rem); }
.jf-line.diff-add::after {
  content: '+';
  position: absolute;
  right: 0.4rem;
  color: var(--jf-diff-add-bar);
  font-weight: 700;
}
.jf-line.diff-rem::after {
  content: '−';
  position: absolute;
  right: 0.4rem;
  color: var(--jf-diff-rem-bar);
  font-weight: 700;
}

/* ---------- Buttons ---------- */
.jf-btn {
  appearance: none;
  border: 1px solid var(--jf-border-str);
  background: var(--jf-surface-2);
  color: var(--jf-text);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.18s;
  font-family: inherit;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.jf-btn:hover { border-color: var(--jf-accent-line); transform: translateY(-1px); }
.jf-btn-sm { font-size: 0.72rem; padding: 0.28rem 0.6rem; border-radius: 6px; }
.jf-btn-ghost { background: transparent; border-color: var(--jf-border); }
.jf-btn.copied { background: rgba(34, 197, 94, 0.15); border-color: rgba(34, 197, 94, 0.4); color: #86efac; }

/* ---------- Status bar ---------- */
.jf-status-bar {
  margin-top: 0.65rem;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-family: var(--jf-mono);
  min-height: 2rem;
  display: flex;
  align-items: center;
  transition: background 0.2s;
}
.jf-status-bar:empty { display: none; }
.jf-status-bar.valid   { background: rgba(34, 197, 94, 0.08);  color: #86efac;  border: 1px solid rgba(34, 197, 94, 0.25); }
.jf-status-bar.invalid { background: rgba(239, 68, 68, 0.08);  color: #f87171;  border: 1px solid rgba(239, 68, 68, 0.25); }
.jf-status-bar.info    { background: rgba(6, 182, 212, 0.08);  color: var(--jf-accent); border: 1px solid var(--jf-accent-line); }

/* ---------- Modal / shortcuts ---------- */
.jf-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.jf-modal[hidden] { display: none; }
.jf-modal-card {
  width: 100%;
  max-width: 460px;
  background: rgba(12, 20, 32, 0.96);
  border: 1px solid var(--jf-border-str);
  border-radius: 16px;
  padding: 1.3rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}
.jf-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.jf-modal-head h3 { margin: 0; font-size: 1rem; color: #fff; }
.jf-modal-close {
  background: none; border: none; color: var(--jf-text-dim);
  font-size: 1.5rem; line-height: 1; cursor: pointer;
}
.jf-modal-close:hover { color: #fff; }
.jf-shortcuts-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1rem;
  font-size: 0.82rem;
  color: var(--jf-text);
}
.jf-shortcuts-grid kbd {
  display: inline-block;
  padding: 0.1rem 0.35rem;
  background: var(--jf-surface-2);
  border: 1px solid var(--jf-border-str);
  border-radius: 4px;
  font-size: 0.7rem;
  font-family: var(--jf-mono);
}

/* ---------- Toasts ---------- */
.jf-toast-host {
  position: fixed;
  bottom: 1.2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9500;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}
.jf-toast {
  pointer-events: auto;
  min-width: 200px;
  max-width: 380px;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  font-size: 0.84rem;
  color: #fff;
  background: rgba(20, 28, 40, 0.96);
  border: 1px solid var(--jf-border-str);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.3s, transform 0.3s;
  cursor: pointer;
}
.jf-toast.show   { opacity: 1; transform: translateY(0); }
.jf-toast.success { border-color: rgba(34, 197, 94, 0.5); }
.jf-toast.error   { border-color: rgba(239, 68, 68, 0.5); }
.jf-toast.info    { border-color: var(--jf-accent-line); }

/* ---------- Shared ---------- */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .jf-workspace { grid-template-columns: 1fr; }
  .jf-panel { min-height: 320px; }
  .jf-editor-input, .jf-editor-output { min-height: 300px; }
}
@media (max-width: 560px) {
  .jf-op-bar { gap: 0.3rem; }
  .jf-op-tab { font-size: 0.72rem; padding: 0.35rem 0.65rem; }
}
