/* How the page around the game looks */
html, body {
  margin: 0;
  height: 100%;
  background: #1e1830;
  overflow: hidden;
}
body {
  display: grid;
  place-items: center;
  font-family: 'Press Start 2P', monospace;
}
#wrap {
  position: relative;
  --s: 3; /* how many times bigger each pixel is drawn (set by game.js) */
  --u: calc(var(--s) * 1px); /* one game pixel */
  font-size: max(10px, calc(var(--u) * 6));
  color: #3d2a38;
}
#game {
  display: block;
  cursor: pointer;
  image-rendering: pixelated; /* keeps the pixels crisp instead of blurry */
  border-radius: calc(var(--u) * 2);
  box-shadow: 0 0 0 calc(var(--u) * 2) #3d3150, 0 10px 40px #0008;
}
button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* every screen sits on top of the canvas */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8em;
  text-align: center;
}
h1 {
  margin: 0 0 0.1em;
  font-size: 2.6em;
  line-height: 1.3;
  color: #fff4e0;
  text-shadow: 0.12em 0.12em 0 #b0476a, -0.06em -0.06em 0 #b0476a, 0.06em -0.06em 0 #b0476a, -0.06em 0.06em 0 #b0476a;
}
h2 {
  margin: 0;
  font-size: 1.3em;
  color: #fff4e0;
  text-shadow: 0.12em 0.12em 0 #b0476a;
}
.sub { margin: 0 0 0.6em; color: #2d5f94; font-size: 0.9em; }

/* chunky pixel buttons */
.big, .small {
  border: calc(var(--u) * 2) solid #5b3a52;
  border-radius: calc(var(--u) * 3);
  background: #fff4e0;
  color: #5b3a52;
  box-shadow: 0 calc(var(--u) * 2) 0 #5b3a52;
  transition: transform 0.05s;
}
.big { font-size: 1em; padding: 0.7em 1.4em; min-width: 11em; }
.small { font-size: 0.7em; padding: 0.6em 1em; }
.big:hover:not(:disabled), .small:hover:not(:disabled), .big:focus-visible { background: #ffd27a; outline: none; }
.big:active:not(:disabled), .small:active:not(:disabled) { transform: translateY(calc(var(--u) * 2)); box-shadow: none; }
button:disabled { opacity: 0.5; cursor: default; }

/* folders */
#folderList { display: flex; gap: calc(var(--u) * 14); margin: calc(var(--u) * 10) 0 calc(var(--u) * 4); }
.folder { position: relative; }
.folderBtn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6em;
  width: calc(var(--u) * 100);
  min-height: calc(var(--u) * 100);
  padding: 1.6em 0.6em 0.8em;
  border: calc(var(--u) * 2) solid #8a5a2a;
  border-radius: 0 calc(var(--u) * 3) calc(var(--u) * 3) calc(var(--u) * 3);
  background: #f6c66a;
  color: #5b3a22;
  box-shadow: 0 calc(var(--u) * 2) 0 #8a5a2a;
  font-size: 0.75em;
}
.folderBtn:hover:not(:disabled) { background: #ffd98a; }
.folder.empty .folderBtn { background: #f0dcb0; }
.folder.confirm .folderBtn, .folder.confirmDel .folderBtn { background: #ffb0b8; }
.folderBtn canvas { width: calc(var(--u) * 33); height: calc(var(--u) * 51); image-rendering: pixelated; }
.folder.empty .folderBtn canvas { visibility: hidden; }
.info .tab {
  position: absolute;
  top: calc(var(--u) * -6);
  left: calc(var(--u) * -2);
  padding: 0.4em 0.8em;
  background: #f6c66a;
  border: calc(var(--u) * 2) solid #8a5a2a;
  border-bottom: none;
  border-radius: calc(var(--u) * 3) calc(var(--u) * 3) 0 0;
  font-size: 0.85em;
  white-space: nowrap;
}
.folder.empty .info .tab { background: #f0dcb0; }
.info .name { font-size: 1.1em; margin-bottom: 0.4em; }
.info .date { font-size: 0.75em; line-height: 1.5; }
.info .pron { font-size: 0.7em; margin-bottom: 0.5em; color: #8a5a2a; }
.delBtn {
  position: absolute;
  top: calc(var(--u) * 2);
  right: calc(var(--u) * 2);
  border: none;
  background: none;
  color: #a03a3a;
  font-size: 0.8em;
}

/* character designer */
#creator { gap: 0.6em; }
.creatorBody {
  display: flex;
  gap: 1.2em;
  align-items: center;
  padding: 0.9em 1.1em;
  background: #fff4e0e6;
  border: calc(var(--u) * 2) solid #5b3a52;
  border-radius: calc(var(--u) * 3);
}
.left { display: flex; flex-direction: column; align-items: center; gap: 0.6em; }
#preview {
  width: calc(var(--u) * 66);
  height: calc(var(--u) * 101);
  image-rendering: pixelated;
  background: #9ad5f4;
  border: calc(var(--u) * 2) solid #5b3a52;
  border-radius: calc(var(--u) * 2);
}
.nameLabel { display: flex; flex-direction: column; gap: 0.4em; font-size: 0.7em; }
#nameInput {
  width: 9em;
  font-family: inherit;
  font-size: 1.1em;
  padding: 0.4em;
  text-align: center;
  border: calc(var(--u) * 1) solid #5b3a52;
  border-radius: calc(var(--u) * 2);
  background: #fff;
  color: #3d2a38;
}
#options { display: flex; flex-direction: column; gap: 0.55em; text-align: left; }
.optRow { display: flex; align-items: center; gap: 0.6em; }
.optLabel { width: 8.5em; flex-shrink: 0; font-size: 0.6em; line-height: 1.4; }
.opts { display: flex; gap: 0.35em; flex-wrap: wrap; }
.swatch {
  width: 1.5em;
  height: 1.5em;
  padding: 0;
  border: calc(var(--u) * 1) solid #5b3a52;
  border-radius: calc(var(--u) * 2);
}
.word {
  font-size: 0.55em;
  padding: 0.5em 0.7em;
  border: calc(var(--u) * 1) solid #5b3a52;
  border-radius: calc(var(--u) * 2);
  background: #fff;
  color: #5b3a52;
}
.swatch.picked, .word.picked { outline: calc(var(--u) * 1.5) solid #e8628c; outline-offset: calc(var(--u) * 1); }
.word.picked { background: #ffd27a; }
#pronounBox .optRow { flex-direction: column; gap: 0.3em; }
#pronounBox .optLabel { width: auto; }
#pronounBox .opts { justify-content: center; }
.right { display: flex; flex-direction: column; gap: 0.7em; width: calc(var(--u) * 250); min-height: calc(var(--u) * 132); align-self: flex-start; }
#tabs { display: flex; gap: 0.4em; }
.tabBtn {
  flex: 1;
  font-size: 0.6em;
  padding: 0.6em 0.4em;
  border: calc(var(--u) * 1) solid #5b3a52;
  border-radius: calc(var(--u) * 2) calc(var(--u) * 2) 0 0;
  background: #e8d8c8;
  color: #5b3a52;
}
.tabBtn.picked { background: #ffd27a; }
.optRow.off { opacity: 0.35; }
.creatorButtons { display: flex; gap: 1em; align-items: center; }

/* pause */
#pause { background: #2b214099; }

/* talking box */
#dialog {
  position: absolute;
  left: calc(var(--u) * 12);
  right: calc(var(--u) * 12);
  bottom: calc(var(--u) * 28);
  min-height: calc(var(--u) * 36);
  padding: calc(var(--u) * 8) calc(var(--u) * 10);
  background: #fff4e0;
  border: calc(var(--u) * 2) solid #5b3a52;
  border-radius: calc(var(--u) * 3);
  box-shadow: inset 0 0 0 calc(var(--u) * 1) #e8b4a0;
  line-height: 1.7;
}
#dialog p { margin: 0; }
#dialog .next {
  position: absolute;
  right: calc(var(--u) * 8);
  bottom: calc(var(--u) * 4);
  font-size: 0.8em;
  color: #b0476a;
  animation: blink 0.8s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

#toast {
  position: absolute;
  top: calc(var(--u) * 8);
  right: calc(var(--u) * 8);
  padding: 0.6em 0.9em;
  font-size: 0.7em;
  background: #fff4e0;
  border: calc(var(--u) * 2) solid #5b3a52;
  border-radius: calc(var(--u) * 3);
}

/* room name banner when you walk into a room */
#roomName {
  position: absolute;
  top: calc(var(--u) * 8);
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5em 1em;
  font-size: 0.75em;
  white-space: nowrap;
  color: #fff4e0;
  background: #2b2140cc;
  border: calc(var(--u) * 1) solid #fff4e088;
  border-radius: calc(var(--u) * 3);
}

/* the close-up face on the right of the talking box */
#dialog.withFace { padding-right: calc(var(--u) * 58); min-height: calc(var(--u) * 44); }
#portrait {
  position: absolute;
  right: calc(var(--u) * 8);
  top: calc(var(--u) * 5);
  width: calc(var(--u) * 40);
  height: calc(var(--u) * 40);
  image-rendering: pixelated;
  border: calc(var(--u) * 2) solid #5b3a52;
  border-radius: calc(var(--u) * 2);
}
#dialog.withFace .next { right: calc(var(--u) * 60); }

/* things you can choose to say */
#choices { display: flex; flex-direction: column; gap: 0.35em; margin-top: 0.6em; }
.choice {
  text-align: left;
  font-size: 0.85em;
  padding: 0.4em 0.7em;
  border: calc(var(--u) * 1) solid #5b3a52;
  border-radius: calc(var(--u) * 2);
  background: #fff;
  color: #5b3a52;
}
.choice.picked, .choice:hover { background: #ffd27a; }

/* words under the old photo */
#photoCaption { display: none; }
#wrap.photoMode #dialog { display: none; }
#wrap.photoMode #photoCaption {
  display: block;
  position: absolute;
  left: calc(var(--u) * 16);
  right: calc(var(--u) * 16);
  top: calc(var(--u) * 236);
  text-align: center;
  font-size: 0.75em;
  line-height: 1.5;
  color: #5a3a2a;
}

/* the task guide in the top left corner */
#task {
  position: absolute;
  top: calc(var(--u) * 6);
  left: calc(var(--u) * 6);
  max-width: calc(var(--u) * 170);
  padding: 0.5em 0.8em;
  font-size: 0.6em;
  line-height: 1.6;
  background: #fff4e0;
  border: calc(var(--u) * 1) solid #5b3a52;
  border-radius: calc(var(--u) * 3);
  box-shadow: 0 calc(var(--u) * 1) 0 #5b3a52;
}
#task .label {
  display: block;
  font-size: 0.8em;
  color: #b0476a;
}
#task.newTask { animation: taskPop 0.6s ease; }
@keyframes taskPop { 0% { transform: scale(1); } 30% { transform: scale(1.15); background: #ffd27a; } 100% { transform: scale(1); } }

/* ---------- phones and tablets ---------- */
html.touch, html.touch body {
  touch-action: none;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
#touchControls { position: absolute; inset: 0; pointer-events: none; }
#stick {
  pointer-events: auto;
  position: absolute;
  left: 3vmin;
  bottom: 4vmin;
  width: 30vmin;
  height: 30vmin;
  border-radius: 50%;
  background: rgba(255, 244, 224, 0.22);
  border: 0.8vmin solid rgba(91, 58, 82, 0.55);
  touch-action: none;
}
#knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 13vmin;
  height: 13vmin;
  margin: -6.5vmin;
  border-radius: 50%;
  background: rgba(255, 244, 224, 0.9);
  border: 0.8vmin solid #5b3a52;
}
#btnAct, #btnPause {
  pointer-events: auto;
  position: absolute;
  border-radius: 50%;
  background: #fff4e0;
  border: 0.8vmin solid #5b3a52;
  color: #b0476a;
  font-family: inherit;
  box-shadow: 0 1vmin 0 #5b3a52;
  touch-action: none;
}
#btnAct { right: 9vmin; bottom: 9vmin; width: 20vmin; height: 20vmin; font-size: 8vmin; }
#btnAct:active { transform: translateY(1vmin); box-shadow: none; background: #ffd27a; }
#btnPause { right: calc(var(--u) * 6); top: calc(var(--u) * 32); width: 11vmin; height: 11vmin; font-size: 3.5vmin; }

/* if a phone is held up tall, ask to turn it sideways */
#rotate { display: none; }
@media (orientation: portrait) {
  html.touch #rotate {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: fixed;
    inset: 0;
    z-index: 10;
    background: #74c2ec;
    color: #fff4e0;
    font-size: 5vw;
    text-align: center;
    text-shadow: 0.4vw 0.4vw 0 #b0476a;
    padding: 8vw;
  }
  html.touch #rotate div { font-size: 18vw; margin-bottom: 4vw; }
}
