:root {
  --bg: #fff;
  --bg-alt: #f5f5f7;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --accent: #0066cc;
  --accent-hover: #0077ed;
  --teal: #008c95;
  --green: #1a7f37;
  --green-dot: #30b455;
  --orange: #b54708;
  --red: #c62828;
  --border: #d2d2d7;
  --hairline: rgba(0, 0, 0, .08);
  --shadow: 0 24px 70px rgba(0, 0, 0, .075);
  --shadow-hover: 0 18px 44px rgba(0, 0, 0, .09);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
code { font-family: var(--mono); }
::selection { background: rgba(0, 102, 204, .16); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

.nav {
  position: fixed;
  z-index: 100;
  inset: 0 0 auto;
  height: 52px;
  background: rgba(255,255,255,.72);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s ease, box-shadow .25s ease;
}
.nav.scrolled { border-bottom-color: var(--hairline); box-shadow: 0 1px 12px rgba(0,0,0,.04); }
.nav-inner { height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand-mark { width: 24px; height: 24px; flex: none; }
.brand-name { font-size: 14px; font-weight: 600; letter-spacing: -.01em; }
.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a { color: var(--text-2); font-size: 13px; transition: color .2s ease; }
.nav-links a:hover { color: var(--text); }
.nav-cta { padding: 6px 14px; border-radius: 999px; color: var(--accent) !important; background: rgba(0,102,204,.08); font-weight: 500; }
.nav-cta:hover { background: rgba(0,102,204,.14); }

.hero { position: relative; overflow: hidden; padding: 142px 0 100px; }
.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(1100px 540px at 50% -8%, rgba(0,102,204,.08), transparent 62%),
    linear-gradient(to right, rgba(29,29,31,.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(29,29,31,.035) 1px, transparent 1px);
  background-size: auto, 54px 54px, 54px 54px;
  mask-image: linear-gradient(to bottom, #000 30%, transparent 94%);
}
.hero-inner { position: relative; text-align: center; }
.eyebrow-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: rgba(255,255,255,.78);
  backdrop-filter: blur(8px);
  color: var(--text-2);
  font: 500 11px/1.4 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.status-dot, .mini-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green-dot); flex: none; }
.status-dot.connected, .mini-dot.connected { animation: ripple 2.2s ease-out infinite; }
.status-dot.connecting, .mini-dot.connecting { background: #f5a623; animation: pulse 1.1s ease-in-out infinite; }
.status-dot.error, .mini-dot.error { background: var(--red); }
@keyframes ripple { from { box-shadow: 0 0 0 0 rgba(48,180,85,.45); } to { box-shadow: 0 0 0 9px rgba(48,180,85,0); } }
@keyframes pulse { 50% { opacity: .35; transform: scale(.75); } }

.hero h1 { margin-top: 27px; font-size: clamp(2.8rem, 7vw, 4.65rem); line-height: 1.04; letter-spacing: -.03em; }
.hero-sub { margin: 18px auto 0; max-width: 720px; font-size: clamp(1.18rem, 2.6vw, 1.55rem); line-height: 1.38; font-weight: 600; letter-spacing: -.012em; }
.hero-copy { margin: 16px auto 0; max-width: 710px; color: var(--text-2); font-size: 1.04rem; }
.hero-copy code { color: var(--accent); font-size: .92em; }

.converter-shell {
  margin: 58px auto 0;
  max-width: 1040px;
  overflow: hidden;
  text-align: left;
  border: 1px solid rgba(0,0,0,.075);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,.96);
  box-shadow: var(--shadow);
}
.shell-head { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 24px 28px; border-bottom: 1px solid var(--hairline); background: #fbfbfd; }
.shell-kicker { color: var(--accent); font: 600 11px/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.shell-head h2 { margin-top: 3px; font-size: 1.35rem; letter-spacing: -.015em; }
.connection-state { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font: 500 12px/1 var(--mono); }

.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 46px minmax(0, 1fr); padding: 0 28px; }
.editor-panel { min-width: 0; padding: 26px 0 22px; }
.editor-head { display: flex; min-height: 34px; align-items: center; justify-content: space-between; gap: 14px; }
.editor-head > div { display: flex; align-items: center; gap: 10px; }
.editor-head strong { font-size: .95rem; }
.language-tag { display: inline-flex; padding: 4px 8px; border-radius: 7px; font-size: 12px; font-weight: 650; line-height: 1; }
.tag-traditional { background: rgba(118,57,177,.1); color: #7639b1; }
.tag-simplified { background: rgba(0,140,149,.1); color: var(--teal); }
.char-count { color: var(--text-3); font: 11px/1 var(--mono); }
textarea {
  width: 100%;
  height: 220px;
  margin-top: 16px;
  resize: vertical;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 18px;
  background: var(--bg-alt);
  color: var(--text);
  font-family: var(--font);
  font-size: clamp(1.15rem, 2vw, 1.35rem);
  line-height: 1.7;
  transition: background .2s ease, box-shadow .2s ease;
}
textarea:focus { outline: 0; background: #fff; box-shadow: inset 0 0 0 2px var(--accent), 0 8px 24px rgba(0,102,204,.07); }
textarea::placeholder { color: #aaaab0; }
.sample-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; color: var(--text-3); font-size: 12px; }
.sample-btn { border: 1px solid var(--hairline); border-radius: 999px; padding: 4px 10px; background: #fff; color: var(--text-2); font-size: 12px; transition: all .2s ease; }
.sample-btn:hover { border-color: rgba(0,102,204,.3); color: var(--accent); background: rgba(0,102,204,.04); }

.flow-divider { display: flex; align-items: center; justify-content: center; }
.flow-divider span { display: none; }
.flow-divider svg { width: 22px; height: 22px; fill: none; stroke: var(--accent); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.output-text {
  height: 220px;
  margin-top: 16px;
  overflow: auto;
  border-radius: var(--radius-sm);
  padding: 18px;
  background: linear-gradient(145deg, #f4f9ff, #f5f5f7 58%);
  color: var(--text);
  font-size: clamp(1.15rem, 2vw, 1.35rem);
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.output-text.empty { display: grid; place-items: center; color: var(--text-3); font-size: .9rem; text-align: center; }
.output-text.loading { display: grid; place-items: center; color: var(--accent); font-size: .92rem; }
.copy-btn { border: 0; border-radius: 999px; padding: 6px 12px; color: var(--accent); background: rgba(0,102,204,.08); font-size: 12px; font-weight: 600; transition: all .2s ease; }
.copy-btn:hover:not(:disabled) { background: rgba(0,102,204,.15); }
.copy-btn:disabled { opacity: .4; cursor: not-allowed; }
.copy-btn.copied { color: var(--green); background: rgba(26,127,55,.1); }
.result-meta { min-height: 28px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; color: var(--text-3); font: 11px/1.3 var(--mono); }
.meta-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 999px; background: var(--bg-alt); }
.meta-chip.success { color: var(--green); background: rgba(26,127,55,.08); }
.meta-placeholder { padding: 4px 0; }

.action-row { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 20px 28px; border-top: 1px solid var(--hairline); background: #fbfbfd; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 44px; border-radius: 999px; padding: 10px 22px; border: 0; font-weight: 600; font-size: .92rem; transition: transform .2s var(--ease), background .2s ease, opacity .2s ease, box-shadow .2s ease; }
.btn-primary { min-width: 180px; color: #fff; background: var(--accent); }
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); background: var(--accent-hover); box-shadow: 0 8px 22px rgba(0,102,204,.25); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.btn-secondary { background: transparent; color: var(--text-2); }
.btn-secondary:hover { background: rgba(0,0,0,.045); color: var(--text); }
.spinner { display: none; width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.btn.busy .spinner { display: inline-block; }
.btn.busy svg { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.notice { margin: 0 28px 24px; padding: 12px 14px; border-radius: 10px; font-size: 13px; }
.notice.error { color: var(--red); background: rgba(198,40,40,.075); border: 1px solid rgba(198,40,40,.12); }
.notice.info { color: var(--orange); background: rgba(181,71,8,.07); border: 1px solid rgba(181,71,8,.12); }

.section { padding: 104px 0; }
.section-gray { background: var(--bg-alt); }
.section-head { max-width: 720px; margin-bottom: 44px; }
.eyebrow { color: var(--accent); font: 600 12px/1.4 var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.section-head h2 { margin-top: 10px; font-size: clamp(2rem, 4vw, 3rem); line-height: 1.12; letter-spacing: -.025em; }
.section-head p:last-child { margin-top: 14px; color: var(--text-2); }
.workflow-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.workflow-card { position: relative; min-height: 256px; padding: 26px; border: 1px solid rgba(0,0,0,.065); border-radius: var(--radius-md); background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.03); transition: transform .3s var(--ease), box-shadow .3s ease; }
.workflow-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.step-num { position: absolute; top: 24px; right: 24px; color: #b6b6bb; font: 500 12px/1 var(--mono); }
.step-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; font-weight: 700; }
.step-icon.blue { color: var(--accent); background: rgba(0,102,204,.09); }
.step-icon.teal { color: var(--teal); background: rgba(0,140,149,.09); }
.step-icon.green { color: var(--green); background: rgba(26,127,55,.09); }
.step-icon svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.workflow-card h3 { margin-top: 24px; font-size: 1.12rem; letter-spacing: -.012em; }
.workflow-card p { margin-top: 8px; color: var(--text-2); font-size: .94rem; }
.workflow-card code { color: var(--accent); font-size: .88em; }
.contract-card { margin-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 24px 26px; border: 1px solid rgba(0,0,0,.065); border-radius: var(--radius-md); background: #fff; }
.contract-copy { display: flex; align-items: center; gap: 14px; }
.contract-copy h3 { font-size: 1rem; }
.contract-copy p { color: var(--text-2); font-size: .88rem; }
.proto-badge { display: inline-flex; padding: 5px 8px; border-radius: 7px; color: #7639b1; background: rgba(118,57,177,.1); font: 700 11px/1 var(--mono); }
.contract-card > code { overflow: hidden; color: var(--text-2); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

.footer { padding: 34px 0; border-top: 1px solid var(--hairline); background: #fff; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 28px; }
.footer-copy { display: flex; flex-direction: column; align-items: flex-end; color: var(--text-3); font-size: 12px; line-height: 1.6; }

@media (max-width: 820px) {
  .nav-links > a:not(.nav-cta) { display: none; }
  .hero { padding-top: 118px; }
  .editor-grid { grid-template-columns: 1fr; padding: 0 20px; }
  .flow-divider { height: 40px; }
  .flow-divider svg { transform: rotate(90deg); }
  .workflow-grid { grid-template-columns: 1fr; }
  .workflow-card { min-height: 220px; }
  .contract-card { align-items: flex-start; flex-direction: column; }
  .contract-card > code { max-width: 100%; }
  .footer-inner, .footer-copy { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 540px) {
  .container { padding: 0 16px; }
  .nav-cta { display: none; }
  .hero { padding: 102px 0 76px; }
  .hero h1 { font-size: 2.55rem; }
  .eyebrow-chip { max-width: 100%; font-size: 9.5px; }
  .converter-shell { margin-top: 42px; border-radius: 19px; }
  .shell-head { align-items: flex-start; flex-direction: column; padding: 20px; }
  .editor-grid { padding: 0 16px; }
  textarea, .output-text { height: 190px; }
  .action-row { padding: 16px; }
  .btn-primary { flex: 1; min-width: 0; }
  .notice { margin: 0 16px 18px; }
  .section { padding: 78px 0; }
}

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