:root {
  --bg: #f7f7fb;
  --card: #ffffff;
  --ink: #1a1a2e;
  --muted: #6b6b83;
  --line: #e7e7f0;
  --brand: #7c5cff;
  --brand-2: #a78bfa;
  --brand-ink: #4c2fbf;
  --ok: #16a34a;
  --err: #dc2626;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(20,20,50,.06), 0 8px 30px rgba(20,20,50,.06);
  --maxw: 1100px;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- nav ---- */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  max-width: var(--maxw); margin: 0 auto; padding: 18px 20px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--ink); }
.brand .dot { width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.nav .links a { color: var(--muted); margin-left: 18px; font-size: 14px; font-weight: 500; }

/* ---- hero (index) ---- */
.hero { max-width: var(--maxw); margin: 10px auto 8px; padding: 24px 20px 8px; text-align: center; }
.hero h1 { font-size: clamp(28px, 5vw, 44px); line-height: 1.1; margin: 0 0 12px; letter-spacing: -.02em; }
.hero p { color: var(--muted); font-size: 18px; max-width: 640px; margin: 0 auto; }
.hero .pill { display: inline-block; background: #efeaff; color: var(--brand-ink); font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 999px; margin-bottom: 16px; }

/* ---- grid of tools ---- */
.grid { max-width: var(--maxw); margin: 24px auto 40px; padding: 0 20px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.tool-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s;
  display: flex; flex-direction: column; gap: 8px; color: inherit;
}
.tool-card:hover { transform: translateY(-3px); box-shadow: 0 12px 34px rgba(20,20,50,.12); text-decoration: none; }
.tool-card .cat { font-size: 12px; font-weight: 600; color: var(--brand); text-transform: uppercase; letter-spacing: .04em; }
.tool-card h3 { margin: 0; font-size: 18px; }
.tool-card p { margin: 0; color: var(--muted); font-size: 14px; flex: 1; }
.tool-card .meta { font-size: 12px; color: var(--muted); display: flex; gap: 12px; margin-top: 6px; }
.tool-card .go { color: var(--brand-ink); font-weight: 600; font-size: 14px; margin-top: 4px; }

/* ---- tool page layout ---- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 8px 20px 60px; }
.tool-head { text-align: center; margin: 8px 0 26px; }
.tool-head .cat { font-size: 12px; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: .05em; }
.tool-head h1 { font-size: clamp(26px, 4vw, 38px); margin: 8px 0 10px; letter-spacing: -.02em; }
.tool-head p { color: var(--muted); font-size: 17px; max-width: 620px; margin: 0 auto; }

.studio { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 820px) { .studio { grid-template-columns: 1fr; } }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.panel h2 { font-size: 15px; margin: 0 0 16px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

/* form */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field input[type=text], .field select, .field textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 15px; font-family: inherit; background: #fbfbfe; color: var(--ink);
}
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--brand-2); border-color: var(--brand); }

/* uploader */
.uploads { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.drop {
  flex: 1; min-width: 130px; aspect-ratio: 3/4; max-height: 300px; border: 2px dashed var(--line); border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; color: var(--muted); font-size: 13px; text-align: center; padding: 10px;
  background: #fbfbfe; position: relative; overflow: hidden; transition: border-color .15s;
}
.drop:hover { border-color: var(--brand-2); }
.drop.filled { border-style: solid; }
.drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.drop .ph { font-size: 26px; opacity: .5; }
.drop .rm { position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,.6); color: #fff; border: none;
  border-radius: 999px; width: 24px; height: 24px; cursor: pointer; font-size: 14px; line-height: 1; z-index: 2; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  padding: 13px 18px; border-radius: 12px; border: none; font-size: 16px; font-weight: 600; cursor: pointer; font-family: inherit; }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; filter: none; }
.btn-ghost { background: transparent; color: var(--brand-ink); border: 1px solid var(--line); margin-top: 10px; }
.btn-ghost:hover { background: #f4f1ff; }

/* output */
.output { min-height: 320px; display: flex; align-items: center; justify-content: center; text-align: center; }
.output .placeholder { color: var(--muted); font-size: 14px; }
.output img { max-width: 100%; border-radius: 12px; box-shadow: var(--shadow); }
.output .letter { white-space: pre-wrap; text-align: left; font-size: 15px; width: 100%; background: #fbfbfe;
  border: 1px solid var(--line); border-radius: 12px; padding: 18px; max-height: 460px; overflow: auto; }
.results-multi { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.results-multi img { cursor: zoom-in; }

.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
.status { color: var(--muted); font-size: 14px; }
.err { color: var(--err); font-size: 14px; }

.dl { margin-top: 12px; }
.dl a { font-size: 14px; font-weight: 600; }

/* safety / notice */
.notice { margin-top: 16px; font-size: 13px; color: var(--muted); background: #fff8ec; border: 1px solid #f5e6c8;
  border-radius: 10px; padding: 10px 12px; }
.notice.safe { background: #eef7f0; border-color: #cdeccf; }

/* showcase (真实样例) */
.showcase { max-width: 860px; margin: 40px auto 0; text-align: center; }
.showcase h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 18px; }
.sc-row { display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.sc-ins { display: flex; gap: 10px; }
.sc-in { width: 130px; border-radius: 10px; box-shadow: var(--shadow); }
.sc-arrow { font-size: 26px; color: var(--brand); font-weight: 700; }
.sc-out { max-width: 300px; width: 100%; border-radius: 12px; box-shadow: var(--shadow); }
.sc-letter { white-space: pre-wrap; text-align: left; font-size: 14px; color: #3a3a52; background: #fbfbfe;
  border: 1px solid var(--line); border-radius: 12px; padding: 18px; max-width: 560px; }
.sc-cap { margin-top: 12px; font-size: 13px; color: var(--muted); }
.sc-cap code { background: #efeaff; color: var(--brand-ink); padding: 1px 6px; border-radius: 6px; font-size: 12px; }
@media (max-width: 640px) { .sc-in { width: 96px; } .sc-arrow { transform: rotate(90deg); } }

/* homepage card thumbs */
.tool-card .thumb { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 10px; margin-bottom: 4px; }
.tool-card .thumb-letter { aspect-ratio: 4/3; overflow: hidden; font-size: 11px; color: var(--muted);
  background: #fbfbfe; border: 1px solid var(--line); padding: 10px; white-space: pre-wrap; line-height: 1.45; }

/* seo body */
.seo-body { max-width: 760px; margin: 46px auto 0; }
.seo-body h2 { font-size: 22px; margin: 28px 0 10px; }
.seo-body p { color: #3a3a52; }
.seo-body ul { color: #3a3a52; padding-left: 20px; }

/* replicate snippet */
.repl { max-width: 760px; margin: 34px auto 0; }
details.repl-box { background: #0f0f1e; color: #e6e6f0; border-radius: 14px; padding: 6px 18px 18px; }
details.repl-box summary { cursor: pointer; padding: 14px 0; font-weight: 600; color: #fff; list-style: none; }
details.repl-box summary::-webkit-details-marker { display: none; }
details.repl-box pre { overflow-x: auto; font-size: 12.5px; line-height: 1.5; background: #080814; padding: 14px; border-radius: 10px; }
details.repl-box code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

footer { text-align: center; color: var(--muted); font-size: 13px; padding: 30px 20px 40px; }
footer a { color: var(--muted); text-decoration: underline; }

.badge-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.badge { font-size: 12px; color: var(--muted); background: #fff; border: 1px solid var(--line); padding: 4px 10px; border-radius: 999px; }
