:root {
  --kasr-ink: #171713;
  --kasr-night: #11110f;
  --kasr-night-soft: #1b1b17;
  --kasr-paper: #f7f5ef;
  --kasr-card: #fff;
  --kasr-gold: #cda13b;
  --kasr-gold-dark: #98701c;
  --kasr-gold-soft: #f4ead0;
  --kasr-muted: #77746b;
  --kasr-line: #dfdbd1;
  --kasr-danger: #a63b32;
  --kasr-success: #267044;
  --kasr-shadow: 0 18px 55px rgba(31, 27, 18, .08);
  --kasr-radius: 18px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 92px;
}

body {
  margin: 0;
  color: var(--kasr-ink);
  font-family: Tahoma, "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Three-page app shell */
.home-page {
  min-height: 100vh;
  min-height: 100svh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% 5%, rgba(205, 161, 59, .14), transparent 25rem),
    linear-gradient(180deg, #fff 0%, #f8f5ed 100%);
}

.home-app {
  width: min(820px, calc(100% - 32px));
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  margin: auto;
  padding: max(44px, env(safe-area-inset-top)) 0 max(30px, env(safe-area-inset-bottom));
}

.home-brand-image {
  width: min(390px, 75vw);
  height: auto;
  max-height: 150px;
  display: block;
  margin-bottom: 54px;
  object-fit: contain;
}

.language-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.language-card {
  position: relative;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 13px;
  padding: 26px;
  border: 1px solid #e4ddcf;
  border-radius: 22px;
  background: rgba(255, 255, 255, .92);
  color: var(--kasr-ink);
  text-decoration: none;
  box-shadow: 0 20px 55px rgba(55, 45, 24, .08);
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}

.language-card:hover,
.language-card:focus-visible {
  border-color: var(--kasr-gold);
  background: #fffdf7;
  color: var(--kasr-ink);
  transform: translateY(-4px);
}

.language-symbol {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(205, 161, 59, .6);
  border-radius: 20px;
  background: var(--kasr-gold-soft);
  color: var(--kasr-gold);
  font: 36px Georgia, Tahoma, serif;
}

.language-card strong { font-size: 23px; }

.language-card > svg {
  position: absolute;
  right: 20px;
  bottom: 20px;
  color: var(--kasr-gold);
  font-size: 13px;
}

.language-card[dir="ltr"] > svg { right: auto; left: 20px; }

.download-fonts-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 44px;
  padding: 10px 14px;
  color: #6f6a5f;
  font-size: 12px;
  text-underline-offset: 5px;
}

.download-fonts-link:hover,
.download-fonts-link:focus-visible { color: var(--kasr-gold); }

.admin-corner {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  left: max(18px, env(safe-area-inset-left));
  z-index: 10;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid #ded7ca;
  border-radius: 12px;
  background: rgba(255,255,255,.8);
  color: #6f6a5f;
  text-decoration: none;
}

.admin-corner:hover { border-color: var(--kasr-gold); color: var(--kasr-gold); }

.fonts-page {
  min-height: 100vh;
  background: var(--kasr-paper);
  overflow-x: hidden;
}

.nav-back,
.nav-admin {
  width: 42px;
  height: 42px;
  display: grid;
  flex: 0 0 42px;
  place-items: center;
  border: 1px solid #ddd6c9;
  border-radius: 11px;
  background: #fff;
  color: #5e594f;
}

.nav-back:hover,
.nav-admin:hover { border-color: var(--kasr-gold); color: var(--kasr-gold); }

.fonts-main { min-height: calc(100vh - 78px); padding-top: 48px; padding-bottom: 90px; }

.fonts-heading { margin-bottom: 22px; }
.fonts-heading > div { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.fonts-heading h1 { margin: 0; font-size: 28px; font-weight: 800; }

.fonts-page .font-actions {
  position: sticky;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 20;
  width: max-content;
  max-width: 100%;
  margin: 25px auto 0;
  padding: 8px;
  border: 1px solid rgba(205, 161, 59, .28);
  border-radius: 17px;
  background: rgba(17, 17, 15, .9);
  box-shadow: 0 16px 45px rgba(0, 0, 0, .2);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.designer-modal .modal-dialog { max-width: min(1500px, calc(100% - 30px)); }
.designer-modal { overscroll-behavior: contain; }

.designer-modal .modal-content {
  overflow: hidden;
  border: 1px solid var(--kasr-line);
  border-radius: 22px;
  background: var(--kasr-paper);
  box-shadow: 0 35px 100px rgba(0, 0, 0, .28);
}

.designer-modal .modal-header {
  padding: 17px 22px;
  border-bottom-color: var(--kasr-line);
  background: #fff;
}

.designer-modal .modal-header .btn-close { margin: 0 auto 0 0; }
.designer-modal .modal-title { margin: 2px 0 0; font-size: 20px; font-weight: 800; }
.modal-kicker { color: var(--kasr-gold-dark); font-size: 10px; font-weight: 700; }
.modal-name-row { max-width: 650px; }
.modal-name-row .input-group > .btn { border-radius: 10px 0 0 10px; }
.modal-name-row .input-group > .form-control { border-radius: 0 10px 10px 0; }

@media (max-width: 767.98px) {
  .home-brand-image { margin-bottom: 37px; }
  .language-grid { grid-template-columns: 1fr; gap: 13px; }
  .language-card { min-height: 145px; flex-direction: row; }
  .language-symbol { width: 58px; height: 58px; border-radius: 16px; font-size: 29px; }
  .language-card strong { font-size: 20px; }
  .download-fonts-link { margin-top: 30px; }

  .fonts-main { padding-top: 32px; }
  .fonts-heading h1 { font-size: 23px; }
  .name-entry-panel { margin-bottom: 28px; padding: 15px; border-radius: 15px; }
  .name-entry-control .form-control { min-height: 55px; font-size: 18px; }
  .designer-modal .modal-dialog { max-width: none; }
  .designer-modal .modal-content { border: 0; border-radius: 0; }
  .designer-modal .modal-header { padding-top: max(14px, env(safe-area-inset-top)); }
  .designer-modal .modal-body { padding-bottom: max(24px, env(safe-area-inset-bottom)) !important; }
}

.site-body {
  background:
    radial-gradient(circle at 8% 16%, rgba(205, 161, 59, .07), transparent 25rem),
    var(--kasr-paper);
  overflow-x: hidden;
}

a,
button,
input,
select { -webkit-tap-highlight-color: transparent; }

a,
button,
.btn { touch-action: manipulation; }

.hidden { display: none !important; }

.app-navbar {
  min-height: 78px;
  padding: 0;
  border-bottom: 1px solid #e8e2d7;
  background: rgba(255, 255, 255, .95);
  box-shadow: 0 8px 25px rgba(43, 36, 21, .06);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.elkasr-brand {
  display: inline-flex;
  align-items: center;
  padding: 0;
  line-height: 0;
}

.elkasr-brand img {
  width: 166px;
  height: auto;
  max-height: 56px;
  object-fit: contain;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.navbar-actions .nav-link {
  align-items: center;
  gap: 7px;
  padding: 9px 11px;
  border-radius: 10px;
  color: #bbb7ad;
  font-size: 12px;
  text-decoration: none;
  transition: color .18s ease, background .18s ease;
}

.navbar-actions .nav-link:hover,
.navbar-actions .nav-link:focus-visible {
  background: rgba(255, 255, 255, .05);
  color: var(--kasr-gold);
}

.btn-admin {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border: 1px solid rgba(205, 161, 59, .5);
  border-radius: 10px;
  color: #e8dfcb;
  font-size: 11px;
}

.btn-admin:hover,
.btn-admin:focus-visible {
  border-color: var(--kasr-gold);
  background: var(--kasr-gold);
  color: #17130a;
}

.public-hero {
  padding: clamp(58px, 8vw, 92px) 0 54px;
}

.hero-crown {
  width: 48px;
  height: 43px;
  display: block;
  margin: 0 auto 12px;
  object-fit: contain;
}

.section-kicker {
  display: block;
  color: var(--kasr-gold-dark);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.7px;
}

.public-hero h1 {
  margin: 12px 0 13px;
  font-size: clamp(34px, 4.5vw, 56px);
  font-weight: 800;
  line-height: 1.3;
}

.public-hero p {
  max-width: 690px;
  margin: 0 auto;
  color: var(--kasr-muted);
  font-size: 15px;
  line-height: 1.9;
}

.hero-button { margin-top: 24px; }

.btn {
  border-radius: 11px;
  font-weight: 700;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-gold {
  border-color: var(--kasr-gold);
  background: linear-gradient(135deg, #d8ae4a, #c29027);
  color: #17130a;
  box-shadow: 0 9px 24px rgba(152, 112, 28, .17);
}

.btn-gold:hover,
.btn-gold:focus-visible {
  border-color: #b78622;
  background: linear-gradient(135deg, #e3bd5c, #c7972d);
  color: #17130a;
}

.btn-outline-gold {
  border-color: var(--kasr-gold);
  background: #fff;
  color: #805d14;
}

.btn-outline-gold:hover,
.btn-outline-gold.active {
  border-color: var(--kasr-gold);
  background: var(--kasr-gold-soft);
  color: #60450e;
}

.designer-container { padding-bottom: 102px; }

.app-card {
  border: 1px solid var(--kasr-line);
  border-radius: var(--kasr-radius);
  background: var(--kasr-card);
  box-shadow: var(--kasr-shadow);
}

.name-card {
  position: relative;
  border-top: 3px solid var(--kasr-gold);
  scroll-margin-top: 96px;
}

.form-label {
  margin-bottom: 7px;
  color: #48443b;
  font-size: 12px;
  font-weight: 700;
}

.form-label svg { margin-left: 4px; color: var(--kasr-gold-dark); }

.form-control,
.form-select,
.input-group-text {
  min-height: 48px;
  border-color: #d8d3c8;
  border-radius: 10px;
  color: var(--kasr-ink);
  font-size: 15px;
}

[dir="rtl"] .form-select {
  padding-right: .75rem;
  padding-left: 2.25rem;
  background-position: left .75rem center;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--kasr-gold);
  box-shadow: 0 0 0 .22rem rgba(205, 161, 59, .14);
}

.input-group > .form-control { border-radius: 0 10px 10px 0; }
.input-group > .input-group-text { border-radius: 10px 0 0 10px; background: #f6f3eb; color: var(--kasr-muted); font-size: 11px; }

.app-section { margin-top: 64px; }

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.section-heading > div {
  display: flex;
  align-items: center;
  gap: 13px;
}

.section-heading h2 {
  margin: 0;
  font-size: 25px;
  font-weight: 800;
}

.section-heading p {
  margin: 3px 0 0;
  color: var(--kasr-muted);
  font-size: 11px;
}

.step-badge {
  width: 46px;
  height: 46px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #e1d0a8;
  border-radius: 14px;
  background: var(--kasr-gold-soft);
  color: var(--kasr-gold-dark);
  font: italic 17px Georgia, serif;
}

.count-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 11px;
  border: 1px solid var(--kasr-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .68);
  color: var(--kasr-muted);
  font-size: 11px;
}

.font-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.font-card {
  position: relative;
  min-height: 178px;
  padding: 18px;
  border: 1px solid var(--kasr-line);
  border-radius: 16px;
  background: #fff;
  color: var(--kasr-ink);
  cursor: default;
  overflow: hidden;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.font-card:hover,
.font-card.selected {
  border-color: var(--kasr-gold);
  box-shadow: 0 15px 38px rgba(38, 31, 14, .1);
  transform: translateY(-2px);
}

.font-card.selected::after {
  content: "✓";
  position: absolute;
  left: 13px;
  top: 12px;
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--kasr-gold);
  color: #17130a;
  font-size: 13px;
  font-weight: 800;
}

.font-card:disabled { opacity: .58; cursor: not-allowed; }
.font-card-error { opacity: .62; }

.name-entry-panel {
  max-width: 760px;
  margin: 0 auto 38px;
  padding: 20px;
  border: 1px solid #e1dacc;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 16px 42px rgba(42, 34, 18, .07);
}

.name-entry-panel .form-label {
  display: block;
  margin-bottom: 10px;
  font-size: 13px;
}

.name-entry-control { position: relative; }
.name-entry-control .form-control {
  min-height: 58px;
  padding-right: 54px;
  border-radius: 13px;
  background: #fcfbf8;
  font-size: 20px;
}

.name-entry-control.is-ltr .form-control { padding-right: 16px; padding-left: 54px; }

.name-entry-icon {
  position: absolute;
  top: 50%;
  right: 17px;
  z-index: 3;
  color: var(--kasr-gold-dark);
  transform: translateY(-50%);
  pointer-events: none;
}

.name-entry-control.is-ltr .name-entry-icon { right: auto; left: 17px; }

.font-card-preview {
  width: 100%;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  border: 1px solid #ddd4c2;
  border-radius: 10px;
  background: #fbf8f0;
  color: #745719;
  font-size: 12px;
}

.font-card-preview:hover,
.font-card-preview:focus-visible {
  border-color: var(--kasr-gold);
  background: var(--kasr-gold-soft);
  color: #573f0d;
}

.font-preview {
  height: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.font-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-top: 13px;
  border-top: 1px solid #eeeae1;
  color: var(--kasr-muted);
  font-size: 11px;
}

.font-meta b { color: #4c483f; }

.font-actions { margin-top: 20px; text-align: center; }

.empty-state,
.empty {
  grid-column: 1 / -1;
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  border: 1px dashed #cec8bc;
  border-radius: 16px;
  color: var(--kasr-muted);
  text-align: center;
}

.canvas-toolbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--kasr-line);
  background: #fff;
}

.canvas-toolbar .btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  font-size: 11px;
}

.canvas-toolbar .btn.active {
  border-color: var(--kasr-gold);
  background: var(--kasr-gold);
  color: #17130a;
}

.toolbar-spacer { flex: 1 1 auto; }

.btn-tool {
  min-width: 42px;
  justify-content: center;
  border: 1px solid var(--kasr-line);
  background: #f8f6f1;
  color: #504c43;
}

.artboard-wrap {
  position: relative;
  min-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: auto;
  overscroll-behavior: none;
  background-color: #eeece6;
  background-image: linear-gradient(45deg, #e5e2dc 25%, transparent 25%), linear-gradient(-45deg, #e5e2dc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e5e2dc 75%), linear-gradient(-45deg, transparent 75%, #e5e2dc 75%);
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  background-size: 24px 24px;
}

#artboard {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid #d9d4ca;
  background: #fff;
  box-shadow: 0 10px 30px rgba(33, 28, 18, .08);
  touch-action: pan-y;
}

#artboard.move-mode,
html.design-dragging #artboard { touch-action: none !important; -webkit-user-select: none; user-select: none; }

html.design-dragging .designer-modal .modal-body { overflow: hidden !important; overscroll-behavior: none; touch-action: none; }

.preview-dimensions {
  position: absolute;
  top: 38px;
  left: 38px;
  z-index: 2;
  padding: 6px 10px;
  border: 1px solid rgba(205, 161, 59, .38);
  border-radius: 8px;
  background: rgba(17, 17, 15, .86);
  color: #f2cb6d;
  direction: ltr;
  font-size: 10px;
  pointer-events: none;
}

.hint {
  padding: 13px 18px;
  border-top: 1px solid var(--kasr-line);
  color: var(--kasr-muted);
  font-size: 11px;
  text-align: center;
}

.hint svg { margin-left: 5px; color: var(--kasr-gold-dark); }

.nudge-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 18px;
  border-top: 1px solid var(--kasr-line);
  background: #fffdf8;
}

.nudge-copy { min-width: 145px; display: grid; gap: 4px; }
.nudge-copy b { font-size: 13px; }
.nudge-copy span { color: var(--kasr-muted); font-size: 9px; }

.nudge-pad {
  width: 132px;
  height: 132px;
  display: grid;
  flex: 0 0 132px;
  grid-template-columns: repeat(3, 42px);
  grid-template-rows: repeat(3, 42px);
  gap: 3px;
  direction: ltr;
}

.nudge-arrow,
.nudge-center { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 11px; }

.nudge-arrow {
  border: 1px solid #d9d2c5;
  background: #fff;
  color: #3e392f;
  box-shadow: 0 4px 12px rgba(37,31,18,.06);
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.nudge-arrow:active { border-color: var(--kasr-gold); background: var(--kasr-gold); color: #17130a; transform: scale(.94); }
.nudge-up { grid-column: 2; grid-row: 1; }
.nudge-right { grid-column: 3; grid-row: 2; }
.nudge-center { grid-column: 2; grid-row: 2; background: var(--kasr-gold-soft); color: var(--kasr-gold-dark); }
.nudge-left { grid-column: 1; grid-row: 2; }
.nudge-down { grid-column: 2; grid-row: 3; }

.nudge-step { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.nudge-step > span { width: 100%; color: var(--kasr-muted); font-size: 9px; }
.nudge-step button { min-height: 36px; padding: 7px 9px; border: 1px solid #ddd6c9; border-radius: 9px; background: #fff; color: #5c564b; font-size: 10px; touch-action: manipulation; }
.nudge-step button.active { border-color: var(--kasr-gold); background: var(--kasr-gold-soft); color: #684c12; font-weight: 800; }

.settings-panel { overflow: hidden; }

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

.settings-title > span {
  width: 44px;
  height: 44px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 13px;
  background: var(--kasr-gold-soft);
  color: var(--kasr-gold-dark);
}

.settings-title h3 { margin: 0; font-size: 20px; font-weight: 800; }
.settings-title p { margin: 4px 0 0; color: var(--kasr-muted); font-size: 10px; }
.size-cross { padding-bottom: 13px; color: var(--kasr-muted); }

.aspect-lock {
  display: grid;
  grid-template-columns: auto 34px 1fr;
  align-items: center;
  gap: 10px;
  margin-top: 15px;
  padding: 12px;
  border: 1px solid #ded8cd;
  border-radius: 12px;
  background: #fbfaf7;
  cursor: pointer;
}

.aspect-lock:has(.form-check-input:checked) { border-color: var(--kasr-gold); background: #fffaf0; }
.aspect-lock .form-check-input { width: 20px; height: 20px; margin: 0; border-color: #c8c0b3; cursor: pointer; }
.aspect-lock .form-check-input:checked { border-color: var(--kasr-gold-dark); background-color: var(--kasr-gold-dark); }
.aspect-lock-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--kasr-gold-soft); color: var(--kasr-gold-dark); }
.aspect-lock > span:last-child { display: grid; gap: 3px; }
.aspect-lock b { color: #37332c; font-size: 11px; }
.aspect-lock small { color: var(--kasr-muted); font-size: 9px; line-height: 1.5; }

.quality-box {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0;
  padding: 15px;
  border: 1px solid #e6dcc2;
  border-radius: 13px;
  background: #faf6eb;
  color: var(--kasr-gold-dark);
}

.quality-box > svg { font-size: 21px; }
.quality-box div { display: grid; gap: 3px; }
.quality-box b { color: #3e392f; font-size: 12px; }
.quality-box span { color: var(--kasr-muted); font-size: 10px; }
.quality-box small { direction: ltr; font-size: 11px; font-weight: 700; }

.export-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.export-grid .btn { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 12px; }
.export-note { margin: 11px 0 0; color: var(--kasr-muted); font-size: 9px; line-height: 1.7; text-align: center; }
.export-note svg { margin-left: 4px; color: var(--kasr-gold-dark); }

.privacy {
  margin: 16px 0 0;
  color: var(--kasr-muted);
  font-size: 9px;
  line-height: 1.7;
  text-align: center;
}

.privacy svg { margin-left: 4px; color: var(--kasr-success); }

.glyph {
  fill: #0d0d0c;
  stroke: transparent;
  stroke-width: 34;
  paint-order: stroke fill;
  pointer-events: all;
  transition: fill .14s ease;
}

.move-mode .glyph { cursor: grab; }
.move-mode .glyph:hover,
.glyph.dragging { fill: #b58725; }
.glyph.selected { fill: var(--kasr-gold); }
.glyph.group-dragging { fill: var(--kasr-gold-dark); }

.gallery-section {
  padding-top: 74px;
  background: #efede6;
}

.gallery-heading { margin-bottom: 27px; }
.gallery-heading h2 { margin: 9px 0 5px; font-size: clamp(29px, 4vw, 43px); font-weight: 800; }
.gallery-heading p { margin: 0; color: var(--kasr-muted); font-size: 12px; }

.gallery-carousel {
  width: 100vw;
  background: var(--kasr-night);
}

.gallery-carousel .carousel-item img {
  height: min(68vh, 700px);
  min-height: 360px;
  object-fit: cover;
  object-position: center;
}

.gallery-carousel .carousel-indicators { margin-bottom: 18px; gap: 6px; }

.gallery-carousel .carousel-indicators [data-bs-target] {
  width: 8px;
  height: 8px;
  margin: 0;
  border: 0;
  border-radius: 999px;
  background: #fff;
  opacity: .45;
  transition: width .18s ease, opacity .18s ease, background .18s ease;
}

.gallery-carousel .carousel-indicators .active {
  width: 28px;
  background: var(--kasr-gold);
  opacity: 1;
}

.gallery-carousel .carousel-control-prev,
.gallery-carousel .carousel-control-next { width: 9%; opacity: 1; }

.carousel-control-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .52);
  border-radius: 50%;
  background: rgba(17, 17, 15, .64);
  color: #fff;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.site-footer {
  padding: 45px 20px max(36px, env(safe-area-inset-bottom));
  border-top: 1px solid #2b2a25;
  background: #0d0d0c;
  color: #fff;
}

.site-footer img { width: 160px; height: auto; }
.site-footer p { margin: 10px 0 5px; color: #d2cdc2; font-size: 12px; }
.site-footer small { color: #77746b; font-size: 9px; letter-spacing: .6px; }

.app-toast {
  position: fixed;
  right: auto;
  bottom: 28px;
  left: 50%;
  z-index: 1080;
  width: auto;
  max-width: calc(100% - 24px);
  padding: 12px 18px;
  border: 1px solid rgba(205, 161, 59, .35);
  border-radius: 12px;
  background: var(--kasr-night);
  color: #fff;
  font-size: 12px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity .18s ease, transform .18s ease;
}

.app-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Admin */
.admin-body {
  min-height: 100vh;
  background: #f2f0ea;
  color: var(--kasr-ink);
}

.admin-navbar {
  min-height: 72px;
  border-bottom: 1px solid #e6dfd2;
  background: rgba(255,255,255,.96);
  box-shadow: 0 7px 22px rgba(43,36,21,.055);
}

.admin-brand img { width: 146px; height: auto; }

.admin-nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-nav-actions a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  border-radius: 9px;
  color: #625d53;
  font-size: 11px;
  text-decoration: none;
}

.admin-nav-actions a:hover { background: var(--kasr-gold-soft); color: var(--kasr-gold-dark); }

.admin-main { padding-top: 34px; padding-bottom: 60px; }

.admin-page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.admin-page-heading h1 { margin: 0; font-size: 29px; font-weight: 800; }
.admin-page-heading p { margin: 6px 0 0; color: var(--kasr-muted); font-size: 12px; }
.version-badge { padding: 7px 11px; border-radius: 999px; background: #e8e3d8; color: #686258; font-size: 10px; direction: ltr; }

.stat-card {
  height: 100%;
  padding: 18px;
  border: 1px solid var(--kasr-line);
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(31, 27, 18, .055);
}

.stat-card > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--kasr-gold-soft);
  color: var(--kasr-gold-dark);
}

.stat-card b { display: block; font-size: 25px; }
.stat-card small { display: block; margin-top: 3px; color: var(--kasr-muted); font-size: 10px; }
.stat-card.published .stat-icon { background: #e7f4eb; color: var(--kasr-success); }
.stat-card.archived .stat-icon { background: #f4e9e7; color: var(--kasr-danger); }

.admin-card {
  border: 1px solid var(--kasr-line);
  border-radius: 17px;
  background: #fff;
  box-shadow: var(--kasr-shadow);
  overflow: hidden;
}

.admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 21px;
  border-bottom: 1px solid var(--kasr-line);
  background: #fff;
}

.admin-card-header > div { display: flex; align-items: center; gap: 10px; }
.admin-card-header .header-icon { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 11px; background: var(--kasr-gold-soft); color: var(--kasr-gold-dark); }
.admin-card-header h2 { margin: 0; font-size: 16px; font-weight: 800; }
.admin-card-header small { color: var(--kasr-muted); font-size: 9px; }

.font-dropzone {
  position: relative;
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 7px;
  padding: 24px;
  overflow: hidden;
  border: 2px dashed #d9cfb9;
  border-radius: 16px;
  background: #fcfaf4;
  color: #5f594d;
  text-align: center;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.font-dropzone.is-dragging { border-color: var(--kasr-gold); background: var(--kasr-gold-soft); transform: scale(.995); }
.font-dropzone > svg { color: var(--kasr-gold-dark); font-size: 28px; }
.font-dropzone b { font-size: 15px; }
.font-dropzone > span { color: var(--kasr-muted); font-size: 10px; }

.font-drop-input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.selected-font-files {
  display: none;
  max-width: 100%;
  margin-top: 6px;
  padding: 7px 10px;
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
  color: var(--kasr-gold-dark);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-font-files.show { display: block; }

.message {
  display: block;
  margin-bottom: 18px;
  padding: 13px 15px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 12px;
}

.message.ok { border-color: #bcdcc7; background: #eaf7ee; color: var(--kasr-success); }
.message.error { border-color: #e5c0bc; background: #fbefed; color: var(--kasr-danger); }

.admin-table-wrap { overflow-x: auto; }

.admin-table {
  width: 100%;
  min-width: 1220px;
  margin: 0;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 13px 10px;
  border-bottom: 1px solid #ece8df;
  vertical-align: middle;
  text-align: right;
  font-size: 11px;
}

.admin-table th {
  background: #f7f5ef;
  color: #625d53;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.admin-table tr:last-child td { border-bottom: 0; }
.admin-table input[type="text"],
.admin-table input[type="number"],
.admin-table select {
  width: 100%;
  min-width: 105px;
  height: 39px;
  padding: 7px 9px;
  border: 1px solid #d8d3c8;
  border-radius: 8px;
  background: #fff;
  color: var(--kasr-ink);
  font: inherit;
  outline: none;
}

.admin-table input:focus,
.admin-table select:focus { border-color: var(--kasr-gold); box-shadow: 0 0 0 3px rgba(205, 161, 59, .12); }
.admin-table input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--kasr-gold-dark); }

.admin-font-preview {
  width: 225px;
  height: 72px;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 8px;
  border: 1px solid #e3ddd1;
  border-radius: 11px;
  background: #fcfbf8;
  color: #8a8376;
  font-size: 10px;
}

.admin-font-preview svg { width: 100%; height: 100%; display: block; overflow: visible; }
.admin-font-preview path { fill: #171713; }
.admin-font-preview.is-error { border-color: #ead3cf; background: #fff8f7; color: var(--kasr-danger); }

.actions-cell { display: flex; gap: 7px; white-space: nowrap; }

.small-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.small-btn.save { background: var(--kasr-gold); color: #17130a; }
.small-btn.delete { background: #f4e2df; color: var(--kasr-danger); }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(205, 161, 59, .13), transparent 23rem),
    #f7f4ec;
}

.login-shell {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: .9fr 1.1fr;
  overflow: hidden;
  border: 1px solid #e0d8c9;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 30px 90px rgba(42, 34, 18, .13);
}

.login-brand-panel {
  min-height: 520px;
  display: flex;
  justify-content: space-between;
  flex-direction: column;
  padding: 42px;
  background: linear-gradient(145deg, #fff9ea, #eee3c6);
  color: var(--kasr-ink);
}

.login-brand-panel img { width: 190px; height: auto; }
.login-brand-panel h1 { margin: 0 0 10px; color: var(--kasr-gold); font-size: 34px; font-weight: 800; }
.login-brand-panel p { margin: 0; color: #6d685d; font-size: 12px; line-height: 1.8; }
.login-brand-panel small { color: #817966; font-size: 9px; }

.login-form-panel {
  display: flex;
  align-items: center;
  padding: clamp(30px, 6vw, 60px);
}

.login-form-panel > div { width: 100%; }
.login-form-panel .login-icon { width: 50px; height: 50px; display: grid; place-items: center; margin-bottom: 18px; border-radius: 15px; background: var(--kasr-gold-soft); color: var(--kasr-gold-dark); font-size: 20px; }
.login-form-panel h2 { margin: 0; font-size: 27px; font-weight: 800; }
.login-form-panel .intro { margin: 7px 0 24px; color: var(--kasr-muted); font-size: 11px; }
.back-link { display: inline-flex; align-items: center; gap: 7px; margin-top: 18px; color: var(--kasr-gold-dark); font-size: 11px; text-decoration: none; }

:focus-visible { outline: 2px solid var(--kasr-gold); outline-offset: 3px; }

@supports (padding: max(0px)) {
  .app-navbar,
  .admin-navbar {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  .app-toast { bottom: max(28px, env(safe-area-inset-bottom)); }
}

@media (max-width: 991.98px) {
  .font-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar-spacer { display: none; }
  .canvas-toolbar .btn { flex: 1 1 auto; justify-content: center; }
  .gallery-carousel .carousel-item img { height: min(58vh, 570px); }
}

@media (max-width: 767.98px) {
  html { scroll-padding-top: 78px; }
  input,
  select,
  button { font-size: 16px; }

  .app-navbar { min-height: 68px; }
  .elkasr-brand img { width: 128px; max-height: 44px; }
  .btn-admin span { display: none; }
  .btn-admin { width: 39px; height: 39px; justify-content: center; padding: 0; }

  .public-hero { padding: 48px 0 38px; }
  .hero-crown { width: 41px; height: 37px; }
  .public-hero h1 { font-size: 31px; }
  .public-hero p { max-width: 520px; font-size: 13px; }

  .designer-container { padding-bottom: 76px; }
  .app-section { margin-top: 50px; }
  .section-heading { align-items: start; }
  .section-heading h2 { font-size: 21px; }
  .section-heading p { max-width: 220px; }
  .step-badge { width: 40px; height: 40px; border-radius: 12px; }

  .font-grid { grid-template-columns: 1fr; }
  .font-card { min-height: 156px; padding: 14px; }
  .font-preview { height: 80px; }
  .name-entry-panel { margin-bottom: 28px; padding: 15px; border-radius: 15px; }
  .name-entry-control .form-control { min-height: 55px; font-size: 18px; }

  .canvas-toolbar .btn { flex: 1 1 130px; }
  .canvas-toolbar .btn-tool { flex: 0 0 42px; }
  .canvas-toolbar .reset-tool { flex: 1 1 120px; }
  .artboard-wrap { min-height: 250px; padding: 10px; }
  .preview-dimensions { top: 20px; left: 20px; }
  .nudge-panel { flex-wrap: wrap; justify-content: center; gap: 10px 16px; padding: 13px; }
  .nudge-copy { width: 100%; text-align: center; }
  .nudge-step { width: 145px; justify-content: center; }
  .nudge-step > span { text-align: center; }

  .gallery-section { padding-top: 54px; }
  .gallery-carousel .carousel-item img { height: 52vh; min-height: 310px; }
  .gallery-carousel .carousel-control-prev,
  .gallery-carousel .carousel-control-next { width: 15%; }
  .carousel-control-icon { width: 40px; height: 40px; }

  .admin-page-heading { align-items: start; }
  .admin-page-heading h1 { font-size: 24px; }
  .admin-card-header { align-items: start; flex-direction: column; }
  .login-page { padding: 14px; }
  .login-shell { grid-template-columns: 1fr; border-radius: 19px; }
  .login-brand-panel { min-height: 180px; padding: 25px; }
  .login-brand-panel img { width: 150px; }
  .login-brand-panel > div { display: none; }
  .login-form-panel { padding: 30px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
