:root {
  font-family: ui-monospace, 'SF Mono', Menlo, Monaco, monospace;
  color-scheme: dark;
  --bg: #050507;
  --fg: #e5e5e5;
  --muted: #888;
  --dim: #555;
  --border: #1f1f26;
  --border-hover: #2a2a33;
  --accent: #4ade80;
  --danger: #f87171;
  --input: #0d0d13;
  --highlight: rgba(74, 222, 128, 0.25);
}

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

html, body { min-height: 100%; }

body {
  background: radial-gradient(ellipse at top, #0a0a14 0%, var(--bg) 70%);
  color: var(--fg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 820px;
  margin: 0 auto;
  padding: 3rem 1.25rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-height: 100vh;
}

header h1 {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #fff, #888);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 0.25rem;
}

header h1::before {
  content: '> ';
  color: var(--accent);
  -webkit-text-fill-color: var(--accent);
}

.home-link {
  text-decoration: none;
  display: inline-block;
  transition: opacity 0.15s;
}
.home-link:hover { opacity: 0.75; }

.tagline {
  color: var(--muted);
  font-size: 0.9rem;
}

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

.tab {
  font-family: inherit;
  font-size: 0.85rem;
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}

.tab:hover { color: var(--fg); }

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Tool panels */
.tool-wrap { flex: 1; }

.tool {
  display: none;
  flex-direction: column;
  gap: 1rem;
}

.tool.active { display: flex; }

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

.row label {
  font-size: 0.7rem;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.row .meta {
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.75rem;
}

input[type='text'],
textarea {
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--input);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.7rem 0.85rem;
  resize: vertical;
  transition: border-color 0.15s;
  width: 100%;
}

input[type='text']:focus,
textarea:focus {
  outline: none;
  border-color: var(--border-hover);
}

.output {
  font-family: inherit;
  font-size: 0.85rem;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.85rem;
  min-height: 8rem;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--fg);
  line-height: 1.6;
}

.output mark {
  background: var(--highlight);
  color: var(--accent);
  padding: 0 2px;
  border-radius: 2px;
}

.err {
  color: var(--danger);
  font-size: 0.8rem;
  min-height: 1em;
}

.arrow {
  text-align: center;
  color: var(--dim);
  font-size: 1.2rem;
}

/* Regex line */
.regex-line {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.1rem 0.6rem;
}

.regex-line:focus-within { border-color: var(--border-hover); }

.regex-line .slash {
  color: var(--accent);
  font-size: 1.1rem;
}

.regex-line input {
  background: transparent;
  border: none;
  padding: 0.6rem 0;
  flex: 1;
}

.regex-line input:focus { outline: none; }

.regex-line .flags {
  flex: 0 0 3rem;
  text-align: center;
  color: var(--accent);
}

/* JSON controls */
.json-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

button {
  font-family: inherit;
  font-size: 0.85rem;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 5px;
  padding: 0.45rem 1rem;
  cursor: pointer;
  transition: background 0.15s;
}

button:hover { background: rgba(74, 222, 128, 0.08); }

#ts-now { align-self: flex-start; }

/* Footer */
footer {
  margin-top: auto;
  padding-top: 1.5rem;
  text-align: center;
}

footer a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.15s;
}

footer a:hover { color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
