/* =========================================================
   CODEX DETAIL PAGE LAYOUT
   ========================================================= */

#codex-content.codex-detail-page,
#codex-content.codex-region-detail-page {
  overflow: hidden;

  mask-image:
    linear-gradient(
      to bottom,
      transparent 0,
      black 18px,
      black calc(100% - 22px),
      transparent 100%
    );

  -webkit-mask-image:
    linear-gradient(
      to bottom,
      transparent 0,
      black 18px,
      black calc(100% - 22px),
      transparent 100%
    );
}

.codex-detail-page-shell {
  min-height: calc(100vh - 285px);

  display: flex;
  flex-direction: column;
}

.codex-detail-rail-page {
  height: calc(100vh - 285px);
  min-height: 0;

  display: flex;
  flex-direction: column;

  overflow: hidden;
}

.codex-detail-overview-locked {
  flex: 0 0 auto;
  min-height: 0;

  padding-bottom: 8px;
}

.codex-detail-overview-panel {
  border-bottom: 1px solid rgba(72, 43, 18, 0.18);
}

#codex-content .codex-detail-overview-panel h3 {
  display: none;
}

.codex-detail-lower-pane {
  flex: 1 1 auto;
  min-height: 0;

  display: grid;
  grid-template-columns: var(--codex-rail-width, 190px) minmax(0, 1fr);
  gap: 18px;

  overflow: hidden;
}

.codex-detail-rail {
  min-height: 0;

  display: flex;
  align-items: center;
}

.codex-detail-section-rail {
  width: 100%;
}

.codex-detail-section-rail-row .codex-row-title {
  font-size: 0.93rem;
}

.codex-detail-main {
  min-height: 0;

  overflow-y: auto;

  padding: 4px 12px 24px 2px;
}

.codex-detail-rail-section {
  display: none;

  min-height: 100%;

  margin: 0;

  border: 0;
}

.codex-detail-rail-section.active {
  display: block;
}

.codex-detail-rail-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(72, 43, 18, 0.18);
  margin-bottom: 8px;
}

#codex-content .codex-detail-rail-section h3 {
  margin: 0;
  padding: 12px 0 8px;

  font-size: 1.05rem;
}

#codex-content .codex-detail-rail-section h3::after {
  content: none;
}

.codex-detail-section-action {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 4px 10px;
  border: 1px solid rgba(70, 47, 24, 0.58);
  background:
    radial-gradient(circle at 38% 24%, rgba(255, 244, 215, 0.32), transparent 44%),
    linear-gradient(to bottom, rgba(238, 214, 169, 0.84), rgba(209, 166, 95, 0.62));
  color: rgba(47, 29, 16, 0.9);
  font-family: "Marcellus SC", serif;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
}

.codex-detail-section-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.codex-detail-section-actions .codex-detail-section-action {
  font-size: 0.72rem;
  padding-inline: 8px;
}

.codex-detail-section-action:hover,
.codex-detail-section-action:focus-visible {
  border-color: rgba(72, 43, 18, 0.82);
  background:
    radial-gradient(circle at 38% 24%, rgba(255, 246, 222, 0.40), transparent 44%),
    linear-gradient(to bottom, rgba(244, 224, 184, 0.94), rgba(216, 175, 105, 0.72));
}

.codex-detail-rail-section-content {
  padding: 3px 0 16px;
}

.codex-detail-rail-section-content > p,
.codex-detail-rail-section-content .codex-detail-text-block {
  margin: 0;

  font-style: italic;
  font-size: 1.02rem;
  line-height: 1.9;
  letter-spacing: 0.01em;
}

.codex-detail-rail-section-content .codex-row-list {
  margin: 0;
}

.codex-detail-related-areas-content {
  display: grid;
  gap: 16px;
}

.codex-detail-related-area-group {
  display: grid;
  gap: 8px;
}

#codex-content .codex-detail-related-area-group h4 {
  margin: 0;
  font-family: 'Marcellus SC', Georgia, serif;
  font-size: 0.96rem;
  line-height: 1.2;
  letter-spacing: 0.035em;
  color: rgba(47, 29, 16, 0.82);
}

/* =========================================================
   MOBILE DETAIL CONTENT ADAPTATION
   ========================================================= */

@media (max-width: 1099px), (max-height: 699px) {
  #codex-content.codex-detail-page .codex-detail-page-shell,
  #codex-content.codex-detail-page .codex-detail-rail-page {
    height: 100% !important;
    min-height: 0 !important;
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
    gap: 8px !important;
    overflow: hidden !important;
  }

  #codex-content.codex-detail-page .codex-detail-overview-locked {
    display: block !important;
    min-height: 0 !important;
    padding-bottom: 6px !important;
    overflow: hidden !important;
  }

  #codex-content.codex-detail-page .codex-detail-overview-panel {
    border-bottom: 1px solid rgba(72, 43, 18, 0.16) !important;
  }

  #codex-content.codex-detail-page .codex-detail-overview-panel .codex-detail-fixed,
  #codex-content.codex-detail-page .codex-detail-overview-panel .codex-detail-fixed-poi,
  #codex-content.codex-detail-page .codex-detail-overview-panel .codex-detail-fixed-region {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    align-items: center !important;
    justify-content: center !important;
    justify-items: stretch !important;
    gap: clamp(10px, calc(var(--codex-mobile-image-width, 100vw) * 0.032), 16px) !important;
    max-width: min(100%, 460px) !important;
    margin: 0 auto !important;
    padding: 0 0 7px !important;
  }

  #codex-content.codex-detail-page .codex-detail-overview-panel .codex-detail-fixed::before,
  #codex-content.codex-detail-page .codex-detail-overview-panel .codex-detail-fixed::after,
  #codex-content.codex-detail-page .codex-detail-overview-panel .codex-detail-fixed-poi::before,
  #codex-content.codex-detail-page .codex-detail-overview-panel .codex-detail-fixed-poi::after,
  #codex-content.codex-detail-page .codex-detail-overview-panel .codex-detail-fixed-region::before,
  #codex-content.codex-detail-page .codex-detail-overview-panel .codex-detail-fixed-region::after {
    display: none !important;
    content: none !important;
  }

  #codex-content.codex-hex-detail-page .codex-detail-overview-panel .codex-detail-overview-meta {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    align-items: start !important;
    justify-items: stretch !important;
    gap: clamp(12px, calc(var(--codex-mobile-image-width, 100vw) * 0.052), 24px) !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 auto !important;
    padding:
      clamp(8px, calc(var(--codex-mobile-image-height, 100vh) * 0.014), 14px)
      clamp(8px, calc(var(--codex-mobile-image-width, 100vw) * 0.024), 14px)
      10px !important;
    text-align: center !important;
  }

  #codex-content.codex-hex-detail-page .codex-detail-overview-panel .codex-detail-overview-meta p:first-child {
    justify-self: start !important;
    text-align: left !important;
  }

  #codex-content.codex-hex-detail-page .codex-detail-overview-panel .codex-detail-overview-meta p:last-child {
    justify-self: end !important;
    text-align: right !important;
  }

  #codex-content.codex-hex-detail-page .codex-detail-overview-panel .codex-detail-overview-meta p {
    margin: 0 !important;
    min-width: 0 !important;
    font-size: clamp(0.82rem, calc(var(--codex-mobile-image-width, 100vw) * 0.031), 1rem) !important;
    line-height: 1.2 !important;
  }

  #codex-content.codex-hex-detail-page .codex-detail-overview-panel .codex-detail-overview-meta .codex-link-button {
    margin: 0 !important;
    padding: 0 !important;
    display: inline !important;
    font: inherit !important;
    line-height: inherit !important;
    vertical-align: baseline !important;
  }

  #codex-content.codex-detail-page .codex-detail-overview-panel .codex-detail-portrait-slot {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1 !important;
    max-width: 138px !important;
    min-width: 0 !important;
    margin: 0 !important;
    align-self: center !important;
    justify-self: end !important;
  }

  #codex-content.codex-detail-page .codex-detail-overview-panel .codex-detail-meta {
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    align-self: center !important;
    justify-self: start !important;
    text-align: left !important;
    gap: 2px !important;
  }

  #codex-content.codex-detail-page .codex-detail-overview-panel .codex-detail-meta p {
    margin: 0 0 4px !important;
    font-size: clamp(0.76rem, calc(var(--codex-mobile-image-width, 100vw) * 0.029), 0.96rem) !important;
    line-height: 1.18 !important;
  }

  #codex-content.codex-detail-page .codex-detail-overview-side {
    display: none !important;
  }

  #codex-content.codex-detail-page .codex-detail-lower-pane {
    height: 100% !important;
    min-height: 0 !important;
  }

  #codex-overlay #codex-title .codex-header-link {
    appearance: none !important;
    -webkit-appearance: none !important;
    border: 0 !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    font: inherit !important;
    color: inherit !important;
    letter-spacing: inherit !important;
    text-transform: inherit !important;
    cursor: pointer !important;
    border-bottom: 1px solid rgba(72, 43, 18, 0.32) !important;
  }

  #codex-overlay #codex-title .codex-header-link:active,
  #codex-overlay #codex-title .codex-header-link:focus-visible {
    color: rgba(47, 29, 16, 0.82) !important;
    outline: none !important;
    border-bottom-color: rgba(72, 43, 18, 0.58) !important;
  }
}

@media (max-width: 420px) {
  #codex-content.codex-detail-page .codex-detail-overview-panel .codex-detail-fixed,
  #codex-content.codex-detail-page .codex-detail-overview-panel .codex-detail-fixed-poi,
  #codex-content.codex-detail-page .codex-detail-overview-panel .codex-detail-fixed-region {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    gap: 9px !important;
    max-width: 100% !important;
  }

  #codex-content.codex-detail-page .codex-detail-overview-panel .codex-detail-portrait-slot {
    max-width: 112px !important;
  }

  #codex-content.codex-detail-page .codex-detail-overview-panel .codex-detail-meta p {
    font-size: 0.74rem !important;
  }

  #codex-content.codex-hex-detail-page .codex-detail-overview-panel .codex-detail-overview-meta {
    gap: 10px !important;
    padding-top: 9px !important;
    max-width: 100% !important;
  }

  #codex-content.codex-hex-detail-page .codex-detail-overview-panel .codex-detail-overview-meta p {
    font-size: 0.78rem !important;
  }
}

.codex-detail-fixed {
  flex: 0 0 auto;

  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  gap: 16px;

  padding-bottom: 12px;
}

.codex-detail-overview-panel .codex-detail-fixed {
  position: relative;
  padding-top: 8px;
  padding-bottom: 8px;
}

.codex-detail-overview-panel .codex-detail-fixed:has(.codex-detail-overview-side)::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: calc(190px + 16px + 205px + 18px);
  width: 1px;

  pointer-events: none;

  background: linear-gradient(
    to bottom,
    transparent,
    rgba(72, 43, 18, 0.45),
    transparent
  );
}

.codex-detail-portrait-slot {
  position: relative;

  width: 190px;
  height: 190px;

  overflow: hidden;

  border-radius: 14px;
  border: 0;

  background:
    var(--codex-record-image, none),
    linear-gradient(
      rgba(255, 236, 188, 0.24),
      rgba(166, 108, 41, 0.14)
    );

  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;

  box-shadow: none;
}

.codex-placeholder-npc,
.codex-placeholder-settlement,
.codex-placeholder-poi,
.codex-placeholder-region {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.codex-placeholder-npc::before,
.codex-placeholder-settlement::before,
.codex-placeholder-poi::before,
.codex-placeholder-region::before {
  content: "";

  position: absolute;
  inset: 0;

  pointer-events: none;

  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;

  opacity: 0.90;

  z-index: -1;
}

.codex-placeholder-npc::before {
  background-image: url("../assets/placeholder/Placeholder_NPC.png");
}

.codex-placeholder-settlement::before {
  background-image: url("../assets/placeholder/Placeholder_Settlement.png");
}

.codex-placeholder-poi::before {
  background-image: url("../assets/placeholder/Placeholder_POI.png");
}

.codex-placeholder-region::before {
  background-image: url("../assets/placeholder/Placeholder_Region.png");
}

.codex-detail-meta {
  flex: 0 0 205px;

  display: grid;
  gap: 2px;

  align-self: center;

  text-align: left;

  margin:
    0
    30px
    10px
    0;
}

.codex-detail-overview-meta {
  margin: 0;
}

.codex-detail-meta p {
  margin: 0 0 4px;
}

.codex-detail-tag-row {
  display: grid;
  gap: 6px;
  margin: 0 0 6px;
}

.codex-detail-tag-row strong {
  display: block;
}

.codex-detail-meta h3 {
  margin-top: 18px;
}

.codex-detail-npc-panel {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;

  display: flex;
  flex-direction: column;

  align-self: flex-start;
}

.codex-detail-overview-side {
  align-self: stretch;
  padding-top: 8px;
  padding-left: 38px;
}

#codex-content .codex-detail-npc-panel h3,
#codex-content .codex-detail-overview-side h3 {
  flex: 0 0 auto;

  display: block;
  margin: 0 0 8px;
  padding: 0;

  font-size: 1.02rem;
}

.codex-overview-side-label {
  flex: 0 0 auto;
  margin: 0 0 5px;
  font-size: 1.02rem;
  line-height: 1.35;
}

.codex-detail-npc-panel .codex-record-button {
  padding: 8px 11px;
}

.codex-detail-npc-panel .codex-record-main {
  min-width: 0;
}

.codex-detail-npc-panel .codex-record-title,
.codex-detail-npc-panel .codex-record-meta {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.codex-detail-npc-panel .codex-record-title {
  font-size: 0.98rem;
}

.codex-detail-npc-panel .codex-record-meta {
  font-size: 0.88rem;
}

.codex-detail-upper-scrollbox {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 170px;

  overflow-y: auto;

  padding: 2px 8px 8px 0;
}

.codex-detail-upper-scrollbox .codex-linked-row-list {
  margin-bottom: 0;
}

.codex-detail-related-overview > .codex-detail-upper-scrollbox > p {
  margin: 0 0 6px;
  font-size: 0.96rem;
  line-height: 1.35;
}

.codex-detail-scroll-grid {
  flex: 0 0 auto;

  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.codex-detail-scroll-panel {
  min-height: 250px;
  max-height: 320px;

  display: flex;
  flex-direction: column;
}

.codex-detail-scroll-panel h3 {
  flex: 0 0 auto;
  margin-top: 0;
}

.codex-detail-scrollbox,
.codex-region-list-scrollbox {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 260px;

  overflow-y: auto;

  padding: 4px 12px 18px;
}

.codex-detail-scrollbox p {
  margin: 0;

  font-style: italic;
  font-size: 1.02rem;
  line-height: 1.9;
  letter-spacing: 0.01em;
}

#codex-content.codex-regions-index .codex-region-tile-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

#codex-content.codex-regions-index .codex-list-scroll-shell {
  display: block;
}

#codex-content.codex-regions-index .codex-region-index-section {
  display: none;
}

#codex-content.codex-regions-index .codex-region-index-section.active {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  height: 100%;
}

#codex-content.codex-regions-index .codex-region-index-section h3 {
  margin: 0 0 12px;
  padding: 0 0 8px;

  font-family: 'Marcellus SC', Georgia, serif;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

#codex-content.codex-regions-index .codex-region-index-section h3::after {
  content: "";
  display: block;
  width: min(72%, 360px);
  height: 1px;
  margin: 7px auto 0;
  background: linear-gradient(
    to right,
    transparent,
    rgba(72, 43, 18, 0.65),
    transparent
  );
}

#codex-content.codex-regions-index .codex-region-tile-grid {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 4px 18px;
}

#codex-content.codex-regions-index .codex-region-tile {
  transform: translateZ(0);
  backface-visibility: hidden;
}

#codex-content.codex-regions-index .codex-region-tile-hover {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;

  pointer-events: none;

  background: rgba(24, 13, 5, 0);

  transition: background 0.14s ease;

  -webkit-mask-image:
    linear-gradient(
      to right,
      transparent 0%,
      black 10%,
      black 90%,
      transparent 100%
    ),
    linear-gradient(
      to bottom,
      black 0%,
      black 50%,
      rgba(0, 0, 0, 0.24) 66%,
      transparent 78%,
      transparent 100%
    );
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(
      to right,
      transparent 0%,
      black 10%,
      black 90%,
      transparent 100%
    ),
    linear-gradient(
      to bottom,
      black 0%,
      black 50%,
      rgba(0, 0, 0, 0.24) 66%,
      transparent 78%,
      transparent 100%
    );
  mask-composite: intersect;
}

#codex-content.codex-regions-index .codex-region-tile-stroke {
  content: "";
  position: absolute;
  inset: 9px 9px auto;
  z-index: 2;
  height: calc(100% - 18px);
  border: 3px solid var(--codex-region-color, transparent);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  box-shadow:
    0 -1px 0 rgba(47, 29, 16, 0.16),
    -1px 0 0 rgba(47, 29, 16, 0.12),
    1px 0 0 rgba(47, 29, 16, 0.12);
  opacity: 0.88;
  pointer-events: none;

  -webkit-mask-image: linear-gradient(
    to bottom,
    black 0%,
    black 56%,
    rgba(0, 0, 0, 0.58) 72%,
    transparent 90%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    black 0%,
    black 56%,
    rgba(0, 0, 0, 0.58) 72%,
    transparent 90%,
    transparent 100%
  );
}

#codex-content.codex-regions-index .codex-region-tile:hover {
  transform: none;
}

#codex-content.codex-regions-index .codex-region-tile:hover .codex-region-tile-hover,
#codex-content.codex-regions-index .codex-region-tile:focus-visible .codex-region-tile-hover {
  background: rgba(24, 13, 5, 0.10);
}

#codex-content.codex-regions-index .codex-region-tile:active .codex-region-tile-hover {
  background: rgba(24, 13, 5, 0.18);
}

#codex-content.codex-regions-index .codex-region-tile-image {
  image-rendering: auto;
  transform: translateZ(0);
  backface-visibility: hidden;

  -webkit-mask-image:
    linear-gradient(
      to right,
      transparent 0%,
      rgba(0, 0, 0, 0.18) 4%,
      rgba(0, 0, 0, 0.78) 12%,
      black 22%,
      black 78%,
      rgba(0, 0, 0, 0.78) 88%,
      rgba(0, 0, 0, 0.18) 96%,
      transparent 100%
    ),
    linear-gradient(
      to bottom,
      transparent 0%,
      rgba(0, 0, 0, 0.18) 4%,
      rgba(0, 0, 0, 0.78) 12%,
      black 22%,
      black 50%,
      rgba(0, 0, 0, 0.24) 66%,
      transparent 78%,
      transparent 100%
    );
  -webkit-mask-composite: source-in;

  mask-image:
    linear-gradient(
      to right,
      transparent 0%,
      rgba(0, 0, 0, 0.18) 4%,
      rgba(0, 0, 0, 0.78) 12%,
      black 22%,
      black 78%,
      rgba(0, 0, 0, 0.78) 88%,
      rgba(0, 0, 0, 0.18) 96%,
      transparent 100%
    ),
    linear-gradient(
      to bottom,
      transparent 0%,
      rgba(0, 0, 0, 0.18) 4%,
      rgba(0, 0, 0, 0.78) 12%,
      black 22%,
      black 50%,
      rgba(0, 0, 0, 0.24) 66%,
      transparent 78%,
      transparent 100%
    );
  mask-composite: intersect;
}

#codex-content.codex-regions-index .codex-region-tile-info {
  z-index: 3;
  min-height: 33.333%;
  padding: 12px 14px 14px;

  background: transparent;
  border-top: 0;
  border-radius: 0;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;

  text-shadow:
    0 0 1px rgba(238, 211, 158, 1),
    0 0 2px rgba(238, 211, 158, 1),
    0 0 3px rgba(238, 211, 158, 1),
    0 0 5px rgba(238, 211, 158, 1),
    0 0 7px rgba(238, 211, 158, 1),
    0 0 10px rgba(238, 211, 158, 0.98),
    0 0 14px rgba(238, 211, 158, 0.92),
    0 0 19px rgba(238, 211, 158, 0.82),
    0 0 25px rgba(238, 211, 158, 0.66),
    0 1px 2px rgba(47, 29, 16, 0.52),
    0 2px 4px rgba(47, 29, 16, 0.42);
}

#codex-content.codex-regions-index .codex-region-tile-name,
#codex-content.codex-regions-index .codex-region-tile-details {
  font-weight: 700;
  -webkit-text-stroke: 1.35px rgba(238, 211, 158, 1);
  paint-order: stroke fill;
}

#codex-content.codex-regions-index .codex-region-tile-name {
  font-weight: 800;
}

/* =========================================================
   CODEX DETAIL PAGE TYPOGRAPHY
   ========================================================= */

#codex-content p {
  font-size: 1.08rem;
  line-height: 1.7;
}

/* Large lore/journal manuscript blocks */
#codex-content h3 + p {
  padding-left: 1.1em;

  font-style: italic;
  font-weight: 400;

  font-size: 1.02rem;
  line-height: 1.9;

  letter-spacing: 0.01em;
}

/* Slightly reduce metadata size */
#codex-content strong {
  font-size: 0.96em;
}

.codex-region-color-swatch {
  display: inline-block;
  width: 1.35em;
  height: 0.82em;
  border: 1px solid rgba(47, 29, 16, 0.42);
  border-radius: 999px;
  background: var(--codex-region-color);
  box-shadow:
    inset 0 0 0 1px rgba(255, 245, 210, 0.38),
    0 1px 2px rgba(47, 29, 16, 0.24);
  vertical-align: -0.08em;
}

.codex-region-color-none {
  opacity: 0.72;
}

@media (max-width: 700px) {
  #codex-content.codex-detail-page,
  #codex-content.codex-region-detail-page {
    overflow-y: auto;
  }

  .codex-detail-rail-page,
  .codex-detail-lower-pane {
    display: block;
    height: auto;
    overflow: visible;
  }

  .codex-detail-rail {
    display: none;
  }

  .codex-detail-rail-section {
    display: block;
    min-height: 0;
    margin-bottom: 24px;
  }

  .codex-detail-main {
    overflow: visible;
    padding: 0 0 24px;
  }

  .codex-detail-fixed,
  .codex-detail-fixed-poi,
  .codex-detail-fixed-region {
    flex-direction: column;
    display: flex;
    gap: 14px;
  }

  .codex-detail-overview-panel .codex-detail-fixed::before,
  .codex-detail-overview-panel .codex-detail-fixed::after {
    display: none;
  }

  .codex-detail-overview-side {
    padding-left: 0;
  }

  .codex-detail-portrait-slot {
    width: 220px;
    height: 220px;
    margin: 0 auto;
  }

  .codex-detail-meta {
    width: 100%;
    text-align: center;
    margin: 0;
  }
}

/* =========================================================
   DESKTOP DETAIL NORMALIZATION
   ========================================================= */

@media (min-width: 1100px) and (min-height: 700px) {
  #codex-content.codex-detail-page .codex-detail-overview-panel .codex-detail-fixed,
  #codex-content.codex-detail-page .codex-detail-overview-panel .codex-detail-fixed-poi,
  #codex-content.codex-detail-page .codex-detail-overview-panel .codex-detail-fixed-region {
    display: grid;
    grid-template-columns: minmax(190px, 1fr) minmax(205px, 1fr);
    align-items: center;
    justify-content: center;
    justify-items: stretch;
    gap: 18px;

    width: min(100%, 560px);
    margin: 0 auto;
    padding: 8px 0;
  }

  #codex-content.codex-detail-page .codex-detail-overview-panel .codex-detail-fixed::before,
  #codex-content.codex-detail-page .codex-detail-overview-panel .codex-detail-fixed::after,
  #codex-content.codex-detail-page .codex-detail-overview-panel .codex-detail-fixed-poi::before,
  #codex-content.codex-detail-page .codex-detail-overview-panel .codex-detail-fixed-poi::after,
  #codex-content.codex-detail-page .codex-detail-overview-panel .codex-detail-fixed-region::before,
  #codex-content.codex-detail-page .codex-detail-overview-panel .codex-detail-fixed-region::after {
    display: none !important;
    content: none !important;
  }

  #codex-content.codex-detail-page .codex-detail-overview-panel .codex-detail-portrait-slot {
    justify-self: end;
    align-self: center;
    margin: 0;
  }

  #codex-content.codex-detail-page .codex-detail-overview-panel .codex-detail-meta {
    justify-self: start;
    align-self: center;
    width: 100%;
    min-width: 0;
    max-width: 235px;
    flex: initial;
    margin: 0;
    text-align: left;
  }

  #codex-content.codex-hex-detail-page .codex-detail-overview-panel .codex-detail-overview-meta {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 28px;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 16px 2px 14px;
    text-align: left;
  }

  #codex-content.codex-hex-detail-page .codex-detail-overview-panel .codex-detail-overview-meta p:first-child {
    margin: 0;
    text-align: left;
  }

  #codex-content.codex-hex-detail-page .codex-detail-overview-panel .codex-detail-overview-meta p:last-child {
    margin: 0;
    text-align: right;
  }

  #codex-content.codex-hex-detail-page .codex-detail-overview-panel .codex-detail-overview-meta .codex-link-button {
    margin: 0;
    padding: 0;
    display: inline;
    font: inherit;
    line-height: inherit;
    vertical-align: baseline;
  }

  #codex-content.codex-detail-page .codex-detail-main {
    overflow: hidden;
    padding: 0 12px 0 2px;
    -webkit-mask-image: none;
    mask-image: none;
  }

  #codex-content.codex-detail-page .codex-detail-rail-section {
    display: none;
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  #codex-content.codex-detail-page .codex-detail-rail-section.active {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
  }

  #codex-content.codex-detail-page .codex-detail-rail-section > h3 {
    margin: 0;
    padding: 12px 0 8px;
    text-align: center;
    font-size: 1.05rem;
  }

  #codex-content.codex-detail-page .codex-detail-rail-section > h3::after {
    content: "";
    display: block;
    width: min(72%, 360px);
    height: 1px;
    margin: 7px auto 0;
    background: linear-gradient(
      to right,
      transparent,
      rgba(72, 43, 18, 0.65),
      transparent
    );
  }

  #codex-content.codex-detail-page .codex-detail-rail-section-content {
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 0 18px;
    -webkit-overflow-scrolling: touch;

    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 16px, #000 calc(100% - 18px), transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0, #000 16px, #000 calc(100% - 18px), transparent 100%);
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
  }
}
