:root {
    --primary-bg: #16151d;
    --secondary-bg: #212121;
    --accent-bg: #342d27;
    --primary-text: #ffffff;
    --accent-color: #ffa21b;
    --border-radius: 46px;
    --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

a {
    text-decoration: none; 
}

body {
    background-color: var(--primary-bg);
    color: var(--primary-text);
    font-family: var(--font-family);
    line-height: 1.5;
}

.header-grid-container {
    width: 100%;
    display: grid;
    align-items: center;
    justify-items: center;
}

.header.hidden {
    transform: translateY(-100%);
    transition: transform 0.3s ease-in-out;
}

.header {
    position: sticky;
    width: 100%;
    top: 0;
    z-index: 1000;
    transform: translateY(0);
    transition: transform 0.3s ease-in-out;
}

#current-chapter-name {
    color: #ffa21b
}

.tooltip-container{
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 25px;
    color: var(--accent-color);
}

.tooltip-arrow-up {
  width: 0; 
  height: 0; 
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 5px solid black;
}

.comment-tooltip{
    font-size: 50%;
}

@media (min-width: 320px) {
    .header {
        background-color: var(--secondary-bg);
        padding: 12px 70px;
        position: sticky;
        top: 0;
        z-index: 100;
        text-align: center;
        width: 100%;
        transition: transform 0.5s ease;
    }
    
    .reader-container {
        display: flex;
        min-height: 100vh;
        flex-direction: column;
    }
    
    .content-wrapper {
        display: flex;
        margin-bottom: -39px;
        align-items: center;
        gap: 40px 55px;
        justify-content: center;
        flex-direction: column;
        width: 100%;
        background-color: rgba(52, 45, 39, 1);
        padding: 20px;
        border-radius: 10px;
    }
}

@media (min-width: 768px){
    .header {
        background-color: var(--secondary-bg);
        padding: 12px 70px;
        position: absolute;
        top: 0;
        z-index: 100;
        text-align: center;
        width: 100%;
        transition: transform 0.5s ease;
    }
    
    .reader-container {
        display: flex;
        min-height: 100vh;
        flex-direction: column;
        padding-top: 120px;
        margin-top: 120px;
    }
}

.header.hidden {
    transform: translateY(-100%);
}

.header-content {
    max-width: 1154px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.chapter-navigation {
    display: flex;
    align-items: center;
    gap: 20px;
    width: 100%;
    justify-content: center;
}

.chapter-title {
    color: var(--primary-text);
    font-size: 24px;
    font-weight: 700;
}

.chapter-select {
    background-color: var(--accent-bg);
    border: none;
    border-radius: 8px;
    color: var(--primary-text);
    font-family: var(--font-family);
    font-weight: 700;
    padding: 12px 40px 12px 20px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 9L0 3h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    min-width: 200px;
}

.navigation-controls {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-button {
    background-color: var(--accent-bg);
    border: none;
    border-radius: var(--border-radius);
    padding: 12px 24px;
    color: var(--primary-text);
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.nav-button:hover,
.nav-button:focus {
    background-color: var(--accent-color);
}

.nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.keyboard-shortcuts {
    display: flex;
    align-items: center;
    gap: 5px;
    background-color: var(--accent-color);
}

.keyboard-shortcuts:hover,
.keyboard-shortcuts:focus {
    background-color: #e08600;
}

.reader-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.chapter-content {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
}

.chapter-image {
    width: 100%;
    height: auto;
}

.bottom-navigation {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 20px 0;
    margin: 20px 0;
    border-radius: 10px;
}

.comment-container {
    display: flex;
    margin-top: 8px;
    width: 100%;
    flex-direction: column;
    align-items: center;
    color: rgba(255, 255, 255, 1);
    white-space: nowrap;
    justify-content: center;
    padding: 100px 70px;
    font: 700 48px Plus Jakarta Sans, -apple-system, Roboto, Helvetica, sans-serif;
}

.icon-button {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.icon {
    aspect-ratio: 1;
    object-fit: contain;
    object-position: center;
    width: 48px;
    align-self: stretch;
    margin: auto 0;
}

.comment-options {
    background: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.tab-button {
    background: none;
    border: none;
    padding: 8px 16px;
    color: #342D27;
    font-size: 16px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.tab-button[aria-selected="true"] {
    background-color: #342D27;
    color: white;
}

.comment-panel {
    width: 100%;
    max-width: 800px;
    margin-top: 20px;
}

.footer-container {
    background-color: rgba(33, 33, 33, 1);
    display: flex;
    margin-top: 8px;
    width: 100%;
    flex-direction: column;
    align-items: start;
    padding: 24px 70px 0;
  }
  .footer-wrapper {
    width: 100%;
    max-width: 1010px;
  }
  .footer-content {
    gap: 20px;
    display: flex;
  }
  .left-column {
    display: flex;
    flex-direction: column;
    line-height: normal;
    width: 63%;
    margin-left: 0;
  }
  .mission-wrapper {
    display: flex;
    margin-top: 38px;
    width: 100%;
    flex-direction: column;
  }
  .mission-text {
    color: rgba(255, 255, 255, 1);
    align-self: start;
    font: 400 20px Plus Jakarta Sans, -apple-system, Roboto, Helvetica, sans-serif;
  }
  .action-buttons {
    display: flex;
    margin-top: 31px;
    align-items: center;
    gap: 8px;
    justify-content: start;
    flex-wrap: wrap;
  }
  .terms-button {
    border-radius: 20px;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    color: rgba(255, 255, 255, 1);
    width: 207px;
    margin: auto 0;
    font: 700 12px Plus Jakarta Sans, -apple-system, Roboto, Helvetica, sans-serif;
  }
  .terms-content {
    border-radius: 20px;
    background-color: rgba(52, 45, 39, 1);
    padding: 13px 21px;
    border: 1px solid rgba(0, 0, 0, 0.5);
  }
  .social-wrapper {
    border-radius: 0;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    width: 165px;
    margin: auto 0;
  }
  .social-container {
    border-radius: 20px;
    background-color: rgba(52, 45, 39, 1);
    display: flex;
    width: 100%;
    flex-direction: column;
    justify-content: center;
    padding: 11px 0;
    border: 1px solid rgba(0, 0, 0, 0.5);
  }
  .social-content {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 14px;
    justify-content: center;
  }
  .social-text {
    color: rgba(255, 255, 255, 1);
    align-self: stretch;
    margin: auto 0;
    font: 700 12px Plus Jakarta Sans, -apple-system, Roboto, Helvetica, sans-serif;
  }
  .social-icons {
    align-self: stretch;
    display: flex;
    align-items: center;
    gap: 9px;
    justify-content: center;
    margin: auto 0;
  }
  .social-icon {
    aspect-ratio: 1;
    object-fit: contain;
    object-position: center;
    width: 18px;
    align-self: stretch;
    margin: auto 0;
  }
  .server-wrapper {
    border-radius: 0;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    color: rgba(255, 255, 255, 1);
    width: 137px;
    margin: auto 0;
    font: 700 12px Plus Jakarta Sans, -apple-system, Roboto, Helvetica, sans-serif;
  }
  .server-container {
    border-radius: 20px;
    background-color: rgba(52, 45, 39, 1);
    display: flex;
    width: 100%;
    flex-direction: column;
    justify-content: center;
    padding: 11px 0;
    border: 1px solid rgba(0, 0, 0, 0.5);
  }
  .server-content {
    display: flex;
    align-items: center;
    gap: 11px;
    justify-content: center;
  }
  .server-text {
    align-self: stretch;
    margin: auto 0;
  }
  .right-column {
    display: flex;
    flex-direction: column;
    line-height: normal;
    width: 37%;
    margin-left: 20px;
  }
  .donation-wrapper {
    border-radius: 14px 14px 0 0;
    background-color: rgba(52, 45, 39, 1);
    display: flex;
    flex-grow: 1;
    flex-direction: column;
    color: rgba(255, 255, 255, 1);
    width: 100%;
    padding: 26px 0 0 26px;
    font: 700 24px Plus Jakarta Sans, -apple-system, Roboto, Helvetica, sans-serif;
    
    align-items: center;
    justify-content: center;
  }
  .donation-text {
    margin-right: 26px;
  }
  .donation-image {
    aspect-ratio: 1.27;
    object-fit: contain;
    object-position: center;
    width: 400px;
    align-self: end;
    z-index: 10;
    max-width: 100%;
    display: block;
    margin: 0 auto;
  }
  @media (max-width: 991px) {
    .footer-container {
      max-width: 100%;
      padding: 0 20px;
    }
    .footer-wrapper {
      max-width: 100%;
    }
    .footer-content {
      flex-direction: column;
      align-items: stretch;
      gap: 0;
    }
    .left-column {
      width: 100%;
    }
    .mission-wrapper {
      max-width: 100%;
      margin-top: 40px;
    }
    .mission-text {
      max-width: 100%;
    }
    .terms-content {
      padding: 0 20px;
    }
    .right-column {
      width: 100%;
    }
    .donation-wrapper {
      margin-top: 40px;
    }
    .donation-text {
      margin-right: 10px;
    }
  }
@media (max-width: 991px) {
    .header {
        padding: 12px 20px;
    }

    .chapter-navigation {
        flex-direction: column;
    }

    .chapter-select {
        width: 100%;
    }

    .navigation-controls {
        width: 100%;
        justify-content: center;
    }

    .comment-container {
        max-width: 100%;
        font-size: 40px;
        white-space: initial;
        padding: 100px 20px;
    }

    .content-wrapper {
        margin-bottom: 10px;
        font-size: 40px;
        white-space: initial;
    }

    .footer-container {
        padding: 24px 20px 0;
    }

    .footer-content {
        flex-direction: column;
    }

    .left-column,
    .right-column {
        flex: 0 0 100%;
    }
}

.ad-section {
    width: 100%;
    display: flex;
    justify-content: center;
}

.ad-div {
    width: 80%;
    max-width: 1200px;
    margin: var(--spacing-lg) auto;
    min-height: clamp(120px, 25vw, 300px);
    background-color: transparent;
    border: 2px dashed rgba(52, 45, 39, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.5;
    margin-bottom: 40px;
}

#backToTopBtn {
  position: fixed;
  bottom: 200px;
  right: 0;
  background-color: #ff9800;
  color: white;
  border-radius: 20px 0 0 20px;
  padding: 10px 15px;
  cursor: pointer;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  display: none;
}

#keyboard-shortcuts-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: var(--secondary-bg);
  padding: 20px;
  border-radius: 20px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
  z-index: 10000;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow: auto;
  color: var(--primary-text);
  border: 2px solid var(--accent-color);
}

#keyboard-shortcuts-modal h2 {
  color: var(--accent-color);
  margin-top: 0;
  margin-bottom: 15px;
  text-align: center;
}

#keyboard-shortcuts-modal table {
  width: 100%;
  border-collapse: collapse;
}

#keyboard-shortcuts-modal th,
#keyboard-shortcuts-modal td {
  text-align: left;
  padding: 8px;
  border-bottom: 1px solid #444;
}

#keyboard-shortcuts-modal th {
  color: var(--accent-color);
}

#keyboard-shortcuts-modal button {
  padding: 8px 16px;
  cursor: pointer;
  background-color: var(--accent-color);
  color: white;
  border: none;
  border-radius: 4px;
  margin-top: 15px;
}

#keyboard-shortcuts-modal button:hover {
  background-color: #e08600;
}

.arrow-up {
  font-size: 24px;
}

@media (max-width: 768px) {
  #backToTopBtn {
    bottom: 10px;
    padding: 8px 12px;
  }
  .arrow-up {
    font-size: 20px;
  }
}