:root {
  color-scheme: light;
  --color-text: #172033;
  --color-muted: #697386;
  --color-primary: #315efb;
  --color-primary-hover: #244bd6;
  --color-border: #e5e9f0;
  --color-surface: #ffffff;
  --color-background: #f7f8fb;
  --color-soft: #f1f4f9;
  --color-success: #16845b;
  --color-danger: #c53b43;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-panel: 0 8px 30px rgba(25, 39, 70, 0.045);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--color-text);
  background: var(--color-background);
  font-size: 15px;
  line-height: 1.65;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

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

.site-header {
  position: relative;
  z-index: 5;
  background: #fff;
  border-bottom: 1px solid var(--color-border);
}

.header-inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  font-size: 19px;
  font-weight: 750;
  letter-spacing: -0.6px;
}

.brand-name {
  white-space: nowrap;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 30px;
}

.top-nav a,
.site-footer a {
  color: #596477;
  font-size: 14px;
  font-weight: 550;
  transition: color 0.18s ease;
}

.top-nav a:hover,
.site-footer a:hover {
  color: var(--color-primary);
}

.page-intro {
  padding-top: 58px;
  padding-bottom: 34px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--color-primary);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 1.35px;
  line-height: 1.5;
}

.page-intro h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 46px);
  font-weight: 760;
  letter-spacing: -1.8px;
  line-height: 1.15;
}

.intro-description {
  max-width: 690px;
  margin: 17px 0 0;
  color: var(--color-muted);
  font-size: 16px;
  line-height: 1.8;
}

.trust-points {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 26px;
  margin: 23px 0 0;
  padding: 0;
  list-style: none;
}

.trust-points li {
  position: relative;
  padding-left: 21px;
  color: #566176;
  font-size: 13px;
}

.trust-points li::before {
  position: absolute;
  top: 1px;
  left: 0;
  color: var(--color-success);
  content: "✓";
  font-weight: 800;
}

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

.workspace-panel,
.results-panel,
.replacement-panel {
  min-width: 0;
  padding: 30px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
}

.results-panel,
.replacement-panel {
  margin-top: 20px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 25px;
}

.section-heading .eyebrow {
  margin-bottom: 5px;
}

.section-heading h2,
.content-section h2,
.faq-section h2,
.related-inner h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 720;
  letter-spacing: -0.55px;
  line-height: 1.35;
}

.tool-label,
.result-status {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 11px;
  color: #596477;
  background: var(--color-soft);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.result-status {
  color: var(--color-success);
  background: #edf8f2;
}

.field-group {
  min-width: 0;
  margin-top: 22px;
}

.field-group > label,
.field-heading label {
  display: block;
  margin-bottom: 9px;
  color: #263248;
  font-size: 14px;
  font-weight: 680;
}

.pattern-input-wrap {
  display: flex;
  align-items: center;
  min-height: 54px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #dce2ec;
  border-radius: var(--radius-md);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.pattern-input-wrap:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(49, 94, 251, 0.1);
}

.pattern-delimiter {
  padding: 0 12px;
  color: #8792a5;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 18px;
}

.pattern-input-wrap input {
  min-width: 0;
  height: 52px;
  padding: 0;
  color: #1c2940;
  background: transparent;
  border: 0;
  outline: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
}

#regexPattern {
  flex: 1;
}

.pattern-input-wrap .flags-input {
  width: 76px;
  padding: 0 12px;
  border-left: 1px solid var(--color-border);
  text-align: center;
}

.field-help,
.field-hint {
  margin: 7px 0 0;
  color: #8993a4;
  font-size: 12px;
  line-height: 1.6;
}

.error-message {
  margin: 9px 0 0;
  padding: 10px 12px;
  color: var(--color-danger);
  background: #fff1f1;
  border: 1px solid #f5d5d7;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.flags-fieldset {
  min-width: 0;
  margin: 22px 0 0;
  padding: 0;
  border: 0;
}

.flags-fieldset legend {
  margin-bottom: 11px;
  color: #263248;
  font-size: 14px;
  font-weight: 680;
}

.flags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.flag-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 39px;
  padding: 5px 11px;
  color: #566176;
  background: #f7f8fb;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.16s ease;
}

.flag-option:has(input:checked) {
  color: #244bd6;
  background: #eff3ff;
  border-color: #b9c9ff;
}

.flag-option input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--color-primary);
}

.flag-option span {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  font-weight: 750;
}

.flag-option small {
  font-size: 11px;
}

.examples-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  margin-top: 22px;
}

.examples-label {
  margin-right: 3px;
  color: #697386;
  font-size: 12px;
  font-weight: 650;
}

.example-button {
  padding: 6px 11px;
  color: #46536a;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 7px;
  font-size: 12px;
  transition: all 0.16s ease;
}

.example-button:hover {
  color: var(--color-primary);
  background: #f4f6ff;
  border-color: #bdcaff;
}

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

.field-heading label {
  margin-bottom: 0;
}

.field-heading .field-hint {
  margin: 0;
}

textarea,
#replacementText {
  display: block;
  width: 100%;
  color: #253149;
  background: #fff;
  border: 1px solid #dce2ec;
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

textarea {
  min-height: 180px;
  margin-top: 10px;
  padding: 15px 16px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.7;
}

#replacementText {
  min-height: 48px;
  padding: 11px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

textarea:focus,
#replacementText:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(49, 94, 251, 0.1);
}

textarea::placeholder,
input::placeholder {
  color: #a0a8b6;
}

.workspace-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 11px;
  margin-top: 19px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 19px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 680;
  transition: background 0.18s ease, border-color 0.18s ease,
    color 0.18s ease, transform 0.18s ease;
}

.button:active {
  transform: translateY(1px);
}

.button-primary {
  color: #fff;
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.button-primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

.button-secondary {
  color: #35435b;
  background: #fff;
  border-color: #dce2ec;
}

.button-secondary:hover {
  color: var(--color-primary);
  background: #f7f8ff;
  border-color: #bdcaff;
}

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

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 83px;
  padding: 14px 16px;
  background: #f8f9fc;
  border: 1px solid #edf0f5;
  border-radius: var(--radius-md);
}

.stat-label {
  color: #7a8598;
  font-size: 12px;
}

.stat-value {
  color: #202d43;
  font-size: 21px;
  font-weight: 750;
  letter-spacing: -0.5px;
}

.result-section {
  margin-top: 25px;
}

.result-section-heading {
  margin-bottom: 11px;
}

.result-section-heading h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.text-button {
  padding: 5px 0;
  color: var(--color-primary);
  background: transparent;
  border: 0;
  font-size: 12px;
  font-weight: 680;
}

.text-button:hover {
  color: var(--color-primary-hover);
  text-decoration: underline;
}

.highlight-output,
.replacement-output {
  min-height: 95px;
  margin: 0;
  padding: 15px 16px;
  overflow-wrap: anywhere;
  color: #354158;
  background: #f8f9fc;
  border: 1px solid #edf0f5;
  border-radius: var(--radius-md);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.8;
  white-space: pre-wrap;
}

.highlight-output mark {
  padding: 2px 1px;
  color: #173c91;
  background: #dce8ff;
  border-radius: 3px;
}

.empty-state {
  margin: 0;
  padding: 15px;
  color: #8a94a5;
  background: #f8f9fc;
  border: 1px dashed #dce2ec;
  border-radius: var(--radius-md);
  font-size: 13px;
}

.match-list,
.capture-list {
  display: grid;
  gap: 9px;
}

.match-item,
.capture-item {
  min-width: 0;
  padding: 13px 15px;
  background: #f8f9fc;
  border: 1px solid #edf0f5;
  border-radius: var(--radius-md);
}

.match-item-header,
.capture-item-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}

.match-index,
.capture-name {
  color: #35435b;
  font-size: 12px;
  font-weight: 700;
}

.match-position {
  color: #8993a4;
  font-size: 11px;
}

.match-value,
.capture-value {
  display: block;
  overflow-wrap: anywhere;
  color: #26344d;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  white-space: pre-wrap;
}

.replacement-output {
  min-height: 100px;
}

.privacy-note {
  margin: 20px 0 0;
  padding: 14px 17px;
  color: #647087;
  background: #f0f4fa;
  border-radius: var(--radius-md);
  font-size: 12px;
  line-height: 1.7;
}

.privacy-note strong {
  color: #35435b;
}

.content-section {
  padding-top: 40px;
  padding-bottom: 48px;
  border-top: 1px solid var(--color-border);
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 45px;
}

.content-section h2 {
  margin-bottom: 13px;
}

.content-section p:not(.eyebrow) {
  color: var(--color-muted);
  font-size: 14px;
  line-height: 1.85;
}

.feature-list {
  display: grid;
  gap: 9px;
  margin: 15px 0 0;
  padding-left: 19px;
  color: #5e6a7f;
  font-size: 13px;
}

.feature-list code {
  padding: 2px 5px;
  color: #244bd6;
  background: #eff3ff;
  border-radius: 4px;
  font-size: 12px;
}

.faq-section {
  padding-top: 10px;
  padding-bottom: 65px;
}

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

.faq-list {
  display: grid;
  gap: 10px;
}

.faq-list details {
  padding: 16px 19px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.faq-list summary {
  color: #263248;
  font-size: 14px;
  font-weight: 680;
  cursor: pointer;
}

.faq-list details p {
  margin: 12px 0 0;
  color: var(--color-muted);
  font-size: 13px;
  line-height: 1.8;
}

.related-section {
  background: #eef2f8;
  border-top: 1px solid #e4e9f1;
}

.related-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding-top: 33px;
  padding-bottom: 33px;
}

.related-inner h2 {
  font-size: 20px;
}

.related-inner p:not(.eyebrow) {
  margin: 7px 0 0;
  color: var(--color-muted);
  font-size: 13px;
}

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

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  min-height: 76px;
}

.footer-inner > span {
  color: #8993a4;
  font-size: 12px;
}

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

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

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 44px));
  padding: 11px 16px;
  color: #fff;
  background: #202d43;
  border-radius: 9px;
  box-shadow: 0 8px 25px rgba(15, 25, 45, 0.18);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

[hidden] {
  display: none !important;
}

button:focus-visible,
a:focus-visible,
summary:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(49, 94, 251, 0.25);
  outline-offset: 2px;
}

@media (max-width: 760px) {
  .container {
    width: min(100% - 32px, 600px);
  }

  .header-inner {
    min-height: 64px;
  }

  .brand {
    font-size: 17px;
  }

  .top-nav {
    gap: 16px;
  }

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

  .page-intro {
    padding-top: 42px;
    padding-bottom: 27px;
  }

  .page-intro h1 {
    font-size: 36px;
  }

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

  .workspace-panel,
  .results-panel,
  .replacement-panel {
    padding: 21px;
    border-radius: 14px;
  }

  .section-heading h2,
  .content-section h2,
  .faq-section h2 {
    font-size: 20px;
  }

  .content-grid {
    grid-template-columns: 1fr;
    gap: 27px;
  }

  .related-inner {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .container {
    width: calc(100% - 26px);
  }

  .header-inner {
    gap: 12px;
  }

  .brand {
    font-size: 15px;
  }

  .top-nav {
    gap: 12px;
  }

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

  .page-intro h1 {
    font-size: 32px;
  }

  .trust-points {
    gap: 8px 15px;
  }

  .workspace-panel,
  .results-panel,
  .replacement-panel {
    padding: 16px;
  }

  .section-heading {
    align-items: flex-start;
    gap: 10px;
  }

  .tool-label {
    font-size: 10px;
  }

  .flags-list {
    gap: 7px;
  }

  .flag-option {
    gap: 5px;
    padding: 5px 8px;
  }

  .flag-option small {
    font-size: 10px;
  }

  .examples-row {
    gap: 7px;
  }

  .examples-label {
    width: 100%;
  }

  .field-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .stats-grid {
    gap: 7px;
  }

  .stat-card {
    min-height: 72px;
    padding: 10px;
  }

  .stat-value {
    font-size: 18px;
  }

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

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

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

/* Baiming Service unified visual system */
:root {
  --color-text: #111827;
  --color-muted: #6b7280;
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-border: #e5e7eb;
  --color-surface: #ffffff;
  --color-background: #ffffff;
  --color-soft: #f9fafb;
  --shadow-panel: none;
}

body {
  background: #ffffff;
  color: #111827;
}

.container {
  width: min(1120px, calc(100% - 40px));
}

.site-header {
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
}

.header-inner {
  min-height: 72px;
}

.brand {
  display: inline-flex;
  align-items: center;
}

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

.top-nav {
  margin-left: auto;
  gap: 24px;
}

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

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

.page-intro {
  padding-top: 56px;
  padding-bottom: 28px;
}

.page-intro h1 {
  letter-spacing: -1.5px;
}

.intro-description {
  max-width: 760px;
  color: #4b5563;
  font-size: 17px;
}

.trust-points {
  gap: 8px 22px;
}

.trust-points li {
  color: #4b5563;
}

.workspace-panel,
.results-panel,
.replacement-panel {
  background: #ffffff;
  border-color: #e5e7eb;
  border-radius: 14px;
  box-shadow: none;
}

.tool-label {
  color: #4b5563;
  background: #f3f4f6;
}

.result-status {
  color: #15803d;
  background: #f0fdf4;
}

.pattern-input-wrap,
textarea,
#replacementText {
  border-color: #d1d5db;
}

.stat-card,
.highlight-output,
.replacement-output,
.match-item,
.capture-item,
.empty-state {
  background: #f9fafb;
  border-color: #e5e7eb;
}

.privacy-note {
  max-width: 860px;
  margin: 18px 0 0;
  color: #365744;
  background: #f0fdf4;
  border: 1px solid #dcfce7;
  border-radius: 11px;
}

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

/* Instructions, FAQ and privacy share the same left alignment */
.content-section {
  padding-top: 10px;
  padding-bottom: 42px;
  border-top: 1px solid #e5e7eb;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 860px);
  gap: 24px;
  max-width: 860px;
}

.content-section article {
  min-width: 0;
}

.content-section h2,
.faq-section h2 {
  font-size: 19px;
  letter-spacing: -0.3px;
}

.content-section p:not(.eyebrow) {
  color: #4b5563;
}

.feature-list {
  color: #4b5563;
}

.faq-section {
  max-width: 1120px;
  margin-left: auto;
  margin-right: auto;
  padding-top: 10px;
  padding-bottom: 55px;
}

.faq-list {
  max-width: 860px;
  gap: 0;
}

.faq-list details {
  padding: 14px 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #e5e7eb;
  border-radius: 0;
}

.faq-list summary {
  color: #111827;
}

.faq-list details p {
  color: #4b5563;
}

.related-section {
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
}

.related-inner {
  padding-top: 30px;
  padding-bottom: 30px;
}

.related-inner h2 {
  font-size: 20px;
}

.site-footer {
  padding: 12px 0;
  background: #ffffff;
  border-top: 0;
}

.footer-inner {
  min-height: 64px;
}

@media (max-width: 760px) {
  .container {
    width: calc(100% - 32px);
  }

  .header-inner {
    min-height: 0;
    padding-top: 12px;
    padding-bottom: 12px;
    flex-wrap: wrap;
    gap: 10px 18px;
  }

  .brand-logo {
    width: 155px;
  }

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

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

  .page-intro {
    padding-top: 40px;
    padding-bottom: 24px;
  }

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

  .content-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }

  .faq-section {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .container {
    width: calc(100% - 28px);
  }

  .brand-logo {
    width: 145px;
  }

  .top-nav {
    gap: 16px;
  }

  .page-intro h1 {
    font-size: 34px;
  }

  .workspace-panel,
  .results-panel,
  .replacement-panel {
    padding: 16px;
  }

  .footer-inner {
    align-items: flex-start;
  }
}
