:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #000;
  color: #fff;
  --safe-top: max(14px, env(safe-area-inset-top));
  --safe-right: max(14px, env(safe-area-inset-right));
  --safe-bottom: max(14px, env(safe-area-inset-bottom));
  --safe-left: max(14px, env(safe-area-inset-left));
}

* {
  box-sizing: border-box;
}

html,
body,
.world {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #000;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.world {
  position: relative;
  isolation: isolate;
  touch-action: manipulation;
}

.slides {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 1.2s ease-in-out;
  will-change: opacity;
  user-select: none;
  -webkit-user-drag: none;
}

.slide.is-visible {
  opacity: 1;
}

.glass {
  border: 1px solid rgb(255 255 255 / 14%);
  background: rgb(12 12 12 / 58%);
  box-shadow: 0 8px 28px rgb(0 0 0 / 28%);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
}

.visit-badge {
  position: fixed;
  z-index: 30;
  top: var(--safe-top);
  left: var(--safe-left);
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  letter-spacing: .01em;
}

.visit-badge__label strong {
  font-variant-numeric: tabular-nums;
}

.visit-badge__dot {
  margin: 0 7px;
  color: rgb(255 255 255 / 48%);
}

.reaction-stage {
  position: absolute;
  z-index: 10;
  pointer-events: none;
}

.world.is-placing .reaction-stage {
  cursor: none;
  pointer-events: auto;
  outline: 1px dashed rgb(255 255 255 / 38%);
  outline-offset: -1px;
}

.world.is-placing .reaction-sticker {
  pointer-events: none;
}

.reaction-sticker {
  position: absolute;
  left: calc(var(--x) * 100%);
  top: calc(var(--y) * 100%);
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  filter: drop-shadow(0 2px 5px rgb(0 0 0 / 75%));
  cursor: pointer;
  pointer-events: auto;
  font-size: 29px;
  line-height: 1;
  text-align: center;
  transition: transform 160ms ease, filter 160ms ease;
  animation: sticker-arrive 260ms ease-out both;
}

.reaction-sticker:hover,
.reaction-sticker:focus-visible {
  z-index: 4;
  filter: drop-shadow(0 3px 8px rgb(0 0 0 / 90%));
  transform: scale(1.16);
}

.reaction-sticker.is-mine::after {
  content: "";
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 7px;
  height: 7px;
  border: 1px solid rgb(0 0 0 / 60%);
  border-radius: 50%;
  background: #fff;
}

.reaction-sticker.is-dismissing {
  z-index: 8;
  cursor: default;
  pointer-events: none;
  will-change: opacity, transform, filter;
}

.reaction-sticker.is-dismissing .reaction-tooltip,
.reaction-sticker.is-dismissing::after {
  display: none;
}

.reaction-sticker.is-dismissing-heart {
  animation: sticker-dismiss-heart 1180ms cubic-bezier(.16, .8, .25, 1) both;
}

.reaction-sticker.is-dismissing-laugh {
  animation: sticker-dismiss-laugh 1280ms cubic-bezier(.2, .7, .2, 1) both;
}

.reaction-sticker.is-dismissing-paw {
  animation: sticker-dismiss-paw 1380ms cubic-bezier(.2, .65, .3, 1) both;
}

.reaction-sticker.is-dismissing-frog {
  animation: sticker-dismiss-frog 1320ms cubic-bezier(.22, .75, .2, 1) both;
}

.placement-cursor {
  position: absolute;
  z-index: 6;
  left: calc(var(--x) * 100%);
  top: calc(var(--y) * 100%);
  display: grid;
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
  border: 2px solid rgb(255 255 255 / 92%);
  border-radius: 50%;
  background: rgb(0 0 0 / 28%);
  box-shadow: 0 0 0 4px rgb(0 0 0 / 26%), 0 0 20px rgb(255 255 255 / 22%);
  filter: drop-shadow(0 3px 7px rgb(0 0 0 / 80%));
  font-size: 29px;
  line-height: 1;
  pointer-events: none;
  place-items: center;
}

.reaction-tooltip {
  position: absolute;
  z-index: 50;
  left: 50%;
  bottom: calc(100% + 5px);
  width: max-content;
  max-width: min(180px, 75vw);
  padding: 4px 6px;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 6px;
  background: rgb(8 8 8 / 90%);
  box-shadow: 0 3px 12px rgb(0 0 0 / 42%);
  color: #fff;
  font-size: 10px;
  font-weight: 550;
  line-height: 1.15;
  white-space: nowrap;
  transform: translateX(-50%) scale(.96);
  transform-origin: bottom center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 120ms ease, transform 120ms ease, visibility 120ms;
}

.reaction-sticker:hover .reaction-tooltip,
.reaction-sticker:focus-visible .reaction-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) scale(1);
}

.reaction-sticker.is-near-left .reaction-tooltip {
  left: 22px;
  transform: scale(.96);
  transform-origin: bottom left;
}

.reaction-sticker.is-near-right .reaction-tooltip {
  right: 22px;
  left: auto;
  transform: scale(.96);
  transform-origin: bottom right;
}

.reaction-sticker.is-near-top .reaction-tooltip {
  top: calc(100% + 7px);
  bottom: auto;
  transform-origin: top center;
}

.reaction-sticker.is-near-left:hover .reaction-tooltip,
.reaction-sticker.is-near-left:focus-visible .reaction-tooltip,
.reaction-sticker.is-near-right:hover .reaction-tooltip,
.reaction-sticker.is-near-right:focus-visible .reaction-tooltip {
  transform: scale(1);
}

.placement-hint {
  position: fixed;
  z-index: 32;
  top: calc(var(--safe-top) + 54px);
  left: 50%;
  margin: 0;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  transform: translateX(-50%);
  white-space: nowrap;
}

.reaction-controls {
  position: fixed;
  z-index: 30;
  bottom: var(--safe-bottom);
  left: 50%;
  width: max-content;
  max-width: calc(100vw - var(--safe-left) - var(--safe-right));
  padding: 7px 9px 5px;
  border-radius: 21px;
  transform: translateX(-50%);
}

.reaction-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.reaction-choice {
  position: relative;
  display: inline-flex;
}

.reaction-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 56px;
  min-height: 44px;
  padding: 3px 7px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.reaction-button:hover {
  background: rgb(255 255 255 / 8%);
}

.reaction-button[aria-pressed="true"] {
  border-color: rgb(255 255 255 / 32%);
  background: rgb(255 255 255 / 15%);
  transform: translateY(-2px);
}

.reaction-button.has-my-reaction:not([aria-pressed="true"]) {
  background: rgb(255 255 255 / 8%);
}

.reaction-delete {
  position: absolute;
  z-index: 2;
  top: -6px;
  right: -4px;
  display: grid;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 42%);
  border-radius: 50%;
  background: rgb(20 20 20 / 92%);
  box-shadow: 0 2px 6px rgb(0 0 0 / 55%);
  color: rgb(255 255 255 / 92%);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  place-items: center;
}

.reaction-delete:hover {
  background: rgb(120 30 40 / 95%);
  transform: scale(1.12);
}

.reaction-delete:disabled {
  cursor: wait;
  opacity: .55;
}

.reaction-button:disabled {
  cursor: wait;
  opacity: .58;
}

.reaction-button__emoji {
  font-size: 23px;
  line-height: 1;
}

.reaction-button__count {
  min-width: 1ch;
  color: rgb(255 255 255 / 78%);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.reaction-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.reaction-note {
  margin: 0 3px 2px;
  color: rgb(255 255 255 / 46%);
  font-size: 9px;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}

.privacy-panel {
  position: fixed;
  z-index: 60;
  top: calc(var(--safe-top) + 52px);
  left: var(--safe-left);
  width: min(370px, calc(100vw - var(--safe-left) - var(--safe-right)));
  max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 62px);
  overflow: auto;
  padding: 16px;
  border-radius: 18px;
  color: rgb(255 255 255 / 82%);
  font-size: 13px;
  line-height: 1.55;
}

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

.privacy-panel h1 {
  margin: 0;
  color: #fff;
  font-size: 15px;
}

.privacy-panel p {
  margin: 12px 0 0;
}

.privacy-panel a {
  color: inherit;
  text-underline-offset: 2px;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  font-size: 25px;
  place-items: center;
}

.privacy-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin-top: 10px;
  color: #fff;
  cursor: pointer;
}

.privacy-toggle input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: #fff;
}

.privacy-panel__fineprint {
  color: rgb(255 255 255 / 52%);
  font-size: 11px;
}

.toast {
  position: fixed;
  z-index: 80;
  top: var(--safe-top);
  left: 50%;
  max-width: calc(100vw - 32px);
  padding: 9px 13px;
  border-radius: 999px;
  font-size: 12px;
  text-align: center;
  transform: translateX(-50%);
}

.slide-progress {
  position: fixed;
  z-index: 90;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  overflow: hidden;
  background: rgb(255 255 255 / 9%);
  pointer-events: none;
}

.slide-progress__fill {
  display: block;
  width: 100%;
  height: 100%;
  background: rgb(255 255 255 / 78%);
  box-shadow: 0 0 8px rgb(255 255 255 / 52%);
  transform: scaleX(0);
  transform-origin: left center;
}

.slide-progress.is-running .slide-progress__fill {
  animation: slide-progress var(--slide-duration, 3000ms) linear forwards;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

@keyframes sticker-arrive {
  from {
    opacity: 0;
    scale: .72;
  }
  to {
    opacity: 1;
    scale: 1;
  }
}

@keyframes sticker-dismiss-heart {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  12% {
    transform: scale(1.9);
    filter: drop-shadow(0 0 18px rgb(255 48 105 / 100%));
  }
  23% {
    transform: scale(.72);
  }
  36% {
    transform: scale(2.55);
    filter: drop-shadow(0 0 32px rgb(255 48 105 / 100%));
  }
  49% {
    transform: scale(.62);
  }
  64% {
    opacity: 1;
    transform: translate(8px, -22px) scale(2.9) rotate(8deg);
    filter: drop-shadow(0 0 42px rgb(255 48 105 / 92%));
  }
  100% {
    opacity: 0;
    transform: translate(30px, -190px) scale(.08) rotate(28deg);
    filter: drop-shadow(0 0 48px rgb(255 48 105 / 0%));
  }
}

@keyframes sticker-dismiss-laugh {
  0% {
    opacity: 1;
    transform: rotate(0) scale(1);
  }
  11% {
    transform: translate(-18px, -7px) rotate(-34deg) scale(1.38);
  }
  22% {
    transform: translate(20px, -4px) rotate(34deg) scale(1.55);
  }
  33% {
    transform: translate(-22px, -13px) rotate(-42deg) scale(1.32);
  }
  45% {
    transform: translate(22px, -8px) rotate(42deg) scale(1.6);
    filter: drop-shadow(0 0 25px rgb(255 222 60 / 85%));
  }
  62% {
    opacity: 1;
    transform: translate(4px, -38px) rotate(540deg) scale(1.9);
  }
  100% {
    opacity: 0;
    transform: translate(45px, 170px) rotate(1080deg) scale(.08);
    filter: drop-shadow(0 0 30px rgb(255 222 60 / 0%));
  }
}

@keyframes sticker-dismiss-paw {
  0% {
    opacity: 1;
    transform: rotate(0) scale(1);
  }
  18% {
    transform: translate(27px, -42px) rotate(28deg) scale(1.35);
  }
  37% {
    transform: translate(59px, 12px) rotate(-24deg) scale(1.08);
    filter: drop-shadow(-25px -8px 5px rgb(255 255 255 / 55%));
  }
  56% {
    transform: translate(91px, -48px) rotate(24deg) scale(.86);
    filter: drop-shadow(-48px 8px 7px rgb(255 255 255 / 45%));
  }
  76% {
    opacity: 1;
    transform: translate(126px, 16px) rotate(-20deg) scale(.62);
    filter: drop-shadow(-70px -8px 8px rgb(255 255 255 / 30%));
  }
  100% {
    opacity: 0;
    transform: translate(175px, -62px) rotate(26deg) scale(.06);
    filter: drop-shadow(-95px 8px 10px rgb(255 255 255 / 0%));
  }
}

@keyframes sticker-dismiss-frog {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  16% {
    transform: translateY(15px) scaleX(1.65) scaleY(.42);
  }
  34% {
    opacity: 1;
    transform: translate(22px, -145px) scaleX(.68) scaleY(1.72) rotate(12deg);
    filter: drop-shadow(0 18px 12px rgb(69 255 107 / 80%));
  }
  53% {
    transform: translate(64px, -205px) scale(1.25) rotate(26deg);
    filter: drop-shadow(-10px 28px 16px rgb(69 255 107 / 62%));
  }
  76% {
    opacity: 1;
    transform: translate(105px, 18px) scaleX(1.65) scaleY(.38) rotate(38deg);
  }
  100% {
    opacity: 0;
    transform: translate(150px, -95px) scale(.08) rotate(75deg);
    filter: drop-shadow(0 0 28px rgb(69 255 107 / 0%));
  }
}

@keyframes slide-progress {
  from { transform: scaleX(var(--slide-start, 0)); }
  to { transform: scaleX(1); }
}

@media (max-width: 420px) {
  .reaction-controls {
    padding-inline: 5px;
  }

  .reaction-buttons {
    gap: 3px;
  }

  .reaction-button {
    min-width: 51px;
    min-height: 44px;
    padding-inline: 5px;
  }

  .reaction-delete {
    top: -7px;
    right: 0;
    width: 24px;
    height: 24px;
  }

  .reaction-button__emoji {
    font-size: 21px;
  }

  .reaction-note {
    font-size: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .slide {
    transition-duration: .01ms;
  }

  .reaction-sticker,
  .reaction-button,
  .reaction-tooltip {
    animation: none;
    transition: none;
  }

  .reaction-sticker.is-dismissing-heart {
    animation: sticker-dismiss-heart-reduced 680ms ease-out both;
  }

  .reaction-sticker.is-dismissing-laugh {
    animation: sticker-dismiss-laugh-reduced 740ms ease-out both;
  }

  .reaction-sticker.is-dismissing-paw {
    animation: sticker-dismiss-paw-reduced 780ms ease-out both;
  }

  .reaction-sticker.is-dismissing-frog {
    animation: sticker-dismiss-frog-reduced 760ms ease-out both;
  }
}

@keyframes sticker-dismiss-heart-reduced {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  38% {
    opacity: 1;
    transform: scale(2.15);
    filter: drop-shadow(0 0 22px rgb(255 48 105 / 95%));
  }
  100% {
    opacity: 0;
    transform: scale(.18);
    filter: drop-shadow(0 0 26px rgb(255 48 105 / 0%));
  }
}

@keyframes sticker-dismiss-laugh-reduced {
  0% {
    opacity: 1;
    transform: rotate(0);
  }
  28% {
    transform: translateX(-12px) rotate(-24deg) scale(1.35);
  }
  56% {
    opacity: 1;
    transform: translateX(12px) rotate(24deg) scale(1.45);
  }
  100% {
    opacity: 0;
    transform: translateY(12px) rotate(180deg) scale(.15);
  }
}

@keyframes sticker-dismiss-paw-reduced {
  0% {
    opacity: 1;
    transform: rotate(0);
  }
  34% {
    opacity: 1;
    transform: translate(15px, -13px) rotate(18deg) scale(1.2);
  }
  68% {
    opacity: 1;
    transform: translate(31px, 8px) rotate(-17deg) scale(.82);
  }
  100% {
    opacity: 0;
    transform: translate(48px, -16px) rotate(16deg) scale(.12);
  }
}

@keyframes sticker-dismiss-frog-reduced {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  24% {
    transform: translateY(8px) scaleX(1.5) scaleY(.55);
  }
  58% {
    opacity: 1;
    transform: translate(8px, -28px) scaleX(.72) scaleY(1.45) rotate(12deg);
  }
  100% {
    opacity: 0;
    transform: translate(18px, 7px) scaleX(1.35) scaleY(.25) rotate(20deg);
  }
}

@media (forced-colors: active) {
  .glass,
  .reaction-button[aria-pressed="true"],
  .reaction-tooltip {
    border: 1px solid CanvasText;
    background: Canvas;
    color: CanvasText;
  }
}
