/* =====================================================================
   ZIKA PERFUME — Premium dark / muted gold UI (RTL, touch friendly)
   ===================================================================== */

/* ---------- الخطوط (محلية بالكامل) ---------- */
@font-face {
  font-family: 'Cinzel';
  font-weight: 400 900;
  font-display: swap;
  src: url('../assets/fonts/Cinzel-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'El Messiri';
  font-weight: 400 700;
  font-display: swap;
  src: url('../assets/fonts/ElMessiri-arabic.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+FB50-FDFF, U+FE70-FEFC, U+200C-200E, U+2010-2011;
}
@font-face {
  font-family: 'El Messiri';
  font-weight: 400 700;
  font-display: swap;
  src: url('../assets/fonts/ElMessiri-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+2000-206F, U+FEFF, U+FFFD;
}
@font-face { font-family: 'Tajawal'; font-weight: 400; font-display: swap; src: url('../assets/fonts/Tajawal-400-arabic.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+FB50-FDFF, U+FE70-FEFC, U+200C-200E, U+2010-2011; }
@font-face { font-family: 'Tajawal'; font-weight: 400; font-display: swap; src: url('../assets/fonts/Tajawal-400-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+FEFF, U+FFFD; }
@font-face { font-family: 'Tajawal'; font-weight: 500; font-display: swap; src: url('../assets/fonts/Tajawal-500-arabic.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+FB50-FDFF, U+FE70-FEFC, U+200C-200E, U+2010-2011; }
@font-face { font-family: 'Tajawal'; font-weight: 500; font-display: swap; src: url('../assets/fonts/Tajawal-500-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+FEFF, U+FFFD; }
@font-face { font-family: 'Tajawal'; font-weight: 700; font-display: swap; src: url('../assets/fonts/Tajawal-700-arabic.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+FB50-FDFF, U+FE70-FEFC, U+200C-200E, U+2010-2011; }
@font-face { font-family: 'Tajawal'; font-weight: 700; font-display: swap; src: url('../assets/fonts/Tajawal-700-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+FEFF, U+FFFD; }

/* ---------- المتغيرات ---------- */
:root {
  --bg: #0a0a0b;
  --bg-2: #131315;
  --glass: rgba(255, 255, 255, 0.045);
  --glass-2: rgba(255, 255, 255, 0.075);
  --line: rgba(255, 255, 255, 0.09);
  --gold: #d4af37;
  --gold-2: #f0d78a;
  --gold-3: #8f7429;
  --text: #f4efe4;
  --muted: #9d978c;
  --radius: 18px;
  --font-body: 'Tajawal', 'Segoe UI', Tahoma, Arial, sans-serif;
  --font-display: 'El Messiri', 'Segoe UI', Tahoma, Arial, sans-serif;
  --font-latin: 'Cinzel', 'Palatino Linotype', Georgia, serif;
}

/* ---------- الأساسيات ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { font-size: 17px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; }
img { -webkit-user-drag: none; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(212, 175, 55, 0.25); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(1100px 600px at 50% -10%, rgba(212, 175, 55, 0.09), transparent 60%),
    radial-gradient(700px 500px at 100% 100%, rgba(212, 175, 55, 0.05), transparent 60%),
    var(--bg);
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: scale(1.02);
  transition: opacity 0.5s ease, transform 0.5s ease, visibility 0s linear 0.5s;
}
.screen.active {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 0.5s ease, transform 0.5s ease, visibility 0s;
}

@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: none; } }
@keyframes shake { 0%, 100% { transform: none; } 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }

/* ---------- الأزرار ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 54px;
  padding: 0 1.6em;
  border-radius: 14px;
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.25s ease, background 0.25s ease, opacity 0.25s ease, border-color 0.25s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.35; pointer-events: none; }
.btn-gold {
  background: linear-gradient(135deg, #f3d77c 0%, #d4af37 45%, #b58f28 100%);
  color: #1a1405;
  box-shadow: 0 10px 26px -10px rgba(212, 175, 55, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--text);
}
.btn-danger {
  background: rgba(192, 57, 43, 0.14);
  border-color: rgba(192, 57, 43, 0.45);
  color: #ff9a8c;
}
.btn-lg { min-height: 62px; font-size: 1.15rem; padding: 0 2.2em; }
.btn-xl { min-height: 74px; font-size: 1.4rem; padding: 0 3em; border-radius: 40px; }
.btn-sm { min-height: 44px; font-size: 0.95rem; padding: 0 1.1em; }

.muted { color: var(--muted); }

/* =====================================================================
   شاشة البداية
   ===================================================================== */
#screen-home { align-items: center; justify-content: center; text-align: center; }
.ambient { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.orb {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.2) 0%, rgba(212, 175, 55, 0.06) 35%, transparent 70%);
}
.orb-1 { width: 70vw; height: 70vw; max-width: 900px; max-height: 900px; left: -20vw; top: -25vw; animation: orb 16s ease-in-out infinite alternate; }
.orb-2 { width: 55vw; height: 55vw; max-width: 700px; max-height: 700px; right: -15vw; bottom: -22vw; animation: orb 20s ease-in-out infinite alternate-reverse; }
@keyframes orb { from { transform: translate(0, 0); } to { transform: translate(6vw, 4vw); } }

.dust { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.dust span {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--s, 4px);
  height: var(--s, 4px);
  border-radius: 50%;
  background: var(--gold-2);
  box-shadow: 0 0 8px 1px rgba(240, 215, 138, 0.5);
  opacity: 0;
  animation: dust var(--d, 8s) linear infinite var(--delay, 0s);
}
@keyframes dust {
  0% { transform: translateY(0) scale(0.5); opacity: 0; }
  15% { opacity: 0.8; }
  80% { opacity: 0.4; }
  100% { transform: translateY(-140px) scale(1); opacity: 0; }
}

.home-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem;
  animation: fadeUp 1s ease both;
}
.brand-ar {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.6rem, 6vw, 4.8rem);
  line-height: 1.2;
  margin: 0;
  background: linear-gradient(180deg, #fff6d2 0%, #e9c96a 50%, #b8922a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 6px 22px rgba(212, 175, 55, 0.25));
}
.brand-en {
  font-family: var(--font-latin);
  font-weight: 600;
  letter-spacing: 0.45em;
  text-indent: 0.45em;
  font-size: clamp(0.9rem, 1.6vw, 1.3rem);
  color: var(--gold);
  direction: ltr;
  margin-top: 0.3rem;
}
.brand-rule { display: flex; align-items: center; gap: 12px; margin: 0.9rem 0 0.3rem; }
.brand-rule span { width: 80px; height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
.brand-rule span:last-child { transform: scaleX(-1); }
.brand-rule i { width: 7px; height: 7px; background: var(--gold); transform: rotate(45deg); }

.home-bottle {
  height: min(42vh, 380px);
  aspect-ratio: 200 / 340;
  margin: 0.4rem 0 0.8rem;
  animation: floaty 5.5s ease-in-out infinite;
}
.home-bottle svg { width: 100%; height: 100%; }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }

.tagline {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2.6vw, 2rem);
  margin: 0 0 1.4rem;
  color: #ebe4d3;
}

/* =====================================================================
   شاشة التركيب
   ===================================================================== */
.topbar {
  flex: 0 0 68px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.4rem;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 10, 11, 0.6);
  backdrop-filter: blur(10px);
  z-index: 5;
}
.topbar-brand { display: flex; flex-direction: column; line-height: 1.15; min-width: 150px; }
.topbar-brand span { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; color: var(--gold-2); }
.topbar-brand small { font-family: var(--font-latin); letter-spacing: 0.3em; font-size: 0.62rem; color: var(--muted); direction: ltr; text-align: start; }

.steps { display: flex; align-items: center; gap: 0.4rem; }
.step {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: transparent;
  border: 0;
  padding: 0.4rem 0.9rem;
  border-radius: 30px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
  transition: color 0.3s, background 0.3s;
}
.step-num {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.95rem;
  transition: all 0.3s;
}
.step.done { color: #ddd6c5; }
.step.done .step-num { background: rgba(212, 175, 55, 0.18); border-color: var(--gold); color: var(--gold-2); }
.step.active { color: var(--gold-2); background: rgba(212, 175, 55, 0.08); }
.step.active .step-num { background: var(--gold); color: #1a1405; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.18); }
.step-sep { width: 30px; height: 1px; background: var(--line); }

.builder {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(380px, 46%) 1fr;
  min-height: 0;
}

/* ---- لوحة الاختيار ---- */
.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-inline-end: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}
.panel-body { flex: 1; min-height: 0; overflow-y: auto; padding: 1.3rem 1.5rem; overscroll-behavior: contain; }
.panel-nav {
  flex: 0 0 auto;
  display: flex;
  gap: 1rem;
  padding: 0.9rem 1.5rem;
  border-top: 1px solid var(--line);
  background: rgba(10, 10, 11, 0.5);
}
.panel-nav .btn { flex: 1; }
.pane { display: none; }
.pane.active { display: block; animation: fadeUp 0.4s ease both; }
.pane-title { font-family: var(--font-display); font-size: 1.55rem; font-weight: 600; margin: 0 0 1rem; color: #fff; }

/* ---- رف الزجاجات ---- */
.shelf { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem 0.4rem; }
.shelf-item {
  position: relative;
  background: transparent;
  border: 0;
  padding: 0.5rem 0.2rem 0.5rem;
  border-radius: 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: background 0.3s;
}
.shelf-item:active { background: rgba(255, 255, 255, 0.04); }
.shelf-bottle {
  position: relative;
  height: clamp(130px, 21vh, 176px);
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.shelf-bottle img, .shelf-bottle svg { height: 100%; width: auto; max-width: 100%; filter: drop-shadow(0 14px 14px rgba(0, 0, 0, 0.6)); }
.shelf-bottle::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 18%;
  right: 18%;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(212, 175, 55, 0.3), transparent 70%);
  opacity: 0.45;
  transition: opacity 0.3s, transform 0.3s, background 0.3s;
}
.shelf-stand {
  display: block;
  width: 100%;
  height: 3px;
  margin: 10px 0 8px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.4) 18%, rgba(212, 175, 55, 0.4) 82%, transparent);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.7);
  transition: background 0.3s, box-shadow 0.3s;
}
.shelf-name { font-weight: 700; font-size: 1.02rem; unicode-bidi: plaintext; line-height: 1.25; transition: color 0.3s; }
.shelf-price { color: var(--gold-2); font-weight: 500; font-size: 0.95rem; }
.shelf-item.selected .shelf-bottle { transform: translateY(-10px) scale(1.1); }
.shelf-item.selected .shelf-bottle::after {
  opacity: 1;
  transform: scaleX(1.25);
  background: radial-gradient(ellipse at center, rgba(240, 215, 138, 0.65), rgba(212, 175, 55, 0.18) 50%, transparent 72%);
}
.shelf-item.selected .shelf-name { color: var(--gold-2); }
.shelf-item.selected .shelf-stand {
  background: linear-gradient(90deg, transparent, var(--gold) 18%, var(--gold) 82%, transparent);
  box-shadow: 0 0 14px rgba(212, 175, 55, 0.55);
}
.shelf-item.selected::before {
  content: '✓';
  position: absolute;
  top: 6px;
  inset-inline-start: 8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--gold);
  color: #1a1405;
  font-weight: 800;
  font-size: 0.9rem;
  display: grid;
  place-items: center;
  z-index: 1;
}

/* ---- أنابيب العطور ---- */
.chips { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.chip {
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--muted);
  border-radius: 30px;
  padding: 0.4rem 1.1rem;
  min-height: 44px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.25s;
}
.chip.active { background: rgba(212, 175, 55, 0.15); border-color: var(--gold); color: var(--gold-2); }

.vials { display: grid; grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 0.5rem 0.3rem; }
.vial {
  position: relative;
  background: transparent;
  border: 0;
  padding: 0.6rem 0.15rem 0.5rem;
  border-radius: 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  transition: background 0.3s;
}
.vial:active { background: rgba(255, 255, 255, 0.04); }
.vial-tube {
  position: relative;
  display: block;
  width: 34px;
  height: clamp(84px, 13vh, 116px);
  margin-top: 8px;
  border: 1.5px solid rgba(255, 255, 255, 0.38);
  border-top-color: rgba(255, 255, 255, 0.2);
  border-radius: 5px 5px 17px 17px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.03) 40%, rgba(255, 255, 255, 0) 60%, rgba(255, 255, 255, 0.12));
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.4s;
}
.vial-liquid {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 64%;
  border-radius: 0 0 15px 15px;
  background: linear-gradient(180deg, var(--sw-light) 0%, var(--sw) 22%, var(--sw-dark) 100%);
}
.vial-liquid::before {
  content: '';
  position: absolute;
  top: -3px;
  left: 0;
  right: 0;
  height: 6px;
  border-radius: 50%;
  background: var(--sw-light);
  opacity: 0.85;
}
.vial-liquid::after {
  content: '';
  position: absolute;
  top: 10%;
  bottom: 12%;
  left: 5px;
  width: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.35);
}
.vial-cap {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 26px;
  height: 12px;
  border-radius: 3px;
  background: linear-gradient(180deg, #4a4a4a, #161616);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.7);
}
.vial-name { font-weight: 700; font-size: 0.95rem; unicode-bidi: plaintext; text-align: center; line-height: 1.2; margin-top: 0.4rem; max-width: 100%; transition: color 0.3s; }
.vial-price { color: var(--gold-2); font-size: 0.85rem; font-weight: 500; }
.vial-tag { font-size: 0.72rem; color: var(--muted); border: 1px solid var(--line); border-radius: 20px; padding: 0 0.5rem; line-height: 1.6; }
.vial.selected .vial-tube {
  transform: translateY(-8px) scale(1.06);
  box-shadow: 0 14px 30px -8px var(--sw), 0 0 0 2px rgba(240, 215, 138, 0.75);
}
.vial.selected .vial-name { color: var(--gold-2); }
.vial.selected::before {
  content: '✓';
  position: absolute;
  top: 4px;
  inset-inline-start: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gold);
  color: #1a1405;
  font-weight: 800;
  font-size: 0.8rem;
  display: grid;
  place-items: center;
  z-index: 1;
}
.empty-note { color: var(--muted); text-align: center; padding: 2rem 1rem; grid-column: 1 / -1; }

/* ---- الكمية ---- */
.amount-display { display: flex; align-items: baseline; justify-content: center; gap: 0.5rem; margin: 0 0 0.8rem; }
.amount-num {
  font-family: var(--font-display);
  font-size: 4.2rem;
  font-weight: 700;
  color: var(--gold-2);
  line-height: 1;
  min-width: 2ch;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.amount-unit { font-size: 1.35rem; color: var(--muted); }
.presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.7rem; margin-bottom: 1rem; }
.preset {
  min-height: 104px;
  padding: 0.4rem 0;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--glass);
  color: #a08a3c;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  line-height: 1.1;
  transition: all 0.25s;
}
.preset svg { width: 34px; height: 50px; }
.preset-num { font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; color: var(--text); }
.preset small { font-weight: 400; font-size: 0.75rem; color: var(--muted); }
.preset.active { background: rgba(212, 175, 55, 0.15); border-color: var(--gold); color: var(--gold-2); box-shadow: 0 0 0 1px var(--gold), 0 14px 30px -14px rgba(212, 175, 55, 0.8); }
.preset.active .preset-num, .preset.active small { color: var(--gold-2); }

.slider-wrap { padding: 0 0.3rem; }
input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 46px;
  background: transparent;
  cursor: pointer;
  margin: 0;
  --fill: 30%;
}
input[type='range']::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to left, var(--gold) var(--fill), rgba(255, 255, 255, 0.12) var(--fill));
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  margin-top: -12px;
  background: radial-gradient(circle at 35% 35%, #fff3bd, var(--gold) 60%, #a8862a);
  border: 2px solid #fff3c4;
  box-shadow: 0 4px 16px rgba(212, 175, 55, 0.55);
}
input[type='range']::-moz-range-track { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.12); }
input[type='range']::-moz-range-progress { height: 8px; border-radius: 4px; background: var(--gold); }
input[type='range']::-moz-range-thumb { width: 30px; height: 30px; border-radius: 50%; background: var(--gold); border: 2px solid #fff3c4; }
.slider-scale { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.85rem; padding: 0 6px; }
.hint { color: var(--muted); text-align: center; margin: 0.5rem 0 0; }
.recipe { margin-top: 0.9rem; border: 1px solid var(--line); border-radius: 18px; padding: 0.7rem 1rem 0.8rem; background: rgba(255, 255, 255, 0.03); }
.recipe-title { font-family: var(--font-display); font-size: 1.1rem; color: var(--gold-2); margin-bottom: 0.4rem; }
.recipe-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.35rem 0; border-top: 1px solid rgba(255, 255, 255, 0.06); }
.recipe-row span { color: var(--muted); flex: 0 0 auto; }
.recipe-row b { font-weight: 600; unicode-bidi: plaintext; text-align: left; display: flex; align-items: center; gap: 0.4rem; }
.recipe-row .dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 12px; box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.4); }
.recipe-row.total b { color: var(--gold-2); font-family: var(--font-display); font-size: 1.25rem; }

/* ---- المسرح ---- */
.stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1.5rem 1rem;
  min-height: 0;
  overflow: hidden;
}
.stage-glow {
  position: absolute;
  width: 62%;
  padding-bottom: 62%;
  border-radius: 50%;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, var(--glow, rgba(212, 175, 55, 0.3)) 0%, transparent 65%);
  opacity: 0.75;
  transition: background 1s ease, opacity 0.6s;
  pointer-events: none;
}
.stage.pouring .stage-glow { opacity: 1; }
.stage-bottle { position: relative; height: min(58vh, 540px); aspect-ratio: 200 / 340; z-index: 1; }
.stage-bottle svg { width: 100%; height: 100%; }
.stage-bottle.ghost { opacity: 0.2; filter: grayscale(1); }
.stage-bottle.pop { animation: pop 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.25) both; }
@keyframes pop { from { transform: scale(0.85); opacity: 0; } to { transform: none; opacity: 1; } }
.stage-caption {
  margin-top: 0.7rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: #efe8d8;
  min-height: 1.8em;
  text-align: center;
  z-index: 1;
  unicode-bidi: plaintext;
}
.stage-caption b { color: var(--gold-2); }

.price-panel {
  margin-top: 0.6rem;
  z-index: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 0.8rem 1.8rem;
  min-width: 340px;
  text-align: center;
  backdrop-filter: blur(8px);
}
.price-lines { display: flex; justify-content: center; gap: 1.4rem; flex-wrap: wrap; color: var(--muted); font-size: 0.95rem; min-height: 1.4em; }
.price-lines b { color: #ddd5c3; font-weight: 500; }
.price-total { display: flex; align-items: baseline; justify-content: center; gap: 0.5rem; margin-top: 0.15rem; }
.price-label { font-size: 1.25rem; color: #efe8d8; }
.price-num {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 700;
  color: var(--gold-2);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  display: inline-block;
}
.price-num.bump { animation: bump 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.4); }
@keyframes bump { 30% { transform: scale(1.15); color: #fff8d6; } }
.price-currency { font-size: 1.25rem; color: var(--gold); }

/* =====================================================================
   شاشة النتيجة
   ===================================================================== */
#screen-result, #screen-success { align-items: center; justify-content: center; }
.sparkles { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.sparkles span {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold-2);
  box-shadow: 0 0 14px 3px rgba(240, 215, 138, 0.55);
  opacity: 0;
  animation: sparkle var(--d, 3s) ease-in-out infinite var(--delay, 0s);
}
@keyframes sparkle { 0%, 100% { transform: scale(0); opacity: 0; } 50% { transform: scale(1); opacity: 1; } }

.result-card {
  position: relative;
  z-index: 1;
  width: min(92vw, 580px);
  max-height: 94vh;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 28px;
  padding: 1.4rem 2rem 1.6rem;
  text-align: center;
  backdrop-filter: blur(14px);
  box-shadow: 0 30px 90px -30px rgba(212, 175, 55, 0.4);
  animation: fadeUp 0.6s ease both;
}
.result-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.7rem);
  margin: 0 0 0.3rem;
  background: linear-gradient(180deg, #fff6d2 0%, #e9c96a 50%, #b8922a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.result-bottle { height: min(34vh, 290px); aspect-ratio: 200 / 340; margin: 0 auto 0.5rem; animation: floaty 5.5s ease-in-out infinite; }
.result-bottle svg { width: 100%; height: 100%; }
.result-details { display: grid; gap: 0.4rem; margin: 0.5rem 0 1.2rem; }
.detail { display: flex; justify-content: space-between; align-items: center; padding: 0.55rem 1rem; background: rgba(255, 255, 255, 0.04); border-radius: 12px; }
.detail span { color: var(--muted); }
.detail strong { unicode-bidi: plaintext; font-size: 1.1rem; }
.detail.total { background: rgba(212, 175, 55, 0.12); border: 1px solid rgba(212, 175, 55, 0.35); }
.detail.total strong { color: var(--gold-2); font-size: 1.5rem; font-family: var(--font-display); }
.result-actions { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; }
.result-actions .btn { flex: 1; min-width: 200px; }

/* =====================================================================
   الزجاجة (SVG) — السائل والفقاعات واللمعة والصبّ
   ===================================================================== */
.bottle-svg .liquid { transition: transform 1.4s cubic-bezier(0.22, 0.8, 0.25, 1); }
.bottle-svg .wave { animation: wave 3.2s linear infinite; }
.bottle-svg .wave-back { animation-duration: 4.6s; animation-direction: reverse; }
@keyframes wave { to { transform: translateX(-50px); } }

.bottle-svg .bubble { fill: rgba(255, 255, 255, 0.55); animation: rise var(--dur, 5s) linear infinite; animation-delay: var(--delay, 0s); }
@keyframes rise {
  0% { transform: translateY(250px); opacity: 0; }
  12% { opacity: 0.8; }
  85% { opacity: 0.5; }
  100% { transform: translateY(4px); opacity: 0; }
}

.bottle-svg .shine { animation: shine 8s ease-in-out infinite; opacity: 0; }
@keyframes shine {
  0%, 60% { transform: translateX(-70px) skewX(-18deg); opacity: 0; }
  65% { opacity: 0.6; }
  82% { opacity: 0.6; }
  87%, 100% { transform: translateX(260px) skewX(-18deg); opacity: 0; }
}

.bottle-svg .cap {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  transition: transform 0.55s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.bottle-svg.pouring .cap { transform: translate(-28px, -44px) rotate(-24deg); }

.bottle-svg .stream {
  transform-box: fill-box;
  transform-origin: 50% 0;
  transform: scaleY(0);
  opacity: 0;
  transition: transform 0.5s ease-out, opacity 0.35s ease;
}
.bottle-svg.pouring .stream { transform: scaleY(1); opacity: 0.95; }

.bottle-svg .st-light, .bottle-svg .st-mid, .bottle-svg .st-dark { transition: stop-color 0.9s ease; }
.bottle-svg .wave-back { transition: fill 0.9s ease; }

/* =====================================================================
   أزرار الزاوية
   ===================================================================== */
.corner { position: fixed; bottom: 12px; left: 12px; display: flex; gap: 6px; z-index: 50; }
.admin-link { position: fixed; bottom: 16px; right: 16px; font-size: 0.72rem; color: rgba(255, 255, 255, 0.22); text-decoration: none; z-index: 3; }
.admin-link:active { color: var(--gold); }
.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.35);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.25s;
}
.icon-btn:active { color: var(--gold); border-color: var(--gold); }

/* =====================================================================
   التنبيه
   ===================================================================== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 20px);
  background: #1b1b1e;
  color: #fff;
  border: 1px solid rgba(212, 175, 55, 0.45);
  padding: 0.8rem 1.5rem;
  border-radius: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 300;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: rgba(192, 57, 43, 0.6); color: #ffb3a8; }

/* =====================================================================
   الطلب Online: حالات التحميل، الأخطاء، شاشة النجاح
   ===================================================================== */
.home-note {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  padding: 0.7rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(192, 57, 43, 0.45);
  background: rgba(192, 57, 43, 0.12);
  color: #ffb3a8;
  font-weight: 600;
}
.order-error {
  margin: 0 0 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(192, 57, 43, 0.45);
  background: rgba(192, 57, 43, 0.12);
  color: #ffb3a8;
  font-weight: 600;
  animation: fadeUp 0.3s ease;
}
.btn .spinner {
  display: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid rgba(26, 20, 5, 0.25);
  border-top-color: #1a1405;
  animation: spin 0.8s linear infinite;
}
.btn.is-loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.success-card { border-color: rgba(212, 175, 55, 0.55); }
.success-check {
  width: 64px;
  height: 64px;
  margin: 0 auto 0.4rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #f3d77c, #b58f28);
  color: #1a1405;
  font-size: 2rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  box-shadow: 0 12px 30px -10px rgba(212, 175, 55, 0.8);
  animation: popIn 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.3) both;
}
.order-number-label { color: var(--muted); margin-top: 0.2rem; }
.order-number {
  font-family: var(--font-latin);
  font-size: clamp(2rem, 5vw, 2.8rem);
  letter-spacing: 0.12em;
  color: var(--gold-2);
  direction: ltr;
  line-height: 1.2;
  margin: 0.1rem 0 0.3rem;
  user-select: text;
  -webkit-user-select: text;
}
.success-sub { margin: 0 0 0.4rem; color: #efe8d8; font-family: var(--font-display); font-size: 1.15rem; }
.success-bottle { height: min(22vh, 180px); aspect-ratio: 200 / 340; margin: 0 auto 0.4rem; }
.success-bottle svg { width: 100%; height: 100%; }
.result-details.compact { gap: 0.3rem; margin: 0.4rem 0 0.8rem; }
.result-details.compact .detail { padding: 0.4rem 0.9rem; }
.keep-note { color: var(--muted); margin: 0 0 1rem; font-size: 0.95rem; }

/* =====================================================================
   Responsive
   ===================================================================== */
@media (min-width: 1700px) and (min-height: 900px) {
  html { font-size: 20px; }
  .shelf-bottle { height: clamp(130px, 23vh, 240px); }
  .vials { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .vial-tube { height: clamp(84px, 14vh, 140px); width: 40px; }
  .stage-bottle { height: min(58vh, 640px); }
}
@media (max-width: 1000px), (orientation: portrait) {
  .builder { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .stage { order: -1; padding: 0.5rem 1rem 0.7rem; }
  .stage-bottle { height: min(26vh, 300px); }
  .stage-glow { width: 40vh; padding-bottom: 40vh; top: 45%; }
  .stage-caption { margin-top: 0.2rem; font-size: 1.05rem; min-height: 1.4em; }
  .price-panel { padding: 0.35rem 1.2rem; min-width: 0; width: min(100%, 420px); margin-top: 0.3rem; }
  .price-lines { font-size: 0.85rem; }
  .price-num { font-size: 2.1rem; }
  .panel { border-inline-end: 0; border-top: 1px solid var(--line); }
  .panel-body { padding: 1rem 1.2rem; }
  .panel-nav { padding-inline-end: 108px; } /* مساحة لأزرار الزاوية */
  .field-row { grid-template-columns: 1fr; }
  .shape-picker { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .shelf { grid-template-columns: repeat(2, 1fr); }
  .topbar-brand span { white-space: nowrap; font-size: 1.05rem; }
  .topbar-brand small { display: none; }
  .step-label { display: none; }
  .step-sep { width: 14px; }
  .topbar { padding: 0 0.8rem; }
  .topbar-brand { min-width: 0; }
  .btn-xl { min-height: 64px; font-size: 1.2rem; padding: 0 2em; }
  .presets { gap: 0.4rem; }
  .keypad { grid-template-columns: repeat(3, 70px); }
  .row { flex-wrap: wrap; }
  .row-actions { width: 100%; justify-content: flex-end; }
  .admin-head h2 { width: 100%; }
}

