:root {
  --bg: #e6e6e6;
  --grad-a: #a677ff;
  --grad-b: #644799;
  --surface: #976ce7;
  --surface-2: #b085ff;
  --btn-dark: #583c8b;
  --text: #ffffff;
  --cyan: #1a9be6;
  --radius-card: 21px;
  --radius-hero: 40px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: Inter, sans-serif;
  background: var(--bg);
  color: #fff;
  width: 100%;
  height: 100%;
}

body {
  overflow: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: linear-gradient(90deg, var(--grad-a), var(--grad-b));
  min-height: 98px;
  padding: 14px clamp(12px, 2vw, 26px);
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: clamp(8px, 2vw, 18px);
}

.pfp {
  width: 66px;
  height: 66px;
  border-radius: 999px;
  border: none;
  background: #d9d9d9;
  cursor: pointer;
}

.brand {
  font-weight: 800;
  font-size: clamp(28px, 3vw, 50px);
  letter-spacing: 0.4px;
}

.upload-meter {
  width: min(260px, 36vw);
  background: rgba(212, 152, 255, 0.85);
  border-radius: 29px;
  padding: 10px 14px;
}

.meter-row {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  font-size: 15px;
}

.meter-track {
  height: 8px;
  background: #5f4473;
  border-radius: 7.5px;
  overflow: hidden;
  margin-top: 6px;
}

.meter-fill {
  width: 42%;
  height: 8px;
  background: #b44eff;
  border-radius: 7.5px;
}

.meter-sub {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 500;
  opacity: 0.95;
}

.cart-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #fff;
  background: rgba(212, 152, 255, 0.95);
  border-radius: 29px;
  font-size: clamp(24px, 2.4vw, 44px);
  font-weight: 800;
  min-width: clamp(150px, 18vw, 240px);
  padding: 8px 14px;
}

.badge {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 29px;
  height: 28px;
  border-radius: 999px;
  background: #a931ff;
  box-shadow: 0 4px 4px rgba(0, 0, 0, 0.25);
  font-family: "Roboto Mono", monospace;
  font-size: 20px;
  display: grid;
  place-items: center;
}

.profile-menu {
  position: absolute;
  top: 88px;
  left: 16px;
  width: 210px;
  background: #28183f;
  border: 1px solid #8f63d6;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
}

.profile-menu a {
  display: block;
  color: #fff;
  text-decoration: none;
  padding: 12px 14px;
  font-weight: 700;
}

.profile-menu a:hover {
  background: rgba(166, 119, 255, 0.25);
}

.page-scroll {
  height: calc(100vh - 98px);
  overflow-y: auto;
  padding: clamp(14px, 2vw, 24px);
  scroll-behavior: smooth;
}

.hero {
  width: min(1200px, 100%);
  aspect-ratio: 849 / 205;
  border-radius: var(--radius-hero);
  box-shadow: 0 8px 4.8px rgba(0, 0, 0, 0.25);
  background: #c4c4c4 center/cover no-repeat;
  margin: 0 auto 20px;
  transition: background-image 350ms ease;
}

.tab-switch {
  margin: 6px auto 0;
  max-width: 360px;
  background: #d498ff;
  border-radius: 34px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
}

.tab {
  border: 0;
  padding: 10px 8px;
  font-size: clamp(24px, 3vw, 44px);
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  background: transparent;
}

.tab.active {
  background: #644799;
}

.section-rule {
  margin: 18px 0 24px;
  border: 0;
  border-top: 6px solid #9b6eed;
  border-radius: 10px;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.section-title {
  margin: 0;
  font-size: clamp(32px, 4vw, 46px);
  font-weight: 800;
}

.section-title-cyan {
  color: var(--cyan);
}

.section-title-purple {
  color: var(--surface-2);
  margin-top: 34px;
}

.custom-card {
  margin-top: 12px;
  background: #0a5f88;
  width: min(270px, 100%);
  border-radius: var(--radius-card);
  padding: 24px 18px;
  display: grid;
  gap: 18px;
  justify-items: center;
}

.head-box {
  width: 84px;
  height: 84px;
  border-radius: 8px;
  background: linear-gradient(145deg, #d5d5d5, #8e8e8e);
}

.custom-card button {
  background: #1798ff;
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 8px 16px;
  font-weight: 800;
  font-size: 24px;
  cursor: pointer;
}

.refresh {
  margin-top: 6px;
  color: #897eee;
  font-size: 20px;
  font-weight: 800;
}

.grid-cards {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(182px, 1fr));
  gap: 16px;
  padding-bottom: 30px;
}

.product-card {
  background: var(--surface);
  border-radius: var(--radius-card);
  min-height: 308px;
  padding: 14px 12px 12px;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 8px;
  overflow: hidden;
}

.product-thumb {
  width: 85px;
  height: 85px;
  border-radius: 10px;
  background: linear-gradient(145deg, #f2f2f2, #cb9f7a);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-name {
  margin-top: 2px;
  width: 100%;
  text-align: center;
  font-size: 23px;
  font-weight: 500;
  line-height: 1.05;
  min-height: 48px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-price {
  font-weight: 800;
  font-size: 44px;
  line-height: 1;
  width: 100%;
  text-align: center;
}

.product-cat {
  font-size: 18px;
  font-weight: 400;
  width: 100%;
  text-align: center;
  opacity: 0.95;
}

.product-btn {
  margin-top: auto;
  border: 0;
  background: var(--btn-dark);
  color: #fff;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 800;
  padding: 10px 14px;
  cursor: pointer;
  width: 86%;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.preset {
  background: var(--surface);
  border-radius: 14px;
  padding: 16px;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
}

.upload-box {
  margin-top: 18px;
  background: #fff;
  color: #3a2a5a;
  border-radius: 16px;
  padding: 18px;
  border: 2px dashed #976ce7;
}

.upload-box h3 {
  margin: 0 0 10px;
}

.upload-box input {
  width: 100%;
}

@media (max-width: 940px) {
  .topbar {
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "pfp brand cart"
      "meter meter meter";
    row-gap: 8px;
  }

  .pfp { grid-area: pfp; }
  .brand { grid-area: brand; }
  .cart-btn { grid-area: cart; }
  .upload-meter { grid-area: meter; width: 100%; }
}

@media (max-width: 560px) {
  .cart-btn {
    min-width: 122px;
  }
  .badge {
    width: 24px;
    height: 24px;
    font-size: 16px;
  }
}

/* Live app utility styles */
.page-narrow {
  max-width: 980px;
  margin: 0 auto;
}

.page-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.link-btn {
  color: #583c8b;
  font-weight: 800;
  text-decoration: none;
  background: #d9c3ff;
  border-radius: 999px;
  padding: 8px 14px;
}

.panel-card {
  margin-top: 16px;
  background: #f2ecff;
  border: 2px solid #c9a8ff;
  border-radius: 18px;
  padding: 14px;
  color: #2f1b4f;
}

.stack {
  display: grid;
  gap: 10px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: #3d2a63;
}

.actions-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.action-btn,
.small-btn {
  border: 0;
  cursor: pointer;
  border-radius: 10px;
  color: #fff;
  font-weight: 800;
}

.action-btn {
  background: #583c8b;
  padding: 10px 14px;
  text-decoration: none;
  display: inline-block;
}

.small-btn {
  background: #7b56bb;
  padding: 8px 12px;
}

.small-btn:disabled,
.action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.field-label {
  font-weight: 800;
  color: #563987;
}

.text-input {
  width: 100%;
  border: 1px solid #b48af1;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 16px;
}

.small-inline-input {
  width: 110px;
}

.line-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 10px;
  background: #fff;
  border: 1px solid #d8c0ff;
  border-radius: 12px;
}

.cart-item-thumb {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  object-fit: cover;
  flex: 0 0 52px;
  border: 1px solid #d8c0ff;
  background: linear-gradient(145deg, #f6f0ff, #cbb2f7);
}

.cart-item-thumb-grid {
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  color: #4b2f7a;
}

.cart-item-main {
  min-width: 0;
}

.line-name {
  font-weight: 800;
  color: #352253;
}

.line-sub {
  color: #70539f;
  font-size: 14px;
}

.line-right {
  display: grid;
  justify-items: end;
  gap: 6px;
  color: #3d2a63;
  font-weight: 700;
}

.muted-text {
  color: #6d5b8e;
}

.error-text {
  color: #b43352;
  font-weight: 700;
}

.radio-row {
  color: #3f2d61;
  font-weight: 700;
}

.dev-box {
  border: 1px dashed #9f77ea;
  border-radius: 12px;
  padding: 10px;
}

.preset-btn {
  border: 0;
  cursor: pointer;
}

.preset-btn.active {
  outline: 3px solid #583c8b;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(24, 12, 39, 0.7);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 110;
}

.modal-backdrop[hidden] {
  display: none !important;
}

.modal-card {
  width: min(560px, 100%);
  border-radius: 24px;
  background: linear-gradient(165deg, #efe4ff 0%, #d4b4ff 100%);
  border: 2px solid #8e5add;
  box-shadow: 0 18px 44px rgba(16, 8, 27, 0.38);
  padding: 18px;
  color: #2e1b4d;
  display: grid;
  gap: 10px;
}

.modal-layout {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 12px;
  align-items: start;
}

.modal-fields {
  display: grid;
  gap: 10px;
}

.head-preview-stage {
  min-height: 210px;
  border-radius: 18px;
  background: radial-gradient(circle at 28% 20%, rgba(190, 146, 255, 0.6), rgba(107, 67, 172, 0.9));
  display: grid;
  place-items: center;
  perspective: 700px;
}

.head-cube {
  --cube-size: 96px;
  --cube-translate: calc(var(--cube-size) / 2);
  position: relative;
  width: var(--cube-size);
  height: var(--cube-size);
  transform-style: preserve-3d;
  animation: spin-head 7s linear infinite;
}

.head-face {
  position: absolute;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  background: linear-gradient(145deg, #e5e5e5 0%, #adadad 40%, #7f7f7f 100%);
  background-repeat: no-repeat;
  border: 1px solid rgba(33, 22, 49, 0.22);
}

.head-cube.has-texture .head-face {
  background-image: var(--head-preview-image), linear-gradient(145deg, #e5e5e5 0%, #adadad 40%, #7f7f7f 100%);
  background-size: calc(var(--cube-size) * 8) calc(var(--cube-size) * 8), cover;
}

.head-face.front { transform: translateZ(var(--cube-translate)); }
.head-face.back { transform: rotateY(180deg) translateZ(var(--cube-translate)); }
.head-face.left { transform: rotateY(-90deg) translateZ(var(--cube-translate)); filter: brightness(0.92); }
.head-face.right { transform: rotateY(90deg) translateZ(var(--cube-translate)); filter: brightness(0.86); }
.head-face.top { transform: rotateX(90deg) translateZ(var(--cube-translate)); filter: brightness(1.06); }
.head-face.bottom { transform: rotateX(-90deg) translateZ(var(--cube-translate)); filter: brightness(0.72); }

.head-cube.has-texture .head-face.front { background-position: calc(-1 * var(--cube-size)) calc(-1 * var(--cube-size)); }
.head-cube.has-texture .head-face.back { background-position: calc(-3 * var(--cube-size)) calc(-1 * var(--cube-size)); }
.head-cube.has-texture .head-face.left { background-position: calc(-2 * var(--cube-size)) calc(-1 * var(--cube-size)); }
.head-cube.has-texture .head-face.right { background-position: 0 calc(-1 * var(--cube-size)); }
.head-cube.has-texture .head-face.top { background-position: calc(-1 * var(--cube-size)) 0; }
.head-cube.has-texture .head-face.bottom { background-position: calc(-2 * var(--cube-size)) 0; }

@keyframes spin-head {
  0% {
    transform: rotateX(-12deg) rotateY(0deg);
  }
  100% {
    transform: rotateX(-12deg) rotateY(360deg);
  }
}

.modal-title {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  color: #5c2fa3;
}

.modal-textarea {
  min-height: 108px;
  resize: vertical;
}

.grid-preview-canvas {
  width: 100%;
  max-height: 55vh;
  border-radius: 14px;
  border: 1px solid #8b63d3;
  background: #110a1c;
}

@media (max-width: 620px) {
  .modal-layout {
    grid-template-columns: 1fr;
  }

  .head-preview-stage {
    min-height: 150px;
  }
}

.pricing-hero {
  text-align: center;
  color: #103419;
  margin-bottom: 18px;
}

.pricing-title {
  margin: 18px 0 4px;
  color: #143821;
  font-size: clamp(34px, 4vw, 54px);
  font-weight: 800;
}

.pricing-subtitle {
  margin: 0;
  color: #3d5b45;
  font-size: 18px;
}

.pricing-grid-modern {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.pricing-card-modern {
  background: #f2f5ef;
  color: #16341f;
  border: 1px solid #d4dfcd;
  border-radius: 22px;
  padding: 18px;
  display: grid;
  gap: 8px;
}

.pricing-card-featured {
  background: #0d3a1b;
  color: #e7f6eb;
  border-color: #0d3a1b;
  box-shadow: 0 14px 30px rgba(9, 34, 16, 0.28);
}

.pricing-badge-modern {
  justify-self: center;
  background: #eef3ea;
  color: #1d3b25;
  border-radius: 999px;
  font-weight: 700;
  padding: 6px 12px;
}

.pricing-plan-name {
  font-size: 28px;
  font-weight: 800;
}

.pricing-amount {
  font-size: 48px;
  line-height: 1;
  font-weight: 800;
}

.pricing-amount span {
  font-size: 18px;
  font-weight: 500;
}

.pricing-desc {
  margin: 0 0 10px;
  font-size: 16px;
}

.pricing-feature {
  font-size: 16px;
  font-weight: 600;
}

.pricing-btn-modern {
  border: 1px solid #c6d8bf;
  background: #d8e8ca;
  color: #113619;
  border-radius: 999px;
  font-size: 18px;
  font-weight: 800;
  padding: 10px 14px;
  cursor: pointer;
}

.pricing-btn-light {
  background: #ffffff;
}

.pricing-card-featured .pricing-btn-modern {
  background: #c9dfad;
  color: #0f2c15;
  border-color: #c9dfad;
}
