:root {
  --story-width: min(
    (100vmin - var(--topNav-height)) * 16 / 9,
    100vw - var(--scrollbarWidth),
    1920px
  );
  --story-bg-width: min(
    var(--story-width),
    (100vh - var(--topNav-height)) * 16 / 9
  );
  --dialog-size: 5.5em;
  --aspectratio: 16 / 9;
  --story-scale: var(--story-bg-width) / 1280;
  --story-scale-unitless: var(--story-bg-width) / 1280px;
}
@media (orientation: landscape) and (max-width: 1200px) {
  :root {
    --story-width: calc(100vw - var(--scrollbarWidth));
  }
}
/*@font-face {
  font-family: "vn";
  src: url("../webfonts/vn.woff2") format("woff2");
}
.dialog {
  font-family: "vn";
}*/
.scene {
  width: 100%;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
/* set minHeight according to aspect ratio, defaults to 16:9 */
.scene {
  min-height: calc(var(--story-bg-width) / calc(var(--aspectratio)));
}
.scene.video {
  /* wider ratio for videos */
  min-height: calc(var(--story-bg-width) / 13 * 6);
  min-height: 0;
}
.scene:before {
  content: "";
  background-color: black;
  background-image: var(--background-image-url);
  background-size: cover;
  background-attachment: fixed;
  background-position: center calc(50% + var(--topNav-height) / 2);
  background-repeat: no-repeat;
  width: 100%;
  height: 100%;
  position: absolute;
  transform: scale(1.02); /* to remove the "box-shadow" created by blur */
  filter: blur(10px);
  z-index: -1;
}
.scene.blockerPadded:after {
  content: "";
  flex: 1;
  background-color: var(--fill-blocker);
}
.scene:after {
  transition: opacity 0.5s;
}
.scenebreak {
  width: 100%;
  height: 2em;
  background: black;
  position: relative;
}
.scenebreak::after,
.scenebreak::before {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 1em;
  pointer-events: none;
  z-index: -1;
}
.scenebreak::before {
  bottom: 100%;
  background: radial-gradient(
    200% 200% at 50% 0%,
    var(--start-color) 25%,
    var(--end-color) 50%
  );
}
.scenebreak::after {
  /* this will be hidden/clipped by the next scene and never visible. */
  content: none;
  top: 100%;
  background: radial-gradient(
    200% 200% at 50% 100%,
    var(--start-color) 25%,
    var(--end-color) 50%
  );
}

.blocker {
  width: 100%;
  height: 1em;
}
.blocker.nochange {
  height: 0px !important;
}
.blocker.fadein {
  background: radial-gradient(
    200% 200% at 50% 0%,
    var(--start-color) 25%,
    var(--end-color) 50%
  );
}
.blocker.fadeout {
  background: radial-gradient(
    200% 200% at 50% 100%,
    var(--end-color) 25%,
    var(--start-color) 50%
  );
}
.blocker.spacer-blocker {
  flex: 99999 1 0%;
}
.blocker.spacer-blocker.fullHeight {
  flex: 99999 1 0%;
}
#storyDisp {
  display: flex;
  flex-direction: column;
  max-width: var(--story-width);
  margin: 0 auto;
  overflow: hidden;
}
.dialog {
  display: flex;
  margin: 0;
  padding: 0.3em 0.3em;
  justify-content: center;
  transition: opacity 0.5s;
  opacity: 1;
}
.blocker {
  transition: opacity 0.5s;
}
.dialog.blocker {
  padding: 0;
}
.dialog.narration .text {
}
.dialog.hidden {
  visibility: hidden;
  position: absolute;
  opacity: 0;
}
.dialog:after,
.dialog:before {
  content: "";
  flex: 0 99;
}
.dialog-right,
.dialog-left {
  flex: 1;
  display: flex;
  min-width: -webkit-min-content;
  min-width: calc(var(--dialog-size) + 1em);
}
.dialog-left {
  justify-content: flex-end;
}
.avatar {
  width: var(--dialog-size);
  height: var(--dialog-size);
  opacity: 0.75;
  margin: 0 0.5em;
  overflow: hidden;
  position: relative;
  border-radius: 0.3em;
  flex-shrink: 0;
  align-self: center;
}
.avatar.active {
  opacity: 1;
}
.avatar.initial img {
  left: 0 !important;
  top: 0 !important;
  width: 100% !important;
  height: 100% !important;
  transform: scale(1) !important;
}
.avatar.unknown img {
  left: -265px !important;
  top: -41px !important;
  transform: scale(1.2) !important;
  filter: brightness(0);
}
.avatar.mystery img {
  filter: brightness(0);
}
.avatar img {
  width: 100%;
  height: 100%;
}
.avatar.npc img {
  position: absolute;
  /* width: initial; */
  /* height: initial; */
  /* margin: auto; */
  /* width: 200px; */
  /* height: 200px; */
  /* transform: translate(-25%,25%) scale(1.5); */
  /* width: 300px; */
  /* height: 300px; */
  /* transform: translate(-33%, 0); */
  width: 1024px;
  height: 1024px;
  /* transform: scale(.5) translate(-50%,-50%) translate(-40%,0); */
  transform-origin: top left;
  transform: scale(0.5);
  left: -205px;
  top: 0px;
}
.text {
  box-sizing: border-box;
  background: #000b;
  flex: 0;
  flex-basis: 35em;
  padding: 0.3em 0.5em 0.4em 0.5em;
  display: flex;
  font-size: 1.3em;
  flex-direction: column;
  justify-content: flex-start;
  border-radius: 0.3em;
  min-height: calc(var(--dialog-size) / 2 / 1.3);
  position: relative;
}
.text:not([data-name=""]) {
  min-height: calc(var(--dialog-size) / 1.3);
}
.text:not([data-name=""]) .dialog-name {
  /*.text:before {
  content: attr(data-name);*/
  color: var(--name-color);
  font-size: 0.8em;
  margin-bottom: 0.2em;
  margin-left: -0.3em;
}
.text.doctor:before,
.text[data-name=""]:before {
  content: none;
}
.text[data-name=""] {
  justify-content: center;
  text-align: center;
}
.decision {
  border: 1px solid #aaa;
  cursor: pointer;
  margin: 0.2em 0;
  padding: 0.2em;
  border-radius: 0.25em;
}
.text.has-english {
  padding-right: 2.4em;
}
.english-toggle,
.review-note-button {
  position: absolute;
  top: 0.3em;
  right: 0.3em;
  display: grid;
  place-items: center;
  width: 1.8em;
  height: 1.6em;
  padding: 0;
  border: 1px solid #888;
  border-radius: 0.25em;
  background: #151515;
  color: #ddd;
  font: inherit;
  font-size: 0.85em;
  cursor: pointer;
}
.english-toggle:hover,
.english-toggle:focus-visible,
.review-note-button:hover,
.review-note-button:focus-visible {
  border-color: #fff;
  color: #fff;
}
.english-toggle:focus-visible,
.review-note-button:focus-visible {
  outline: 2px solid #78bbff;
  outline-offset: 2px;
}
.english-toggle[aria-pressed="true"] {
  color: #9bceff;
  border-color: #9bceff;
}
.english-toggle[aria-busy="true"] {
  opacity: 0.6;
}
.english-status {
  margin-top: 0.5em;
  font-size: 0.7em;
  color: #ddd;
}
.english-status[hidden] {
  display: none;
}
.text.has-review-control {
  padding-right: 4.2em;
}
.has-review-control .english-toggle {
  right: 2.3em;
}
.review-note-button.has-note {
  color: #ffd286;
  border-color: #ffd286;
}
.text.has-review-note {
  box-shadow: inset 2px 0 #ffd286;
}
.review-copy,
.review-clear {
  position: relative;
  margin-left: 0.5em;
  padding: 0.35em 0.6em;
  border: 1px solid #888;
  border-radius: 0.25em;
  background: #151515;
  color: #ddd;
  cursor: pointer;
  font: inherit;
}
.review-copy:disabled,
.review-clear:disabled {
  opacity: 0.5;
  cursor: default;
}
.review-count {
  margin-left: 0.4em;
  font-size: 0.75em;
}
.btnPanel .review-copy i,
.btnPanel .review-clear i {
  font-size: 1em;
}
.review-copy-status {
  display: block;
  font-size: 0.85em;
  margin-top: 0.3em;
}
.review-dialog {
  box-sizing: border-box;
  width: min(34rem, 92vw);
  max-height: 90vh;
  overflow: auto;
  padding: 1.2rem;
  border: 1px solid #888;
  border-radius: 0.5rem;
  background: #202020;
  color: #eee;
  font: 1rem/1.4 sans-serif;
  text-align: left;
  user-select: text;
}
.review-dialog::backdrop {
  background: #0009;
}
.review-dialog h2 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}
.review-dialog label {
  display: block;
  margin-top: 0.7rem;
}
.review-dialog textarea {
  box-sizing: border-box;
  display: block;
  width: 100%;
  margin: 0.3rem 0;
  padding: 0.5rem;
  border: 1px solid #777;
  border-radius: 0.25rem;
  background: #111;
  color: #eee;
  font: inherit;
  resize: vertical;
  user-select: text;
}
.review-location,
.review-help {
  color: #bbb;
  font-size: 0.85rem;
}
.review-help {
  margin-top: 0.7rem;
}
.review-quote {
  border-left: 2px solid #888;
  margin: 0.8rem 0;
  padding-left: 0.7rem;
  max-height: 8rem;
  overflow: auto;
  white-space: pre-wrap;
}
.review-error {
  color: #ffd286;
  margin-top: 0.5rem;
}
.review-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}
.review-dialog button {
  border: 1px solid #888;
  border-radius: 0.25rem;
  padding: 0.4rem 0.7rem;
  background: #333;
  color: #eee;
  font: inherit;
  cursor: pointer;
}
.review-dialog button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.review-dialog .review-save {
  background: #214d73;
}
.review-dialog .review-delete {
  margin-right: auto;
  color: #ffb7b7;
}
.review-dialog button[hidden] {
  display: none;
}
.review-dialog :focus-visible,
.review-copy:focus-visible,
.review-clear:focus-visible {
  outline: 2px solid #78bbff;
  outline-offset: 2px;
}
.decision.selected {
  color: #000;
  background: #888;
}

#topBtn {
  display: none;
  position: fixed;
  font-size: 4em;
  bottom: 0.25em;
  right: 0.25em;
  opacity: 0.75;
  z-index: 999;
  cursor: pointer;
}
@media (hover: hover) {
  .story_nav:hover {
    color: #777;
    cursor: pointer;
  }
  #topBtn:hover {
    opacity: 1;
  }
}
.storyNav {
  display: flex;
  justify-content: center;
  font-size: 4em;
  margin: 0.2em 0;
}
.storyNav.top {
  font-size: 2em;
}
.storyNav .spacer {
  flex-basis: 1em;
}
#storyTitle,
.storyName {
  display: flex;
  align-items: center;
  justify-content: center;
}
#storyTitle.hidden {
  display: none;
}
.storyName {
  font-size: 2em;
  background: var(--main-background-color);
  padding: 0.25em;
}
img.storyAvatar {
  height: 1em;
  width: 1em;
  border: 1px solid var(--main-text-color);
  border-radius: 0.1em;
}
#storyTitle > *,
.storyName > * {
  margin-left: 0.15em;
  margin-right: 0.15em;
}
.storyName {
  position: relative;
}
.readtime {
  right: 0;
  margin-right: 0.5em;
}
.readtime,
.docName {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  font-size: 0.6em;
  color: var(--light-text-color);
  overflow: hidden;
  padding: 2px;
}
.docName {
  left: 0;
  margin-left: 0.5em;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
.editableName {
  padding: 3px;
  max-width: 26ch;
  outline: none;
  overflow: hidden;
  white-space: nowrap;
  border-radius: 2px;
}
.editableName:hover {
  outline: 1px solid #4a90e2;
  background-color: #0003;
}
.editableName:focus {
  outline: 2px solid #4a90e2;
  background-color: #0006;
}
.storySelect {
  font-size: 1.2em;
  padding-right: 0.3em;
}
audio {
  /* margin: .4em auto; */
}
.music {
  visibility: hidden;
  height: 0px;
  margin: 0;
}
.sound {
  display: none;
}
#volControl {
  display: flex;
  align-items: center;
  margin: 0 0.35rem 0 0;
}
.vol-spacer {
  /* flex: 1; */
}
.dlBtn {
  --btn-size: 2rem;
  font-size: var(--btn-size);
  width: var(--btn-size);
  height: var(--btn-size);
  line-height: var(--btn-size);
  text-align: center;
  align-self: center;
  padding: 0.2em;
  border-radius: 0.25em;
  color: #777;
  cursor: pointer;
  position: absolute;
  top: 0;
  right: 0;
  margin-right: 0.25em;
  margin-top: 0.25em;
  opacity: 0.75;
  z-index: 2;
}
/* Hide .dlBtn by default */
.scene .dlBtn {
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.15s ease-in-out,
    visibility 0s 0.15s;
}

/* Show .dlBtn when .scene is hovered */
.scene:hover .dlBtn {
  transition-delay: 0.35s;
  opacity: 0.85;
  visibility: visible;
}

/* Hide .dlBtn when any interactable part of .dialog is hovered */
.scene:hover:has(.dialog i:hover) .dlBtn,
.scene:hover:has(.dialog .avatar:hover) .dlBtn,
.scene:hover:has(.dialog .text:hover) .dlBtn {
  transition-delay: 0s;
  opacity: 0;
  visibility: hidden;
}

#avatarModal .dlBtn {
  margin: 0.25em;
}
.scene.fixed .dlBtn {
  top: calc(
    50% - var(--story-bg-width) / calc(var(--aspectratio)) / 2 +
      var(--topNav-height) / 2
  );
  right: calc(
    50% - var(--story-width) / 2
  ); /* use full width (not bg) so its accessible on landscape */
  position: fixed;
}
.scene.bottom .dlBtn {
  top: calc(100% - var(--story-bg-width) / calc(var(--aspectratio)));
}

.itemBtn,
.soundBtn {
  --btn-size: 2rem;
  height: var(--btn-size);
  line-height: var(--btn-size);
  text-align: center;
  border: 2px solid #aaa;
  border-radius: 0.25em;
  align-self: center;
  color: #999;
  background: #222e;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 0.1em 0.3em;
  font-size: 1.2rem;
  width: max-content;
}
.itemBtn .fileName,
.soundBtn .fileName {
  display: inline-block;
  white-space: nowrap;
  user-select: none;
}
@media (hover: hover) {
  .itemBtn:hover,
  .soundBtn:hover {
    background: #888;
    color: #222;
  }
  .dlBtn:hover {
    background: #888;
    color: #222;
  }
}
.itemBtn:active,
.soundBtn.playing,
.soundBtn:active {
  color: #222;
  background: #444;
}
.soundBtn.stalled {
  background: #944;
}
.soundBtn.stalled:before {
  content: "\f6a9";
}
#volControl i {
  font-size: 1.5em;
}
#volControl #playPauseBtn {
  margin: 0 0.35rem 0 0;
}
#volControl #playPauseBtn i {
  font-size: 1em;
}
#volSlider {
  margin: 0 0.35rem;
  -webkit-appearance: none; /* Override default CSS styles */
  appearance: none;
  /* height: 25px; /* Specified height */
  height: 0.8em;
  background: #808080; /* Grey background */
  outline: none; /* Remove outline */
  opacity: 0.7; /* Set transparency (for mouse-over effects on hover) */
  -webkit-transition: 0.2s; /* 0.2 seconds transition on hover */
  transition: opacity 0.2s;
  border-radius: 0.5em;
}
#volSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1.3em;
  height: 1.3em;
  background: #dddddd;
  cursor: pointer;
  border-radius: 50%;
}

#volSlider::-moz-range-thumb {
  width: 1.3em;
  height: 1.3em;
  background: #dddddd;
  cursor: pointer;
  border-radius: 50%;
}

/* The Modal (background) */
.modal {
  display: block;
  opacity: 0;
  visibility: hidden;
  transition:
    visibility 0.2s,
    opacity 0.2s;
  position: fixed; /* Stay in place */
  z-index: 1; /* Sit on top */
  left: 0;
  top: var(--topNav-height);
  width: 100%; /* Full width */
  height: calc(100% - var(--topNav-height)); /* Full height */
  overflow: hidden; /* Enable scroll if needed */
  background-color: rgb(0, 0, 0); /* Fallback color */
  background-color: rgba(0, 0, 0, 0.4); /* Black w/ opacity */
}
.modal.show {
  opacity: 1;
  visibility: visible;
}

/* Modal Content/Box */
.modal-content {
  background-color: #222e;
  border: 1px solid #777;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  height: min(1024px, 80vh, 80vw);
  width: min(1024px, 80vw, 80vh);
  display: flex;
  justify-content: center;
  align-items: center;
  --bstart: 0;
  --bend: 0;
}
.modal-content,
.modal-content img {
  border-radius: 0.5em;
  user-select: none;
  -moz-user-select: none;
  -khtml-user-select: none;
  -webkit-user-select: none;
  -o-user-select: none;
  -ms-user-select: none;
}
.modal-content img.item {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.modal-content.unknown img {
  filter: brightness(0);
}
.modal-content img,
.modal-content .black {
  max-width: 100%;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
.modal-content .black {
  z-index: 1;
  filter: brightness(0);
  pointer-events: none;

  -webkit-mask-image: linear-gradient(
    to bottom,
    #fff calc(var(--bstart, 0) * 100%),
    transparent calc(var(--bend, 0) * 100%)
  );
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;

  mask-image: linear-gradient(
    to bottom,
    #fff calc(var(--bstart, 0) * 100%),
    transparent calc(var(--bend, 0) * 100%)
  );
  mask-repeat: no-repeat;
  mask-size: 100% 100%;
}

.avatar:not(.unknown) {
  cursor: pointer;
}

.avatar:not(.unknown):hover {
  transition: transform 0.1s;
  transform: scale(1.05);
}

.avatar:not(.unknown):hover:after {
  content: "\f00e";
  font-weight: 900;
  position: absolute;
  font-family: "Font Awesome 5 Free";
  font-size: 1.5em;
}
#serverSelect {
  margin-right: 0.25em;
}
#storyDisp:not([display-mode="0"]) .soundPlayer {
  height: 0;
  padding: 0;
  margin: 0;
}
#storyDisp:not([display-mode="0"]) .soundBtn {
  display: none;
}
#storyDisp.bg_only .scene:after,
#storyDisp[display-mode="2"] .scene:after,
#storyDisp.bg_only .scene > *,
#storyDisp[display-mode="2"] .scene > * {
  opacity: 0;
  pointer-events: none;
}
#storyDisp.bg_only .scene .scene-background,
#storyDisp[display-mode="2"] .scene .scene-background {
  opacity: 1;
  pointer-events: auto;
  box-shadow: none;
}
#storyDisp.bg_only .scene > .dlBtn,
#storyDisp[display-mode="2"] .scene > .dlBtn {
  opacity: 0.85;
  pointer-events: auto;
}
#storyDisp.bg_only .scenebreak::before,
#storyDisp[display-mode="2"] .scenebreak::before {
  content: none;
}
#ccselector {
  justify-content: center;
}
em,
i {
  font-style: italic;
}
b,
strong {
  font-weight: bold;
}
#storyDisp.module .text {
  text-align: left;
  flex-basis: 31.45em;
}

.storySelect option,
.storySelect {
  background-color: var(--main-background-color);
  color: var(--main-text-color);
}
.storySelect {
  outline: none;
  padding: 0.15em;
  border: 1px solid #555;
  border-radius: 0.2em;
}

.scene > video {
  margin-top: auto;
  margin-bottom: auto;
}

html {
  overscroll-behavior: none;
}

.nav-left {
  min-width: 0;
}
.nav-center {
  overflow: hidden;
}
@property --xfrom {
  syntax: "<number>";
  initial-value: 0;
  inherits: false;
}
@property --yfrom {
  syntax: "<number>";
  initial-value: 0;
  inherits: false;
}
@property --xscalefrom {
  syntax: "<number>";
  initial-value: 1;
  inherits: false;
}
.scene-background {
  width: var(--story-bg-width);
  aspect-ratio: var(--aspectratio);
  padding: 0;
  margin: 0;
  background-repeat: no-repeat;
  z-index: -1;
  box-shadow: 0px 0px 25px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  left: 50%;
  transform: translateX(-50%);
  background: #0000;
  background-color: #0000;
}
.scene-background .bg-scale-wrap {
  height: 100%;
  width: 100%;
  transform: scale(calc(var(--totalScale)));
  transform-origin: calc(
      var(--story-scale) * (var(--halfWidth) + var(--xmod, 0))
    )
    calc(var(--story-scale) * (var(--halfHeight) + var(--ymod, 0)));
}
.scene-background .bgimg {
  transform: translate(
    calc(var(--story-scale) * var(--xmod, 0)),
    calc(var(--story-scale) * var(--ymod, 0))
  );
  display: block;
  object-fit: cover;
  width: 100%;
  position: absolute;
}
.scene.top .scene-background {
  position: absolute;
  top: 0;
}
.scene.bottom .scene-background {
  position: absolute;
  bottom: 0;
}
.scene.fixed .scene-background {
  position: fixed;
  top: calc(50% + var(--topNav-height) / 2);
  transform: translate(-50%, -50%);
}
/* [curtain]s */
.scene-background::before {
  z-index: 1;
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--curtains);
  background-repeat: no-repeat;
  background-size: 100% 100%;
}
.dialog p {
  display: block;
  margin: 0.5em 0;
}
.dialog p[data-lvl="1"] {
  font-weight: 600;
  font-size: 1.15em;
}
.dialog.animtext .text {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #000d;
  box-shadow:
    inset 0 0 0.5em rgba(255, 255, 255, 0.15),
    inset 0 0 1em rgba(255, 255, 255, 0.1),
    inset 0 0 0 1px rgba(255, 255, 255, 0.15),
    inset 0 0 0.5em rgba(255, 255, 255, 0.1);
}
.btnPanel {
  padding-bottom: 8px;
}
.btnPanel i {
  font-size: 2em;
}
.cgitem {
  position: absolute;
}
