:root {
  --bg: #0f1226;
  --bg-soft: #171a35;
  --card: #1d2142;
  --line: #2c3160;
  --text: #e8eaff;
  --muted: #9aa0d0;
  --brand: #6c7bff;
  --brand-2: #57e0c4;
  --danger: #ff6b81;
  --ok: #57e0c4;
  --radius: 14px;
  --shadow: 0 10px 40px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { overflow-x: hidden; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans Thai", sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #23285a 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: rgba(15,18,38,.85); backdrop-filter: blur(8px);
  z-index: 5;
}
.brand { display: inline-flex; align-items: center; gap: 9px; font-size: 20px; font-weight: 800; letter-spacing: .3px; color: var(--text); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark { display: block; }
.brand .dot { color: var(--brand); }
.nav { display: flex; gap: 12px; align-items: center; }
.nav .who { color: var(--muted); font-size: 14px; }

.container { width: 100%; max-width: 900px; margin: 0 auto; padding: 28px 20px 60px; flex: 1; }
.loading { text-align: center; color: var(--muted); padding: 60px 0; }

.hero { text-align: center; padding: 30px 0 10px; }
.hero h1 { font-size: 40px; margin: 0 0 10px; line-height: 1.1; }
.hero h1 .grad {
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--muted); font-size: 17px; margin: 0 auto; max-width: 560px; }

.card {
  background: linear-gradient(180deg, var(--card), var(--bg-soft));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow); margin-bottom: 18px;
}
.card h2 { margin: 0 0 14px; font-size: 18px; }

label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
input[type=text], input[type=email], input[type=password], input[type=url] {
  width: 100%; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: #0e1130; color: var(--text);
  font-size: 15px; outline: none;
}
input:focus { border-color: var(--brand); }

.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 12px 18px; border-radius: 10px; border: 1px solid transparent;
  background: var(--brand); color: white; font-weight: 700; font-size: 15px;
  cursor: pointer; transition: transform .05s ease, opacity .2s;
}
.btn:hover { opacity: .92; }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn.small { padding: 7px 12px; font-size: 13px; }
.btn.danger { background: transparent; color: var(--danger); border-color: transparent; }
.btn:disabled { opacity: .5; cursor: default; }

.row { display: flex; gap: 10px; }
.row .grow { flex: 1; }
.muted { color: var(--muted); }
.err { color: var(--danger); font-size: 14px; min-height: 18px; margin-top: 8px; }
.center { text-align: center; }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.tabs button {
  flex: 1; padding: 10px; border-radius: 10px; border: 1px solid var(--line);
  background: transparent; color: var(--muted); cursor: pointer; font-weight: 600;
}
.tabs button.active { background: var(--brand); color: #fff; border-color: var(--brand); }

.result {
  display: flex; align-items: center; gap: 14px; margin-top: 16px;
  padding: 14px; border-radius: 10px; border: 1px dashed var(--brand);
  background: rgba(108,123,255,.08);
}
.result .short { font-size: 18px; font-weight: 800; color: var(--brand-2); word-break: break-all; }
.result .qr { width: 84px; height: 84px; border-radius: 8px; background: #fff; padding: 4px; flex: none; }

.link-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 0;
  border-top: 1px solid var(--line);
}
.link-item:first-child { border-top: none; }
.qr.thumb { width: 52px; height: 52px; background: #fff; border-radius: 8px; padding: 4px; flex: none; }
.link-main { flex: 1; min-width: 0; }
.link-code { font-weight: 800; color: var(--brand-2); }
.link-target { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pill { font-size: 11px; padding: 3px 8px; border-radius: 999px; background: var(--line); color: var(--muted); }

.notice {
  margin-top: 12px; padding: 10px 14px; border-radius: 10px; font-size: 13px;
  background: rgba(255,193,7,.1); border: 1px solid rgba(255,193,7,.35); color: #ffd66b;
}

pre.code {
  background: #0b0e24; border: 1px solid var(--line); border-radius: 10px;
  padding: 14px; overflow-x: auto; margin: 6px 0 0; max-width: 100%; min-width: 0;
}
pre.code code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px; color: #c8d0ff; white-space: pre; line-height: 1.6;
}
@media (max-width: 820px) {
  pre.code code { white-space: pre-wrap; overflow-wrap: anywhere; }
}
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ok); color: #06231d; padding: 12px 18px; border-radius: 10px;
  font-weight: 700; box-shadow: var(--shadow); z-index: 20;
}

/* --- Landing page --- */
.eyebrow {
  display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .6px;
  text-transform: uppercase; color: var(--brand-2);
  background: rgba(87,224,196,.1); border: 1px solid rgba(87,224,196,.25);
  padding: 6px 12px; border-radius: 999px; margin-bottom: 18px;
}
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; padding: 34px 0 20px; }
.hero-grid > *, .api-grid > * { min-width: 0; } /* let grid items shrink instead of overflowing */
.hero-grid h1 { font-size: 46px; line-height: 1.08; margin: 0 0 16px; letter-spacing: -.5px; }
.hero-grid h1 .grad { background: linear-gradient(90deg, var(--brand), var(--brand-2));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-grid .lead { font-size: 18px; color: var(--muted); margin: 0 0 24px; max-width: 520px; line-height: 1.6; }
.cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.btn.lg { padding: 14px 26px; font-size: 16px; }
.trust { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
.trust span { display: inline-flex; align-items: center; gap: 6px; }
.trust b { color: var(--text); font-weight: 700; }

.hero-demo {
  background: linear-gradient(180deg, var(--card), var(--bg-soft));
  border: 1px solid var(--line); border-radius: 18px; padding: 22px; box-shadow: var(--shadow);
}
.demo-long {
  font-size: 12px; color: var(--muted); background: #0e1130; border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 12px; word-break: break-all;
}
.demo-arrow { text-align: center; color: var(--brand); font-size: 22px; margin: 4px 0; }
.demo-short { display: flex; align-items: center; gap: 14px; }
.demo-short .s { flex: 1; min-width: 0; font-size: 21px; font-weight: 800; color: var(--brand-2); overflow-wrap: anywhere; }
.demo-short img { width: 78px; height: 78px; background: #fff; border-radius: 10px; padding: 5px; flex: none; }
.demo-long { overflow-wrap: anywhere; }

.section { padding: 44px 0; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--brand); text-align: center; margin-bottom: 6px; font-weight: 700; }
.section h2.big { font-size: 30px; text-align: center; margin: 0 0 30px; }

.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feature { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 22px; }
.feature .ic { font-size: 26px; margin-bottom: 10px; }
.feature h3 { margin: 0 0 6px; font-size: 16px; }
.feature p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.step { text-align: center; padding: 10px; }
.step .num { width: 44px; height: 44px; border-radius: 50%; margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 18px;
  color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.step h3 { margin: 0 0 4px; font-size: 16px; }
.step p { margin: 0; color: var(--muted); font-size: 14px; }

.api-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: center; }
.auth-wrap { max-width: 440px; margin: 0 auto; }

@media (max-width: 820px) {
  .hero-grid, .api-grid { grid-template-columns: 1fr; }
  .feature-grid, .steps { grid-template-columns: 1fr; }
  .hero-grid h1 { font-size: 34px; }
  .section h2.big { font-size: 25px; }
  .demo-short .s { font-size: 18px; }
  .demo-short img { width: 66px; height: 66px; }
  .trust { gap: 12px 16px; }
}

.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 20px; border-top: 1px solid var(--line); }

@media (max-width: 560px) {
  .hero h1 { font-size: 30px; }
  .link-item { flex-wrap: wrap; }
}
