/* Reset and base layout */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: sans-serif;
  font-size: 12px; /* Default: landscape */
  line-height: 1.2;
  color: white;
}

/* Background image */
#background {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 100vw;
  height: 100vh;
  background: no-repeat center center;
  background-size: cover;
  transform: translate(-50%, -50%);
  z-index: -1;
  transition: transform 0.3s ease;
  backface-visibility: hidden;
  will-change: transform;
}

/* Rotate background slightly oversized on portrait to eliminate edge gap */
@media (orientation: portrait) {
  #background {
    transform: translate(-50%, -50%) rotate(90deg);
    width: 101vh;
    height: 101vw;
  }
}

/* Text block, top-left, tight spacing */
#text {
  position: fixed;
  top: 6px;
  left: 6px;
  z-index: 1;
  max-width: 100vw;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px; /* Match default */
  line-height: 1.2;
}

/* Portrait font size override */
@media (orientation: portrait) {
  #text {
    font-size: 13.5px;
  }
}

/* Pre element cleanup */
#text pre {
  margin: 0;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
  background: none;
  border: none;
}
