/* =========
   Stylized — token-driven theme (all values are overridden by JS via CSS vars)
   ========= */

:root{
  --bg:#0b0f17;
  --bg2:#070a10;
  --text:#e8eefc;
  --muted:#9fb0d0;
  --accent:#78a6ff;
  --accent2:#6ef3c5;

  --glow:0.55;

  --radius:18px;
  --radius2:26px;

  --container:1120px;
  --density:1;

  --borderA:0.10; /* line intensity */
  --cardA:0.06;   /* card opacity */
  --cardBlur:10px;

  --shadowA:0.55;
  --accentGlow:0.22;

  --baseSize:16px;
  --lineHeight:1.55;
  --hWeight:760;
  --letterSpace:-0.01;

  --btnStyle:soft;
  --btnHeight:46px;
  --btnRadius:14px;

  --font-ui: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  --font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --font: var(--font-ui);
  --mono: var(--font-mono);
}

/* Layout shell */
*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  background:
    radial-gradient(1200px 600px at 18% 0%, color-mix(in srgb, var(--accent) calc(var(--glow) * 35%), transparent), transparent 60%),
    radial-gradient(900px 520px at 82% 8%, color-mix(in srgb, var(--accent2) calc(var(--glow) * 18%), transparent), transparent 60%),
    linear-gradient(180deg, var(--bg), var(--bg2));
  color: var(--text);
  font-family: var(--font);
  font-size: var(--baseSize);
  line-height: var(--lineHeight);
  letter-spacing: var(--letterSpace);
  overflow:hidden;
}

a{ color:inherit; text-decoration:none; }
a:hover{ opacity:.92; }

.app{
  display:grid;
  grid-template-columns: 420px 1fr;
  height:100vh;
}

/* Left control panel */
.panel{
  border-right:1px solid rgba(255,255,255, calc(var(--borderA) * 0.7));
  background: rgba(0,0,0,.20);
  backdrop-filter: blur(10px);
  overflow:hidden;
  display:flex;
  flex-direction:column;
}

.panel-head{
  padding: calc(18px * var(--density));
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  border-bottom:1px solid rgba(255,255,255, calc(var(--borderA) * 0.7));
}

.brand{ display:flex; align-items:center; gap:12px; }
.mark{
  width:22px; height:22px; border-radius:8px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 18px 50px rgba(0,0,0,.35);
}
.brand-name{ font-weight:800; letter-spacing:-.2px; }
.brand-sub{ font-size:12px; color: var(--muted); margin-top:2px; }

.panel-actions{ display:flex; gap:10px; }

.panel-body{
  padding: calc(16px * var(--density));
  overflow:auto;
}

.group{
  border:1px solid rgba(255,255,255, var(--borderA));
  background: rgba(255,255,255, calc(var(--cardA) * 0.55));
  border-radius: calc(var(--radius) + 2px);
  padding: calc(14px * var(--density));
  margin-bottom: calc(12px * var(--density));
}

.group-title{
  font-weight:800;
  letter-spacing:-.1px;
  margin-bottom: calc(10px * var(--density));
  display:flex;
  align-items:center;
  justify-content:space-between;
}

.row2{ display:grid; grid-template-columns: 1fr 1fr; gap:10px; margin-bottom:10px; }
.row3{ display:grid; grid-template-columns: 1.1fr 1fr 1fr; gap:10px; margin-bottom:10px; }

.field{ display:flex; flex-direction:column; gap:6px; }
.field-actions .actions-inline{ display:flex; gap:8px; }
.label{ font-size:12px; color: var(--muted); }

input[type="text"], input[type="tel"], input[type="email"], select{
  height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255, calc(var(--borderA) * 1.2));
  background: rgba(0,0,0,.18);
  color: var(--text);
  padding: 0 12px;
  outline:none;
}
select{ cursor:pointer; }

input[type="range"]{ width:100%; }
input[type="color"]{
  width:100%; height:42px; padding:6px;
  border-radius: 12px;
  border:1px solid rgba(255,255,255, calc(var(--borderA) * 1.2));
  background: rgba(0,0,0,.18);
}

.micro{
  font-size:12px;
  color: color-mix(in srgb, var(--muted) 80%, white);
  opacity:.9;
}

.panel-foot{
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255, calc(var(--borderA) * 0.7));
}
.foot-note{ font-size:12px; color: var(--muted); }

/* Buttons (panel) */
.btn{
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255, calc(var(--borderA) * 1.3));
  background: rgba(255,255,255, .05);
  color: var(--text);
  font-weight: 750;
  cursor:pointer;
}
.btn:hover{ transform: translateY(-1px); transition: .15s ease; }
.btn:active{ transform: translateY(0px); }

.btn-ghost{
  background: rgba(0,0,0,.16);
  color: var(--muted);
}
.btn-ghost:hover{ color: var(--text); background: rgba(255,255,255,.06); }
.btn-ghost.danger{ border-color: rgba(255,120,120,.35); }

/* Preview area */
.preview{
  overflow:auto;
  position:relative;
}
.preview-wrap{
  width: min(var(--container), calc(100% - 48px));
  margin: 0 auto;
  padding: calc(22px * var(--density)) 0 calc(36px * var(--density));
}

/* Preview topbar */
.topbar{
  position:sticky;
  top:0;
  z-index:20;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: calc(14px * var(--density)) 0;
  background: linear-gradient(180deg, rgba(0,0,0,.35), rgba(0,0,0,0));
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255,255,255, calc(var(--borderA) * 0.6));
}

.topbar-left{ display:flex; align-items:center; gap:10px; }
.logo{
  width:18px; height:18px; border-radius:7px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 0 30px rgba(0,0,0,.35);
}
.topbar-title{ font-weight:850; letter-spacing:-.2px; }
.topbar-chip{
  font-family: var(--mono);
  font-size:12px;
  color: var(--muted);
  border: 1px solid rgba(255,255,255, calc(var(--borderA) * 0.9));
  background: rgba(255,255,255,.04);
  padding: 6px 10px;
  border-radius: 999px;
}
.topbar-nav{
  display:flex;
  align-items:center;
  gap:14px;
  color: var(--muted);
  font-size:14px;
}
.topbar-nav a{ padding: 8px 10px; border-radius: 12px; }
.topbar-nav a:hover{ background: rgba(255,255,255,.04); color: var(--text); }

/* Preview buttons (pbtn) */
.pbtn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  height: var(--btnHeight);
  padding: 0 16px;
  border-radius: var(--btnRadius);
  font-weight: 800;
  cursor:pointer;
  user-select:none;
  border: 1px solid rgba(255,255,255, calc(var(--borderA) * 1.1));
  transition: .15s ease;
}

.pbtn:hover{ transform: translateY(-1px); }
.pbtn:active{ transform: translateY(0px); }

.pbtn-sm{ height: calc(var(--btnHeight) - 8px); font-size: 13px; padding: 0 12px; }

/* Variant styles controlled by --btnStyle */
body[data-btnstyle="soft"] .pbtn{
  background: color-mix(in srgb, var(--accent) 18%, rgba(255,255,255,.04));
  border-color: color-mix(in srgb, var(--accent) 45%, rgba(255,255,255,.12));
  box-shadow: 0 18px 50px rgba(0,0,0, calc(var(--shadowA) * 0.55));
}
body[data-btnstyle="soft"] .pbtn-ghost{
  background: rgba(255,255,255,.04);
  color: var(--muted);
  box-shadow:none;
}

body[data-btnstyle="solid"] .pbtn{
  background: color-mix(in srgb, var(--accent) 85%, black 10%);
  border-color: rgba(255,255,255, .14);
  box-shadow: 0 18px 50px rgba(0,0,0, calc(var(--shadowA) * 0.65));
}
body[data-btnstyle="solid"] .pbtn-ghost{
  background: rgba(255,255,255,.03);
  color: var(--muted);
  box-shadow:none;
}

body[data-btnstyle="outline"] .pbtn{
  background: rgba(0,0,0,.10);
  border-color: color-mix(in srgb, var(--accent) 65%, rgba(255,255,255,.10));
  box-shadow:none;
}
body[data-btnstyle="outline"] .pbtn-ghost{
  background: rgba(0,0,0,.10);
  border-color: rgba(255,255,255, calc(var(--borderA) * 1.0));
  color: var(--muted);
}

.pbtn-ghost{
  border-color: rgba(255,255,255, calc(var(--borderA) * 1.0));
}

/* Hero */
.hero{
  display:grid;
  grid-template-columns: 1.15fr .85fr;
  gap: calc(22px * var(--density));
  padding: calc(26px * var(--density)) 0 calc(12px * var(--density));
  align-items:stretch;
}

.pill{
  display:inline-flex;
  align-items:center;
  gap:10px;
  font-size:12px;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255, calc(var(--borderA) * 0.9));
  background: rgba(255,255,255, .03);
}

h1{
  margin: 14px 0 10px;
  font-size: clamp(34px, 4vw, 54px);
  line-height: 1.05;
  font-weight: var(--hWeight);
  letter-spacing: calc(var(--letterSpace) * 1.2);
}

.sub{
  margin:0;
  color: var(--muted);
  font-size: 18px;
  max-width: 56ch;
}

.hero-actions{
  display:flex;
  gap:12px;
  margin-top: 16px;
  flex-wrap:wrap;
}

.micro-note{
  margin-top: 12px;
  font-size: 12px;
  color: color-mix(in srgb, var(--muted) 85%, white);
  opacity:.95;
}

/* Cards / surfaces */
.card, .tile, .panel-card, .cta-card{
  border: 1px solid rgba(255,255,255, var(--borderA));
  border-radius: var(--radius2);
  background: rgba(255,255,255, var(--cardA));
  backdrop-filter: blur(var(--cardBlur));
  box-shadow: 0 22px 60px rgba(0,0,0, var(--shadowA));
}

.hero-card .card{ padding: calc(16px * var(--density)); height:100%; }

.card-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255, calc(var(--borderA) * 0.7));
  margin-bottom: 12px;
}
.card-title{ font-weight: 850; }
.chip{
  font-family: var(--mono);
  font-size:12px;
  color: color-mix(in srgb, var(--accent2) 90%, white);
  border: 1px solid color-mix(in srgb, var(--accent2) 35%, rgba(255,255,255,.12));
  background: color-mix(in srgb, var(--accent2) 10%, rgba(255,255,255,.03));
  padding: 6px 10px;
  border-radius: 999px;
}

.spec{ display:flex; flex-direction:column; gap:10px; margin-top:10px; }
.spec-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  color: var(--muted);
  font-size: 13px;
}
.mono{ font-family: var(--mono); color: var(--text); }
.card-foot{
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255, calc(var(--borderA) * 0.7));
  color: var(--muted);
  font-size: 13px;
}

/* Sections */
.grid{ padding: calc(26px * var(--density)) 0 calc(8px * var(--density)); }
.section-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:18px;
  margin-bottom: 14px;
}
.section-head h2{ margin:0; font-size: 22px; letter-spacing:-.2px; }
.section-head p{ margin:0; color: var(--muted); font-size:14px; }

.tiles{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.tile{
  border-radius: var(--radius);
  padding: calc(14px * var(--density));
  box-shadow: 0 18px 55px rgba(0,0,0, calc(var(--shadowA) * 0.9));
}

.num{
  font-family: var(--mono);
  font-size:12px;
  color: color-mix(in srgb, var(--accent) 95%, white);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, rgba(255,255,255,.12));
  background: color-mix(in srgb, var(--accent) 10%, rgba(255,255,255,.03));
  display:inline-block;
  padding: 6px 10px;
  border-radius: 999px;
}
.tile-title{ margin-top:10px; font-weight: 850; }
.tile-text{ margin-top:6px; color: var(--muted); font-size: 13px; }

.split{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.panel-card{
  border-radius: var(--radius);
  padding: calc(14px * var(--density));
  box-shadow: 0 18px 55px rgba(0,0,0, calc(var(--shadowA) * 0.85));
}
.pc-title{ font-weight:850; margin-bottom:10px; }

.list{
  margin:0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.85;
}

/* CTA */
.cta{ padding: calc(28px * var(--density)) 0; }
.cta-card{
  border-radius: var(--radius2);
  padding: calc(18px * var(--density));
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 16px;
  box-shadow:
    0 25px 70px rgba(0,0,0, var(--shadowA)),
    0 0 90px rgba(0,0,0, .15),
    0 0 120px color-mix(in srgb, var(--accent) calc(var(--accentGlow) * 60%), transparent);
}
.cta-title{ font-weight: 900; letter-spacing:-.2px; font-size: 18px; }
.cta-text{ color: var(--muted); margin-top: 6px; max-width: 62ch; }
.cta-right{ display:flex; gap:10px; flex-wrap:wrap; }

.footer{
  margin-top: calc(26px * var(--density));
  padding-top: calc(16px * var(--density));
  border-top: 1px solid rgba(255,255,255, calc(var(--borderA) * 0.6));
  display:flex;
  justify-content:space-between;
  color: color-mix(in srgb, var(--muted) 75%, white);
  font-size: 13px;
}
.foot-links{ display:flex; gap:14px; }
.foot-links a{ padding:6px 8px; border-radius: 12px; }
.foot-links a:hover{ background: rgba(255,255,255,.04); color: var(--text); }

/* Modal */
.modal{
  position:fixed;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(10px);
  padding: 24px;
  z-index: 200;
}
.modal.show{ display:flex; }
.modal-card{
  width: min(720px, 100%);
  border-radius: var(--radius2);
  border: 1px solid rgba(255,255,255, var(--borderA));
  background: rgba(0,0,0,.45);
  box-shadow: 0 30px 90px rgba(0,0,0,.60);
  padding: 14px;
}
.modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  border-bottom: 1px solid rgba(255,255,255, calc(var(--borderA) * 0.7));
  padding-bottom: 10px;
}
.modal-title{ font-weight: 900; }
.icon-btn{
  border: 1px solid rgba(255,255,255, calc(var(--borderA) * 1.2));
  background: rgba(255,255,255,.04);
  color: var(--text);
  border-radius: 12px;
  padding: 8px 10px;
  cursor:pointer;
}
.modal-body{ padding-top: 12px; }
.modal-body textarea{
  width:100%;
  height: 280px;
  resize: vertical;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255, calc(var(--borderA) * 1.2));
  background: rgba(0,0,0,.25);
  color: var(--text);
  padding: 12px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.5;
  outline:none;
}
.modal-actions{
  margin-top: 10px;
  display:flex;
  justify-content:flex-end;
  gap:10px;
  flex-wrap:wrap;
}

/* Responsive */
@media (max-width: 1120px){
  .app{ grid-template-columns: 1fr; }
  body{ overflow:auto; }
  .panel{ height:auto; border-right:none; border-bottom:1px solid rgba(255,255,255, calc(var(--borderA) * 0.7)); }
  .topbar-nav{ display:none; }
  .hero{ grid-template-columns: 1fr; }
  .tiles{ grid-template-columns: 1fr; }
  .split{ grid-template-columns: 1fr; }
}
