@font-face {
  font-family: Nunito;
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("../fonts/nunito-cyrillic-800.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: Nunito;
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("../fonts/nunito-latin-800.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

html, body {
  height: 100%;
  background: #7b030f;
  overflow: hidden;
}

body {
  margin: 0;
  display: grid;
  place-items: center;
  font-family: Nunito, "Segoe UI", sans-serif;
  font-weight: 800;
  color: #fff6ea;
  touch-action: manipulation;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.board {
  width: min(100vw, calc(100vh * 4 / 3));
  height: min(100vh, calc(100vw * 3 / 4));
  padding: 1.5%;
  box-sizing: border-box;
}

.board .container-fluid {
  height: 100%;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1.3%;
}

.board .container-fluid > .row {
  flex: 1 1 0;
  min-height: 0;
  flex-wrap: nowrap;
  --bs-gutter-x: 0;
  --bs-gutter-y: 0;
  margin: 0;
  gap: 1.15%;
}

.board .row-5 {
  padding-inline: 8.333%;
}

.slot {
  position: relative;
  min-width: 0;
  min-height: 0;
  padding: 0;
  width: auto;
  flex: 1 1 0;
  align-self: stretch;
}

.day {
  position: absolute;
  inset: 0;
  display: block;
  width: auto;
  height: auto;
  padding: 0;
  border: 0;
  margin: 0;
  background: transparent;
  color: var(--ink, #fff6ea);
  container-type: size;
  cursor: pointer;
  border-radius: 14%;
  transform-origin: center center;
  transition: transform 1.4s cubic-bezier(0.22, 0.61, 0.16, 1), filter 0.7s ease;
}

.day:focus {
  outline: none;
}
.day:focus-visible {
  outline: 3px solid #ffe08a;
  outline-offset: 3px;
}

.inner {
  height: 100%;
  display: grid;
  transform-style: preserve-3d;
  transition: transform 1.4s cubic-bezier(0.22, 0.61, 0.16, 1);
  border-radius: inherit;
}
.day:not(.is-open) .inner {
  transition-duration: 0.28s;
}

.day.is-flipped .inner {
  transform: rotateY(180deg);
}

.day:not(.is-open):hover .inner {
  transform: translateY(-3px) scale(1.03);
}
.day:not(.is-open):active .inner {
  transform: scale(0.97);
}

.face {
  grid-area: 1 / 1;
  position: relative;
  border-radius: inherit;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  background: var(--paper, #d1001f);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.16),
    0 10px 16px rgba(40, 0, 6, 0.32);
}

.face::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.22), transparent 46%);
  pointer-events: none;
  z-index: 0;
}

.front {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  padding: 6% 5% 6% 7%;
}

.front .ico,
.front .num {
  position: relative;
  z-index: 1;
}

.front .ico {
  width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.front .num {
  font-size: 34cqmin;
  line-height: 0.82;
  text-align: center;
  letter-spacing: -0.03em;
}

.day:not(.two) .front .num {
  font-size: 46cqmin;
}

.back {
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 7% 8%;
  gap: 2%;
}

.back .num,
.back .task {
  position: relative;
  z-index: 1;
}

.back .num {
  font-size: 16cqmin;
  line-height: 1;
  opacity: 0.8;
}

.back .task {
  font-size: 8.6cqmin;
  line-height: 1.16;
  text-wrap: balance;
}

.back .watermark {
  position: absolute;
  width: 72%;
  height: auto;
  right: -6%;
  bottom: -8%;
  opacity: 0.16;
  z-index: 0;
  pointer-events: none;
}

.day.is-open {
  position: fixed;
  z-index: 30;
  inset: auto;
  margin: 0;
}

.day.is-open .face {
  box-shadow:
    inset 0 0 0 3px rgba(255, 255, 255, 0.18),
    0 24px 50px rgba(30, 0, 6, 0.4);
}

body.is-dim .day:not(.is-open) {
  filter: brightness(0.72) saturate(0.9);
}

.shade {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(48, 0, 6, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
}

.shade.show {
  opacity: 1;
  pointer-events: auto;
}

.d1 { --ink: #fff6ea; --paper: #d1001f; }
.d2 { --ink: #7b030f; --paper: #f6c248; }
.d3 { --ink: #d1001f; --paper: #fff4d2; }
.d3 .face { background: repeating-linear-gradient(45deg, #fffaf3 0 11px, #ffe08a 11px 22px); }
.d4 { --ink: #fff6ea; --paper: #5c7e05; }
.d5 { --ink: #7b030f; --paper: #e0b15a; }
.d6 { --ink: #d1001f; --paper: #fff6ea; }
.d7 { --ink: #fff6ea; --paper: #4f7308; }
.d8 { --ink: #7b030f; --paper: #f4c34a; }
.d9 { --ink: #7b030f; --paper: #fff6ea; }
.d10 { --ink: #fff6ea; --paper: #c8101e; }
.d11 { --ink: #7b030f; --paper: #f6c248; }
.d12 { --ink: #fff6ea; --paper: #b80e1c; }
.d12 .face { background: repeating-linear-gradient(90deg, #c8101e 0 14px, #9d0c16 14px 28px); }
.d13 { --ink: #7b030f; --paper: #e4b07a; }
.d14 { --ink: #d1001f; --paper: #fffaf3; }
.d15 { --ink: #fff6ea; --paper: #5f820c; }
.d16 { --ink: #fff6ea; --paper: #5c7e05; }
.d17 { --ink: #7b030f; --paper: #e0b15a; }
.d18 { --ink: #7b030f; --paper: #f6c248; }
.d19 { --ink: #fff6ea; --paper: #a30d18; }
.d19 .face { background: repeating-linear-gradient(-45deg, #c8101e 0 16px, #8e0b14 16px 32px); }
.d20 { --ink: #fff6ea; --paper: #3f6206; }
.d21 { --ink: #fff6ea; --paper: #d1001f; }
.d22 { --ink: #d1001f; --paper: #fff6ea; }

@media (prefers-reduced-motion: reduce) {
  .day, .inner, .shade {
    transition: none;
  }
}
