:root {
  --background: #ffffff;
  --foreground: #171717;
}

.error-message {
  color: #FF0000;
  font-weight: bold;
}

/* Chapter title styling */
.chapter-section {
  margin-top: 60px;
}

.text-container h3 {
  font-size: 1.4rem;
}

/* Continuation loading indicator */
.loading-indicator {
  display: inline-block;
  margin-left: 10px;
  font-style: italic;
}

/* Disable button styling */
.button-continuation:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Continuation prompt text and prompt status in button */

/* Button prompt styles */
.button-prompt-text {
  display: block;
  margin-bottom: 5px;
}

.button-status {
  display: block;
  font-size: 0.85rem;
  font-style: italic;
  opacity: 0.8;
  margin-top: 5px;
}

/* Highlight new continuation */
@keyframes highlightFade {
  0% { background-color: rgba(255, 255, 150, 0.3); }
  100% { background-color: transparent; }
}

.new-continuation {
  animation: highlightFade 3s ease-out;
}

/* Generating... animation and cancel button */
.loading-spinner-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 20px 0;
}

.loading-spinner {
  display: inline-block;
  width: 50px;
  height: 50px;
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top-color: #333;
  animation: spin 1s ease-in-out infinite;
  margin-bottom: 15px;
}

.cancel-button {
  background-color: #f3f3f3;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid #333;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  font-family: "Gowun Batang", serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: #333;
  cursor: pointer;
  transition: background-color 0.4s;
}

.cancel-button:hover {
  background-color: #e0e0e0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

a {
  color: inherit;
  text-decoration: underline;
}

.hidden {
 display: none;
}

html {
  scroll-behavior: auto; /* Override any smooth scrolling */
  max-width: 100vw;
  overflow-x: hidden;
}

body {
  max-width: 100vw;
  overflow-x: hidden;
  font-family: "Gowun Batang", serif;
  padding-top: 50px; /* Adjust depending on your toolbar height */
  margin: 0;
}

.button {
  margin: 5px auto;
  background-color: #f3f3f3;
  padding: 5px;
  border-radius: 8px;
  border-style: solid;
  border-width: 1px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  font-family: "Gowun Batang", serif;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.5;
  color: #333;
  border-color: #333;
  text-align: center;
}

.button {
  transition-duration: 0.4s;
}

.button-generate { /*Generate new story*/
  margin: 5px auto;
  background-color: #f3f3f3;
  padding: 15px;
  border-radius: 8px;
  border-style: solid;
  border-width: 1px;
  border-color: #333;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  font-family: "Gowun Batang", serif;
  font-weight: 700;
  font-size: 1.4rem;
  line-height: 1.5;
  color: #333;
  text-align: center;
  transition-duration: 0.4s;
}

.continuation-prompt-button-container {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start; /* This aligns items at the top */
  justify-content: center;
  padding: 10px 0;
}

.button-continuation {
  margin: 5px auto;
  width: 40%;
  background-color: #f3f3f3;
  padding: 15px;
  margin: 20px;
  border-radius: 8px;
  border-style: solid;
  border-width: 1px;
  border-color: #333;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  font-family: "Gowun Batang", serif;
  line-height: 1.5;
  color: #333;
  text-align: center;
  transition-duration: 0.4s;
  font-size: 1.25rem;
  align-self: flex-start;
}

/* Adjust button height to accommodate additional text */
.button-continuation {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 90px;
}

.button-generate-continuation {
  margin: 5px auto;
  width: 30%;
  background-color: #f3f3f3;
  padding: 15px;
  margin: 20px;
  border-radius: 8px;
  border-style: solid;
  border-width: 1px;
  border-color: #333;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  font-family: "Gowun Batang", serif;
  line-height: 1.5;
  color: #333;
  text-align: center;
  transition-duration: 0.4s;
  font-size: 1.25rem
}

.restart-button-container {
  margin: 20px 0;
  text-align: center;
}

.restart-button {
  background-color: #f3f3f3;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid #333;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  font-family: "Gowun Batang", serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: #333;
  cursor: pointer;
  transition: background-color 0.4s;
  text-decoration: none;
  display: inline-block;
}

.restart-button:hover {
  background-color: #333;
  color: #f3f3f3;
}

/* Write your own continuation prompt buttons */
.custom-prompt-button-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin: 15px 0;
}

#generate-custom-continuation-button {
  min-width: 250px;
  margin: 0 auto;
}

#generate-custom-continuation-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

#generate-custom-continuation-button:disabled:hover {
  background-color: #f3f3f3;
  color: #333; 
}

.generate-custom-continuation-button-active-text {
  font-size: 1.35rem;
  font-weight: 700;
}

/* Prevent hover styles on disable buttons */
.button:disabled:hover,
.button-generate:disabled:hover,
.button-generate-continuation:disabled:hover {
  background-color: #f3f3f3;  /* Keep the default background */
  color: #333;                /* Keep the default text color */
  cursor: not-allowed;        /* Show not-allowed cursor */
}

/* Button hover styling inside media query to exclude button tapping on mobile */
@media (hover: hover) {

  .button:hover  {
    background-color: #333;
    color: #f3f3f3;
    cursor:pointer;
  }

  .button-generate:hover  {
    background-color: #333;
    color: #f3f3f3;
    cursor:pointer;
  }

  .button-continuation:hover  {
    background-color: #333;
    color: #f3f3f3;
    cursor:pointer;
  }

  .button-generate-continuation:hover  {
    background-color: #333;
    color: #f3f3f3;
    cursor:pointer;
  }

  .cancel-button:hover  {
    background-color: #333;
    color: #f3f3f3;
    cursor:pointer;
  }

  .restart-button:hover {
    background-color: #333;
    color: #f3f3f3;
    cursor:pointer;
  }

}

/* Active (clicked/tapped) button styling */
.button:active {
  background-color: #333;
  color: #f3f3f3;
  cursor:pointer;
}

.button-generate:active {
  background-color: #333;
  color: #f3f3f3;
  cursor:pointer;
}

.gowun-batang-regular {
  font-family: "Gowun Batang", serif;
  font-weight: 400;
  font-style: normal;
}

#gradient-container {
  width: 100vw;
  min-height: 200vh; /* Ensures initial scrollability */
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 60px;
}

.input-text-field{
  width: 50%;
  padding: 5px 10px;
  margin: 8px;
  box-sizing: border-box;
  border-radius: 8px;
  border-style: solid;
  border-width: 1px;
  text-align: center;
  font-family: "Gowun Batang", serif;
  font-size: 1.25rem;
  line-height: 1.5;
  color: #333;
}

textarea {
  width: 80%;
  max-width: 90%;
  min-width: 80%;
  max-height: calc(1.25rem * 20 + 1.25rem); /* font-size * line-height + padding */
  min-height: calc(1.25rem * 5 + 1.25rem);
  padding: 10px;
  margin: 8px;
  box-sizing: border-box;
  border-radius: 8px;
  border-style: solid;
  border-width: 1px;
  text-align: left;
  font-family: "Gowun Batang", serif;
  font-size: 1.25rem;
  line-height: 1.5;
  color: #333;
}

#char-count {
  display: block;
  text-align: right;
  font-size: 0.8rem;
  width: 80%;
  margin: -5px auto 10px auto;
}

.limit-reached {
  color: #FF0000;
}

span.email b {
    display: none;
}

.title-container {
  width: 60%;
  font-size: 1.6rem; /* Section number font size */
  margin: 40px auto; /* Adds 40px spacing between containers */
  background-color: #f3f3f3;
  padding: 10px;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  font-size: 1.25rem;
  line-height: 1.5;
  color: #333;
  text-align: center;
}

.text-container {
  width: 60%;
  margin: 70px auto;
  background-color: #f3f3f3;
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  font-size: 1.25rem;
  line-height: 1.5;
  color: #333;
  text-align: center;
}

.continuation-title {
  padding: 10px 0;
}

.text-container h1 {
  font-size: 2rem; /* Section number font size */
}

.text-container h2 {
  font-size: 1.6rem; /* Section number font size */
}

.text-container h3 {
  font-size: 1.25rem; /* Section number font size */
}

.text-container p {
  font-size: 1.25rem; /* Paragraph font size */
  line-height: 1.5;
}


/* toolbar*/
.toolbar {
  position: fixed;
  top: 0;
  width: 100%;
  background-color: transparent;
  z-index: 1000;
  box-sizing: border-box;
  padding: 20px;
}

.header-nav-icon {
  max-height: 70px;
  width: auto;
  padding: 5px;
}

.header-nav-icon1 {
  max-height: 65px;
  width: auto;
  padding: 5px;
}

.header-nav-icon2 {
  max-height: 80px;
  width: auto;
  padding: 5px;
}

.header-nav-icon3 {
  max-height: 79px;
  width: auto;
  padding: 5px;
}


/* Special size for hamburger menu on mobile */
.hamburger-icon {
  height: 50px;
  width: auto;
  object-fit: contain;
  cursor: pointer;
  margin:20px;
}

.toolbar-options a {
  display: flex;
  align-items: center;
}

.toolbar-nav span, .toolbar-options span {
  cursor: pointer;
}

/* Mobile toolbar styles (below 1500px) */
.mobile-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.hamburger-menu {
  display: flex;
  align-items: center;
}

/* Mobile menu styles */
.mobile-menu {
  position: fixed;
  top: 0;
  right: 0;
  padding: 5px;
  margin: 20px 20px 0px 0px;
  background-color: #f3f3f3;
  color: #333;
  z-index: 2000;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  min-width: 200px; /* Ensure minimum width */
}

.menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(28, 28, 28, 0.4); /* #1C1C1C at 40% opacity */
  z-index: 1999; /* Just below the menu z-index of 2000 */
}

.mobile-menu-fullwidth {
  position: fixed;
  top: 0px;
  left: 0px;
  margin: 10px;
  background-color: #f3f3f3;
  color: #333;
  width: calc(100% - 20px);
  z-index: 2000;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.menu-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  padding: 25px 50px 40px 50px; /* 50px buffer on left and right of text */
  min-width: 200px; /* Ensure minimum width */
}

.menu-close-icon {
  position: absolute;
  top: 25px; 
  right: 25px; 
  cursor: pointer;
  height: 20px;
  width: 20px;
}

.menu-links {
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 25px;
  font-size: 1.25rem;
}

.menu-links a {
  text-decoration: none;
  color: #333;
  cursor: pointer;
}

.wrapper {
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-top: 20px;
}

/* Footer */

.footer {
  text-align: center;
  padding: 15 30 30 30px;
}

.footer-text {
  color:#FFFFFF;
  font-size: 1.25rem;
  line-height: 1.5;
  }

/* Canon page styling */
.canon-page .text-container {
  width: 70%;
}

.canon-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left !important;
  margin: 20px 0;
}

.canon-table th,
.canon-table td {
  padding: 12px 8px;
  text-align: left !important;
  vertical-align: top;

}

.canon-table th {
  cursor: pointer;
  position: relative;
  font-weight: bold;
  border-bottom: 2px solid #333;
}

.canon-table th .sort-icon {
  display: inline-block;
  margin-left: 5px;
  font-size: 0.8em;
}

.canon-table tbody tr {
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.canon-table tbody tr:nth-child(even) {
  background-color: rgba(0, 0, 0, 0.05);
}

.canon-table tbody tr:hover {
  background-color: rgba(0, 0, 0, 0.1);
}

.canon-table .title-column {
  width: 35%;
}

.canon-table .summary-column {
  width: 45%;
}

.canon-table .date-column {
  width: 20%;
}

.load-more-container {
  margin: 20px 0;
  text-align: center;
}

.load-more-button {
  background-color: #f3f3f3;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid #333;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  font-family: "Gowun Batang", serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: #333;
  cursor: pointer;
  transition: background-color 0.4s;
}

.load-more-button:hover {
  background-color: #333;
  color: #f3f3f3;
}

/* Recaptcha */
.grecaptcha-badge {
  visibility: hidden !important;
  /*display: none !important;*/
}

.recaptcha-notice {
  font-size: 1rem;
  margin: 10px 10px 50px 10px;
}

.recaptcha-notice a {
  text-decoration: underline;
}

/* Responsive adjustments */

@media (min-width: 1400px) {
  .canon-table .summary-column {
    width: 55%;
  }

  .canon-table .title-column {
    width: 25%;
  }

  .toolbar-nav {
    display: flex;
    justify-content: space-evenly; /* Changed from space-between to space-evenly */
    width: 100%;
    align-items: flex-start;
  }
  
  .nav-wrapper {
    display: flex;
    justify-content: center;
  }
  
  .logo-mobile {
    cursor: pointer;
    display: flex;
  }

  .text-container {
    margin-top: 100px;
  }

  .continuation-title {
    padding: 20px 0;
  }

  .desktop-toolbar {
    display: flex;
    width: 100%;
    box-sizing: border-box;
    justify-content: space-between;
    align-items: flex-start; /* Top-align everything */
  }
  
  .toolbar-nav {
    display: flex;
    justify-content: space-between; /* Distribute items evenly */
    flex: 1; /* Take up all remaining space */
    align-items: flex-start; /* Top-align all nav items */
    padding: 10px; /* Padding for the nav */
  }
}

@media (max-width: 1800px) {
  .canon-page .text-container {
    width: 80%;
  }
}

@media (max-width: 1100px) {
  .text-container {
    width: 75%;
  }
}

@media (max-width: 1100px) {
  .button-continuation {
    width: 80%;
  }
}

@media (max-width: 768px) {
  .canon-table .summary-column {
    width: 40%;
  }
}

@media (max-width: 700px) {
  .canon-table .summary-column {
    width: 40%;
  }

}

@media (max-width: 600px) {
  .canon-table .title-column,
  .canon-table .date-column {
    width: 30%;
  }
  
  .canon-table .summary-column {
    width: 40%;
  }

  .button-continuation {
    font-size: 1.1rem;
    width: 75%;
  }
}

/* Media query for screens 500px or narrower */
@media (max-width: 500px) {

  .input-text-field{
    width: 100%;
    font-size: 1rem;
  }

  .menu-links {
    font-size: 1.1rem;
  }

  .text-container {
    padding: 15px 30px 30px 30px;
    margin-top: 60px;
  }

  .story-page {
    padding-top: 20px;
  }

  .text-container h1 {
    font-size: 1.5rem;
  }

  .text-container h2, .title-container h2 {
    font-size: 1.3rem; 
  }

  .text-container h3 {
    font-size: 1.1rem; 
  }

  .text-container p {
    font-size: 1.1rem; 
  }

  .button-status {
    font-size: 0.75rem;
  }

  .button-generate-continuation {
    width: 75%;
  }

  textarea {
    width: 95%;
    max-width: 100%;
    font-size: 1.1rem;
    max-height: calc(1.1rem * 30 + 1.1rem); /* font-size * line-height + padding */
    min-height: calc(1.1rem * 10 + 1.1rem);
  }

  .footer-text {
    font-size: 1.1rem;
  }

  .hamburger-icon {
    margin-right: 0px;
  }

  .canon-table th,
  .canon-table td {
    padding: 8px 4px;
    font-size: 1.1rem;
  }

}

@media (max-width: 400px) {
  .canon-table th,
  .canon-table td {
    padding: 8px 4px;
    font-size: 1rem;
  }
}

/* dark mode */
@media (prefers-color-scheme: dark) {

  :root {
    --background: #0a0a0a;
    --foreground: #ededed;
  }

  .title-container {
    background-color: #333;
    color: #f3f3f3;
  }
  
  .text-container {
    background-color: #333;
    color: #f3f3f3;
  }

  .mobile-menu,
  .mobile-menu-fullwidth {
    background-color: #333;
    color: #f3f3f3;
  }

  .menu-links a {
    color: #f3f3f3;
  }

  @keyframes highlightFade {
    0% { background-color: rgba(100, 100, 0, 0.3); }
    100% { background-color: transparent; }
  }

  .button:disabled:hover,
  .button-generate:disabled:hover,
  .button-generate-continuation:disabled:hover {
    background-color: #333;   /* Keep the dark mode background */
    color: #f3f3f3;           /* Keep the dark mode text color */
  }

  .loading-spinner {
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #f3f3f3;
  }
  
  .cancel-button {
    background-color: #333;
    color: #f3f3f3;
  }
  
  .cancel-button:hover {
    background-color: #444;
  }
}
