@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;
  --card-shadow: 0 4px 10px rgba(120, 70, 20, .18);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  font-family: 'Grobold', 'PingFang SC', 'Microsoft YaHei', 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; }

/* ---------------- phone frame ---------------- */
.phone {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
}

.store {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--cream);
  overflow: hidden;
}

/* ---------------- header / awning ---------------- */
.store-head {
  position: relative;
  height: 70px;
  flex: 0 0 70px;
  background: url('../images/store/shop.webp') repeat-x top center;
  background-size: auto 86px;
  z-index: 20;
}

.id-pill {
  position: absolute;
  left: 10px;
  top: 18px;
  height: 44px;
  min-width: 150px;
  padding: 0 16px 0 46px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: url('../images/store/spin_bg.webp') no-repeat left center;
  background-size: auto 100%;
  color: #3a6ea5;
  font-size: 17px;
  white-space: nowrap;
}
.id-pill .id-pill-label {
  color: #b98b4e;
  font-size: 13px;
}

.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;
}
.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);
}

.section { padding-top: 6px; }

.section-title {
  text-align: center;
  font-size: 24px;
  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;
}

/* small benefit chips under the count (vip / clover / etc.) */
.card-benefit {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 2px;
  min-height: 16px;
}
.card-benefit span {
  display: flex;
  align-items: center;
  gap: 1px;
  font-size: 10px;
  color: #8a5a20;
}
.card-benefit img { width: 15px; height: 15px; object-fit: contain; }

.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));
}

.card-extras {
  position: absolute;
  right: 6px;
  top: 30px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.card-extras span {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  color: #7a4ea8;
  -webkit-text-stroke: 2px #fff;
  paint-order: stroke fill;
}
.card-extras img { width: 22px; height: 22px; object-fit: contain; }

/* ---------------- 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; }

/* ---------------- free banner ---------------- */
.free-banner {
  margin: 16px 0 4px;
  height: 92px;
  border-radius: 18px;
  background: linear-gradient(#ffd34d, #f5a623);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.5), 0 3px 6px rgba(150,90,20,.25);
  display: flex;
  align-items: center;
  padding: 8px 10px;
  gap: 8px;
  position: relative;
  overflow: hidden;
}
.free-banner .fb-gift {
  height: 74px;
  filter: drop-shadow(0 3px 3px rgba(0,0,0,.2));
}
.free-banner .fb-items {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}
.free-banner .fb-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #6a4cc0;
  font-size: 15px;
  -webkit-text-stroke: 3px #fff;
  paint-order: stroke fill;
}
.free-banner .fb-item img { width: 46px; height: 46px; object-fit: contain; }
.free-banner .fb-btn {
  width: 70px;
  height: 70px;
  border-radius: 16px;
  background: var(--green);
  border-bottom: 4px solid var(--green-edge);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 17px;
  cursor: pointer;
  text-shadow: 0 2px 0 rgba(0,0,0,.22);
}
.free-banner .fb-btn:active { transform: translateY(2px); }

/* ---------------- 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: 80;
  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: 90;
  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); }

/* ---------------- result modal ---------------- */
.result-mask {
  position: fixed;
  inset: 0;
  z-index: 85;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, .5);
}
.result-card {
  width: 100%;
  max-width: 320px;
  background: var(--cream);
  border-radius: 24px;
  padding: 26px 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(.8); opacity: 0; } }
.result-card h2 {
  margin: 0 0 16px;
  font-size: 24px;
  color: #69bd1f;
  -webkit-text-stroke: 4px #fff;
  paint-order: stroke fill;
}
.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; }
