:root {
  --bg: #f7f7f8; --surface: #ffffff; --line: #e4e4e7; --ink: #16171a; --muted: #62646c;
  --accent: #5b4cf0; --accent-ink: #4b3ce0; --accent-soft: #eeecfe; --ok: #127a4a; --warn: #a14a0b; --warn-bg: #fff4e5;
  --shadow: 0 1px 2px rgba(16,17,20,.05), 0 8px 24px rgba(16,17,20,.06);
  --r: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111214; --surface: #1a1b1f; --line: #2c2d33; --ink: #ececef; --muted: #a0a2ab;
    --accent: #8b80ff; --accent-ink: #a49bff; --accent-soft: #24223d; --ok: #4ccf8f; --warn: #ffb45c; --warn-bg: #33240f;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent-ink); }
code { font: .85em ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.top { display: flex; align-items: center; gap: 10px; padding: 14px 24px; max-width: 1240px; margin: 0 auto; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font-weight: 750; font-size: 1.12rem; letter-spacing: -.01em; }
.pill { font-size: .7rem; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; background: var(--accent-soft); color: var(--accent-ink); padding: 2px 8px; border-radius: 99px; }
.top-r { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.count { display: inline-block; min-width: 1.4em; padding: 0 5px; border-radius: 99px; background: var(--line); font-size: .75rem; text-align: center; }
.menu { position: relative; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); width: min(320px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; z-index: 20; }
.menu-pop a { display: flex; justify-content: space-between; gap: 10px; padding: 9px 10px; border-radius: 8px; text-decoration: none; color: var(--ink); }
.menu-pop a:hover { background: var(--accent-soft); }
.menu-pop small { color: var(--muted); }
.menu-pop p { margin: 8px 10px; color: var(--muted); font-size: .9rem; }

.hero { max-width: 1240px; margin: 0 auto; padding: 22px 24px 8px; }
.hero h1 { font-size: clamp(1.7rem, 4.2vw, 2.7rem); line-height: 1.08; letter-spacing: -.025em; margin: 0 0 10px; max-width: 22ch; }
.hero h1 span { color: var(--accent-ink); }
.hero p { margin: 0; color: var(--muted); max-width: 62ch; font-size: 1.02rem; }
.steps { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); font-size: .9rem; }
.steps b { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); color: var(--bg); font-size: .72rem; margin-right: 4px; }

.banner { width: calc(100% - 48px); max-width: 1192px; margin: 16px auto 0; padding: 10px 14px; border-radius: 10px; font-size: .92rem; background: var(--accent-soft); color: var(--ink); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.banner:empty { display: none; }
.banner.ok { background: color-mix(in srgb, var(--ok) 14%, var(--surface)); }
.banner.err { background: var(--warn-bg); color: var(--warn); }
.banner .btn { margin-left: auto; }

.grid { max-width: 1240px; margin: 0 auto; padding: 16px 24px 32px; display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }

.tabs { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 9px 14px; border-radius: 9px; cursor: pointer; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tabs button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent-ink); }
.panel { padding: 20px; display: grid; gap: 18px; }
.field { display: grid; gap: 7px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span, .field legend, .row-h > span { font-weight: 600; font-size: .88rem; }
.field legend { margin-bottom: 7px; padding: 0; }
input:not([type]), input[type="text"], textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); min-height: 42px;
}
textarea { resize: vertical; }
input:not([type]):focus, textarea:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
input.bad { border-color: var(--warn); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.check { display: flex; gap: 9px; align-items: center; font-size: .92rem; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.hint { margin: 0; font-size: .82rem; color: var(--muted); }
.warn { margin: 0; font-size: .85rem; color: var(--warn); background: var(--warn-bg); padding: 8px 10px; border-radius: 8px; }
.note { background: var(--bg); border: 1px dashed var(--line); border-radius: 12px; padding: 12px 14px; font-size: .88rem; color: var(--muted); }
.note b { color: var(--ink); }
.note p { margin: 4px 0 0; }
.note code { overflow-wrap: anywhere; color: var(--ink); }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: grid; gap: 2px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; height: 100%; }
.seg small { color: var(--muted); font-size: .8rem; }
.seg input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.colors { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.colors label { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; }
input[type="color"] { width: 38px; height: 38px; padding: 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { border: 1.5px solid var(--line); background: var(--surface); border-radius: 10px; padding: 6px 10px 6px 6px; display: inline-flex; gap: 8px; align-items: center; cursor: pointer; font-size: .85rem; }
.chips button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.chips svg { width: 26px; height: 26px; }
.range { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; font-size: .88rem; }
.range input { accent-color: var(--accent); }
.logo-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.logo-prev { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg) center/contain no-repeat; }
.file { position: relative; overflow: hidden; }
.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.row-h { display: flex; justify-content: space-between; align-items: center; }
.links-ed { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.links-ed li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: start; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.links-ed li.off { opacity: .6; }
.links-ed .inputs { display: grid; gap: 6px; min-width: 0; }
.links-ed .inputs input { min-height: 36px; padding: 7px 10px; background: var(--surface); }
.links-ed .tools { display: flex; flex-direction: column; gap: 2px; }
.links-ed .ord { display: flex; flex-direction: column; gap: 2px; }
.icon { width: 32px; height: 32px; display: grid; place-items: center; border: 0; background: none; border-radius: 8px; cursor: pointer; color: var(--muted); font-size: 15px; line-height: 1; }
.icon:hover:not(:disabled) { background: var(--line); color: var(--ink); }
.icon:disabled { opacity: .3; cursor: default; }
.switch { appearance: none; width: 34px; height: 20px; border-radius: 99px; background: var(--line); position: relative; cursor: pointer; margin: 6px 0; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(14px); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 10px; padding: 10px 16px; font-weight: 600; cursor: pointer; text-decoration: none; min-height: 42px; white-space: nowrap; }
.btn.sm { padding: 6px 11px; min-height: 34px; font-size: .86rem; }
.btn.primary { background: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { color: #12101f; } }
.btn.primary:hover { filter: brightness(1.06); }
.btn.primary:disabled { opacity: .6; cursor: progress; }
.btn.ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { border-color: var(--muted); }

.preview { position: sticky; top: 16px; display: grid; gap: 18px; }
.qr-card { padding: 18px; display: grid; gap: 14px; }
.qr-box { aspect-ratio: 1; width: 100%; max-width: 300px; margin: 0 auto; display: grid; place-items: center; border-radius: 12px; overflow: hidden; }
.qr-box canvas, .qr-box svg { width: 100% !important; height: auto !important; display: block; }
.scan-url { display: flex; gap: 8px; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 6px 6px 6px 12px; min-width: 0; }
.scan-url code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actions { display: grid; gap: 8px; }
.dl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.phone { width: 300px; max-width: 100%; margin: 0 auto; border-radius: 40px; padding: 10px; background: #1b1c20; box-shadow: var(--shadow); }
.phone-screen { height: 560px; border-radius: 31px; overflow: hidden auto; background: #fff; scrollbar-width: none; }
.phone-screen .lf-bio { min-height: 100%; font-size: 14px; }
.phone-screen .lf-bio-inner { padding-top: 40px; }
.phone-screen .lf-link { pointer-events: none; }
.redirect-card { height: 100%; display: grid; place-content: center; text-align: center; gap: 10px; padding: 24px; color: #16171a; background: #f4f4f6; font-size: .95rem; }
.redirect-card b { font-size: 1.15rem; overflow-wrap: anywhere; }

.stats-k { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stats-k div { background: var(--bg); border-radius: 12px; padding: 12px; }
.stats-k b { display: block; font-size: 1.5rem; letter-spacing: -.02em; }
.stats-k span { font-size: .8rem; color: var(--muted); }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 110px; padding-top: 8px; }
.bars div { flex: 1; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; opacity: .85; }
.bars-x { display: flex; justify-content: space-between; font-size: .72rem; color: var(--muted); }
.clicks { width: 100%; border-collapse: collapse; font-size: .9rem; }
.clicks td { padding: 8px 4px; border-bottom: 1px solid var(--line); }
.clicks td:last-child { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-right: 6px; animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

dialog { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); max-width: min(480px, calc(100vw - 32px)); padding: 22px; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(10,10,14,.45); }
dialog h2 { margin: 0 0 8px; font-size: 1.25rem; }
dialog p { color: var(--muted); }
dialog form { margin-top: 14px; display: flex; justify-content: flex-end; }

.foot { max-width: 1240px; margin: 0 auto; padding: 8px 24px 40px; color: var(--muted); font-size: .82rem; }

@media (max-width: 900px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .preview { position: static; order: -1; grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .top, .hero, .grid, .foot { padding-left: 16px; padding-right: 16px; }
  .banner { width: calc(100% - 32px); }
  .top #newBtn { display: none; }
  .seg, .two { grid-template-columns: 1fr; }
  .panel { padding: 16px; }
  .phone { width: 280px; }
  .phone-screen { height: 440px; }
}
