/* Dialogue box, choice dialog and chapter two end screens. */
.dialogue {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  box-sizing: border-box;
  pointer-events: auto;
  touch-action: none;
}

.dialogue-box {
  position: relative;
  box-sizing: border-box;
  width: min(100%, 900px);
  min-height: 28vh;
  padding: 18px 64px 18px 24px;
  background: var(--panel);
  border: 2px solid var(--text);
  border-radius: 14px;
  color: var(--text);
}

.dialogue-speaker {
  margin-bottom: 6px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.75;
}

.dialogue-text {
  margin: 0;
  font-size: clamp(22px, 3.2vw, 30px);
  line-height: 1.4;
}

.dialogue-pending {
  visibility: hidden;
}

.dialogue-tap {
  position: absolute;
  right: 18px;
  bottom: 14px;
  width: 32px;
  height: 32px;
  fill: none;
  stroke: var(--text);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
}

.dialogue-complete .dialogue-tap {
  animation: dialogue-tap-pulse 1.2s ease-in-out infinite;
}

/* Paper note, same look as the lore note. */
.dialogue-note {
  align-self: center;
  width: min(90vw, 520px);
  min-height: 0;
  padding: 28px 28px 40px;
  background: #d9c79b;
  background-image: radial-gradient(ellipse at center, rgba(255, 245, 210, 0.35) 30%, rgba(120, 85, 40, 0.35) 100%);
  border: 0;
  border-radius: 3px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  transform: rotate(-1.5deg);
  color: #2e2112;
}

.dialogue-note .dialogue-text {
  font: italic 22px/1.45 "Segoe Print", "Bradley Hand", "Snell Roundhand", Georgia, "Times New Roman", serif;
}

.dialogue-note .dialogue-speaker {
  color: #2e2112;
}

.dialogue-note .dialogue-tap {
  right: 14px;
  bottom: 10px;
  stroke: #2e2112;
}

.dialogue-shout .dialogue-text {
  font-size: clamp(30px, 5vw, 48px);
  font-weight: 800;
  line-height: 1.2;
  animation: dialogue-shake 0.12s linear infinite;
}

.choice-dialog {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  pointer-events: auto;
}

.choice-row {
  display: flex;
  gap: 24px;
  margin-top: 20vh;
  width: min(100%, 760px);
}

.choice-button {
  flex: 1;
  min-height: 88px;
  padding: 16px 24px;
  border: 3px solid var(--text);
  border-radius: 18px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 32px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.choice-button:active {
  background: var(--text);
  color: var(--bg);
  transform: scale(0.96);
}

@media (max-width: 560px) {
  .choice-row {
    flex-direction: column;
  }
}

.screen-continued {
  background: #000;
  gap: 48px;
}

.continued-title {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(36px, 9vw, 96px);
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.1;
  opacity: 0;
  animation: continued-fade-in 2s ease-out forwards;
}

.continued-credits {
  opacity: 0;
  animation: continued-fade-in 2s ease-out 2s forwards;
}

.continued-credit {
  margin: 8px 0;
  font-size: clamp(18px, 3vw, 28px);
  letter-spacing: 0.06em;
}

@keyframes continued-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes dialogue-tap-pulse {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(4px); }
}

@keyframes dialogue-shake {
  0% { transform: translate(1px, 0); }
  25% { transform: translate(-1px, 1px); }
  50% { transform: translate(1px, -1px); }
  75% { transform: translate(-1px, 0); }
  100% { transform: translate(1px, 1px); }
}

@media (prefers-reduced-motion: reduce) {
  .dialogue-shout .dialogue-text,
  .dialogue-complete .dialogue-tap {
    animation: none;
  }

  .dialogue-complete .dialogue-tap {
    opacity: 1;
  }

  .continued-title,
  .continued-credits {
    animation: none;
    opacity: 1;
  }
}
