 @font-face {
  font-family: 'Thmanyah Serif Text';
  src: url('thmanyahseriftext-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
 * { box-sizing: border-box; }
  body {
    margin: 0;
    background: #E8DCCB;
    color: #4B4036;
    font-family: 'Tajawal', sans-serif;
    line-height: 1.6;
    padding: 28px 16px 60px;
  }

.wrap {
  max-width: 1100px;
  margin: 0 auto;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1040px;
  margin: 0 auto 32px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(183, 154, 107, 0.35);
  background: rgba(250, 248, 243, 0.12);
  border-radius: 16px 16px 0 0;
}

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

.logo {
  width: 88px;
  height: 88px;
  object-fit: contain;
}

.brand-name {
  font-family: 'Aref Ruqaa', serif;
  font-size: 20px;
  font-weight: 700;
  color: #4B4036;
}

.header-sub {
  display: none;
}

.social-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.linkedin-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  background: transparent;
  color: #B79A6B;
  border: 1px solid #B79A6B;
  text-decoration: none;
  font-family: 'Tajawal', sans-serif;
  font-size: 13px;
  font-weight: 700;
  transition: background .2s ease, color .2s ease, transform .2s ease;
}

.linkedin-link:hover {
  background: #B79A6B;
  color: #4B4036;
  transform: translateY(-1px);
}

button:focus-visible,
.chip:focus-visible,
.swatch:focus-visible,
textarea:focus-visible,
.linkedin-link:focus-visible,
.social-links a:focus-visible {
  outline: 3px solid rgba(111, 127, 92, 0.55);
  outline-offset: 2px;
}

  .grid {
    display: grid;
    grid-template-columns: minmax(0,1.1fr) minmax(280px, 0.9fr);
    gap: 28px;
    align-items: start;
  }

  .preview {
    background: #FAF8F3;
    border: 1px solid rgba(183, 154, 107, 0.7);
    border-radius: 20px;
    padding: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 14px 30px rgba(75, 64, 54, 0.08);
  }
  #canvas {
    width: 100%;
    max-width: 460px;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 20px 45px rgba(0,0,0,0.35);
    display: block;
  }
  #canvas.story { max-width: 320px; }

  .controls {
    display: flex;
    flex-direction: column;
    gap: 18px;
  }

  .controls section {
    background: rgba(250, 248, 243, 0.22);
    border: 1px solid rgba(183, 154, 107, 0.3);
    border-radius: 16px;
    padding: 16px 14px;
  }

  section h2 {
    font-size: 15px;
    color: #4B4036;
    margin: 0 0 12px;
    font-weight: 700;
  }

  .chips { display: flex; flex-wrap: wrap; gap: 8px; }
  .chip {
    padding: 9px 14px;
    border-radius: 999px;
    font-size: 14px;
    border: 1px solid #B79A6B;
    background: #FAF8F3;
    color: #4B4036;
    cursor: pointer;
    transition: transform .15s ease, background .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease;
  }
  .chip:hover { transform: translateY(-1px); }
  .chip.active {
    background: #B79A6B;
    color: #4B4036;
    border-color: #B79A6B;
    box-shadow: 0 8px 18px rgba(183, 154, 107, 0.25);
  }
  .chip.dhikr { font-family: 'Aref Ruqaa', serif; }

  textarea {
    margin-top: 12px;
    width: 100%;
    border-radius: 12px;
    border: 1px solid #B79A6B;
    background: #FAF8F3;
    color: #4B4036;
    padding: 12px 14px;
    font-family: 'Thmanyah Serif Text', serif;
    font-size: 18px;
    resize: vertical;
    box-shadow: inset 0 1px 2px rgba(75, 64, 54, 0.04);
  }

  .custom-font-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: #4B4036;
    font-size: 13px;
    font-weight: 700;
    opacity: 1;
    transition: opacity .2s ease;
  }

  .custom-font-wrap.disabled {
    opacity: 0.55;
  }

  .custom-font-wrap h2 {
    margin: 0;
    font-size: 15px;
  }

  .custom-font-wrap input[type="range"] {
    width: 100%;
    accent-color: #6F7F5C;
    cursor: pointer;
  }

  .custom-font-wrap input[type="range"]:disabled {
    cursor: not-allowed;
    opacity: 0.6;
  }

  .bg-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }
  .swatch {
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  }
  .swatch:hover { transform: translateY(-2px); }
  .swatch.active {
    border-color: #6f7f5c;
    box-shadow: 0 8px 18px rgba(111, 127, 92, 0.2);
  }
  .swatch .color { height: 58px; }
  .swatch .label {
    font-size: 14px;
    text-align: center;
    padding: 6px 2px;
    background: #B79A6B;
    color: #FAF8F3;
  }

  #downloadBtn {
    margin-top: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #B79A6B;
    color: #4B4036;
    border: none;
    border-radius: 12px;
    padding: 14px 18px;
    font-family: 'Thmanyah Serif Text', serif;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
    box-shadow: 0 10px 20px rgba(183, 154, 107, 0.18);
  }

  #downloadBtn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(183, 154, 107, 0.22);
  }

  @media (max-width: 960px) {
    .grid { grid-template-columns: 1fr; }
    .preview { order: 1; }
    .controls { order: 2; }
  }

  @media (max-width: 480px) {
    body {
      padding: 18px 12px 40px;
    }
    header {
      margin-bottom: 18px;
      padding: 12px 14px;
    }
    .brand-name { font-size: 16px; }
    .logo { width: 68px; height: 68px; }
    .social-links .linkedin-link span { display: none; }
    .linkedin-link { padding: 8px; }
    .preview { padding: 14px; }
    .controls section { padding: 14px 12px; }
    .chip { padding: 8px 12px; font-size: 13px; }
    .swatch .color { height: 48px; }
  }