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

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

#stage {
  position: fixed;
  inset: 0;
}

#stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

[hidden] {
  display: none !important;
}

.privacy-notice {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(0 0 0 / 82%);
  backdrop-filter: blur(8px);
}

.privacy-card {
  position: relative;
  width: min(645px, 100%);
  max-height: min(85vh, 780px);
  overflow: auto;
  padding: 48px 45px 36px;
  border: 1px solid rgb(255 255 255 / 25%);
  border-radius: 4px;
  background: #121212;
  box-shadow: 0 24px 80px rgb(0 0 0 / 65%);
  color: #e8e8e8;
  font: 15px/1.5 system-ui, sans-serif;
}

.privacy-card h1 {
  margin: 0 0 18px;
  font: 600 24px/1.2 Georgia, 'Times New Roman', serif;
}

.privacy-card p {
  margin: 0;
}

.privacy-card p + p {
  margin-top: 15px;
}

.privacy-close,
.close-button {
  position: absolute;
  top: 18px;
  right: 18px;
  display: grid;
  place-items: center;
  width: 45px;
  height: 45px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 30px;
  line-height: 1;
}

.privacy-close:hover {
  background: rgb(255 255 255 / 8%);
}

button {
  font: inherit;
}

.letter-page {
  position: fixed;
  z-index: 10;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(0 0 0 / 74%);
  backdrop-filter: blur(8px);
}

.letter-sheet {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 21px;
  width: min(840px, 100%);
  height: min(85vh, 930px);
  padding: 69px 51px 39px;
  border: 1px solid #c8b993;
  border-radius: 4px;
  background: #e8ddbd;
  box-shadow: 0 24px 80px rgb(0 0 0 / 50%);
  color: #29251d;
}

#letter-content {
  width: 100%;
  min-height: 0;
  padding: 0;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
  font: 24px/1.65 Georgia, 'Times New Roman', serif;
}

#letter-content::placeholder {
  color: #8e836b;
}

.letter-response {
  display: none;
  min-height: 0;
  place-items: center;
  overflow: auto;
  text-align: center;
  white-space: pre-wrap;
  font-family: Georgia, 'Times New Roman', serif;
}

.letter-actions {
  display: none;
  align-items: center;
  justify-content: center;
}

.close-button {
  top: 15px;
  right: 15px;
}

.close-button:hover {
  background: rgb(41 37 29 / 8%);
}

.download-button {
  display: inline-flex;
  padding: 12px 21px;
  border: 1px solid rgb(41 37 29 / 28%);
  border-radius: 999px;
  color: inherit;
  text-decoration: none;
  font-size: 18px;
  font-weight: 600;
}

.download-button:hover {
  background: rgb(41 37 29 / 8%);
}

.letter-page.is-reading #letter-content {
  display: none;
}

.letter-page.is-reading .letter-sheet {
  grid-template-rows: minmax(180px, auto) auto;
  width: min(540px, 100%);
  height: auto;
  max-height: min(78vh, 600px);
  padding: 57px 39px 30px;
}

.letter-page.is-reading .letter-response {
  display: grid;
  max-height: calc(78vh - 135px);
  padding: 12px;
  font-size: 20px;
  line-height: 1.5;
}

.letter-page.is-reading .letter-actions {
  display: flex;
}

@media (max-width: 600px) {
  .privacy-notice {
    padding: 12px;
  }

  .privacy-card {
    max-height: 90vh;
    padding: 48px 30px 33px;
  }

  .letter-page {
    padding: 12px;
  }

  .letter-sheet {
    height: min(88vh, 930px);
    padding: 63px 33px 33px;
  }
}
