img {
  -webkit-user-drag: none;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: calc(80px + env(safe-area-inset-top));
  padding-bottom: calc(70px + env(safe-area-inset-bottom));
}

.container {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 12px;
}

.panel {
  width: min(720px, 100%);
  background: rgba(0, 20, 40, 0.6);
  border: 1px solid rgba(0, 212, 232, 0.25);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
  min-height: 400px;
  display: grid;
  place-items: center;
}

#main-panel > div {
  display: grid;
  gap: 16px;
  place-items: center;
  text-align: center;
  width: 100%;
  animation: fadeIn 0.3s ease-in;
}

#main-panel > div[hidden] {
  display: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.title {
  margin: 8px 0 2px;
  font-weight: 900;
  text-align: center;
}
.subtitle {
  margin: 0 0 10px;
  color: var(--brand-200);
  text-align: center;
}

.topbar {
  display: flex;
  gap: 10px;
  align-items: center;
}
.progress {
  flex: 1;
  height: 8px;
  background: rgba(0, 25, 45, 0.6);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(0, 212, 232, 0.25);
}
.progress > span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--brand), var(--brand-400));
  transition: width 0.3s;
}

.wish-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 6px;
  width: 100%;
  max-width: 480px;
}
.wish-form input {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(0, 212, 232, 0.35);
  font-size: 1rem;
  background: rgba(0, 20, 40, 0.55);
  color: var(--paper);
}
.wish-form input::placeholder {
  color: rgba(128, 220, 240, 0.7);
}
.wish-form input:focus {
  outline: none;
  box-shadow: var(--ring);
  border-color: var(--brand);
}
/* Phone number input - RTL for Arabic, LTR for English */
[lang="ar"] #phone-number,
html[lang="ar"] #phone-number {
  direction: rtl;
  text-align: right;
}
[lang="en"] #phone-number,
html[lang="en"] #phone-number {
  direction: ltr;
  text-align: left;
}
.btn-group {
  display: flex;
  gap: 12px;
  width: min(100%, 400px);
}
.btn-group .btn {
  flex: 1;
}
.btn {
  transition: 0.2s ease;
}
.btn:not(.ghost) {
  background: var(--brand);
  color: var(--ink-900);
  border-color: transparent;
  box-shadow: 0 0 30px rgba(0, 212, 232, 0.35);
}
.btn:not(.ghost):hover {
  transform: translateY(-2px);
  box-shadow: 0 0 40px rgba(0, 212, 232, 0.5), 0 6px 20px rgba(0, 0, 0, 0.35);
}
.btn:not(.ghost):disabled,
.btn:not(.ghost)[aria-disabled="true"] {
  opacity: 0.55;
  box-shadow: none;
  cursor: not-allowed;
}
.btn:active {
  transform: translateY(1px);
}
.btn.ghost {
  background: rgba(0, 212, 232, 0.1);
  color: var(--brand-200);
  border-color: rgba(0, 212, 232, 0.35);
}

.game {
  display: grid;
  gap: 14px;
  justify-items: center;
}

.box {
  position: relative;
  display: grid;
  place-items: center;
  touch-action: none;
}
.box img {
  width: 200px;
  max-width: 52vw;
  height: auto;
  pointer-events: none;
}
.box-label {
  position: absolute;
  bottom: -10px;
  background: rgba(0, 212, 232, 0.12);
  color: var(--brand-200);
  border: 1px dashed rgba(0, 212, 232, 0.35);
  border-radius: 10px;
  padding: 6px 10px;
  font-weight: 800;
  white-space: nowrap;
}

.box-intro {
  width: 160px;
  max-width: 45vw;
  margin-bottom: 1rem;
}

.qr-code {
  width: 200px;
  max-width: 60vw;
  border-radius: 12px;
  margin: 1rem 0;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.qr-code:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 200, 225, 0.3);
}

.address-display {
  background: rgba(0, 20, 40, 0.7);
  color: var(--brand-100);
  padding: 1rem 1.5rem;
  border-radius: 12px;
  border: 1px solid rgba(0, 212, 232, 0.3);
  font-weight: 800;
  font-size: 1.1rem;
  text-align: center;
  direction: ltr;
  min-height: 4.5rem;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
}

.map-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 100%;
}
@media (min-width: 780px) {
  .map-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.hint {
  font-weight: 800;
  color: var(--brand-200);
  margin: 6px 0;
}

.street {
  display: grid;
  gap: 10px;
  width: 100%;
}
.street {
  grid-template-columns: repeat(3, 1fr);
} /* عمودي أولاً: 3 أعمدة */
@media (min-width: 780px) {
  .street {
    grid-template-columns: repeat(7, 1fr);
  }
} /* الأجهزة الأوسع: 7 */

.lot {
  min-height: 124px;
  display: grid;
  place-items: end center;
  position: relative;
  background: rgba(0, 20, 40, 0.55);
  border: 1px solid rgba(0, 212, 232, 0.25);
  border-radius: 12px;
  padding: 8px;
  transition: background 0.15s, transform 0.15s;
  cursor: pointer;
}
.lot:hover {
  background: rgba(0, 212, 232, 0.12);
  transform: translateY(-2px);
}
.lot:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}
.tile {
  width: 100%;
  height: auto;
  pointer-events: none;
}
.store {
  background: rgba(0, 212, 232, 0.15);
}

.address-tag {
  position: absolute;
  top: 6px;
  inset-inline: 6px auto;
  background: rgba(0, 212, 232, 0.18);
  color: var(--brand-100);
  border: 1px solid rgba(0, 212, 232, 0.4);
  border-radius: 8px;
  padding: 4px 8px;
  font-weight: 800;
  font-size: 0.8rem;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.32);
  display: none;

  /* إصلاح عرض الأرقام مع الشرطة */
  direction: ltr;
  unicode-bidi: bidi-override;
  text-align: left;
  font-variant-numeric: tabular-nums;
}
.address-tag.show {
  display: inline-block;
  font-size: 0.6rem;
  line-height: 1.4;
  text-align: center;
  inset-inline: 6px 6px;
  direction: ltr;
  white-space: normal;
  hyphens: auto;
}

/* يمكن استخدام هذه للعنوانين داخل النصوص */
.addr {
  direction: ltr;
  unicode-bidi: bidi-override;
  text-align: left;
  font-variant-numeric: tabular-nums;
}

.dropzone {
  outline: 2px dashed transparent;
  transition: 0.12s;
}
.dropzone.over {
  outline-color: var(--brand-300);
  background: rgba(0, 212, 232, 0.18);
  transform: translateY(-2px);
}

.toast {
  position: fixed;
  inset-inline: 0 0;
  bottom: 18px;
  display: grid;
  place-items: center;
  padding: 0 12px;
  z-index: 90;
  pointer-events: none;
}
.toast[hidden] { display: none; }
.toast > div {
  background: rgba(0, 20, 40, 0.85);
  color: var(--brand-100);
  border: 1px solid rgba(0, 212, 232, 0.3);
  padding: 10px 14px;
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  font-weight: 800;
  width: 100%;
  max-width: 560px;
  text-align: center;
  animation: toast-pop .25s ease;
  pointer-events: auto;
}

@keyframes toast-pop {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* تحسين قابلية السحب على الجوال */
.draggable {
  touch-action: none;
  user-select: none;
}

/* ===== Modal & Confetti ===== */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 120;
}
.modal.show {
  display: block;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 24, 26, 0.65);
  backdrop-filter: blur(4px);
}
.modal-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(92%, 560px);
  background: linear-gradient(180deg, var(--ink-800), var(--ink-700));
  color: var(--paper);
  border: 1px solid rgba(0, 212, 232, 0.35);
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), 0 0 30px rgba(0, 212, 232, 0.18);
  display: grid;
  gap: 12px;
  place-items: center;
  text-align: center;
  z-index: 2;
}
.modal-text {
  color: var(--brand-200);
  margin: 0 0 6px;
  line-height: 1.6;
}
#confetti {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* Map preview */
.map-embed {
  width: min(720px, 100%);
  height: 360px;
  background: rgba(0, 20, 40, 0.6);
  border: 1px solid rgba(0, 212, 232, 0.25);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
}
.map-embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* Sync status indicator */
.sync-status {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom));
  right: 16px;
  background: rgba(0, 20, 40, 0.95);
  border: 1px solid rgba(0, 212, 232, 0.35);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--brand-200);
  display: none;
  align-items: center;
  gap: 8px;
  z-index: 1000;
  animation: slideInRight 0.3s ease-out;
  cursor: pointer;
  transition: transform 0.2s;
}

.sync-status:hover {
  transform: scale(1.05);
}

.sync-status.show {
  display: flex;
}

.sync-status-icon {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  animation: pulse 2s infinite;
}

.sync-status.syncing .sync-status-icon {
  background: #fbbf24;
  animation: spin 1s linear infinite;
}

.sync-status.offline .sync-status-icon {
  background: #f87171;
  animation: none;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

