/* Shared presentation for the character and dungeon journals. */
.character-studio,
.dungeon-journal {
  background:
    linear-gradient(#3020150a, #30201580 500px, #2b2018 1100px),
    url("/static/assets/hero-background.jpg") center top/cover fixed;
  color: #432b18;
  font-family: Georgia, "Times New Roman", serif;
}
.studio-nav,
.dungeon-nav {
  padding: 8px 4vw;
  gap: 42px;
  height: 76px;
  min-height: 76px;
  background: linear-gradient(#27190eee, #322013aa, transparent);
}
.studio-nav > a,
.dungeon-nav > a {
  width: 205px;
}
.studio-nav nav,
.dungeon-nav nav {
  gap: 30px;
  font-size: 15px;
}
.studio-nav nav a,
.dungeon-nav nav a {
  padding: 10px 0;
}
.studio-shell,
.dungeon-shell {
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 0 3vw 12px;
}
.studio-heading,
.dungeon-heading {
  height: 25px;
  min-height: 25px;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.studio-layout,
.dungeon-layout {
  display: grid;
  grid-template-columns: 235px minmax(0, 1fr);
  gap: 0;
  align-items: start;
}
.character-book,
.dungeon-book {
  --book-art: url("/static/assets/dungeons/book-clean.png");
  position: relative;
  display: block;
  aspect-ratio: 1402/1122;
  width: min(100%, calc((100dvh - 140px) * 1.24955));
  height: auto;
  min-height: 0;
  max-height: none;
  padding: 0;
  margin: 0;
  align-self: start;
  justify-self: start;
  border: 0;
  background: var(--book-art) center/contain no-repeat;
  filter: drop-shadow(0 14px 12px #180c0766);
}
.character-library,
.dungeon-library {
  width: auto;
  aspect-ratio: auto;
  height: calc((100dvh - 140px) - 27px);
  margin: 15px -8px 12px 0;
  padding: 40px 23px 35px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  color: #432b18;
  border: 0;
  border-radius: 0;
  background: url("/static/assets/dungeons/book-clean.png") left center/200%
    100% no-repeat;
  filter: drop-shadow(0 8px 8px #180c0755);
}
.character-library .library-heading,
.dungeon-library .library-heading {
  flex-shrink: 0;
}
.character-library .library-heading h1,
.dungeon-library .library-heading h2 {
  font-size: 23px;
  margin: 0 0 8px;
  font-weight: 400;
}
.character-library .library-heading p:not(.chapter-number),
.dungeon-library .library-heading p:not(.chapter-number) {
  font-size: 12px;
  color: #785c3a;
}
.character-library > .ornament,
.dungeon-library > .ornament {
  margin: 10px 0;
  flex-shrink: 0;
}
#character-list,
.dungeon-list {
  min-height: 0;
  max-height: none;
  overflow: auto;
  scrollbar-width: thin;
}
.character-list-item,
.dungeon-list-item {
  padding: 7px 5px;
  gap: 9px;
  border: 0;
  border-bottom: 1px solid #ad895334;
  border-radius: 0;
  background: none;
  box-shadow: none;
}
.character-list-item[aria-pressed="true"],
.dungeon-list-item[aria-current="page"] {
  border: 0;
  border-bottom: 1px solid #a47b3e;
  background: linear-gradient(90deg, #c59b4b22, transparent);
  box-shadow: none;
  color: #573717;
}
.character-list-item img,
.dungeon-list-item img {
  width: 40px;
  height: 47px;
  object-fit: cover;
  border: 0;
  border-radius: 0;
  mask-image: radial-gradient(ellipse, #000 50%, transparent 76%);
}
.character-list-item strong,
.dungeon-list-item strong {
  font-size: 18px;
  font-weight: 400;
  line-height: 1.2;
}
.character-list-item small,
.dungeon-list-item small {
  font:
    11px/1.5 Arial,
    sans-serif;
  color: #785c3a;
  margin-top: 4px;
}
.portrait-page {
  position: absolute;
  left: 9%;
  top: 13%;
  width: 36%;
  bottom: 17%;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: none;
  border: 0;
  box-shadow: none;
}
.portrait-wrap {
  flex: 1;
  min-height: 60px;
  height: auto;
  margin: 0;
}
.character-identity {
  flex-shrink: 0;
  max-height: 55%;
  overflow: auto;
  margin: 0;
  padding: 0 3px;
  scrollbar-width: thin;
}
.character-identity h2 {
  font-size: 28px;
  margin: 8px 0 5px;
}
.character-biography {
  font-size: 12px;
  line-height: 1.5;
  margin-top: 8px;
}
.character-identity .ornament {
  margin: 7px;
}
.character-identity .book-button {
  padding: 8px 10px;
  font-size: 13px;
}
.sheet-page {
  position: absolute;
  left: 55%;
  right: 12%;
  top: 14%;
  bottom: 18%;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: none;
  border: 0;
  box-shadow: none;
}
.sheet-tabs {
  flex-shrink: 0;
  margin: 0;
}
.sheet-tabs button {
  font-size: 10px;
  padding: 9px 1px;
}
.sheet-content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px 5px 5px 0;
  scrollbar-width: thin;
}
.sheet-disclaimer {
  font-size: 8px;
  margin: 5px 0;
  flex-shrink: 0;
}
.page-number {
  display: none;
}
.attribute-columns {
  gap: 12px;
}
.attribute-columns h3 {
  font-size: 15px;
}
.core-stats dd {
  font-size: 18px;
}
.studio-status {
  font-size: 10px;
  line-height: 18px;
  margin: 0;
}
@media (min-width: 1001px) and (max-height: 650px) {
  .character-book,
  .dungeon-book {
    width: min(100%, 850px);
  }
  .character-library,
  .dungeon-library {
    height: 560px;
  }
}
@media (max-width: 1000px) {
  .character-studio {
    height: auto;
    display: block;
  }
  .studio-layout,
  .dungeon-layout {
    display: block;
  }
  .character-library,
  .dungeon-library {
    height: auto;
    margin: 0 0 12px;
    padding: 20px;
    background: #edddbb;
    border: 1px solid #ba955d;
    border-radius: 3px;
  }
  .character-library .library-heading,
  .dungeon-library .library-heading {
    display: block;
  }
  #character-list,
  .dungeon-list {
    display: flex;
    max-height: 180px;
    gap: 12px;
  }
  .character-list-item,
  .dungeon-list-item {
    min-width: 190px;
  }
  .character-book,
  .dungeon-book {
    width: 100%;
    max-width: 920px;
    margin: auto;
  }
}
@media (max-width: 650px) {
  .studio-nav,
  .dungeon-nav {
    height: auto;
    min-height: 0;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 24px;
  }
  .studio-nav > a,
  .dungeon-nav > a {
    width: 180px;
  }
  .studio-nav nav,
  .dungeon-nav nav {
    gap: 20px;
    font-size: 13px;
  }
  .journal-label {
    display: none;
  }
  .studio-heading,
  .dungeon-heading {
    height: auto;
    min-height: 30px;
    gap: 8px;
    font-size: 8px;
  }
  .studio-eyebrow,
  .demo-label {
    font-size: 8px;
  }
  .character-book,
  .dungeon-book {
    background: none;
    aspect-ratio: auto;
    filter: none;
  }
  .portrait-page,
  .sheet-page,
  .dungeon-portrait,
  .dungeon-details {
    position: relative;
    inset: auto;
    width: auto;
    background: #eddfbd;
    padding: 28px;
    margin: 0 0 12px;
    border-radius: 3px;
    box-shadow: 0 5px 15px #170d0744;
    filter: none;
  }
  .portrait-wrap {
    height: 320px;
    flex: none;
  }
  .character-identity {
    max-height: none;
    overflow: visible;
  }
  .sheet-content {
    max-height: 65dvh;
    min-height: 0;
  }
  .sheet-page {
    min-height: 0;
  }
}
/* Fade every portrait edge fully before the image boundary. */
#character-portrait,
.dungeon-portrait img {
  -webkit-mask-image: radial-gradient(
    ellipse 50% 50% at 50% 50%,
    #000 62%,
    #000b 78%,
    transparent 100%
  );
  mask-image: radial-gradient(
    ellipse 50% 50% at 50% 50%,
    #000 62%,
    #000b 78%,
    transparent 100%
  );
}
#character-portrait {
  object-position: center top;
}
/* Character portraits retain their wider composition; only the outer edges fade. */
#character-portrait {
  object-position: center 24%;
  -webkit-mask-image:
    linear-gradient(
      to bottom,
      transparent 0%,
      #000 8%,
      #000 78%,
      transparent 100%
    ),
    linear-gradient(
      to right,
      transparent 0%,
      #000 7%,
      #000 93%,
      transparent 100%
    );
  mask-image:
    linear-gradient(
      to bottom,
      transparent 0%,
      #000 8%,
      #000 78%,
      transparent 100%
    ),
    linear-gradient(
      to right,
      transparent 0%,
      #000 7%,
      #000 93%,
      transparent 100%
    );
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}
/* Anchor portraits at the top of their source to preserve headroom. */
#character-portrait {
  object-position: center top;
  padding-top: 12px;
}
#character-portrait {
  -webkit-mask-origin: content-box;
  mask-origin: content-box;
  -webkit-mask-clip: content-box;
  mask-clip: content-box;
}
/* Shared index lives on the landscape; the book remains the focal object. */
.character-library,
.dungeon-library {
  background: linear-gradient(
    90deg,
    #2b1b10ed 0%,
    #2b1b10e6 72%,
    #2b1b10c9 90%,
    #2b1b1000 100%
  );
  filter: none;
  box-shadow: none;
  border: 0;
  border-radius: 0;
  padding: 28px 20px 24px 12px;
  color: #f0dab1;
}
.character-library .library-heading,
.dungeon-library .library-heading {
  text-align: left;
}
.character-library .library-heading h1,
.dungeon-library .library-heading h2 {
  color: #f5dfb3;
}
.character-library .chapter-number,
.dungeon-library .chapter-number,
.character-library .library-heading p:not(.chapter-number),
.dungeon-library .library-heading p:not(.chapter-number) {
  color: #d0b78e;
}
.character-library > .ornament,
.dungeon-library > .ornament {
  justify-content: flex-start;
  color: #bb9357;
  margin: 18px 0;
}
.character-list-item,
.dungeon-list-item {
  position: relative;
  padding: 10px 8px 10px 12px;
  color: #e1cba6;
  border-bottom: 1px solid #b9976030;
}
.character-list-item[aria-pressed="true"],
.dungeon-list-item[aria-current="page"] {
  color: #ffe2a4;
  background: linear-gradient(90deg, #bc945025, transparent);
  border: 0;
  border-bottom: 1px solid #b9976030;
  box-shadow: inset 2px 0 #c69b54;
}
.character-list-item:hover,
.dungeon-list-item:hover {
  background-color: #bc945018;
}
.character-list-item small,
.dungeon-list-item small {
  color: #cbb18a;
}
.character-list-item img,
.dungeon-list-item img {
  width: 42px;
  height: 54px;
}
.character-library .selection-mark {
  color: #d9b16d;
}
.character-library .create-character {
  background: #32221399;
  color: #eed4a4;
  border: 1px solid #b9976055;
  box-shadow: none;
  border-radius: 3px;
}
.character-library .create-character small,
.character-library .quiet-button {
  color: #cbb18a;
}
.character-library .create-symbol {
  background: #493017;
  border: 1px solid #ab8446;
  color: #efd299;
}
.character-library .library-foot p {
  color: #cbb18a;
}
.character-library :focus-visible,
.dungeon-library :focus-visible {
  outline: 2px solid #f0c777;
  outline-offset: 2px;
}
@media (max-width: 1000px) {
  .character-library,
  .dungeon-library {
    background: #2b1b10e6;
    padding: 18px;
    border: 0;
  }
}
/* Fade only the backdrop; keep the index text and controls crisp. */
.character-library,
.dungeon-library {
  position: relative;
  isolation: isolate;
  background: none;
}
.character-library::before,
.dungeon-library::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: #2b1b10e8;
  -webkit-mask-image:
    linear-gradient(
      to bottom,
      transparent,
      #000 30px,
      #000 calc(100% - 40px),
      transparent
    ),
    linear-gradient(
      to right,
      transparent,
      #000 20px,
      #000 calc(100% - 28px),
      transparent
    );
  mask-image:
    linear-gradient(
      to bottom,
      transparent,
      #000 30px,
      #000 calc(100% - 40px),
      transparent
    ),
    linear-gradient(
      to right,
      transparent,
      #000 20px,
      #000 calc(100% - 28px),
      transparent
    );
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}
.character-list-item,
.character-list-item[aria-pressed="true"],
.dungeon-list-item,
.dungeon-list-item[aria-current="page"] {
  transform: none;
}
