body{
  /* tiled background using tile1.png */
  background-image: url('graphics/ripdeath/tile3.png');
  /* make the tile smaller so it repeats more frequently */
  background-size: 100px 100px;
  background-repeat: repeat;
  background-position: top left;
  background-attachment: fixed; /* keep tiles fixed while scrolling */
  background-color: black; /* fallback if image missing */
  color: white;
}

/* Subtle page overlay to darken background so the center box and text stand out.
   This sits above the background but below the header/center-box (they have high z-index).
   pointer-events: none ensures it doesn't block input. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  pointer-events: none;
  z-index: 50;
}

header {
  /* keep the logo centered and positioned above other content */
  text-align: center;
  position: relative;
  z-index: 1000; /* keep logo above the center box */
}

/* Decorative candles positioned absolutely so they don't affect layout flow */
.header-candle {
  width: 36px; /* smaller candle width */
  height: auto;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none; /* purely decorative */
}

/* Symmetric offsets from the center. Adjust the 160px value to move candles closer/further. */
.header-candle.left { left: calc(50% - 265px); }
.header-candle.right { left: calc(50% + 230px); }

.header-img {
  max-width: 30%;
  height: auto;
  display: block;
  margin: 1rem auto;
  position: relative;
  z-index: 2;
}
/* Main content box and container */
.center-box {
  --box-size: 60vmin;
  position: fixed;
  top: 54%; /* moved up to sit closer under smaller logo */
  left: 50%;
  /* make the center box square using a CSS variable so we can adjust it with UI */
  width: var(--box-size);
  height: var(--box-size);
  transform: translate(-50%, -50%);
  border: 60px solid transparent;
  border-image: url('graphics/ripdeath/cool-border.png') 63;
  border-image-slice: 20% round; /* figure out what this is and adjust */
  border-image-repeat: round;
  padding: 0;
  color: white;
  /* background: rgba(0,0,0,0.85); */
  z-index: 900; /* keep under corners but above most content */
  /* inner pages handle scrolling so the center box shows a scrollbar on the right */
  overflow: hidden;
}

.content-container {
  width: 100%;
  height: 100%;
  position: relative;
}

/* Individual content pages */

.content-page {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.3s ease;
  display: none;
}

.content-page.active {
  opacity: 1;
  display: block;
}

/* Scroll area inside each page: image fills the viewport area first, lyrics follow */
.page-scroll {
  height: 100%;
  width: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
}

.image-full {
  width: 100%;
  /* Make the image a non-shrinking flex item that takes the full center-box height.
     This prevents the image from being reduced when the lyrics grow longer. */
  flex: 0 0 100%;
  height: auto; /* allow object-fit to cover the allocated area */
  object-fit: cover;
  display: block;
}

/* Image container and sizing */

/* Lyrics section sits below the full-height image; visible when the user scrolls down */
.lyrics-container {
  padding: 1rem;
  background: rgba(0,0,0,0.85);
  color: #fff;
}

.lyrics-container p {
  margin: 0 0 1rem 0;
  line-height: 1.6;
}

/* stanza blocks inside lyrics - add spacing between stanzas and preserve line breaks */
.lyrics-container .stanza {
  margin: 0 0 1rem 0;
  white-space: pre-wrap; /* keep line breaks inside a stanza */
}

/* Navigation arrows */
.nav-arrows {
  position: fixed;
  /* top will be set by JS so nav sits below the center-box (not overlapping) */
  left: 50%;
  transform: translateX(-50%);
  z-index: 801;
  display: flex;
  gap: 3rem;
  align-items: center;
}

.nav-arrow {
  background: rgba(255,0,0,0.3);
  border: 2px solid red;
  color: white;
  padding: 0.5rem 1rem;
  font-size: 1.25rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.nav-arrow:hover {
  background: rgba(255,0,0,0.5);
}

/* Corner decorations for the center box */
.corner-decoration {
  position: fixed; /* fixed so they can overlap header and stay in place while page resizes */
  width: 360px; /* larger decorative corners */
  height: auto;
  z-index: 1200; /* above header (1000) and center box (900) */
  pointer-events: none;
  display: block;
  opacity: 1;
}

.corner-decoration.top-left {
  /* initial fallback — JS will reposition to match the center-box bounds */
  top: 0;
  left: 0;
}

.corner-decoration.bottom-right {
  /* initial fallback — JS will reposition to match the center-box bounds */
  top: 0;
  left: 0;
  transform: rotate(180deg);
}

/* Controls panel for interactive positioning */
.corner-controls {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 14px;
  z-index: 2000;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 8px 10px;
  color: #fff;
  font-size: 13px;
  display: flex;
  gap: 12px;
  align-items: center;
  border-radius: 6px;
}
.corner-controls label { font-size: 12px; opacity: 0.9; }
.corner-controls input[type=range] { width: 120px; }
.corner-controls .group { display:flex; flex-direction:column; align-items:flex-start; gap:4px; }

/* extra controls buttons */
.corner-controls button {
  background: rgba(255,255,255,0.06);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.08);
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
}
.corner-controls button:hover { background: rgba(255,255,255,0.1); }

/* CSS export modal */
#cssExportModal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.6);
  z-index: 3000;
}
#cssExportModal .card {
  background: #0b0b0b;
  color: #fff;
  padding: 14px;
  width: 80%;
  max-width: 900px;
  border-radius: 8px;
  box-shadow: 0 6px 30px rgba(0,0,0,0.7);
}
#cssExportModal pre {
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 60vh;
  overflow: auto;
  background: rgba(0,0,0,0.3);
  padding: 10px;
  border-radius: 6px;
}
#cssExportModal .actions { display:flex; gap:8px; justify-content:flex-end; margin-top:8px; }

/* small floating button to toggle controls if they were hidden */
.toggle-controls-btn {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 4000;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.06);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.12);
  cursor: pointer;
}
.toggle-controls-btn:hover { background: rgba(255,255,255,0.12); }

/* Final hard-coded positions (pasted from user) */
/* Paste into ripdeath.css to hard-code final positions */
.center-box { --box-size: 45vmin; }
.corner-decoration.top-left { position: fixed; left: 574px; top: 174px; width: 271px; }
.corner-decoration.bottom-right { position: fixed; left: 690px; top: 369px; width: 271px; transform: rotate(180deg); }

/* External scrollbar (track + thumb) placed to the right of the center box.
   The user can replace styles or use their own graphics for track/thumb. */
.external-scrollbar {
  position: fixed;
  width: 20px;
  background: transparent; /* keep track transparent by default */
  border-radius: 8px;
  z-index: 802;
  /* visual hit area so it's easy to click/drag */
}

.external-scrollbar .thumb {
  position: absolute;
  left: 2px;
  right: 2px;
  height: 40px; /* will be resized by JS */
  background: rgba(200,0,0,0.6);
  border: 2px solid red;
  border-radius: 8px;
  cursor: pointer;
}

/* Optional: visible custom scrollbar track style; you can change or replace with images */
.external-scrollbar.track-visible {
  background: rgba(255,255,255,0.03);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02);
}
