:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef2f6;
  --ink: #172033;
  --muted: #667085;
  --line: #d9e0e8;
  --red: #cf3636;
  --red-dark: #a92727;
  --blue: #2867d8;
  --green: #127a5b;
  --amber: #b26000;
  --shadow: 0 18px 50px rgba(23, 32, 51, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: #f4f7fb;
  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;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(16px, 4vw, 42px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

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

.brand-logo {
  display: block;
  width: 174px;
  height: auto;
  max-height: 42px;
  object-fit: contain;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  color: var(--muted);
  scrollbar-width: none;
}

.topnav::-webkit-scrollbar {
  display: none;
}

.topnav a {
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 14px;
  white-space: nowrap;
}

.topnav a:hover,
.topnav a:focus-visible {
  background: var(--surface-2);
  color: var(--ink);
  outline: none;
}

main {
  padding: clamp(18px, 4vw, 44px);
}

.home-page main {
  padding-top: 0;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  gap: clamp(24px, 5vw, 62px);
  align-items: center;
  max-width: 1180px;
  min-height: 520px;
  margin: 0 auto 28px;
  padding: clamp(34px, 7vw, 78px) 0 clamp(26px, 5vw, 48px);
}

.hero-copy {
  min-width: 0;
}

.hero-kicker {
  display: inline-flex;
  margin-bottom: 14px;
  padding: 7px 11px;
  background: #fff5f5;
  border: 1px solid #f3c7c7;
  border-radius: 999px;
  color: var(--red-dark);
  font-size: 13px;
  font-weight: 800;
}

.hero-copy h1 {
  max-width: 780px;
  font-size: 58px;
  line-height: 1;
}

.hero-copy p:not(.hero-kicker) {
  max-width: 650px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 18px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.hero-primary,
.hero-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 12px 18px;
  border-radius: 8px;
  font-weight: 800;
}

.hero-primary {
  background: var(--red);
  color: #fff;
  box-shadow: 0 14px 30px rgba(207, 54, 54, 0.24);
}

.hero-secondary {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
}

.hero-primary:hover,
.hero-primary:focus-visible {
  background: var(--red-dark);
  outline: none;
}

.hero-secondary:hover,
.hero-secondary:focus-visible {
  border-color: #b9c4d0;
  outline: none;
}

.hero-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
  color: var(--muted);
}

.hero-metrics span {
  padding: 9px 11px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.hero-metrics strong {
  color: var(--ink);
}

.hero-preview {
  min-width: 0;
}

.preview-window {
  position: relative;
  padding: 16px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(246, 247, 249, 0.95)),
    linear-gradient(135deg, #fef3f3, #eef7ff);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(23, 32, 51, 0.16);
}

.preview-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.preview-bar span {
  width: 10px;
  height: 10px;
  background: #d7dee7;
  border-radius: 50%;
}

.preview-upload {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 122px;
  padding: 18px;
  background: #fff;
  border: 1px dashed #b8c6d5;
  border-radius: 8px;
}

.preview-file {
  display: grid;
  width: 58px;
  height: 74px;
  place-items: center;
  flex: 0 0 auto;
  background: var(--red);
  color: #fff;
  border-radius: 8px;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(207, 54, 54, 0.25);
}

.preview-upload p {
  margin: 4px 0 0;
  color: var(--muted);
}

.preview-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.preview-tools a {
  display: grid;
  gap: 3px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.preview-tools span {
  color: var(--red-dark);
  font-size: 12px;
  font-weight: 800;
}

.preview-tools strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-tool-grid {
  max-width: 1180px;
  margin: 0 auto 22px;
  padding: clamp(18px, 4vw, 28px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(23, 32, 51, 0.08);
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-head h2 {
  margin-bottom: 0;
  font-size: 30px;
}

.section-head a {
  color: var(--red-dark);
  font-weight: 800;
}

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

.popular-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 244px;
  padding: 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.popular-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0%, rgba(207, 54, 54, 0.08) 45%, transparent 70%);
  opacity: 0;
  transform: translateX(-70%);
  transition: opacity 160ms ease, transform 500ms ease;
}

.popular-card:hover,
.popular-card:focus-visible {
  transform: translateY(-5px);
  border-color: #f3c7c7;
  box-shadow: 0 20px 40px rgba(23, 32, 51, 0.12);
  outline: none;
}

.popular-card:hover::before,
.popular-card:focus-visible::before {
  opacity: 1;
  transform: translateX(70%);
}

.popular-icon {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  margin-bottom: 22px;
  border-radius: 8px;
  font-weight: 900;
}

.popular-icon svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.popular-icon.icon-red {
  background: #fff0f0;
  color: #d13232;
}

.popular-icon.icon-blue {
  background: #eef5ff;
  color: #2867d8;
}

.popular-icon.icon-green {
  background: #eef8f4;
  color: #127a5b;
}

.popular-icon.icon-orange {
  background: #fff2e8;
  color: #c2410c;
}

.popular-icon.icon-cyan {
  background: #eafaff;
  color: #08758f;
}

.popular-icon.icon-slate {
  background: #eef2f7;
  color: #334155;
}

.popular-icon.icon-amber {
  background: #fff8ec;
  color: #b26000;
}

.popular-icon.icon-purple {
  background: #f5efff;
  color: #7c3aed;
}

.popular-icon.icon-rose {
  background: #fff2f8;
  color: #be185d;
}

.popular-card strong {
  min-width: 0;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.2;
}

.popular-card small {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.animated-tool-button {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: max-content;
  min-height: 36px;
  margin-top: auto;
  padding-top: 18px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
  transition: color 160ms ease, gap 160ms ease;
}

.animated-tool-button span {
  transition: transform 160ms ease;
}

.popular-card:hover .animated-tool-button,
.popular-card:focus-visible .animated-tool-button {
  gap: 12px;
  color: var(--red-dark);
}

.popular-card:hover .animated-tool-button span,
.popular-card:focus-visible .animated-tool-button span {
  transform: translateX(2px);
}

.home-page .workspace {
  min-height: auto;
  padding-top: 8px;
}

.workspace {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 20px;
  max-width: 1180px;
  margin: 0 auto;
  min-height: min(760px, calc(100vh - 150px));
}

.toolrail {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-self: start;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(23, 32, 51, 0.06);
}

.tool-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 9px 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 7px;
  cursor: pointer;
  text-align: left;
}

.tool-tab:hover,
.tool-tab:focus-visible,
.tool-tab.is-active {
  background: #fff5f5;
  border-color: #f3c7c7;
  color: var(--red-dark);
  outline: none;
}

.tool-icon {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 800;
}

.tool-tab.is-active .tool-icon {
  background: var(--red);
  color: #fff;
}

.toolstage {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 4px 0 8px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--red-dark);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 48px;
  line-height: 1.02;
  letter-spacing: 0;
}

.stage-head h2 {
  margin: 0;
  font-size: 38px;
  line-height: 1.05;
}

.stage-intro {
  max-width: 760px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 17px;
}

.status-pill {
  flex: 0 0 auto;
  padding: 8px 12px;
  background: #eef8f4;
  color: var(--green);
  border: 1px solid #bde2d5;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.tool-panel {
  display: none;
  padding: clamp(18px, 4vw, 34px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.tool-panel.is-active {
  display: block;
}

.panel-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.panel-title h2 {
  margin-bottom: 6px;
  font-size: 24px;
  letter-spacing: 0;
}

.panel-title p {
  max-width: 560px;
  margin-bottom: 0;
  color: var(--muted);
}

.dropzone {
  position: relative;
  display: grid;
  min-height: 230px;
  place-items: center;
  padding: 28px;
  border: 2px dashed #c8d2dd;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.96)),
    repeating-linear-gradient(135deg, #f2f5f8 0, #f2f5f8 12px, #e8edf3 12px, #e8edf3 24px);
  cursor: pointer;
  text-align: center;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.dropzone:hover,
.dropzone.is-dragging,
.dropzone:focus-within {
  border-color: var(--red);
  transform: translateY(-1px);
}

.dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dropzone strong {
  display: block;
  margin-top: 10px;
  font-size: 20px;
}

.dropzone small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.drop-icon {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  margin: 0 auto;
  background: var(--red);
  color: #fff;
  border-radius: 8px;
  font-size: 30px;
  font-weight: 800;
  box-shadow: 0 18px 32px rgba(207, 54, 54, 0.28);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.field-grid .wide {
  grid-column: span 3;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

input:not([type="file"]),
select {
  width: 100%;
  min-height: 44px;
  padding: 9px 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #c8d2dd;
  border-radius: 7px;
}

input[type="color"] {
  padding: 3px;
}

input:not([type="file"]):focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(40, 103, 216, 0.12);
  outline: none;
}

.file-list {
  display: grid;
  gap: 8px;
  min-height: 0;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  font-size: 14px;
}

.file-list strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 170px;
  min-height: 48px;
  margin-top: 18px;
  padding: 12px 18px;
  border: 0;
  background: var(--red);
  color: #fff;
  border-radius: 7px;
  box-shadow: 0 12px 26px rgba(207, 54, 54, 0.26);
  cursor: pointer;
  font-weight: 800;
}

.primary-action:hover,
.primary-action:focus-visible {
  background: var(--red-dark);
  outline: none;
}

.primary-action:disabled {
  background: #a8b1bd;
  box-shadow: none;
  cursor: wait;
}

.resultbar {
  min-height: 46px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.resultbar:empty {
  display: none;
}

.resultbar.is-success {
  background: #eef8f4;
  border-color: #bde2d5;
  color: var(--green);
}

.resultbar.is-error {
  background: #fff5f5;
  border-color: #f3c7c7;
  color: var(--red-dark);
}

.resultbar.is-working {
  background: #fff8ec;
  border-color: #f1d2a9;
  color: var(--amber);
}

.trust-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  max-width: 1180px;
  margin: 22px auto 0;
}

.trust-band article {
  min-height: 94px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.trust-band strong,
.trust-band span {
  display: block;
}

.trust-band strong {
  margin-bottom: 4px;
}

.trust-band span {
  color: var(--muted);
}

.content-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 18px;
  max-width: 1180px;
  margin: 22px auto 0;
}

.content-main,
.content-side,
.faq-section,
.guide-strip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.content-main,
.content-side {
  padding: clamp(18px, 4vw, 28px);
}

.content-main h2,
.content-side h2,
.faq-section h2,
.guide-strip h2 {
  margin-bottom: 12px;
  font-size: 26px;
  letter-spacing: 0;
}

.content-main h3 {
  margin: 24px 0 8px;
  font-size: 18px;
}

.content-main p,
.content-main li {
  color: var(--muted);
}

.clean-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
}

.tool-card-grid,
.faq-grid,
.guide-list,
.article-list {
  display: grid;
  gap: 10px;
}

.tool-card,
.guide-list a,
.article-list a {
  display: grid;
  gap: 4px;
  padding: 13px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.tool-card:hover,
.tool-card:focus-visible,
.guide-list a:hover,
.guide-list a:focus-visible,
.article-list a:hover,
.article-list a:focus-visible {
  border-color: #f3c7c7;
  color: var(--red-dark);
  outline: none;
}

.tool-card.is-current {
  background: #fff5f5;
  border-color: #f3c7c7;
}

.tool-card span,
.guide-list span,
.article-list span {
  color: var(--muted);
  font-size: 14px;
}

.faq-section,
.guide-strip {
  max-width: 1180px;
  margin: 22px auto 0;
  padding: clamp(18px, 4vw, 28px);
}

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

.faq-grid article {
  min-height: 150px;
  padding: 15px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.faq-grid h3 {
  margin: 0 0 8px;
  font-size: 17px;
}

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

.guide-strip {
  display: grid;
  grid-template-columns: 0.7fr 1.3fr;
  gap: 18px;
  align-items: start;
}

.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  color: var(--muted);
  font-size: 14px;
}

.footer-brand img {
  display: block;
  width: 120px;
  height: auto;
}

.footer a:hover,
.footer a:focus-visible {
  color: var(--ink);
  outline: none;
}

.legal-page {
  display: grid;
  min-height: calc(100vh - 80px);
  place-items: start center;
}

.legal-panel {
  width: min(820px, 100%);
  padding: clamp(18px, 4vw, 34px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.legal-panel h1 {
  margin-bottom: 18px;
}

.legal-panel h2 {
  margin: 24px 0 8px;
  font-size: 20px;
}

.legal-panel p {
  color: var(--muted);
}

.article-list {
  margin-top: 18px;
}

.article-list.compact {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.article-page p {
  font-size: 17px;
}

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

  .home-hero,
  .workspace {
    grid-template-columns: 1fr;
  }

  .home-hero {
    min-height: auto;
    padding-top: 30px;
  }

  .hero-copy h1 {
    font-size: 44px;
  }

  .toolrail {
    flex-direction: row;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .toolrail::-webkit-scrollbar {
    display: none;
  }

  .tool-tab {
    min-width: 164px;
  }

  .stage-head,
  .panel-title {
    align-items: start;
    flex-direction: column;
  }

  .field-grid,
  .popular-grid,
  .trust-band,
  .content-layout,
  .faq-grid,
  .guide-strip {
    grid-template-columns: 1fr;
  }

  .field-grid .wide {
    grid-column: auto;
  }
}

@media (max-width: 520px) {
  main {
    padding: 14px;
  }

  .topnav {
    width: 100%;
  }

  .tool-panel {
    padding: 16px;
  }

  .dropzone {
    min-height: 190px;
    padding: 18px;
  }

  h1 {
    font-size: 34px;
  }

  .hero-copy h1 {
    font-size: 36px;
  }

  .stage-head h2 {
    font-size: 30px;
  }

  .section-head {
    align-items: start;
    flex-direction: column;
  }

  .preview-tools {
    grid-template-columns: 1fr;
  }

  .primary-action {
    width: 100%;
  }
}
