*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  padding-bottom: env(safe-area-inset-bottom, 0);
  text-align: center;
  background-color: #333;
  -webkit-text-size-adjust: 100%;
}
header {
  background-color: hsl(212, 92%, 33%);
  color: white;
  padding: 10px 0;
}
header h1 {
  font-size: clamp(1.25rem, 4vw, 2rem);
  margin: 0.25em 0;
}
.marque-container {
  background: #f4f4f4;
  padding: 10px;
}
.marque {
  font-size: 14px;
  color: #333;
}
#editor {
  margin: 20px auto;
  width: min(92%, 900px);
  height: clamp(200px, 40vh, 300px);
  background-color: hsl(0, 0%, 98%);
  color: #000;
  border: 1px solid #272727;
  box-shadow: -4px -4px 5px rgba(18, 18, 18, 0.1),
    4px 4px 5px rgba(18, 18, 18, 0.1);
  border-radius: 5px;
}

.ql-toolbar {
  background-color: #444444 !important;
  color: white !important;
  border: 1px solid #555555 !important;
}

.ql-toolbar button {
  color: white !important;
}

.ql-picker-label {
  color: white !important;
}

.ql-stroke {
  stroke: white !important;
}

.button-container {
  display: flex;
  justify-content: center;
  flex-wrap: wrap; /* Allow buttons to wrap on smaller screens */
  gap: 10px; /* Add spacing between buttons */
  margin: 10px 0;
}

.dismiss-btn {
  position: absolute;
  top: 5px;
  right: 10px;
  background-color: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  min-height: 44px;
  min-width: 44px;
}
.dismiss-btn--bubble {
  color: white;
}

button {
  align-items: center;
  background-color: #fff;
  border-radius: 12px;
  box-shadow: transparent 0 0 0 3px, rgba(18, 18, 18, 0.1) 0 6px 20px;
  box-sizing: border-box;
  color: #121212;
  cursor: pointer;
  display: inline-flex;
  flex: 1 1 auto;
  font-family: Inter, sans-serif;
  font-size: clamp(0.9rem, 2.5vw, 1.2rem);
  font-weight: 700;
  justify-content: center;
  line-height: 1;
  margin: 5px;
  outline: none;
  padding: 0.75rem 1rem;
  min-height: 44px;
  text-align: center;
  text-decoration: none;
  transition: box-shadow 0.2s, -webkit-box-shadow 0.2s;
  white-space: nowrap;
  border: 0;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
button:hover {
  box-shadow: #121212 0 0 0 3px, transparent 0 0 0 0;
}
#formattedContent {
  margin-top: 20px;
  background-color: #555555;
  padding: 10px clamp(8px, 3vw, 20px);
  max-width: 100%;
  overflow-x: hidden;
}

.load-error {
  color: #ffb4a2;
  padding: 1rem;
}

.title-meta {
  color: white;
  margin: 0;
  font-size: clamp(0.65rem, 2vw, 0.85rem);
}
.title-meta--left {
  float: left;
}
.title-meta--right {
  float: right;
}
.snippet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 8px 0 12px;
}

/* Progress bar for loading */
.progress-bar {
  width: 100%;
  height: 10px;
  background-color: #444;
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}
.progress-bar::after {
  content: "";
  position: absolute;
  width: 50%;
  height: 100%;
  background-color: #ff6347;
  animation: loading 1.5s infinite ease-in-out;
}
@keyframes loading {
  0% { left: -50%; }
  50% { left: 100%; }
  100% { left: -50%; }
}

.income-content {
  text-align: start;
}
.outer-snippet {
  margin: 0.5em 0;
  border-radius: 5px;
  color: #ccc;
  font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace;
  font-size: 1em;
  text-align: left;
  word-spacing: normal;
  word-break: normal;
  word-wrap: normal;
  line-height: 1.5;
  tab-size: 4;
  box-shadow: 5px 5px 10px #00000070;
}
.title-bar {
  position: relative;
  width: 100%;
  min-height: 30px;
  background: #282a31;
  border-radius: 5px 5px 0px 0px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 5px;
  padding: 6px 10px 6px 15px;
  flex-wrap: wrap;
  overflow: hidden;
}
.dot {
  width: 12px;
  height: 12px;
  border-radius: 20px;
}
.red-dot {
  background-color: rgb(240, 101, 8);
}
.green-dot {
  background-color: rgb(62, 240, 8);
}
.blue-dot {
  background-color: rgb(8, 128, 240);
}
.inner-snippet {
  background: #1e1e1e !important;
  color: #ccc;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1em;
  padding-top: 0.5em;
  font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace;
  font-size: clamp(0.8rem, 2.5vw, 1em);
  text-align: left;
  white-space: pre-wrap;
  word-break: break-word;
  word-spacing: normal;
  word-break: normal;
  word-wrap: normal;
  line-height: 1.5;
  tab-size: 4;
  border-radius: 0px 0px 5px 5px;
}
.inner-snippet::-webkit-scrollbar {
  width: 5px;
  height: 8px;
  background-color: #2c2c2c;
}
.inner-snippet::-webkit-scrollbar-thumb {
  background: #7e7d7d;
  border-radius: 5px;
}
.inner-snippet p {
  margin-top: 2px;
  margin-bottom: 2px;
}
.delete {
  padding: 12px 16px;
  background-color: #d51a1a;
  color: white;
  box-shadow: 5px 5px 10px #00000031;
  flex: 1 1 120px;
  max-width: 200px;
}
.copy {
  padding: 12px 16px;
  background-color: #2579da;
  color: white;
  box-shadow: 5px 5px 10px #00000031;
  flex: 1 1 120px;
  max-width: 200px;
}

#unique-visitors {
  font-size: clamp(0.85rem, 2.5vw, 1rem);
  padding: 0 12px;
}

@media screen and (max-width: 768px) {
  .button-container {
    padding: 0 12px;
  }
  .button-container button {
    flex: 1 1 calc(50% - 10px);
    min-width: 140px;
  }
  #themeButton {
    flex: 1 1 100%;
  }
  .title-meta--left,
  .title-meta--right {
    float: none;
    width: 100%;
    text-align: left;
  }
  #ad-bubble {
    bottom: calc(12px + env(safe-area-inset-bottom, 0));
    right: 12px;
    width: 72px;
    height: 72px;
    font-size: 12px;
  }
}

@media screen and (max-width: 480px) {
  #editor {
    width: 96%;
    margin: 12px auto;
  }
  .delete,
  .copy {
    flex: 1 1 100%;
    max-width: none;
  }
}

/* Light mode styles */
body.light-mode {
  background-color: rgb(101, 40, 247);
  color: #333;
}
body.light-mode #formattedContent {
  background-color: #e0e0e0;
}
body.light-mode .outer-snippet {
  color: #333;
}
body.light-mode .inner-snippet {
  background: #fff !important;
  color: #333;
}
body.light-mode .title-bar {
  background: #d3d3d3;
}

/* Ensure Unique Visitors text is visible in both modes */
#unique-visitors {
  color: red; /* Default for dark mode */
}
body.light-mode #unique-visitors {
  color: #333; /* Black in light mode */
}

/* Advertisement bubble styles */
#ad-bubble {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 80px;
  height: 80px;
  background-color: #cf1ee6;
  color: white;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  font-size: 14px;
  font-weight: bold;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  text-decoration: none;
  transition: transform 0.2s;
  animation: float 3s ease-in-out infinite;
}
#ad-bubble:hover {
  transform: scale(1.1);
}
#ad-bubble a {
  color: white;
  text-decoration: none;
}
@keyframes float {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
  100% {
    transform: translateY(0);
  }
}

.search-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(92%, 560px);
  margin: 20px auto 0;
  padding: 0 12px;
}

#searchBar {
  width: 100%;
  padding: 12px;
  margin: 0;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 16px;
  min-height: 44px;
}

@media (prefers-reduced-motion: reduce) {
  .progress-bar::after,
  #ad-bubble {
    animation: none;
  }
}