/* ============ LinkBio design system ============ */
:root {
  --ink: #1c1e24;
  --muted: rgba(28, 30, 36, .62);
  --line: rgba(28, 30, 36, .12);
  --accent: #6c4dff;
  --accent2: #ff5e8a;
  --card: #ffffff;
  /* page theme vars (set by applyTheme) */
  --pbg: #ffffff;
  --ptext: #1c1e24;
  --pmuted: rgba(28, 30, 36, .66);
  --pfont: -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --pradius: 999px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--ink); font-family: -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; background: #f7f7fa; }
a { color: var(--accent); }
img { max-width: 100%; }
button { font: inherit; cursor: pointer; }

/* ---------- buttons / forms ---------- */
.btn { display: inline-block; border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 10px 18px; border-radius: 999px; text-decoration: none; font-weight: 600; }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.ghost { background: transparent; }
.btn.big { padding: 13px 26px; font-size: 1.05rem; }
.btn.sm, .btn.small { padding: 7px 13px; font-size: .85rem; }
.btn:disabled { opacity: .55; cursor: default; }
label { display: block; font-weight: 600; font-size: .9rem; margin: 14px 0 4px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=datetime-local], textarea, select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; font: inherit; background: #fff; }
textarea { resize: vertical; }
.err { background: #fde8e8; color: #b3261e; border: 1px solid #f5c6c6; padding: 10px 14px; border-radius: 12px; margin: 10px 0; }
.hint { font-size: .85rem; margin-top: 4px; min-height: 1.2em; }
.hint.good { color: #1c7a3d; } .hint.bad { color: #b3261e; }
.muted { color: var(--muted); }
.demobanner { background: #fff7d6; border-bottom: 1px solid #f0dfa0; color: #7a5b00; text-align: center; padding: 8px 12px; font-size: .85rem; }

/* ---------- landing ---------- */
body.landing { background: #fff; }
.nav { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; max-width: 1120px; margin: 0 auto; }
.brand { font-weight: 800; font-size: 1.25rem; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.brand small { font-weight: 500; color: var(--muted); font-size: .75rem; }
.blogo { font-size: 1.4rem; }
.navlinks { display: flex; align-items: center; gap: 20px; }
.navlinks a:not(.btn) { color: var(--ink); text-decoration: none; font-weight: 500; }
.hero { display: flex; gap: 48px; align-items: center; max-width: 1120px; margin: 24px auto 0; padding: 24px; flex-wrap: wrap; }
.hero-in { flex: 1 1 340px; }
.hero h1 { font-size: clamp(2.4rem, 5vw, 3.8rem); line-height: 1.05; margin: 0 0 16px; letter-spacing: -1px; }
.hero h1 em { font-style: normal; background: linear-gradient(100deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .sub { font-size: 1.15rem; color: var(--muted); max-width: 34rem; }
.claim { display: flex; align-items: center; gap: 0; margin: 24px 0 8px; max-width: 30rem; border: 1px solid var(--line); border-radius: 999px; padding: 5px 5px 5px 16px; background: #fff; }
.claim .prefix { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.claim input { border: none; outline: none; flex: 1; min-width: 0; padding: 10px 8px; font-size: 1rem; background: transparent; }
.fine { color: var(--muted); font-size: .9rem; }
.hero-art { flex: 1 1 280px; display: flex; justify-content: center; }
.phone { width: 300px; border: 10px solid #14161c; border-radius: 42px; padding: 22px 16px; background: #fff; box-shadow: 0 24px 60px rgba(20, 22, 28, .18); }
.ph-head { text-align: center; margin-bottom: 14px; }
.ph-head .avatar { width: 64px; height: 64px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 1.6rem; font-weight: 800; }
.ph-head b { display: block; margin-top: 8px; }
.ph-head span { color: var(--muted); font-size: .85rem; }
.feat { max-width: 1120px; margin: 72px auto; padding: 0 24px; }
.feat h2, .pricing h2 { font-size: clamp(1.7rem, 3.4vw, 2.5rem); letter-spacing: -.5px; text-align: center; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; margin-top: 32px; }
.card { border: 1px solid var(--line); border-radius: 20px; padding: 24px; background: #fff; }
.card .ce { font-size: 2rem; }
.card h3 { margin: 12px 0 8px; }
.card p { color: var(--muted); margin: 0; }
.myspot { background: #14161c; color: #fff; margin: 72px 0; }
.myspot-in { max-width: 900px; margin: 0 auto; padding: 56px 24px; display: flex; gap: 28px; align-items: center; }
.myspot .ce.big { font-size: 3.4rem; }
.myspot p { color: rgba(255, 255, 255, .75); }
.myspot h2 { margin: 0 0 10px; }
.pricing { max-width: 900px; margin: 0 auto 72px; padding: 0 24px; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; margin-top: 32px; }
.plan { border: 1px solid var(--line); border-radius: 20px; padding: 28px; background: #fff; }
.plan.hot { border: 2px solid var(--ink); }
.plan .p { font-size: 2rem; font-weight: 800; margin: 8px 0 16px; }
.plan ul { list-style: none; padding: 0; margin: 0 0 20px; color: var(--muted); }
.plan li { margin: 8px 0; }
.cta { text-align: center; padding: 40px 24px 80px; }
.cta h2 { font-size: clamp(1.6rem, 3.4vw, 2.4rem); margin-bottom: 20px; }
.foot { display: flex; justify-content: space-between; max-width: 1120px; margin: 0 auto; padding: 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
.foot a { color: var(--muted); }

/* ---------- auth ---------- */
body.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; }
.authcard { background: #fff; border: 1px solid var(--line); border-radius: 24px; padding: 36px; width: 100%; max-width: 420px; box-shadow: 0 18px 50px rgba(20, 22, 28, .08); }
.authcard h1 { margin: 14px 0 4px; }
.authcard form { margin-top: 8px; }
.authcard .btn.big { width: 100%; margin-top: 18px; }

/* ---------- editor ---------- */
body.editor { background: #eef0f5; min-height: 100vh; }
.ebar { display: flex; align-items: center; gap: 12px; padding: 12px 20px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; flex-wrap: wrap; }
.ebar .esp { flex: 1; }
.hello { color: var(--muted); font-weight: 600; }
.saved { color: #1c7a3d; font-size: .85rem; }
.etabs { display: flex; gap: 8px; padding: 14px 20px 0; max-width: 1200px; margin: 0 auto; }
.etabs button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 9px 20px; font-weight: 700; }
.etabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.ebuild { display: flex; gap: 20px; max-width: 1200px; margin: 0 auto; padding: 16px 20px 60px; align-items: flex-start; }
.palette { flex: 0 0 300px; display: grid; gap: 10px; position: sticky; top: 76px; max-height: calc(100vh - 100px); overflow: auto; }
.pal { text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; }
.pal:hover { border-color: var(--accent); }
.pal .pi { font-size: 1.5rem; grid-row: span 2; }
.pal .pn { font-weight: 700; }
.pal .pd { color: var(--muted); font-size: .8rem; grid-column: 2; }
.stage { flex: 1; display: flex; justify-content: center; }
.stage .phone { width: min(380px, 100%); }
.canvas { min-height: 420px; border-radius: 32px; background: var(--pbg); padding: 20px 14px 30px; transition: background .2s; }
.canvas.dropover { outline: 3px dashed var(--accent); outline-offset: -6px; }
.cempty { color: var(--pmuted); text-align: center; padding: 90px 20px; }
.wblock { background: rgba(255, 255, 255, .75); border: 1px dashed rgba(28, 30, 36, .25); border-radius: 18px; padding: 8px; margin: 0 0 20px; }
.wtools { display: flex; justify-content: space-between; align-items: center; padding: 2px 6px 8px; }
.wt { font-size: .8rem; font-weight: 700; color: var(--muted); }
.wbtns button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 3px 9px; font-size: .78rem; margin-left: 4px; }
.wbtns .danger { color: #b3261e; }
.wbody { cursor: pointer; border-radius: 12px; }
.wbody:hover { outline: 2px solid var(--accent); outline-offset: 2px; }

/* design pane */
.edesign { max-width: 720px; margin: 0 auto; padding: 16px 20px 60px; display: grid; gap: 16px; }
.dcard { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 24px; }
.dcard h2 { margin: 0 0 6px; }
.swrow { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0 6px; }
.sw { width: 44px; height: 44px; border-radius: 50%; border: 2px solid transparent; }
.sw.on { border-color: var(--ink); box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); }
.pillrow { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 6px; }
.pillopt { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 16px; }
.pillopt.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.check.big { font-size: 1rem; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.dcard.myspace { background: linear-gradient(135deg, #1b1440, #3c1a5e); color: #fff; border: none; }
.dcard.myspace .check { color: #fff; }

/* ---------- modal / popup ---------- */
.modal { position: fixed; inset: 0; background: rgba(15, 17, 23, .55); display: flex; align-items: flex-start; justify-content: center; z-index: 100; padding: 5vh 16px; overflow: auto; }
.mbox { background: #fff; border-radius: 24px; padding: 26px; width: 100%; max-width: 520px; box-shadow: 0 30px 80px rgba(0, 0, 0, .3); }
.mbox h3 { margin: 0 0 6px; }
.mfoot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.fld { margin: 12px 0; }
.fld > label { margin: 0 0 6px; }
.note { color: var(--muted); font-size: .85rem; background: #f4f5f9; border-radius: 10px; padding: 10px 12px; }
.imgfield .imgprev { border: 1px dashed var(--line); border-radius: 14px; min-height: 90px; display: flex; align-items: center; justify-content: center; color: var(--muted); overflow: hidden; margin-bottom: 8px; background: #fafbfc; }
.imgfield .imgprev img { max-height: 180px; width: auto; display: block; }
.imgrow { display: flex; gap: 8px; }
.imgrow .imglink { flex: 1; }
.filebtn { white-space: nowrap; }
.listfield .lrow { border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin: 0 0 10px; background: #fafbfc; }
.lrm { border: 1px solid #f5c6c6; color: #b3261e; background: #fff; border-radius: 8px; padding: 5px 12px; font-size: .8rem; margin-top: 6px; }
.ladd { margin-top: 2px; }

/* ---------- public page ---------- */
body.public { background: var(--pbg); color: var(--ptext); font-family: var(--pfont); min-height: 100vh; }
.pwrap { max-width: 560px; margin: 0 auto; padding: 40px 20px 60px; }
.p-head { text-align: center; margin-bottom: 22px; }
.avatar { width: 92px; height: 92px; border-radius: 50%; object-fit: cover; }
.avatar.ph { display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; font-size: 2.2rem; font-weight: 800; }
.p-head h1 { margin: 12px 0 6px; font-size: 1.6rem; }
.p-head .bio { color: var(--pmuted); margin: 0; }
.p-widgets > * { margin-bottom: 20px; }
.p-foot { text-align: center; margin-top: 36px; font-size: .85rem; }
.p-foot a { color: var(--pmuted); text-decoration: none; }
.notfound { text-align: center; padding: 80px 20px; }
.nf-e { font-size: 3rem; }

/* ---------- widgets ---------- */
.lb-btn { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 15px; margin: 0 0 14px;
  background: var(--ink); color: #fff; text-decoration: none; font-weight: 700; border-radius: var(--pradius); }
body.public .lb-btn, .stage .lb-btn { background: var(--ptext); color: var(--pbg); }
.lb-btn:last-child { margin-bottom: 0; }
.lb-btn .e { font-size: 1.2rem; }
.w-social { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.soc { width: 52px; height: 52px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.5rem; background: rgba(127, 127, 160, .14); text-decoration: none; }
.w-image img, .w-gallery img { width: 100%; border-radius: 16px; display: block; }
.w-image figcaption, .w-gallery figcaption { color: var(--pmuted); font-size: .85rem; text-align: center; margin-top: 6px; }
.w-gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.w-video { display: block; border-radius: 18px; overflow: hidden; text-decoration: none; color: inherit; background: rgba(127, 127, 160, .1); }
.w-video img, .w-video .vph { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: flex; align-items: center; justify-content: center; font-size: 3rem; background: #20232e; }
.w-video .vmeta { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; }
.w-video .vt { font-weight: 700; color: var(--ptext); }
.w-video .vp { color: var(--pmuted); font-size: .9rem; }
.w-music { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 18px; text-decoration: none; color: inherit; background: rgba(127, 127, 160, .12); }
.meq { display: flex; gap: 3px; align-items: flex-end; height: 22px; }
.meq i { width: 4px; background: var(--accent2); border-radius: 2px; animation: eq 1s ease-in-out infinite; }
.meq i:nth-child(1) { height: 60%; } .meq i:nth-child(2) { height: 100%; animation-delay: .2s; } .meq i:nth-child(3) { height: 40%; animation-delay: .4s; }
@keyframes eq { 50% { transform: scaleY(.4); } }
.mmeta { flex: 1; display: flex; flex-direction: column; }
.mt { font-weight: 700; color: var(--ptext); }
.ma { color: var(--pmuted); font-size: .85rem; }
.mplay { font-size: 1.3rem; color: var(--pmuted); }
.w-text h3 { margin: 0 0 6px; color: var(--ptext); }
.w-text p { margin: 0; color: var(--pmuted); }
.w-tipjar { text-align: center; border: 1px solid rgba(127, 127, 160, .25); border-radius: 20px; padding: 20px; }
.tj-t { font-weight: 800; font-size: 1.1rem; color: var(--ptext); }
.tj-n { color: var(--pmuted); font-size: .9rem; margin: 6px 0 12px; }
.tj-amts { display: flex; gap: 10px; justify-content: center; }
.tj-amt { border: 1px solid rgba(127, 127, 160, .4); background: transparent; color: var(--ptext); border-radius: var(--pradius); padding: 10px 22px; font-weight: 800; font-size: 1rem; }
.w-store { display: grid; gap: 14px; }
.prod { position: relative; border: 1px solid rgba(127, 127, 160, .25); border-radius: 20px; padding: 14px; }
.prod img, .prod .pph { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 12px; background: rgba(127, 127, 160, .12); display: flex; align-items: center; justify-content: center; font-size: 2.4rem; }
.pbadge { position: absolute; top: 22px; left: 22px; background: var(--accent2); color: #fff; font-size: .72rem; font-weight: 800; padding: 4px 10px; border-radius: 999px; }
.pname { font-weight: 700; margin: 10px 0 4px; color: var(--ptext); }
.prow { display: flex; justify-content: space-between; align-items: center; }
.pprice { font-weight: 800; font-size: 1.1rem; color: var(--ptext); }
.pbuy { background: var(--ptext); color: var(--pbg); border: none; border-radius: var(--pradius); padding: 9px 22px; font-weight: 700; }
.w-count { text-align: center; border: 1px solid rgba(127, 127, 160, .25); border-radius: 20px; padding: 18px; }
.c-t { font-weight: 800; color: var(--ptext); margin-bottom: 10px; }
.c-cells { display: flex; gap: 10px; justify-content: center; }
.c-cells span { background: rgba(127, 127, 160, .12); border-radius: 12px; padding: 10px 12px; min-width: 64px; }
.c-cells b { display: block; font-size: 1.4rem; color: var(--ptext); }
.c-cells i { font-style: normal; font-size: .72rem; color: var(--pmuted); }
.w-contact, .w-news { border: 1px solid rgba(127, 127, 160, .25); border-radius: 20px; padding: 18px; }
.ct-t, .n-t { font-weight: 800; color: var(--ptext); margin-bottom: 10px; }
.w-contact input, .w-contact textarea { margin-bottom: 10px; background: rgba(255, 255, 255, .7); }
.w-contact button, .w-news button { background: var(--ptext); color: var(--pbg); border: none; border-radius: var(--pradius); padding: 11px 24px; font-weight: 700; width: 100%; }
.n-n { color: var(--pmuted); font-size: .9rem; margin-bottom: 10px; }
.n-row { display: flex; gap: 8px; }
.n-row input { flex: 1; background: rgba(255, 255, 255, .7); }
.n-row button { width: auto; }
.w-map { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 18px; background: rgba(127, 127, 160, .12); text-decoration: none; color: inherit; }
.mpin { font-size: 1.8rem; }
.w-map .mt { display: block; }
.w-div { border: none; border-top: 1px solid rgba(127, 127, 160, .35); margin: 6px 0; }
.w-div.stars { text-align: center; color: var(--pmuted); letter-spacing: 6px; border: none; }
.w-qr { text-align: center; }
.q-t { font-weight: 800; color: var(--ptext); margin-bottom: 10px; }
.w-qr img { border-radius: 14px; background: #fff; padding: 8px; }
.w-empty { border: 1px dashed rgba(127, 127, 160, .4); border-radius: 14px; padding: 22px; text-align: center; color: var(--pmuted); }
.pok { text-align: center; padding: 18px; font-weight: 700; color: var(--ptext); }
.pok small { display: block; font-weight: 400; color: var(--pmuted); margin-top: 6px; }
.payamt { font-size: 2.4rem; font-weight: 800; text-align: center; margin: 6px 0 4px; }

/* ---------- MySpace mode ---------- */
body.myspace { background: #0b0620 url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="120" height="120"><circle cx="20" cy="30" r="1.6" fill="white"/><circle cx="70" cy="12" r="1.2" fill="white"/><circle cx="100" cy="60" r="1.8" fill="white"/><circle cx="40" cy="90" r="1.2" fill="white"/><circle cx="90" cy="100" r="1.5" fill="white"/></svg> !important; }
body.myspace .pwrap { color: #fff; }
body.myspace .p-head h1 { background: linear-gradient(90deg, #ffd700, #ff6ec4, #7873f5, #ffd700); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 12px rgba(255, 110, 196, .8)); }
body.myspace .p-head .bio, body.myspace .p-foot a { color: rgba(255, 255, 255, .75); }
body.myspace .lb-btn { background: linear-gradient(180deg, #3b2d7a, #241b4d); border: 1px solid #6f5bd3; color: #fff; }
body.myspace .soc { background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .25); }
body.myspace .w-text h3, body.myspace .tj-t, body.myspace .c-t, body.myspace .ct-t, body.myspace .n-t, body.myspace .pname, body.myspace .pprice, body.myspace .mt, body.myspace .q-t, body.myspace .w-video .vt { color: #fff; }
body.myspace .w-text p, body.myspace .tj-n, body.myspace .ma, body.myspace .n-n, body.myspace .w-video .vp, body.myspace .c-cells i { color: rgba(255, 255, 255, .7); }
body.myspace .w-tipjar, body.myspace .w-count, body.myspace .w-contact, body.myspace .w-news, body.myspace .prod { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .2); }
body.myspace .w-music, body.myspace .w-video, body.myspace .w-map { background: rgba(255, 255, 255, .08); }
body.myspace .pbuy, body.myspace .w-contact button, body.myspace .w-news button { background: #ffd700; color: #1c1e24; }
body.myspace .tj-amt { color: #fff; border-color: rgba(255, 255, 255, .4); }
body.myspace .c-cells span { background: rgba(255, 255, 255, .1); }
body.myspace .c-cells b { color: #fff; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .ebuild { flex-direction: column; }
  .palette { flex: none; position: static; max-height: none; grid-template-columns: 1fr 1fr; }
  .navlinks a:not(.btn) { display: none; }
}
@media (max-width: 560px) {
  .palette { grid-template-columns: 1fr; }
  .claim { flex-wrap: wrap; border-radius: 20px; }
  .claim .btn { width: 100%; margin-top: 6px; }
}
