:root {
  color-scheme: light dark;
  --text-color: #333;
  --bg-color: #f9f9f9;
  --border-color: #ccc;
  --timestamp-color: #666;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --button-text: #fff;
  --button-bg: rgba(211, 211, 211, 0.5);
  --button-hover-bg: #333333;
  --link-color: #000000;
  --link-hover-color: #0052a3;
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

body {
  font-family: var(--font-family);
}

@media (prefers-color-scheme: dark) {
  :root {
    --text-color: #e0e0e0;
    --bg-color: #1a1a1a;
    --border-color: #404040;
    --timestamp-color: #999;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --button-bg: #404040;
    --button-hover-bg: #505050;
    --link-color: #ffffff;
    --link-hover-color: #99ccff;
  }

  @media (prefers-color-scheme: dark) {
    .comment-title {
      color: #ffffff !important;
    }
  }

  body {
    background-color: #181818;
    color: var(--text-color);
  }

  input,
  textarea {
    background-color: #1a1a1a;
    color: var(--text-color);
    border-color: var(--border-color);
  }
}

.comment-item {
  position: relative;
  margin: 0 auto;
  max-width: 1080px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 15px;
  margin-bottom: 15px;
  background-color: var(--bg-color);
  box-shadow: 0 4px 10px var(--shadow-color);
  color: var(--text-color);
  word-break: break-all;
  transition:
    border-color 0.3s ease,
    background-color 0.3s ease,
    box-shadow 0.3s ease;
}

.comment-item:hover {
  border-color: var(--link-color);
  box-shadow: 0 6px 15px var(--shadow-color);
}

body .comment-title {
  font-weight: bold;
  margin-bottom: 10px;
  color: var(--link-color);
  text-decoration: none;
  display: block;
  transition: color 0.3s;
}

body .comment-title:hover {
  color: var(--link-hover-color);
  padding-bottom: 2px;
}

.comment-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 10px 0;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.comment-content {
  word-break: break-all;
  margin-bottom: 10px;
  color: var(--text-color);
  text-decoration: none;
}

.comment-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #666;
  margin-top: 5px;
}

.user-link {
  color: var(--timestamp-color);
  font-weight: bold;
  text-decoration: none;
}

.user-link:hover {
  text-decoration: underline;
}

.comment-timestamp {
  position: absolute;
  bottom: 10px;
  right: 15px;
  font-size: 12px;
  color: var(--timestamp-color);
  white-space: nowrap;
}

.write-post,
.back-link {
  position: fixed;
  top: 10px;
  right: 10px;
  border: 0;
  border-radius: 20px;
  width: 120px;
  height: 40px;
  font-size: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 10px var(--shadow-color);
  z-index: 1000;
  background-color: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

#pagination {
  position: fixed;
  left: 0;
  right: 0;
  margin-left: auto;
  margin-right: auto;
  width: fit-content;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 0;
  border-radius: 20px;
  bottom: 10px;
  padding: 10px 10px;
  gap: 5px;
  z-index: 1000;
  box-shadow: 0 4px 10px var(--shadow-color);
  background-color: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.prev-page-btn,
.next-page-btn {
  height: 80%;
  padding-top: 10%;
  padding: 0.7em;
  color: var(--button-text);
  background-color: var(--button-bg);
  border: none;
  border-radius: 10px;
  font-size: 1em;
  transition: all 0.3s ease;
  text-align: center;
}

.prev-page-btn:hover,
.next-page-btn:hover,
.write-post:hover,
.push-btn:hover,
.back-link:hover {
  background-color: var(--button-bg);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px var(--shadow-color);
}

.prev-page-btn:active,
.next-page-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.prev-page-btn.disabled,
.next-page-btn.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background-color: rgba(0, 0, 0, 0.1);
}

.push {
  margin: 0 auto;
  max-width: 1080px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.push-btn {
  background-color: var(--button-bg);
  color: var(--button-text);
  border: 0;
  border-radius: 20px;
  width: 120px;
  height: 50px;
  font-size: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 10px var(--shadow-color);
}

#name {
  height: 2rem;
}


form {
  max-width: 80%;
  margin: auto;
  padding: 1em;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background-color: var(--bg-color);
}

.container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 2rem 0;
}

div+div {
  margin-top: 1em;
}

label {
  display: block;
  margin-bottom: .5em;
  color: var(--text-color);
}

input {
  /*input: not(.CodeMirror-input),
  textarea: not(.CodeMirror-textarea): not(#comment) {
  width: 100%;
  padding: 0.5em;
  border: 1px solid var(--border-color);
  border-radius: 0.3em;
  background-color: var(--bg-color);
  color: var(--text-color);
  box-sizing: border-box;
}*/

  width: 100%;
  padding: 0.5em;
  border: 1px solid var(--border-color);
  border-radius: 0.3em;
  background-color: var(--bg-color);
  color: var(--text-color);
  box-sizing: border-box;
}

.error-message {
  color: red;
  margin-bottom: 10px;
  padding: 10px;
  border-radius: 5px;
  background-color: #ffe6e6;
}

a {
  color: var(--link-color);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 250px;
  height: 100vh;
  background-color: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(4px);
  color: var(--text-color);
  box-shadow: 2px 0 10px var(--shadow-color);
  transform: translateX(-100%);
  transition: transform 0.5s ease-in-out;
  z-index: 1000;
  padding: 0;
  margin: 0;
  box-shadow: 0 4px 10px var(--shadow-color);
}

.sidebar.open {
  transform: translateX(0);
}

.menu-item {
  display: block;
  padding: 1em;
  color: var(--text-color);
  text-decoration: none;
  transition: background-color 1s ease;
}

.menu-item:hover {
  background-color: var(--button-bg);
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.1);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
  z-index: 999;
}

.overlay.active {
  opacity: 1;
  visibility: visible;
}

@media (max-width: 768px) {
  .comment-item {
    border-radius: 15px;
    padding: 12px;
  }


  form {
    max-width: 95%;
    padding: 0.8em;
  }
}

@media (max-width: 480px) {
  .comment-item {
    border-radius: 10px;
    padding: 10px;
  }

  form {
    max-width: 100%;
    padding: 0.5em;
  }
}