/* ------------------------------------------------------------------------ */
/* GENERAL STYLES --------------------------------------------------------- */
/* ------------------------------------------------------------------------ */

/* NOTE ABOUT "display: flex"
 * Beware that using 'display: flex' will break the app if used in elements
 * that are shown/hidden at runtime, because "display: flex" will override
 * the "hidden" HTML attribute which is used to control their visibility.
 *
 * If 'display: flex' needs to be used in such an element, the best way to
 * work around this is to put 'display: flex' on a child element that
 * is set to occupy 100% of the parent.
 */

html, body {
  overflow: hidden;
  user-select: none;
}

html, body, input, button, select {
  font: 14px 'Inter';
}

h1 {
  font: 24px 'Inter';
  font-weight: 600;
  color: #494cd2;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

#my-canvas {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: white;
}

#site-border {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  border: 4px solid #494cd2;
  pointer-events: none;
}

button {
  padding: 8px;
  border-radius: 8px;
  border: 1px solid black;
  background-color: #eee;
  color: black;
  box-shadow: 2px 2px rgba(0, 0, 0, 0.5);
}
button:hover {
  background-color: #ffffff;
}
button:active {
  background: #bbb;
  box-shadow: none;
  transform: translate(1px, 1px);
}

@keyframes scale-in-anim {
  from { transform: scaleX(0.5) scaleY(0.5); opacity: 0; }
  to { transform: scaleX(1) scaleY(1); opacity: 1}
}
.scale-in-anim {
  animation: scale-in-anim 0.75s;
}

@keyframes fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}
.fade-out-anim {
  animation: fade-out 0.75s;
  opacity: 0;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.fade-in-anim {
  animation: fade-in 0.4s;
  opacity: 1;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(180deg); }
}

/* ------------------------------------------------------------------------ */
/* TOOLBAR ---------------------------------------------------------------- */
/* ------------------------------------------------------------------------ */

#toolbar {
  position: fixed;
  background: #ffc15e;
  border: 2px solid #CC9A4B;
  border-radius: 8px;
  box-shadow: 4px 4px hsla(37, 58%, 55%, 0.24);

  top: 24px!important;
  left: 24px;
}
#toolbar-header {
  display: none;
}
#toolbar-body {
  display: flex;
  flex-direction: row;
  padding: 4px;
}
.tool-shortcut {
  position: absolute;
  right: 8px;
  top: 4px;
  font-size: 14px;
}
.tool-icon {
  vertical-align: middle;
}
.tool-button {
  position: relative;
  font: 18px Mitr;
  width: 80px;
  height: 50px;
  margin: 8px;

  cursor: pointer;
}

.tool-button .tooltip {
  position: absolute;
  background: rgba(0,0,0,0.87);
  color: #fff;
  border-radius: 6px;
  font-family: 'Inter';
  font-size: 12px;
  padding: 8px;
  font-weight: 600;
  bottom: 0;
  width: max-content;
  left: 50%;
  transform: translateX(-50%) translateY(calc(100% + 8px));
}

.tool-button:not(:hover) .tooltip {
  opacity: 0;
  pointer-events: none;
}

.tool-button-sel {
  background-color: #000;
  color: white;
  box-shadow: none;
  transform: translate(2px 2px);
}
.tool-button-sel:hover {
  background-color: #111;
}

.tool-button-shortcut {
  font: 12px Rubik;
}

#tool-blurb {
  position: fixed;
  background: rgba(0,0,0,0.12);
  border-radius: 7px;
  padding: 8px 12px 8px 9px;

  left: 50%;
  transform: translateX(-50%);
  bottom: 32px;
}
#tool-blurb img {
  width: 20px;
  height: 20px;
  vertical-align: middle;
  margin-right: 2px;
}

/* ------------------------------------------------------------------------ */
/* PANELS IN GENERAL ------------------------------------------------------ */
/* ------------------------------------------------------------------------ */
.panel {
  display: flex;
  flex-direction: column;
}
.panel-header {
  display: flex;
  height: 32px;
  line-height: 32px;
}
.panel-anchor-left .panel-header, .panel-anchor-right .panel-header {
  flex-direction: column;
  width: 32px;
  height: inherit;
}
.panel-anchor-left .panel-body, .panel-anchor-right .panel-body {
  flex-grow: 1;
}
.panel-header:hover {
  background: rgba(255, 255, 255, 0.5);
}
.panel-title {
  margin: 0 8px 0 8px;
}
.panel-anchor-left .panel-title {
  writing-mode: vertical-rl;
  transform: translate(8px);
}
.panel-anchor-right .panel-title {
  writing-mode: vertical-rl;
  transform: rotate(180deg) translate(8px);
}
.panel-title-dots {
  flex-grow: 1;
  margin: 0 8px 0 8px;
  background: url(/assets/tactile-dots.png);
}
.panel-anchor-left .panel-title-dots, .panel-anchor-right .panel-title-dots {
  margin: 8px 0 8px 0;
  background: url(/assets/tactile-dots-vert.png);
}
.panel-button {
  align-self: center;
  width: 32px;
  text-align: center;
}
.panel-button:hover {
  background: rgba(255, 255, 255, 0.8);
}
.panel-button img {
  width: 14px;
  height: 9px;
}

/* ------------------------------------------------------------------------ */
/* PALETTE ---------------------------------------------------------------- */
/* ------------------------------------------------------------------------ */

#palette {
  position: fixed;
  left: 16px;
  background: #ffe7df;
  border-radius: 8px;
  border: 2px solid #CCB9B2;
  box-shadow: 4px 4px rgb(255, 231, 223, 0.48);
  height: 400px;
  overflow: hidden;

  cursor: pointer;
}
#palette-body {
  padding: 16px;
}
.palette-button {
  border-radius: 16px;
  width: 32px;
  height: 32px;
  margin: 4px;
  border: 1px solid gray;
  box-shadow: none;
  overflow: hidden;

  cursor: pointer;
}
.palette-button-sel {
  transform: scale(1.2);
  border: 1px solid black;
  box-shadow: 0px 0px 2px 2px rgba(0, 0, 0, 0.2);
}
.palette-button > img {
  transform: translate(-8px, -8px)
}

/* ------------------------------------------------------------------------ */
/* GRID PANEL ------------------------------------------------------------- */
/* ------------------------------------------------------------------------ */
#grid-panel {
  position: fixed;
  right: 80px;
  background: #589f64;
  border-radius: 8px;
  border: 2px solid hsl(130deg 29% 34%);
  box-shadow: 4px 4px rgb(60, 109, 69, 0.24);

  cursor: pointer;
}
#grid-panel-body {
  display: flex;
  flex-direction: row;
  padding-bottom: 12px;
}
.grid-button {
  width: 48px;
  height: 48px;
  box-shadow: none;
  border-radius: 24px;
  border: 2px solid black;
  background: transparent;
  margin: 8px;
}
#grid-panel button img {
  width: 24px;
  height: 24px;
}
.grid-button-sel {
  border: 2px solid black;
  box-shadow: 0px 0px 2px 2px rgba(0, 0, 0, 0.2);
  background: black;
}

/* ------------------------------------------------------------------------ */
/* SHAPES PANEL ----------------------------------------------------------- */
/* ------------------------------------------------------------------------ */

#shape-button img {
  width: 28px;
  height: 28px;
}
#shapes-bar {
  position: fixed;
  left: 220px;
  background: #eb7150;
  border-radius: 8px;
  border: 2px solid hsl(13deg 79% 43%);
  box-shadow: 4px 4px rgb(198, 99, 72, 0.24);
  padding-bottom: 16px;

  cursor: pointer;
}
#shapes-bar-body {
  padding-left: 8px;
}
#shapes-bar-expand-button {
  background: transparent;
  color: white;
  box-shadow: none;
  border: none;
  vertical-align: middle;
  justify-self: center;
  margin: 0px;
}
#shapes-bar-expand-button:hover, #shapes-bar-collapse-button:hover {
  background: rgba(255, 255, 255, 0.5);
}
.shapes-bar-button {
  width: 48px;
  height: 48px;
  box-shadow: none;
  border-radius: 24px;
  border: 2px solid black;
  background: transparent;
  margin: 8px 4px 8px 4px;
}
.shapes-bar-button img {
  width: 24px;
  height: 24px;
}
.shape-button-sel {
  border: 2px solid black;
  box-shadow: 0px 0px 2px 2px rgba(0, 0, 0, 0.2);
  background: black;
}
#rotate-hint {
  position: fixed;
  bottom: 64px;
  left: 500px;
  background: #222;
  color: white;
  padding: 8px;
  border-radius: 8px;
}

/* ------------------------------------------------------------------------ */
/* LOADING MESSAGE -------------------------------------------------------- */
/* ------------------------------------------------------------------------ */

#loading {
  position: fixed;
  top: 0px;
  left: 0px;
  right: 0px;
  bottom: 0px;
  background: #FBE8E0;

  z-index: 5;
}
#loading-message {
  position: fixed;
  width: 200px;
  height: 50px;
  line-height: 50px;
  top: calc(50vh + 56px);
  left: calc(50vw - 100px);
  text-align: center;
  font-size: 18px;
  color: rgba(0,0,0,0.32);
  text-transform: uppercase;
  font-weight: 600;
}
#loading-icon {
  position: fixed;
  left: calc(50vw - 25px);
  top: calc(50vh - 25px);
  width: 50px;
  height: 50px;
  border: 4px solid #494cd1;
  animation: spin 1s infinite;
  border-radius: 8px;
}

/* ------------------------------------------------------------------------ */
/* COLLAB INFO PANEL ------------------------------------------------------ */
/* ------------------------------------------------------------------------ */

#collab-info {
  position: fixed;
  top: 16px;
  left: calc(50vw + 120px);
  border-radius: 0px 16px 16px 16px;
  width: 250px;
  color: white;

  background: rgba(0, 0, 0, 0.87);
  line-height: 1.25;
  padding: 12px;

  display: none;
}

/* ------------------------------------------------------------------------ */
/* ENTER NAME DIALOG ------------------------------------------------------ */
/* ------------------------------------------------------------------------ */

#enter-name-root {
  position: fixed;
  top: 0px;
  left: 0px;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  pointer-events: all;
}

#enter-name {
  width: 400px;
  position: fixed;
  left: calc(50vw - 200px);
  top: calc(50vh - 100px);
  background: white;
  border-radius: 8px;
  padding: 24px;
  box-shadow: 4px 4px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
}

#enter-name input {
  width: 100%;
  font-size: 18px;
  font-weight: bold;
  margin: 16px 0px 16px 0px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #aaa;
}
#enter-name input:focus {
  background: #fff0ff;
}
#enter-name input::placeholder {
  color: #bbb;
}

#enter-name-confirm {
  align-self: end;
}

/* ------------------------------------------------------------------------ */
/* PRESENCE PANEL --------------------------------------------------------- */
/* ------------------------------------------------------------------------ */

#presence-panel {
  position: fixed;
  right: 16px;
  width: 180px;
  border-radius: 8px;
  top: 16px;
  background: #5ed3e1;
  border: 2px solid hsl(186deg 69% 40%);
  box-shadow: 4px 4px rgb(87, 183, 194, 0.24);

  cursor: pointer;
}
#presence-panel-body {
  padding: 16px;
  padding-right: 32px;
}
#presence-list {
  display: flex;
  flex-direction: column;
}
.presence-list-entry {
  color: white;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 16px;
  padding: 8px;
  margin: 4px;
  overflow: hidden;
  text-align: center;
}

.presence-chip {
  position: fixed;
  padding: 8px;
  border-radius: 8px;
  color: white;
  background: rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

/* ------------------------------------------------------------------------ */
/* APP TITLE BAR ---------------------------------------------------------- */
/* ------------------------------------------------------------------------ */

#title {
  position: fixed;
  width: 200px;
  left: calc(50vw - 100px);
  top: -4px;
  background: #494cd2;
  text-align: center;
  color: white;
  border-radius: 0px 0px 8px 8px;
  padding: 4px;
  border: 2px solid hsl(239deg 60% 39%);
  box-shadow: 4px 4px rgb(60, 62, 166, 0.24);
  cursor: pointer;

  font-size: 18px;
  font-weight: 600;
  padding: 12px 0 12px;
}
#title-file-id {
  color: orange;
}
#title-copy-feedback {
  position: fixed;
  width: max-content;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  border-radius: 8px;
  padding: 12px;
  background: rgba(0,0,0,0.87);
  color: white;
  top: 64px;
}

/* ------------------------------------------------------------------------ */
/* ENVIRONMENT SELECTION PANEL -------------------------------------------- */
/* ------------------------------------------------------------------------ */

#env-panel {
  position: fixed;
  right: 16px;
  top: 224px;
  width: 186px;
  height: 180px;
  background: #ee7e99;
  border: 2px solid #AE5C70;
  border-radius: 8px;
  box-shadow: 4px 4px rgb(206, 114, 136, 0.24);

  cursor: pointer;
}
#env-panel-body {
  padding: 16px 32px 16px 16px;
}
#env-panel-body select {
  padding: 4px;
  border-radius: 4px;
}
#env-panel-body section {
  margin-bottom: 12px;
}
#env-panel-body .subheading {
  margin-bottom: 8px;
}
#env-loading {
  position: fixed;
  top: 20vh;
  width: 200px;
  background: rgba(0, 0, 0, 0.5);
  left: calc(50vw - 100px);
  text-align: center;
  color: white;
  border-radius: 16px;
  padding: 8px;
}

/* ------------------------------------------------------------------------ */
/* MUSIC TOGGLE ----------------------------------------------------------- */
/* ------------------------------------------------------------------------ */

#music-toggle {
  width: 48px;
  height: 48px;
  border-radius: 24px;
  color: white;
  background: #ce7288;
}

/* ------------------------------------------------------------------------ */
/* OPTIONS (OVERFLOW) BUTTON AND MENU ------------------------------------- */
/* ------------------------------------------------------------------------ */

#overflow-button {
  position: fixed;
  right: 16px;
  bottom: 16px;
  font-size: 32px;
  cursor: pointer;
  width: 40px;
  height: 40px;
  overflow: hidden;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.5);
  text-align: center;

  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border: 2px solid rgba(0,0,0,0.16);
}
#overflow-button:hover {
  background: white;
}
#overflow-button:active {
  background: #e0e0e0;
}

#overflow-menu {
  position: fixed;
  right: 16px;
  bottom: 64px;
  background: rgba(255, 255, 255, 0.8);
  border: 2px solid black;
  border-radius: 16px;
  overflow: hidden;
  min-width: 100px;

  padding: 8px 0 12px;
}
#overflow-menu .divider {
  width: 100%;
  height: 2px;
  background: #000;
  margin: 8px 0;
}
.overflow-menu-item {
  cursor: pointer;
  font-size: 16px;
  padding: 4px 16px;
}
.overflow-menu-item:hover {
  background: blue;
  color: white;
}

#things-attribution {
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-transform: uppercase;
  color: rgba(0,0,0,0.24);
  font-weight: 600;
  font-size: 12px;
  margin-top: 16px;
}

#things-attribution a {
  transition: 100ms ease-in-out;
}

#things-attribution a:hover {
  transform: scale(1.25);
}

#things-attribution img {
  width: 16px;
}

/* ------------------------------------------------------------------------ */
/* TOAST ------------------------------------------------------------------ */
/* ------------------------------------------------------------------------ */

#toast {
  position: fixed;
  bottom: 200px;
  width: 250px;
  left: calc(50vw - 125px);
  padding: 16px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  text-align: center;
  pointer-events: none;
}

/* ------------------------------------------------------------------------ */
/* ABOUT DIALOG ----------------------------------------------------------- */
/* ------------------------------------------------------------------------ */

#about-root {
  position: fixed;
  top: 0px;
  left: 0px;
  right: 0px;
  bottom: 0px;
  background: rgba(0, 0, 0, 0.7);
  pointer-events: all;
  z-index: 2;
}

#about {
  position: fixed;
  top: calc(50vh - 160px);
  left: calc(50vw - 200px);
  width: 400px;
  background: white;
  padding: 24px;
  border: 2px solid black;
  border-radius: 16px;
}
#about p {
  margin-top: 13px;
  line-height: 1.4;
}
#about button {
  width: 100%;
  margin-top: 24px;
  cursor: pointer;

  color: #fff;
  background: #494cd2;
  border: 2px solid hsl(239deg 60% 39%);
  height: 48px;
  box-shadow: 0px 0px 0 rgb(0 0 0 / 24%);

  transition: 100ms ease-in-out;
}
#about button:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 rgb(0 0 0 / 24%);
}
#about button:active {
  transform: translate(0px, 0px);
  box-shadow: 2px 2px 0 rgb(0 0 0 / 24%);
}

#shape-count {
  position: fixed;
  bottom: 8px;
  right: 250px;
  color: rgba(0, 0, 0, 0.3);
}

/* ------------------------------------------------------------------------ */
/* FATAL ERROR ------------------------------------------------------------ */
/* ------------------------------------------------------------------------ */
#fatal-error {
  position: fixed;
  width: 400px;
  height: 300px;
  left: calc(50vw - 200px);
  top: calc(50vh - 200px);
  background: darkblue;
  border: white;
  border-radius: 16px;
  z-index: 999;
  color: white;
  padding: 16px;
  font: 14px Monospace;
}
#fatal-error i {
  display: block;
  margin-bottom: 16px;
  text-align: center;
  font-size: 48px;
}

/* ------------------------------------------------------------------------ */
/* STAGE TOGGLE ----------------------------------------------------------- */
/* ------------------------------------------------------------------------ */
#stage-panel {
  position: fixed;
  top: 16px;
  right: 200px;
}
