:root {
  color-scheme: light dark;
  --bg: #0f172a;
  --panel: rgba(30, 41, 59, 0.85);
  --panel-light: rgba(148, 163, 184, 0.18);
  --text: #e2e8f0;
  --muted: #cbd5f5;
  --accent: #60a5fa;
  --danger: #f87171;
  --safe: #34d399;
  --border: rgba(148, 163, 184, 0.45);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, rgba(59, 130, 246, 0.18), transparent 55%),
    radial-gradient(circle at bottom, rgba(96, 165, 250, 0.12), transparent 60%),
    var(--bg);
  color: var(--text);
}

.app-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

header {
  text-align: center;
}

header h1 {
  margin-bottom: 0.5rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.tagline {
  margin: 0 auto;
  max-width: 640px;
  color: var(--muted);
  font-size: 0.95rem;
}

.prompt-panel {
  background: var(--panel);
  border-radius: 18px;
  padding: 1.75rem;
  box-shadow: 0 25px 45px rgba(15, 23, 42, 0.35);
  border: 1px solid var(--border);
}

#prompt-form {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.field-label {
  display: block;
  font-weight: 600;
}

textarea,
input[type='text'],
input[type='password'] {
  width: 100%;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.45);
  color: var(--text);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

textarea:focus,
input[type='text']:focus,
input[type='password']:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.25);
  outline: none;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.settings-panel {
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 14px;
  padding: 0.2rem 1rem 0.8rem;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.settings-panel[open] {
  border-color: var(--accent);
  box-shadow: 0 6px 18px rgba(96, 165, 250, 0.15);
}

.settings-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  cursor: pointer;
  list-style: none;
  padding: 0.65rem 0;
  font-weight: 600;
}

.settings-panel summary::-webkit-details-marker {
  display: none;
}

.summary-title {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.summary-meta {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.settings-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-top: 0.5rem;
}

.settings-note {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
}

.checkbox input {
  accent-color: var(--accent);
}

button.primary {
  align-self: flex-start;
  background: var(--accent);
  border: none;
  border-radius: 999px;
  color: #0f172a;
  padding: 0.75rem 1.6rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.form-actions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

button.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 25px rgba(96, 165, 250, 0.35);
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.result-card {
  background: var(--panel-light);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 320px;
  position: relative;
  overflow: hidden;
}

.result-card.loading::after {
  content: 'Checking…';
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.result-card h2 {
  margin: 0;
  font-weight: 600;
}

.status {
  font-size: 0.95rem;
  color: var(--muted);
}

.status.success {
  color: var(--safe);
}

.status.error {
  color: var(--danger);
}

.output {
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(15, 23, 42, 0.35);
  border-radius: 12px;
  padding: 1rem;
}

.detectors {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.detector-row {
  background: rgba(15, 23, 42, 0.55);
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.detector-row.triggered {
  border-color: rgba(248, 113, 113, 0.65);
  box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.55);
}

.detector-header {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
}

.detector-body {
  font-size: 0.9rem;
  color: var(--muted);
  word-break: break-word;
}

.raw {
  margin-top: auto;
}

.raw pre {
  white-space: pre-wrap;
  max-height: 240px;
  overflow: auto;
  font-size: 0.85rem;
  background: rgba(15, 23, 42, 0.65);
  padding: 1rem;
  border-radius: 12px;
  word-break: break-word;
  font-family: 'JetBrains Mono', 'Fira Code', 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
}

.raw pre .json-key {
  color: #93c5fd;
}

.raw pre .json-string {
  color: #fbcfe8;
}

.raw pre .json-number {
  color: #facc15;
}

.raw pre .json-boolean {
  color: #34d399;
}

.raw pre .json-null {
  color: #f97316;
}

@media (max-width: 720px) {
  .app-shell {
    padding: 2rem 1rem 3rem;
  }

  .prompt-panel {
    padding: 1.25rem;
  }

  .result-card {
    min-height: 280px;
  }
}
