html, html a {
  -webkit-font-smoothing: antialiased;
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.004);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  font-size: 22px;
  line-height: 1.6;
  color: #333;
}

h1, h2, h3, h4 {
  font-family: "Piazzolla", Georgia, serif;
  color: #2c1810;
  line-height: 1.25;
  margin-bottom: 16px;
}

h1 {
  font-size: 58px;
  font-weight: 800;
}

h2 {
  font-size: 48px;
  font-weight: 600;
}

h3 {
  font-size: 32px;
  font-weight: 600;
  margin-top: 24px;
}

h4 {
  font-size: 25px;
  font-weight: 600;
}

p {
  margin-bottom: 16px;
}

a {
  color: #780000;
  text-decoration: none;
}
a:hover {
  color: #8b3030;
  text-decoration: underline;
}

b, strong {
  font-weight: 600;
}

.flavor {
  font-family: "Piazzolla", Georgia, serif;
  font-style: italic;
  font-size: 19px;
  color: #777;
  line-height: 1.6;
  display: block;
  margin-bottom: 16px;
}

i, em {
  font-style: italic;
}

.section-heading {
  font-family: "Piazzolla", Georgia, serif;
  font-size: 58px;
  font-weight: 800;
  text-align: center;
  margin-top: 72px;
  margin-bottom: 24px;
  color: #2c1810;
}

.subsection-heading {
  font-family: "Piazzolla", Georgia, serif;
  font-size: 48px;
  font-weight: 600;
  text-align: center;
  margin-top: 32px;
  margin-bottom: 24px;
}

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

html {
  scroll-padding-top: 70px;
}

body {
  background-color: #f8f5f0;
  min-height: 100vh;
}

#menu-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 50px;
  background-color: #111;
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0 16px;
}

#menu-burger {
  display: none;
  width: 28px;
  height: 28px;
  cursor: pointer;
  margin-left: 16px;
}
@media (max-width: 768px) {
  #menu-burger {
    display: block;
  }
}

#menu-bar-title {
  color: #ddd;
  font-family: "Piazzolla", Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

#page-container {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  padding-top: 50px;
}
@media (max-width: 768px) {
  #page-container {
    grid-template-columns: 1fr;
  }
}

#sidebar {
  position: fixed;
  top: 50px;
  left: 0;
  width: 260px;
  height: calc(100vh - 50px);
  background-color: #1a1210;
  overflow-y: auto;
  padding: 24px 0;
  z-index: 50;
  transition: transform 0.3s ease;
}
@media (max-width: 768px) {
  #sidebar {
    transform: translateX(-100%);
  }
  #sidebar.open {
    transform: translateX(0);
  }
}
#sidebar::-webkit-scrollbar {
  width: 6px;
}
#sidebar::-webkit-scrollbar-track {
  background: #1a1210;
}
#sidebar::-webkit-scrollbar-thumb {
  background-color: #444;
  border-radius: 3px;
}

#sidebar-overlay {
  display: none;
  position: fixed;
  top: 50px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 40;
}
@media (max-width: 768px) {
  #sidebar-overlay.active {
    display: block;
  }
}

#main-content {
  padding: 32px 32px 48px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}
@media (max-width: 768px) {
  #main-content {
    padding: 24px 16px 32px;
  }
}

.content-section {
  margin-bottom: 72px;
}
.content-section:first-child {
  margin-top: 24px;
}

.hero-logo {
  display: block;
  width: 60%;
  max-width: 500px;
  margin: 32px auto 48px;
}
@media (max-width: 768px) {
  .hero-logo {
    width: 80%;
  }
}

body.page-mode .content-section {
  display: none;
}
body.page-mode .content-section.page-visible {
  display: block;
}
body.page-mode .hero-logo {
  display: none;
}

.prose-image-container {
  display: flex;
  justify-content: center;
  margin: 32px 0;
}
.prose-image-container img {
  max-width: 70%;
  height: auto;
}
@media (max-width: 768px) {
  .prose-image-container img {
    max-width: 100%;
  }
}

.nav-group {
  margin-bottom: 8px;
}

.nav-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 24px;
  color: #ccc;
  font-family: "Piazzolla", Georgia, serif;
  font-size: 19px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s, background-color 0.2s;
}
.nav-heading:hover {
  color: #fff;
  background-color: #2c1810;
}
.nav-heading.active {
  color: #fff;
  border-left: 3px solid #6b2020;
  padding-left: 21px;
}
.nav-heading .nav-caret {
  font-size: 12px;
  transition: transform 0.2s;
}
.nav-heading.expanded .nav-caret {
  transform: rotate(90deg);
}

.nav-items {
  display: none;
  padding-left: 40px;
}
.nav-items.expanded {
  display: block;
}
.nav-items a {
  display: block;
  padding: 3px 0;
  color: #999;
  font-size: 16px;
  text-decoration: none;
  transition: color 0.2s;
}
.nav-items a:hover, .nav-items a.active {
  color: #fff;
}

#view-mode-toggle {
  margin-left: auto;
  display: flex;
  align-items: center;
  background: #222;
  border: 1px solid #444;
  border-radius: 16px;
  padding: 2px;
  cursor: pointer;
  position: relative;
}
#view-mode-toggle .toggle-option {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 22px;
  border-radius: 12px;
  position: relative;
  z-index: 1;
  color: #666;
  transition: color 0.3s;
}
#view-mode-toggle .toggle-option svg {
  width: 14px;
  height: 14px;
}
#view-mode-toggle .toggle-scroll {
  color: #fff;
}
#view-mode-toggle .toggle-slider {
  position: absolute;
  width: 28px;
  height: 22px;
  border-radius: 12px;
  background: #6b2020;
  left: 2px;
  top: 2px;
  transition: left 0.3s ease;
}

body.page-mode #view-mode-toggle .toggle-scroll {
  color: #666;
}
body.page-mode #view-mode-toggle .toggle-page {
  color: #fff;
}
body.page-mode #view-mode-toggle .toggle-slider {
  left: 30px;
}

#page-mode-nav {
  padding-top: 8px;
}
#page-mode-nav .nav-node-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #ccc;
  font-family: "Piazzolla", Georgia, serif;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s, background-color 0.2s;
}
#page-mode-nav .nav-node-label:hover {
  color: #fff;
  background-color: #2c1810;
}
#page-mode-nav .nav-node-label.active {
  color: #fff;
  border-left: 3px solid #6b2020;
}
#page-mode-nav .nav-node-label .nav-caret {
  font-size: 12px;
  transition: transform 0.2s;
}
#page-mode-nav .nav-node-label.expanded .nav-caret {
  transform: rotate(90deg);
}
#page-mode-nav .depth-0 {
  padding: 8px 24px;
  font-size: 19px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}
#page-mode-nav .depth-0.active {
  padding-left: 21px;
}
#page-mode-nav .depth-1 {
  padding: 4px 24px 4px 40px;
  font-size: 16px;
  font-weight: 600;
}
#page-mode-nav .depth-1.active {
  padding-left: 37px;
}
#page-mode-nav .depth-2 {
  padding: 3px 24px 3px 56px;
  font-size: 15px;
  font-weight: 500;
}
#page-mode-nav .depth-2.active {
  padding-left: 53px;
}
#page-mode-nav .depth-3 {
  padding: 2px 24px 2px 72px;
  font-size: 14px;
  font-weight: 400;
}
#page-mode-nav .depth-3.active {
  padding-left: 69px;
}

#page-landing {
  display: none;
  padding-top: 24px;
}
#page-landing .landing-title {
  font-family: "Piazzolla", Georgia, serif;
  font-size: 58px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 32px;
  color: #2c1810;
}
@media (max-width: 768px) {
  #page-landing .landing-title {
    font-size: 48px;
  }
}
#page-landing .landing-links {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 500px;
  margin: 0 auto;
}
#page-landing .landing-link {
  display: block;
  padding: 24px;
  background: #faf8f4;
  border: 1px solid #d4c8b8;
  border-radius: 4px;
  text-decoration: none;
  color: #2c1810;
  font-family: "Piazzolla", Georgia, serif;
  font-size: 32px;
  font-weight: 600;
  text-align: center;
  transition: box-shadow 0.2s, border-color 0.2s;
  cursor: pointer;
}
#page-landing .landing-link:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  border-color: #6b2020;
}

#page-breadcrumbs {
  display: none;
  padding: 8px 0 16px;
  font-size: 15px;
  color: #777;
}
#page-breadcrumbs .bc-sep {
  margin: 0 4px;
  color: #ccc;
}
#page-breadcrumbs .bc-link {
  color: #780000;
  text-decoration: none;
  cursor: pointer;
}
#page-breadcrumbs .bc-link:hover {
  text-decoration: underline;
}
#page-breadcrumbs .bc-current {
  color: #2c1810;
  font-weight: 600;
}

.entry-card {
  background: #faf8f4;
  border: 1px solid #d4c8b8;
  border-radius: 4px;
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.2s;
}
.entry-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.entry-card-title {
  font-family: "Piazzolla", Georgia, serif;
  font-size: 32px;
  font-weight: 800;
  color: #2c1810;
  margin-bottom: 4px;
}

.entry-card-summary {
  font-size: 22px;
  font-style: italic;
  color: #777;
  margin-bottom: 16px;
}

.entry-card-meta {
  font-size: 19px;
  margin-bottom: 8px;
}
.entry-card-meta b {
  color: #2c1810;
}

.entry-card-details {
  font-size: 22px;
  line-height: 1.6;
  margin-top: 16px;
}
.entry-card-details h2 {
  font-size: 25px;
  margin-top: 24px;
  margin-bottom: 8px;
}
.entry-card-details h3 {
  font-size: 22px;
  margin-top: 16px;
  margin-bottom: 4px;
}
.entry-card-details table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}
.entry-card-details table th, .entry-card-details table td {
  border: 1px solid #d4c8b8;
  padding: 8px 16px;
  text-align: center;
}
.entry-card-details table th {
  background: #f8f5f0;
  font-weight: 600;
  font-size: 19px;
}
.entry-card-details table td {
  font-size: 22px;
}
.entry-card-details img {
  max-width: 100%;
  height: auto;
}
.entry-card-details h4 {
  font-size: 22px;
  font-weight: 700;
  margin: 16px 0 4px 0;
  display: block;
}
.entry-card-details .entry_h4 {
  font-weight: 600;
  font-size: 22px;
  margin-bottom: 4px;
  margin-top: 24px;
}
.entry-card-details .small_bottom_margin {
  margin-bottom: 0;
}

.entry-card.collapsed .entry-card-summary,
.entry-card.collapsed .entry-card-meta,
.entry-card.collapsed .entry-card-details {
  display: none;
}

.entry-card-toggle {
  display: inline-block;
  cursor: pointer;
  font-size: 15px;
  color: #777;
  margin-left: 8px;
  vertical-align: middle;
}
.entry-card-toggle:hover {
  color: #2c1810;
}

.goods-card {
  background: #faf8f4;
  border: 1px solid #d4c8b8;
  border-radius: 4px;
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.goods-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.goods-card-name {
  font-family: "Piazzolla", Georgia, serif;
  font-size: 25px;
  font-weight: 700;
  color: #2c1810;
}

.goods-card-cost {
  font-size: 19px;
  color: #777;
}
.goods-card-cost b {
  color: #2c1810;
}

.goods-card-meta {
  font-size: 19px;
  color: #777;
  margin-bottom: 8px;
}

.goods-card-two-handed {
  font-size: 19px;
  font-weight: 600;
  text-align: right;
  margin-bottom: 8px;
}
.goods-card-two-handed img {
  width: 50px;
  height: auto;
  vertical-align: middle;
  margin-right: 4px;
}

.goods-card-summary {
  font-style: italic;
  color: #777;
  margin-bottom: 16px;
  font-size: 19px;
}

.goods-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  font-size: 19px;
  margin-bottom: 8px;
}
.goods-card-stats b {
  color: #2c1810;
}

.goods-card-details {
  font-size: 19px;
  margin-top: 8px;
  line-height: 1.6;
}
.goods-card-details h4 {
  font-size: 19px;
  font-weight: 700;
  margin: 16px 0 4px 0;
  display: block;
}

.creature-card {
  background: #faf8f4;
  border: 1px solid #d4c8b8;
  border-radius: 4px;
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.creature-card-title {
  font-family: "Piazzolla", Georgia, serif;
  font-size: 32px;
  font-weight: 800;
  color: #2c1810;
  margin-bottom: 4px;
}

.creature-card-summary {
  font-style: italic;
  color: #777;
  margin-bottom: 16px;
}

.creature-stat-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
  font-size: 19px;
}
.creature-stat-table th, .creature-stat-table td {
  border: 1px solid #d4c8b8;
  padding: 8px;
  text-align: center;
}
.creature-stat-table th {
  background: #f8f5f0;
  font-weight: 600;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.creature-stat-table td {
  font-size: 25px;
  font-weight: 600;
  font-family: "Piazzolla", Georgia, serif;
}

.creature-card-details {
  font-size: 22px;
  line-height: 1.6;
}
.creature-card-details h4 {
  font-size: 22px;
  font-weight: 700;
  margin: 16px 0 4px 0;
  display: block;
}

.spell-school-heading {
  font-family: "Piazzolla", Georgia, serif;
  font-size: 48px;
  font-weight: 800;
  text-align: center;
  margin-top: 72px;
  margin-bottom: 24px;
  color: #2c1810;
}

.spell-level-heading {
  font-family: "Piazzolla", Georgia, serif;
  font-size: 32px;
  font-weight: 600;
  text-align: center;
  margin-top: 32px;
  margin-bottom: 16px;
  color: #2c1810;
}

.data-section-header {
  font-family: "Piazzolla", Georgia, serif;
  font-size: 58px;
  font-weight: 800;
  text-align: center;
  margin-top: 72px;
  margin-bottom: 32px;
  color: #2c1810;
}

#search-container {
  padding: 16px 24px;
  margin-bottom: 8px;
}

#search-input {
  width: 100%;
  padding: 8px 16px;
  border: 1px solid #444;
  border-radius: 4px;
  background: #222;
  color: #ddd;
  font-size: 19px;
  outline: none;
}
#search-input::placeholder {
  color: #666;
}
#search-input:focus {
  border-color: #6b2020;
}

.edit-mode-banner {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #6b2020;
  color: #fff;
  text-align: center;
  padding: 8px;
  font-size: 19px;
  font-weight: 600;
  z-index: 200;
}
.edit-mode-banner.active {
  display: block;
}

.edit-btn {
  display: none;
  background: none;
  border: 1px solid #d4c8b8;
  border-radius: 3px;
  padding: 2px 10px;
  font-size: 15px;
  color: #777;
  cursor: pointer;
  float: right;
  margin-top: 2px;
}
.edit-btn:hover {
  background: #f8f5f0;
  color: #2c1810;
}

.edit-mode .edit-btn {
  display: inline-block;
}

.save-btn, .cancel-btn {
  display: inline-block;
  border: none;
  border-radius: 3px;
  padding: 4px 12px;
  font-size: 15px;
  cursor: pointer;
  margin-right: 4px;
}

.save-btn {
  background: #6b2020;
  color: #fff;
}
.save-btn:hover {
  background: #8b3030;
}

.cancel-btn {
  background: #ddd;
  color: #333;
}
.cancel-btn:hover {
  background: #ccc;
}

.prose-block {
  position: relative;
}
.prose-block .prose-edit-btn {
  position: absolute;
  top: 0;
  right: 0;
  float: none;
}

.prose-textarea {
  width: 100%;
  min-height: 400px;
  font-family: monospace;
  font-size: 13px;
  line-height: 1.5;
  padding: 8px;
  border: 1px solid #d4c8b8;
  border-radius: 3px;
  background: #f8f5f0;
  color: #333;
  resize: vertical;
  margin-bottom: 8px;
  tab-size: 2;
}

#edit-mode-trigger {
  display: none;
  width: 28px;
  height: 28px;
  margin: 32px auto 24px;
  border-radius: 50%;
  border: 1px solid #2a2a2a;
  color: #2a2a2a;
  font-family: "Piazzolla", Georgia, serif;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  line-height: 26px;
  cursor: default;
  user-select: none;
  transition: color 0.3s, border-color 0.3s;
}
#edit-mode-trigger.available {
  display: block;
  cursor: pointer;
}
#edit-mode-trigger.available:hover {
  color: #555;
  border-color: #555;
}
#edit-mode-trigger.active {
  color: #6b2020;
  border-color: #6b2020;
}

#auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}

#auth-modal {
  background: #1a1210;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 32px 32px 24px;
  width: 280px;
  text-align: center;
}
#auth-modal .auth-title {
  font-family: "Piazzolla", Georgia, serif;
  font-size: 25px;
  font-weight: 800;
  color: #ccc;
  margin-bottom: 24px;
  letter-spacing: 1px;
}
#auth-modal input {
  display: block;
  width: 100%;
  padding: 8px 16px;
  margin-bottom: 16px;
  border: 1px solid #444;
  border-radius: 4px;
  background: #222;
  color: #ddd;
  font-size: 15px;
  outline: none;
}
#auth-modal input::placeholder {
  color: #666;
}
#auth-modal input:focus {
  border-color: #6b2020;
}
#auth-modal .auth-error {
  color: #c44;
  font-size: 13px;
  min-height: 20px;
  margin-bottom: 8px;
}
#auth-modal .auth-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}
#auth-modal .auth-actions button {
  padding: 8px 24px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
#auth-modal .auth-actions #auth-submit {
  background: #6b2020;
  color: #fff;
}
#auth-modal .auth-actions #auth-submit:hover {
  background: #8b3030;
}
#auth-modal .auth-actions #auth-cancel {
  background: #333;
  color: #999;
}
#auth-modal .auth-actions #auth-cancel:hover {
  background: #444;
  color: #ccc;
}

table.action_attack_range {
  border: none;
}
table.action_attack_range tr, table.action_attack_range td {
  border: none;
}
table.action_attack_range img {
  width: 65%;
  height: auto;
}
table.action_attack_range .subtitle {
  padding: 0 10%;
  font-size: 19px;
  line-height: 1.4;
}