:root {
  --bg: #0b1220;
  --card: #111a2e;
  --accent: #6c5ce7;
  --accent-2: #00d2ff;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --border: #1e293b;
  --danger: #ef4444;
}

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

body {
  font-family: "Tajawal", system-ui, sans-serif;
  background:
    radial-gradient(1000px 400px at 80% -10%, rgba(108,92,231,.25), transparent),
    radial-gradient(700px 350px at 10% 110%, rgba(0,210,255,.15), transparent),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

.container { max-width: 720px; margin: 0 auto; padding: 2.5rem 1.25rem 3rem; }

.hero { text-align: center; margin-bottom: 2rem; }
.logo {
  width: 64px; height: 64px;
  margin: 0 auto 1rem;
  display: grid; place-items: center;
  font-size: 2rem; font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 18px;
  box-shadow: 0 12px 40px rgba(108, 92, 231, .45);
}
h1 { font-size: 2rem; font-weight: 800; }
h1 span {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p { color: var(--muted); margin-top: .25rem; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.75rem;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}

.field { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1.1rem; }
.field-label { font-size: .85rem; font-weight: 700; color: var(--muted); }

textarea, select {
  width: 100%;
  background: #0e1729;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .8rem 1rem;
  font-family: inherit;
  font-size: 1rem;
  transition: border-color .2s, box-shadow .2s;
  resize: vertical;
}
textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108,92,231,.25);
}
.hint { display: flex; justify-content: space-between; font-size: .78rem; color: var(--muted); }
.counter { direction: ltr; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.colors { grid-template-columns: 1fr 1fr auto; align-items: end; margin-bottom: 1.1rem; }
input[type="color"] {
  width: 100%; height: 46px;
  background: #0e1729;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  cursor: pointer;
}
.check { flex-direction: row; align-items: center; gap: .5rem; margin: 0; align-self: end; padding-bottom: 10px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }

.btn {
  width: 100%;
  padding: .95rem;
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: transform .15s, box-shadow .2s, opacity .2s;
  box-shadow: 0 8px 25px rgba(108,92,231,.4);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(108,92,231,.55); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.btn-ghost {
  width: auto;
  padding: .6rem 1.4rem;
  font-size: .95rem;
  background: transparent;
  border: 1.5px solid var(--accent);
  box-shadow: none;
}
.btn-ghost:hover { background: rgba(108,92,231,.15); box-shadow: none; }

.spinner {
  width: 20px; height: 20px;
  display: inline-block;
  border: 3px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

.result-card { margin-top: 1.75rem; }
.result-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.result-head h2 { font-size: 1.2rem; }
.qr-wrap {
  display: grid; place-items: center;
  background: #fff;
  border-radius: 16px;
  padding: 1.25rem;
}
.qr-wrap img { max-width: 100%; height: auto; image-rendering: pixelated; border-radius: 8px; }
.note { text-align: center; color: var(--muted); font-size: .85rem; margin-top: 1rem; }

.error-bar {
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  background: rgba(239,68,68,.12);
  border: 1px solid var(--danger);
  border-radius: 12px;
  color: #fca5a5;
  font-weight: 500;
  text-align: center;
}

footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 1rem 0 2rem; }

@media (max-width: 640px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .colors { grid-template-columns: 1fr 1fr; }
  h1 { font-size: 1.6rem; }
}