/* Extracted from styles.css during client modularization. */
/* Load order matters; keep this file in the same relative position. */

/* Archives view */
#view-archives main{
  --archives-reader-viewport-offset: 6.2rem;
  max-width: none;
  width: 100%;
  padding: 0.72rem 0.85rem 0;
  overflow: hidden;
}

#view-archives .archives-reader{
  --archives-scene-bg: none;
  --archives-roll-highlight-bg: none;
  --archives-reader-inline-pad: 0.92rem;
  --archives-thread-inline-pad: 0.24rem;
  --archives-entry-bleed: calc(var(--archives-reader-inline-pad) + var(--archives-thread-inline-pad));
  margin: 0;
  min-height: calc(100vh - var(--archives-reader-viewport-offset));
  height: calc(100dvh - var(--archives-reader-viewport-offset));
  max-height: calc(100dvh - var(--archives-reader-viewport-offset));
  padding: 0.88rem var(--archives-reader-inline-pad) 0.96rem;
  border-radius: 1rem;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  overflow: hidden;
}

#view-archives .archives-reader.is-hidden-by-browse{
  display: none !important;
}

#view-archives .archives-reader::before{
  background-image:
    var(--archives-scene-bg),
    radial-gradient(1100px 740px at 50% 32%, rgba(255, 255, 255, 0.24), rgba(0, 0, 0, 0.10) 68%),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.14), rgba(0, 0, 0, 0.04));
  background-size: cover, auto, auto;
  background-position: center, center, center;
  background-repeat: no-repeat, no-repeat, no-repeat;
  background-attachment: fixed, scroll, scroll;
  filter: brightness(0.82);
  opacity: 0.26;
}

#view-archives .archives-reader.has-scene-bg::before{
  opacity: 0.96;
}

#view-archives .archives-roll-highlight-layer{
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transform: scale(1.05);
  filter: brightness(0.6) saturate(1.08) contrast(1.02) blur(2px);
  background-image:
    linear-gradient(to bottom, rgba(245, 235, 214, 0.08), rgba(47, 31, 18, 0.18)),
    var(--archives-roll-highlight-bg);
  background-size: auto, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
  background-attachment: scroll, fixed;
  transition: opacity 1200ms ease, transform 1800ms ease, filter 1800ms ease;
}

#view-archives .archives-roll-highlight-layer.is-active{
  opacity: 0.82;
  transform: scale(1);
  filter: brightness(0.74) saturate(1.08) contrast(1.02) blur(0);
}

#view-archives .archives-reader::after{
  background:
    linear-gradient(to bottom, rgba(244, 235, 214, 0.14), rgba(72, 50, 29, 0.10)),
    radial-gradient(860px 430px at 50% 120%, rgba(0, 0, 0, 0.12), transparent 74%);
  mix-blend-mode: multiply;
  opacity: 0.34;
}

#view-archives .archives-head{
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.2rem 0.18rem 0.32rem;
  border-bottom: 1px solid rgba(122, 78, 42, 0.35);
}

#view-archives .archives-scene-controls-toggle-btn{
  display: none;
  margin-left: auto;
  width: 2.64rem;
  height: 2.64rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 245, 220, 0.36);
  background: rgba(12, 10, 8, 0.72);
  color: rgba(255, 255, 255, 0.96);
  font-size: 1.34rem;
  line-height: 1;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(10px);
  z-index: 6;
}

#view-archives .archives-scene-controls-toggle-btn:hover{
  border-color: rgba(255, 245, 220, 0.54);
  background: rgba(12, 10, 8, 0.82);
}

#view-archives .archives-scene-controls-toggle-btn[aria-expanded="true"]{
  border-color: rgba(236, 205, 146, 0.64);
  background: rgba(64, 42, 22, 0.84);
  color: rgba(255, 248, 233, 0.98);
}

#view-archives .archives-scene-controls-toggle-icon{
  transform: translateY(-1px);
  pointer-events: none;
}

#view-archives .archives-jump{
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 0.38rem;
  flex: 0 0 auto;
}

#view-archives #archives-scene-jump{
  width: 7.8rem;
  min-height: 2rem;
  text-align: center;
}

#view-archives .archives-title-wrap{
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  gap: 0.12rem;
  text-align: center;
  min-width: 0;
  max-width: min(56%, 760px);
  width: max-content;
  padding: 0.56rem 1rem 0.48rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0.78rem;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.76), rgba(0, 0, 0, 0.5));
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(10px);
  pointer-events: none;
}

#view-archives .archives-title{
  font-size: 1.32rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.98);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.48);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#view-archives .archives-order{
  margin-top: 0;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 245, 220, 0.74);
}

#view-archives .archives-order:empty{
  display: none;
}

#view-archives .archives-nav{
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  position: relative;
  margin-left: auto;
  flex: 0 0 auto;
  z-index: 1;
}

#view-archives .archives-nav-btn{
  width: 2.02rem;
  height: 2.02rem;
  border-radius: 0.54rem;
  border: 1px solid rgba(122, 78, 42, 0.74);
  background: linear-gradient(to bottom, rgba(246, 237, 216, 0.95), rgba(234, 214, 178, 0.9));
  color: rgba(33, 29, 23, 0.96);
  font-size: 1.04rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

#view-archives .archives-nav-btn:hover{
  border-color: rgba(122, 78, 42, 0.94);
}

#view-archives .archives-browse-btn{
  min-width: 7.8rem;
  height: 2.02rem;
  padding: 0 0.72rem;
  border-radius: 0.54rem;
  border: 1px solid rgba(122, 78, 42, 0.74);
  background: linear-gradient(to bottom, rgba(246, 237, 216, 0.95), rgba(234, 214, 178, 0.9));
  color: rgba(33, 29, 23, 0.96);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

#view-archives .archives-browse-btn:hover{
  border-color: rgba(122, 78, 42, 0.94);
}

#view-archives .archives-browse-btn[aria-pressed="true"]{
  background: linear-gradient(to bottom, rgba(232, 215, 183, 0.96), rgba(221, 197, 159, 0.92));
  color: rgba(58, 42, 25, 0.92);
}

#view-archives .archives-browse-btn:disabled{
  cursor: wait;
  opacity: 0.7;
}

#view-archives .archives-nav-btn:disabled{
  cursor: wait;
  opacity: 0.62;
}

#view-archives .archives-audio-settings{
  position: relative;
  pointer-events: auto;
}

#view-archives .archives-audio-settings-btn{
  width: 1.96rem;
  height: 1.96rem;
  border-radius: 999px;
  border: 1px solid rgba(122, 78, 42, 0.62);
  background: rgba(255, 255, 255, 0.6);
  color: rgba(47, 42, 34, 0.82);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
}

#view-archives .archives-audio-settings-btn:hover{
  border-color: rgba(122, 78, 42, 0.9);
}

#view-archives .archives-header-toggle-btn{
  width: 1.96rem;
  height: 1.96rem;
  border-radius: 999px;
  border: 1px solid rgba(122, 78, 42, 0.62);
  background: rgba(255, 255, 255, 0.6);
  color: rgba(47, 42, 34, 0.82);
  font-size: 0.96rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#view-archives .archives-header-toggle-btn:hover{
  border-color: rgba(122, 78, 42, 0.9);
}

#view-archives .archives-header-toggle-btn[aria-pressed="true"]{
  background: rgba(243, 230, 201, 0.88);
  color: rgba(67, 50, 33, 0.9);
}

#view-archives .archives-audio-settings-popover{
  position: absolute;
  top: calc(100% + 0.32rem);
  right: 0;
  min-width: 210px;
  border-radius: 0.62rem;
  border: 1px solid rgba(122, 78, 42, 0.52);
  background:
    linear-gradient(to bottom, rgba(249, 242, 224, 0.96), rgba(240, 226, 195, 0.92));
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
  padding: 0.44rem 0.52rem 0.5rem;
  display: grid;
  gap: 0.32rem;
  z-index: 7;
  pointer-events: auto;
}

#view-archives .archives-audio-settings-popover *{
  pointer-events: auto;
}

#view-archives .archives-audio-settings-popover[hidden]{
  display: none;
}

#view-archives .archives-audio-setting-row{
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(47, 42, 34, 0.8);
}

#view-archives .archives-audio-setting-row input[type="checkbox"]{
  width: 0.95rem;
  height: 0.95rem;
  accent-color: rgba(122, 78, 42, 0.9);
}

#view-archives .archives-audio-setting-row input[type="range"]{
  grid-column: 1 / -1;
  width: 100%;
  accent-color: rgba(122, 78, 42, 0.9);
}

#view-archives .archives-audio-setting-volume{
  grid-template-columns: minmax(0, 1fr);
}

#view-archives .archives-status{
  position: relative;
  z-index: 3;
  font-size: 0.78rem;
  color: rgba(47, 42, 34, 0.86);
}

#view-archives .archives-status:empty{
  display: none;
}

#view-archives .archives-status:not(:empty){
  min-height: 1.1rem;
}

#view-archives .archives-status[data-tone="error"]{
  color: rgba(145, 34, 30, 0.94);
}

#view-archives .archives-browse-page{
  margin: 0;
  min-height: calc(100vh - var(--archives-reader-viewport-offset));
  height: calc(100dvh - var(--archives-reader-viewport-offset));
  max-height: calc(100dvh - var(--archives-reader-viewport-offset));
  padding: 0.88rem 0.92rem 0.96rem;
  border-radius: 1rem;
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 0.62rem;
  background:
    linear-gradient(180deg, rgba(198, 176, 139, 0.96), rgba(160, 132, 94, 0.94)),
    var(--paper-bg-0);
  border: 1px solid rgba(92, 60, 31, 0.46);
}

#view-archives .archives-browse-page[hidden]{
  display: none;
}

#view-archives .archives-browse-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.16rem 0.12rem 0.34rem;
  border-bottom: 1px solid rgba(122, 78, 42, 0.35);
}

#view-archives .archives-browse-title-wrap{
  min-width: 0;
}

#view-archives .archives-browse-title{
  font-size: 1rem;
  letter-spacing: 0.04em;
  color: rgba(29, 23, 17, 0.95);
  text-transform: uppercase;
}

#view-archives .archives-browse-subtitle{
  margin-top: 0.06rem;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(61, 50, 35, 0.75);
}

#view-archives .archives-browse-back-btn{
  min-width: 8rem;
  height: 2.02rem;
  padding: 0 0.72rem;
  border-radius: 0.54rem;
  border: 1px solid rgba(122, 78, 42, 0.74);
  background: linear-gradient(to bottom, rgba(246, 237, 216, 0.95), rgba(234, 214, 178, 0.9));
  color: rgba(33, 29, 23, 0.96);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

#view-archives .archives-browse-back-btn:hover{
  border-color: rgba(122, 78, 42, 0.94);
}

#view-archives .archives-browse-back-btn:disabled{
  cursor: wait;
  opacity: 0.7;
}

#view-archives .archives-browse-status{
  font-size: 0.78rem;
  color: rgba(47, 42, 34, 0.86);
  padding: 0 0.12rem;
}

#view-archives .archives-browse-status:empty{
  display: none;
}

#view-archives .archives-browse-status:not(:empty){
  min-height: 1.1rem;
}

#view-archives .archives-browse-status[data-tone="error"]{
  color: rgba(145, 34, 30, 0.94);
}

#view-archives .archives-browse-filters{
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.52rem;
}

#view-archives .archives-browse-filter{
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.24rem;
}

#view-archives .archives-browse-filter span{
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(47, 42, 34, 0.78);
}

#view-archives .archives-browse-filter select{
  min-height: 2rem;
  border-radius: 0.44rem;
}

#view-archives .archives-browse-filter select.is-locked{
  color: rgba(92, 92, 92, 0.92);
  background: rgba(198, 196, 188, 0.58);
  border-color: rgba(124, 122, 116, 0.52);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#view-archives .archives-browse-filter-progress{
  align-content: end;
}

#view-archives .archives-browse-check{
  min-height: 2rem;
  display: inline-flex;
  align-items: center;
  gap: 0.46rem;
  border: 1px solid rgba(122, 78, 42, 0.42);
  background: rgba(255, 246, 224, 0.62);
  padding: 0 0.58rem;
  font-size: 0.8rem;
  color: rgba(41, 33, 25, 0.92);
}

#view-archives .archives-browse-check input[type="checkbox"]{
  width: 0.94rem;
  height: 0.94rem;
  accent-color: rgba(122, 78, 42, 0.9);
}

#view-archives .archives-browse-grid{
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.62rem;
  padding: 0.38rem 0.38rem 0.42rem;
  background:
    linear-gradient(180deg, rgba(58, 43, 27, 0.34), rgba(45, 33, 21, 0.28)),
    var(--paper-bg-0);
  border: 1px solid rgba(77, 53, 31, 0.44);
  box-shadow: inset 0 1px 0 rgba(255, 240, 209, 0.15);
}

#view-archives .archives-browse-empty{
  grid-column: 1 / -1;
  border-radius: 0.62rem;
  border: 1px solid rgba(122, 78, 42, 0.38);
  background: rgba(245, 233, 203, 0.68);
  color: rgba(47, 42, 34, 0.82);
  padding: 0.68rem 0.76rem;
  font-size: 0.84rem;
}

#view-archives .archives-browse-card{
  --archives-browse-bg: none;
  position: relative;
  border-radius: 0;
  border: 1px solid rgba(122, 78, 42, 0.56);
  min-height: 186px;
  padding: 0.7rem 0.74rem;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  color: rgba(250, 244, 231, 0.98);
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.44), rgba(0, 0, 0, 0.66)),
    var(--archives-browse-bg);
  background-size: cover;
  background-position: center;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
}

#view-archives .archives-browse-card.is-show-progress{
  border-color: var(--archives-progress-color, rgba(33, 29, 23, 0.82));
  box-shadow:
    0 0 0 1px var(--archives-progress-color, rgba(33, 29, 23, 0.82)),
    0 0 22px 2px var(--archives-progress-glow, rgba(33, 29, 23, 0.34)),
    0 12px 28px rgba(0, 0, 0, 0.2);
}

#view-archives .archives-browse-card.is-show-progress[data-progress-state="1"]{
  --archives-progress-color: rgba(145, 34, 30, 0.98);
  --archives-progress-glow: rgba(191, 49, 39, 0.38);
}

#view-archives .archives-browse-card.is-show-progress[data-progress-state="2"]{
  --archives-progress-color: rgba(174, 95, 20, 0.98);
  --archives-progress-glow: rgba(224, 130, 34, 0.36);
}

#view-archives .archives-browse-card.is-show-progress[data-progress-state="3"]{
  --archives-progress-color: rgba(178, 142, 18, 0.98);
  --archives-progress-glow: rgba(230, 194, 36, 0.34);
}

#view-archives .archives-browse-card.is-show-progress[data-progress-state="4"]{
  --archives-progress-color: rgba(124, 148, 28, 0.98);
  --archives-progress-glow: rgba(166, 194, 44, 0.34);
}

#view-archives .archives-browse-card.is-show-progress[data-progress-state="5"]{
  --archives-progress-color: rgba(38, 84, 170, 0.98);
  --archives-progress-glow: rgba(72, 132, 214, 0.34);
}

#view-archives .archives-browse-card::before{
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 0;
  background:
    linear-gradient(to top, rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0.14) 52%, rgba(0, 0, 0, 0.52) 100%);
  pointer-events: none;
}

#view-archives .archives-browse-card > *{
  position: relative;
  z-index: 1;
}

#view-archives .archives-browse-card-head{
  display: grid;
  gap: 0.22rem;
}

#view-archives .archives-browse-card-order{
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(240, 225, 195, 0.92);
}

#view-archives .archives-browse-card-title{
  font-size: 0.98rem;
  line-height: 1.2;
  font-weight: 700;
  text-wrap: balance;
}

#view-archives .archives-browse-card-summary{
  margin-top: 0.38rem;
  font-size: 0.82rem;
  line-height: 1.4;
  color: rgba(245, 236, 216, 0.88);
  max-height: 5.68em;
  overflow: hidden;
  text-overflow: ellipsis;
}

#view-archives .archives-browse-card-hover{
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 0;
  padding: 0.52rem 0.62rem 0.58rem;
  background: linear-gradient(to top, rgba(20, 16, 12, 0.92), rgba(20, 16, 12, 0.72));
  transform: translateY(102%);
  opacity: 0;
  transition: transform 160ms ease, opacity 160ms ease;
  pointer-events: none;
}

#view-archives .archives-browse-card:hover .archives-browse-card-hover,
#view-archives .archives-browse-card:focus-visible .archives-browse-card-hover{
  transform: translateY(0);
  opacity: 1;
}

#view-archives .archives-browse-card-meta-row{
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.36rem;
  align-items: baseline;
  font-size: 0.72rem;
}

#view-archives .archives-browse-card-meta-row + .archives-browse-card-meta-row{
  margin-top: 0.26rem;
}

#view-archives .archives-browse-card-meta-label{
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(231, 200, 147, 0.9);
}

#view-archives .archives-browse-card-meta-value{
  color: rgba(247, 239, 222, 0.95);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#view-archives .archives-thread{
  position: relative;
  z-index: 2;
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 0.26rem var(--archives-thread-inline-pad) 0.3rem;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

#view-archives .archives-reader.has-scene-end-reserve .archives-thread{
  padding-bottom: max(0.3rem, var(--archives-next-scene-reserve, 0px));
}

#view-archives .archives-roll-overlay{
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  overflow: hidden;
  transition: opacity 180ms ease;
}

#view-archives .archives-roll-overlay.is-active{
  opacity: 1;
}

#view-archives .archives-roll-overlay-canvas{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#view-archives .archives-roll-overlay-canvas canvas{
  width: 100% !important;
  height: 100% !important;
  display: block;
}

#view-archives .archives-thread::-webkit-scrollbar{
  width: 0;
  height: 0;
  display: none;
}

#view-archives .archives-next-scene-prompt{
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 0.82rem;
  width: min(calc(100% - 1.5rem), 34rem);
  max-width: min(calc(100% - 1.5rem), 34rem);
  padding: 0.72rem 0.82rem;
  border: 1px solid rgba(255, 245, 220, 0.18);
  border-radius: 0.88rem;
  background:
    linear-gradient(180deg, rgba(19, 15, 11, 0.84), rgba(35, 25, 16, 0.76));
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
  transform: translate(-50%, calc(-50% + 1.1rem));
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease, transform 260ms ease;
}

#view-archives .archives-next-scene-prompt.is-visible{
  opacity: 1;
  transform: translate(-50%, -50%);
  pointer-events: auto;
}

#view-archives .archives-next-scene-prompt-copy{
  min-width: 0;
  display: grid;
  gap: 0.14rem;
}

#view-archives .archives-next-scene-prompt-label{
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(237, 209, 154, 0.82);
}

#view-archives .archives-next-scene-prompt-title{
  min-width: 0;
  font-size: 0.94rem;
  font-weight: 600;
  line-height: 1.2;
  color: rgba(255, 248, 238, 0.98);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#view-archives .archives-next-scene-prompt-btn{
  flex: 0 0 auto;
  min-width: 8.2rem;
  height: 2.1rem;
  padding: 0 0.88rem;
  border-radius: 999px;
  border: 1px solid rgba(212, 174, 111, 0.72);
  background:
    linear-gradient(180deg, rgba(247, 235, 210, 0.96), rgba(231, 206, 161, 0.9));
  color: rgba(39, 29, 19, 0.96);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
  cursor: pointer;
}

#view-archives .archives-next-scene-prompt-btn:hover{
  border-color: rgba(223, 190, 132, 0.9);
}

#view-archives .archives-next-scene-prompt-btn:disabled{
  cursor: wait;
  opacity: 0.7;
}

#view-archives .archives-entry{
  --archives-focus-strength: 1;
  width: 100%;
  opacity: calc(0.18 + (var(--archives-focus-strength) * 0.82));
  filter: blur(calc((1 - var(--archives-focus-strength)) * 10px));
  transition: opacity 220ms ease, filter 320ms ease;
}

#view-archives .archives-entry.is-focus-active{
  z-index: 1;
}

#view-archives .archives-entry--speech{
  display: flex;
}

#view-archives .archives-entry--speech.archives-entry--right{
  justify-content: flex-end;
}

#view-archives .archives-entry--speech.archives-entry--left{
  justify-content: flex-start;
}

#view-archives .archives-speech-wrap{
  display: flex;
  align-items: flex-end;
  gap: 0.62rem;
  max-width: min(88%, 860px);
}

#view-archives .archives-entry--right .archives-speech-wrap{
  flex-direction: row-reverse;
}

#view-archives .archives-avatar{
  width: 56px;
  height: 56px;
  border-radius: 999px;
  object-fit: cover;
  border: 2px solid rgba(122, 78, 42, 0.72);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.15);
  flex: 0 0 auto;
}

#view-archives .archives-speech-stack{
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

#view-archives .archives-entry--right .archives-speech-stack{
  align-items: flex-end;
}

#view-archives .archives-character-name{
  font-size: 0.74rem;
  color: rgba(70, 65, 58, 0.82);
}

#view-archives .archives-bubble{
  border-radius: 0;
  border: 0;
  background: transparent;
  color: rgba(26, 23, 18, 0.95);
  padding: 0.58rem 0.8rem;
  white-space: pre-wrap;
  word-break: normal;
  overflow-wrap: break-word;
  box-shadow: none;
  position: relative;
}

#view-archives .archives-bubble::before,
#view-archives .archives-bubble::after{
  pointer-events: none;
}

#view-archives .archives-bubble::before{
  content: none;
  display: none;
}

#view-archives .archives-bubble::after{
  content: attr(data-character-name);
  position: absolute;
  top: 0;
  left: 0.72rem;
  padding: 0.24rem 0.5rem;
  border-radius: 999px;
  background: rgba(8, 7, 6, 0.84);
  color: rgba(255, 255, 255, 0.96);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
  transform: translateY(calc(-100% - 0.45rem));
  opacity: 0;
  transition: opacity 140ms ease, transform 140ms ease;
}

#view-archives .archives-speech-wrap:hover .archives-bubble[data-character-name]::after{
  opacity: 1;
  transform: translateY(calc(-100% - 0.6rem));
}

#view-archives .archives-entry--right .archives-bubble{
  background:
    linear-gradient(
      270deg,
      rgba(248, 236, 206, 0.84) 0%,
      rgba(248, 236, 206, 0.78) 36%,
      rgba(248, 236, 206, 0.72) 72%,
      rgba(248, 236, 206, 0.64) 100%
    );
}

#view-archives .archives-entry--left .archives-bubble{
  background:
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.85) 0%,
      rgba(255, 255, 255, 0.79) 36%,
      rgba(255, 255, 255, 0.73) 72%,
      rgba(255, 255, 255, 0.66) 100%
    );
}

#view-archives .archives-entry--right .archives-bubble::after{
  left: auto;
  right: 0.72rem;
}

#view-archives .archives-entry--narrator{
  display: flex;
  justify-content: center;
}

#view-archives .archives-narrator{
  width: auto;
  max-width: min(72%, 760px);
  text-align: center;
  font-style: italic;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.95);
  background: rgba(0, 0, 0, 0.51);
  border-radius: 0.42rem;
  padding: 0.3rem 0.7rem;
  box-sizing: border-box;
  overflow-wrap: anywhere;
}

#view-archives .archives-entry--media{
  display: flex;
  justify-content: center;
}

#view-archives .archives-entry--music{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.18rem;
}

#view-archives .archives-music-title{
  max-width: min(76%, 620px);
  text-align: center;
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(47, 42, 34, 0.68);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#view-archives .archives-music-body{
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.08rem 0 0.14rem;
  font-size: 0.84rem;
  color: rgba(47, 42, 34, 0.74);
}

#view-archives .archives-media-card{
  width: min(84%, 860px);
  border-radius: 0.72rem;
  border: 1px solid rgba(122, 78, 42, 0.56);
  background: rgba(245, 233, 203, 0.78);
  padding: 0.52rem 0.6rem 0.56rem;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

#view-archives .archives-media-meta{
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(47, 42, 34, 0.72);
  margin-bottom: 0.36rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#view-archives .archives-media-icon{
  font-size: 0.86rem;
  color: rgba(122, 78, 42, 0.86);
}

#view-archives .archives-media-label{
  opacity: 0.84;
}

#view-archives .archives-media-name{
  font-weight: 700;
  letter-spacing: 0.05em;
  color: rgba(33, 29, 23, 0.9);
}

#view-archives .archives-media-body{
  font-size: 0.9rem;
  color: rgba(33, 29, 23, 0.9);
}

#view-archives .archives-image-body{
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

#view-archives .archives-image-fallback{
  max-width: min(100%, 34rem);
  text-align: center;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
}

#view-archives .archives-audio{
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

#view-archives .archives-music-center{
  width: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

#view-archives .archives-music-toggle{
  width: 4.05rem;
  height: 4.05rem;
  border-radius: 999px;
  border: 1px solid rgba(122, 78, 42, 0.64);
  background:
    radial-gradient(140% 110% at 22% 14%, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0)),
    rgba(248, 239, 217, 0.92);
  color: rgba(34, 30, 24, 0.95);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.14);
}

#view-archives .archives-music-toggle:hover{
  border-color: rgba(122, 78, 42, 0.92);
}

#view-archives .archives-music-toggle.is-playing{
  background:
    radial-gradient(140% 110% at 22% 14%, rgba(255, 255, 255, 0.54), rgba(255, 255, 255, 0)),
    rgba(238, 222, 187, 0.96);
}

#view-archives .archives-music-toggle-icon{
  font-size: 1.54rem;
  line-height: 1;
  transform: translateX(1px);
}

#view-archives .archives-music-toggle.is-playing .archives-music-toggle-icon{
  transform: none;
}

#view-archives .archives-entry--roll{
  display: flex;
  justify-content: center;
  opacity: calc(var(--archives-focus-strength) * var(--archives-focus-strength));
  filter: blur(calc((1 - var(--archives-focus-strength)) * 18px));
}

#view-archives .archives-roll-card{
  --archives-roll-bg: none;
  width: auto;
  max-width: min(78%, 760px);
  min-width: min(18rem, 100%);
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: grid;
  gap: 0.22rem;
  border-radius: 0.62rem;
  border: 1px solid rgba(122, 78, 42, 0.28);
  background:
    linear-gradient(180deg, rgba(249, 242, 228, 0.92), rgba(239, 227, 199, 0.82));
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.16);
  padding: 0.56rem 0.82rem 0.68rem;
  text-align: center;
}

#view-archives .archives-roll-card::before{
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image: var(--archives-roll-bg);
  background-size: cover;
  background-position: center 18%;
  background-repeat: no-repeat;
  opacity: 0;
  filter: saturate(1.02) contrast(1.04) brightness(0.84);
  transform: scale(1.04);
  transition: opacity 140ms ease;
}

#view-archives .archives-roll-card::after{
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(140% 120% at 50% -10%, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0) 58%),
    linear-gradient(180deg, rgba(250, 244, 232, 0.9), rgba(238, 227, 201, 0.72)),
    rgba(246, 237, 217, 0.3);
}

#view-archives .archives-roll-card.has-character-portrait::before{
  opacity: 0.82;
}

#view-archives .archives-roll-card.has-character-portrait::after{
  background:
    radial-gradient(120% 110% at 50% 0%, rgba(255, 255, 255, 0.56), rgba(255, 255, 255, 0) 54%),
    linear-gradient(180deg, rgba(249, 242, 230, 0.68), rgba(236, 224, 193, 0.36)),
    linear-gradient(180deg, rgba(17, 13, 9, 0.08), rgba(17, 13, 9, 0.28));
}

#view-archives .archives-roll-card > *{
  position: relative;
  z-index: 1;
}

#view-archives .archives-roll-character{
  justify-self: center;
  max-width: 100%;
  padding: 0.22rem 0.74rem 0.26rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(34, 27, 20, 0.5);
  color: rgba(255, 248, 239, 0.96);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.2;
  backdrop-filter: blur(6px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.32);
}

#view-archives .archives-roll-head{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.34rem;
  max-width: 100%;
}

#view-archives .archives-roll-icon{
  width: auto;
  height: auto;
  border-radius: 0;
  border: 0;
  background: transparent;
  color: rgba(122, 78, 42, 0.82);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
}

#view-archives .archives-roll-title{
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(47, 42, 34, 0.74);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#view-archives .archives-roll-content{
  position: relative;
  display: grid;
  place-items: center;
  min-height: clamp(4.95rem, 7.1vw, 5.8rem);
  padding: 0.18rem 0 0.06rem;
}

#view-archives .archives-roll-body{
  grid-area: 1 / 1;
  width: 100%;
  margin-top: 0;
  display: grid;
  gap: 0.1rem;
  justify-items: center;
  align-content: center;
  align-self: stretch;
  transition: opacity 220ms ease, transform 220ms ease, filter 220ms ease;
}

#view-archives .archives-roll-body[hidden],
#view-archives .archives-roll-overlay[hidden],
#view-archives .archives-roll-stage[hidden],
#view-archives .archives-roll-stage-canvas[hidden],
#view-archives .archives-roll-stage-status[hidden],
#view-archives .archives-roll-reveal[hidden]{
  display: none !important;
}

#view-archives .archives-entry--roll[data-roll-state="ready"] .archives-roll-body,
#view-archives .archives-entry--roll[data-roll-state="rolling"] .archives-roll-body{
  opacity: 0;
  transform: translateY(0.18rem) scale(0.985);
  filter: blur(42px);
  pointer-events: none;
}

#view-archives .archives-entry--roll[data-roll-state="revealed"] .archives-roll-body,
#view-archives .archives-entry--roll[data-roll-state="complete"] .archives-roll-body{
  opacity: 1;
  transform: none;
  filter: none;
}

#view-archives .archives-roll-stage{
  grid-area: 1 / 1;
  position: relative;
  width: 100%;
  min-height: 100%;
  margin: 0;
  display: grid;
  place-items: center;
  overflow: visible;
}

#view-archives .archives-entry--roll[data-roll-state="revealed"] .archives-roll-stage,
#view-archives .archives-entry--roll[data-roll-state="complete"] .archives-roll-stage{
  display: none;
}

#view-archives .archives-roll-stage::before{
  content: none;
}

#view-archives .archives-roll-stage-canvas{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#view-archives .archives-roll-stage-canvas canvas{
  width: 100% !important;
  height: 100% !important;
  display: block;
}

#view-archives .archives-roll-stage-status{
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 0;
  color: rgba(82, 64, 38, 0.72);
  font-size: clamp(0.9rem, 1.8vw, 1.06rem);
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-align: center;
  text-shadow:
    0 1px 0 rgba(255, 252, 245, 0.72),
    0 8px 24px rgba(248, 229, 187, 0.34);
}

#view-archives .archives-roll-reveal{
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 0 1rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(47, 35, 22, 0.95);
  font-size: clamp(1.05rem, 2.4vw, 1.34rem);
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  text-shadow:
    0 1px 0 rgba(255, 252, 245, 0.7),
    0 10px 28px rgba(248, 229, 187, 0.44);
  cursor: pointer;
  transition: letter-spacing 180ms ease, opacity 180ms ease, text-shadow 180ms ease;
}

#view-archives .archives-roll-reveal:hover:not(:disabled){
  letter-spacing: 0.28em;
  text-shadow:
    0 1px 0 rgba(255, 252, 245, 0.76),
    0 12px 34px rgba(248, 229, 187, 0.54);
}

#view-archives .archives-roll-reveal:disabled{
  opacity: 0.52;
  cursor: default;
  text-shadow:
    0 1px 0 rgba(255, 252, 245, 0.45),
    0 8px 22px rgba(248, 229, 187, 0.28);
}

#view-archives .archives-roll-total{
  font-size: 1.5rem;
  font-weight: 700;
  color: rgba(29, 25, 20, 0.96);
  line-height: 1.05;
}

#view-archives .archives-roll-total--natural{
  font-size: clamp(2rem, 4vw, 2.7rem);
  letter-spacing: 0.16em;
  line-height: 1;
  text-transform: uppercase;
}

#view-archives .archives-entry--roll[data-natural-roll="20"] .archives-roll-total--natural{
  color: rgba(161, 116, 32, 0.98);
  text-shadow:
    0 1px 0 rgba(255, 247, 211, 0.88),
    0 12px 26px rgba(201, 157, 72, 0.28);
}

#view-archives .archives-entry--roll[data-natural-roll="1"] .archives-roll-total--natural{
  color: rgba(111, 52, 39, 0.96);
  text-shadow:
    0 1px 0 rgba(255, 233, 225, 0.7),
    0 10px 22px rgba(122, 64, 46, 0.18);
}

#view-archives .archives-roll-expression{
  max-width: 100%;
  font-size: 0.9rem;
  color: rgba(57, 50, 42, 0.78);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

#view-archives .archives-image{
  width: min(100%, 720px);
  max-height: 72vh;
  border-radius: 0;
  border: none;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  background: transparent;
}

@media (max-width: 1600px){
  #view-archives main{
    --archives-reader-viewport-offset: 5.8rem;
    padding: 0.6rem 0.62rem 0;
  }

  #view-archives .archives-scene-controls-toggle-btn{
    display: inline-flex;
    position: absolute;
    top: 0.78rem;
    right: 0.78rem;
    margin: 0;
    align-self: auto;
  }

  #view-archives .archives-reader.is-scene-controls-collapsed .archives-head{
    display: none;
  }

  #view-archives .archives-reader{
    --archives-reader-inline-pad: 0.7rem;
    --archives-thread-inline-pad: 0.18rem;
    padding: 0.72rem 0.7rem 0.78rem;
  }

  #view-archives .archives-browse-page{
    padding: 0.72rem 0.7rem 0.78rem;
  }

  #view-archives .archives-head{
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.35rem;
    padding-right: 4rem;
    text-align: left;
  }

  #view-archives .archives-title-wrap{
    position: static;
    left: auto;
    transform: none;
    pointer-events: auto;
    width: fit-content;
    max-width: min(100%, calc(100% - 0.2rem));
    text-align: left;
    order: -1;
  }

  #view-archives .archives-nav{
    margin-left: 0;
    justify-content: flex-start;
  }

  #view-archives .archives-browse-btn{
    min-width: 6.7rem;
    font-size: 0.68rem;
  }

  #view-archives .archives-browse-head{
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.35rem;
    align-items: start;
  }

  #view-archives .archives-browse-back-btn{
    min-width: 6.9rem;
    width: fit-content;
  }

  #view-archives .archives-audio-settings-popover{
    left: 0;
    right: auto;
  }

  #view-archives .archives-browse-filters{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #view-archives .archives-browse-grid{
    grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  }

  #view-archives .archives-speech-wrap{
    width: auto;
    max-width: min(94%, 42rem);
  }

  #view-archives .archives-speech-stack{
    flex: 0 1 auto;
    max-width: calc(100% - 4.4rem);
  }

  #view-archives .archives-bubble{
    width: auto;
    max-width: 100%;
  }

  #view-archives .archives-media-card{
    width: 100%;
  }

  #view-archives .archives-narrator{
    width: auto;
    max-width: 96%;
  }
}

body.archives-header-hidden header.ns-header{
  display: none;
}

body.archives-header-hidden #view-archives main{
  --archives-reader-viewport-offset: 1.2rem;
  padding-top: 0.45rem;
}

@media (max-width: 640px){
  #view-archives #archives-scene-jump{
    width: 6.6rem;
  }

  #view-archives .archives-browse-title{
    font-size: 0.86rem;
  }

  #view-archives .archives-browse-subtitle{
    font-size: 0.66rem;
  }

  #view-archives .archives-browse-back-btn{
    min-width: 0;
    width: 100%;
  }

  #view-archives .archives-browse-filters{
    grid-template-columns: minmax(0, 1fr);
  }

  #view-archives .archives-browse-card{
    min-height: 170px;
  }

  #view-archives .archives-browse-card-summary{
    max-height: 4.3em;
  }

  #view-archives .archives-browse-card-hover{
    position: static;
    margin-top: 0.5rem;
    transform: none;
    opacity: 1;
    border-radius: 0;
  }

  #view-archives .archives-avatar{
    width: 44px;
    height: 44px;
  }

  #view-archives .archives-bubble{
    font-size: 0.89rem;
    padding: 0.5rem 0.58rem;
  }

  #view-archives .archives-narrator{
    width: auto;
    max-width: 96%;
  }

  #view-archives .archives-media-card{
    width: 100%;
  }

  #view-archives .archives-next-scene-prompt{
    width: min(calc(100% - 1rem), 24rem);
    flex-direction: column;
    align-items: stretch;
    gap: 0.56rem;
    padding: 0.7rem 0.74rem;
  }

  #view-archives .archives-next-scene-prompt-title{
    white-space: normal;
  }

  #view-archives .archives-next-scene-prompt-btn{
    width: 100%;
    min-width: 0;
  }

  #view-archives .archives-music-toggle{
    width: 3.5rem;
    height: 3.5rem;
  }

  #view-archives .archives-music-toggle-icon{
    font-size: 1.36rem;
  }

  #view-archives .archives-roll-card{
    max-width: 96%;
  }
}

/* ===== Header redesign (adapted from NewHeaderModel.html) ===== */
:root{
  --ns-header-tex: var(--paper-bg-0);
  --ns-header-logo: var(--ns-logo);
  --ns-header-ink: rgba(44, 38, 31, 0.84);
  --ns-header-ink-2: rgba(44, 38, 31, 0.58);
  --ns-header-gold: rgba(202, 136, 62, 0.96);
  --ns-header-gold-glow: rgba(202, 136, 62, 0.30);
  --ns-header-rule-warm: rgba(179, 112, 44, 0.88);
  --ns-header-inset: inset 0 1px 0 rgba(255, 255, 255, 0.78);
  --ns-title-underline-width: 34ch;
}

header.ns-header{
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 10px 0 0;
  border-top: 1px solid rgba(44, 38, 31, 0.30);
  border-bottom: none;
  backdrop-filter: none;
  box-shadow: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.34) 0%, rgba(255, 255, 255, 0.16) 42%, rgba(255, 255, 255, 0.06) 100%),
    radial-gradient(1000px 420px at 12% 62%, rgba(0, 0, 0, 0.22), transparent 74%),
    radial-gradient(1000px 420px at 88% 62%, rgba(0, 0, 0, 0.20), transparent 74%),
    radial-gradient(1400px 340px at 50% 70%, rgba(202, 136, 62, 0.22), transparent 72%),
    radial-gradient(1400px 520px at 50% 132%, rgba(0, 0, 0, 0.40), transparent 72%),
    var(--ns-header-tex);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  overflow: visible;
  isolation: isolate;
}

header.ns-header::before{
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--ns-header-rule-warm), transparent);
  opacity: 0.98;
  pointer-events: none;
}

header.ns-header::after{
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 68px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.18) 42%, rgba(0, 0, 0, 0.48) 100%);
  opacity: 0.40;
  pointer-events: none;
}

header.ns-header .ns-noise{
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
  background-size: 220px 220px;
  mix-blend-mode: multiply;
  opacity: 0.07;
}

header.ns-header .ns-header-shell{
  max-width: 1480px;
  margin: 0 auto;
  padding: 0 clamp(18px, 3vw, 40px);
  position: relative;
  z-index: 1;
}

header.ns-header .header-inner{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: clamp(14px, 2vw, 26px);
  padding: 10px 0 6px;
}

header.ns-header .brand{
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
  flex: 1 1 auto;
  margin-left: 0;
}

header.ns-header .mark{
  width: 42px;
  height: 42px;
  background-image: var(--ns-header-logo);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  transform: translateY(2px);
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.16));
  flex: 0 0 auto;
}

header.ns-header .title-block{
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 1px;
  min-width: 0;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 180ms ease, opacity 180ms ease;
}

header.ns-header .title-block:hover{
  opacity: 0.92;
}

header.ns-header .title-block:active{
  transform: translateY(1px);
}

header.ns-header .title{
  margin: 0;
  font-family: "Cinzel", ui-serif, Georgia, "Times New Roman", Times, serif;
  font-weight: 400;
  font-size: 34px;
  letter-spacing: 6.2px;
  text-transform: uppercase;
  color: rgba(44, 38, 31, 0.78);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.46);
  line-height: 1;
  white-space: nowrap;
}

header.ns-header .app-subtitle{
  display: none;
}

header.ns-header .title-underline{
  position: relative;
  width: var(--ns-title-underline-width);
  height: 10px;
}

header.ns-header .title-underline::before{
  content: "";
  position: absolute;
  left: 0;
  top: 5px;
  width: 100%;
  height: 1px;
  background: rgba(44, 38, 31, 0.40);
  opacity: 0.85;
}

header.ns-header #header-actions{
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex: 0 0 auto;
  flex-wrap: wrap;
  padding-top: 8px;
  margin-right: 0;
}

header.ns-header .tone{
  font-size: 12px;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: rgba(44, 38, 31, 0.54);
  white-space: nowrap;
}

header.ns-header .vsep{
  width: 1px;
  height: 20px;
  background: rgba(44, 38, 31, 0.22);
  opacity: 0.45;
}

header.ns-header #spellbook-header-actions,
header.ns-header #classes-header-actions,
header.ns-header #feats-header-actions{
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

header.ns-header .summary-pill{
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid rgba(44, 38, 31, 0.14);
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.12) 72%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.07));
  color: rgba(44, 38, 31, 0.64);
  box-shadow: var(--ns-header-inset), 0 12px 24px rgba(0, 0, 0, 0.18);
  padding: 0.46rem 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
}

header.ns-header .summary-dot{
  width: 0.46rem;
  height: 0.46rem;
  border-radius: 999px;
  background: var(--green-ink);
  box-shadow: 0 0 0 3px rgba(43, 106, 74, 0.18);
}

header.ns-header .user-actions{
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

header.ns-header .user-name-btn{
  appearance: none;
  border: none;
  border-right: 1px solid rgba(44, 38, 31, 0.22);
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: rgba(44, 38, 31, 0.54);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  padding: 0 0.85rem 0 0;
  cursor: default;
  line-height: 1;
  white-space: nowrap;
}

header.ns-header .user-name-btn:focus-visible{
  outline: 2px solid rgba(122, 78, 42, 0.58);
  outline-offset: 4px;
}

header.ns-header .icon-btn,
header.ns-header .logout-icon:not(.menu-action){
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(44, 38, 31, 0.22);
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0.14) 72%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.18), var(--ns-header-inset);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

header.ns-header .logout-icon{
  border-color: rgba(44, 38, 31, 0.22);
}

header.ns-header .logout-icon::before{
  content: none;
}

header.ns-header .logout-icon::after{
  content: none;
}

header.ns-header .logout-icon svg{
  width: 18px;
  height: 18px;
  display: block;
}

header.ns-header .logout-icon svg path{
  stroke: rgba(44, 38, 31, 0.60);
  stroke-width: 1.7;
}

header.ns-header .logout-icon:hover svg path{
  stroke: rgba(44, 38, 31, 0.75);
}

header.ns-header .mobile-user .logout-icon{
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(44, 38, 31, 0.22);
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0.14) 72%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.18), var(--ns-header-inset);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transform: none;
}

header.ns-header .menu-toggle{
  display: none;
  position: relative;
  z-index: 30;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease, background 220ms ease;
}

header.ns-header .menu-icon{
  position: relative;
  display: block;
  width: 18px;
  height: 2px;
  background: rgba(44, 38, 31, 0.62);
  transition: background 180ms ease;
}

header.ns-header .menu-icon::before,
header.ns-header .menu-icon::after{
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: rgba(44, 38, 31, 0.62);
  transform-origin: center;
  transition: transform 300ms cubic-bezier(0.22, 1, 0.36, 1), opacity 180ms ease, background 180ms ease;
}

header.ns-header .menu-icon::before{ top: -6px; }
header.ns-header .menu-icon::after{ top: 6px; }

body.menu-open header.ns-header .menu-toggle{
  transform: translateY(1px);
  border-color: rgba(202, 136, 62, 0.28);
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.30), rgba(255, 255, 255, 0.12) 72%),
    linear-gradient(180deg, rgba(236, 214, 186, 0.24), rgba(202, 136, 62, 0.08));
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.22), var(--ns-header-inset);
}

body.menu-open header.ns-header .menu-icon{
  background: transparent;
}

body.menu-open header.ns-header .menu-icon::before{
  transform: translateY(6px) rotate(45deg);
}

body.menu-open header.ns-header .menu-icon::after{
  transform: translateY(-6px) rotate(-45deg);
}

header.ns-header .nav-row{
  display: flex;
  justify-content: center;
  width: 100%;
  padding: 8px 0 0;
}

header.ns-header .nav-rail{
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-width: 0;
  max-width: 100%;
  margin: 0 auto;
  padding: 10px 14px;
  border-radius: 24px;
  -webkit-overflow-scrolling: touch;
  scroll-padding-inline: 14px;
  scroll-snap-type: x proximity;
  background:
    radial-gradient(1100px 170px at 50% 0%, rgba(255, 255, 255, 0.30), rgba(255, 255, 255, 0.10) 72%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.05));
  border: 1px solid rgba(44, 38, 31, 0.12);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18), 0 46px 120px rgba(0, 0, 0, 0.28), 0 10px 22px rgba(0, 0, 0, 0.16);
}

header.ns-header .pill{
  appearance: none;
  border: 1px solid rgba(44, 38, 31, 0.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.07));
  box-shadow: var(--ns-header-inset), 0 12px 22px rgba(0, 0, 0, 0.18);
  border-radius: 999px;
  padding: 9px 18px;
  min-width: 114px;
  text-align: center;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--ns-header-ink-2);
  cursor: pointer;
  position: relative;
  scroll-snap-align: start;
  white-space: nowrap;
  text-decoration: none;
  transition: border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

header.ns-header .pill:hover{
  transform: translateY(-1px);
  border-color: rgba(44, 38, 31, 0.22);
}

header.ns-header .pill.is-active,
header.ns-header .pill.active{
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.20), rgba(255, 255, 255, 0.08) 72%),
    linear-gradient(180deg, rgba(236, 214, 186, 0.26), rgba(202, 136, 62, 0.08));
  border-color: rgba(202, 136, 62, 0.24);
  box-shadow: var(--ns-header-inset), 0 14px 26px rgba(0, 0, 0, 0.22);
  color: rgba(44, 38, 31, 0.64);
}

header.ns-header .pill.is-active::after,
header.ns-header .pill.active::after{
  content: "";
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 6px;
  height: 2px;
  border-radius: 99px;
  background: linear-gradient(90deg, transparent, var(--ns-header-gold), transparent);
  box-shadow: 0 14px 40px var(--ns-header-gold-glow);
  opacity: 0.95;
}

header.ns-header .divider{
  position: relative;
  height: 26px;
  margin-top: 6px;
  width: 100%;
}

header.ns-header .divider::before{
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 13px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(44, 38, 31, 0.16) 36%, rgba(44, 38, 31, 0.30) 50%, rgba(44, 38, 31, 0.16) 64%, transparent);
  opacity: 0.90;
}

header.ns-header .divider::after{
  content: "";
  position: absolute;
  left: 50%;
  top: 13px;
  width: 8px;
  height: 8px;
  transform: translate(-50%, -50%) rotate(45deg);
  border-radius: 2px;
  background: rgba(202, 136, 62, 0.24);
  border: 1px solid rgba(44, 38, 31, 0.16);
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.18);
}

header.ns-header .mobile-menu{
  position: absolute;
  left: clamp(10px, 3vw, 20px);
  right: clamp(10px, 3vw, 20px);
  top: calc(100% - 6px);
  z-index: 25;
  padding: 0.95rem 0.95rem calc(1rem + env(safe-area-inset-bottom, 0px));
  background:
    linear-gradient(180deg, rgba(240, 230, 211, 0.88) 0%, rgba(227, 211, 184, 0.82) 46%, rgba(205, 184, 154, 0.76) 100%),
    radial-gradient(860px 260px at 50% -12%, rgba(255, 255, 255, 0.10), transparent 70%),
    radial-gradient(1000px 320px at 50% -40%, rgba(0, 0, 0, 0.28), transparent 74%),
    var(--ns-header-tex);
  background-size: cover;
  background-position: center;
  border: 1px solid rgba(92, 70, 46, 0.20);
  border-top: none;
  border-radius: 0 0 26px 26px;
  border-bottom: 1px solid rgba(92, 70, 46, 0.28);
  box-shadow: 0 24px 46px rgba(0, 0, 0, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  -webkit-backdrop-filter: blur(18px) saturate(1.04);
  backdrop-filter: blur(18px) saturate(1.04);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate3d(0, -14px, 0) scale(0.98);
  transform-origin: top center;
  transition: opacity 220ms ease, transform 300ms cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 300ms;
  will-change: opacity, transform;
  max-height: calc(100vh - 5.5rem);
  max-height: calc(100dvh - 5.5rem - env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  overscroll-behavior: contain;
}

header.ns-header .mobile-menu[hidden]{
  display: none;
}

header.ns-header .mobile-menu[data-open="true"]{
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate3d(0, 0, 0) scale(1);
  transition: opacity 200ms ease, transform 340ms cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0s;
}

body.menu-open header.ns-header .mobile-menu{
  display: block;
}

header.ns-header .mobile-user{
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding: 0.1rem 0.1rem 0.7rem;
  border-bottom: 1px solid rgba(44, 38, 31, 0.14);
}

header.ns-header .mobile-user-name{
  font-family: "Cinzel", ui-serif, Georgia, "Times New Roman", Times, serif;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: rgba(44, 38, 31, 0.82);
  position: static;
  width: auto;
  min-width: 0;
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

header.ns-header .mobile-nav{
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

header.ns-header .mobile-menu .pill{
  width: 100%;
  justify-content: center;
  min-width: 0;
  min-height: 2.95rem;
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  border-color: rgba(82, 61, 39, 0.18);
  border-radius: 24px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.04) 58%),
    linear-gradient(180deg, rgba(219, 205, 183, 0.90), rgba(193, 174, 146, 0.88));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.30),
    inset 0 -1px 0 rgba(96, 74, 46, 0.12),
    0 10px 18px rgba(0, 0, 0, 0.14);
  color: rgba(43, 35, 27, 0.84);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.18);
}

header.ns-header .mobile-menu .pill:hover{
  border-color: rgba(94, 71, 46, 0.24);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.20), rgba(255, 255, 255, 0.05) 58%),
    linear-gradient(180deg, rgba(226, 212, 190, 0.94), rgba(199, 179, 150, 0.92));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    inset 0 -1px 0 rgba(96, 74, 46, 0.14),
    0 12px 20px rgba(0, 0, 0, 0.16);
}

header.ns-header .mobile-menu .pill.is-active,
header.ns-header .mobile-menu .pill.active{
  border-color: rgba(120, 84, 43, 0.30);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.04) 56%),
    linear-gradient(180deg, rgba(210, 188, 157, 0.96), rgba(181, 152, 117, 0.94));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.26),
    inset 0 -1px 0 rgba(103, 73, 34, 0.18),
    0 12px 22px rgba(0, 0, 0, 0.18);
  color: rgba(37, 29, 21, 0.92);
}

header.ns-header .mobile-menu .pill.is-active::after,
header.ns-header .mobile-menu .pill.active::after{
  left: 30%;
  right: 30%;
  bottom: 7px;
  height: 2px;
  opacity: 0.5;
  box-shadow: 0 8px 22px rgba(202, 136, 62, 0.18);
}

@media (max-width: 1100px){
  header.ns-header .brand{
    margin-left: 0;
  }

  header.ns-header .ns-header-shell{
    padding: 0 20px;
  }

  header.ns-header .nav-rail{
    overflow-x: auto;
    justify-content: flex-start;
    scrollbar-width: none;
    -ms-overflow-style: none;
    max-width: 100%;
  }

  header.ns-header .nav-rail::-webkit-scrollbar{
    display: none;
  }

  header.ns-header .pill{
    min-width: 132px;
  }
}

@media (max-width: 1520px) and (min-width: 961px){
  header.ns-header .nav-row{
    padding-top: 10px;
  }

  header.ns-header .nav-rail{
    width: min(100%, 1060px);
    max-width: 1060px;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px 16px;
    padding: 18px 18px 20px;
  }

  header.ns-header .pill{
    flex: 1 1 220px;
    min-width: 220px;
    max-width: 248px;
  }
}

@media (max-width: 860px){
  header.ns-header .tone,
  header.ns-header .vsep{
    display: none;
  }
}

@media (max-width: 960px){
  header.ns-header .menu-toggle{
    display: inline-grid;
  }

  header.ns-header .nav-row{
    display: none;
  }

  header.ns-header .divider{
    margin-top: 2px;
  }

  header.ns-header #header-actions{
    position: static;
    left: auto;
    right: auto;
    top: auto;
    width: auto;
    justify-content: flex-end;
    padding-top: 0;
    transform: none;
    margin-right: 0;
  }

  header.ns-header #header-actions > :not(.menu-toggle){
    display: none !important;
  }

  header.ns-header .header-inner{
    align-items: center;
  }

  header.ns-header .brand{
    margin-left: 0;
  }

  header.ns-header .title-block{
    padding-inline: 0;
    text-align: left;
  }
}

@media (max-width: 640px){
  :root{
    --ns-title-underline-width: 26ch;
  }

  header.ns-header{
    padding: 6px 0 0;
  }

  header.ns-header .ns-header-shell{
    padding: 0 10px;
  }

  header.ns-header .header-inner{
    gap: 10px;
    padding: 6px 0 4px;
  }

  header.ns-header .brand{
    margin-left: 0;
    gap: 8px;
    min-width: 0;
    align-items: center;
  }

  header.ns-header .mark{
    width: 30px;
    height: 30px;
    transform: none;
  }

  header.ns-header .title-block{
    gap: 4px;
    min-width: 0;
  }

  header.ns-header .title{
    font-size: clamp(1.18rem, 6.8vw, 1.42rem);
    letter-spacing: 0.09em;
    line-height: 1.05;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  header.ns-header .title-underline{
    width: 100%;
    max-width: 14rem;
    height: 8px;
  }

  header.ns-header .menu-toggle.icon-btn{
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
  }

  header.ns-header .mobile-menu{
    left: 8px;
    right: 8px;
    top: calc(100% - 4px);
    padding: 0.82rem 0.82rem calc(0.92rem + env(safe-area-inset-bottom, 0px));
    border-radius: 0 0 22px 22px;
    max-height: calc(100vh - 4.9rem);
    max-height: calc(100dvh - 4.9rem - env(safe-area-inset-bottom, 0px));
  }

  header.ns-header .mobile-user{
    margin-bottom: 0.6rem;
    padding-bottom: 0.58rem;
  }

  header.ns-header .mobile-menu .pill{
    min-height: 2.7rem;
    font-size: 0.72rem;
    letter-spacing: 0.16em;
  }

  #view-archives .archives-head{
    gap: 0.46rem;
    padding: 0.48rem 4rem 0.56rem 0.52rem;
    border: 1px solid rgba(122, 78, 42, 0.42);
    border-radius: 0.72rem;
    background:
      linear-gradient(to bottom, rgba(247, 238, 217, 0.9), rgba(230, 210, 174, 0.78));
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.14);
  }

  #view-archives .archives-jump{
    grid-template-columns: minmax(0, 1fr);
    gap: 0.2rem;
    width: 100%;
  }

  #view-archives .archives-jump label{
    font-size: 0.63rem;
    letter-spacing: 0.11em;
  }

  #view-archives #archives-scene-jump{
    width: 100%;
    min-height: 2.12rem;
  }

  #view-archives .archives-title{
    font-size: 1.08rem;
    line-height: 1.2;
  }

  #view-archives .archives-order{
    font-size: 0.64rem;
  }

  #view-archives .archives-nav{
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.34rem;
  }

  #view-archives .archives-nav-btn,
  #view-archives .archives-header-toggle-btn,
  #view-archives .archives-audio-settings-btn{
    width: 2.14rem;
    height: 2.14rem;
    flex: 0 0 2.14rem;
  }

  #view-archives .archives-browse-btn{
    flex: 1 1 calc(100% - 7.2rem);
    min-width: 8rem;
    height: 2.14rem;
    font-size: 0.7rem;
    letter-spacing: 0.09em;
  }

  #view-archives .archives-audio-settings-popover{
    right: 0;
    left: auto;
    min-width: min(16rem, calc(100vw - 2rem));
  }
}

@media (max-width: 430px){
  header.ns-header .mark{
    display: none;
  }

  header.ns-header .title-underline{
    display: none;
  }
}

@media (max-width: 960px){
  body.menu-open{
    overflow: hidden;
  }
}

@media (prefers-reduced-motion: reduce){
  header.ns-header .title-block,
  header.ns-header .menu-toggle,
  header.ns-header .menu-icon,
  header.ns-header .menu-icon::before,
  header.ns-header .menu-icon::after,
  header.ns-header .mobile-menu{
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ===== Paper asset system (local + per-element variation) ===== */
.panel,
.spell-card,
.sheet {
  --paper-variant-image: var(--paper-bg-1);
  --paper-variant-size: 156% 156%;
  --paper-variant-repeat: no-repeat;
  --paper-variant-x: 50%;
  --paper-variant-y: 50%;
  --paper-variant-opacity: 0.24;
  --paper-variant-brightness: 1;
  --paper-variant-contrast: 1;
  --paper-variant-saturate: 1;

  background-image:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.08)),
    var(--paper-variant-image),
    var(--noise-coarse),
    var(--noise-fine),
    radial-gradient(980px 320px at 18% 0%, rgba(255, 255, 255, 0.62), transparent 64%),
    radial-gradient(880px 560px at 86% 18%, rgba(154, 106, 56, 0.22), transparent 66%),
    radial-gradient(680px 520px at 26% 92%, rgba(122, 78, 42, 0.16), transparent 70%),
    radial-gradient(520px 420px at 76% 88%, rgba(0, 0, 0, 0.12), transparent 72%),
    radial-gradient(520px 380px at 70% 56%, rgba(31, 77, 122, 0.09), transparent 72%),
    radial-gradient(520px 380px at 32% 54%, rgba(140, 47, 42, 0.028), transparent 74%),
    linear-gradient(to bottom, var(--paper), var(--paper-2) 62%, var(--paper-3));
  background-size:
    auto,
    var(--paper-variant-size),
    560px 560px,
    260px 260px,
    auto,
    auto,
    auto,
    auto,
    auto,
    auto,
    auto;
  background-repeat:
    no-repeat,
    var(--paper-variant-repeat),
    repeat,
    repeat,
    no-repeat,
    no-repeat,
    no-repeat,
    no-repeat,
    no-repeat,
    no-repeat,
    no-repeat;
  background-position:
    0 0,
    var(--paper-variant-x) var(--paper-variant-y),
    0 0,
    0 0,
    18% 0%,
    86% 16%,
    26% 92%,
    76% 88%,
    70% 56%,
    32% 54%,
    0 0;
  background-blend-mode:
    normal,
    multiply,
    multiply,
    overlay,
    normal,
    multiply,
    multiply,
    multiply,
    multiply,
    multiply,
    normal;
}

.panel::before,
.sheet::before {
  background:
    var(--paper-variant-image),
    radial-gradient(1200px 420px at 40% 0%, rgba(255, 255, 255, 0.25), transparent 60%),
    radial-gradient(780px 520px at 55% 115%, rgba(0, 0, 0, 0.10), transparent 62%);
  background-size:
    var(--paper-variant-size),
    auto,
    auto;
  background-position:
    var(--paper-variant-x) var(--paper-variant-y),
    40% 0%,
    55% 115%;
  background-repeat: var(--paper-variant-repeat), no-repeat, no-repeat;
  opacity: var(--paper-variant-opacity);
  mix-blend-mode: multiply;
  transform: scale(1.05);
  transform-origin: 50% 50%;
  filter: brightness(var(--paper-variant-brightness)) contrast(var(--paper-variant-contrast)) saturate(var(--paper-variant-saturate));
}

.spell-card::before {
  opacity: calc(var(--paper-variant-opacity) * 0.92);
  background:
    var(--paper-variant-image),
    radial-gradient(900px 360px at 50% 0%, rgba(255, 255, 255, 0.25), transparent 55%),
    linear-gradient(to right, transparent, rgba(122, 78, 42, 0.20), transparent);
  background-size:
    var(--paper-variant-size),
    auto,
    auto;
  background-position:
    var(--paper-variant-x) var(--paper-variant-y),
    50% 0%,
    50% 50%;
  background-repeat: var(--paper-variant-repeat), no-repeat, no-repeat;
  mix-blend-mode: multiply;
  transform: scale(1.06);
  transform-origin: 50% 50%;
  filter: brightness(var(--paper-variant-brightness)) contrast(var(--paper-variant-contrast)) saturate(var(--paper-variant-saturate));
}

.spell-card:hover::before,
.spell-card.expanded::before {
  opacity: calc(var(--paper-variant-opacity) + 0.16);
}

.paper-variant-large::before {
  opacity: calc(var(--paper-variant-opacity) * 0.9);
}

/* Archives reader must prioritize scene/place imagery over paper textures. */
#view-archives .archives-reader{
  /* Paper base sits under scene/place image so transparent pixels inherit paper grain. */
  background-image: var(--paper-bg-0) !important;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: rgba(232, 220, 196, 0.58);
}

