/* First Font */
@font-face {
  font-family: "Death Hollows";
  src: url("Resources/Deaths Hallows.ttf");
}

@font-face {
  font-family: PIstonBlack;
  src: url(Resources/PistonBlack-Regular.ttf);
}

/* DEFAULT THEME (Vampire/Retro) */
:root,
[data-theme="retro"] {
  --bg-img: url("Resources/stars in your eyes.jpg");
  --panel-bg: rgba(26, 2, 2, 0.7);
  --accent: #8b0000;
  --text: #e0d0d0;
  --header-bg: #4a0404;
  --main-font: "Death Hollows";
}

/* THEME: CRYPT (Grey/Ghostly) */
[data-theme="crypt"] {
  --bg-img: url("Resources/forest-lamp.gif");
  --panel-bg: rgba(20, 20, 20, 0.8);
  --accent: #5e6b6b; /* Cold steel grey */
  --text: #bec0f6;
  --header-bg: #2c3333;
  --main-font: "PistonBlack"; /* Using your second font */
}

/* THEME: NOCTURNAL (Deep Purple/Magic) */
[data-theme="nocturnal"] {
  --bg-img: url("Resources/purple-stars.gif");
  --panel-bg: rgba(15, 0, 31, 0.75);
  --accent: #8508a8f5; /* Neon Purple */
  --text: #e789ed;
  --header-bg: #2e005e;
  --main-font: "serif";
}

body {
  margin: 0;
  background-image: var(--bg-img);
  background-size: cover; /* Changed to cover for better filling */
  background-attachment: fixed; /* Keep this fixed for the JS to handle the offset */
  background-repeat: no-repeat;

  color: var(--text);
  font-family: var(--main-font);
  font-size: x-large;

  /* THE FIX: Allow scrolling by making body tall */
  height: 100vh;
  width: 100vw;
  overflow-x: hidden;
  overflow-y: auto; /* Enable vertical scrollbar */

  display: flex;
  justify-content: center;
  /* Removed align-items: center because it fights with long scrolling bodies */
}

#main-container {
  /* THE FIX: Lock the container to the screen regardless of scroll */
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  width: 75vw;
  max-width: 1200px;
  height: 85vh; /* Fixed height so it stays a window */

  display: flex;
  flex-direction: column;
  border: 2px solid var(--accent);
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  border-radius: 30px;
  z-index: 99;
  overflow: hidden;
}

#layout-grid {
  display: grid;
  grid-template-columns: 160px 1fr 220px; /* Left, Center, Right */
  flex: 1;
  gap: 8px;
  padding: 10px;
  min-height: 0;
}

/* Common Panel Styling */
#left-sidebar,
#center-body,
#right-sidebar {
  background: var(--panel-bg);
  border: 1px solid var(--accent);
  margin: 2px;
  border-radius: 15px; /* Curly/Rounded edges for boxes */
  display: flex;
  flex-direction: column;
  overflow-y: auto; /* Each section scrolls independently */
  height: 100%;
}

.panel-header {
  background: var(--header-bg);
  color: var(--text);
  padding: 8px;
  font-weight: bold;
  text-transform: uppercase;
  font-size: 14px;
  text-align: center;
  letter-spacing: 2px;
  font-family: serif;
  border-bottom: 1px solid var(--accent);
  position: sticky;
  top: 0;
  z-index: 20;
}

/* Customizing the side boxes */
.side-box {
  padding: 8px;
  background: var(--inner-bg);
  margin: 10px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-family: var(--main-font);
  font-palette: var(--accent);
}

audio {
  width: 100%;
  height: 30px; /* Slimmer player */
  margin-top: 5px;
  filter: invert(100%) sepia(100%) saturate(500%) hue-rotate(300deg); /* Optional: colors the player red/dark */
}

#page-content {
  padding: 20px;
  font-family: var(--main-font);
}

/* Buttons & UI */
button {
  background: var(--inner-bg);
  color: var(--text);
  border: 1px solid var(--accent);
  margin: 5px 10px;
  padding: 8px;
  cursor: pointer;
  font-size: 11px;
}

button:hover {
  background: var(--accent);
  color: var(--text);
}

textarea {
  width: 100%;
  height: 60px;
  background: #000;
  color: var(--text);
  border: 1px solid var(--accent);
  resize: none;
}

#footer {
  height: 40px;
  background: var(--inner-bg);
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-family: var(--main-font);
  border-top: 2px solid var(--accent);
  align-items: center;
  flex-shrink: 0;
}

/* 4. EXTRAS */
h1,
h2,
h3 {
  font-weight: normal;
  font-family: var(--main-font);
  color: var(--text);
  text-shadow: 2px 2px 4px #000;
}

/* Scrollbar styling to match the theme */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--inner-bg);
}
::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 10px;
}
