:root {
  --bg: #f5f7f6;
  --surface: #ffffff;
  --surface-alt: #eef7f4;
  --ink: #17211f;
  --muted: #64716d;
  --line: #d9e4df;
  --brand: #0f766e;
  --brand-strong: #0b5d58;
  --accent: #be6a15;
  --accent-soft: #fff3e5;
  --danger: #b42318;
  --shadow: 0 18px 50px rgba(20, 41, 36, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.28);
  outline-offset: 3px;
}

button,
input,
textarea {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px clamp(18px, 4vw, 56px);
  background: rgba(245, 247, 246, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 800;
  letter-spacing: 0;
}

.brand span {
  white-space: nowrap;
}

.top-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: clamp(14px, 3vw, 30px);
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}

.top-nav a:hover,
.top-nav a:focus-visible {
  color: var(--brand);
}

main {
  width: 100%;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(360px, 1.35fr);
  gap: clamp(22px, 4vw, 44px);
  min-height: min(720px, calc(100vh - 96px));
  padding: clamp(28px, 5vw, 64px) clamp(18px, 4vw, 56px) 42px;
  align-items: center;
}

.workspace-copy {
  max-width: 620px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  max-width: 720px;
  font-size: clamp(2.45rem, 5.5vw, 5.2rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.summary {
  margin: 22px 0 28px;
  max-width: 560px;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.18rem);
}

.search-wrap {
  max-width: 510px;
}

.search-wrap label,
.field-group label,
.output-header label {
  display: block;
  margin-bottom: 8px;
  color: #2e3a37;
  font-size: 0.86rem;
  font-weight: 800;
}

.search-wrap input {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(20, 41, 36, 0.06);
  outline: none;
}

.search-wrap input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.14);
}

.tool-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.tool-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  border-bottom: 1px solid var(--line);
  background: #f9fbfa;
}

.tool-tab {
  min-height: 48px;
  padding: 0 8px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.tool-tab:last-child {
  border-right: 0;
}

.tool-tab:hover,
.tool-tab:focus-visible {
  background: var(--surface-alt);
  color: var(--brand);
}

.tool-tab.is-active {
  background: var(--brand);
  color: #ffffff;
}

.tool-body {
  padding: clamp(18px, 3vw, 28px);
}

.field-group {
  min-width: 0;
}

textarea {
  width: 100%;
  min-height: 170px;
  resize: vertical;
  padding: 14px;
  color: #18211f;
  background: #fbfdfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92rem;
  line-height: 1.55;
}

textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0;
}

.primary-action,
.secondary-action,
.ghost-action {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 800;
}

.primary-action {
  background: var(--brand);
  color: #ffffff;
}

.primary-action:hover,
.primary-action:focus-visible {
  background: var(--brand-strong);
}

.secondary-action {
  background: var(--accent-soft);
  color: #7a3f08;
  border-color: #f3d6b4;
}

.secondary-action:hover,
.secondary-action:focus-visible {
  border-color: var(--accent);
}

.ghost-action {
  background: #ffffff;
  color: var(--muted);
  border-color: var(--line);
}

.ghost-action:hover,
.ghost-action:focus-visible {
  color: var(--ink);
  border-color: #a7b7b1;
}

.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#tool-status {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  text-align: right;
}

#tool-status.is-error {
  color: var(--danger);
}

.section-block {
  padding: 42px clamp(18px, 4vw, 56px);
}

.section-heading {
  display: grid;
  grid-template-columns: minmax(0, 0.7fr) minmax(280px, 1.3fr);
  gap: 24px;
  align-items: end;
  margin-bottom: 22px;
}

.section-heading h2 {
  margin: 0;
  max-width: 820px;
  font-size: clamp(1.65rem, 3vw, 2.45rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.tool-card {
  display: block;
  min-height: 190px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.featured-tools .tool-card {
  min-height: 172px;
}

.tool-card[href]:hover,
.tool-card[href]:focus-visible {
  border-color: rgba(15, 118, 110, 0.5);
  box-shadow: 0 14px 36px rgba(20, 41, 36, 0.1);
  transform: translateY(-1px);
}

.tool-card.is-hidden {
  display: none;
}

.tool-icon {
  display: inline-grid;
  width: 46px;
  height: 46px;
  place-items: center;
  margin-bottom: 16px;
  color: #ffffff;
  background: #243b37;
  border-radius: 8px;
  font-size: 0.83rem;
  font-weight: 900;
}

.tool-card:nth-child(2n) .tool-icon {
  background: var(--brand);
}

.tool-card:nth-child(3n) .tool-icon {
  background: var(--accent);
}

.tool-card h3,
.roadmap-list h3 {
  margin: 0 0 8px;
  font-size: 1.08rem;
  letter-spacing: 0;
}

.tool-card p,
.roadmap-list p {
  margin: 0;
  color: var(--muted);
}

.tool-link-text {
  display: inline-block;
  margin-top: 16px;
  color: var(--brand);
  font-size: 0.9rem;
  font-weight: 800;
}

.tool-page {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(360px, 1.35fr);
  gap: clamp(22px, 4vw, 44px);
  padding: clamp(28px, 5vw, 64px) clamp(18px, 4vw, 56px) 42px;
  align-items: start;
}

.tool-hero {
  position: sticky;
  top: 104px;
  max-width: 620px;
}

.tool-hero h1 {
  font-size: clamp(2.35rem, 5vw, 4.7rem);
}

.standalone-tool {
  width: 100%;
}

.content-grid,
.related-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.content-grid article,
.related-links a {
  min-height: 138px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.content-grid h3 {
  margin: 0 0 8px;
  font-size: 1.08rem;
}

.content-grid p {
  margin: 0;
  color: var(--muted);
}

.article-section {
  background: #ffffff;
}

.article-copy,
.legal-copy {
  max-width: 920px;
  color: #2e3a37;
}

.article-copy p,
.legal-copy p {
  margin: 0 0 18px;
}

.article-copy p:last-child,
.legal-copy p:last-child {
  margin-bottom: 0;
}

.legal-page {
  padding: clamp(34px, 5vw, 70px) clamp(18px, 4vw, 56px);
}

.legal-page h1 {
  margin-bottom: 28px;
  font-size: clamp(2.2rem, 4.6vw, 4rem);
}

.legal-copy section {
  margin-bottom: 30px;
}

.legal-copy h2 {
  margin: 0 0 10px;
  font-size: clamp(1.35rem, 2.4vw, 1.9rem);
  line-height: 1.15;
}

.qr-preview {
  display: grid;
  min-height: 220px;
  place-items: center;
  margin-top: 14px;
  padding: 18px;
  background: #fbfdfc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.qr-preview:empty {
  display: none;
}

.qr-preview svg {
  width: min(100%, 260px);
  height: auto;
}

.related-links a {
  display: flex;
  align-items: center;
  color: var(--brand);
  font-weight: 800;
}

.featured-tools {
  background: linear-gradient(180deg, #f8fbfa 0%, #eef7f4 100%);
}

.feature-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  padding: 0 10px;
  margin-bottom: 14px;
  color: #0b5d58;
  background: #dff7f1;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.not-found-page {
  display: block;
  min-height: calc(100vh - 80px);
}

.not-found-page .legal-copy a {
  color: var(--brand);
  font-weight: 800;
}

.tool-controls {
  display: grid;
  gap: 14px;
}

.control-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.tool-select,
.tool-input,
.tool-output {
  width: 100%;
  min-width: 0;
  padding: 14px;
  color: #18211f;
  background: #fbfdfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

.tool-select {
  min-height: 52px;
}

.tool-output {
  min-height: 240px;
  white-space: pre-wrap;
}

.tool-preview {
  padding: 18px;
  background: #fbfdfc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.tool-preview:empty {
  display: none;
}

.diff-lines {
  display: grid;
  gap: 6px;
}

.diff-line {
  padding: 10px 12px;
  border-radius: 6px;
  background: #f8fbfa;
  border: 1px solid transparent;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.diff-line.is-added {
  background: #eaf8f4;
  border-color: #b8e8d6;
}

.diff-line.is-removed {
  background: #fff1eb;
  border-color: #f5c4b0;
}

.scan-status {
  padding: 14px 16px;
  background: #fbfdfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.related-links a:hover,
.related-links a:focus-visible {
  border-color: rgba(15, 118, 110, 0.5);
  background: var(--surface-alt);
}

.roadmap {
  background: #eaf2ef;
}

.roadmap-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.roadmap-list > div {
  padding: 22px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 32px;
  padding: 24px clamp(18px, 4vw, 56px);
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.site-footer span:first-child,
.site-footer strong {
  color: var(--ink);
  font-weight: 800;
}

.site-footer p {
  margin: 6px 0 0;
}

.footer-nav {
  display: grid;
  grid-template-columns: minmax(180px, 1.3fr) minmax(140px, 0.7fr);
  gap: 24px;
  min-width: min(100%, 520px);
}

.footer-nav div {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
}

.footer-nav strong {
  flex-basis: 100%;
}

.footer-nav a {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.footer-nav a:hover,
.footer-nav a:focus-visible {
  color: var(--brand);
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
    min-height: 0;
    align-items: start;
  }

  .workspace-copy {
    max-width: 760px;
  }

  .section-heading,
  .tool-grid,
  .roadmap-list,
  .tool-page,
  .content-grid,
  .related-links {
    grid-template-columns: 1fr;
  }

  .tool-hero {
    position: static;
    max-width: 760px;
  }

  .control-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .site-header {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .top-nav {
    width: 100%;
    justify-content: flex-start;
  }

  .tool-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tool-tab {
    border-bottom: 1px solid var(--line);
  }

  .action-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .primary-action,
  .secondary-action,
  .ghost-action {
    width: 100%;
  }

  .site-footer {
    flex-direction: column;
  }

  .footer-nav {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .content-grid article,
  .related-links a {
    min-height: auto;
  }
}

@media (max-width: 430px) {
  .brand span {
    white-space: normal;
  }

  .tool-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .action-row {
    grid-template-columns: 1fr;
  }
}
