:root {
  --bg: #0b0e14;
  --bg-2: #0d1018;
  --panel: #12161f;
  --panel-2: #151a24;
  --line: rgba(255, 255, 255, .07);
  --line-2: rgba(255, 255, 255, .12);
  --txt: #e6e9ef;
  --muted: #8a93a6;
  --faint: #5b6473;
  --accent: #6366f1;
  --accent-2: #22d3ee;
  --amber: #f0b429;
  --green: #34d399;
  --red: #f87171;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, .7);
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--txt);
  background: radial-gradient(1200px 700px at 50% -10%, #131a2b 0%, var(--bg) 55%, var(--bg-2) 100%);
  min-height: 100dvh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.glow {
  position: fixed;
  inset: -30% 0 auto 0;
  height: 60vh;
  background: radial-gradient(600px 300px at 30% 0%, rgba(99, 102, 241, .18), transparent 70%),
              radial-gradient(500px 300px at 75% 10%, rgba(34, 211, 238, .12), transparent 70%);
  pointer-events: none;
  z-index: 0;
  filter: blur(10px);
}

main, .site-header, .site-footer { position: relative; z-index: 1; }

a { color: inherit; text-decoration: none; }

code {
  font-family: var(--mono);
  font-size: .88em;
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--line);
  padding: .08em .4em;
  border-radius: 6px;
  color: #c7cbff;
}

/* ---------- header ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 980px;
  margin: 0 auto;
  padding: 22px 20px 8px;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 20px -6px rgba(99, 102, 241, .8);
  position: relative;
}
.brand-mark::after {
  content: "";
  position: absolute; inset: 9px;
  border: 3px solid #0b0e14;
  border-radius: 50%;
}

.brand-txt { display: flex; flex-direction: column; line-height: 1.1; }
.brand-txt strong { font-size: 1.05rem; letter-spacing: .2px; }
.brand-txt .dot { color: var(--accent-2); margin: 0 1px; }
.brand-txt small { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: 1.5px; }

.header-links { display: flex; gap: 20px; }
.header-links a { color: var(--muted); font-size: .9rem; transition: color .15s; }
.header-links a:hover { color: var(--txt); }

/* ---------- layout ---------- */
main {
  max-width: 980px;
  margin: 0 auto;
  padding: 12px 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.hero { padding: 26px 4px 6px; }
.hero h1 {
  font-size: clamp(1.9rem, 5vw, 2.9rem);
  line-height: 1.08;
  margin: 0 0 12px;
  letter-spacing: -.5px;
}
.grad {
  background: linear-gradient(100deg, var(--accent) 10%, var(--accent-2) 90%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero .lead { color: var(--muted); max-width: 640px; font-size: 1.02rem; margin: 0; }
.hero .lead strong { color: var(--txt); }

.card {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.card-head, .section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 16px;
}
.card-head h2, .section-head h2, .help h2 { margin: 0; font-size: 1.15rem; letter-spacing: -.2px; }
.hint { color: var(--faint); font-size: .82rem; }

/* ---------- quick QR ---------- */
.quick-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
}

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: .82rem; color: var(--muted); }
.field > span small { color: var(--faint); }

input[type=text], select {
  background: #0a0d13;
  border: 1px solid var(--line-2);
  color: var(--txt);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: .95rem;
  font-family: var(--mono);
  width: 100%;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
select { font-family: var(--sans); }
input[type=text]:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .18);
}
input::placeholder { color: var(--faint); }

.toggle { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .85rem; cursor: pointer; margin-bottom: 14px; }
.toggle input { accent-color: var(--accent); width: 16px; height: 16px; }

.quick-actions { display: flex; gap: 10px; }
.quick-note { color: var(--faint); font-size: .82rem; margin: 12px 0 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: .9rem;
  font-weight: 600;
  font-family: var(--sans);
  cursor: pointer;
  transition: transform .1s, box-shadow .15s, opacity .15s;
  box-shadow: 0 8px 20px -10px rgba(99, 102, 241, .9);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.ghost {
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--txt);
  box-shadow: none;
}
.btn.ghost:hover { border-color: var(--accent); }
.btn.danger { background: transparent; border: 1px solid rgba(248, 113, 113, .4); color: var(--red); box-shadow: none; }
.btn.danger:hover { background: rgba(248, 113, 113, .1); }
.btn[aria-disabled=true] { opacity: .45; pointer-events: none; }

/* ---------- QR box ---------- */
.qr-stage { display: flex; justify-content: center; }
.qr-box {
  width: 196px; height: 196px;
  background: #fff;
  border-radius: 14px;
  padding: 12px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .6);
}
.qr-box[data-empty=true] {
  background: #0a0d13;
  border: 1px dashed var(--line-2);
  color: var(--faint);
  font-size: .8rem;
  text-align: center;
  padding: 18px;
}
.qr-box img, .qr-box canvas { display: block; width: 100% !important; height: 100% !important; }

/* ---------- apps grid ---------- */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.app-card {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color .15s, transform .1s;
}
.app-card:hover { border-color: var(--line-2); }

.app-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.app-name { font-weight: 700; font-size: 1.02rem; }
.app-desc { color: var(--muted); font-size: .84rem; margin-top: 2px; }

.badge {
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .6px;
  padding: 3px 8px; border-radius: 20px; white-space: nowrap;
}
.badge.dev { background: rgba(240, 180, 41, .14); color: var(--amber); }
.badge.live { background: rgba(52, 211, 153, .14); color: var(--green); }
.badge.planned { background: rgba(138, 147, 166, .14); color: var(--muted); }

.app-qr { display: flex; gap: 14px; align-items: center; }
.app-qr .qr-box { width: 116px; height: 116px; padding: 8px; border-radius: 11px; }
.app-qr .qr-box[data-empty=true] { font-size: .7rem; }

.app-url {
  font-family: var(--mono); font-size: .74rem; color: var(--faint);
  word-break: break-all; line-height: 1.35;
  flex: 1; min-width: 0;
}
.app-url.set { color: #9aa2ff; }

.app-actions { display: flex; gap: 8px; }
.app-actions .btn { padding: 8px 12px; font-size: .82rem; flex: 1; }

/* ---------- empty ---------- */
.empty {
  text-align: center;
  padding: 46px 20px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  color: var(--muted);
}
.empty-mark {
  width: 48px; height: 48px; margin: 0 auto 14px;
  border-radius: 12px;
  border: 2px solid var(--accent);
  position: relative; opacity: .7;
}
.empty-mark::after { content: "+"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--accent); font-size: 1.6rem; font-weight: 300; }
.empty h3 { margin: 0 0 6px; color: var(--txt); }
.empty p { margin: 0; font-size: .9rem; }

/* ---------- help ---------- */
.steps { margin: 0; padding-left: 20px; color: var(--muted); display: flex; flex-direction: column; gap: 10px; }
.steps strong { color: var(--txt); }
.steps em { color: var(--accent-2); font-style: normal; font-weight: 600; }
.fineprint { color: var(--faint); font-size: .82rem; margin: 16px 0 0; }

/* ---------- footer ---------- */
.site-footer {
  max-width: 980px; margin: 0 auto; padding: 30px 20px 40px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  border-top: 1px solid var(--line); margin-top: 20px;
}
.site-footer > span { color: var(--faint); font-size: .78rem; text-transform: uppercase; letter-spacing: 1.5px; }
.site-footer nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-footer nav a { color: var(--muted); font-size: .88rem; transition: color .15s; }
.site-footer nav a:hover { color: var(--txt); }

/* ---------- dialog ---------- */
.dialog {
  border: 1px solid var(--line-2);
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border-radius: var(--radius);
  color: var(--txt);
  padding: 0;
  width: min(440px, 92vw);
  box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgba(4, 6, 10, .68); backdrop-filter: blur(3px); }
.dialog-form { padding: 22px; }
.dialog-form h3 { margin: 0 0 18px; font-size: 1.15rem; }
.dialog-actions { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.dialog-actions .spacer { flex: 1; }

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  .header-links { display: none; }
  .quick-grid { grid-template-columns: 1fr; }
  .qr-stage { order: -1; }
  .quick-actions { flex-direction: column; }
  .quick-actions .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto; }
}
