@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700&display=swap');
#compendium #sidebar {
  width: 300px;
  background: linear-gradient(#1e1c1a, #151311);
  border-right: 2px solid #3a2f26;
  padding: 1em;
  overflow-y: auto;
  box-shadow: inset -2px 0 8px rgba(0,0,0,0.7);
}
#compendium #sidebar h3 {
  color: #88aabb;
  text-align: center;
  margin-bottom: 1em;
  font-weight: bold;
  font-size: 1.2em;
}
#compendium #content {
  flex-grow: 1;
  max-width: calc(100% - 300px); /* prevent overflow into sidebar */
  overflow-y: auto;
  padding: 1em;
  background: radial-gradient(ellipse at top left, #181a1e, #101215);
  box-shadow: inset 2px 0 8px rgba(0,0,0,0.7);
  position: relative;
  font-family: 'Cinzel', serif;
  font-size: 16px;
  line-height: 1.6;
  color: #d6c7b0;
}
#entryContent {
  background: #1e1c1a;
  border: 1px solid #3a2f26;
  border-radius: 8px;
  padding: 1em;
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
  /*max-width: 900px;*/
  margin: 0 auto;
}

.tree {
  max-height: 1000px;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.tree.hidden {
  max-height: 0;
  overflow: hidden;
}

.tree-item {
  cursor: pointer;
  margin: 3px 0;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.2s;
}
.tree-item:hover {
  background-color: rgba(120, 150, 180, 0.2);
  color: #ffffff;
}

.folder-label {
  padding: 4px;
  border-radius: 4px;
  transition: background 0.3s;
}

.folder-label:hover {
  background: rgba(255, 255, 255, 0.05);
}

.folder-toggle {
  transition: transform 0.3s;
}

.folder-toggle:has(+ ul:not(.hidden)) {
  transform: rotate(90deg);
}

.hidden {
  display: none;
}
table {
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
  background-color: rgba(30, 28, 26, 0.7);
  color: #d6c7b0;
}
table, th, td {
  border: 1px solid #3a2f26;
  padding: 6px;
}
th {
  background-color: #2e2b28;
}
ul {
  padding-left: 1.2em;
}
::content h2, h3 {
  color: #9dc3e6;
  border-bottom: 1px solid #3a2f26;
  padding-bottom: 4px;
}
.highlight {
  background-color: rgba(100, 150, 220, 0.3);
  transition: background-color 0.5s;
}
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-thumb {
  background: #3a2f26;
}
::selection {
  background: #555;
  color: #fff;
}

.chronicle-entry {
  background: #1c1b18;
  border: 1px solid #3b3a36;
  padding: 1em;
  margin-bottom: 1em;
  border-radius: 8px;
}
.chronicle-entry h3 {
  margin-bottom: 0.5em;
}


.timeline {
  position: relative;
  margin: 2em 0;
  padding-left: 2em;
  border-left: 3px solid #444;
}
.timeline-entry {
  position: relative;
  margin-bottom: 2em;
  padding-left: 1em;
}
.timeline-dot {
  position: absolute;
  left: -1.1em;
  top: 0.3em;
  width: 1em;
  height: 1em;
  background: #88aaff;
  border: 2px solid #222;
  border-radius: 50%;
}
.timeline-year {
  font-weight: bold;
  color: #aaa;
  margin-bottom: 0.2em;
}
.timeline-content h4 {
  margin: 0 0 0.2em;
  color: #ccc;
}
.timeline-content p {
  margin: 0.2em 0;
}

[compendium-link] {
  cursor: pointer;
}
[compendium-link]:hover {
  text-decoration: underline;
  color: #9cf;
}



.filtered-table {
  width: 100%;
  border-collapse: collapse;
  background: #1a1a1a;
  color: #ccc;
}

.filtered-table th, .filtered-table td {
  padding: 8px;
  border: 1px solid #333;
}

.filtered-table th {
  background-color: #2a2a2a;
  color: #eee;
}

.content-link {
  color: #88c;
  cursor: pointer;
  text-decoration: underline;
}

.content-link:hover {
  color: #ccf;
}


@media (max-width: 768px) {
  #compendium {
    display: flex;
    flex-direction: column;
  }

  #compendium #sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 2px solid #3a2f26;
    box-shadow: inset 0 -2px 8px rgba(0,0,0,0.7);
    max-height: 250px;
    overflow-y: auto;
    margin-bottom: 1em;
  }

  #compendium #content {
    max-width: 100%;
    padding: 1em;
  }

  .folder-label {
    font-size: 1rem;
  }

  .tree-item {
    font-size: 0.95rem;
    padding: 6px 10px;
  }

  table,
  .filtered-table {
    font-size: 0.9rem;
    word-break: break-word;
  }

  .timeline {
    padding-left: 1em;
  }

  .timeline-dot {
    left: -0.9em;
    width: 0.8em;
    height: 0.8em;
  }
}

/* Wrapper for each key/value pair */
.entry-section {
  margin-bottom: 2em;
  padding: 1em;
  border-left: 4px solid #444;
  background: rgba(30, 28, 26, 0.4);
  border-radius: 6px;
}

.entry-section h3 {
  margin-top: 0;
  margin-bottom: 0.5em;
  color: #aaccff;
  font-size: 1.2em;
  border-bottom: 1px solid #3a2f26;
  padding-bottom: 4px;
}

.entry-section p,
.entry-section ul {
  margin: 0.3em 0 0 0.5em;
  color: #ddd;
}

.entry-section ul {
  list-style: disc inside;
}

.entry-section table {
  margin-top: 0.5em;
}

/* Optional: use grid layout for field-value alignment */
.entry-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.5em 1em;
  align-items: start;
}
.entry-grid > .field-label {
  font-weight: bold;
  color: #bbccdd;
  white-space: nowrap;
}

.entry-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 1em;
  margin-bottom: 1em;
}

.entry-field {
  flex: 1 1 200px; /* responsive horizontal sizing */
  min-width: 150px;
  background: #222;
  padding: 0.75em;
  border: 1px solid #111;
  border-radius: 6px;
}

.entry-field h3 {
  margin: 0 0 0.5em;
  font-size: 1em;
  color: #aaa;
}

.entry-field p, .entry-field ul {
  margin: 0;
  font-size: 0.95em;
}
