:root {
  --bg: #ffffff; --surface: #f8fafc; --text: #0f172a; --muted: #64748b; --line: #e5e7eb;
  --accent: #2563eb; --accent-hover: #1d4ed8; --accent-soft: #eff6ff; --err: #dc2626;
  --radius: 14px; --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
}
* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; font: 16px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
header, main, footer { max-width: 1040px; margin: 0 auto; padding-left: 20px; padding-right: 20px; }

/* header */
header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px 16px; padding-top: 18px; padding-bottom: 18px; }
.brand { font-weight: 800; font-size: 1.2rem; letter-spacing: -.02em; color: var(--text); }
.brand:hover { text-decoration: none; }
.lang { display: flex; flex-wrap: wrap; gap: 4px 4px; }
.lang a { color: var(--muted); font-size: 14px; padding: 4px 10px; border-radius: 999px; }
.lang a:hover { background: var(--surface); color: var(--text); text-decoration: none; }

/* headings */
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); line-height: 1.2; letter-spacing: -.025em; font-weight: 800; margin: 20px 0 10px; }
.lead { color: var(--muted); font-size: 1.08rem; max-width: 720px; margin: 0 0 28px; }
.crumbs { font-size: 14px; color: var(--muted); margin-top: 4px; }
.crumbs a { color: var(--muted); }

/* hub */
main.hub { text-align: center; }
main.hub h1 { margin-top: 40px; }
main.hub .lead { margin-left: auto; margin-right: auto; margin-bottom: 36px; }
main.hub .grid, main.hub .content { text-align: left; }

/* tool layout */
.tool { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 20px; align-items: start; }
@media (max-width: 800px) { .tool { grid-template-columns: 1fr; } }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.tool > .card:last-child { position: sticky; top: 16px; background: var(--surface); }
@media (max-width: 800px) { .tool > .card:last-child { position: static; } }

/* form */
label { display: block; font-size: 13.5px; font-weight: 600; color: #334155; margin: 14px 0 6px; }
.card > label:first-child, .card > .hint + label { margin-top: 0; }
input[type=text], input[type=password], input[type=tel], input[type=email], select, textarea {
  width: 100%; padding: 10px 12px; font: inherit; font-size: 15px; color: var(--text); background: #fff;
  border: 1px solid #d5dbe5; border-radius: 10px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #a0aabb; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
input:disabled { background: var(--surface); color: #94a3b8; }
textarea { resize: vertical; }
input[type=file] { width: 100%; font: inherit; font-size: 14px; color: var(--muted); }
input[type=color] { width: 100%; height: 40px; padding: 3px; border: 1px solid #d5dbe5; border-radius: 10px; background: #fff; cursor: pointer; }
.row { display: flex; gap: 8px; align-items: center; }
.row > input { flex: 1; }
.inline { display: flex; align-items: center; gap: 8px; font-weight: 500; margin-top: 12px; cursor: pointer; }
.inline input { width: 16px; height: 16px; accent-color: var(--accent); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { background: var(--accent-soft); color: #1e40af; border-radius: 10px; padding: 11px 14px; font-size: 14px; line-height: 1.5; margin: 0 0 14px; }
details.sign { margin-top: 18px; background: var(--surface); }

/* buttons */
button { font: inherit; font-size: 14.5px; font-weight: 600; cursor: pointer; border: 1px solid #d5dbe5; background: #fff; color: var(--text); padding: 10px 16px; border-radius: 10px; transition: background .15s, border-color .15s, transform .05s; }
button:hover:not(:disabled) { background: var(--surface); border-color: #b9c2d0; }
button:active:not(:disabled) { transform: translateY(1px); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.toggle { white-space: nowrap; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.actions .primary { flex: 1 1 140px; }

/* preview */
.preview { display: flex; justify-content: center; align-items: center; min-height: 320px; background: #fff; border-radius: 12px; border: 1px solid var(--line); padding: 12px; }
.preview svg { max-width: 100%; height: auto; }
.placeholder { color: #94a3b8; padding: 0 24px; text-align: center; font-size: 15px; }
.err { color: var(--err); font-size: 14px; min-height: 1.3em; margin-top: 10px; }
.privacy { font-size: 13px; color: var(--muted); margin: 14px 0 0; }

/* content */
section.content { margin: 56px 0; }
section.content h2 { font-size: 1.3rem; letter-spacing: -.015em; margin: 36px 0 10px; }
section.content > h2:first-child { margin-top: 0; }
section.content p, section.content li { color: #334155; max-width: 760px; }
section.content ol { padding-left: 22px; }
section.content li { margin: 6px 0; }
details { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin: 10px 0; max-width: 760px; }
details[open] { background: var(--surface); }
summary { cursor: pointer; font-weight: 600; }
details p { margin: 10px 0 2px; }

/* tool tiles */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin: 18px 0; }
.tile { display: flex; flex-direction: column; gap: 6px; padding: 18px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); transition: border-color .15s, box-shadow .15s, transform .15s; }
.tile:hover { text-decoration: none; border-color: #bfd3fb; box-shadow: var(--shadow); transform: translateY(-2px); }
.tile .ico { width: 40px; height: 40px; display: grid; place-items: center; font-size: 20px; background: var(--accent-soft); border-radius: 10px; margin-bottom: 4px; }
.tile strong { font-size: 1rem; }
.tile span:not(.ico) { color: var(--muted); font-size: 14px; line-height: 1.5; }

/* footer */
footer { margin-top: 56px; padding-top: 28px; padding-bottom: 48px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); }
footer a { color: var(--muted); }
footer a:hover { color: var(--accent); }
.flinks { line-height: 2; }

/* printable poster, only visible when printing */
#poster { display: none; }
@media print {
  body { background: #fff; color: #000; }
  header, main, footer { display: none !important; }
  #poster { display: flex !important; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 95vh; padding: 24px; font-family: system-ui, sans-serif; }
  #poster h2 { font-size: 40px; margin: 0 0 12px; }
  #poster .pnote { font-size: 20px; margin: 0 0 16px; }
  #poster svg { width: 70vmin; height: 70vmin; }
  #poster .creds { font-size: 22px; margin-top: 18px; }
}

/* style panel */
details.style { margin-top: 18px; background: var(--surface); }
details.style > summary { font-size: 1rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.chip { padding: 6px 14px; border-radius: 999px; font-size: 13.5px; background: #fff; }
.chip:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=color]:disabled { opacity: .45; cursor: not-allowed; }
.warn { color: #92400e; background: #fffbeb; border-radius: 8px; font-size: 13px; line-height: 1.5; margin-top: 8px; }
.warn:not(:empty) { padding: 8px 12px; }
.row > input[type=file] { min-width: 0; }

/* brand logo */
.brand { display: inline-flex; align-items: center; }
.brand img { height: 36px; width: auto; display: block; }
@media (max-width: 480px) { .brand img { height: 30px; } }

/* cookie consent (only present when ads/analytics are configured) */
.cc { position: fixed; left: 16px; right: 16px; bottom: 16px; max-width: 560px; margin: 0 auto; z-index: 50; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 40px rgba(15, 23, 42, .18); padding: 18px; }
@media (min-width: 640px) { .cc { left: auto; right: 24px; bottom: 24px; margin: 0; } }
.cc-title { font-size: 1.05rem; margin: 0 0 6px; }
.cc-text { font-size: 14px; color: #334155; margin: 0 0 12px; line-height: 1.55; }
.cc-options { display: grid; gap: 10px; margin: 0 0 12px; }
.cc-row { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 0; cursor: pointer; }
.cc-row input { margin-top: 4px; width: 16px; height: 16px; accent-color: var(--accent); }
.cc-rowtext { display: flex; flex-direction: column; font-size: 13.5px; color: #334155; }
.cc-rowtext strong { color: var(--text); font-size: 14px; }
.cc-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cc-btn { padding: 9px 14px; }
.cc-primary { background: var(--accent); border-color: var(--accent); color: #fff; flex: 1 1 120px; }
.cc-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.cc-link { background: transparent; border-color: transparent; color: var(--accent); }
.cc-link:hover { text-decoration: underline; background: transparent; }
[hidden] { display: none !important; }

/* phone number: country-code dropdown + number */
.phone { display: flex; gap: 8px; }
.phone .ccsel { flex: 0 0 44%; max-width: 210px; min-width: 0; text-overflow: ellipsis; }
.phone input { flex: 1; min-width: 0; }
@media (max-width: 520px) {
  .phone { flex-direction: column; }
  .phone .ccsel { flex: none; max-width: none; width: 100%; }
}
