:root {
  --bg: #0b1020;
  /* deep navy */
  --fg: #e7eaf3;
  /* soft white */
  --muted: #a8b0c5;
  --accent: #6ee7ff;
  /* cyan */
  --panel: #141a33;
  /* card */
  --ok: #34d399;
  --warn: #f59e0b;
  --default-font-size: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: radial-gradient(1200px 800px at 20% 0%, #10183a 0%, var(--bg) 60%);
  color: var(--fg);
}

header {
  padding: 8px;
  text-align: center;
}

h1 {
  margin: 0 0 8px 0;
  font-size: 24px;
  letter-spacing: .2px;
  font-weight: 600;
}

main {
  max-width: 1800px;
  margin: 0 auto;
  padding: 8px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.card {
  width: 48%;
  max-width: 48%;
  background: var(--panel);
  border: 1px solid #223;
  border-radius: 16px;
  padding: 5px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  transition: box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: 0 12px 35px rgba(0, 0, 0, .3);
}

.row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

label {
  font-size: var(--default-font-size);
  color: var(--muted);
}

textarea,
input[type="number"] {
  width: 100%;
  background: #0f1430;
  color: var(--fg);
  border: 1px solid #2a3157;
  border-radius: 12px;
  padding: 5px 6px;
  outline: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: var(--default-font-size);
}

textarea {
  min-height: 260px;
  resize: vertical;
}

input[type="file"] {
  color: var(--muted);
}

.controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

button {
  background: linear-gradient(180deg, #49dcff, #22aaff);
  color: #01212b;
  border: 0;
  padding: 8px;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  background: linear-gradient(180deg, #5ee0ff, #33b5ff);
}

button.secondary {
  background: #172043;
  color: var(--fg);
  border: 1px solid #2a3157;
}

button.secondary:hover {
  background: #1d2655;
  border-color: #3a4167;
}

button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px dashed #2a3157;
}

button.ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  border-style: solid;
  color: var(--fg);
}

button.copied {
  background: #2a3157;
  color: #666;
  opacity: 0.6;
}

button.copied:hover {
  transform: translateY(-1px);
  background: #33406b;
}

button.test-button {
  background: #dc2626;
  color: white;
  border: 1px solid #b91c1c;
}

button.test-button:hover {
  background: #ef4444;
  border-color: #dc2626;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #11183a;
  border: 1px solid #2a3157;
  border-radius: 999px;
  padding: 6px;
  font-size: var(--default-font-size);
  color: var(--muted);
}

.stat {
  font-variant-numeric: tabular-nums;
}

.outputs {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
  min-width: 500px;
  max-width: 900px;
  margin-left: 0;
}

.condition-card {
  border: 1px solid #C5CAD6;
  border-radius: 8px;
  background: #fff;
  color: #2F426C;
  margin-bottom: 0;
  padding: 0;
  box-shadow: 0 4px 16px rgba(47, 66, 108, 0.07);
  width: 100%;
  min-width: 500px;
  max-width: 900px;
}

.condition-body {
  padding: 8px;
  background: #F8F9FB;
  border-radius: 6px;
}

.condition-label {
  font-size: var(--default-font-size);
  font-weight: 600;
  color: #6D81A6;
  margin-bottom: 8px;
}

.method-rows {
  width: 100%;
}

.method-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  background: #fff;
  border: 1px solid #C5CAD6;
  border-radius: 6px;
  margin-bottom: 8px;
  position: relative;
  font-size: var(--default-font-size)
}

.value-preview {
  flex: 1;
  padding: 6px;
  border: 1px solid #C5CAD6;
  border-radius: 6px;
  font-size: var(--default-font-size);
  background: #F8F9FB;
  color: #2F426C;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: background 0.2s;
}

.value-preview:hover {
  background: #e6eef7;
}

.value-full {
  flex: 1;
  padding: 8px;
  border: 1px solid #C5CAD6;
  border-radius: 6px;
  font-size: var(--default-font-size);
  background: #F8F9FB;
  color: #2F426C;
  word-break: break-all;
  white-space: pre-wrap;
  margin-top: 4px;
  cursor: pointer;
}

.method-row.collapsed .method-input {
  display: none;
}

.drag-handle {
  color: #C5CAD6;
  cursor: move;
  font-size: 20px;
  user-select: none;
  margin-right: 2px;
}

.checkbox {
  width: 18px;
  height: 18px;
  border: 1px solid #6D81A6;
  border-radius: 3px;
  background: #fff;
  margin-right: 4px;
}

.dropdown-btn {
  padding: 5px;
  border: 1px solid #C5CAD6;
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
  color: #2F426C;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 110px;
}

.method-input {
  flex: 1;
  padding: 6px;
  border: 1px solid #C5CAD6;
  border-radius: 6px;
  font-size: var(--default-font-size);
  background: #F8F9FB;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  color: #2F426C;
  white-space: pre-wrap;
  word-break: break-word;
}

.condition-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.success-badge {
  width: 19px;
  height: 19px;
  background: #41B7A6;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.or-button {
  width: 50px;
  padding: 4px;
  background: #fff;
  border: 1px solid #C5CAD6;
  border-radius: 6px;
  color: #6D81A6;
  font-size: var(--default-font-size);
  cursor: pointer;
  margin: 8px 0 8px 0;
  text-align: center;
  font-weight: 600;
  display: block;
}

.navigation-controls {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 12px 0;
  position: sticky;
  top: 10px;
  z-index: 10;
  background: var(--panel);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid #2a3157;
}

.hint {
  color: var(--muted);
  font-size: var(--default-font-size);
}

.good {
  color: var(--ok);
}

.warn {
  color: var(--warn);
}

.grid-2 {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
}

.kvs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.kvs .pill strong {
  color: var(--fg);
}

.footer {
  text-align: center;
  color: var(--muted);
  padding: 12px 0 24px;
  font-size: var(--default-font-size)
}

.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;
}

code {
  background: #10163a;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid #2a3157;
}

/* Modal/Popup styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--panel);
  color: var(--fg);
  border: 1px solid #2a3157;
  border-radius: 16px;
  padding: 20px;
  width: 90%;
  max-width: 800px;
  max-height: 80%;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #2a3157;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--fg);
}

.modal-close {
  background: transparent;
  color: var(--muted);
  border: none;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--fg);
}

.modal-body {
  overflow-y: auto;
  max-height: 400px;
  margin-bottom: 16px;
}

.modal-code {
  background: #0f1430;
  color: var(--fg);
  border: 1px solid #2a3157;
  border-radius: 8px;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.4;
  user-select: all;
}

.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 12px;
  border-top: 1px solid #2a3157;
}

/* Utility layout classes (replacing inline styles) */
.row-between { display:flex; justify-content:space-between; align-items:center; gap:8px; margin-bottom:8px; }
.mt-12 { margin-top:12px; }
.grid-span-2 { grid-column: span 2; }
.hidden { display: none; }