/* http://meyerweb.com/eric/tools/css/reset/ 
   v2.0 | 20110126
   License: none (public domain)
*/
html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
}

/* HTML5 display-role reset for older browsers */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
  display: block;
}

body {
  line-height: 1;
}

ol,
ul {
  list-style: none;
}

blockquote,
q {
  quotes: none;
}

blockquote:before,
blockquote:after,
q:before,
q:after {
  content: "";
  content: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

@font-face {
  font-family: PixelOperator;
  font-weight: bold;
  src: url("./PixelOperatorMono8-Bold.ttf");
}
@font-face {
  font-family: PixelOperator;
  font-weight: normal;
  src: url("./PixelOperatorMono8.ttf");
}
:root {
  --paper-rgb: 200, 176, 127;
  --ink-rgb: 53, 34, 11;
  --paper: rgb(var(--paper-rgb));
  --ink: rgb(var(--ink-rgb));
}

button,
details > summary {
  cursor: pointer;
}

b,
strong {
  font-weight: bolder;
}

i,
em {
  font-style: italic;
}

:root {
  font-family: PixelOperator;
  font-size: 16px;
  font-weight: normal;
  color-scheme: dark;
}

::selection {
  background: #312129;
  color: #fff4c4;
}

* {
  box-sizing: border-box;
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) rgba(0, 0, 0, 0.1);
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
*::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}
*::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.52);
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}
*::-webkit-scrollbar-corner {
  background: rgba(0, 0, 0, 0.1);
}

@keyframes progress {
  from {
    background-position-x: 0;
  }
  to {
    background-position-x: 180vw;
  }
}
html,
body {
  margin: 0;
  padding: 0;
}

html {
  width: 100%;
  background-color: #000;
}

body,
main {
  background-color: inherit;
}

body {
  position: relative;
  width: 100%;
  height: 100svh;
  contain: paint;
}

progress {
  position: relative;
  width: 90%;
  height: 2rem;
  margin: 5%;
  margin-top: 45vh;
  appearance: none;
  background-color: rgba(0, 0, 0, 0.25);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25) inset;
  border-radius: 0.5rem;
  border: none;
  overflow: hidden;
  appearance: none;
}
progress::-webkit-progress-bar {
  background-color: transparent;
}
progress::-webkit-progress-value, progress::-moz-progress-bar {
  background-color: #000;
  border-top-left-radius: 0.5rem;
  border-bottom-left-radius: 0.5rem;
  background-image: linear-gradient(to right, rgba(255, 255, 255, 0) 25%, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0) 75%);
  background-size: 200% 100%;
  animation: progress 1s linear infinite;
}

progress + main {
  display: none;
}

noscript {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

main {
  position: absolute;
  inset: 0;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1;
  margin: auto;
}

iframe {
  box-sizing: border-box;
  border: none;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  flex: auto;
}
iframe::selection {
  background: transparent;
}

@keyframes game {
  from {
    width: 0;
    height: 0;
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes gameout {
  from {
    opacity: 1;
  }
  to {
    width: 0;
    height: 0;
    opacity: 0;
  }
}
.img {
  pointer-events: none;
}

.floater {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  transition: top 0.5s ease-out, left 0.5s ease-out, width 0.5s ease-out, height 0.5s ease-out, opacity 0.2s ease-out;
  opacity: 1;
  border-radius: 0.5rem;
}
.floater:hover {
  opacity: 0.5;
}
.floater.hidden {
  top: 50% !important;
  left: 50% !important;
  width: 0 !important;
  height: 0 !important;
  opacity: 0;
  pointer-events: none;
  user-select: none;
}

#bipsi,
#map,
#ui,
#titles,
.game {
  position: absolute;
  inset: 0;
}

.game {
  animation: game 0.5s cubic-bezier(0.075, 0.82, 0.165, 1);
  grid-area: spec;
  margin: auto;
  width: calc(100% - 2rem);
  height: calc(100% - 2rem);
  contain: paint;
}

.game.over {
  animation: gameout 0.5s cubic-bezier(0.075, 0.82, 0.165, 1) forwards;
  pointer-events: none;
}

.game.game_choice,
.game.game_input,
.game.game_review {
  top: unset;
  bottom: 1rem;
  height: calc(100% - min(256px, 33vmin) - 1rem);
  border-radius: 0;
  border-image: url("./border.png") 100 115 fill round;
  border-width: 4vmin;
  border-style: solid;
  box-shadow: 0 0 1rem #000;
}

#ui {
  background-color: rgba(0, 0, 0, 0.7);
  pointer-events: none;
  display: grid;
  grid-template-areas: "player log npc" "spec spec spec";
  grid-template-columns: min(256px, 33vmin) 1fr min(256px, 33vmin);
  grid-template-rows: min(256px, 33vmin) 1fr;
}

#map {
  pointer-events: none;
}

#npc {
  grid-area: npc;
}

#player {
  grid-area: player;
}

.spectacles {
  grid-area: spec;
}

#log {
  grid-area: log;
}

#titles {
  pointer-events: none;
}

.sfx_text,
.sfx {
  display: none;
}

.music {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 3rem;
  height: 3rem;
  mix-blend-mode: screen;
}

#bipsi,
#map,
#ui {
  transition: opacity 1s ease-out;
  opacity: 0;
}

main[data-layout=bipsi] #bipsi,
main[data-layout=spectacles] #bipsi {
  opacity: 1;
}

main[data-layout=spectacles] #ui .spectacles,
main[data-layout=spectacles] #ui #log,
main[data-layout=spectaclusi] #ui .spectacles,
main[data-layout=spectaclusi] #ui #log,
main[data-layout=spectaclesmap] #ui .spectacles,
main[data-layout=spectaclesmap] #ui #log {
  pointer-events: auto;
}

main[data-layout=spectacles] #ui,
main[data-layout=spectaclusi] #ui,
main[data-layout=spectaclesmap] #ui {
  opacity: 1;
}

main[data-layout=map] #map,
main[data-layout=spectaclesmap] #map {
  opacity: 1;
}

main[data-layout=map] #map {
  pointer-events: auto;
}

main::after {
  content: "";
  display: block;
  position: absolute;
  inset: 0;
  background-image: url("./paper.jpg");
  background-size: cover;
  opacity: 0.25;
  mix-blend-mode: multiply;
  pointer-events: none;
}