:root {
  --bg: #08090d;
  --phone-bg: #0d0f14;
  --card: #151821;
  --text: #f2f4f8;
  --muted: #9aa1b4;
  --accent: #ff2a2a;
  --accent-dark: #c51212;
  --accent-soft: #2a1616;
  --border: #262a35;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  min-height: 100%;
  font-family: "Cairo", sans-serif;
  background:
    radial-gradient(circle at 15% 10%, rgba(255, 40, 40, 0.14), transparent 28%),
    radial-gradient(circle at 85% 92%, rgba(255, 40, 40, 0.09), transparent 30%),
    linear-gradient(160deg, #07080b, #0c0f15 55%, #06070a);
  color: var(--text);
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-text-size-adjust: 100%;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

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

button,
a {
  font: inherit;
}

input,
textarea,
select {
  font-family: inherit;
  font-size: 16px;
}

.app-wrap {
  height: auto;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px 12px;
}

.phone-shell {
  width: min(1120px, 100%);
  height: calc(100vh - 24px);
  min-height: 620px;
  background:
    linear-gradient(180deg, rgba(255, 42, 42, 0.08), transparent 22%),
    linear-gradient(180deg, #0f1218, #0c0f15 58%, #0b0d13);
  border-radius: 26px;
  border: 1px solid #252a36;
  box-shadow: 0 26px 52px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  display: grid;
  grid-template-rows: 1fr auto;
}

.screen-content {
  padding: 8px 14px 12px;
  overflow: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 55, 55, 0.06), transparent 26%),
    repeating-linear-gradient(90deg, transparent, transparent 48px, rgba(255, 55, 55, 0.015) 48px, rgba(255, 55, 55, 0.015) 49px);
}

.screen-content::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.muted {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.top-row h1 {
  margin: 2px 0 0;
  font-size: 1.05rem;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.search-row {
  margin-top: 8px;
}

.search-row input {
  width: 100%;
  border: 1px solid #303646;
  border-radius: 11px;
  background: #141924;
  color: #e4e8f2;
  padding: 8px 10px;
  outline: none;
}

.search-row input::placeholder {
  color: #8f97ad;
}

.top-actions button,
.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #171b24;
  color: #d4d9e6;
  display: grid;
  place-items: center;
  text-decoration: none;
  cursor: pointer;
}

.hero-banner {
  margin-top: 12px;
  border-radius: 14px;
  padding: 12px;
  background:
    radial-gradient(circle at 85% 20%, rgba(255, 70, 70, 0.22), transparent 35%),
    linear-gradient(120deg, #1b1d24, #3a1414 45%, #11141c);
  color: #fff;
  display: grid;
  grid-template-columns: 1fr 130px;
  gap: 8px;
  align-items: center;
  min-height: 122px;
}

.hero-copy h2 {
  margin: 0;
  font-size: 0.95rem;
}

.hero-copy p {
  margin: 4px 0 0;
  font-size: 0.72rem;
  opacity: 0.92;
  line-height: 1.3;
}

.hero-btn {
  margin-top: 10px;
  display: inline-block;
  border-radius: 999px;
  background: linear-gradient(120deg, #9a1010, #ff2f2f);
  color: #fff;
  border: 1px solid rgba(255, 90, 90, 0.55);
  text-decoration: none;
  padding: 5px 12px;
  font-size: 0.72rem;
  font-weight: 700;
}

.hero-banner img {
  width: 124px;
  height: 100px;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.55));
}

.hero-dots {
  margin-top: 8px;
  display: flex;
  justify-content: center;
  gap: 6px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3f4556;
}

.dot.active {
  background: var(--accent);
}

.block-head {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.block-head h3 {
  margin: 0;
  font-size: 0.9rem;
}

.block-head a {
  text-decoration: none;
  color: #d05252;
  font-size: 0.72rem;
}

.category-chips {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  overflow-x: hidden;
  padding-bottom: 2px;
}

.category-chip {
  border: 1px solid #2a3040;
  background: linear-gradient(180deg, #1a1f2a, #141820);
  color: #c8cfde;
  border-radius: 11px;
  padding: 8px 10px;
  min-width: 0;
  flex: 1 1 calc(33.333% - 8px);
  display: grid;
  justify-items: center;
  gap: 3px;
  cursor: pointer;
  font-size: 0.72rem;
  white-space: normal;
}

.category-chip.active {
  border-color: var(--accent);
  color: #ffd7d7;
  background: linear-gradient(180deg, #341616, #231414);
}

.recommend-grid {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding-bottom: 8px;
}

.home-watermark {
  margin: 10px 0 6px;
  pointer-events: none;
  user-select: none;
  text-align: center;
  opacity: 0.48;
}

.wm-logo {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  line-height: 1;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #f1f4fb;
  text-transform: lowercase;
}

.wm-power {
  width: 0.9em;
  height: 0.9em;
  border-radius: 50%;
  display: inline-block;
  position: relative;
  background: radial-gradient(circle at 50% 35%, #ff6f6f, #ff2c2c 58%, #b10c0c);
  box-shadow: inset 0 0 0 0.08em rgba(255, 255, 255, 0.15);
}

.wm-power::before {
  content: "";
  position: absolute;
  width: 0.14em;
  height: 0.42em;
  border-radius: 0.08em;
  background: #f4f7ff;
  top: 0.16em;
  left: 50%;
  transform: translateX(-50%);
}

.wm-power::after {
  content: "";
  position: absolute;
  inset: 0.16em;
  border: 0.1em solid #f4f7ff;
  border-radius: 50%;
}

.wm-x {
  position: relative;
}

.wm-x::after {
  content: "⚡";
  position: absolute;
  top: -0.2em;
  left: 0.28em;
  font-size: 0.62em;
  color: #ff3333;
}

.home-watermark p {
  margin: 2px 0 0;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #ff8a8a;
  text-transform: uppercase;
}

.product-card {
  border: 1px solid var(--border);
  border-radius: 13px;
  background: linear-gradient(180deg, #191e29, #12151d);
  padding: 8px;
  display: grid;
  gap: 6px;
  cursor: pointer;
}

.product-image-box {
  position: relative;
  border-radius: 10px;
  background:
    radial-gradient(circle at 50% 90%, rgba(255, 56, 56, 0.11), transparent 50%),
    #0f1219;
  min-height: 106px;
  display: grid;
  place-items: center;
}

.product-image-box img {
  width: 92px;
  height: 92px;
  object-fit: contain;
}

.fav-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid #3a4052;
  background: #171b24;
  color: #a5adbf;
  cursor: pointer;
}

.fav-btn.active {
  color: #ff4d4d;
}

.price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.price-row strong {
  font-size: 0.82rem;
}

.rating {
  font-size: 0.68rem;
  color: #9ea6b9;
}

.product-title {
  margin: 0;
  font-size: 0.73rem;
  line-height: 1.25;
  min-height: 2.4em;
  color: #c9cfdd;
}

.details-top {
  display: grid;
  grid-template-columns: 32px 1fr 32px;
  align-items: center;
  gap: 10px;
}

.details-top h2 {
  margin: 0;
  text-align: center;
  font-size: 0.95rem;
}

.detail-image-card {
  margin-top: 10px;
  border-radius: 14px;
  background: #141821;
  border: 1px solid var(--border);
  padding: 12px;
}

.detail-main-image {
  width: 220px;
  height: 180px;
  margin: 0 auto;
  object-fit: contain;
}

.detail-gallery-thumbs {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.detail-gallery-thumbs::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.detail-thumb {
  min-width: 58px;
  width: 58px;
  border: 1px solid #313747;
  border-radius: 10px;
  padding: 4px;
  background: #171b24;
  cursor: pointer;
  display: grid;
  gap: 4px;
  justify-items: center;
}

.detail-thumb img {
  width: 48px;
  height: 44px;
  object-fit: contain;
}

.detail-thumb small {
  font-size: 0.6rem;
  color: #aeb6c9;
  text-align: center;
  line-height: 1.1;
}

.detail-thumb.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.product-head {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}

.product-head h1 {
  margin: 0;
  font-size: 1rem;
}

.product-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.product-head strong {
  color: #ffd7d7;
  font-size: 0.98rem;
  white-space: nowrap;
}

.option-head h3,
.qty-row h3 {
  margin: 12px 0 6px;
  font-size: 0.84rem;
}

.variant-options {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.variant-btn {
  border: 1px solid #313747;
  border-radius: 10px;
  background: #171b24;
  padding: 6px;
  min-width: 68px;
  text-align: center;
  cursor: pointer;
}

.variant-btn img {
  width: 52px;
  height: 40px;
  margin: 0 auto;
  object-fit: contain;
}

.variant-btn small {
  font-size: 0.66rem;
  color: #afb6c8;
}

.variant-btn.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.qty-row {
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.qty-control {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.qty-control button {
  width: 34px;
  height: 30px;
  border: 0;
  background: #171b24;
  color: #e1e5ef;
  cursor: pointer;
}

.qty-control span {
  min-width: 34px;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  border-inline: 1px solid var(--border);
  background: #12151d;
}

.description {
  margin: 12px 0 0;
  color: #9ea6bb;
  font-size: 0.72rem;
  line-height: 1.45;
}

.action-row {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 8px;
}

.ghost-btn,
.primary-btn {
  height: 40px;
  border-radius: 12px;
  border: 0;
  cursor: pointer;
  font-weight: 700;
}

.ghost-btn {
  background: #1a1f2a;
  color: #d5dbe9;
}

.primary-btn {
  background: linear-gradient(120deg, #991010, #ff2f2f);
  color: #fff;
}

.cart-list {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.cart-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #171b24;
  padding: 8px;
  display: grid;
  grid-template-columns: 54px 1fr auto;
  gap: 8px;
  align-items: center;
}

.cart-item img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  border-radius: 8px;
  background: #0f1219;
}

.cart-item h4 {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.2;
}

.cart-item p {
  margin: 2px 0 0;
  color: #a3abc0;
  font-size: 0.7rem;
}

.mini-qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.mini-qty button {
  width: 24px;
  height: 24px;
  border: 0;
  background: #171b24;
  color: #d8deec;
  cursor: pointer;
}

.mini-qty span {
  min-width: 22px;
  text-align: center;
  font-size: 0.74rem;
}

.checkout-summary {
  margin-top: 12px;
  border-radius: 14px;
  padding: 12px;
  background:
    radial-gradient(circle at 85% 15%, rgba(255, 90, 90, 0.2), transparent 28%),
    linear-gradient(160deg, #131720, #2a1010 50%, #9b1313);
  color: #fff;
}

.sum-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  margin-bottom: 7px;
}

.sum-row.total {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 103, 103, 0.4);
  font-size: 0.95rem;
  font-weight: 700;
}

.checkout-btn {
  margin-top: 8px;
  width: 100%;
  height: 42px;
  border: 1px solid rgba(255, 96, 96, 0.5);
  border-radius: 12px;
  background: linear-gradient(120deg, #8f1010, #ff2f2f);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.customer-form-section {
  margin-top: 12px;
  border-radius: 14px;
  padding: 12px;
  border: 1px solid #343b4f;
  background:
    radial-gradient(circle at 15% 10%, rgba(255, 56, 56, 0.14), transparent 32%),
    linear-gradient(160deg, #151923, #11151e);
}

.customer-form-section h3 {
  margin: 0;
  font-size: 0.92rem;
  color: #f5f7fd;
}

.form-hint {
  margin: 4px 0 10px;
  color: #a8b0c6;
  font-size: 0.72rem;
}

.customer-form {
  display: grid;
  gap: 8px;
}

.field {
  display: grid;
  gap: 4px;
}

.field span {
  font-size: 0.74rem;
  color: #c9d0e0;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid #333a4e;
  border-radius: 10px;
  background: #181d28;
  color: #eef2fb;
  padding: 9px 10px;
  outline: none;
}

.field textarea {
  resize: vertical;
  min-height: 62px;
}

.field input:focus,
.field textarea:focus {
  border-color: #ff4444;
  box-shadow: 0 0 0 2px rgba(255, 68, 68, 0.2);
}

.form-actions {
  margin-top: 4px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.empty-state {
  border: 1px dashed #434a60;
  border-radius: 12px;
  padding: 16px 12px;
  text-align: center;
  color: #a1a8bd;
}

.empty-state a {
  color: #ff4b4b;
  text-decoration: none;
  font-weight: 700;
}

.bottom-nav {
  padding: 10px 14px 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  background:
    linear-gradient(180deg, rgba(255, 42, 42, 0.08), transparent 45%),
    #0f1219;
  position: sticky;
  bottom: 0;
  z-index: 9;
  border-top: 1px solid #272d3a;
}

.nav-item {
  text-decoration: none;
  border-radius: 12px;
  border: 1px solid #2a3040;
  height: 46px;
  background: #171b24;
  color: #a9b0c3;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1px;
}

.nav-item span {
  line-height: 1;
}

.nav-item small {
  font-size: 0.64rem;
}

.nav-item.active {
  background: linear-gradient(120deg, var(--accent-dark), var(--accent));
  color: #fff;
  border-color: transparent;
}

/* Force checkout page dark/red palette to avoid any legacy light cache bleed */
body[data-page="checkout"] .phone-shell,
body[data-page="checkout"] .screen-content {
  background: linear-gradient(180deg, #0f1218, #0b0d13) !important;
}

body[data-page="checkout"] .details-top h2 {
  color: #f0f3fa !important;
}

body[data-page="checkout"] .icon-btn {
  background: #171b24 !important;
  border-color: #2f3647 !important;
  color: #dde2ef !important;
}

body[data-page="checkout"] .cart-item,
body[data-page="checkout"] .mini-qty,
body[data-page="checkout"] .mini-qty button {
  background: #171b24 !important;
  border-color: #2f3647 !important;
  color: #dde2ef !important;
}

body[data-page="checkout"] .cart-item p {
  color: #aab2c8 !important;
}

body[data-page="checkout"] .checkout-summary {
  background:
    radial-gradient(circle at 85% 15%, rgba(255, 90, 90, 0.2), transparent 28%),
    linear-gradient(160deg, #131720, #2a1010 50%, #9b1313) !important;
  color: #fff !important;
}

body[data-page="checkout"] .checkout-btn {
  background: linear-gradient(120deg, #8f1010, #ff2f2f) !important;
  color: #fff !important;
  border-color: rgba(255, 96, 96, 0.5) !important;
}

body[data-page="checkout"] .customer-form-section {
  border-color: #323a4d !important;
  background:
    radial-gradient(circle at 15% 10%, rgba(255, 56, 56, 0.14), transparent 32%),
    linear-gradient(160deg, #151923, #11151e) !important;
}

body[data-page="checkout"] .field input,
body[data-page="checkout"] .field textarea {
  background: #181d28 !important;
  border-color: #333a4e !important;
  color: #eef2fb !important;
}

body[data-page="checkout"] .sum-row,
body[data-page="checkout"] .sum-row strong,
body[data-page="checkout"] .sum-row.total {
  color: #fff !important;
}

body[data-page="checkout"] .empty-state {
  background: #151922 !important;
  border-color: #3a4156 !important;
  color: #aab2c8 !important;
}

@media (min-width: 700px) {
  .screen-content {
    padding: 14px 18px;
  }

  body[data-page="home"] .category-chip {
    flex: 1 1 calc(20% - 8px);
  }

  body[data-page="home"] .recommend-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hero-banner {
    grid-template-columns: 1fr 180px;
    min-height: 148px;
  }

  .hero-banner img {
    width: 170px;
    height: 126px;
  }
}

@media (min-width: 1024px) {
  .phone-shell {
    width: min(1280px, 100%);
  }

  body[data-page="home"] .screen-content {
    max-width: 1140px;
    margin-inline: auto;
    width: 100%;
  }

  body[data-page="home"] .recommend-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  body[data-page="details"] .screen-content {
    max-width: 760px;
    margin-inline: auto;
    width: 100%;
  }

  body[data-page="checkout"] .screen-content {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(280px, 1fr);
    gap: 12px 14px;
    align-content: start;
  }

  body[data-page="checkout"] .details-top {
    grid-column: 1 / -1;
  }

  body[data-page="checkout"] #cartList {
    grid-column: 1;
    margin-top: 0;
  }

  body[data-page="checkout"] .checkout-summary {
    grid-column: 2;
    margin-top: 0;
    position: sticky;
    top: 8px;
  }

  body[data-page="checkout"] .customer-form-section {
    grid-column: 2;
    margin-top: 0;
  }
}

@media (max-width: 460px) {
  .app-wrap {
    padding: 0;
  }

  .phone-shell {
    width: 100%;
    height: 100vh;
    min-height: 100vh;
    border-radius: 0;
    border: 0;
    box-shadow: none;
  }
}
