:root {
  /* Alpin natt + SkiStar-blått + varm julkänsla */
  --bg-deep: #091526;
  --bg-surface: #10233d;
  --bg-card: rgba(18, 38, 66, 0.78);
  --bg-card-hover: rgba(25, 52, 88, 0.92);

  --alpine-blue: #1e78d6;
  --alpine-ice: #8fd3ff;
  --snow: #f4f8fc;
  --text-muted: #9eb6d1;

  --xmas-red: #c82337;
  --xmas-red-dark: #8e1524;
  --xmas-gold: #f0c25b;
  --pine-green: #1f6b4b;

  --border-subtle: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.22);
  --radius-lg: 20px;
  --radius-md: 14px;
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
}

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

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: radial-gradient(circle at 20% 0%, #143258 0%, var(--bg-deep) 58%, #060e1a 100%);
  color: var(--snow);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

#snow-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.is-hidden {
  display: none !important;
}

/* ===========================
   PIN-LÅS
   =========================== */
.pin-gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: radial-gradient(circle at 50% 15%, rgba(28, 72, 126, 0.55), rgba(6, 14, 26, 0.96) 72%);
  backdrop-filter: blur(12px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.pin-gate.is-unlocked {
  opacity: 0;
  transform: scale(1.03);
  pointer-events: none;
}

.pin-card {
  width: 100%;
  max-width: 370px;
  padding: 32px 26px 28px;
  border-radius: 24px;
  background: linear-gradient(165deg, rgba(22, 46, 78, 0.92), rgba(10, 22, 40, 0.96));
  border: 1px solid rgba(143, 211, 255, 0.22);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.pin-badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--alpine-ice);
  background: rgba(30, 120, 214, 0.2);
  border: 1px solid rgba(143, 211, 255, 0.25);
  margin-bottom: 14px;
}

.pin-icon {
  font-size: 2.2rem;
  margin-bottom: 6px;
}

.pin-card h1 {
  margin: 0;
  font-family: 'Outfit', sans-serif;
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.pin-subtitle {
  margin: 8px 0 4px;
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.pin-hint {
  margin: 0 0 22px;
  font-size: 0.84rem;
  color: var(--xmas-gold);
  font-weight: 600;
}

.pin-dots {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-bottom: 10px;
}

.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: transparent;
  transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.pin-dot.is-filled {
  background: var(--xmas-gold);
  border-color: var(--xmas-gold);
  transform: scale(1.12);
  box-shadow: 0 0 12px rgba(240, 194, 91, 0.55);
}

.pin-dots.is-error .pin-dot {
  background: var(--xmas-red);
  border-color: var(--xmas-red);
}

.pin-dots.is-shake {
  animation: shake 0.42s ease;
}

.pin-error {
  min-height: 20px;
  margin: 0 0 14px;
  font-size: 0.84rem;
  font-weight: 600;
  color: #ff7a88;
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.pin-key {
  height: 56px;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.06);
  color: var(--snow);
  font-family: 'Outfit', sans-serif;
  font-size: 1.35rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.pin-key:hover {
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(143, 211, 255, 0.35);
}

.pin-key:active {
  transform: scale(0.95);
  background: rgba(30, 120, 214, 0.35);
}

.pin-key--action {
  font-size: 0.92rem;
  color: var(--text-muted);
}

/* ===========================
   HERO & HEADER
   =========================== */
.app {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hero {
  position: relative;
  background: linear-gradient(170deg, #133663 0%, #0d2240 60%, #091526 100%);
  padding: 20px 20px 88px;
  overflow: hidden;
  border-bottom: 1px solid rgba(143, 211, 255, 0.1);
}

.hero-top-bar {
  max-width: 1080px;
  margin: 0 auto 36px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.pass-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(143, 211, 255, 0.25);
  font-family: 'Outfit', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--alpine-ice);
}

.pass-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #42e395;
  box-shadow: 0 0 8px #42e395;
}

.status-counter {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
}

.hero-content {
  max-width: 680px;
  margin: 0 auto;
  text-align: center;
}

.hero-eyebrow {
  margin: 0 0 10px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--xmas-gold);
}

.hero-title {
  margin: 0 0 12px;
  font-family: 'Outfit', sans-serif;
  font-size: clamp(2.15rem, 6vw, 3.4rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.025em;
}

.hero-lead {
  margin: 0 auto 24px;
  max-width: 520px;
  font-size: 1rem;
  line-height: 1.55;
  color: #c2d6ec;
}

.progress-wrap {
  max-width: 340px;
  height: 8px;
  margin: 0 auto;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--xmas-red), var(--xmas-gold));
  transition: width 0.5s ease;
}

.mountain-ridge {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 68px;
  display: block;
}

/* ===========================
   KALENDER-GRID
   =========================== */
.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 18px 64px;
  flex: 1;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.door-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 164px;
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--snow);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease, background-color 0.22s ease;
  -webkit-tap-highlight-color: transparent;
}

/* Milstolpe-storlekar */
.door-card.size-wide {
  grid-column: span 2;
  min-height: 176px;
}

.door-card.size-hero {
  grid-column: 1 / -1;
  min-height: 205px;
}

/* Dekorativ pistlinje i kortets kant */
.door-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
}

/* STATE 1: LÅST (framtida datum) */
.door-card.is-locked {
  opacity: 0.62;
  cursor: not-allowed;
  background: rgba(13, 27, 48, 0.58);
}

.door-card.is-locked:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

/* STATE 2: TILLGÄNGLIG & OÖPPNAD (ska synas tydligt!) */
.door-card.is-unopened {
  background: linear-gradient(145deg, rgba(168, 25, 42, 0.86), rgba(96, 15, 31, 0.92));
  border-color: rgba(240, 194, 91, 0.65);
  box-shadow: 0 10px 28px rgba(200, 35, 55, 0.28);
}

.door-card.is-unopened::before {
  background: linear-gradient(90deg, var(--xmas-gold), #fff1c2, var(--xmas-gold));
}

.door-card.is-unopened:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 34px rgba(200, 35, 55, 0.42);
}

/* STATE 3: ÖPPNAD (kan öppnas igen hur många gånger som helst) */
.door-card.is-opened {
  background: linear-gradient(155deg, rgba(22, 54, 92, 0.86), rgba(14, 34, 60, 0.92));
  border-color: rgba(143, 211, 255, 0.34);
}

.door-card.is-opened::before {
  background: linear-gradient(90deg, var(--alpine-blue), var(--alpine-ice));
}

.door-card.is-opened:hover {
  transform: translateY(-3px);
  border-color: rgba(143, 211, 255, 0.6);
  background: var(--bg-card-hover);
}

/* Julafton extra lyxig när den går att öppna */
.door-card.size-hero.is-unopened {
  background: linear-gradient(135deg, #b81d31 0%, #6d1020 55%, #19385f 100%);
  border: 1.5px solid var(--xmas-gold);
}

.door-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.door-number {
  font-family: 'Outfit', sans-serif;
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
}

.size-wide .door-number,
.size-hero .door-number {
  font-size: 2.65rem;
}

.door-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.status-unopened {
  background: rgba(240, 194, 91, 0.22);
  color: #ffe39b;
  border: 1px solid rgba(240, 194, 91, 0.55);
}

.status-unopened .pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--xmas-gold);
  animation: pulse 1.6s infinite;
}

.status-opened {
  background: rgba(143, 211, 255, 0.14);
  color: var(--alpine-ice);
  border: 1px solid rgba(143, 211, 255, 0.28);
}

.status-locked {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-muted);
}

.door-bottom {
  margin-top: 18px;
}

.door-milestone {
  display: inline-block;
  margin-bottom: 6px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--xmas-gold);
}

.door-label {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--snow);
}

.is-locked .door-label {
  color: var(--text-muted);
  font-weight: 500;
}

.door-sub {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: rgba(244, 248, 252, 0.72);
}

.door-card.is-shake {
  animation: shake 0.38s ease;
}

/* ===========================
   POPUP-MODAL
   =========================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background: rgba(4, 10, 20, 0.8);
  backdrop-filter: blur(10px);
  animation: fadeIn 0.2s ease;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 580px;
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 24px;
  background: linear-gradient(165deg, #152e4f 0%, #0d1d35 100%);
  border: 1px solid rgba(143, 211, 255, 0.26);
  box-shadow: var(--shadow-lg);
  animation: popIn 0.24s cubic-bezier(0.2, 0.9, 0.25, 1);
}

.modal-close {
  position: sticky;
  top: 14px;
  float: right;
  margin: 14px 14px -52px 0;
  z-index: 10;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(9, 21, 38, 0.78);
  color: var(--snow);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: grid;
  place-items: center;
  backdrop-filter: blur(6px);
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.modal-close:hover {
  background: var(--xmas-red);
  transform: scale(1.06);
}

.modal-image-wrap {
  width: 100%;
  max-height: 300px;
  overflow: hidden;
  background: #081221;
}

.modal-image-wrap img {
  width: 100%;
  height: 100%;
  max-height: 300px;
  object-fit: cover;
  display: block;
}

.modal-body {
  padding: 26px 26px 30px;
  clear: both;
}

.modal-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.modal-day {
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(200, 35, 55, 0.24);
  border: 1px solid rgba(200, 35, 55, 0.55);
  color: #ffd5da;
  font-family: 'Outfit', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.modal-piste {
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(30, 120, 214, 0.2);
  border: 1px solid rgba(143, 211, 255, 0.35);
  color: var(--alpine-ice);
  font-size: 0.78rem;
  font-weight: 600;
}

.modal-title {
  margin: 0 0 14px;
  font-family: 'Outfit', sans-serif;
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.18;
}

.modal-text {
  font-size: 1rem;
  line-height: 1.68;
  color: #d7e5f5;
}

.modal-text p {
  margin: 0 0 12px;
}

.modal-text p:last-child {
  margin-bottom: 0;
}

.modal-extra {
  margin-top: 22px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: rgba(240, 194, 91, 0.1);
  border: 1px dashed rgba(240, 194, 91, 0.55);
}

.modal-extra-label {
  display: block;
  font-family: 'Outfit', sans-serif;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--xmas-gold);
  margin-bottom: 6px;
}

.modal-extra p {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--snow);
  line-height: 1.5;
}

/* ===========================
   TOAST & FOOTER
   =========================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  z-index: 90;
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(16, 35, 61, 0.96);
  border: 1px solid rgba(143, 211, 255, 0.35);
  color: var(--snow);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  text-align: center;
  max-width: calc(100% - 32px);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.footer {
  text-align: center;
  padding: 20px 16px 36px;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  color: rgba(158, 182, 209, 0.55);
  text-transform: uppercase;
}

/* ===========================
   ANIMATIONER & RESPONSIVITET
   =========================== */
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.45); opacity: 0.5; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 820px) {
  .calendar-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .door-card {
    min-height: 146px;
    padding: 15px;
  }

  .door-card.size-wide,
  .door-card.size-hero {
    grid-column: span 2;
  }

  .hero {
    padding: 16px 16px 76px;
  }

  .modal-body {
    padding: 20px 20px 26px;
  }
}