:root {
  color-scheme: light;
  --bg: #f4f6f5;
  --paper: #ffffff;
  --paper-soft: #f8faf9;
  --ink: #151817;
  --muted: #66706b;
  --line: #dfe5e2;
  --line-dark: #cbd3cf;
  --green: #2c9a68;
  --green-dark: #166344;
  --green-pale: #e7f6ee;
  --green-light: #bce9d2;
  --amber: #9b6a18;
  --amber-pale: #fff7e7;
  --red: #b8424c;
  --red-pale: #fff0f1;
  --shadow: 0 18px 55px rgba(26, 43, 35, .08);
  font-family: Inter, "Segoe UI", ui-sans-serif, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { min-width: 320px; margin: 0; background: linear-gradient(180deg, #fbfcfb 0, var(--bg) 520px); }
button, input, textarea { font: inherit; }
button, a, .file-drop { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.site-header { position: sticky; z-index: 20; top: 0; height: 74px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(24px, calc((100vw - 1240px) / 2)); border-bottom: 1px solid rgba(211, 219, 215, .9); background: rgba(255, 255, 255, .9); backdrop-filter: blur(18px); }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; color: white; background: var(--ink); font-size: .86rem; font-weight: 850; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: .88rem; letter-spacing: .12em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: .65rem; }
.header-actions { display: flex; align-items: center; gap: 18px; }
.header-actions > a { color: var(--muted); font-size: .73rem; font-weight: 700; text-decoration: none; }
.header-actions > a:hover { color: var(--green-dark); }
.service-status { display: flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--paper); font-size: .66rem; font-weight: 750; }
.service-status i, .key-pill i { width: 7px; height: 7px; border-radius: 50%; background: #b4bcb8; }
.service-status.online { color: var(--green-dark); }
.service-status.online i, .key-pill.ready i { background: var(--green); box-shadow: 0 0 0 4px rgba(44, 154, 104, .1); }
.service-status.offline { color: var(--red); }
.service-status.offline i { background: var(--red); }

main { width: min(1240px, calc(100% - 48px)); margin: 0 auto; }
.intro { display: grid; grid-template-columns: minmax(0, 1.22fr) minmax(340px, .78fr); align-items: center; gap: 84px; min-height: 440px; padding: 70px 0 60px; }
.overline, .card-label { color: var(--green-dark); font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .64rem; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.intro h1 { max-width: 720px; margin: 15px 0 20px; font-size: clamp(2.7rem, 5.3vw, 5.3rem); font-weight: 650; line-height: .97; letter-spacing: -.06em; }
.intro-copy > p { max-width: 670px; margin: 0; color: var(--muted); font-size: 1rem; line-height: 1.72; }
.intro-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; padding: 0 17px; border: 1px solid transparent; border-radius: 10px; cursor: pointer; font-size: .72rem; font-weight: 800; text-decoration: none; transition: transform .18s, border-color .18s, background .18s, opacity .18s; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button.primary { color: white; background: var(--ink); box-shadow: 0 9px 24px rgba(20, 25, 22, .12); }
.button.primary:hover:not(:disabled) { background: var(--green-dark); }
.button.quiet { border-color: var(--line); color: var(--ink); background: var(--paper); }
.button.quiet:hover:not(:disabled) { border-color: var(--green-light); background: var(--green-pale); }
.button.small { min-height: 36px; padding: 0 12px; font-size: .64rem; }

.quick-start { padding: 27px; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); box-shadow: var(--shadow); }
.quick-start ol { display: grid; gap: 0; margin: 18px 0 0; padding: 0; list-style: none; }
.quick-start li { position: relative; display: grid; grid-template-columns: 34px 1fr; gap: 12px; min-height: 77px; }
.quick-start li:not(:last-child)::after { position: absolute; left: 16px; top: 35px; bottom: 4px; width: 1px; background: var(--line); content: ""; }
.quick-start li > b { position: relative; z-index: 1; width: 33px; height: 33px; display: grid; place-items: center; border: 1px solid var(--green-light); border-radius: 50%; color: var(--green-dark); background: var(--green-pale); font-size: .67rem; }
.quick-start strong, .quick-start small { display: block; }
.quick-start strong { padding-top: 2px; font-size: .8rem; }
.quick-start small { margin-top: 5px; color: var(--muted); font-size: .67rem; line-height: 1.45; }

.pipeline-section { padding: 28px 0 60px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 40px; margin-bottom: 24px; }
.section-heading h2 { margin: 8px 0 0; font-size: clamp(1.65rem, 3vw, 2.55rem); letter-spacing: -.035em; }
.section-heading > p { max-width: 570px; margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.65; }
.compact-heading { align-items: center; }
.pipeline { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr auto 1fr; align-items: stretch; padding: 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); }
.pipeline > div { display: flex; align-items: center; gap: 11px; min-height: 82px; padding: 15px; border-radius: 12px; background: var(--paper-soft); }
.pipeline > div > b { flex: 0 0 auto; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; color: var(--green-dark); background: var(--green-pale); font-size: .56rem; }
.pipeline strong, .pipeline small { display: block; }
.pipeline strong { font-size: .7rem; }
.pipeline small { margin-top: 4px; color: var(--muted); font-size: .58rem; line-height: 1.35; }
.pipeline > i { align-self: center; padding: 0 7px; color: #a7b0ac; font-style: normal; }

.tester-section { scroll-margin-top: 90px; padding: 66px 0 76px; border-top: 1px solid var(--line); }
.api-access { display: grid; grid-template-columns: minmax(220px, .75fr) minmax(320px, 1.4fr) auto; align-items: center; gap: 18px; padding: 17px; border: 1px solid var(--green-light); border-radius: 16px; background: var(--green-pale); }
.access-title, .access-title > span:last-child { display: flex; align-items: center; gap: 11px; }
.access-title > span:last-child { display: block; }
.access-title strong, .access-title small { display: block; }
.access-title strong { font-size: .76rem; }
.access-title small { margin-top: 3px; color: var(--green-dark); font-size: .62rem; opacity: .8; }
.lock-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; color: var(--green-dark); background: rgba(255, 255, 255, .7); }
.key-input { position: relative; }
.key-input input { width: 100%; height: 44px; padding: 0 64px 0 13px; border: 1px solid #b8d8c8; border-radius: 9px; outline: none; color: var(--ink); background: var(--paper); font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .7rem; }
.key-input input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(44, 154, 104, .1); }
.key-input button { position: absolute; top: 5px; right: 5px; height: 34px; padding: 0 10px; border: 0; border-radius: 7px; cursor: pointer; color: var(--muted); background: var(--paper-soft); font-size: .61rem; font-weight: 750; }
.key-pill { display: flex; align-items: center; gap: 8px; min-width: 117px; color: var(--muted); font-size: .64rem; font-weight: 750; }
.key-pill.ready { color: var(--green-dark); }

.current-box { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 13px; padding: 13px 16px; border: 1px solid var(--green-light); border-radius: 13px; background: var(--paper); }
.current-box > div { display: flex; align-items: center; gap: 10px; }
.current-box strong, .current-box small { display: block; }
.current-box strong { font-size: .72rem; }
.current-box small { max-width: 520px; margin-top: 2px; overflow: hidden; color: var(--muted); font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .61rem; text-overflow: ellipsis; }
.success-icon { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 50%; color: var(--green-dark); background: var(--green-pale); font-weight: 900; }
.text-button { padding: 7px 9px; border: 0; border-radius: 7px; cursor: pointer; color: var(--muted); background: transparent; font-size: .61rem; font-weight: 750; }
.text-button:hover { color: var(--green-dark); background: var(--green-pale); }

.workflow-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 22px; }
.workflow-tab { display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; color: var(--muted); background: rgba(255, 255, 255, .5); text-align: left; transition: border-color .18s, color .18s, background .18s; }
.workflow-tab > b { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; color: var(--muted); background: #edf0ee; font-size: .6rem; }
.workflow-tab strong, .workflow-tab small { display: block; }
.workflow-tab > span { color: var(--ink); font-size: .7rem; font-weight: 800; }
.workflow-tab small { margin-top: 3px; color: var(--muted); font-size: .57rem; font-weight: 500; }
.workflow-tab.active { border-color: var(--ink); background: var(--paper); box-shadow: 0 8px 24px rgba(30, 44, 37, .06); }
.workflow-tab.active > b { color: white; background: var(--ink); }

.tester-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(390px, .9fr); gap: 18px; margin-top: 12px; align-items: start; }
.form-card, .result-card { border: 1px solid var(--line); border-radius: 18px; background: var(--paper); box-shadow: 0 12px 40px rgba(26, 43, 35, .05); }
.form-card { min-height: 600px; padding: 27px; }
.workflow-panel:not(.active) { display: none; }
.panel-title { display: flex; align-items: start; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.panel-title h3, .result-heading h3, .learn-card h3 { margin: 7px 0 5px; font-size: 1.25rem; letter-spacing: -.02em; }
.panel-title p { max-width: 510px; margin: 0; color: var(--muted); font-size: .7rem; line-height: 1.5; }
.panel-title > code { flex: 0 0 auto; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); background: var(--paper-soft); font-size: .53rem; }
form { display: grid; gap: 15px; }
.field { display: grid; gap: 7px; }
.field > span { font-size: .68rem; font-weight: 800; }
.field > small { color: var(--muted); font-size: .6rem; line-height: 1.4; }
.field input, .field textarea { width: 100%; border: 1px solid var(--line-dark); border-radius: 9px; outline: none; color: var(--ink); background: var(--paper); }
.field input { height: 44px; padding: 0 12px; }
.field textarea { min-height: 110px; padding: 11px; resize: vertical; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .58rem; line-height: 1.5; }
.field input:focus, .field textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(44, 154, 104, .08); }
.key-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper-soft); }
.key-summary > div { display: flex; align-items: center; gap: 10px; }
.key-summary strong, .key-summary small { display: block; }
.key-summary strong { font-size: .68rem; }
.key-summary small { margin-top: 3px; color: var(--muted); font-size: .58rem; }
.key-symbol { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 8px; color: var(--green-dark); background: var(--green-pale); font-size: .66rem; font-weight: 900; }
.mini-badge { padding: 5px 8px; border-radius: 999px; color: var(--amber); background: var(--amber-pale); font-size: .52rem; font-weight: 800; text-transform: uppercase; }
.mini-badge.ready { color: var(--green-dark); background: var(--green-pale); }
.mini-badge.error { color: var(--red); background: var(--red-pale); }
.advanced-key { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.advanced-key summary { padding: 12px 13px; cursor: pointer; color: var(--muted); font-size: .63rem; font-weight: 750; }
.details-body { display: grid; gap: 11px; padding: 0 13px 13px; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }
.note { margin: 0; color: var(--muted); font-size: .59rem; line-height: 1.45; }

.file-drop { position: relative; min-height: 88px; display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px dashed #bdc8c2; border-radius: 11px; cursor: pointer; background: #fbfcfb; transition: border-color .18s, background .18s; }
.file-drop:hover, .file-drop.has-file { border-color: var(--green); background: var(--green-pale); }
.file-drop input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.file-icon, .pose-code { flex: 0 0 auto; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 9px; color: var(--green-dark); background: var(--green-pale); font-weight: 850; }
.file-drop strong, .file-drop small { display: block; }
.file-drop strong { font-size: .68rem; }
.file-drop small { max-width: 420px; margin-top: 4px; overflow: hidden; color: var(--muted); font-size: .58rem; text-overflow: ellipsis; white-space: nowrap; }
.choose-file { margin-left: auto; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); background: white; font-size: .56rem; font-weight: 750; }
.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.file-drop.compact { min-height: 75px; padding: 11px; }
.pose-code { width: 34px; height: 34px; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .61rem; }
.plain-note, .warning-note { padding: 10px 12px; border-radius: 9px; color: var(--muted); background: var(--paper-soft); font-size: .61rem; line-height: 1.5; }
.plain-note b { color: var(--green-dark); }
.warning-note { color: #775623; background: var(--amber-pale); }
.submit-button { width: 100%; justify-content: space-between; min-height: 48px; padding: 0 16px; }
.submit-button > span { font-size: 1rem; }
.decision { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; padding: 11px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); font-size: .59rem; }
.decision span, .decision strong { padding: 6px 8px; border-radius: 6px; background: var(--paper-soft); }
.decision strong { color: var(--green-dark); background: var(--green-pale); }
.decision i { font-style: normal; }

.result-card { position: sticky; top: 90px; padding: 22px; }
.result-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.result-heading > div:last-child { display: flex; gap: 4px; }
.result-state { display: flex; align-items: center; gap: 10px; margin-top: 15px; padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper-soft); }
.result-state > i { width: 9px; height: 9px; border-radius: 50%; background: #b3bbb7; }
.result-state strong, .result-state small { display: block; }
.result-state strong { font-size: .67rem; }
.result-state small { margin-top: 2px; color: var(--muted); font-size: .56rem; }
.result-state.loading > i { background: var(--amber); animation: pulse 1s infinite; }
.result-state.success > i { background: var(--green); box-shadow: 0 0 0 4px rgba(44, 154, 104, .1); }
.result-state.error > i { background: var(--red); }
@keyframes pulse { 50% { opacity: .35; } }
.result-summary { min-height: 71px; margin-top: 10px; padding: 12px; border-left: 3px solid var(--green-light); color: var(--muted); background: #fbfcfb; font-size: .66rem; line-height: 1.55; }
.result-summary strong { color: var(--ink); }
.json-box { margin-top: 11px; overflow: hidden; border: 1px solid #252a28; border-radius: 11px; background: #171b19; }
.json-box > div { height: 36px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 12px; border-bottom: 1px solid #2d3330; color: #95a09a; font-size: .53rem; }
.json-box > div > span { color: var(--green-light); font-weight: 800; }
.json-box code { max-width: 75%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
pre { min-height: 285px; max-height: 470px; margin: 0; overflow: auto; padding: 14px; color: #d6ded9; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .58rem; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }

.learn-section { scroll-margin-top: 90px; padding: 72px 0 82px; border-top: 1px solid var(--line); }
.learn-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 14px; }
.learn-card { padding: 24px; border: 1px solid var(--line); border-radius: 17px; background: var(--paper); }
.learn-card h3 { margin-bottom: 18px; }
.path-list { display: grid; gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--line); }
.path-list > div { display: grid; grid-template-columns: minmax(270px, .85fr) 1fr; gap: 16px; padding: 11px 12px; background: var(--paper-soft); }
.path-list code { overflow: hidden; color: var(--ink); font-size: .56rem; text-overflow: ellipsis; }
.path-list span { color: var(--muted); font-size: .59rem; }
.card-footnote { margin: 14px 0 0; color: var(--muted); font-size: .61rem; line-height: 1.5; }
.saved-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.saved-list > div { display: grid; gap: 7px; padding: 14px; border-radius: 10px; }
.saved-list .yes { background: var(--green-pale); }
.saved-list .no { background: var(--paper-soft); }
.saved-list b { margin-bottom: 3px; font-size: .66rem; }
.saved-list span { position: relative; padding-left: 13px; color: var(--muted); font-size: .59rem; }
.saved-list span::before { position: absolute; left: 0; content: "•"; color: var(--green); }
.ckks-card ol { display: grid; gap: 11px; margin: 0; padding: 0; list-style: none; }
.ckks-card li { display: grid; grid-template-columns: 27px 1fr; align-items: start; gap: 9px; color: var(--muted); font-size: .64rem; line-height: 1.5; }
.ckks-card li b { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 7px; color: var(--green-dark); background: var(--green-pale); font-size: .55rem; }
.route-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.route-flow span { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper-soft); font-size: .6rem; font-weight: 750; }
.route-flow i { color: var(--muted); font-size: .52rem; font-style: normal; }
.security-warning { margin-top: 18px; padding: 13px; border-radius: 10px; background: var(--amber-pale); }
.security-warning strong { color: #76541d; font-size: .64rem; }
.security-warning p { margin: 5px 0 0; color: #826735; font-size: .59rem; line-height: 1.5; }

.site-footer { width: min(1240px, calc(100% - 48px)); display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 0 auto; padding: 26px 0 40px; border-top: 1px solid var(--line); color: var(--muted); }
.site-footer span { color: var(--ink); font-size: .7rem; font-weight: 900; letter-spacing: .12em; }
.site-footer p { margin: 0; font-size: .59rem; text-align: right; }
.toast { position: fixed; z-index: 30; right: 22px; bottom: 22px; max-width: 360px; padding: 12px 15px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--paper); box-shadow: var(--shadow); font-size: .65rem; opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: none; }

@media (max-width: 1020px) {
  .intro { grid-template-columns: 1fr; gap: 36px; }
  .quick-start { max-width: 680px; }
  .pipeline { grid-template-columns: 1fr; gap: 5px; }
  .pipeline > i { justify-self: center; transform: rotate(90deg); }
  .workflow-tabs { grid-template-columns: 1fr 1fr; }
  .tester-grid { grid-template-columns: 1fr; }
  .result-card { position: static; }
}

@media (max-width: 700px) {
  .site-header { height: 66px; padding: 0 16px; }
  .header-actions > a { display: none; }
  main, .site-footer { width: min(100% - 24px, 620px); }
  .intro { min-height: auto; padding: 52px 0; }
  .intro h1 { font-size: clamp(2.55rem, 13vw, 4rem); }
  .section-heading { display: grid; gap: 12px; }
  .api-access { grid-template-columns: 1fr; }
  .current-box { align-items: start; flex-direction: column; }
  .workflow-tabs { display: flex; overflow-x: auto; padding-bottom: 3px; }
  .workflow-tab { flex: 0 0 168px; }
  .form-card, .result-card { padding: 18px; border-radius: 14px; }
  .panel-title { display: grid; }
  .panel-title > code { justify-self: start; }
  .upload-grid, .learn-grid, .saved-list { grid-template-columns: 1fr; }
  .path-list > div { grid-template-columns: 1fr; gap: 5px; }
  .choose-file { display: none; }
  .site-footer { align-items: start; flex-direction: column; }
  .site-footer p { text-align: left; }
}

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