@font-face{font-family:"IBM Plex Sans";src:url("../assets/fonts/IBMPlexSans-400.woff2") format("woff2");font-weight:400;font-style:normal;font-display:swap}
@font-face{font-family:"IBM Plex Sans";src:url("../assets/fonts/IBMPlexSans-500.woff2") format("woff2");font-weight:500;font-style:normal;font-display:swap}
@font-face{font-family:"IBM Plex Sans";src:url("../assets/fonts/IBMPlexSans-600.woff2") format("woff2");font-weight:600;font-style:normal;font-display:swap}
@font-face{font-family:"IBM Plex Mono";src:url("../assets/fonts/IBMPlexMono-400.woff2") format("woff2");font-weight:400;font-style:normal;font-display:swap}
@font-face{font-family:"IBM Plex Mono";src:url("../assets/fonts/IBMPlexMono-500.woff2") format("woff2");font-weight:500;font-style:normal;font-display:swap}
@font-face{font-family:"Chakra Petch";src:url("../assets/fonts/chakra-petch-latin-500-normal.woff2") format("woff2");font-weight:500;font-style:normal;font-display:swap}
@font-face{font-family:"Chakra Petch";src:url("../assets/fonts/chakra-petch-latin-600-normal.woff2") format("woff2");font-weight:600;font-style:normal;font-display:swap}
@font-face{font-family:"Chakra Petch";src:url("../assets/fonts/chakra-petch-latin-700-normal.woff2") format("woff2");font-weight:700;font-style:normal;font-display:swap}

:root {
  --navy: #0A0A3C;
  --navy-deep: #06062a;
  --indigo: #526ABE;
  --cream: #FFF5C3;
  --cyan: #0FF0FC;

  --surface: #0d0d44;
  --surface-2: #121255;
  --line: rgba(255, 245, 195, 0.14);
  --line-strong: rgba(255, 245, 195, 0.3);
  --text: #FFF5C3;
  --text-dim: rgba(255, 245, 195, 0.62);

  --head: 'Chakra Petch', system-ui, sans-serif;
  --body: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;

  --radius: 14px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { background: var(--navy); }

body {
  margin: 0;
  font-family: var(--body);
  color: var(--text);
  background: transparent;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  isolation: isolate;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(70vmax 55vmax at 100% 0%, rgba(82, 106, 190, 0.45), transparent 70%),
    radial-gradient(60vmax 50vmax at 0% 100%, rgba(82, 106, 190, 0.30), transparent 70%),
    linear-gradient(160deg, #0a0a3c 0%, #10155a 55%, #0a0a3c 100%);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px max(28px, calc((100% - 1380px) / 2 + 28px));
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  flex: none;
}

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

.brand-mark {
  width: 34px; height: 34px;
  flex: none;
  display: block;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-family: var(--head); font-size: 1.05rem; letter-spacing: 0.02em; }
.brand-text small { color: var(--text-dim); font-size: 0.74rem; font-family: var(--mono); }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 22px;
  padding: 22px 28px;
  align-items: start;
  max-width: 1380px;
  width: 100%;
  margin: 0 auto;
  flex: 1 1 auto;
}

.panel {
  background: rgba(16, 18, 74, 0.72);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(6px);
}

.preview { position: sticky; top: 22px; }

.field-group { padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.field-group:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }

h2 {
  font-family: var(--head);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cyan);
  margin: 0 0 14px;
  font-weight: 600;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-dim);
  flex: 1 1 0;
  min-width: 0;
}

.row { display: flex; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.row:last-child { margin-bottom: 0; }

.pane label { margin-bottom: 12px; }
.pane label:last-child { margin-bottom: 0; }

input[type="text"], input[type="url"], input[type="email"], input[type="tel"],
textarea, select {
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: rgba(6, 6, 42, 0.75);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 11px;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea { resize: vertical; font-family: var(--body); }

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(15, 240, 252, 0.16);
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%),
                    linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
  cursor: pointer;
}

option { background: var(--navy-deep); color: var(--text); }

label.check {
  flex-direction: row;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  padding-top: 20px;
}
label.check input { width: auto; accent-color: var(--cyan); }

input[type="range"] {
  appearance: none;
  background: transparent;
  padding: 0;
  height: 22px;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: rgba(255, 245, 195, 0.2);
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 15px; height: 15px; margin-top: -5.5px;
  border-radius: 50%;
  background: var(--cyan);
  border: 0;
}
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(255,245,195,0.2); }
input[type="range"]::-moz-range-thumb { width: 15px; height: 15px; border: 0; border-radius: 50%; background: var(--cyan); }

.colorwrap {
  display: block;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 4px;
  background: rgba(6, 6, 42, 0.75);
}
input[type="color"] {
  width: 100%; height: 30px;
  border: 0; padding: 0; background: none; cursor: pointer;
  border-radius: 6px;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 6px; }

.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }

.tab {
  font: inherit;
  font-size: 0.8rem;
  font-family: var(--head);
  font-weight: 500;
  color: var(--text-dim);
  background: rgba(6, 6, 42, 0.6);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.tab:hover { color: var(--text); border-color: var(--line-strong); }
.tab.is-active { color: var(--navy); background: var(--cyan); border-color: var(--cyan); font-weight: 600; }

.pane { display: none; }
.pane.is-active { display: block; }

.presets { display: flex; gap: 8px; flex-wrap: wrap; }

.preset {
  font: inherit;
  font-size: 0.78rem;
  font-family: var(--head);
  color: var(--text);
  background: rgba(6, 6, 42, 0.6);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 12px;
  cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  transition: all 0.15s;
}
.preset:hover { border-color: var(--cyan); }
.preset .swatch {
  width: 14px; height: 14px; border-radius: 4px; flex: none;
  border: 1px solid rgba(255,255,255,0.18);
}

.brandlock {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 13px 15px;
  margin-bottom: 14px;
  background: rgba(15, 240, 252, 0.05);
}

#logo-preview {
  width: 48px; height: 48px;
  flex: none;
  border-radius: 10px;
  object-fit: contain;
}

.brandlock-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.brandlock-text strong { font-family: var(--head); font-size: 0.86rem; font-weight: 600; }
.brandlock-text span { font-size: 0.76rem; color: var(--text-dim); line-height: 1.4; }

.preview-stage {
  background:
    linear-gradient(45deg, rgba(255,245,195,0.055) 25%, transparent 25%, transparent 75%, rgba(255,245,195,0.055) 75%),
    linear-gradient(45deg, rgba(255,245,195,0.055) 25%, transparent 25%, transparent 75%, rgba(255,245,195,0.055) 75%);
  background-size: 18px 18px;
  background-position: 0 0, 9px 9px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 18px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}

.qr-holder { width: 100%; max-width: 330px; }
.qr-holder svg { width: 100%; height: auto; display: block; border-radius: 6px; }

.readout {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--text-dim);
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  margin-bottom: 12px;
}
.readout b { color: var(--cyan); font-weight: 500; }

.warning {
  font-size: 0.8rem;
  line-height: 1.45;
  border-radius: 9px;
  padding: 10px 12px;
  margin-bottom: 14px;
  border: 1px solid;
}
.warning.danger { background: rgba(255, 90, 90, 0.1); border-color: rgba(255, 120, 120, 0.5); color: #ffd4d4; }
.warning.caution { background: rgba(255, 196, 0, 0.09); border-color: rgba(255, 210, 90, 0.45); color: #ffeab5; }

.export .row { margin-bottom: 12px; }
.buttons { display: flex; gap: 9px; flex-wrap: wrap; }

button.primary, button.secondary, button.ghost {
  font: inherit;
  font-family: var(--head);
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 9px;
  padding: 10px 16px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  flex: 1 1 auto;
}
button.primary { background: var(--cyan); color: var(--navy); }
button.primary:hover { filter: brightness(1.1); }
button.secondary { background: transparent; color: var(--text); border-color: var(--line-strong); }
button.secondary:hover { border-color: var(--cyan); color: var(--cyan); }
button.ghost {
  background: transparent; color: var(--text-dim);
  border-color: var(--line); font-weight: 500; font-size: 0.8rem;
  padding: 8px 12px; flex: 0 0 auto;
}
button.ghost:hover { color: var(--text); border-color: var(--line-strong); }

.footnote {
  margin: 14px 0 0;
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--text-dim);
}

.sitefoot {
  text-align: center;
  padding: 10px 20px 28px;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-dim);
}

@media (max-width: 940px) {
  .layout { grid-template-columns: 1fr; padding: 18px; }
  .preview { position: static; order: -1; }
  .topbar { padding: 16px 18px; }
}

@media (max-width: 560px) {
  .row { gap: 10px; }
  .row > label { flex: 1 1 100%; }
  label.check { padding-top: 0; }
  .buttons button { flex: 1 1 100%; }
}

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
a.brand { color: inherit; text-decoration: none; }
a.brand:hover .brand-text strong { color: var(--cyan); }
.sitefoot a { color: inherit; text-decoration: none; }
.sitefoot a:hover { color: var(--text); text-decoration: underline; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.sitefoot { flex: none; }

@media (min-width: 941px) {
  body { height: 100vh; height: 100dvh; overflow: hidden; }
  .layout { min-height: 0; height: 100%; align-items: stretch; }
  .panel { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
  .preview { position: static; display: flex; flex-direction: column; }
  .preview-stage { flex: 1 1 auto; min-height: 0; }
  .qr-holder { max-width: max(190px, min(360px, calc(100dvh - 440px))); }
  .sitefoot { padding: 6px 20px 14px; }
}

@media (max-width: 940px) {
  .qr-holder { max-width: min(330px, 42dvh); }
}

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { 0% { transform: scale(0.96); opacity: 0.55; } 100% { transform: scale(1); opacity: 1; } }
@keyframes slide { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(15, 240, 252, 0); } 50% { box-shadow: 0 0 0 6px rgba(15, 240, 252, 0.12); } }

@media (prefers-reduced-motion: no-preference) {
  .topbar { animation: fade 0.5s ease both; }
  .brand-mark { transition: transform 0.35s cubic-bezier(.2,.8,.2,1); }
  a.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.06); }
  .panel { animation: rise 0.55s cubic-bezier(.2,.8,.2,1) both; }
  .preview { animation-delay: 0.08s; }
  .controls .field-group { animation: rise 0.5s cubic-bezier(.2,.8,.2,1) both; }
  .controls .field-group:nth-child(1) { animation-delay: 0.12s; }
  .controls .field-group:nth-child(2) { animation-delay: 0.17s; }
  .controls .field-group:nth-child(3) { animation-delay: 0.22s; }
  .controls .field-group:nth-child(4) { animation-delay: 0.27s; }
  .controls .field-group:nth-child(5) { animation-delay: 0.32s; }
  .controls .field-group:nth-child(6) { animation-delay: 0.37s; }
  .pane.is-active { animation: slide 0.25s ease both; }
  .qr-holder { transition: transform 0.25s ease; }
  .qr-holder.is-fresh { animation: pop 0.35s cubic-bezier(.2,.8,.2,1); }
  .preview-stage:hover .qr-holder { transform: scale(1.015); }
  .warning:not([hidden]) { animation: slide 0.25s ease both; }
  .preset, .tab, button.primary, button.secondary, button.ghost { transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, filter 0.15s ease; }
  .preset:hover, button.primary:hover, button.secondary:hover { transform: translateY(-1px); }
  .preset:active, .tab:active, button.primary:active, button.secondary:active, button.ghost:active { transform: scale(0.97); }
  .preset .swatch { transition: transform 0.2s ease; }
  .preset:hover .swatch { transform: scale(1.18) rotate(8deg); }
  button.primary { animation: glow 2.8s ease-in-out 1.2s 2; }
  input[type="range"]::-webkit-slider-thumb { transition: transform 0.15s ease; }
  input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.25); }
}

.range { display: flex; align-items: center; gap: 8px; }
.range input[type="range"] { flex: 1 1 auto; min-width: 0; }
.range-step {
  flex: none;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  font: 600 1rem/1 var(--mono);
  color: var(--text);
  background: rgba(6, 6, 42, 0.6);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
}
.range-step:hover { border-color: var(--cyan); color: var(--cyan); }
@media (prefers-reduced-motion: no-preference) {
  .range-step { transition: transform 0.15s ease, border-color 0.15s ease, color 0.15s ease; }
  .range-step:active { transform: scale(0.9); }
}

.size { display: flex; align-items: center; gap: 8px; }
.size input[type="number"] {
  font: inherit; font-size: 0.9rem; font-family: var(--mono);
  color: var(--text); background: rgba(6, 6, 42, 0.75);
  border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 10px; width: 100%; min-width: 0; flex: 1 1 0;
  -moz-appearance: textfield; appearance: textfield;
}
.size input[type="number"]::-webkit-outer-spin-button,
.size input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.size input[type="number"]:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(15, 240, 252, 0.16); }
.size-x { color: var(--text-dim); font-family: var(--mono); flex: none; }
.size select { flex: 0 0 78px; width: 78px; }
.size-note { margin: -4px 0 12px; font-size: 0.74rem; color: var(--text-dim); font-family: var(--mono); line-height: 1.5; }
.size-note.is-bad { color: #ffd4d4; }

.fname { display: flex; align-items: center; gap: 8px; }
.fname input { flex: 1 1 auto; min-width: 0; font-family: var(--mono); font-size: 0.85rem; }
.fname input::placeholder { color: var(--text-dim); opacity: 0.8; }
.fname-ext { flex: none; font-family: var(--mono); font-size: 0.74rem; color: var(--text-dim); }

@font-face{font-family:"IBM Plex Sans Arabic";src:url("../assets/fonts/IBMPlexSansArabic-400.woff2") format("woff2");font-weight:400;font-style:normal;font-display:swap}
@font-face{font-family:"IBM Plex Sans Arabic";src:url("../assets/fonts/IBMPlexSansArabic-600.woff2") format("woff2");font-weight:600;font-style:normal;font-display:swap}
@font-face{font-family:"Kufam";src:url("../assets/fonts/kufam-arabic-500-normal.woff2") format("woff2");font-weight:500;font-style:normal;font-display:swap}
@font-face{font-family:"Kufam";src:url("../assets/fonts/kufam-arabic-600-normal.woff2") format("woff2");font-weight:600;font-style:normal;font-display:swap}

:root:lang(ar) {
  --head: 'Kufam', 'Chakra Petch', system-ui, sans-serif;
  --body: 'IBM Plex Sans Arabic', 'IBM Plex Sans', system-ui, sans-serif;
}
:lang(ar) h2 { letter-spacing: 0; font-size: 0.86rem; }
:lang(ar) .brand-text strong { font-family: 'Chakra Petch', system-ui, sans-serif; }
:lang(ar) .brand-text small { font-family: var(--body); }
:lang(ar) .sitefoot { font-family: var(--body); }

select:dir(rtl) {
  background-position: 12px 50%, 17px 50%;
  padding-right: 11px;
  padding-left: 30px;
}
:lang(ar) .readout, :lang(ar) .size-note { font-family: var(--body); }

.langlink {
  font-family: var(--head);
  font-size: 0.82rem;
  color: var(--text-dim);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
}
.langlink:lang(ar) { font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif; }
.langlink:hover { color: var(--cyan); border-color: var(--cyan); }

.hint { margin: -4px 0 12px; font-size: 0.74rem; line-height: 1.5; color: var(--text-dim); }

.buttons--small { margin-top: 9px; }
.buttons--small button.ghost { flex: 1 1 0; }
button.ghost.is-done { color: var(--cyan); border-color: var(--cyan); }

@media (min-width: 941px) {
  .preview-stage { flex: 1 0 auto; }
  .qr-holder { max-width: max(190px, min(360px, calc(100dvh - 610px))); }
}
@media (max-width: 560px) {
  .buttons--small button.ghost { flex: 1 1 0; }
}
.buttons--small button.ghost { white-space: nowrap; padding-inline: 8px; }
