:root {
  --ink: #3d2459;
  --ink-soft: #7a5f93;
  --pink: #ff5c9d;
  --pink-deep: #e83e84;
  --card: #ffffffee;
  --radius: 28px;
  --kaffeteria: linear-gradient(145deg, #ff9a8b 0%, #ff6a88 55%, #ff99ac 100%);
  --leker: linear-gradient(145deg, #6fd6ff 0%, #6a8dff 100%);
  --julepynt: linear-gradient(145deg, #4fd18b 0%, #1fa86a 100%);
  --armband: linear-gradient(145deg, #5ce0d0 0%, #17a9a0 100%);
  --harpynt: linear-gradient(145deg, #ffd166 0%, #ff9f43 100%);
  --malerier: linear-gradient(145deg, #c79bff 0%, #8e6bff 100%);
  font-family: "Fredoka", "Baloo 2", "Nunito", "Comic Sans MS", system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  color: var(--ink);
  background: linear-gradient(160deg, #ffe3f1 0%, #f3e6ff 45%, #dff4ff 100%);
  background-attachment: fixed;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
.hidden { display: none !important; }

/* Flytende pynt i bakgrunnen */
.bg { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.bg span {
  position: absolute; bottom: -60px; font-size: 34px; opacity: .45;
  animation: float 18s linear infinite;
}
.bg span:nth-child(1) { left: 5%;  animation-delay: 0s; }
.bg span:nth-child(2) { left: 18%; animation-delay: -6s; font-size: 26px; }
.bg span:nth-child(3) { left: 32%; animation-delay: -12s; }
.bg span:nth-child(4) { left: 47%; animation-delay: -3s; font-size: 24px; }
.bg span:nth-child(5) { left: 61%; animation-delay: -9s; }
.bg span:nth-child(6) { left: 74%; animation-delay: -15s; }
.bg span:nth-child(7) { left: 86%; animation-delay: -1s; font-size: 28px; }
.bg span:nth-child(8) { left: 94%; animation-delay: -11s; }
@keyframes float {
  0% { transform: translateY(0) rotate(0); }
  100% { transform: translateY(-115vh) rotate(360deg); }
}

/* Topp */
.top {
  position: relative; z-index: 2;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 18px 24px 6px;
}
.brand { text-align: center; }
.brand h1 {
  margin: 0; font-size: clamp(40px, 6vw, 64px); font-weight: 700; letter-spacing: 1px;
  background: linear-gradient(90deg, #ff4f8b, #b44dff, #4f8bff, #ff4f8b);
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 8s linear infinite;
}
.brand h1::before, .brand h1::after { content: "✨"; -webkit-text-fill-color: initial; font-size: .6em; margin: 0 .2em; }
.brand p { margin: 2px 0 0; font-size: clamp(18px, 2.2vw, 24px); color: var(--ink-soft); font-weight: 500; }
@keyframes shimmer { to { background-position: 300% 0; } }

.back {
  justify-self: start;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 26px; border-radius: 999px;
  background: #fff; box-shadow: 0 6px 0 #e7c6ff, 0 10px 24px #b44dff22;
  font-size: 24px; font-weight: 600;
}
.back:active { transform: translateY(4px); box-shadow: 0 2px 0 #e7c6ff; }
.back .arrow { font-size: 28px; }

main { position: relative; z-index: 1; padding: 14px 24px 32px; }
.view { animation: pop-in .35s ease-out; }
@keyframes pop-in { from { opacity: 0; transform: scale(.97) translateY(10px); } }

/* Kategorier */
.cat-grid {
  display: grid; gap: 24px;
  grid-template-columns: repeat(3, 1fr);
  max-width: 1200px; margin: 0 auto;
}
.cat {
  position: relative; overflow: hidden;
  aspect-ratio: 1 / 1; max-height: 36vh; width: 100%;
  border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; padding: 18px;
  box-shadow: 0 10px 0 #00000014, 0 18px 30px #6a3d9a26;
  transition: transform .15s;
}
.cat:active { transform: scale(.95); }
.cat::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 25% 15%, #ffffff55 0 18%, transparent 19%),
              radial-gradient(circle at 85% 80%, #ffffff30 0 12%, transparent 13%);
  pointer-events: none;
}
.cat .logo-box { width: 62%; aspect-ratio: 1; filter: drop-shadow(0 6px 0 #0000001a); }
.cat .name { font-size: clamp(24px, 3vw, 36px); font-weight: 700; margin-top: 6px; text-shadow: 0 3px 0 #00000022; }
.cat .count {
  position: absolute; top: 14px; right: 14px;
  background: #ffffffdd; color: var(--ink); font-weight: 600; font-size: 16px;
  padding: 4px 12px; border-radius: 999px;
}
.cat[data-cat="kaffeteria"] { background: var(--kaffeteria); }
.cat[data-cat="leker"] { background: var(--leker); }
.cat[data-cat="julepynt"] { background: var(--julepynt); }
.cat[data-cat="armband"] { background: var(--armband); }
.cat[data-cat="harpynt"] { background: var(--harpynt); }
.cat[data-cat="malerier"] { background: var(--malerier); }

/* Kategori-side */
.cat-head {
  display: flex; align-items: center; gap: 18px; justify-content: center;
  margin: 0 auto 22px; padding: 10px 30px 10px 14px; width: fit-content;
  border-radius: 999px; color: #fff; box-shadow: 0 8px 0 #00000014;
}
.cat-head .logo-box { width: 72px; height: 72px; }
.cat-head h2 { margin: 0; font-size: 40px; text-shadow: 0 3px 0 #00000022; }

.prod-grid {
  display: grid; gap: 22px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  max-width: 1200px; margin: 0 auto;
}
.prod {
  position: relative; background: var(--card); border-radius: var(--radius);
  padding: 12px 12px 16px; text-align: center;
  box-shadow: 0 8px 0 #e7c6ff, 0 14px 26px #b44dff1f;
  transition: transform .15s;
}
.prod:active { transform: scale(.96); }
.prod .img {
  aspect-ratio: 1; border-radius: 20px; overflow: hidden;
  background: #fbeefc; display: grid; place-items: center; font-size: 64px;
}
.prod .img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.prod .pname { font-size: 24px; font-weight: 600; margin: 10px 4px 8px; line-height: 1.15; min-height: 2.3em; display: flex; align-items: center; justify-content: center; }
.prod .price {
  display: inline-block; background: var(--pink); color: #fff;
  font-size: 26px; font-weight: 700; padding: 4px 20px; border-radius: 999px;
  box-shadow: 0 4px 0 var(--pink-deep);
}
.prod .few {
  position: absolute; top: 20px; left: 20px; background: #ffd23f; color: #6b4a00;
  font-weight: 600; padding: 4px 12px; border-radius: 999px; font-size: 15px;
}
.prod.soldout { filter: grayscale(.9); opacity: .7; pointer-events: none; }
.prod.soldout::after {
  content: "Utsolgt 😢"; position: absolute; top: 38%; left: 50%;
  transform: translate(-50%, -50%) rotate(-10deg);
  background: #fff; color: var(--pink-deep); border: 4px solid var(--pink-deep);
  font-size: 30px; font-weight: 700; padding: 6px 22px; border-radius: 16px;
}
.empty {
  grid-column: 1 / -1; text-align: center; font-size: 26px; color: var(--ink-soft);
  background: var(--card); padding: 40px; border-radius: var(--radius);
}
.empty .emoji { font-size: 64px; display: block; margin-bottom: 8px; }

/* Betalingsvindu */
.overlay {
  position: fixed; inset: 0; z-index: 10; background: #3d245966;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 20px;
  animation: fade .2s ease-out;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  position: relative; background: #fff; border-radius: 36px; width: min(920px, 100%);
  max-height: 100%; overflow: auto;
  padding: 28px; box-shadow: 0 20px 60px #3d245955;
  animation: pop-in .3s cubic-bezier(.2,1.4,.5,1);
}
.close {
  position: absolute; top: 14px; right: 14px; width: 56px; height: 56px; border-radius: 50%;
  background: #f4e8ff; font-size: 26px; font-weight: 700;
}
.pay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: center; }
.pay-product { text-align: center; }
.pay-img { aspect-ratio: 1; max-width: 300px; margin: 0 auto; border-radius: 24px; overflow: hidden; background: #fbeefc; display: grid; place-items: center; font-size: 90px; }
.pay-img img { width: 100%; height: 100%; object-fit: cover; }
.pay-product h2 { font-size: 34px; margin: 14px 0 10px; }
.qty { display: inline-flex; align-items: center; gap: 18px; background: #f4e8ff; border-radius: 999px; padding: 8px; }
.qty button {
  width: 64px; height: 64px; border-radius: 50%; background: #fff; font-size: 38px; font-weight: 700;
  box-shadow: 0 4px 0 #e0c8f7; line-height: 1;
}
.qty button:disabled { opacity: .35; }
.qty span { min-width: 48px; font-size: 36px; font-weight: 700; }
.stock-left { color: var(--ink-soft); font-size: 18px; margin: 10px 0 0; min-height: 1.3em; }

.pay-qr { text-align: center; }
.vipps-badge {
  display: inline-block; background: #ff5b24; color: #fff; font-size: 24px;
  padding: 6px 22px; border-radius: 999px; margin-bottom: 12px;
}
.qr-wrap { position: relative; width: min(280px, 100%); margin: 0 auto; border: 6px solid #ff5b24; border-radius: 24px; padding: 10px; background: #fff; }
.qr-wrap img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; }
.example-tag {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) rotate(-12deg);
  background: #ffd23f; color: #6b4a00; font-weight: 700; font-size: 22px;
  padding: 4px 16px; border-radius: 10px; box-shadow: 0 4px 12px #0003;
}
.pay-amount { font-size: 30px; margin: 16px 0 4px; }
.pay-amount b { color: var(--pink-deep); }
.pay-help { font-size: 19px; color: var(--ink-soft); margin: 0; }
.paid-btn {
  display: block; width: 100%; margin-top: 24px; padding: 22px;
  border-radius: 999px; background: linear-gradient(90deg, #ff5c9d, #b44dff); color: #fff;
  font-size: 32px; font-weight: 700; box-shadow: 0 8px 0 #9a2f8a;
}
.paid-btn:active { transform: translateY(5px); box-shadow: 0 3px 0 #9a2f8a; }
.paid-btn:disabled { opacity: .6; }

/* Takk */
.thanks { background: #ffffffcc; }
.thanks-card { text-align: center; animation: pop-in .4s cubic-bezier(.2,1.6,.5,1); }
.thanks-card h2 { font-size: 72px; margin: 0; color: var(--pink-deep); }
.thanks-card p { font-size: 30px; margin: 8px 0 0; }
.big-heart { font-size: 140px; animation: beat-big 1s ease-in-out infinite; }
@keyframes beat-big { 0%,100% { transform: scale(1); } 40% { transform: scale(1.18); } }
.confetti {
  position: fixed; top: -20px; width: 14px; height: 20px; border-radius: 4px; z-index: 11;
  animation: fall 2.8s linear forwards; pointer-events: none;
}
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); z-index: 20;
  background: var(--ink); color: #fff; font-size: 22px; padding: 16px 28px; border-radius: 999px;
}

/* Stående (portrett) nettbrett */
@media (orientation: portrait) {
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .cat { max-height: 27vh; }
  .pay-grid { grid-template-columns: 1fr; gap: 16px; }
  .pay-img { max-width: 200px; }
}
@media (max-width: 600px) {
  .top { padding: 12px 16px 4px; }
  main { padding: 10px 16px 24px; }
  .back { padding: 10px 16px; font-size: 18px; }
  .prod-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .prod .pname { font-size: 18px; }
  .prod .price { font-size: 20px; }
}
