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

body {
  margin: 0;
  padding: 0;
  height: 100vh;
  background: url('./images/paper.jpg') repeat;
  background-size: 500px;
  overflow-x: hidden;
}

#comic-background {
  position: relative;
  width: 100%;
  height: 100vh;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  background-image: url('images/paper.jpg');
  background-repeat: repeat;
  background-size: 500px;
  box-sizing: border-box;
  gap: 20px;
}

.panel-row {
  display: flex;
  width: 120%;
  margin-left: -10%;
  flex: 1;
  gap: 20px;
  padding: 0 20px;
  box-sizing: border-box;
  transition: flex 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.panel {
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  height: 100%;
  border: 2px solid #000;
  box-sizing: border-box;
  background-color: white;
  mix-blend-mode: multiply;
  transition: all 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Panel widths */
.panel.w-1-6 { width: 16.666%; }
.panel.w-1-5 { width: 20%; }
.panel.w-1-4 { width: 25%; }
.panel.w-1-3 { width: 33.333%; }
.panel.w-1-2 { width: 50%; }

/* Hand-drawn border effect */
.panel::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid #000;
  filter: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg"><filter id="filter"><feTurbulence type="fractalNoise" baseFrequency="0.04" numOctaves="5" seed="1" /><feDisplacementMap in="SourceGraphic" in2="noise" scale="2" /></filter></svg>#filter');
  pointer-events: none;
  z-index: 3;
  mix-blend-mode: normal;
  background: none;
}

/* Burst container */
.burst-container {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  z-index: 1;
}

/* Burst gradient */
.burst-gradient {
  position: absolute;
  inset: -20%;
  z-index: 1;
  opacity: 0.95;
  background-blend-mode: multiply;
  transition: all 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.burst-image {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
  opacity: 0.9;
  mix-blend-mode: multiply;
}

/* Halftone container */
.halftone-container {
  position: absolute;
  inset: -10%;
  width: 120%;
  height: 120%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  z-index: 1;
}

/* Halftone gradient */
.halftone-gradient {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0.9;
  background-blend-mode: multiply;
  transition: all 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.halftone-image {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: none;
  transform-origin: center;
  opacity: 0.7;
  will-change: transform;
  mix-blend-mode: multiply;
  transition: transform 1.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Burst colors */
.burst-image.burst-red {
  filter: invert(15%) sepia(95%) saturate(6932%) hue-rotate(358deg) brightness(200%) contrast(112%);
}

.burst-image.burst-yellow {
  filter: invert(83%) sepia(71%) saturate(473%) hue-rotate(359deg) brightness(200%) contrast(103%);
}

.burst-image.burst-orange {
  filter: invert(48%) sepia(75%) saturate(2476%) hue-rotate(346deg) brightness(200%) contrast(107%);
}

#refresh-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 10px 20px;
  font-size: 16px;
  background: #fff;
  border: 2px solid #000;
  cursor: pointer;
  z-index: 100;
}

#refresh-button:hover {
  background: #f0f0f0;
}

@keyframes burstPulse {
  0% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.1) rotate(5deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.refresh-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 12px 24px;
  background: #000;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-family: inherit;
  font-size: 16px;
  z-index: 1000;
  transition: transform 0.2s ease;
}

.refresh-button:hover {
  transform: scale(1.05);
}

/* Styles for injected content */
.injected-paragraph {
    margin-bottom: 1rem;
    line-height: 1.8rem;
}

.highlighter {
    position: relative;
    display: inline-block;
    font-weight: bold;
    font-style: italic;
    font-size: 1.6rem;
}

.highlighter::before {
    content: '';
    position: absolute;
    left: -5px;
    right: -5px;
    top: -2px;
    bottom: -2px;
    background-image: url('images/highlights/highlight1.png');
    background-size: 100% 100%;
    z-index: -1;
    transition: transform 0.3s ease;
}

.highlighter.highlight2::before {
    background-image: url('images/highlights/highlight2.png');
}

@media (max-width: 480px) {
    .highlighter {
        font-size: 1.4rem;
        padding: 0 3px;
    }
}
