* {
  box-sizing: border-box;
}

:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --soft: #f9fafb;
  --accent: #111827;
  --blue: #2563eb;
  --green: #15803d;
  --red: #b91c1c;
  --radius: 14px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: #fff;
  font-size: 15px;
  line-height: 1.6;
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.container,
.header-inner {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

/* Unified Baiming Service header */

.site-header {
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.header-inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 30px;
}

.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  white-space: nowrap;
}

.brand-logo {
  display: block;
  width: 190px;
  max-width: 100%;
  height: auto;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-left: auto;
}

.top-nav a,
.site-footer a {
  color: #4b5563;
  text-decoration: none;
  font-size: 14px;
}

.top-nav a:hover,
.site-footer a:hover {
  color: #111827;
}

/* Product introduction */

.intro {
  padding: 54px 0 30px;
}

.eyebrow {
  margin: 0 0 10px;
  color: #6b7280;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .13em;
}

h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 46px);
  line-height: 1.15;
  letter-spacing: -.045em;
}

.intro-copy {
  max-width: 760px;
  margin: 16px 0 18px;
  color: #4b5563;
  font-size: 17px;
}

.trust-points {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  color: #4b5563;
  font-size: 13px;
}

.trust-points i {
  margin-right: 5px;
  color: var(--green);
  font-style: normal;
  font-weight: 800;
}

/* Main converter */

.tool-section {
  padding-bottom: 8px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
  gap: 18px;
}

.panel,
.preview-section {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.panel {
  height: 430px;
  display: flex;
  flex-direction: column;
}

.panel-heading,
.panel-footer,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.panel-heading {
  min-height: 78px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}

.panel-title {
  display: block;
  font-size: 14px;
  font-weight: 700;
}

.panel-subtitle {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.text-button {
  padding: 5px 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.text-button:hover {
  color: #374151;
  text-decoration: underline;
}

.danger-text {
  color: var(--red);
}

textarea {
  display: block;
  width: 100%;
  min-height: 0;
  flex: 1;
  resize: vertical;
  padding: 16px;
  border: 0;
  outline: none;
  background: #fff;
  color: #253047;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 1.7;
  tab-size: 2;
}

textarea::placeholder {
  color: #9ca3af;
}

textarea:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, .2);
}

#html-output {
  background: #f9fafb;
}

.panel-footer {
  min-height: 48px;
  margin-top: auto;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: #fafafa;
}

.stats,
.status {
  color: var(--muted);
  font-size: 11px;
}

.status {
  color: var(--green);
  text-align: right;
}

.button-group {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  transition: background .15s, border-color .15s;
}

.primary-button {
  background: #111827;
  color: #fff;
}

.primary-button:hover {
  background: #293548;
}

.secondary-button {
  border-color: #d1d5db;
  background: #fff;
  color: #111827;
}

.secondary-button:hover {
  background: #f3f4f6;
}

/* Live preview */

.preview-section {
  margin-top: 18px;
}

.section-heading {
  min-height: 76px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}

.section-heading h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
}

.section-lead {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.preview-label {
  padding: 5px 9px;
  border-radius: 6px;
  background: #f3f4f6;
  color: #4b5563;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .08em;
}

.preview-content {
  min-height: 160px;
  max-height: 480px;
  padding: 22px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  overflow-wrap: anywhere;
  background: #fff;
}

.empty-preview {
  margin: 0;
  color: #9ca3af;
  font-size: 13px;
}

.preview-content h1,
.preview-content h2,
.preview-content h3,
.preview-content h4,
.preview-content h5,
.preview-content h6 {
  margin: 1.1em 0 .55em;
  line-height: 1.3;
}

.preview-content h1:first-child,
.preview-content h2:first-child,
.preview-content h3:first-child {
  margin-top: 0;
}

.preview-content p {
  margin: .7em 0;
}

.preview-content a {
  color: var(--blue);
  text-decoration: underline;
}

.preview-content blockquote {
  margin: 1em 0;
  padding: 2px 0 2px 14px;
  border-left: 3px solid #cbd5e1;
  color: #4b5563;
}

.preview-content pre {
  overflow-x: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fafb;
}

.preview-content code {
  padding: 2px 5px;
  border-radius: 4px;
  background: #f3f4f6;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .9em;
}

.preview-content pre code {
  padding: 0;
  background: transparent;
}

.preview-content table {
  width: 100%;
  margin: 1em 0;
  border-collapse: collapse;
}

.preview-content th,
.preview-content td {
  padding: 8px 10px;
  border: 1px solid var(--line);
  text-align: left;
}

.preview-content th {
  background: #f9fafb;
}

.preview-content hr {
  border: 0;
  border-top: 1px solid var(--line);
}

.preview-content img {
  max-width: 100%;
  height: auto;
}

/* Privacy and status */

.privacy-note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  margin: 16px 0 22px;
  border: 1px solid #dcfce7;
  border-radius: 11px;
  background: #f0fdf4;
}

.privacy-icon {
  display: grid;
  width: 23px;
  height: 23px;
  flex: 0 0 23px;
  place-items: center;
  border-radius: 50%;
  background: #dcfce7;
  color: #15803d;
  font-size: 13px;
  font-weight: 800;
}

.privacy-note p {
  margin: 0;
  color: #365744;
  font-size: 13px;
}

.privacy-note strong {
  color: #14532d;
}

/* Instructions, FAQ and privacy */

.content-section {
  padding: 30px 0;
  border-top: 1px solid var(--line);
}

.content-section h2 {
  margin: 0 0 14px;
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: -.02em;
}

.content-section h3 {
  margin: 22px 0 8px;
  font-size: 15px;
}

.content-section p,
.content-section li {
  color: #4b5563;
  font-size: 14px;
}

.content-section p {
  margin: 9px 0;
}

.content-section ol,
.content-section ul {
  margin: 10px 0 0;
  padding-left: 22px;
}

.content-section li {
  margin: 6px 0;
}

.faq-section h2 {
  margin-bottom: 14px;
}

.faq-item {
  border-top: 1px solid var(--line);
}

.faq-item:last-child {
  border-bottom: 1px solid var(--line);
}

.faq-item summary {
  position: relative;
  padding: 15px 32px 15px 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  list-style: none;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  position: absolute;
  top: 50%;
  right: 5px;
  transform: translateY(-50%);
  color: #4b5563;
  font-size: 20px;
  font-weight: 400;
}

.faq-item[open] summary::after {
  content: "−";
}

.faq-item p {
  margin: 0;
  padding: 0 30px 16px 0;
  color: #4b5563;
  font-size: 14px;
}

.privacy-section {
  padding-bottom: 38px;
}

/* Unified Baiming Service footer */

.site-footer {
  border-top: 1px solid var(--line);
  background: #fff;
}

.footer-inner {
  min-height: 76px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  color: #9ca3af;
  font-size: 12px;
}

.footer-inner nav {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.site-footer a {
  font-size: 12px;
}

/* Responsive layout */

@media (max-width: 800px) {
  .header-inner {
    min-height: 0;
    padding: 14px 0;
    flex-wrap: wrap;
    gap: 12px 18px;
  }

  .top-nav {
    order: 3;
    width: 100%;
    margin: 0;
    gap: 20px;
  }

  .intro {
    padding: 40px 0 25px;
  }

  .intro-copy {
    font-size: 15px;
  }

  .trust-points {
    gap: 9px 17px;
  }

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

  .panel {
    height: 390px;
  }

  .content-section {
    padding: 26px 0;
  }
}

@media (max-width: 520px) {
  .container,
  .header-inner {
    width: calc(100% - 28px);
  }

  .brand-logo {
    width: 165px;
  }

  .top-nav {
    gap: 18px;
  }

  .top-nav a {
    font-size: 13px;
  }

  .intro {
    padding: 32px 0 22px;
  }

  h1 {
    font-size: 34px;
  }

  .intro-copy {
    font-size: 14px;
  }

  .trust-points {
    gap: 7px 14px;
    font-size: 12px;
  }

  .panel {
    height: 370px;
  }

  .panel-heading {
    padding: 12px;
  }

  .output-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
  }

  .button-group {
    width: 100%;
    gap: 7px;
  }

  .primary-button,
  .secondary-button {
    flex: 1;
    padding: 8px 7px;
    font-size: 11px;
  }

  textarea {
    padding: 13px;
  }

  .panel-footer {
    padding: 9px 12px;
  }

  .preview-content {
    max-height: 400px;
    padding: 17px;
  }

  .section-heading {
    padding: 13px;
  }

  .privacy-note {
    padding: 12px;
  }

  .content-section h2 {
    font-size: 19px;
  }

  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    padding-top: 18px;
    padding-bottom: 18px;
  }

  .footer-inner nav {
    gap: 12px 18px;
  }
}
