/* Serene Game Store — cyan + white, mobile-first */
:root {
  --cyan: #06b6d4;
  --cyan-dark: #0891b2;
  --cyan-light: #ecfeff;
  --ink: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --danger: #dc2626;
  --ok: #16a34a;
  --warn: #d97706;
  --radius: 14px;
}

/* The `hidden` attribute must win over display rules like .modal-backdrop's flex */
[hidden] { display: none !important; }

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Myanmar", sans-serif;
  color: var(--ink);
  background: #f8fafc;
}

.site-header {
  background: linear-gradient(135deg, var(--cyan), var(--cyan-dark));
  color: #fff;
  padding: 16px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { height: 56px; width: auto; display: block; }
.brand-name { font-size: 1.4rem; font-weight: 800; display: block; }
.brand-tag { font-size: 0.85rem; opacity: 0.9; }
.auth-logo { display: block; margin: 4px auto 14px; width: 200px; max-width: 65%; }

.welcome-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  background: linear-gradient(135deg, var(--cyan), var(--cyan-dark));
  color: #fff;
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 16px;
}
.welcome-logo { height: 72px; width: auto; display: block; }
.welcome-title { margin: 0; font-size: 1.5rem; font-weight: 800; }
.welcome-side { margin-left: auto; text-align: right; font-size: 1rem; }
.welcome-balance { margin-top: 2px; }
.welcome-balance strong { font-size: 1.2rem; }

.section-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}
.section-toggle-title { display: block; font-size: 1.25rem; font-weight: 700; }
.section-toggle-sub { display: block; margin-top: 2px; color: var(--muted); font-size: 0.9rem; }
.section-toggle[aria-expanded="true"] .product-chevron { transform: rotate(180deg); }
#langToggle { line-height: 1.7; padding-top: 6px; padding-bottom: 6px; }
#topupBody { margin-top: 14px; }

.header-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.16);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.9rem;
}

main { max-width: 960px; margin: 0 auto; padding: 16px; }

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

h2 { margin: 4px 0 12px; font-size: 1.25rem; }
h3 { margin: 18px 0 10px; font-size: 1.05rem; }

.btn {
  background: #fff;
  color: var(--cyan-dark);
  border: 1.5px solid var(--cyan);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: var(--cyan-light); }
.btn-primary { background: var(--cyan); color: #fff; border-color: var(--cyan); }
.btn-primary:hover { background: var(--cyan-dark); }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.7); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.15); }
.btn-small { padding: 4px 10px; font-size: 0.85rem; }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-block { width: 100%; margin-top: 6px; }
.link-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 6px;
  border: none;
  background: none;
  color: var(--cyan-dark);
  font-weight: 700;
  font-size: 0.92rem;
  text-decoration: underline;
  cursor: pointer;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.view-tabs { margin-top: 16px; }
.tab {
  flex: 1;
  padding: 10px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font-weight: 700;
  cursor: pointer;
  color: var(--muted);
}
.tab.active { border-color: var(--cyan); color: var(--cyan-dark); background: var(--cyan-light); }

.auth-card { max-width: 480px; margin: 24px auto; }
.auth-form label, .topup-form label, .modal label { display: block; margin-bottom: 12px; font-size: 0.92rem; font-weight: 600; }
input, select {
  width: 100%;
  margin-top: 5px;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  background: #fff;
}
input:focus, select:focus { outline: 2px solid var(--cyan); border-color: var(--cyan); }

.form-error { color: var(--danger); font-size: 0.9rem; }
.form-hint { color: var(--muted); font-size: 0.9rem; }

.user-bar {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 1.05rem;
}
.balance-amount { color: var(--cyan-dark); }

.category-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.cat-tab {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: #fff;
  font-weight: 600;
  cursor: pointer;
}
.cat-tab.active { background: var(--cyan); color: #fff; border-color: var(--cyan); }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
  align-items: start;
}
.product-card:not(.soon) { grid-column: 1 / -1; }
.product-card { display: flex; flex-direction: column; }
.product-card h3 { margin: 0 0 4px; }
.product-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}
.product-title { display: flex; flex-direction: column; gap: 2px; }
.product-name { font-size: 1.05rem; font-weight: 700; }
.product-meta { color: var(--muted); font-size: 0.88rem; }
.product-hint { color: var(--cyan-dark); font-size: 0.82rem; font-weight: 600; }
.product-chevron { color: var(--cyan-dark); font-size: 0.9rem; margin-top: 4px; transition: transform 0.2s; }
.product-header.open .product-chevron { transform: rotate(180deg); }
.product-body { margin-top: 12px; }
.region-checker { margin-bottom: 14px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--cyan-light); }
.region-checker h4 { margin: 0 0 8px; font-size: 1rem; }
.region-checker .form-hint { margin: 8px 0 0; }
.checker-row { display: flex; gap: 8px; flex-wrap: wrap; }
.checker-row input { flex: 1 1 110px; min-width: 0; }
.checker-row .btn { flex: 0 0 auto; }
.region-checker > label { display: block; font-size: 0.92rem; font-weight: 600; }
.region-checker select { margin: 5px 0 10px; }
.check-result { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.check-result p { margin: 2px 0; }
.product-sub { color: var(--muted); font-size: 0.88rem; margin: 0 0 10px; }
.package-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.package-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 12px 8px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.package-tile:hover { border-color: var(--cyan); }
.package-tile.selected {
  border-color: var(--cyan);
  background: var(--cyan-light);
  box-shadow: 0 0 0 1.5px var(--cyan) inset;
}
.tile-label { font-weight: 700; font-size: 1rem; }
.tile-price { font-weight: 600; color: var(--cyan-dark); font-size: 0.9rem; }
.buy-btn { width: 100%; padding: 12px 16px; font-size: 1.05rem; }
.product-card.soon { opacity: 0.72; }
.product-card.soon h3 { font-size: 1rem; }
.coming-soon {
  display: inline-block;
  align-self: flex-start;
  background: #eef2f5;
  color: var(--muted);
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  margin-top: 2px;
}
.seed-zone { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); }
.btn-quiet { background: transparent; border-color: #cbd5e1; color: var(--muted); }
.btn-quiet:hover { background: #f1f5f9; }

.pay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0 18px; }
.pay-card {
  border: 1.5px solid var(--cyan);
  background: var(--cyan-light);
  border-radius: 12px;
  padding: 12px;
}
.pay-card strong { display: block; margin-bottom: 4px; }
.pay-number { font-size: 1.15rem; font-weight: 800; letter-spacing: 0.5px; }

.topup-form { max-width: 600px; }

.list { display: flex; flex-direction: column; gap: 10px; }
.list-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  font-size: 0.95rem;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
  justify-content: space-between;
}
.list-item .meta { color: var(--muted); font-size: 0.85rem; }
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}
.badge-new, .badge-pending { background: #fef3c7; color: var(--warn); }
.badge-delivered, .badge-approved { background: #dcfce7; color: var(--ok); }
.badge-rejected { background: #fee2e2; color: var(--danger); }
.empty { color: var(--muted); }

.admin-actions { margin-bottom: 8px; }
.price-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.price-row input { width: 130px; }
.price-row .pkg-label { min-width: 120px; font-weight: 600; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}
.modal { width: 100%; max-width: 440px; margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 0.95rem;
  z-index: 100;
  max-width: 90vw;
  text-align: center;
}

/* Bottom navigation (Home, Order, Wallet, Cart, Profile) */
body.has-nav { padding-bottom: 92px; }
body.has-nav .toast { bottom: 100px; }
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  background: #fff;
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 10px rgba(15, 23, 42, 0.08);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
}
.bottom-nav .nav-item {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 2px 4px;
  border: none;
  background: none;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-radius: 10px;
}
.bottom-nav .nav-item svg { width: 24px; height: 24px; }
.bottom-nav .nav-item.active { color: var(--cyan-dark); background: var(--cyan-light); }
.nav-badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 20px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
}
.tab-panel { animation: panel-in 0.15s ease-out; }
@keyframes panel-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Wallet + Profile + Cart */
.wallet-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  background: linear-gradient(135deg, var(--cyan), var(--cyan-dark));
  color: #fff;
  border: none;
}
.wallet-label { font-size: 0.9rem; opacity: 0.92; }
.wallet-balance { font-size: 2rem; font-weight: 800; }
.wallet-user { font-size: 0.9rem; opacity: 0.9; }
.section-sub { color: var(--muted); margin: -6px 0 8px; font-size: 0.92rem; }
.profile-logo { display: block; margin: 2px auto 8px; width: 150px; max-width: 55%; }
.profile-card h2 { text-align: center; }
.profile-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--border);
  font-size: 0.98rem;
}
.profile-row span { color: var(--muted); }
.profile-signout { margin-top: 18px; }
.cart-empty { font-size: 1.05rem; font-weight: 700; margin: 6px 0 4px; }
.cart-item { border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 16px; background: var(--cyan-light); }
.cart-item-name { font-weight: 800; font-size: 1.05rem; margin-bottom: 8px; }
.cart-line { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: 0.98rem; }
.cart-line span { color: var(--muted); }
.cart-total { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 8px; font-weight: 700; }
.cart-total span { color: var(--ink); }
.cart-form label { display: block; margin-bottom: 12px; font-size: 0.92rem; font-weight: 600; }
.cart-region { margin-bottom: 12px; font-size: 0.95rem; }

@media (max-width: 560px) {
  .pay-grid { grid-template-columns: 1fr; }
  .brand-tag { display: none; }
  .welcome-logo { height: 54px; }
  .welcome-title { font-size: 1.15rem; }
  .welcome-side { margin-left: 0; text-align: left; width: 100%; }
  .package-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  main { padding: 12px; }
}
