@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/*
  DevToolbox design tokens
  Colours come from code-editor syntax highlighting:
  function blue, string mint, keyword violet, number amber, error rose.
*/
:root {
  color-scheme: dark;

  --ink:         #060914;
  --well:        rgba(8, 12, 26, 0.72);
  --well-solid:  #0A0F1F;
  --glass:       rgba(150, 165, 255, 0.055);
  --glass-strong:rgba(150, 165, 255, 0.10);
  --glass-hi:    rgba(255, 255, 255, 0.07);
  --line:        rgba(160, 175, 255, 0.13);
  --line-strong: rgba(160, 175, 255, 0.26);

  --text:   #E8EBF7;
  --muted:  #A3ABC9;
  --dim:    #7880A3;

  --blue:   #7DB4FF;
  --violet: #B794F6;
  --mint:   #6EE7C5;
  --amber:  #F6C177;
  --rose:   #FF7A90;
  --sky:    #7DD3FC;

  --accent: var(--blue);
  --tone:   var(--blue);

  --r-sm: 8px;
  --r:    12px;
  --r-lg: 18px;
  --blur: 16px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --t:    180ms var(--ease);

  --mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', ui-monospace, monospace;

  /* Older names, kept so inline styles on individual tools keep working */
  --bg:         var(--ink);
  --surface:    var(--glass);
  --surface-2:  var(--glass-strong);
  --border:     var(--line);
  --border-mid: var(--line-strong);
  --text-muted: var(--muted);
  --text-dim:   var(--dim);
  --green:      var(--mint);
  --red:        var(--rose);
  --purple:     var(--violet);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--ink);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Aurora behind the glass. Fixed, so panels blur something real. */
body::before {
  content: "";
  position: fixed;
  inset: -20vmax;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(42vmax 30vmax at 12% 8%,  rgba(125, 180, 255, 0.24), transparent 62%),
    radial-gradient(36vmax 28vmax at 90% 4%,  rgba(183, 148, 246, 0.22), transparent 62%),
    radial-gradient(34vmax 26vmax at 70% 55%, rgba(110, 231, 197, 0.07), transparent 65%),
    radial-gradient(44vmax 32vmax at 20% 100%, rgba(183, 148, 246, 0.10), transparent 62%);
  animation: aurora-drift 40s ease-in-out infinite alternate;
}

@keyframes aurora-drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(-3vmax, 2vmax, 0) scale(1.06); }
}

::selection { background: rgba(125, 180, 255, 0.32); color: #fff; }

a { color: var(--blue); }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ── HEADER ─────────────────────────────── */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem clamp(1rem, 4vw, 2rem);
  background: rgba(6, 9, 20, 0.62);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--line);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: linear-gradient(140deg, var(--blue), var(--violet) 70%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 6px 18px -6px rgba(125, 180, 255, 0.55);
  transition: transform var(--t);
}

.logo:hover .logo-icon { transform: rotate(-8deg); }

.logo-icon svg { width: 17px; height: 17px; color: var(--ink); }

.logo-text {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.site-nav a {
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: color var(--t), background var(--t);
}

.site-nav a:hover { color: var(--text); background: var(--glass-strong); }
.site-nav a[aria-current="page"] { color: var(--text); }

.header-right { font-size: 0.8rem; color: var(--dim); font-weight: 500; }

/* ── LAYOUT ──────────────────────────────── */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 2.25rem clamp(1rem, 4vw, 1.5rem) 3rem;
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--dim);
  margin-bottom: 0.9rem;
}

.crumbs a { color: var(--muted); text-decoration: none; transition: color var(--t); }
.crumbs a:hover { color: var(--text); }

.page-title {
  font-size: clamp(1.8rem, 1.2rem + 2vw, 2.55rem);
  font-weight: 600;
  letter-spacing: -0.028em;
  line-height: 1.12;
  margin-bottom: 0.65rem;
  color: var(--text);
}

.page-subtitle {
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.7;
  max-width: 68ch;
  margin-bottom: 2rem;
}

/* ── BUTTONS ─────────────────────────────── */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 40px;
  padding: 0.55rem 1.05rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--glass-strong);
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--t), border-color var(--t), color var(--t), box-shadow var(--t), transform var(--t), filter var(--t);
}

button:hover  { border-color: var(--line-strong); }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(180deg, #92C2FF, #6AA6FF);
  color: #06101F;
  border-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 8px 22px -10px rgba(125, 180, 255, 0.75);
}
.btn-primary:hover { filter: brightness(1.07); transform: translateY(-1px); }

.btn-secondary {
  background: var(--glass-strong);
  color: var(--text);
  border-color: var(--line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.btn-secondary:hover { background: rgba(150, 165, 255, 0.15); border-color: var(--line-strong); }

.btn-danger {
  background: transparent;
  color: var(--rose);
  border-color: rgba(255, 122, 144, 0.35);
}
.btn-danger:hover { background: rgba(255, 122, 144, 0.1); border-color: rgba(255, 122, 144, 0.55); }

.btn-success {
  background: rgba(110, 231, 197, 0.14);
  color: var(--mint);
  border-color: rgba(110, 231, 197, 0.35);
}
.btn-success:hover { background: rgba(110, 231, 197, 0.22); }

.btn-flip {
  background: rgba(183, 148, 246, 0.14);
  color: var(--violet);
  border-color: rgba(183, 148, 246, 0.35);
}
.btn-flip:hover { background: rgba(183, 148, 246, 0.22); }

.toolbar {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0;
  flex-wrap: wrap;
}

/* ── FIELDS ──────────────────────────────── */
textarea {
  width: 100%;
  background: var(--well);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.84rem;
  line-height: 1.65;
  padding: 1rem 1.05rem;
  resize: vertical;
  outline: none;
  box-shadow: inset 0 1px 0 var(--glass-hi);
  transition: border-color var(--t), box-shadow var(--t);
}

input[type=text],
input[type=number],
input[type=search],
input[type=email],
input[type=url],
input[type=date],
input[type=time],
input[type=password] {
  background: var(--well);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 0.6rem 0.85rem;
  font-family: inherit;
  font-size: 0.92rem;
  outline: none;
  box-shadow: inset 0 1px 0 var(--glass-hi);
  transition: border-color var(--t), box-shadow var(--t);
}

select {
  background: var(--well);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: border-color var(--t), box-shadow var(--t);
}

select option { background: var(--well-solid); color: var(--text); }

textarea:focus,
input:focus,
select:focus {
  border-color: rgba(125, 180, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(125, 180, 255, 0.18), inset 0 1px 0 var(--glass-hi);
}

textarea::placeholder,
input::placeholder { color: var(--dim); }

input[type=range]    { accent-color: var(--blue); }
input[type=checkbox],
input[type=radio]    { accent-color: var(--blue); }

/* ── EDITOR GRID ─────────────────────────── */
.editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

@media (max-width: 760px) {
  .editor-grid { grid-template-columns: 1fr; }
  /* Tools set tall heights inline; keep the buttons within reach on phones */
  .editor-box textarea { height: 240px !important; }
}

.editor-box label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

/* ── STATUS ──────────────────────────────── */
.status {
  font-size: 0.84rem;
  min-height: 1.3rem;
  margin-top: 0.45rem;
  font-weight: 500;
}

.status.ok  { color: var(--mint); }
.status.err { color: var(--rose); }

/* ── GLASS PANEL ─────────────────────────── */
.section-box {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  margin-bottom: 1rem;
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  box-shadow: inset 0 1px 0 var(--glass-hi);
}

.section-box h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1.1rem;
  color: var(--text);
}

/* ── TABS ────────────────────────────────── */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.25rem;
  width: fit-content;
  max-width: 100%;
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
}

.tab {
  min-height: 34px;
  padding: 0.4rem 0.95rem;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--t), color var(--t);
}

.tab.active { background: linear-gradient(180deg, #92C2FF, #6AA6FF); color: #06101F; }
.tab:hover:not(.active) { background: var(--glass-strong); color: var(--text); }

/* ── DIVIDER ─────────────────────────────── */
.divider {
  border: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
  margin: 3.5rem 0;
}

/* ── LONG-FORM CONTENT ───────────────────── */
.content-section { max-width: 74ch; }

.content-section h2 {
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 0.9rem;
  color: var(--text);
}

.content-section h3 {
  font-size: 1.08rem;
  font-weight: 600;
  margin: 1.9rem 0 0.55rem;
  color: var(--text);
}

.content-section p,
.content-section li {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.8;
}

.content-section p { margin-bottom: 1rem; }
.content-section ul { padding-left: 1.25rem; margin-bottom: 1rem; }
.content-section a { color: var(--blue); text-underline-offset: 3px; }
.content-section code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--glass-strong);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.05em 0.35em;
  color: var(--text);
}

/* ── STEPS (real sequences only) ─────────── */
.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 1.25rem;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding: 0.45rem 0 0.45rem 2.6rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.75;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.55rem;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--blue);
  background: rgba(125, 180, 255, 0.1);
  border: 1px solid rgba(125, 180, 255, 0.3);
}

/* ── FAQ ─────────────────────────────────── */
.faq {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--glass);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  padding: 0 1.4rem;
  margin-top: 0.5rem;
}

.faq-item { padding: 1.25rem 0; border-top: 1px solid var(--line); }
.faq-item:first-child { border-top: 0; }

.faq-item h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text);
}

.faq-item p {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.75;
  margin: 0;
}

/* ── FOOTER ──────────────────────────────── */
footer,
.site-footer {
  margin-top: 4rem;
  border-top: 1px solid var(--line);
  background: rgba(6, 9, 20, 0.5);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  color: var(--dim);
  font-size: 0.875rem;
}

.footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 2rem clamp(1rem, 4vw, 1.5rem) 2.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
}

.footer-inner p { max-width: 52ch; line-height: 1.6; }

.footer-inner a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--t);
}

.footer-inner p a { color: var(--text); }
.footer-inner a:hover { color: var(--blue); }

.footer-nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }

/* ── UTILITY ─────────────────────────────── */
.hidden,
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ── SMALL SCREENS ───────────────────────── */
@media (max-width: 600px) {
  .page-subtitle { font-size: 0.96rem; }
  .site-nav a { padding: 0.4rem 0.6rem; font-size: 0.84rem; }
  .faq { padding: 0 1.1rem; }
  .divider { margin: 2.75rem 0; }
}

@media (max-width: 380px) {
  .logo-text { display: none; }
}

/* Fewer blur layers on devices that struggle with them */
@media (prefers-reduced-transparency: reduce) {
  header, textarea, .section-box, .tabs, .faq, footer, .site-footer, .btn-secondary {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  header { background: var(--ink); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  body::before { animation: none; }
}
