:root {
  --bg:        #0f1117;
  --surface:   #1a1d27;
  --border:    #2a2d3a;
  --accent:    #7c6af7;
  --accent2:   #5eead4;
  --text:      #e2e8f0;
  --text-muted:#8892a4;
  --success:   #4ade80;
  --error:     #f87171;
  --radius:    8px;
  --mono:      'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 2rem 1rem;
}

#app {
  width: 100%;
  max-width: 860px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

header { text-align: center; }

header h1 {
  font-size: 2.4rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  margin-top: 0.4rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Input section */
.input-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.input-row {
  display: flex;
  gap: 0.5rem;
}

input[type="text"] {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--mono);
  font-size: 1rem;
  padding: 0.6rem 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}

input[type="text"]:focus { border-color: var(--accent); }

button {
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.6rem 1.2rem;
  transition: opacity 0.15s;
  white-space: nowrap;
}

button:hover { opacity: 0.85; }
button:active { opacity: 0.7; }

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.hint {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.hint code {
  font-family: var(--mono);
  background: var(--border);
  border-radius: 3px;
  padding: 0 4px;
}

/* Status */
.status {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.status.error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--error);
}

.status.success {
  background: rgba(74, 222, 128, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.25);
  color: var(--success);
}

/* Results */
#results {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.meta-row span {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  padding: 0.35rem 0.75rem;
  color: var(--text-muted);
}

.meta-row span strong {
  color: var(--text);
}

.examples-row {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.examples-row code {
  font-family: var(--mono);
  color: var(--accent2);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  background: transparent;
  border-radius: var(--radius) var(--radius) 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
}

.tab-btn.active {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-color: var(--surface);
}

.tab-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 1rem;
}

#graph-container {
  overflow-x: auto;
  display: flex;
  justify-content: center;
}

#graph-container svg {
  max-width: 100%;
  height: auto;
}

pre {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text);
  white-space: pre;
  overflow-x: auto;
}

#copy-dot-btn {
  margin-top: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 0.4rem 0.9rem;
}

/* Test section */
.test-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.test-result {
  font-size: 0.9rem;
  font-family: var(--mono);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
}

.test-result.match {
  background: rgba(74, 222, 128, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.25);
  color: var(--success);
}

.test-result.no-match {
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.25);
  color: var(--error);
}

/* Export */
.export-row {
  display: flex;
  justify-content: flex-end;
}

#export-btn {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
}

/* Loading */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 3rem;
  color: var(--text-muted);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }
