html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    background-color: #000000;
    font-family: system-ui, -apple-system, sans-serif;
}

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

.game-scene {
    position: relative;
    width: 100vw;
    height: 100dvh;
    min-height: 100svh;
    overflow: hidden;
    container-type: size;
    isolation: isolate;
}

.slideshow-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #111;
}

.slide-image {
  position: absolute;
  inset: 0;

  display: block;
  width: 100%;
  height: 100%;

  object-fit: contain;
  object-position: center;

  opacity: 0;
  visibility: hidden;
  transition: opacity 650ms ease, visibility 650ms ease;
  will-change: opacity;
}

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



.story-controls {
    position: absolute;
    left: 50%;
    bottom: max(env(safe-area-inset-bottom), clamp(12px, 3.5cqh, 40px));
    width: min(92cqw, 900px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(10px, 2cqw, 30px);
    transform: translateX(-50%);
    z-index: 20;
}

.chapter-question {
  position: absolute;
  left: 50%;
  bottom: clamp(3cqh, 5cqh, 7cqh);
  transform: translateX(-50%);
  width: min(92%, 1100px);

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 2cqh, 24px);

  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  padding: 0;
  z-index: 20;
}

.chapter-question[hidden] {
    display: none;
}

.chapter-question__text {
  margin: 0;
  max-width: 85%;
  text-align: center;
  color: white;
  font-weight: 700;
  font-size: clamp(18px, 3cqw, 32px);
  text-shadow:
    0 2px 4px rgba(0, 0, 0, 0.85),
    0 0 10px rgba(0, 0, 0, 0.45);
}

.chapter-question__actions {
  width: 100%;
  min-width: 0;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 4cqw, 70px);

  overflow: visible;
}

.answer-button {
    line-height: 1.15;
    border: none;
    border-radius: 9999px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    user-select: none;
    transition: transform 300ms ease;
}

.answer-button:hover {
    transform: scale(1.05);
}

.story-button {
    background-color: rgba(255, 255, 255, 0.7);
    color: #333333;
    border: none;
    border-radius: 9999px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    user-select: none;
    min-width: auto;
    min-height: auto;
    padding: clamp(6px, 1cqh, 12px) clamp(12px, 1.5cqw, 20px);
    font-size: clamp(12px, 1cqw, 16px);
    line-height: 1.15;
    font-weight: 600;
    opacity: 0;
    transition: opacity 400ms ease, transform 150ms ease, background-color 150ms ease, color 150ms ease;
}

.story-button.is-visible {
    opacity: 1;
}

.story-button:hover,
.story-button:focus {
    background-color: rgba(255, 255, 255, 0.95);
    color: #111111;
}

.story-button[hidden] {
    display: none;
}

.answer-button--no {
  --no-scale: 1;

  width: clamp(230px, 30cqw, 560px);
  min-height: clamp(60px, 9cqh, 120px);
  padding: clamp(10px, 1.4cqh, 18px) clamp(18px, 2cqw, 34px);
  font-size: clamp(14px, 1.3cqw, 22px);
  background-color: #f87171;
  color: #ffffff;

  transform: scale(var(--no-scale));
  transform-origin: center;
  transition:
    transform 420ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 300ms ease;
}

.answer-button--yes {
  --yes-scale: 1;

  width: clamp(130px, 15cqw, 250px);
  min-height: clamp(44px, 6cqh, 72px);
  padding: clamp(16px, 2.4cqh, 24px) clamp(32px, 4cqw, 48px);
  font-size: clamp(18px, 2cqw, 28px);
  background-color: #4ade80;
  color: #111111;

  transform: scale(var(--yes-scale));
  transform-origin: center;
  transition:
    transform 420ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 300ms ease;
}

.answer-button--yes:hover {
  background-color: #ffffff;
  color: #111111;
}

.story-next-button {
  position: absolute;
  right: clamp(18px, 2.5cqw, 40px);
  bottom: clamp(18px, 2.8cqh, 38px);
  z-index: 30;

  display: grid;
  place-items: center;

  width: clamp(44px, 4.5cqw, 68px);
  height: clamp(44px, 4.5cqw, 68px);

  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 50%;

  color: white;
  background: rgba(20, 20, 20, 0.4);
  backdrop-filter: blur(5px);

  font-size: clamp(22px, 2.5cqw, 36px);
  line-height: 1;
  cursor: pointer;

  transition:
    transform 180ms ease,
    background-color 180ms ease,
    opacity 180ms ease;
}

.story-next-button:hover {
  transform: scale(1.08);
  background: rgba(20, 20, 20, 0.62);
}

.story-next-button:active {
  transform: scale(0.95);
}

.story-next-button:focus-visible {
  outline: 3px solid white;
  outline-offset: 4px;
}

.story-next-button[hidden] {
  display: none;
}




/* Front Page */
.front-page {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-right: 4vw;
    padding-top: 6vh;
    background-image: url('../assets/frontpage_bg.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: opacity 400ms ease, visibility 400ms ease;
}

.front-logo {
    width: clamp(300px, 50vw, 700px);
    height: auto;
    object-fit: contain;
}

.front-play-btn {
    background: transparent;
    border: none;
    padding: 0;
    margin-top: 40px;
    cursor: pointer;
    transition: transform 200ms ease;
    -webkit-tap-highlight-color: transparent;
}

.front-play-btn img {
    width: clamp(150px, 20vw, 300px);
    height: auto;
    object-fit: contain;
    display: block;
}

.front-play-btn:active {
    transform: scale(0.96);
}

/* Farewell Screen */
.farewell-screen {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-image: url('../assets/farewell_bg.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 600ms ease;
}

.farewell-screen.is-visible {
    opacity: 1;
}

.farewell-screen[hidden] {
    display: none;
}

.farewell-glass-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: clamp(300px, 62%, 900px);
    padding: 60px 70px;
    border-radius: 32px;
    background: rgba(25, 20, 18, 0.35);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 220, 170, 0.28);
    box-shadow: 0 20px 70px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.12);
    opacity: 0;
    transform: scale(0.96);
    transition: opacity 700ms ease-out, transform 700ms ease-out;
}

.farewell-glass-panel.is-visible {
    opacity: 1;
    transform: scale(1);
}

.farewell-line {
    font-family: 'Poppins', 'Nunito', 'Quicksand', system-ui, sans-serif;
    color: #ffffff;
    margin: 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
    line-height: 1.5;
    max-width: 70%;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 800ms ease, transform 800ms ease;
}

.farewell-line.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.farewell-heading {
    font-size: clamp(20px, 2.6vw, 32px);
    font-weight: 600;
}

.farewell-heading-last {
    margin-bottom: 2.5vh;
}

.farewell-middle {
    font-size: clamp(16px, 1.8vw, 24px);
    font-weight: 500;
}

.farewell-italic {
    font-size: clamp(16px, 1.8vw, 24px);
    font-weight: 500;
    font-style: italic;
    margin-top: 2.5vh;
}

.farewell-italic-last {
    margin-bottom: 2.5vh;
}

.farewell-wish {
    font-size: clamp(18px, 2.2vw, 28px);
    font-weight: 500;
}

@media (max-width: 768px) {
    .farewell-glass-panel {
        width: 88%;
        padding: 40px 30px;
    }
    .farewell-line {
        max-width: 90%;
    }
}
