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

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: #000;
  color: #fff;
  font-family: Phudu, Rubik, system-ui, sans-serif;
}

body {
  min-height: 100dvh;
}

.stage {
  position: relative;
  min-height: 100dvh;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
}

.photo {
  position: absolute;
  inset: 0;
  background-color: #111;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center 18%;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 0.55s ease, transform 1.2s ease;
  z-index: 0;
}

.photo.is-active {
  opacity: 1;
  transform: scale(1);
  z-index: 1;
}

.overlay {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100dvh;
  min-height: 100svh;
  padding: max(12px, env(safe-area-inset-top)) 20px max(16px, env(safe-area-inset-bottom));
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.12) 28%, rgba(0, 0, 0, 0.2) 52%, rgba(0, 0, 0, 0.88) 100%);
}

.brand {
  margin: 0;
  text-align: center;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-family: Rubik, system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.82);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8);
}

.quote-box {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: 8px 8px 8px;
  text-align: center;
}

blockquote {
  margin: 0 0 18px;
}

.quote {
  margin: 0;
  font-size: clamp(1.2rem, 4vw, 3.1rem);
  font-weight: 700;
  line-height: 1.18;
  overflow-wrap: anywhere;
  text-wrap: pretty;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.85);
}

.quote.is-lg {
  font-size: clamp(1.08rem, 3.4vw, 2.45rem);
}

.quote.is-xl {
  font-size: clamp(1rem, 3.1vw, 2.05rem);
}

.quote.is-leaving,
.reference.is-leaving {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.quote.is-entering,
.reference.is-entering {
  animation: rise-in 0.35s ease both;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.reference {
  display: block;
  margin-top: 12px;
  font-family: Rubik, system-ui, sans-serif;
  font-size: clamp(0.95rem, 2.4vw, 1.5rem);
  font-weight: 400;
  color: rgba(255, 255, 255, 0.88);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.8);
}

.reload {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 420px);
  margin: 0 auto;
  padding: 14px 22px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: #ff3d3d;
  color: #fff;
  cursor: pointer;
  font-family: Phudu, Rubik, sans-serif;
  font-size: clamp(1.05rem, 2.8vw, 1.7rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-decoration: none;
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.reload:hover,
.reload:focus-visible {
  border-color: #fff;
  outline: none;
  box-shadow: inset 0 0 18px rgba(255, 255, 255, 0.35), 0 0 18px rgba(255, 255, 255, 0.18);
}

.reload:active {
  transform: translateY(1px);
}

.hint {
  margin: 10px 0 0;
  font-family: Rubik, system-ui, sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.65);
}

.site-footer {
  margin: 10px 0 0;
  font-family: Rubik, system-ui, sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.45);
}

.site-footer a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: #ffb4b4;
  outline: none;
}

.ad {
  width: min(500px, 100%);
  min-height: 0;
  max-height: 110px;
  margin: 14px auto 0;
  overflow: hidden;
}

@media (max-width: 640px) {
  .overlay {
    padding-left: 12px;
    padding-right: 12px;
  }

  .brand {
    letter-spacing: 0.18em;
  }

  .quote-box {
    padding: 16px 14px 12px;
    background: rgba(0, 0, 0, 0.48);
    border-radius: 14px;
    backdrop-filter: blur(8px);
  }

  .quote {
    font-size: clamp(1.05rem, 5.2vw, 1.55rem);
  }

  .quote.is-lg {
    font-size: clamp(0.98rem, 4.6vw, 1.35rem);
  }

  .quote.is-xl {
    font-size: clamp(0.92rem, 4.2vw, 1.22rem);
  }

  .reload {
    width: 100%;
    padding: 16px 16px;
  }
}

@media (max-height: 700px) {
  .brand {
    font-size: 0.64rem;
  }

  .quote {
    font-size: clamp(1.15rem, 4vw, 2.2rem);
  }

  .ad {
    max-height: 90px;
    margin-top: 10px;
  }
}

@media (min-width: 900px) {
  .photo {
    background-position: center center;
  }

  .overlay {
    padding: 24px 40px 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .photo,
  .quote,
  .reference,
  .reload {
    transition: none;
    animation: none;
  }
}
