/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #21253a;
  --border: #2e3348;
  --accent: #4f8ef7;
  --accent-hover: #6ba3ff;
  --text: #d4d8f0;
  --text-muted: #6b7094;
  --green: #4ec9a3;
  --yellow: #e8c44a;
  --red: #f7644f;
  --purple: #b18aff;
  --cyan: #4fc5f7;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, 'Courier New', monospace;
  --radius: 6px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Header */
header {
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.5rem;
}

header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
}

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

/* Form */
form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-row {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

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

.hostname-group { flex: 1; min-width: 200px; }
.type-group { flex: 0 0 120px; }
.ns-group { flex: 0 0 200px; }

input[type="text"],
select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.95rem;
  padding: 0.55rem 0.75rem;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}

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

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7094' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  padding-right: 2rem;
}

select option, select optgroup {
  background: var(--surface2);
  color: var(--text);
}

button#dig-btn {
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.55rem 1.75rem;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
  align-self: flex-end;
}

button#dig-btn:hover { background: var(--accent-hover); }
button#dig-btn:active { transform: scale(0.97); }

/* Custom nameserver */
.custom-ns-row .input-group { flex: 1; }

/* Options row */
.options-row {
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.options-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-right: 0.25rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--text);
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
  cursor: pointer;
}

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

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

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

/* Error */
.error-msg {
  background: #2a1a1a;
  border: 1px solid var(--red);
  border-radius: var(--radius);
  color: var(--red);
  padding: 0.75rem 1rem;
  margin-top: 1rem;
  font-size: 0.9rem;
}

/* Results */
.results { margin-top: 1.5rem; }

.result-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow: hidden;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  gap: 0.5rem;
  flex-wrap: wrap;
}

.result-ns {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  font-family: var(--font-mono);
}

.result-header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.copy-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  transition: color 0.15s, border-color 0.15s;
}

.copy-btn:hover { color: var(--text); border-color: var(--text-muted); }
.copy-btn.copied { color: var(--green); border-color: var(--green); }

.cmd-display {
  padding: 0.5rem 1rem;
  background: #0b0d14;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  word-break: break-all;
}

.cmd-display span { color: var(--yellow); }

.result-output {
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-x: auto;
}

/* Colorized output */
.result-output.colorized .line-comment { color: var(--text-muted); }
.result-output.colorized .line-section { color: var(--purple); font-weight: 600; }
.result-output.colorized .tok-domain { color: var(--cyan); }
.result-output.colorized .tok-ttl { color: var(--yellow); }
.result-output.colorized .tok-class { color: var(--text-muted); }
.result-output.colorized .tok-type { color: var(--green); font-weight: 600; }
.result-output.colorized .tok-data { color: var(--text); }
.result-output.colorized .line-stats { color: var(--text-muted); font-style: italic; }
.result-output.colorized .tok-error { color: var(--red); }

/* Footer */
footer {
  margin-top: 3rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

footer code {
  font-family: var(--font-mono);
  color: var(--text);
  background: var(--surface);
  padding: 0.1em 0.4em;
  border-radius: 3px;
}

/* Back link */
.back-link {
  display: inline-block;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-decoration: none;
  margin-bottom: 0.75rem;
}
.back-link:hover { color: var(--text); }

/* Responsive */
@media (max-width: 600px) {
  .type-group, .ns-group { flex: 1; }
  button#dig-btn { width: 100%; }
}
