/* ============================================================
   Prism · QR Studio
   ============================================================ */

:root {
  --bg: #07060d;
  --bg-soft: #0e0c1a;
  --panel: rgba(22, 19, 38, 0.55);
  --panel-brd: rgba(255, 255, 255, 0.08);
  --panel-brd-hi: rgba(255, 255, 255, 0.16);
  --txt: #ece9f6;
  --txt-dim: #9a93b8;
  --txt-faint: #6b6586;
  --accent: #a78bfa;
  --accent-2: #ec4899;
  --accent-3: #22d3ee;
  --good: #34d399;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.8);
  --ring: 0 0 0 3px rgba(167, 139, 250, 0.35);
  --grad: linear-gradient(120deg, var(--accent), var(--accent-2) 55%, var(--accent-3));
  font-synthesis: none;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: var(--txt);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand__text h1 { font-family: "Space Grotesk", sans-serif; }

/* ---------- Animated aurora background ---------- */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 20% -10%, #1a1430 0%, transparent 55%),
    radial-gradient(ellipse at 100% 0%, #160e26 0%, transparent 50%),
    var(--bg);
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
  mix-blend-mode: screen;
  will-change: transform;
}
.blob--1 {
  width: 46vw; height: 46vw;
  background: radial-gradient(circle, #7c3aed, transparent 70%);
  top: -10vh; left: -8vw;
  animation: drift1 22s ease-in-out infinite;
}
.blob--2 {
  width: 40vw; height: 40vw;
  background: radial-gradient(circle, #ec4899, transparent 70%);
  bottom: -14vh; right: -6vw;
  animation: drift2 26s ease-in-out infinite;
}
.blob--3 {
  width: 34vw; height: 34vw;
  background: radial-gradient(circle, #22d3ee, transparent 70%);
  top: 35%; left: 45%;
  animation: drift3 30s ease-in-out infinite;
}
@keyframes drift1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(14vw, 12vh) scale(1.15); }
}
@keyframes drift2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-12vw, -10vh) scale(1.1); }
}
@keyframes drift3 {
  0%, 100% { transform: translate(-50%, 0) scale(1); }
  50% { transform: translate(-35%, -14vh) scale(1.2); }
}
.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 50% 40%, #000 30%, transparent 80%);
}

/* ---------- Masthead ---------- */
.masthead {
  max-width: 1240px;
  margin: 0 auto;
  padding: 32px 28px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 16px; }
.brand__mark {
  display: grid;
  place-items: center;
  width: 56px; height: 56px;
  border-radius: 16px;
  background: var(--grad);
  box-shadow: 0 12px 30px -8px rgba(167, 139, 250, 0.6), inset 0 0 0 1px rgba(255,255,255,0.25);
}
.brand__mark svg { fill: #fff; }
.brand__text h1 {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.brand__text h1 span {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand__text p { color: var(--txt-dim); font-size: 0.92rem; }

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--panel-brd);
  background: rgba(255,255,255,0.03);
  color: var(--txt-dim);
  font-size: 0.82rem;
  text-decoration: none;
  backdrop-filter: blur(10px);
  transition: border-color .2s, color .2s, transform .2s;
}
.ghost-btn:hover { border-color: var(--panel-brd-hi); color: var(--txt); transform: translateY(-1px); }
.dot-live {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

/* ---------- Layout ---------- */
.layout {
  max-width: 1240px;
  margin: 0 auto;
  padding: 22px 28px 40px;
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 26px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-brd);
  border-radius: var(--radius);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  box-shadow: var(--shadow);
}
.panel--controls { padding: 8px; }
.panel--preview {
  position: sticky;
  top: 22px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ---------- Blocks ---------- */
.block {
  padding: 22px;
  border-bottom: 1px solid var(--panel-brd);
}
.block:last-child { border-bottom: none; }
.block__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.block__head h2 {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--txt);
}
.hint { font-size: 0.78rem; color: var(--txt-faint); }

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.tab {
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--panel-brd);
  background: rgba(255,255,255,0.02);
  color: var(--txt-dim);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .18s;
}
.tab:hover { color: var(--txt); border-color: var(--panel-brd-hi); }
.tab.is-active {
  color: #fff;
  border-color: transparent;
  background: var(--grad);
  box-shadow: 0 8px 22px -8px rgba(167,139,250,0.7);
}

/* ---------- Fields ---------- */
.fields { display: flex; flex-direction: column; gap: 14px; animation: fade .35s ease; }
.fields.is-hidden { display: none; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.field { display: flex; flex-direction: column; gap: 7px; flex: 1; }
.field > span, .field__label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--txt-dim);
}
.field-row { display: flex; gap: 14px; flex-wrap: wrap; }

input[type="text"], input[type="url"], input[type="email"],
input[type="tel"], textarea, select {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-brd);
  background: rgba(8, 7, 16, 0.6);
  color: var(--txt);
  font-size: 0.92rem;
  font-family: inherit;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
textarea { resize: vertical; min-height: 46px; }
input::placeholder, textarea::placeholder { color: var(--txt-faint); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
  background: rgba(8, 7, 16, 0.85);
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239a93b8' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
option { background: var(--bg-soft); color: var(--txt); }

.field--check {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  align-self: flex-end;
  padding-bottom: 12px;
}
.field--check input { width: auto; accent-color: var(--accent); width: 18px; height: 18px; }
.field--check span { color: var(--txt-dim); font-size: 0.85rem; }

/* ---------- Presets ---------- */
.presets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 10px;
}
.preset {
  position: relative;
  height: 52px;
  border-radius: 14px;
  border: 1px solid var(--panel-brd);
  cursor: pointer;
  overflow: hidden;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.preset:hover { transform: translateY(-2px) scale(1.02); border-color: var(--panel-brd-hi); }
.preset.is-active { border-color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,0.5), 0 10px 24px -10px rgba(0,0,0,0.8); }
.preset__name {
  position: absolute;
  inset: auto 0 0 0;
  font-size: 0.62rem;
  font-weight: 600;
  text-align: center;
  padding: 3px;
  background: rgba(0,0,0,0.45);
  color: #fff;
  backdrop-filter: blur(2px);
  letter-spacing: 0.02em;
}
.surprise {
  margin-top: 12px;
  width: 100%;
  padding: 11px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--panel-brd-hi);
  background: rgba(255,255,255,0.03);
  color: var(--txt);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .18s;
}
.surprise:hover { background: rgba(255,255,255,0.07); transform: translateY(-1px); }
.surprise:active { transform: scale(0.98); }

/* ---------- Chips ---------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 13px;
  border-radius: 10px;
  border: 1px solid var(--panel-brd);
  background: rgba(255,255,255,0.02);
  color: var(--txt-dim);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}
.chip:hover { color: var(--txt); border-color: var(--panel-brd-hi); }
.chip.is-active {
  color: #fff;
  border-color: var(--accent);
  background: rgba(167, 139, 250, 0.18);
  box-shadow: inset 0 0 0 1px rgba(167,139,250,0.4);
}

/* ---------- Switch line + toggle ---------- */
.switch-line { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.toggle { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.toggle input { display: none; }
.toggle__track {
  width: 40px; height: 22px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  position: relative;
  transition: background .2s;
}
.toggle__thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s;
}
.toggle input:checked + .toggle__track { background: var(--grad); }
.toggle input:checked + .toggle__track .toggle__thumb { transform: translateX(18px); }
.toggle__label { font-size: 0.8rem; color: var(--txt-dim); }

/* ---------- Color swatches ---------- */
.color-row { display: flex; gap: 12px; margin-bottom: 14px; }
.swatch {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-brd);
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  transition: border-color .15s;
}
.swatch:hover { border-color: var(--panel-brd-hi); }
.swatch span { font-size: 0.8rem; color: var(--txt-dim); }
.swatch input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 34px; height: 34px;
  border: none;
  border-radius: 9px;
  background: none;
  cursor: pointer;
  padding: 0;
}
.swatch input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.swatch input[type="color"]::-webkit-color-swatch { border: 1px solid rgba(255,255,255,0.25); border-radius: 9px; }
.swatch.is-disabled { opacity: 0.4; pointer-events: none; }

/* ---------- Sliders ---------- */
.slider { margin-bottom: 16px; }
.slider:last-child { margin-bottom: 0; }
.slider label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--txt-dim);
  margin-bottom: 9px;
}
.slider label b { color: var(--txt); font-weight: 600; }
.slider.is-disabled { opacity: 0.4; pointer-events: none; }
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  background-size: var(--fill, 50%) 100%;
  background-repeat: no-repeat;
  background-color: rgba(255,255,255,0.1);
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  transition: transform .12s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.18); }
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
}

/* ---------- Logo drop ---------- */
.logo-drop {
  position: relative;
  border: 1.5px dashed var(--panel-brd-hi);
  border-radius: var(--radius-sm);
  padding: 18px;
  text-align: center;
  cursor: pointer;
  transition: border-color .18s, background .18s;
  margin-bottom: 16px;
}
.logo-drop:hover, .logo-drop.is-drag { border-color: var(--accent); background: rgba(167,139,250,0.06); }
.logo-drop__empty { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--txt-dim); }
.logo-drop__empty.is-hidden { display: none; }
.logo-drop__icon { font-size: 1.6rem; }
.logo-drop__empty b { color: var(--txt); }
.logo-drop__empty small { color: var(--txt-faint); font-size: 0.74rem; }
.logo-drop__preview { display: flex; align-items: center; justify-content: center; position: relative; }
.logo-drop__preview.is-hidden { display: none; }
.logo-drop__preview img {
  max-height: 64px; max-width: 64px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  padding: 6px;
}
.logo-remove {
  position: absolute;
  top: -8px; right: -8px;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: none;
  background: var(--accent-2);
  color: #fff;
  font-size: 0.8rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

/* ---------- Preview ---------- */
.preview-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--panel-brd);
  border-radius: var(--radius);
  padding: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.preview-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  padding: 8px;
}
.preview-glow {
  position: absolute;
  inset: 18%;
  border-radius: 30px;
  background: var(--grad);
  filter: blur(46px);
  opacity: 0.5;
  z-index: 0;
  transition: background .3s;
}
.qr-canvas {
  position: relative;
  z-index: 1;
  background: transparent;
  border-radius: 16px;
  overflow: hidden;
  line-height: 0;
  animation: pop .4s cubic-bezier(.2,.9,.3,1.3);
  max-width: 100%;
}
.qr-canvas canvas, .qr-canvas svg {
  display: block;
  width: 300px !important;
  height: 300px !important;
  max-width: 100%;
  border-radius: 14px;
}
@keyframes pop { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.preview-caption { color: var(--txt-dim); font-size: 0.85rem; }

/* ---------- Export ---------- */
.export { display: flex; flex-direction: column; gap: 12px; }
.export__row { display: flex; gap: 10px; }
.dl-btn {
  flex: 1;
  padding: 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-brd);
  background: rgba(255,255,255,0.04);
  color: var(--txt);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .16s;
}
.dl-btn:hover { background: rgba(255,255,255,0.09); transform: translateY(-1px); border-color: var(--panel-brd-hi); }
.dl-btn:active { transform: scale(0.97); }
.dl-btn--primary {
  border-color: transparent;
  background: var(--grad);
  color: #fff;
  box-shadow: 0 12px 28px -10px rgba(167,139,250,0.7);
}
.dl-btn--primary:hover { box-shadow: 0 16px 34px -10px rgba(167,139,250,0.85); }
.copy-btn {
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-brd);
  background: rgba(255,255,255,0.02);
  color: var(--txt-dim);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .16s;
}
.copy-btn:hover { color: var(--txt); border-color: var(--panel-brd-hi); background: rgba(255,255,255,0.05); }

.lib-error {
  color: #fca5a5;
  font-size: 0.84rem;
  text-align: center;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
}
.is-hidden { display: none !important; }

/* ---------- Footer ---------- */
.footer {
  max-width: 1240px;
  margin: 0 auto;
  padding: 10px 28px 40px;
  text-align: center;
  color: var(--txt-faint);
  font-size: 0.8rem;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(20, 17, 34, 0.95);
  border: 1px solid var(--panel-brd-hi);
  color: var(--txt);
  padding: 13px 22px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 100;
}
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Responsive ---------- */
@media (max-width: 940px) {
  .layout { grid-template-columns: 1fr; }
  .panel--preview { position: static; order: -1; }
}
@media (max-width: 560px) {
  .masthead { padding: 22px 18px 6px; }
  .layout { padding: 16px 18px 30px; }
  .block { padding: 18px; }
  .brand__text h1 { font-size: 1.3rem; }
  .ghost-btn { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .blob, .dot-live, .qr-canvas { animation: none !important; }
  * { transition-duration: 0.01ms !important; }
}
