@font-face {
  font-family: 'Grobold';
  src: url('../font/GROBOLD-1.ttf') format('truetype');
  font-display: swap;
}

:root {
  --green: linear-gradient(#8ed831, #69bd1f);
  --green-edge: #4f9716;
  --cream: #fbe7bd;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  font-family: 'Grobold', 'Helvetica Neue', Arial, sans-serif;
  user-select: none;
}

body {
  background: radial-gradient(120% 80% at 50% 0%, #2d5d82 0%, #1a3851 60%, #122941 100%);
  color: #5a3a1a;
}

img { -webkit-user-drag: none; user-drag: none; }
.hidden { display: none !important; }

/* ---------------- frame ---------------- */
.phone {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.store {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--cream);
  overflow: hidden;
}

/* desktop / wide screens: widen into a full panel, not a phone card.
   NOTE: per-component overrides live at the END of this file so they win
   the source-order cascade against the base rules defined below. */
@media (min-width: 560px) {
  .phone { padding: 28px; }
  .store {
    max-width: 1040px;
    height: min(900px, 94vh);
    max-height: 900px;
    border-radius: 26px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
  }
}

/* ---------------- header / awning ---------------- */
.store-head {
  position: relative;
  height: 72px;
  flex: 0 0 72px;
  background: url('../images/store/shop.webp') repeat-x top center;
  background-size: auto 88px;
  z-index: 20;
}

/* ID pill — framed box, number sits inside */
.id-pill {
  position: absolute;
  left: 14px;
  top: 15px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 4px 6px 4px 5px;
  background: linear-gradient(#fff8e8, #ffe9c2);
  border: 2px solid #e9c987;
  border-radius: 24px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), 0 3px 6px rgba(120, 80, 20, .25);
}
.id-pill .id-icon {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #fff, #ffe6b8);
  border: 1.5px solid #e9c987;
  display: flex;
  align-items: center;
  justify-content: center;
}
.id-pill .id-icon img { width: 24px; height: 24px; object-fit: contain; }
.id-pill .id-label {
  font-size: 12px;
  color: #c0934a;
  letter-spacing: .5px;
}
.id-pill .id-num {
  display: inline-block;
  max-width: 150px;
  padding: 3px 12px;
  background: #fffdf6;
  border: 1.5px solid #ecd29a;
  border-radius: 13px;
  font-size: 15px;
  color: #6b4a22;
  letter-spacing: .5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.close-btn {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 46px;
  height: 46px;
  cursor: pointer;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .25));
  transition: transform .1s;
  z-index: 21;
}
.close-btn:active { transform: scale(.9); }

/* ---------------- scroll area ---------------- */
.scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px 14px 24px;
  background:
    url('../images/store/bf.png') no-repeat top center / 100% auto,
    var(--cream);
}
.scroll::-webkit-scrollbar { width: 8px; }
.scroll::-webkit-scrollbar-thumb { background: rgba(170, 120, 50, .35); border-radius: 4px; }
.scroll::-webkit-scrollbar-track { background: transparent; }

.section { padding-top: 6px; }

.section-title {
  text-align: center;
  font-size: 26px;
  margin: 16px 0 16px;
  -webkit-text-stroke: 5px #fff;
  paint-order: stroke fill;
  text-shadow: 0 3px 0 rgba(0, 0, 0, .12);
  letter-spacing: .5px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

/* ---------------- product card ---------------- */
.card {
  position: relative;
  aspect-ratio: 100 / 138;
  padding: 8px 6px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: url('../images/store/Group179.webp') no-repeat center / 100% 100%;
}
.card-count {
  font-size: 23px;
  line-height: 1;
  margin-top: 4px;
  -webkit-text-stroke: 4.5px #fff;
  paint-order: stroke fill;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .12);
}
.card-icon {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
  margin: 2px 0;
}
.card-icon img {
  max-width: 84%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .18));
}

/* ---------------- buy button ---------------- */
.buy-btn {
  width: 100%;
  border: none;
  border-radius: 20px;
  padding: 9px 4px;
  background: var(--green);
  border-bottom: 4px solid var(--green-edge);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .45), 0 2px 4px rgba(0, 0, 0, .12);
  color: #fff;
  font-family: 'Grobold', sans-serif;
  font-size: 16px;
  letter-spacing: .5px;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .22);
  cursor: pointer;
  transition: transform .08s, filter .15s;
}
.buy-btn:active { transform: translateY(3px); border-bottom-width: 1px; }
.buy-btn[disabled] { filter: grayscale(.4) brightness(.95); cursor: default; }

/* ---------------- tab bar ---------------- */
.tabbar {
  flex: 0 0 76px;
  display: flex;
  background: linear-gradient(#fbe7bd, #f3d295);
  border-top: 2px solid #e7c98c;
  box-shadow: 0 -3px 8px rgba(120, 80, 20, .12);
  z-index: 20;
}
.tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: background .15s;
}
.tab img { height: 46px; object-fit: contain; transition: transform .15s; }
.tab.active { background: linear-gradient(#fff6df, #fbe7bd); }
.tab.active img { transform: scale(1.18) translateY(-2px); }
.tab.active::after {
  content: '';
  position: absolute;
  top: 0; left: 12%; right: 12%;
  height: 4px;
  border-radius: 0 0 4px 4px;
  background: #f0a02a;
}

/* ---------------- gate (login) ---------------- */
.gate {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(120% 80% at 50% 0%, #2d5d82 0%, #14304a 100%);
}
.gate-card {
  width: 100%;
  max-width: 360px;
  background: var(--cream);
  border-radius: 24px;
  padding: 30px 26px 28px;
  text-align: center;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .4), inset 0 3px 0 rgba(255, 255, 255, .5);
}
.gate-logo { width: 84px; margin-bottom: 6px; filter: drop-shadow(0 4px 5px rgba(0, 0, 0, .2)); }
.gate-card h1 {
  margin: 4px 0 6px;
  font-size: 26px;
  color: #f0633a;
  -webkit-text-stroke: 4px #fff;
  paint-order: stroke fill;
}
.gate-card p { margin: 0 0 20px; font-size: 14px; color: #9a7038; }
.gate-input {
  width: 100%;
  height: 50px;
  border: 3px solid #e7c98c;
  border-radius: 14px;
  background: #fffaf0;
  padding: 0 16px;
  font-size: 18px;
  color: #5a3a1a;
  font-family: inherit;
  outline: none;
  text-align: center;
}
.gate-input:focus { border-color: #f0a02a; }
.gate-btn {
  width: 100%;
  height: 52px;
  margin-top: 16px;
  border: none;
  border-radius: 16px;
  background: var(--green);
  border-bottom: 5px solid var(--green-edge);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .45);
  color: #fff;
  font-family: inherit;
  font-size: 20px;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .22);
  cursor: pointer;
}
.gate-btn:active { transform: translateY(3px); border-bottom-width: 2px; }
.gate-btn[disabled] { filter: grayscale(.4); }
.gate-err { min-height: 20px; margin-top: 12px; color: #e23b3b; font-size: 14px; }

/* ---------------- loading ---------------- */
.loading {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .35);
}
.spinner {
  width: 52px;
  height: 52px;
  border: 6px solid rgba(255, 255, 255, .35);
  border-top-color: #ffd34d;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 110px;
  transform: translateX(-50%) translateY(20px);
  z-index: 95;
  max-width: 80%;
  padding: 12px 22px;
  background: rgba(40, 20, 5, .92);
  color: #fff;
  border-radius: 24px;
  font-size: 15px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------------- modals (result + payment) ---------------- */
.mask {
  position: fixed;
  inset: 0;
  z-index: 85;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, .5);
}
.modal-card {
  width: 100%;
  max-width: 340px;
  background: var(--cream);
  border-radius: 24px;
  padding: 24px 22px 22px;
  text-align: center;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .4), inset 0 3px 0 rgba(255, 255, 255, .5);
  animation: pop .25s ease;
}
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.modal-card h2 {
  margin: 0 0 16px;
  font-size: 22px;
  color: #f0633a;
  -webkit-text-stroke: 4px #fff;
  paint-order: stroke fill;
}
.result-card h2 { color: #69bd1f; }

.result-rewards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-bottom: 20px;
}
.result-rewards .rw {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 17px;
  color: #5a3a1a;
}
.result-rewards .rw img { width: 56px; height: 56px; object-fit: contain; }

/* payment summary + methods */
.pay-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 10px 14px;
  background: #fffaf0;
  border: 2px solid #ecd9a8;
  border-radius: 14px;
}
.pay-summary img { width: 46px; height: 46px; object-fit: contain; }
.pay-summary .ps-count { font-size: 18px; color: #5a3a1a; }
.pay-summary .ps-price { margin-left: auto; font-size: 19px; color: #69bd1f; }

.pay-methods { display: flex; flex-direction: column; gap: 12px; }
.pay-method {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 52px;
  border: none;
  border-radius: 14px;
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
  transition: transform .08s, filter .15s;
}
.pay-method:active { transform: translateY(2px); }
.pay-apple { background: #000; color: #fff; }
.pay-google { background: #fff; color: #3c4043; border: 1px solid #dadce0; }
.pay-cashapp { background: #00d632; color: #fff; }
.pay-cancel {
  margin-top: 14px;
  background: none;
  border: none;
  color: #9a7038;
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
  text-decoration: underline;
}

/* ---------------- desktop layout overrides ---------------- */
/* Placed last so they win source order over the mobile base rules above.
   Goal: use the full panel width with a real multi-column grid on PC,
   instead of forcing the narrow phone layout. */
@media (min-width: 560px) {
  .store-head { height: 80px; flex: 0 0 80px; }
  .scroll { padding: 14px 30px 32px; }
  .section { padding-top: 8px; }
  .section-title { font-size: 30px; margin: 22px 0 20px; }
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(146px, 1fr));
    gap: 18px;
  }
  .tabbar { flex-basis: 84px; }
  .tab img { height: 52px; }
}
