* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Martian Mono", ui-monospace, monospace;
  background: #0f0f12;
  color: #e8e6e3;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  text-align: center;
  padding: 20px 20px 24px;
  width: 100%;
  max-width: 100%;
  overflow: visible;
}

h1 {
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 2rem;
  flex-shrink: 0;
  user-select: none;
}

.phrase {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.25rem;
  width: 100%;
  min-width: 0;
  overflow: visible;
  cursor: default;
}


/* Font size is set by JS so each line fills the container width */
.phrase .word {
  font-size: 1rem; /* fallback until fitWordsToWidth runs */
  font-weight: 400;
  line-height: 1.2;
  overflow: visible;
}

.phrase .word-inner {
  display: inline-block;
  position: relative;
}

/* Box cursor: absolutely positioned so it doesn't shift the last line */
.phrase .cursor {
  position: absolute;
  left: 100%;
  bottom: 0;
  width: 0.4em;
  min-width: 8px;
  height: 1em;
  background: currentColor;
  visibility: hidden;
  border: none;
  border-radius: 0;
}
.phrase .cursor.cursor-visible {
  visibility: visible;
  animation: cursor-blink 0.9s step-end infinite;
}
@keyframes cursor-blink {
  50% {
    opacity: 0;
  }
}

/* Extra bottom padding on mobile so the button clears iOS Safari’s URL/tool bar */
@media (max-width: 767px) {
  main {
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px) + 60px);
  }
}

@media (min-width: 768px) {
  main {
    padding: 2rem;
  }
}

#generate {
  flex-shrink: 0;
  margin-top: auto;
  align-self: center;
  padding: 0.6rem 1.2rem;
  padding-bottom: calc(0.6rem + env(safe-area-inset-bottom, 0));
  font: inherit;
  font-size: 0.9rem;
  border: 1px solid #444;
  border-radius: 6px;
  background: transparent;
  color: #e8e6e3;
  cursor: pointer;
}

#generate:hover {
  background: #222;
  border-color: #666;
}

#generate:focus {
  outline: none;
  border-color: #888;
}

#generate:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
