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

:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --ink: #101319;
  --muted: #667085;
  --muted-strong: #475467;
  --border: rgba(16, 19, 25, 0.12);
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.1);
  --red: #ef233c;
  --max: 1120px;
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.1);
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.12), transparent 34rem),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
  font-family: 'Instrument Sans', Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.page {
  width: min(var(--max), calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.topbar,
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--ink);
  text-decoration: none;
  font-size: 1.35rem;
  font-weight: 800;
}

.brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.brand-accent {
  color: var(--red);
}

.nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 40px;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 700;
}

.tool-nav {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 2rem 0 0;
}

.tool-tab {
  min-height: 92px;
  display: grid;
  align-content: start;
  gap: 0.35rem;
  padding: 0.95rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--muted);
  text-decoration: none;
  box-shadow: 0 16px 42px rgba(15, 23, 42, 0.06);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.tool-tab:hover {
  border-color: rgba(37, 99, 235, 0.28);
  background: #ffffff;
  transform: translateY(-2px);
}

.tool-tab.active {
  border-color: rgba(37, 99, 235, 0.42);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(255, 255, 255, 0.95));
}

.tool-tab-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 850;
  line-height: 1.2;
}

.tool-tab-title i {
  color: var(--accent);
}

.tool-tab-desc {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.4;
}

.hero {
  width: min(900px, 100%);
  margin: 0 auto;
  padding: 3.5rem 0 2.2rem;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  color: var(--accent);
  font-family: 'DM Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin-top: 0.9rem;
  font-size: clamp(2.1rem, 4.6vw, 3.7rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.lead {
  width: min(740px, 100%);
  margin: 1.15rem auto 0;
  color: var(--muted);
  font-size: clamp(1.02rem, 2vw, 1.15rem);
  line-height: 1.75;
}

.tool-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.82fr);
  gap: 1rem;
  align-items: start;
}

.tool-card,
.results-card,
.info-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.07);
}

.tool-card,
.results-card {
  padding: clamp(1rem, 2.4vw, 1.35rem);
}

.field-group {
  display: grid;
  gap: 0.55rem;
}

.field-group + .field-group {
  margin-top: 1rem;
}

label,
.field-label {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
}

textarea {
  min-height: 270px;
  padding: 0.9rem;
  resize: vertical;
  line-height: 1.55;
}

input,
select {
  min-height: 44px;
  padding: 0 0.78rem;
}

.hint {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.52rem;
  min-height: 44px;
  padding: 0.74rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 800;
}

.btn.primary {
  border-color: transparent;
  background: var(--accent);
  color: #ffffff;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 0.8rem;
}

.result-title {
  margin-bottom: 0.8rem;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
  text-align: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 30px;
  padding: 0.35rem 0.62rem;
  border: 1px solid rgba(37, 99, 235, 0.24);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.8rem;
  font-weight: 800;
}

.output {
  width: 100%;
  min-height: 270px;
  padding: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted-strong);
  font-family: 'DM Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow: auto;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.check-option {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 44px;
  padding: 0.72rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted-strong);
  font-size: 0.9rem;
  font-weight: 700;
}

.check-option input {
  width: auto;
  min-height: auto;
}

.converter-grid {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 0.75rem;
}

.table-output {
  display: grid;
  gap: 0.45rem;
}

.table-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
  padding: 0.72rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.table-row strong {
  color: var(--ink);
}

.table-row span {
  min-width: 0;
  color: var(--muted-strong);
  font-family: 'DM Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.info-card {
  padding: 1rem;
}

.info-card i {
  margin-bottom: 0.6rem;
  color: var(--accent);
  font-size: 1.15rem;
}

.info-card h2 {
  margin-bottom: 0.45rem;
  font-size: 1rem;
  line-height: 1.25;
}

.info-card p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer a {
  font-weight: 500;
  text-decoration: none;
}

@media (max-width: 860px) {
  .topbar,
  .footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero {
    padding-top: 3.5rem;
    text-align: left;
  }

  .tool-shell,
  .tool-nav,
  .info-grid {
    grid-template-columns: 1fr;
  }

  .options-grid,
  .converter-grid {
    grid-template-columns: 1fr;
  }

  .btn {
    width: 100%;
  }
}

/* Desktop tools workspace: navigation stays on the left. */
.tools-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
  margin-top: 2rem;
}
.tools-layout > .tool-nav {
  position: sticky;
  top: 1rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: .55rem;
  margin: 0;
  padding: .7rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,.9);
  box-shadow: 0 18px 48px rgba(15,23,42,.07);
}
.tools-layout .tool-tab { min-height: 0; padding: .8rem; box-shadow: none; }
.tools-layout .tool-main { min-width: 0; }
.tools-layout .hero { width: 100%; margin: 0; padding: .25rem 0 2.2rem; text-align: left; }
@media (max-width: 860px) {
  .tools-layout { grid-template-columns: 1fr; gap: 1rem; }
  .tools-layout > .tool-nav { position: static; grid-template-columns: 1fr; }
  .tools-layout .hero { padding-top: .5rem; }
}

/* Compact mobile tool navigation keeps the active tool near the first viewport. */
@media (max-width: 600px) {
  .tools-layout > .tool-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem; padding: .5rem; }
  .tools-layout .tool-tab { min-height: 52px; padding: .65rem; align-content: center; }
  .tools-layout .tool-tab-desc { display: none; }
  .tools-layout .tool-tab-title { font-size: .82rem; }
}
