.essay-sheet-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 2rem;
  gap: 2rem;
  font-family: 'Times New Roman', serif;
}

/* MLA page base styling */

.essay-page {
  width: 816px;
  height: 1056px;
  background: white;
  border-radius: 12px;
  padding: 96px;
  box-sizing: border-box;
  color: #000;
  font-size: 16px;
  line-height: 2;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow-wrap: break-word;
  transition: margin-left 0.3s ease;
}

/* Left margin for desktop to avoid overlapping sidebar/chat */

@media (min-width: 821px) {
  .instructions {
    margin-right: 20px;
  }
}

.essay-header p {
  margin: 0;
  padding: 0;
}

.essay-header {
  margin-bottom: 2rem;
}

.essay-title, .mla-title {
  text-align: center;
  font-weight: bold;
  font-size: 20px;
  margin: 0 0 2rem 0;
}

.essay-body p, .essay-header p, .mla-title {
  padding: 4px;
  transition: background-color 0.2s ease;
}

.essay-body p {
  margin: 0 0 1rem 0;
  text-indent: 2em;
}

/* Clean focus styling */

*[contenteditable="true"]:focus {
  outline: none;
  border: none;
  border-radius: 12px;
  background-color: rgba(0, 86, 210, 0.06);
  box-shadow: inset 0 0 0 2px rgba(0, 86, 210, 0.5);
  transition: box-shadow 0.2s ease, background-color 0.2s ease;
  width: 100%;
}

.essay-page:focus-within {
  outline: none !important;
}

/* Footer */

.essay-footer {
  position: absolute;
  bottom: 1.5rem;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 14px;
  color: #444;
}

/* Mobile: maintain A4 aspect ratio, scale page to viewport width, fill more space, consistent look */

@media (max-width: 820px) {
  .essay-page {
    width: 100vw;
    aspect-ratio: 210 / 297;
    height: auto;
    max-height: none;
    padding: 8vw 6vw;
    font-size: 16px;
    line-height: 1.8;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin: 0 auto;
  }
}

.essay-page:first-of-type {
  padding-top: 60px;
}

.essay-header {
  margin-bottom: 1.5rem;
}

.essay-title, .mla-title {
  margin-bottom: 1.5rem;
}

.essay-page:first-of-type .essay-header, .essay-page:first-of-type .mla-title {
  margin-bottom: 1rem;
}

@media (max-width: 820px) {
  .essay-page {
    margin-left: -7% !important;
    margin-right: -7% !important;
  }
}

/* Text select */

@media (max-width: 820px) {
  .persistent-highlight {
    background-color: rgba(0, 123, 255, 0.4);
    border-radius: 2px;
  }
}

@media (min-width: 820px) {
  .persistent-highlight {
    background-color: rgba(55, 99, 244, 1);
    color: white;
    padding: 8px 0px;
    border-radius: 0px;
  }
}

