:root {
  --od-ink: #071f18;
  --od-forest: #0b3d2e;
  --od-leaf: #1b835e;
  --od-mint: #2fbf8a;
  --od-gold: #dba832;
  --od-sand: #e8dfcf;
  --od-cream: #f4efe4;
  --font-ar: "Cairo", "Segoe UI", Tahoma, sans-serif;
  --font-en: "Outfit", "Cairo", sans-serif;
}

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

html, body, .world-body, #world-root {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #050f0c;
  color: #fff;
  font-family: var(--font-ar);
  touch-action: none;
}

#world-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.world-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(47, 191, 138, 0.28), transparent 55%),
    radial-gradient(ellipse at 80% 80%, rgba(219, 168, 50, 0.18), transparent 50%),
    linear-gradient(160deg, #041611 0%, #0b3d2e 48%, #06251c 100%);
}

/* display:grid أعلاه يلغي [hidden] الافتراضي — لازم نخفيه صراحة */
.world-overlay[hidden],
.world-hud[hidden],
.product-sheet[hidden],
.cart-drawer[hidden],
.touch-pad[hidden],
.world-crosshair[hidden],
[hidden] {
  display: none !important;
}

.boot-card {
  width: min(440px, calc(100vw - 32px));
  padding: 28px 24px 22px;
  text-align: center;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(18px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  animation: bootIn 0.7s ease both;
}

@keyframes bootIn {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.boot-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  margin-bottom: 10px;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.35));
}

.boot-brand {
  font-family: var(--font-en);
  letter-spacing: 0.18em;
  font-size: 12px;
  font-weight: 800;
  color: var(--od-gold);
  margin-bottom: 8px;
}

.boot-card h1 {
  font-size: clamp(28px, 6vw, 36px);
  font-weight: 900;
  line-height: 1.25;
  margin-bottom: 10px;
}

.boot-lead {
  color: rgba(255, 255, 255, 0.78);
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 18px;
}

.boot-cta {
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  font: inherit;
  font-weight: 900;
  font-size: 16px;
  color: #06251c;
  background: linear-gradient(90deg, var(--od-gold), #f0c85a);
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.boot-cta:hover { transform: translateY(-1px); filter: brightness(1.05); }
.boot-cta:disabled { opacity: 0.55; cursor: wait; }

.boot-hint {
  margin-top: 12px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
}

.boot-back {
  display: inline-block;
  margin-top: 14px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.boot-back:hover { color: #fff; }

.world-hud {
  position: absolute;
  top: 0;
  inset-inline: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: linear-gradient(180deg, rgba(5, 15, 12, 0.75), transparent);
  pointer-events: none;
}

.world-hud > * { pointer-events: auto; }

.hud-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #fff;
  font-family: var(--font-en);
  font-weight: 800;
  letter-spacing: 0.08em;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 6px 12px 6px 6px;
}

.hud-brand img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 50%;
  background: #fff;
}

.hud-status {
  flex: 1;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.78);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

.hud-cart {
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-weight: 800;
  background: var(--od-leaf);
  color: #fff;
  cursor: pointer;
}

.world-crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
  z-index: 15;
  pointer-events: none;
  opacity: 0.7;
}

.product-sheet {
  position: absolute;
  z-index: 45;
  inset-inline-end: 14px;
  bottom: 14px;
  width: min(360px, calc(100vw - 28px));
  max-height: min(78vh, 640px);
  overflow: auto;
  border-radius: 22px;
  background: rgba(247, 243, 234, 0.96);
  color: var(--od-ink);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  animation: sheetIn 0.28s ease;
  pointer-events: auto;
}

.hud-cart.pop,
#cart-count.pop {
  animation: cartPop 0.35s ease;
}

@keyframes cartPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

@keyframes sheetIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

.sheet-close {
  position: absolute;
  top: 10px;
  inset-inline-start: 10px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(7, 31, 24, 0.08);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

.sheet-media {
  background: linear-gradient(180deg, #e7efe9, #f7f3ea);
  aspect-ratio: 1.15 / 1;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.sheet-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sheet-body { padding: 14px 16px 18px; }

.sheet-body h2 {
  font-size: 17px;
  font-weight: 900;
  line-height: 1.4;
  margin-bottom: 6px;
}

.sheet-price {
  font-size: 20px;
  font-weight: 900;
  color: var(--od-leaf);
  margin-bottom: 4px;
}

.sheet-meta {
  font-size: 12px;
  color: #5d6f68;
  margin-bottom: 12px;
}

.sheet-sizes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.size-chip {
  border: 1px solid #cfd8d3;
  background: #fff;
  border-radius: 999px;
  padding: 7px 11px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.size-chip.on {
  background: var(--od-forest);
  border-color: var(--od-forest);
  color: #fff;
}

.size-chip:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.sheet-actions {
  display: grid;
  gap: 8px;
}

.sheet-add {
  border: 0;
  border-radius: 14px;
  padding: 12px;
  font: inherit;
  font-weight: 900;
  background: var(--od-leaf);
  color: #fff;
  cursor: pointer;
}

.sheet-add:disabled { opacity: 0.45; cursor: not-allowed; }

.sheet-classic {
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--od-forest);
  text-decoration: none;
}

.cart-drawer {
  position: absolute;
  z-index: 35;
  top: 0;
  inset-inline-start: 0;
  width: min(360px, 92vw);
  height: 100%;
  background: #f7f3ea;
  color: var(--od-ink);
  display: flex;
  flex-direction: column;
  box-shadow: 12px 0 40px rgba(0, 0, 0, 0.35);
  animation: drawerIn 0.25s ease;
}

@keyframes drawerIn {
  from { transform: translateX(24px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.cart-head, .cart-foot {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cart-head {
  border-bottom: 1px solid #e2ddd2;
  padding-top: max(16px, env(safe-area-inset-top));
}

.cart-head h2 { font-size: 18px; font-weight: 900; }
.cart-head button, #cart-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(7, 31, 24, 0.08);
  font-size: 22px;
  cursor: pointer;
}

.cart-list {
  flex: 1;
  overflow: auto;
  padding: 8px 12px 16px;
}

.cart-row {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 14px;
  background: #fff;
  margin-bottom: 8px;
}

.cart-row img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 10px;
  background: #eef4f0;
}

.cart-row strong { display: block; font-size: 13px; line-height: 1.35; }
.cart-row span { font-size: 12px; color: #5d6f68; }
.cart-row button {
  border: 0;
  background: transparent;
  color: #b42318;
  font-weight: 800;
  cursor: pointer;
}

.cart-foot {
  border-top: 1px solid #e2ddd2;
  flex-direction: column;
  align-items: stretch;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}

.cart-total { font-weight: 800; }
.cart-checkout {
  display: block;
  text-align: center;
  text-decoration: none;
  background: var(--od-leaf);
  color: #fff;
  font-weight: 900;
  border-radius: 14px;
  padding: 12px;
}

.touch-pad {
  position: absolute;
  z-index: 18;
  left: 18px;
  bottom: max(18px, env(safe-area-inset-bottom));
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.joy {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
  pointer-events: auto;
  touch-action: none;
}

.joy-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
  border-radius: 50%;
  background: rgba(219, 168, 50, 0.9);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.touch-hint {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.65);
  max-width: 160px;
  text-shadow: 0 2px 8px #000;
}

.world-toast {
  position: absolute;
  z-index: 50;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: rgba(7, 31, 24, 0.92);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

@media (max-width: 720px) {
  .product-sheet {
    inset-inline: 10px;
    bottom: 10px;
    width: auto;
  }
  .world-crosshair { display: none; }
}
