:root {
  --hm-red: #ff3d3d;
  --hm-red-dark: #d6262b;
  --hm-navy: #1c1e26;
  --hm-navy-soft: #2a2d3a;
  --hm-cream: #f6f5f2;
  --hm-green: #21c07a;
  --hm-gold: #ffb020;
  --hm-purple: #8b5cf6;
  --hm-purple-dark: #6d3ff0;
  --hm-radius: 14px;
  --hm-shadow: 4px 4px 0 rgba(28, 30, 38, 0.9);
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-padding-top: calc(76px + env(safe-area-inset-top, 0px)); }

body {
  margin: 0;
  font-family: "Baloo 2", "Fredoka", system-ui, sans-serif;
  background: var(--hm-cream);
  color: var(--hm-navy);
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.hm-container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* ---------- Animasi dasar ---------- */
@keyframes hmFloat {
  0%, 100% { transform: translateY(0) rotate(var(--r, 0deg)); }
  50% { transform: translateY(-16px) rotate(var(--r, 0deg)); }
}
@keyframes hmFadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes hmPop {
  0% { opacity: 0; transform: scale(0.85); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes hmPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 61, 61, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(255, 61, 61, 0); }
}
@keyframes hmShine {
  from { background-position: -150% 0; }
  to { background-position: 250% 0; }
}
@keyframes hmBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-6px) scale(1.08); }
  60% { transform: translateY(0) scale(0.97); }
}
@keyframes hmGridDrift {
  from { background-position: 0 0; }
  to { background-position: 48px 48px; }
}

.hm-reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.5s ease, transform 0.5s ease; }
.hm-reveal.in { opacity: 1; transform: translateY(0); }

/* ---------- Header ---------- */
.hm-header {
  background: var(--hm-navy);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: env(safe-area-inset-top, 0px);
  border-bottom: 4px solid var(--hm-red);
}
.hm-header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 14px; padding-bottom: 14px; gap: 16px; flex-wrap: wrap;
}
.hm-logo {
  display: flex; align-items: center; gap: 8px;
  font-family: "Fredoka", sans-serif; font-weight: 700; font-size: 1.3rem;
  color: #fff; text-decoration: none; letter-spacing: 0.5px;
}
.hm-logo-block { width: 10px; height: 10px; display: inline-block; border-radius: 3px; animation: hmFloat 2.4s ease-in-out infinite; }
.hm-block-1 { background: var(--hm-red); --r: 6deg; animation-delay: 0s; }
.hm-block-2 { background: var(--hm-gold); --r: -8deg; margin-left: -4px; animation-delay: 0.2s; }
.hm-block-3 { background: var(--hm-green); --r: 10deg; margin-left: -4px; animation-delay: 0.4s; }

.hm-nav { display: flex; gap: 10px; flex-wrap: wrap; }
.hm-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px; text-decoration: none;
  font-weight: 600; font-size: 0.9rem; color: #fff;
  border: 2px solid rgba(255,255,255,0.15);
  transition: transform 0.15s ease, background 0.15s ease;
}
.hm-pill:hover { transform: translateY(-2px); }
.hm-pill-discord { background: #5865f2; }
.hm-pill-wa { background: #25d366; color: #123; }

.hm-header-actions { display: flex; align-items: center; gap: 10px; }
.hm-btn-onDark { border-color: rgba(255,255,255,0.5); color: #fff; }
.hm-btn-onDark:hover { background: rgba(255,255,255,0.08); }
#authArea { display: flex; align-items: center; gap: 8px; }
.hm-user-chip {
  display: flex; align-items: center; gap: 8px; color: #fff; font-size: 0.88rem; font-weight: 600;
}
.hm-user-chip .hm-avatar {
  width: 26px; height: 26px; border-radius: 50%; background: var(--hm-red);
  display: inline-flex; align-items: center; justify-content: center; font-size: 0.78rem; font-weight: 700;
}

.hm-cart-btn {
  background: var(--hm-red); color: #fff; border: none; border-radius: 10px;
  padding: 10px 14px; font-size: 1rem; font-weight: 700; cursor: pointer;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.35);
}
.hm-cart-count { background: #fff; color: var(--hm-red-dark); border-radius: 999px; padding: 1px 7px; font-size: 0.8rem; }

/* ---------- Hero ---------- */
.hm-hero {
  background: linear-gradient(180deg, var(--hm-navy) 0%, var(--hm-navy-soft) 100%);
  color: #fff; position: relative; overflow: hidden;
}
.hm-hero::before {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  animation: hmGridDrift 6s linear infinite;
  pointer-events: none;
}
.hm-hero-inner { padding: 70px 20px 60px; position: relative; text-align: left; max-width: 720px; }
.hm-hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px; background: rgba(255,61,61,0.15);
  border: 2px solid var(--hm-red); color: #ffb3b3; font-weight: 700; font-size: 0.8rem;
  padding: 5px 12px; border-radius: 999px; margin-bottom: 18px; animation: hmPop 0.6s ease both;
}
.hm-hero h1 {
  font-family: "Fredoka", sans-serif; font-size: clamp(2rem, 5vw, 3.1rem); line-height: 1.12; margin: 0 0 16px;
  animation: hmFadeUp 0.7s ease both; animation-delay: 0.1s;
}
.hm-hero .hm-red { color: var(--hm-red); }
.hm-hero p.hm-hero-sub { font-size: 1.05rem; opacity: 0.85; max-width: 520px; margin: 0 0 26px; animation: hmFadeUp 0.7s ease both; animation-delay: 0.2s; }

.hm-hero-highlights { display: flex; flex-wrap: wrap; gap: 10px; animation: hmFadeUp 0.7s ease both; animation-delay: 0.32s; }
.hm-highlight-chip {
  display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,0.08);
  border: 2px solid rgba(255,255,255,0.18); border-radius: 999px; padding: 7px 14px;
  font-size: 0.85rem; font-weight: 600;
}

.hm-hero-blocks { position: absolute; inset: 0; pointer-events: none; }
.cube { position: absolute; border-radius: 9px; opacity: 0.85; animation: hmFloat 5s ease-in-out infinite; }
.c1 { width: 46px; height: 46px; background: var(--hm-red); top: 16%; right: 14%; --r: 18deg; animation-duration: 4.5s; }
.c2 { width: 30px; height: 30px; background: var(--hm-gold); top: 46%; right: 5%; --r: -10deg; animation-duration: 3.8s; animation-delay: 0.4s; }
.c3 { width: 64px; height: 64px; background: var(--hm-green); bottom: 6%; right: 20%; --r: 8deg; opacity: 0.5; animation-duration: 6s; animation-delay: 0.8s; }
.c4 { width: 22px; height: 22px; background: #fff; top: 24%; right: 32%; --r: 20deg; opacity: 0.3; animation-duration: 4.2s; animation-delay: 0.2s; }
.c5 { width: 38px; height: 38px; background: var(--hm-purple); bottom: 18%; right: 3%; --r: -16deg; opacity: 0.55; animation-duration: 5.4s; animation-delay: 1s; }
.c6 { width: 18px; height: 18px; background: var(--hm-red); top: 62%; right: 38%; --r: 12deg; opacity: 0.4; animation-duration: 3.6s; animation-delay: 0.6s; }

/* ---------- Redfinger Cloudphone section ---------- */
.hm-redfinger { background: linear-gradient(135deg, #f4f0ff 0%, var(--hm-cream) 55%); padding: 54px 0; overflow: hidden; }
.hm-redfinger-head { max-width: 640px; margin: 0 auto 30px; text-align: center; }
.hm-redfinger-eyebrow {
  display: inline-flex; align-items: center; gap: 6px; background: rgba(139,92,246,0.12);
  color: var(--hm-purple-dark); border: 2px solid var(--hm-purple); font-weight: 700; font-size: 0.78rem;
  padding: 5px 12px; border-radius: 999px; margin-bottom: 14px;
}
.hm-redfinger-head h2 { font-family: "Fredoka", sans-serif; font-size: clamp(1.5rem, 3.5vw, 2.1rem); margin: 0 0 10px; }
.hm-redfinger-head p { color: #555; margin: 0; line-height: 1.6; }

.hm-redfinger-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.hm-benefit-card {
  background: #fff; border: 3px solid var(--hm-navy); border-radius: var(--hm-radius);
  box-shadow: 4px 4px 0 rgba(139, 92, 246, 0.35); padding: 20px 18px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.hm-benefit-card:hover { transform: translateY(-4px) rotate(-0.5deg); box-shadow: 6px 6px 0 rgba(139, 92, 246, 0.45); }
.hm-benefit-icon {
  width: 44px; height: 44px; border-radius: 12px; background: var(--hm-purple);
  display: flex; align-items: center; justify-content: center; font-size: 1.3rem; margin-bottom: 12px;
}
.hm-benefit-card h3 { font-family: "Fredoka", sans-serif; font-size: 1.02rem; margin: 0 0 6px; }
.hm-benefit-card p { font-size: 0.86rem; color: #666; margin: 0; line-height: 1.5; }

.hm-redfinger-cta { text-align: center; margin-top: 28px; }
.hm-btn-purple { background: var(--hm-purple); color: #fff; box-shadow: 3px 3px 0 rgba(0,0,0,0.25); }

/* ---------- Filter kategori ---------- */
.hm-filter-row { display: flex; gap: 8px; flex-wrap: wrap; padding: 4px 0 22px; }
.hm-filter-pill {
  border: 2px solid var(--hm-navy); background: #fff; color: var(--hm-navy);
  padding: 7px 16px; border-radius: 999px; font-weight: 700; font-size: 0.85rem;
  cursor: pointer; font-family: inherit; transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.hm-filter-pill:hover { transform: translateY(-2px); }
.hm-filter-pill.active { background: var(--hm-navy); color: #fff; }

/* ---------- Product grid ---------- */
.hm-section-title { padding: 36px 0 16px; }
.hm-section-title h2 { font-family: "Fredoka", sans-serif; font-size: 1.6rem; margin: 0; }

.hm-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 20px; padding-bottom: 60px;
}
.hm-card {
  background: #fff; border-radius: var(--hm-radius); border: 3px solid var(--hm-navy);
  box-shadow: var(--hm-shadow); overflow: hidden; display: flex; flex-direction: column;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}
.hm-card:hover { transform: translateY(-5px); box-shadow: 6px 8px 0 rgba(28, 30, 38, 0.9); }
.hm-card-img-wrap { position: relative; overflow: hidden; }
.hm-card-img { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: #ddd; display: block; transition: transform 0.35s ease; }
.hm-card:hover .hm-card-img { transform: scale(1.08); }
.hm-card-ribbon {
  position: absolute; top: 10px; left: -6px; padding: 4px 12px 4px 14px; font-size: 0.7rem; font-weight: 700;
  color: #fff; border-radius: 0 6px 6px 0; box-shadow: 0 2px 4px rgba(0,0,0,0.25); letter-spacing: 0.2px;
}
.hm-card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.hm-card-cat { font-size: 0.75rem; font-weight: 700; color: var(--hm-red-dark); }
.hm-card-name { font-family: "Fredoka", sans-serif; font-size: 1.05rem; margin: 0; }
.hm-card-desc { font-size: 0.85rem; color: #555; flex: 1; margin: 0; }
.hm-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hm-price { font-weight: 700; font-size: 1.05rem; }
.hm-stock { font-size: 0.75rem; color: #777; }
.hm-stock.low { color: var(--hm-red-dark); font-weight: 700; }
.hm-stock.low::before { content: "●"; display: inline-block; margin-right: 4px; animation: hmPulse 1.4s ease-in-out infinite; border-radius: 50%; }
.hm-sold { color: #999; font-weight: 400; }
.hm-empty { color: #777; padding: 30px 0; }

.hm-btn {
  border: none; border-radius: 10px; font-weight: 700; cursor: pointer;
  font-family: inherit; font-size: 0.95rem; padding: 9px 14px;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.25); transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.hm-btn:active { transform: translateY(2px); box-shadow: 1px 1px 0 rgba(0,0,0,0.25); }
.hm-btn-primary { background: var(--hm-red); color: #fff; }
.hm-btn-primary:disabled { background: #ccc; cursor: not-allowed; box-shadow: none; }
.hm-btn-primary.hm-added { animation: hmBounce 0.4s ease; background: var(--hm-green); }
.hm-btn-block { width: 100%; }
.hm-btn-outline { background: #fff; color: var(--hm-navy); border: 2px solid var(--hm-navy); box-shadow: none; }

/* ---------- Modal Checkout ---------- */
.hm-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 30;
}
.hidden { display: none !important; }
.hm-close { border: none; background: none; font-size: 1.2rem; cursor: pointer; }

.hm-checkout-modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: #fff; border: 3px solid var(--hm-navy); border-radius: var(--hm-radius);
  box-shadow: var(--hm-shadow); padding: 26px; width: min(440px, 92vw);
  max-height: 88vh; overflow-y: auto; -webkit-overflow-scrolling: touch; z-index: 50;
}
.hm-checkout-product {
  display: flex; align-items: center; gap: 12px; background: var(--hm-cream);
  border: 2px solid #eee; border-radius: 10px; padding: 10px; margin: 8px 0 4px;
}
.hm-checkout-product img { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.hm-checkout-product-name { font-weight: 700; font-size: 0.95rem; }
.hm-checkout-product-price { font-size: 0.82rem; color: #777; }
.hm-checkout-product-stock { font-size: 0.75rem; color: var(--hm-red-dark); }

.hm-qty-controls { display: flex; align-items: center; gap: 6px; }
.hm-qty-controls-lg { gap: 14px; margin: 6px 0 4px; }
.hm-qty-controls-lg .hm-qty-btn { width: 36px; height: 36px; font-size: 1.1rem; }
.hm-qty-controls-lg span { font-size: 1.1rem; font-weight: 700; min-width: 24px; text-align: center; }
.hm-qty-btn { width: 26px; height: 26px; border-radius: 6px; border: 2px solid var(--hm-navy); background: #fff; cursor: pointer; font-weight: 700; transition: transform 0.1s ease; }
.hm-qty-btn:active { transform: scale(0.9); }
.hm-qty-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.hm-total-row { display: flex; justify-content: space-between; align-items: center; font-size: 1.1rem; margin-bottom: 10px; }
.hm-total-row strong { transition: transform 0.2s ease; display: inline-block; }
.hm-total-row strong.hm-bump { animation: hmBounce 0.35s ease; }
.hm-label { display: block; font-size: 0.8rem; font-weight: 700; margin: 10px 0 4px; }
.hm-input {
  width: 100%; padding: 9px 10px; border-radius: 8px; border: 2px solid #ddd;
  font-family: inherit; font-size: 0.9rem;
}
.hm-error { color: var(--hm-red-dark); font-size: 0.82rem; min-height: 1.2em; margin: 8px 0 0; }

.hm-discount-row { display: flex; gap: 8px; margin-top: 12px; }
.hm-discount-row .hm-input { flex: 1; }
.hm-discount-msg { font-size: 0.8rem; margin: 6px 0 0; min-height: 1.1em; }
.hm-discount-msg.ok { color: var(--hm-green); font-weight: 700; }
.hm-discount-msg.err { color: var(--hm-red-dark); }
.hm-subtotal-row { font-size: 0.85rem; color: #777; margin-bottom: 2px; }
.hm-discount-total-row { font-size: 0.85rem; color: var(--hm-green); font-weight: 700; margin-bottom: 6px; }

/* ---------- Metode pembayaran (pilihan ikon) ---------- */
.hm-pay-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.hm-pay-pill {
  display: flex; align-items: center; gap: 8px; border: 2px solid #ddd; background: #fff;
  border-radius: 10px; padding: 9px 10px; cursor: pointer; font-size: 0.8rem; font-weight: 600;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}
.hm-pay-pill:hover { transform: translateY(-1px); }
.hm-pay-pill.active { border-color: var(--hm-navy); background: #fff4f4; }
.hm-pay-pill .hm-pay-icon { font-size: 1.05rem; }
.hm-pay-pill input { position: absolute; opacity: 0; pointer-events: none; }

.hm-qris-note {
  display: flex; align-items: flex-start; gap: 10px; background: #fff4f4;
  border: 2px solid var(--hm-red); border-radius: 10px; padding: 10px 12px; margin: 6px 0 4px;
}
.hm-qris-note .hm-pay-icon { font-size: 1.4rem; }
.hm-qris-note strong { font-size: 0.88rem; }
.hm-qris-note p { margin: 2px 0 0; font-size: 0.78rem; color: #666; line-height: 1.4; }

/* ---------- Auth modal ---------- */
.hm-auth-modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: #fff; border: 3px solid var(--hm-navy); border-radius: var(--hm-radius);
  box-shadow: var(--hm-shadow); padding: 26px; width: min(380px, 92vw);
  max-height: 88vh; overflow-y: auto; z-index: 50;
}
.hm-auth-close { position: absolute; top: 14px; right: 16px; font-size: 1.1rem; }
.hm-auth-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.hm-auth-tab {
  flex: 1; border: 2px solid var(--hm-navy); background: #fff; padding: 8px;
  border-radius: 10px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.hm-auth-tab.active { background: var(--hm-navy); color: #fff; }
.hm-google-wrap { display: flex; justify-content: center; margin-bottom: 10px; min-height: 40px; }
.hm-auth-divider { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: #999; font-size: 0.8rem; }
.hm-auth-divider::before, .hm-auth-divider::after { content: ""; flex: 1; height: 1px; background: #eee; }
.hm-auth-panel.hidden { display: none; }

/* ---------- Account page ---------- */
.hm-account-wrap { max-width: 640px; margin: 0 auto; padding: 48px 20px 80px; }
.hm-order-history-card {
  background: #fff; border: 3px solid var(--hm-navy); border-radius: var(--hm-radius);
  box-shadow: var(--hm-shadow); padding: 18px 20px; margin-bottom: 16px;
}

/* ---------- Footer ---------- */
.hm-footer { background: var(--hm-navy); color: #cfd2dc; padding: 34px 0 22px; margin-top: 40px; }
.hm-footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1.1fr; gap: 28px; }
.hm-footer h4 { font-family: "Fredoka", sans-serif; color: #fff; margin: 0 0 10px; font-size: 0.95rem; }
.hm-footer a { color: #cfd2dc; text-decoration: none; }
.hm-footer a:hover { color: #fff; text-decoration: underline; }
.hm-footer-brand p { font-size: 0.84rem; line-height: 1.65; margin: 0; max-width: 320px; }
.hm-footer-col a { display: block; padding: 3px 0; font-size: 0.86rem; }
.hm-footer-bottom { border-top: 1px solid rgba(255,255,255,0.12); margin-top: 24px; padding-top: 16px; font-size: 0.75rem; line-height: 1.7; color: #a9adbb; }
.hm-footer-bottom p { margin: 0 0 4px; }
.hm-footer-bottom .hm-footer-admin { opacity: 0.55; }
@media (max-width: 720px) { .hm-footer-grid { grid-template-columns: 1fr; gap: 20px; } }

/* Teks persetujuan kecil di form (tidak memblokir, cukup informatif) */
#checkoutBtn { margin-top: 14px; }
.hm-consent { font-size: 0.76rem; color: #777; line-height: 1.55; margin: 10px 0 0; text-align: center; }
.hm-consent a { color: var(--hm-red-dark); font-weight: 700; }

@media (prefers-reduced-motion: reduce) {
  .hm-pill, .hm-btn, .hm-card, .hm-card-img, .hm-filter-pill, .hm-pay-pill { transition: none; }
  .cube, .hm-logo-block, .hm-hero::before,
  .hm-stock.low::before, .hm-btn-primary.hm-added, .hm-total-row strong.hm-bump,
  .hm-hero-eyebrow, .hm-hero h1, .hm-hero p.hm-hero-sub, .hm-hero-highlights {
    animation: none !important;
  }
  .hm-reveal { opacity: 1; transform: none; transition: none; }
}
