:root {
  --bg: #0a0810;
  --bg-2: #120e1c;
  --panel: rgba(23, 19, 34, 0.72);
  --panel-line: rgba(255, 255, 255, 0.09);
  --ink: #f7f3ff;
  --muted: #a89fbe;
  --pink: #ff2d87;
  --cyan: #8fc2f5;
  --lime: #b6ff3d;
  --radius: 28px;
  --shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }

/* Skjulte elementer skal faktisk være skjult, også når de har en display-regel. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 700px at 12% -10%, rgba(143, 194, 245, 0.16), transparent 60%),
    radial-gradient(900px 700px at 95% 8%, rgba(255, 45, 135, 0.16), transparent 55%),
    linear-gradient(180deg, var(--bg-2), var(--bg) 55%);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.bg-orbs { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.42;
  animation: drift 22s ease-in-out infinite alternate;
}
.orb-1 { width: 420px; height: 420px; background: #ff2d87; top: -120px; right: -80px; }
.orb-2 { width: 380px; height: 380px; background: #2ea8ff; bottom: -140px; left: -100px; animation-delay: -8s; }
.orb-3 { width: 300px; height: 300px; background: #b6ff3d; top: 45%; left: 55%; opacity: 0.12; animation-delay: -14s; }

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(-40px, 50px, 0) scale(1.15); }
}

/* ---------- top bar ---------- */
.topbar {
  position: relative;
  z-index: 2;
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 24px 18px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  font-family: Fredoka, Inter, sans-serif;
  font-weight: 600;
  font-size: clamp(18px, 2.4vw, 24px);
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.brand-tld { color: var(--muted); font-weight: 400; }
.brand-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--pink);
  box-shadow: 0 0 0 4px rgba(255, 45, 135, 0.18), 0 0 22px 4px rgba(255, 45, 135, 0.6);
}
.tagline { margin: 0; color: var(--muted); font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; }

/* ---------- layout ---------- */
.wrap {
  position: relative;
  z-index: 2;
  max-width: 1180px;
  margin: 0 auto;
  padding: 8px 24px 48px;
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(340px, 0.98fr);
  gap: clamp(20px, 3vw, 42px);
  align-items: start;
}

.stage-col { display: flex; flex-direction: column; gap: 18px; }

/* ---------- stage ---------- */
.stage {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: #05040a;
  box-shadow: var(--shadow), 0 0 0 1px rgba(255, 255, 255, 0.07) inset;
  isolation: isolate;
  touch-action: manipulation;
}

#skinCanvas, #warmerCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
#warmerCanvas {
  transform-origin: 34.5% 46%;
  will-change: transform, opacity;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.25));
  pointer-events: none;
}
.stage.no-warmer #warmerCanvas { opacity: 0; }

.confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }

/* the "off" state: frosted glass with a note, instead of a fake bare nose */
.veil {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(9, 7, 14, 0.58);
  backdrop-filter: blur(30px) saturate(0.8);
  -webkit-backdrop-filter: blur(30px) saturate(0.8);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease 0.25s;
}
.stage.no-warmer .veil { opacity: 1; }

.veil-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  padding: 26px 30px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(20, 16, 30, 0.55);
  box-shadow: 0 30px 60px -24px rgba(0, 0, 0, 0.9);
  transform: translateY(6px) scale(0.98);
  transition: transform 0.5s cubic-bezier(0.34, 1.3, 0.5, 1) 0.25s;
}
.stage.no-warmer .veil-card { transform: none; }
.veil-emoji { font-size: 34px; line-height: 1; margin-bottom: 6px; }
.veil-title { font-family: Fredoka, Inter, sans-serif; font-size: 20px; font-weight: 500; letter-spacing: -0.01em; }
.veil-sub { font-size: 13px; color: #c3b9d8; max-width: 24ch; line-height: 1.5; }


.stage-badge {
  position: absolute;
  top: 14px; left: 14px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 11px;
  border-radius: 999px;
  background: rgba(10, 8, 16, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(10px);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: background 0.3s, border-color 0.3s;
}
.stage-badge .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 12px 2px rgba(182, 255, 61, 0.65);
  transition: background 0.3s, box-shadow 0.3s;
}
.stage.no-warmer .stage-badge .dot { background: #ff5c5c; box-shadow: 0 0 12px 2px rgba(255, 92, 92, 0.5); }

.stage-hint {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 4;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(10, 8, 16, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(10px);
  font-size: 13px;
  color: #e9e4f7;
  white-space: nowrap;
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
}
.stage-hint.gone { opacity: 0; transform: translate(-50%, 8px); }

.stage.no-warmer .stage-hint { opacity: 0; transform: translate(-50%, 8px); }

.nose-hit {
  position: absolute;
  left: 13%;
  top: 26%;
  width: 48%;
  height: 38%;
  z-index: 3;
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
}
.nose-hit:focus-visible { outline: 3px solid var(--cyan); outline-offset: -6px; }

/* ---------- buttons ---------- */
.under-stage { display: flex; flex-direction: column; gap: 12px; }

.btn {
  font-family: Fredoka, Inter, sans-serif;
  font-weight: 500;
  font-size: 16px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  padding: 14px 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: transform 0.15s ease, background 0.2s, border-color 0.2s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { transform: translateY(-1px); background: rgba(255, 255, 255, 0.11); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }

.btn-primary {
  background: linear-gradient(135deg, #ff3d8b, #ff2d5e 55%, #ff7a1a);
  border-color: transparent;
  box-shadow: 0 14px 34px -12px rgba(255, 45, 110, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.18) inset;
  color: #fff;
}
.btn-primary:hover { background: linear-gradient(135deg, #ff539a, #ff3f6c 55%, #ff8c2e); box-shadow: 0 18px 40px -12px rgba(255, 45, 110, 0.95); }
.btn-big { font-size: 19px; padding: 17px 26px; }
.btn-ico { font-size: 20px; line-height: 1; }

.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.quick .btn { font-size: 15.5px; padding: 16px 20px; }

/* ---------- panel ---------- */
.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  padding: clamp(20px, 2.6vw, 30px);
  backdrop-filter: blur(22px) saturate(1.2);
  box-shadow: var(--shadow);
}

.panel-head h1 {
  font-family: Fredoka, Inter, sans-serif;
  font-weight: 600;
  font-size: clamp(26px, 3.4vw, 38px);
  line-height: 1.06;
  letter-spacing: -0.03em;
  margin: 0 0 10px;
  background: linear-gradient(100deg, #fff 20%, #ffc0dd 55%, #a9d4ff 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.panel-head p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; max-width: 46ch; }

.block { margin-top: 26px; padding-top: 22px; border-top: 1px solid rgba(255, 255, 255, 0.07); }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.block-head h2 {
  font-family: Fredoka, Inter, sans-serif;
  font-size: 16px;
  font-weight: 500;
  margin: 0;
  letter-spacing: 0.01em;
}
.block-note { font-size: 12px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }

/* swatches */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 10px; }
.swatch {
  position: relative;
  aspect-ratio: 1;
  width: 100%;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  padding: 0;
  background: var(--c);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18) inset, 0 6px 14px -8px rgba(0, 0, 0, 0.9);
  transition: transform 0.14s ease, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.swatch:hover { transform: translateY(-2px) scale(1.06); }
.swatch:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }
.swatch[aria-pressed="true"] {
  box-shadow: 0 0 0 3px var(--bg-2), 0 0 0 6px var(--c), 0 10px 22px -8px var(--c);
  transform: translateY(-1px) scale(1.04);
}
.swatch[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.75), transparent 42%);
  mix-blend-mode: soft-light;
}

.custom-color {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}
.custom-color span:first-child { flex: 1; }
.custom-color input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 40px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  padding: 0;
}
.custom-color input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.custom-color input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 6px; }
.hex { font-variant-numeric: tabular-nums; font-size: 12px; letter-spacing: 0.06em; color: #cfc7e0; min-width: 74px; text-align: right; }

/* styles */
.styles { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 10px; }
.style-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 6px 11px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.2s, background 0.2s, color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.style-chip:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.07); color: var(--ink); }
.style-chip:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }
.style-chip[aria-pressed="true"] {
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  box-shadow: 0 10px 26px -14px rgba(255, 255, 255, 0.6);
}
.style-thumb {
  width: 42px; height: 42px;
  border-radius: 50%;
  background-color: #6f8bb0;
  background-size: cover;
  background-position: center;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.22) inset;
  image-rendering: auto;
}

/* stats */
.stats { display: flex; gap: 10px; }
.stat {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 18px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-num { font-family: Fredoka, Inter, sans-serif; font-size: 24px; font-weight: 600; letter-spacing: -0.02em; color: #fff; }
.stat-label { font-size: 11.5px; color: var(--muted); letter-spacing: 0.04em; }

.fineprint { margin: 20px 0 0; font-size: 12px; color: #7d7492; line-height: 1.7; }

.load-error .stage::after {
  content: "Bildet fikk ikke plass i sekken. Sjekk at assets/ ligger ved siden av index.html.";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 30px;
  color: #ffb3c9;
  font-size: 14px;
  line-height: 1.6;
  background: #14101f;
}

kbd {
  font-family: inherit;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 1px 6px;
  color: #cfc7e0;
}

/* footer */
.foot {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 0 24px 40px;
  color: #6f6784;
  font-size: 12.5px;
}

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 20px);
  background: #fff;
  color: #120e1c;
  font-weight: 600;
  font-size: 14px;
  padding: 12px 18px;
  border-radius: 999px;
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.8);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .wrap { grid-template-columns: 1fr; padding-bottom: 28px; }
  .stage-col { max-width: 560px; margin: 0 auto; width: 100%; }
  .panel { max-width: 620px; margin: 0 auto; width: 100%; }
  .topbar { padding-bottom: 8px; }
  .tagline { display: none; }
  .stage-hint { font-size: 12px; }
}

@media (max-width: 420px) {
  .swatches { grid-template-columns: repeat(6, 1fr); }
  .styles { grid-template-columns: repeat(3, 1fr); }
  .btn-big { font-size: 17px; padding: 15px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .orb { animation: none; }
  * { scroll-behavior: auto !important; }
}
