:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #E59189;
  color: #f4f4f1;
}

* {
  box-sizing: border-box;
}

:root {
  --cursor-x: -120px;
  --cursor-y: -120px;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #E59189;
  cursor: none;
}

body {
  min-width: 320px;
}

.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #E59189;
  --noise-opacity: 0.18;
  --noise-size: 86px;
}

#gallery {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: none;
}

#gallery:active {
  cursor: none;
}

#dragon-canvas {
  position: absolute;
  z-index: 3;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  pointer-events: none;
  transition: opacity 700ms ease;
}

#dragon-canvas.is-visible {
  opacity: 1;
}

.loading-screen {
  position: fixed;
  z-index: 60;
  inset: 0;
  display: grid;
  place-items: center;
  background: #E59189;
  opacity: 1;
  pointer-events: auto;
  transition: opacity 420ms ease, visibility 0s linear 420ms;
  visibility: visible;
}

.loading-screen.is-hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.loader {
  --color-1: #fff;
  --color-2: #ff3d00;
  --size: 1px;

  display: block;
  position: relative;
  height: calc(12 * var(--size));
  width: min(250px, 80vw);
  border: calc(1 * var(--size)) solid var(--color-1);
  border-radius: calc(10 * var(--size));
  overflow: hidden;
}

.loader:after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0;
  background: var(--color-2);
  animation: 6s prog ease-in infinite;
}

@keyframes prog {
  to {
    width: 100%;
  }
}

a,
button,
.button-color-flip {
  cursor: none;
}

.custom-cursor {
  position: fixed;
  z-index: 40;
  top: 0;
  left: 0;
  width: 40px;
  height: 52px;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(var(--cursor-x), var(--cursor-y), 0) translate(-50%, -50%);
  will-change: transform, opacity;
}

.custom-cursor-image {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 100%;
  height: auto;
  display: block;
  transform: translateX(-50%);
  user-select: none;
  -webkit-user-drag: none;
}

.custom-cursor.is-visible {
  opacity: 1;
}

.custom-cursor.is-blinking {
  animation: none;
}

.custom-cursor.is-high {
  margin-top: -3px;
}

.custom-cursor.is-hovering {
  margin-top: -3px;
}

.custom-cursor.is-clicking {
  animation: none;
}

@media (pointer: coarse) {
  html,
  body,
  #gallery,
  #gallery:active,
  a,
  button,
  .button-color-flip {
    cursor: auto;
  }

  .custom-cursor {
    display: none;
  }
}

.paper-sticker {
  position: absolute;
  z-index: 1;
  height: auto;
  pointer-events: none;
  opacity: 0.92;
  filter: drop-shadow(0 12px 22px rgba(70, 70, 70, 0.12));
}

.paper-sticker--ob {
  z-index: 6;
  top: 24px;
  left: 50%;
  width: 190px;
  pointer-events: auto;
  touch-action: manipulation;
  transform: translateX(-50%) rotate(-5deg);
  transform-origin: 44% 45%;
}

.paper-sticker--ob2 {
  display: none;
  top: clamp(-26px, calc(4.7vw - 60px), -2px);
  left: clamp(148px, 13vw, 190px);
  width: clamp(270px, calc(22vw + 50px), 350px);
  transform: rotate(1deg);
  transform-origin: 42% 50%;
}

.author-button {
  position: absolute;
  z-index: 4;
  right: 12px;
  bottom: 12px;
  transform: scale(1.5);
  transform-origin: right bottom;
}

.button-color-flip {
  --elastic-ease-out: linear(
    0,
    0.5737 7.6%,
    0.8382 11.87%,
    0.9463 14.19%,
    1.0292 16.54%,
    1.0886 18.97%,
    1.1258 21.53%,
    1.137 22.97%,
    1.1424 24.48%,
    1.1423 26.1%,
    1.1366 27.86%,
    1.1165 31.01%,
    1.0507 38.62%,
    1.0219 42.57%,
    0.9995 46.99%,
    0.9872 51.63%,
    0.9842 58.77%,
    1.0011 81.26%,
    1
  );
  --smooth-ease: cubic-bezier(0.32, 0.72, 0, 1);
  --color-ease: cubic-bezier(0.216, 0.62, 0.356, 1);
  color: #000;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  user-select: none;
  font-family: font-mono-medium, Menlo, Consolas, Monaco, "Liberation Mono", "Lucida Console", monospace;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1em;
  text-decoration: none;
  transition: transform 0.45s var(--elastic-ease-out);
  -webkit-tap-highlight-color: transparent;
}

.corner-clock {
  position: absolute;
  z-index: 4;
  color: #000;
  pointer-events: none;
  user-select: none;
  font-family: font-mono-medium, Menlo, Consolas, Monaco, "Liberation Mono", "Lucida Console", monospace;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1em;
  letter-spacing: -0.02em;
}

.clock-colon.is-hidden {
  visibility: hidden;
}

.corner-clock--top-left {
  top: 12px;
  left: 12px;
}

.corner-clock--top-right {
  top: 12px;
  right: 12px;
}

.corner-clock--bottom-left {
  bottom: 12px;
  left: 12px;
}

.button-color-flip:active {
  transform: scaleX(0.955) scaleY(0.954);
}

.button-color-flip_inner {
  pointer-events: none;
  perspective: 500px;
  transform-style: preserve-3d;
  display: grid;
}

.button-color-flip_front {
  grid-area: 1 / 1;
  display: grid;
  transition: translate 0.85s var(--elastic-ease-out), rotate 0.75s var(--elastic-ease-out), opacity 0.15s ease-out;
}

.button-color-flip_bg {
  background-color: #f0ece5;
  border-radius: 0.3125rem;
  grid-area: 1 / 1;
  display: grid;
  transition: background-color 0.2s var(--color-ease);
}

.button-color-flip_text {
  grid-area: 1 / 1;
  padding: 0.75rem 1rem;
  transition: translate 0.75s var(--elastic-ease-out);
}

.button-color-flip_back {
  gap: 0.25rem;
  background-color: #ff5100;
  border-radius: 0.3125rem;
  grid-area: 1 / 1;
  justify-content: center;
  place-self: center;
  align-items: center;
  width: calc(100% - 0.125rem);
  height: calc(100% - 0.125rem);
  display: flex;
  opacity: 0;
  translate: 0 2rem -6rem;
  rotate: x -90deg;
  transition: translate 0.85s var(--elastic-ease-out), rotate 0.75s var(--elastic-ease-out), opacity 0.15s ease-out;
}

.button-color-flip_back::before {
  --index: 1;
  content: attr(data-text);
  display: contents;
}

.button-color-flip_back::before,
.button-color-flip_arrow {
  transition: translate 0.75s var(--elastic-ease-out);
  translate: 0 0.75rem;
}

.button-color-flip_arrow {
  margin-top: -0.0625rem;
}

@media (hover: hover) and (pointer: fine) {
  .button-color-flip:is(:hover, :focus-visible) .button-color-flip_front {
    translate: 0 -2rem -6rem;
    rotate: x 85deg;
    opacity: 0;
  }

  .button-color-flip:is(:hover, :focus-visible) .button-color-flip_text {
    translate: 0 -0.75rem;
    transition-delay: 0s;
  }

  .button-color-flip:is(:hover, :focus-visible) .button-color-flip_back {
    rotate: x 0deg;
    translate: 0;
    opacity: 1;
    transition: translate 0.85s var(--elastic-ease-out), rotate 0.75s var(--elastic-ease-out), opacity 0.075s ease-in;
  }

  .button-color-flip:is(:hover, :focus-visible) .button-color-flip_arrow {
    translate: 0;
    transition-delay: calc(var(--index) * 0.012s);
  }
}

@media (hover: none) or (pointer: coarse) {
  .button-color-flip:active .button-color-flip_bg {
    background-color: #ff5100;
    transition-duration: 0s;
  }
}

.noise-overlay {
  position: absolute;
  z-index: 2;
  inset: -25%;
  pointer-events: none;
  opacity: var(--noise-opacity);
  background-image:
    radial-gradient(circle at 12% 18%, rgba(0, 0, 0, 0.72) 0 1px, transparent 1.7px),
    radial-gradient(circle at 72% 34%, rgba(255, 255, 255, 0.82) 0 1px, transparent 1.8px),
    radial-gradient(circle at 41% 76%, rgba(0, 0, 0, 0.62) 0 1.1px, transparent 1.9px),
    radial-gradient(circle at 88% 82%, rgba(255, 255, 255, 0.72) 0 1px, transparent 1.8px),
    radial-gradient(circle at 28% 55%, rgba(0, 0, 0, 0.54) 0 0.9px, transparent 1.7px);
  background-size:
    var(--noise-size) var(--noise-size),
    calc(var(--noise-size) * 0.73) calc(var(--noise-size) * 0.73),
    calc(var(--noise-size) * 0.49) calc(var(--noise-size) * 0.49),
    calc(var(--noise-size) * 0.62) calc(var(--noise-size) * 0.62),
    calc(var(--noise-size) * 0.38) calc(var(--noise-size) * 0.38);
  animation: noise-drift 0.9s steps(4) infinite;
}

@keyframes noise-drift {
  0% {
    transform: translate3d(0, 0, 0);
  }

  25% {
    transform: translate3d(-4%, 3%, 0);
  }

  50% {
    transform: translate3d(3%, -5%, 0);
  }

  75% {
    transform: translate3d(5%, 4%, 0);
  }

  100% {
    transform: translate3d(-2%, -3%, 0);
  }
}

.rotation-panel {
  position: absolute;
  z-index: 5;
  display: none;
  right: 18px;
  bottom: 18px;
  width: 268px;
  min-height: 44px;
  padding: 14px 14px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(12, 12, 12, 0.62);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(16px);
  overflow: hidden;
  transition: width 220ms ease, padding 220ms ease, border-radius 220ms ease, background 220ms ease;
}

.panel-toggle {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.08);
  font: inherit;
  font-size: 20px;
  line-height: 26px;
  cursor: none;
  transition: transform 220ms ease, background 160ms ease;
}

.panel-toggle:hover {
  background: rgba(255, 255, 255, 0.14);
}

.panel-content {
  opacity: 1;
  transform: translateX(0);
  transition: opacity 160ms ease, transform 220ms ease;
}

.rotation-panel label {
  display: grid;
  grid-template-columns: 38px 1fr 48px;
  gap: 10px;
  align-items: center;
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  line-height: 1;
}

.rotation-panel output {
  color: rgba(255, 255, 255, 0.72);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.rotation-panel label + label {
  margin-top: 12px;
}

.rotation-panel input {
  width: 100%;
  accent-color: #ddfa42;
}

.rotation-panel.is-collapsed {
  width: 44px;
  padding: 8px;
  border-radius: 8px;
}

.rotation-panel.is-collapsed .panel-toggle {
  position: static;
  transform: rotate(180deg);
}

.rotation-panel.is-collapsed .panel-content {
  opacity: 0;
  pointer-events: none;
  transform: translateX(16px);
  position: absolute;
}

@media (max-width: 760px) {
  .paper-sticker--ob {
    top: 24px;
    left: 50%;
    width: 190px;
    transform: translateX(-50%) rotate(-5deg);
  }

  .paper-sticker--ob2 {
    top: -26px;
    left: clamp(104px, 26vw, 148px);
    width: clamp(210px, calc(45vw + 50px), 280px);
  }

  .rotation-panel {
    right: 12px;
    bottom: 12px;
    width: 236px;
  }

  .rotation-panel.is-collapsed {
    width: 44px;
  }
}
