*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0
}

html {
  -webkit-tap-highlight-color: transparent
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: #0d0d0d;
  color: #f0ece4;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  box-shadow: 0 0 100px rgba(0, 0, 0, 0.8);
}

:root {
  --bg: #0d0d0d;
  --s1: #161616;
  --s2: #1e1e1e;
  --s3: #282828;
  --border: rgba(255, 255, 255, 0.06);
  --gold: #c9a96e;
  --gold2: #e2c17e;
  --text: #f0ece4;
  --muted: #666;
  --dim: #333;
  --r: 14px;
  --rs: 9px;
}

/* ── HEADER ── */
.header {
  position: sticky;
  top: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  gap: 10px;
  background: rgba(13, 13, 13, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  width: 100%;
}

.logo {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--gold2);
  flex-shrink: 0;
}

/* ── SEARCH PILL ── */
.search-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--s2);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 7px 14px;
  flex: 1;
  max-width: 240px;
  transition: border-color .15s, max-width .25s ease;
}

.search-pill:focus-within {
  border-color: rgba(201, 169, 110, 0.4);
  max-width: 280px;
}

.search-pill svg {
  width: 13px;
  height: 13px;
  stroke: var(--muted);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.search-pill input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  caret-color: var(--gold);
  min-width: 0;
}

.search-pill input::placeholder {
  color: var(--dim);
  font-size: 12px
}

.clear-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 10px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  flex-shrink: 0;
  transition: color .15s;
}

.clear-btn:hover {
  color: var(--text)
}

/* ── HOME ── */
#homeView {
  min-height: calc(100dvh - 60px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 28px;
  text-align: center;
  gap: 12px;
  animation: fadeScaleIn 0.38s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.home-icon {
  font-size: 44px;
  opacity: .5
}

.home-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text)
}

.home-sub {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
  max-width: 270px
}

/* ── FOLDER HEADER ── */
.folder-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--s1);
  position: sticky;
  top: 60px;
  z-index: 80;
  width: 100%;
  animation: fadeScaleIn 0.38s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.fh-inner {
  display: flex;
  align-items: center;
  gap: 10px
}

.fh-emoji {
  font-size: 22px;
  flex-shrink: 0
}

.fh-code {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 2px;
}

.fh-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text)
}

/* ── PRODUCT COUNT BAR ── */
.product-count-bar {
  padding: 9px 16px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

/* ── STATE MESSAGES ── */
.state-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 28px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  gap: 10px;
  min-height: 40vh;
  animation: fadeScaleIn 0.38s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.state-message .big {
  font-size: 38px
}

.state-message b {
  color: var(--text);
  font-weight: 600
}

.state-message p {
  line-height: 1.7
}

/* ── PRODUCT GRID ── */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 12px;
  animation: fadeScaleIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ── CARD ── */
.card {
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  cursor: pointer;
  transition: transform .12s ease;
  contain: layout style;
  will-change: transform;
}

.card:active {
  transform: scale(0.96)
}

.card-img {
  width: 100%;
  aspect-ratio: 1/1;
  background: var(--s2);
  position: relative;
  overflow: hidden
}

.card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .25s;
  display: block
}

.card-img img.show {
  opacity: 1
}

.tag-row {
  display: flex;
  gap: 4px;
  padding: 8px 9px 0;
  flex-wrap: wrap
}

.tag {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 100px
}

.tag.mall {
  background: rgba(100, 160, 255, .15);
  color: #82b4ff
}

.tag.diskon {
  background: rgba(255, 100, 80, .15);
  color: #ff8070
}

.tag.best {
  background: rgba(200, 169, 110, .15);
  color: var(--gold2)
}

.tag.baru {
  background: rgba(100, 220, 130, .15);
  color: #7de09a
}

.tag.terlaris {
  background: rgba(255, 180, 60, .15);
  color: #ffbc3c
}

.tag.flash {
  background: rgba(255, 80, 160, .15);
  color: #ff7acc
}

.tag.free {
  background: rgba(120, 200, 255, .15);
  color: #8ad4ff
}

.card-body {
  padding: 12px 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 35px;
}

.card-prices {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 2px 0 4px;
}

.card-price {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.2px;
}

.card-price-old {
  font-size: 11px;
  color: var(--dim);
  text-decoration: line-through;
  font-weight: 400;
  opacity: 0.6;
}

.card-btn {
  width: 100%;
  background: var(--gold);
  color: #0d0d0d;
  border: none;
  border-radius: var(--rs);
  padding: 10px 0;
  font-size: 12px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  transition: transform .1s ease, opacity .12s;
}

.card-btn:active {
  transform: scale(0.97);
  opacity: 0.9;
}

/* ── SPINNER + SENTINEL ── */
.load-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 22px;
  color: var(--muted);
  font-size: 13px
}

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--s3);
  border-top-color: var(--gold);
  animation: spin .7s linear infinite
}

@keyframes spin {
  to {
    transform: rotate(360deg)
  }
}

.sentinel {
  height: 1px;
  margin-bottom: 20px
}

.empty-msg {
  text-align: center;
  padding: 50px 20px;
  color: var(--muted);
  font-size: 13px;
  grid-column: 1/-1
}

.empty-msg .big {
  font-size: 36px;
  margin-bottom: 10px
}

/* ── FADE IN ANIMATIONS ── */
@keyframes fadeScaleIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.fi {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .35s cubic-bezier(0.16, 1, 0.3, 1), transform .35s cubic-bezier(0.16, 1, 0.3, 1);
}

.fi.v {
  opacity: 1;
  transform: translateY(0);
}