:root {
  color-scheme: dark;
  --font-sans: "Inter", "Plus Jakarta Sans", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "Space Mono", monospace;
  --background: oklch(0.1 0.08 71);
  --surface: oklch(0.18 0.05 45);
  --panel: rgba(23, 28, 45, 0.95);
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.16);
  --accent: oklch(0.65 0.37 220);
  --accent-strong: oklch(0.78 0.4 200);
  --muted: oklch(0.78 0.05 40);
  --text: oklch(0.97 0.02 40);
  --shadow: 0 25px 55px rgba(5, 8, 20, 0.45);
  --radius: 1rem;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 15% 20%, rgba(125, 211, 252, 0.25), transparent 45%),
    radial-gradient(circle at 55% 0%, rgba(252, 211, 77, 0.2), transparent 35%),
    var(--background);
  font-family: var(--font-sans);
  color: var(--text);
}
header.hero {
  padding: 3rem clamp(1rem, 4vw, 4rem);
  display: grid;
  gap: 1.5rem;
}
.hero-actions {
  margin-top: 1.5rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}
.hero-actions ::slotted(a),
.hero-actions a,
.hero-actions button,
.hero-actions select {
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 0.85rem 1.5rem;
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.hero-actions a {
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 0.85rem 1.5rem;
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.hero-actions a:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.hero-actions button:hover,
.hero-actions select:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
nav.tool-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0 1rem 1rem;
  position: sticky;
  top: 0;
  background: rgba(15, 18, 32, 0.9);
  border-bottom: 1px solid var(--border);
  z-index: 5;
}
nav.tool-nav a {
  padding: 0.6rem 1.3rem;
  border-radius: 0.8rem;
  text-decoration: none;
  color: var(--muted);
  border: 1px solid transparent;
  font-weight: 600;
  transition: border 0.2s ease, color 0.2s ease;
}
nav.tool-nav a.active,
nav.tool-nav a:hover {
  border-color: var(--border);
  color: var(--text);
}
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem 4rem;
  display: grid;
  gap: 1.25rem;
}
section.tool-card {
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: clamp(1.5rem, 3vw, 2.3rem);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
section.tool-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-3px);
}
textarea,
input,
select {
  width: 100%;
  border-radius: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  padding: 0.85rem;
  font-size: 0.95rem;
  font-family: inherit;
}
textarea {
  min-height: 120px;
  font-family: var(--font-mono);
}
label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.tool-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin-bottom: 1rem;
}
.tool-controls button,
.tool-actions button,
button#time-run,
button#time-unix-convert,
button#json-diff-run {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: linear-gradient(135deg, rgba(125, 211, 252, 0.1), rgba(77, 124, 255, 0.12));
  color: var(--text);
  font-weight: 600;
  padding: 0.65rem 1.3rem;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.tool-controls button:hover,
.tool-actions button:hover,
button#time-run:hover,
button#time-unix-convert:hover,
button#json-diff-run:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}
.tool-controls button:active,
.tool-actions button:active,
button#time-run:active,
button#time-unix-convert:active,
button#json-diff-run:active {
  transform: scale(0.97);
}
@keyframes fadeSlide {
  0% { opacity: 0; transform: translateY(12px); }
  100% { opacity: 1; transform: translateY(0); }
}
.time-unix-results.animate .zone-line { animation: fadeSlide 0.45s ease forwards; }
.diff-row { transition: background-color 0.2s ease, transform 0.2s ease; }
.diff-results.animate .diff-row,
.regex-results.animate .regex-match { animation: fadeSlide 0.5s ease forwards; }
.zone-line { animation: fadeSlide 0.45s ease forwards; }
.tool-frame,
.json-main,
.json-diff-card,
.time-main,
.time-aside,
.regex-main,
.regex-side {
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  padding: 1.25rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
}
.tool-frame { margin-top: 1.25rem; }
.tool-frame + .tool-frame { margin-top: 1rem; }
.json-grid,
.time-grid,
.regex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 1.25rem;
}
.regex-grid { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.regex-side { display: flex; flex-direction: column; gap: 0.75rem; }
.regex-results,
.regex-explain {
  min-height: 120px;
  border-radius: var(--radius);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  padding: 0.75rem;
  background: rgba(15, 16, 24, 0.6);
}
.regex-explain { min-height: 80px; font-size: 0.9rem; }
.regex-match {
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  gap: 0.35rem;
}
.regex-match:last-child { border-bottom: none; }
.regex-match.active { background: rgba(125, 211, 252, 0.1); }
.regex-match-value { font-family: var(--font-mono); font-size: 0.9rem; }
.regex-match-header { font-size: 0.8rem; color: var(--muted); }
.regex-flag-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.regex-flag-row label {
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.regex-flag-row input { accent-color: var(--accent); }
.info-card[data-tool-info] { display: none; }
.info-card[data-tool-info].visible { display: block; }
.output-note {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}
.status {
  min-height: 1.2rem;
  font-size: 0.9rem;
  color: var(--accent-strong);
}
.json-diff-controls { margin-top: 0.75rem; }
.diff-results {
  margin-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 1rem;
}
.diff-row {
  display: grid;
  gap: 0.35rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.diff-row:last-child { border-bottom: none; }
.diff-path { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.time-aside { display: flex; justify-content: center; align-items: stretch; }
.time-unix {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  padding: 1rem;
  background: rgba(255, 255, 255, 0.02);
}
.time-unix input { margin-bottom: 0.4rem; }
.time-unix-results {
  margin-top: 0.75rem;
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
}
.time-unix-results div {
  padding: 0.45rem 0.65rem;
  border-radius: 0.7rem;
  background: rgba(255, 255, 255, 0.04);
}
#tool-panels {
  display: grid;
  gap: 1.5rem;
  width: min(960px, 100%);
  margin: 0 auto;
}
.tool-panel.hidden { display: none; }
.ad-panel {
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 1rem;
  padding: 1.25rem;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
}
footer {
  text-align: center;
  padding: 2rem 1rem 3rem;
  color: var(--muted);
  font-size: 0.85rem;
}
body.light-theme {
  color-scheme: light;
  --background: #f8fafc;
  --panel: rgba(255, 255, 255, 0.95);
  --border: rgba(15, 23, 42, 0.15);
  --border-strong: rgba(15, 23, 42, 0.12);
  --accent: #2563eb;
  --text: #0f172a;
  --muted: #475569;
  --input-bg: rgba(255, 255, 255, 0.9);
  --accent-strong: #ea580c;
}
body.light-theme nav.tool-nav {
  background: rgba(248, 250, 252, 0.95);
  border-color: var(--border);
}
body.light-theme .hero-actions button,
body.light-theme .hero-actions select,
body.light-theme .tool-frame,
body.light-theme .json-main,
body.light-theme .json-diff-card,
body.light-theme .time-main,
body.light-theme .time-aside,
body.light-theme .regex-main,
body.light-theme .regex-side {
  border-color: rgba(15, 23, 42, 0.1);
  background: rgba(255, 255, 255, 0.9);
}
body.light-theme .regex-results,
body.light-theme .regex-explain {
  background: rgba(249, 250, 251, 0.8);
  border-color: rgba(15, 23, 42, 0.2);
}
@media (max-width: 640px) {
  .hero-actions { flex-direction: column; }
  nav.tool-nav { position: static; }
}
@media (max-width: 480px) {
  nav.tool-nav { justify-content: center; }
  header.hero { padding: 2rem 1rem; }
}
@media (min-width: 900px) {
  header.hero {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: center;
  }
  nav.tool-nav { justify-content: center; }
  .hero-actions { justify-content: flex-start; }
  main { padding-top: 0; }
}
