:root {
  --advent-padding: 45px;
  --door-size: 12vw;
  --cell-padding: 6px;
  --base-offset: calc(var(--advent-padding) + var(--cell-padding));
  --step: calc(var(--door-size) + 2 * var(--cell-padding));
  --advent-background-image: url('media/background.jpeg');
  --advent-background-image-medium: url('media/background2.png');
  --advent-background-image-small: url('media/background3.png');
}

body {
  padding: 0;
font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.advent {
  margin-left: calc((100vw - (60vw + 150px)) / 2); 
  float: left;
  padding: var(--advent-padding);
  background-image: var(--advent-background-image);
  background-repeat: no-repeat;
 }

@media (max-width: 1400px) {
  :root {
    --advent-background-image: var(--advent-background-image-medium);
  }
}

@media (max-width: 900px) {
  :root {
    --advent-background-image: var(--advent-background-image-small);
  }
}

.advent__row {
  clear: both; }

.advent__row__cell {
  float: left;
  padding: var(--cell-padding); }

.door {
  width: var(--door-size);
  height: var(--door-size);
  position: relative; }

.door__hinge {
  position: absolute;
  top: 0;
  left: 0; }

.door__hinge__pane {
  width: calc(0.888 * var(--door-size));
  height: calc(0.888 * var(--door-size));
  display: block;
  position: relative;
  z-index: 1;
  -webkit-perspective: 600px;
  -moz-perspective: 600px;
  -ms-perspective: 600px;
  perspective: 600px;
  cursor: pointer;
  font-size: 1.2em; }

.door__hinge__pane--open .door__hinge__pane--front {
  z-index: 9;
  transform: rotateY(-180deg);
  left: 2px; }

.door__hinge__pane--open .door__hinge__pane--back {
  z-index: 10;
  transform: rotateY(0deg) translateX(calc(-0.888 * var(--door-size))) translateZ(0px); }

.door__hinge__pane--front {
  z-index: 10;
  border: 1px dashed #3f3f3e;
  background-image: var(--advent-background-image);
  background-repeat: no-repeat;
  background-position: calc(-1 * (var(--base-offset) + var(--col, 0) * var(--step))) calc(-1 * (var(--base-offset) + var(--row, 0) * var(--step)));
 }

.door__hinge__pane--back {
  z-index: 9;
  backface-visibility: hidden;
  -webkit-transform-style: preserve-3d;
  -moz-transform-style: preserve-3d;
  -ms-transform-style: preserve-3d;
  transform-style: preserve-3d;
  transform: rotateY(180deg) translateX(calc(-0.888 * var(--door-size))) translateZ(0px);
  background-color: #9d845b;
  border: 1px solid #9d845b; }

.door__hinge__pane--front, .door__hinge__pane--back {
  transform-origin: 0 0 0;
  transition-duration: 1s;
  width: inherit;
  height: inherit;
  margin: 0;
  position: absolute;
  top: 0;
  left: 0; }

.door__hinge__pane--open .door__hinge__pane--back .door__hinge__pane__shadow {
  position: relative;
  width: calc(0.888 * var(--door-size) + 1px);
  height: calc(0.888 * var(--door-size) + 1px);
  background-color: #9d845b; }

.door__hinge__pane--open .door__hinge__pane--back .door__hinge__pane__shadow::before {
  bottom: 10px;
  box-shadow: 0 15px 10px #000;
  content: "";
  left: 10px;
  position: absolute;
  top: 80%;
  transform: rotate(-3deg);
  width: 90%;
  z-index: -1; }

.number {
  float: right;
  padding: 10px; }

.number--black {
  color: black; }

  .number--white {
    color: white; }

  .door__hinge__pane--one { --col: 0; --row: 0; }
  .door__hinge__pane--two { --col: 1; --row: 0; }
  .door__hinge__pane--three { --col: 2; --row: 0; }
  .door__hinge__pane--four { --col: 3; --row: 0; }
  .door__hinge__pane--five { --col: 4; --row: 0; }
  .door__hinge__pane--six { --col: 0; --row: 1; }
  .door__hinge__pane--seven { --col: 1; --row: 1; }
  .door__hinge__pane--eight { --col: 2; --row: 1; }
  .door__hinge__pane--nine { --col: 3; --row: 1; }
  .door__hinge__pane--ten { --col: 4; --row: 1; }
  .door__hinge__pane--eleven { --col: 0; --row: 2; }
  .door__hinge__pane--twelve { --col: 1; --row: 2; }
  .door__hinge__pane--thirteen { --col: 2; --row: 2; }
  .door__hinge__pane--fourteen { --col: 3; --row: 2; }
  .door__hinge__pane--fifteen { --col: 4; --row: 2; }
  .door__hinge__pane--sixteen { --col: 0; --row: 3; }
  .door__hinge__pane--seventeen { --col: 1; --row: 3; }
  .door__hinge__pane--eighteen { --col: 2; --row: 3; }
  .door__hinge__pane--nineteen { --col: 3; --row: 3; }
  .door__hinge__pane--twenty { --col: 4; --row: 3; }
  .door__hinge__pane--twenty-one { --col: 0; --row: 4; }
  .door__hinge__pane--twenty-two { --col: 1; --row: 4; }
  .door__hinge__pane--twenty-three { --col: 2; --row: 4; }
  .door__hinge__pane--twenty-four { --col: 3; --row: 4; }
  .door__hinge__pane--twenty-five { --col: 4; --row: 4; }
  .door__hinge__pane--twenty-six { --col: 0; --row: 5; }
  .door__hinge__pane--twenty-seven { --col: 1; --row: 5; }
  .door__hinge__pane--twenty-eight { --col: 2; --row: 5; }
  .door__hinge__pane--twenty-nine { --col: 3; --row: 5; }
  .door__hinge__pane--thirty { --col: 4; --row: 5; }
  .door__hinge__pane--thirty-one { --col: 0; --row: 6; }
  .door__hinge__pane--thirty-two { --col: 1; --row: 6; }
  .door__hinge__pane--thirty-three { --col: 2; --row: 6; }
  .door__hinge__pane--thirty-four { --col: 3; --row: 6; }
  .door__hinge__pane--thirty-five { --col: 4; --row: 6; }
  .door__hinge__pane--thirty-six { --col: 0; --row: 7; }
  .door__hinge__pane--thirty-seven { --col: 1; --row: 7; }
  .door__hinge__pane--thirty-eight { --col: 2; --row: 7; }
  .door__hinge__pane--thirty-nine { --col: 3; --row: 7; }
  .door__hinge__pane--fourty { --col: 4; --row: 7; }

.cube {
  position: absolute;
  top: var(--cell-padding);
  left: var(--cell-padding); }

.door__content {
  position: absolute;
  top: var(--cell-padding);
  left: var(--cell-padding);
  width: calc(0.8 * var(--door-size));
  height: calc(0.8 * var(--door-size));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  box-sizing: border-box;
  border-radius: 16px;
  background-image: url('media/cadre.jpg');
  background-size: cover;
  background-position: center;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  z-index: 2;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.door--opened .door__content {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  z-index: 1;
}

.door__content--gift {
  padding: 8px;
  background-image: none;
  background-color: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.door__gift-button {
  width: 100%;
  height: 100%;
  padding: 0;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.door__gift-button:focus-visible {
  outline: 2px solid #f9a825;
  outline-offset: 4px;
}

.door__gift-image {
  width: 100%;
  height: auto;
  max-width: 140px;
  transform-origin: 50% 100%;
  animation: gift-bounce 2.4s ease-in-out infinite;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.35));
}

@keyframes gift-bounce {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  50% {
    transform: translateY(-8px) scale(1.03);
  }
}

@media (prefers-reduced-motion: reduce) {
  .door__gift-image {
    animation: none;
  }
}

.door-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background-color: rgba(0, 0, 0, 0.65);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 20;
}

.door-modal--visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.door-modal__overlay {
  position: absolute;
  inset: 0;
  z-index: 0;
  cursor: pointer;
}

.door-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(90vw, 520px);
  border-radius: 24px;
  background: linear-gradient(145deg, #fffdf5, #ffe7d1);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
  padding: clamp(20px, 5vw, 32px);
  text-align: center;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}

.door-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.door-modal__close:hover,
.door-modal__close:focus-visible {
  background: rgba(0, 0, 0, 0.8);
  transform: scale(1.05);
  outline: none;
}

.door-modal__close span {
  transform: translateY(-1px);
}

.door-modal__body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.door-modal__title {
  margin: 0 0 20px;
  font-size: clamp(1.4rem, 3vw, 2rem);
  color: #b23a48;
  font-weight: 700;
}

.door-modal__video {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
  border-radius: 18px;
  background-color: #000;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
  max-height: min(60vh, 400px);
  object-fit: cover;
}

.door-modal__figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.door-modal__image {
  width: 100%;
  height: auto;
  border-radius: 18px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
  object-fit: cover;
}

.door-modal__caption {
  margin: 0;
  font-size: 1rem;
  color: #5a3d2b;
  text-align: center;
}

.door-modal__fallback {
  margin: 0;
  font-size: 1.05rem;
  color: #5a3d2b;
  text-align: center;
}

.body--modal-open {
  overflow: hidden;
}

.body--preferences-open {
  overflow: hidden;
}

.preferences-toggle {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #f7c16b, #e86a92);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
  transition: opacity 0.3s ease, transform 0.3s ease, box-shadow 0.2s ease;
  z-index: 30;
}

.preferences-toggle--visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.preferences-toggle:hover {
  box-shadow: 0 20px 36px rgba(0, 0, 0, 0.35);
}

.preferences-toggle:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 4px;
}

.preferences-toggle__icon {
  font-size: 26px;
  line-height: 1;
}

.preferences {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 40;
}

.preferences--visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.preferences__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.preferences__dialog {
  position: relative;
  z-index: 1;
  width: min(90vw, 420px);
  border-radius: 24px;
  background: linear-gradient(160deg, #fffdf5, #ffe1cc);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
  padding: clamp(20px, 5vw, 32px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.preferences__title {
  margin: 0;
  font-size: clamp(1.4rem, 4vw, 1.8rem);
  color: #b23a48;
  font-weight: 700;
}

.preferences__close {
  border: none;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.preferences__close:hover,
.preferences__close:focus-visible {
  background: rgba(0, 0, 0, 0.85);
  transform: scale(1.05);
  outline: none;
}

.preferences__description,
.preferences__hint {
  margin: 0;
  color: #5a3d2b;
  font-size: 1rem;
  line-height: 1.45;
}

.preferences__hint {
  font-size: 0.95rem;
  opacity: 0.9;
}

.preferences__form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.preferences__options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.preferences-option {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  border: 2px solid transparent;
}

.preferences-option:hover,
.preferences-option:focus-within {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.18);
}

.preferences-option--selected {
  border-color: rgba(226, 118, 99, 0.6);
  box-shadow: 0 14px 28px rgba(226, 118, 99, 0.35);
}

.preferences-option__input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.preferences-option__preview {
  width: 100%;
  padding-top: 66%;
  border-radius: 12px;
  background-size: cover;
  background-position: center;
  background-color: #e0d4c6;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.preferences-option__preview--random {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  background-image: none;
  background-color: rgba(226, 118, 99, 0.18);
  color: #b23a48;
}

.preferences-option__label {
  margin: 0;
  font-size: 1rem;
  color: #5a3d2b;
  text-align: center;
  font-weight: 600;
}

@media (max-width: 600px) {
  .preferences-toggle {
    right: 16px;
    bottom: 16px;
    width: 52px;
    height: 52px;
  }

  .preferences__dialog {
    width: min(95vw, 360px);
    padding: 20px;
  }
}

.cube__container {
  width: calc(0.8 * var(--door-size));
  height: calc(0.8 * var(--door-size));
  position: relative;
  -webkit-perspective: 1000px;
  -moz-perspective: 1000px;
  -ms-perspective: 1000px;
  perspective: 1000px; }

.panes {
  width: 100%;
  height: 100%;
  position: absolute;
  -webkit-transform-style: preserve-3d;
  -moz-transform-style: preserve-3d;
  -ms-transform-style: preserve-3d;
  transform-style: preserve-3d; }

.pane {
  margin: 0;
  width: calc(0.8 * var(--door-size));
  height: calc(0.8 * var(--door-size));
  display: block;
  position: absolute; }

.pane--back {
  transform: rotateX(180deg) translateZ(calc(0.4 * var(--door-size)));
  background-color: #9d845b;
  -webkit-box-shadow: inset 0px 0px 24px 3px #826b49;
  -moz-box-shadow: inset 0px 0px 24px 3px #826b49;
  box-shadow: inset 0px 0px 24px 3px #826b49; }

.pane--right {
  transform: rotateY(90deg) translateZ(calc(0.4 * var(--door-size)));
  background: #816b44;
  background: -moz-linear-gradient(left, #816b44 0%, #998057 100%);
  background: -webkit-linear-gradient(left, #816b44 0%, #998057 100%);
  background: linear-gradient(to right, #816b44 0%, #998057 100%);
  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#816b44', endColorstr='#998057',GradientType=1 ); }

.pane--left {
  transform: rotateY(-90deg) translateZ(calc(0.4 * var(--door-size)));
  background-color: #816b44; }

.pane--top {
  transform: rotateX(90deg) translateZ(calc(0.4 * var(--door-size)));
  background-color: #735d36; }

.pane--bottom {
  transform: rotateX(-90deg) translateZ(calc(0.4 * var(--door-size)));
  background: #6e562a;
  background: -moz-linear-gradient(left, #6e562a 0%, #a18762 100%);
  background: -webkit-linear-gradient(left, #6e562a 0%, #a18762 100%);
  background: linear-gradient(to right, #6e562a 0%, #a18762 100%);
  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6e562a', endColorstr='#a18762',GradientType=1 ); }


.message {
  position: fixed;
  top: 25px;
  right: 25px;
  width: auto;
  z-index: 15;
  border-radius: 999px;
  padding: 8px;
  background: linear-gradient(45deg, #ff5f6d, #ffc371)
}

