:root {
  --brand: #0b5d3b;
  --gold: #c9a84c;
  --page-bg: #f8fafc;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
}

/* Global */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  width: 100%;
  max-width: 100%;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  font-family: 'Noto Kufi Arabic', sans-serif;
  background: var(--page-bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

img {
  display: block;
  max-width: 100%;
}

#root {
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Page */

.page {
  width: 100%;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 32px 16px;
}

.card {
  width: 100%;
  max-width: 980px;
  min-width: 0;
  padding: 24px;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.08);
}

/* Header */

.header {
  margin-bottom: 20px;
}

.header h1 {
  margin: 0;
  font-size: clamp(22px, 4vw, 28px);
  font-weight: 800;
  line-height: 1.4;
}

.header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}

/* Preview */

.preview-card {
  width: 100%;
  min-width: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 28px 12px;
  margin-bottom: 20px;
  overflow: hidden;
  background: #f3f4f6;
  border-radius: 20px;
}

/* Form */

.form-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.form-grid label {
  min-width: 0;
}

label span,
.section-label {
  display: block;
  margin-bottom: 8px;
  color: #374151;
  font-size: 14px;
  font-weight: 700;
}

input {
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 0 14px;
  outline: none;
  color: var(--text);
  background: #ffffff;
  border: 1.5px solid #d1d5db;
  border-radius: 14px;
  font-size: 16px;
}

input::placeholder {
  color: #9ca3af;
}

input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(11, 93, 59, 0.12);
}

/* Sections */

.section {
  width: 100%;
  margin-top: 18px;
}

.button-grid {
  width: 100%;
  display: grid;
  gap: 10px;
}

.category-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.design-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* Choice buttons */

.choice-btn {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 8px;
  color: #4b5563;
  background: #ffffff;
  border: 2px solid var(--border);
  border-radius: 14px;
  font-weight: 800;
  line-height: 1.3;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.choice-btn:hover {
  border-color: rgba(11, 93, 59, 0.45);
}

.choice-btn:focus-visible {
  outline: 3px solid rgba(11, 93, 59, 0.2);
  outline-offset: 2px;
}

.choice-btn.active {
  color: #ffffff;
  background: var(--brand);
  border-color: var(--brand);
  box-shadow: 0 6px 12px rgba(11, 93, 59, 0.18);
}

/* Design buttons */

.design-btn {
  width: 100%;
  min-width: 0;
  min-height: 94px;
  padding: 0;
  overflow: hidden;
  color: #374151;
  background: #ffffff;
  border: 2px solid var(--border);
  border-radius: 14px;
  font-weight: 800;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.design-btn:hover {
  border-color: rgba(11, 93, 59, 0.45);
}

.design-btn:focus-visible {
  outline: 3px solid rgba(11, 93, 59, 0.2);
  outline-offset: 2px;
}

.design-btn.active {
  border-color: var(--brand);
  box-shadow: 0 8px 18px rgba(11, 93, 59, 0.16);
  transform: scale(1.01);
}

.design-btn span {
  display: block;
  padding: 8px 6px;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.4;
}

/* Small template previews */

.mini-preview {
  width: 100%;
  height: 52px;
  background:
    linear-gradient(
      90deg,
      #ffffff 0 46%,
      transparent 46% 47%,
      #ffffff 47% 94%,
      #e5e7eb 94%
    ),
    #ffffff;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  border-bottom: 1px solid var(--border);
}

.mini-photo {
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

/* Plate system */

.plate-preview-system {
  --plate-w: 700px;
  --plate-h: 147px;
  --plate-ratio-w: 700;
  --plate-ratio-h: 147;

  --plate-shadow:
    -2px -2px #ffffff,
    2px 2px rgba(0, 0, 0, 0.1);

  --plate-base: #fefefe;
  --plate-side-bg: #fefefe;
  --plate-divider: #231e20;

  /* Browser fallback */
  --plate-num-ar: clamp(24px, 8vw, 70px);
  --plate-num-en: clamp(24px, 6.2vw, 60px);
  --plate-letter-ar: clamp(24px, 8vw, 70px);
  --plate-letter-en: clamp(24px, 6.2vw, 70px);
  --plate-letter-spacing: clamp(3px, 1.8vw, 20px);

  width: min(100%, var(--plate-w));
  max-width: 100%;
  min-width: 0;
  display: block;
  container-type: inline-size;
  direction: ltr;
  user-select: none;
}

/* Resize plate text based on plate width */

@supports (font-size: 10cqw) {
  .plate-preview-system {
    --plate-num-ar: clamp(18px, 10cqw, 70px);
    --plate-num-en: clamp(18px, 8.5cqw, 60px);
    --plate-letter-ar: clamp(18px, 10cqw, 70px);
    --plate-letter-en: clamp(18px, 9.5cqw, 70px);
    --plate-letter-spacing: clamp(2px, 2.5cqw, 20px);
  }
}

/* Plate categories */

.plate-kind-private-transport {
  --plate-side-bg: #1888d7;
}

.plate-kind-public-transport {
  --plate-side-bg: #f1c72a;
}

.plate-kind-motorcycle {
  --plate-w: 320px;
  --plate-h: 205px;
  --plate-ratio-w: 320;
  --plate-ratio-h: 205;

  --plate-num-ar: clamp(22px, 9vw, 62px);
  --plate-num-en: clamp(20px, 7vw, 48px);
  --plate-letter-ar: clamp(20px, 7vw, 50px);
  --plate-letter-en: clamp(18px, 5.5vw, 34px);
}

@supports (font-size: 10cqw) {
  .plate-kind-motorcycle {
    --plate-num-ar: clamp(18px, 16cqw, 62px);
    --plate-num-en: clamp(17px, 13cqw, 48px);
    --plate-letter-ar: clamp(17px, 14cqw, 50px);
    --plate-letter-en: clamp(16px, 10cqw, 34px);
  }
}

/* Plate shell */

.plate-shell {
  position: relative;
  width: 100%;
  height: auto;
  aspect-ratio: var(--plate-ratio-w) / var(--plate-ratio-h);
  overflow: hidden;
  isolation: isolate;
  background: var(--plate-base);
  border-radius: 10px;
  touch-action: manipulation;
}

.plate-flat-bg,
.plate-photo-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
}

.plate-flat-bg {
  background: #fefefe;
}

.plate-photo-bg {
  background-color: #ffffff;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

/* Center logo */

.plate-center-image {
  position: absolute;
  top: 49.1%;
  left: 47.3%;
  z-index: 5;
  width: clamp(24px, 5vw, 70px);
  height: clamp(24px, 5vw, 70px);
  object-fit: contain;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

@supports (width: 10cqw) {
  .plate-center-image {
    width: clamp(22px, 10cqw, 70px);
    height: clamp(22px, 10cqw, 70px);
  }
}

/* Plate grid */

.plate-overlay-grid {
  position: absolute;
  inset: 0.8px;
  z-index: 2;
  display: grid;
  align-items: stretch;
  gap: 0;
  overflow: hidden;
  direction: ltr;
  border: 2px solid var(--plate-divider);
  border-radius: 6px;
}

.plate-overlay-standard-grid {
  grid-template-columns: 45fr 45fr 5fr;
}

.plate-overlay-special-grid {
  grid-template-columns: 50fr 20fr 50fr 0fr;
  border: none;
}

.plate-stack {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 1fr 1fr;
  overflow: hidden;
  background: transparent;
}

.plate-row {
  min-width: 0;
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  color: #000000;
  line-height: 1;
  white-space: nowrap;
  text-shadow: var(--plate-shadow);
}

.plate-stack .plate-row + .plate-row {
  border-top: 1.5px solid var(--plate-divider);
}

/* Arabic letters */

.plate-stack-letters .plate-row-ar {
  font-family: 'Lateef', cursive !important;
  font-size: var(--plate-letter-ar);
  letter-spacing: clamp(3px, 1.4vw, 10px);
  transform: translate(
    clamp(-8px, -1vw, -3px),
    clamp(-7px, -0.8vw, -3px)
  );
}

@supports (letter-spacing: 1cqw) {
  .plate-stack-letters .plate-row-ar {
    letter-spacing: clamp(2px, 1.4cqw, 10px);
  }
}

/* English letters */

.plate-row-en {
  direction: ltr;
  font-family: 'Barlow Condensed', sans-serif !important;
  font-size: var(--plate-letter-en);
  font-weight: 100;
  letter-spacing: var(--plate-letter-spacing);
}

/* Arabic numbers */

.plate-stack-numbers .plate-row-ar {
  direction: ltr;
  unicode-bidi: isolate;
  font-family: 'Lateef', cursive !important;
  font-size: var(--plate-num-ar);
  letter-spacing: clamp(1px, 0.6vw, 4px);
  transform: translate(
    clamp(-4px, -0.6vw, -2px),
    clamp(3px, 0.5vw, 5px)
  );
}

@supports (letter-spacing: 1cqw) {
  .plate-stack-numbers .plate-row-ar {
    letter-spacing: clamp(1px, 0.6cqw, 4px);
  }
}

/* English numbers */

.plate-stack-numbers .plate-row-en {
  font-size: var(--plate-num-en);
  letter-spacing: clamp(2px, 1vw, 7px);
}

@supports (letter-spacing: 1cqw) {
  .plate-stack-numbers .plate-row-en {
    letter-spacing: clamp(1px, 1cqw, 7px);
  }
}

/* Dividers */

.plate-overlay-standard-grid .plate-stack-numbers,
.plate-overlay-special-grid .plate-stack-numbers {
  border-right: 1.5px solid var(--plate-divider);
}

.plate-overlay-standard-grid .plate-stack-letters {
  border-right: 1.5px solid var(--plate-divider);
}

.plate-center-gap {
  background: transparent;
  border-right: 1.5px solid var(--plate-divider);
  border-left: 1.5px solid var(--plate-divider);
}

/* Remove lines from designed plates */

.plate-designed .plate-overlay-grid {
  border: none !important;
}

.plate-designed .plate-stack .plate-row + .plate-row {
  border-top: none !important;
}

.plate-designed .plate-overlay-standard-grid .plate-stack-numbers,
.plate-designed .plate-overlay-special-grid .plate-stack-numbers,
.plate-designed .plate-overlay-standard-grid .plate-stack-letters,
.plate-designed .plate-overlay-special-grid .plate-stack-letters,
.plate-designed .plate-center-gap {
  border: none !important;
}

/* Side strip */

.plate-side-strip {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: var(--plate-side-bg);
}

.plate-side-fill {
  position: absolute;
  inset: 0;
  background: var(--plate-side-bg);
}

.plate-side-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Sport design */

.plate-sport .plate-row-en {
  font-size: clamp(28px, 9vw, 100px);
  letter-spacing: clamp(5px, 1.4vw, 32px);
  transform: translateX(8px);
}

@supports (font-size: 10cqw) {
  .plate-sport .plate-row-en {
    font-size: clamp(24px, 12cqw, 85px);
    letter-spacing: clamp(4px, 3cqw, 22px);
    transform: none;
  }
}

/* Tablet and mobile */

@media (max-width: 760px) {
  .page {
    padding: 14px 8px;
  }

  .card {
    padding: 14px;
    border-radius: 18px;
  }

  .header {
    margin-bottom: 16px;
  }

  .header h1 {
    font-size: 23px;
  }

  .header p {
    font-size: 13px;
  }

  .preview-card {
    padding: 18px 6px;
    margin-bottom: 16px;
    border-radius: 16px;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .category-grid,
  .design-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .choice-btn {
    height: 42px;
    padding: 0 5px;
    font-size: 12px;
  }

  .design-btn {
    min-height: 86px;
  }

  .design-btn span {
    padding: 7px 4px;
    font-size: 11px;
  }

  .mini-preview {
    height: 48px;
  }
}

/* Small iPhones */

@media (max-width: 420px) {
  .page {
    padding: 10px 6px;
  }

  .card {
    padding: 10px;
    border-radius: 16px;
  }

  .header h1 {
    font-size: 21px;
  }

  .preview-card {
    padding: 15px 4px;
  }

  .button-grid {
    gap: 7px;
  }

  .choice-btn {
    height: 40px;
    font-size: 11px;
  }

  .design-btn {
    min-height: 80px;
  }

  .design-btn span {
    font-size: 10px;
  }

  .mini-preview {
    height: 44px;
  }

  input {
    height: 46px;
    font-size: 16px;
  }
}

/* Very narrow devices */

@media (max-width: 340px) {
  .category-grid,
  .design-grid {
    grid-template-columns: 1fr;
  }
}

.plate-text-zones {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.plate-position-box {
  position: absolute;
  display: grid;
  place-items: center;
  padding: 0;
  overflow: hidden;
  container-type: size;

  color: #000000;;
  background: transparent;
  border: none;
  text-shadow: var(--plate-shadow);
}

.plate-character-group {
  height: 90%;
  display: grid;
  align-items: center;
  justify-items: center;
  direction: inherit;
  white-space: nowrap;
}

/* Same group width for Arabic and English */
.plate-character-group[data-count="1"] {
  width: 30%;
  grid-template-columns: 1fr;
}

.plate-character-group[data-count="2"] {
  width: 58%;
  grid-template-columns: repeat(2, 1fr);
}

.plate-character-group[data-count="3"] {
  width: 82%;
  grid-template-columns: repeat(3, 1fr);
}

.plate-character-group[data-count="4"] {
  width: 90%;
  grid-template-columns: repeat(4, 1fr);
}

/* Make numbers closer together */
.numbers-ar-box .plate-character-group[data-count="1"],
.numbers-en-box .plate-character-group[data-count="1"] {
  width: 20%;
}

.numbers-ar-box .plate-character-group[data-count="2"],
.numbers-en-box .plate-character-group[data-count="2"] {
  width: 40%;
}

.numbers-ar-box .plate-character-group[data-count="3"],
.numbers-en-box .plate-character-group[data-count="3"] {
  width: 60%;
}

.numbers-ar-box .plate-character-group[data-count="4"],
.numbers-en-box .plate-character-group[data-count="4"] {
  width: 80%;
}

/* Give four sport digits more horizontal room */
.design-sport .numbers-en-box .plate-character-group[data-count="4"] {
  width: 100%;
}
.design-sport .numbers-en-box .plate-character-group[data-count="3"] {
  width: 80%;
}
.design-sport .numbers-en-box .plate-character-group[data-count="2"] {
  width: 50%;
}

.plate-character {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;

  font-size: var(--character-size);
  line-height: 1;
  letter-spacing: 0;
  transform: translateY(
  calc(var(--character-y) + var(--glyph-y, 0%))
);
}

/* Arabic letters */
.letters-ar-box {
  direction: rtl;
  font-family: 'Lateef', cursive;
  font-weight: 700;

  --character-size: 110cqh;
  --character-y: -10%;
}

/* English letters */
.letters-en-box {
  direction: ltr;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 600;

  --character-size: 100cqh;
  --character-y: -5%;
}

/* Arabic numbers */
.numbers-ar-box {
  direction: ltr;
  font-family: 'Lateef', cursive;
  font-weight: 700;

  --character-size: 120cqh;
  --character-y: -4%;
}

/* English numbers */
.numbers-en-box {
  direction: ltr;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 600;

  --character-size: 105cqh;
  --character-y: -10%;
}

/* Hide old duplicated text while preserving plate borders */
.plate-overlay-grid .plate-row {
  color: transparent !important;
  text-shadow: none !important;
}

/* Sport plate only — English letters */
.design-sport .letters-en-box {
  --character-size: 120cqh;
  --character-y: -17%;
}

/* Sport plate only — English numbers */
.design-sport .numbers-en-box {
  --character-size: 120cqh;
  --character-y: -17%;
}

.design-sport .letters-en-box .plate-character-group {
  column-gap: 3%;
}

.design-sport .numbers-en-box {
  left: -10%;
}
/* =========================
   STANDARD
========================= */

.design-standard .letters-ar-box {
  top: 1%;
  right: 7.2%;
  width: 35.4%;
  height: 49%;
}

.design-standard .letters-en-box {
  bottom: 1%;
  right: 7.2%;
  width: 35.4%;
  height: 49%;
}

.design-standard .numbers-ar-box {
  top: 1%;
  left: 0.2%;
  width: 50%;
  height: 49%;
}

.design-standard .numbers-en-box {
  bottom: 1%;
  left: 0.2%;
  width: 50%;
  height: 49%;
}

/* =========================
   SWORDS BLACK & WHITE
========================= */

.design-swords_bw .letters-ar-box {
  top: 4%;
  right: 7.4%;
  width: 33%;
  height: 46%;
}

.design-swords_bw .letters-en-box {
  bottom: 4%;
  right: 7.4%;
  width: 33%;
  height: 46%;
}

.design-swords_bw .numbers-ar-box {
  top: 4%;
  left: 1%;
  width: 38.8%;
  height: 46%;
}

.design-swords_bw .numbers-en-box {
  bottom: 4%;
  left: 1%;
  width: 38.8%;
  height: 46%;
}

/* =========================
   SWORDS COLOR
========================= */

.design-swords_color .letters-ar-box {
  top: 3%;
  right: 7.1%;
  width: 33.5%;
  height: 48%;
}

.design-swords_color .letters-en-box {
  bottom: 1.3%;
  right: 7.1%;
  width: 33.5%;
  height: 48%;
}

.design-swords_color .numbers-ar-box {
  top: 3%;
  left: 0.65%;
  width: 39%;
  height: 48%;
}

.design-swords_color .numbers-en-box {
  bottom: 1.3%;
  left: 0.65%;
  width: 39%;
  height: 48%;
}

/* =========================
   VISION 2030
========================= */

.design-vision_2030 .letters-ar-box {
  top: 3%;
  right: 7.3%;
  width: 32%;
  height: 47%;
}

.design-vision_2030 .letters-en-box {
  bottom: 3%;
  right: 7.3%;
  width: 32%;
  height: 47%;
}

.design-vision_2030 .numbers-ar-box {
  top: 3%;
  left: 0.82%;
  width: 37.5%;
  height: 47%;
}

.design-vision_2030 .numbers-en-box {
  bottom: 3%;
  left: 0.82%;
  width: 37.5%;
  height: 47%;
}

/* =========================
   ALULA
========================= */

.design-alula .letters-ar-box {
  top: 3%;
  right: 7.3%;
  width: 32%;
  height: 47%;
}

.design-alula .letters-en-box {
  bottom: 3%;
  right: 7.3%;
  width: 32%;
  height: 47%;
}

.design-alula .numbers-ar-box {
  top: 3%;
  left: 0.82%;
  width: 37.5%;
  height: 47%;
}

.design-alula .numbers-en-box {
  bottom: 3%;
  left: 0.82%;
  width: 37.5%;
  height: 47%;
}

/* =========================
   DIRIYAH
========================= */

.design-diriyah .letters-ar-box {
  top: 3.7%;
  right: 7.3%;
  width: 30%;
  height: 46.5%;
}

.design-diriyah .letters-en-box {
  bottom: 3.3%;
  right: 7.3%;
  width: 30%;
  height: 47%;
}

.design-diriyah .numbers-ar-box {
  top: 3.7%;
  left: 0.9%;
  width: 35.3%;
  height: 46.5%;
}

.design-diriyah .numbers-en-box {
  bottom: 3.3%;
  left: 0.9%;
  width: 35.3%;
  height: 46.5%;
}

/* =========================
   SPORT
========================= */

.design-sport .letters-ar-box,
.design-sport .numbers-ar-box {
  display: none;
}

.design-sport .letters-en-box {
  top: 4.4%;
  right: 1%;
  width: 38.1%;
  height: 91.2%;
}

.design-sport .numbers-en-box {
  top: 4.4%;
  left: 1.4%;
  width: 44%;
  height: 91.2%;
}

/* Controls vertical line positions for خصوصي، نقل خاص، ونقل عام */
.plate-kind-private.design-standard .plate-overlay-standard-grid,
.plate-kind-private-transport.design-standard .plate-overlay-standard-grid,
.plate-kind-public-transport.design-standard .plate-overlay-standard-grid {
  grid-template-columns: 47.2fr 32.5fr 5.55fr;
}
/* Controls horizontal middle-line position for خصوصي، نقل خاص، ونقل عام */
.plate-kind-private.design-standard .plate-stack,
.plate-kind-private-transport.design-standard .plate-stack,
.plate-kind-public-transport.design-standard .plate-stack {
  grid-template-rows: 50% 50%;
}

/* Responsive line thickness for خصوصي، نقل خاص، ونقل عام */
.plate-kind-private.design-standard .plate-overlay-grid,
.plate-kind-private-transport.design-standard .plate-overlay-grid,
.plate-kind-public-transport.design-standard .plate-overlay-grid {
  border-width: clamp(2px, 0.6cqw, 4px);
}

.plate-kind-private.design-standard .plate-stack .plate-row + .plate-row,
.plate-kind-private-transport.design-standard .plate-stack .plate-row + .plate-row,
.plate-kind-public-transport.design-standard .plate-stack .plate-row + .plate-row {
  border-top-width: clamp(2px, 0.6cqw, 4px);
}

.plate-kind-private.design-standard .plate-stack-numbers,
.plate-kind-private-transport.design-standard .plate-stack-numbers,
.plate-kind-public-transport.design-standard .plate-stack-numbers,
.plate-kind-private.design-standard .plate-stack-letters,
.plate-kind-private-transport.design-standard .plate-stack-letters,
.plate-kind-public-transport.design-standard .plate-stack-letters {
  border-right-width: clamp(2px, 0.6cqw, 4px);
}

/* Arabic letter individual Y positions
   Negative = move up
   Positive = move down
*/

.letters-ar-box [data-char="ا"] { --glyph-y: 5%; }
.letters-ar-box [data-char="ب"] { --glyph-y: -10%; }
.letters-ar-box [data-char="ح"] { --glyph-y: -20%; }
.letters-ar-box [data-char="د"] { --glyph-y: 0%; }
.letters-ar-box [data-char="ر"] { --glyph-y: -15%; }
.letters-ar-box [data-char="س"] { --glyph-y: -10%; }
.letters-ar-box [data-char="ص"] { --glyph-y: -10%; }
.letters-ar-box [data-char="ط"] { --glyph-y: 3%; }
.letters-ar-box [data-char="ع"] { --glyph-y: -20%; }
.letters-ar-box [data-char="ق"] { --glyph-y: -5%; }
.letters-ar-box [data-char="ك"] { --glyph-y: 5%; }
.letters-ar-box [data-char="ل"] { --glyph-y: 0%; }
.letters-ar-box [data-char="م"] { --glyph-y: -20%; }
.letters-ar-box [data-char="ن"] { --glyph-y: -10%; }
.letters-ar-box [data-char="ه"] { --glyph-y: 0%; }
.letters-ar-box [data-char="و"] { --glyph-y: -15%; }
.letters-ar-box [data-char="ى"] { --glyph-y: -10%; }

/* Positions Logo Transparent.png on the new vertical line */
.plate-kind-private.design-standard .plate-center-image,
.plate-kind-private-transport.design-standard .plate-center-image,
.plate-kind-public-transport.design-standard .plate-center-image {
  left: 55%;
  top: 48%;
  transform: translate(-50%, -50%);
}

/* دباب only — text size */
.plate-kind-motorcycle .letters-ar-box {
  --character-size: 110cqh;
}

.plate-kind-motorcycle .letters-en-box {
  --character-size: 100cqh;
}

.plate-kind-motorcycle .numbers-ar-box {
  --character-size: 90cqh;
}

.plate-kind-motorcycle .numbers-en-box {
  --character-size: 80cqh;
}

/* دباب letters: maximum 2 */
.plate-kind-motorcycle .letters-ar-box .plate-character-group[data-count="1"],
.plate-kind-motorcycle .letters-en-box .plate-character-group[data-count="1"] {
  width: 100%;
}

.plate-kind-motorcycle .letters-ar-box .plate-character-group[data-count="2"],
.plate-kind-motorcycle .letters-en-box .plate-character-group[data-count="2"] {
  width: 80%;
}

/* دباب numbers: maximum 4 */
.plate-kind-motorcycle .numbers-ar-box .plate-character-group[data-count="1"],
.plate-kind-motorcycle .numbers-en-box .plate-character-group[data-count="1"] {
  width: 20%;
}

.plate-kind-motorcycle .numbers-ar-box .plate-character-group[data-count="2"],
.plate-kind-motorcycle .numbers-en-box .plate-character-group[data-count="2"] {
  width: 40%;
}

.plate-kind-motorcycle .numbers-ar-box .plate-character-group[data-count="3"],
.plate-kind-motorcycle .numbers-en-box .plate-character-group[data-count="3"] {
  width: 60%;
}

.plate-kind-motorcycle .numbers-ar-box .plate-character-group[data-count="4"],
.plate-kind-motorcycle .numbers-en-box .plate-character-group[data-count="4"] {
  width: 90%;
}

/* دباب فقط — موقع وسماكة خطوط اللوحة */

/* موقع الخطوط العمودية: أرقام | أحرف | الشريط الجانبي */
.plate-kind-motorcycle.design-standard .plate-overlay-standard-grid {
  grid-template-columns: 47fr 32fr 5fr;
  border-width: clamp(2px, 0.8cqw, 4px);
}

/* موقع الخط الأفقي: الصف العربي | الصف الإنجليزي */
.plate-kind-motorcycle.design-standard .plate-stack {
  grid-template-rows: 50% 50%;
}

/* سماكة الخط الأفقي */
.plate-kind-motorcycle.design-standard .plate-stack .plate-row + .plate-row {
  border-top-width: clamp(2px, 0.8cqw, 4px);
}

/* سماكة الخطوط العمودية */
.plate-kind-motorcycle.design-standard .plate-stack-numbers,
.plate-kind-motorcycle.design-standard .plate-stack-letters {
  border-right-width: clamp(2px, 0.8cqw, 4px);
}

/* دباب فقط — موقع وحجم الشعار */
.plate-kind-motorcycle.design-standard .plate-center-image {
  left: 55%;       /* موقع الخط العمودي بين الأرقام والحروف */
  top: 50%;        /* منتصف اللوحة رأسيًا */

  width: 18%;
  height: 55%;

  z-index: 5;      /* يجعل الشعار فوق الخطوط */
  object-fit: contain;
  transform: translate(-50%, -50%);
}

/* دباب فقط — تحريك الأرقام العربية رأسيًا */
.plate-kind-motorcycle .numbers-ar-box {
  --character-y: 5%;
}

/* دباب فقط — تحريك الأرقام الإنجليزية رأسيًا */
.plate-kind-motorcycle .numbers-en-box {
  --character-y: 5%;
}

/* The existing HTML plate remains the source.
   This generated PNG appears directly over it. */

#platePreview {
  position: relative;
}

.generated-plate-preview {
  position: absolute;
  inset: 0;
  z-index: 100;

  display: none;
  width: 100%;
  height: 100%;

  object-fit: fill;
  border-radius: 10px;

  -webkit-touch-callout: default;
  user-select: auto;
}

.generated-plate-preview.ready {
  display: block;
}

.plate-photo-image {
  position: absolute;
  inset: 0;
  z-index: 0;

  display: none;
  width: 100%;
  height: 100%;

  object-fit: fill;
  pointer-events: none;
  user-select: none;
}