/* Base: the scaled stage, backgrounds, fonts and the shared picture of rows. */
@font-face {
  font-family: Fraunces;
  src: url(../assets/fonts/fraunces.woff2) format("woff2");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: Figtree;
  src: url(../assets/fonts/figtree.woff2) format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "Bowlby One";
  src: url(../assets/fonts/bowlby-one.woff2) format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Familjen Grotesk";
  src: url(../assets/fonts/familjen-grotesk.woff2) format("woff2");
  font-weight: 500 700;
  font-display: swap;
}

:root {
  --cream: #fbf1dc;
  --amber: #ffc36b;
  --plum: #2a1826;
  --red: #ce3a20;
  --ink: #16120f;
  --gold: #e9b23c;
  --paper: #fbefd6;
  --soft: "SOFT" 100, "WONK" 0;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #10263a;
}
body {
  font-family: Figtree, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
}
input {
  -webkit-user-select: text;
  user-select: text;
  font: inherit;
}
[hidden] {
  display: none !important;
}
img {
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
}
#bg {
  position: absolute;
  inset: 0;
  background: #10263a;
}
#stage {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 1180px;
  height: 820px;
  transform-origin: bottom center;
  transform: translateX(-50%) scale(var(--s, 1));
}
#app.portrait #stage {
  width: 820px;
  height: 1180px;
}
.screen {
  position: absolute;
  inset: 0;
}

#app[data-bg="street"] #bg {
  background: #10263a url(../assets/street.webp) center bottom / cover no-repeat;
}
#app[data-bg="street-flip"] #bg {
  background: #10263a url(../assets/street.webp) center bottom / cover no-repeat;
  transform: scaleX(-1);
}
#app[data-bg="red"] #bg {
  background: var(--red);
}
#app[data-bg="ink"] #bg {
  background: var(--ink);
}
#app[data-bg="blueprint"] #bg {
  background-color: #123a5c;
  background-image:
    linear-gradient(#ffffff14 1px, transparent 1px),
    linear-gradient(90deg, #ffffff14 1px, transparent 1px),
    linear-gradient(#ffffff08 1px, transparent 1px),
    linear-gradient(90deg, #ffffff08 1px, transparent 1px);
  background-size:
    96px 96px,
    96px 96px,
    24px 24px,
    24px 24px;
}
#app[data-bg="paper"] #bg {
  background: #f4f1ea;
}
#app[data-bg="picker"] #bg {
  background: var(--ink);
}

/* ---------- rows of windows or gems ---------- */
.arr {
  display: inline-flex;
  flex-direction: column;
  gap: 18px;
}
.arr-group {
  display: flex;
  flex-direction: column;
}
.arr-row {
  display: flex;
}
.cell {
  display: block;
  width: var(--c);
  height: var(--c);
  flex: none;
  position: relative;
}

/* Lights On draws windows set into a wall. */
[data-world="lights"] .arr-group {
  background: #56293a;
  padding: 7px;
  box-shadow: inset 0 0 0 1px #3a1c2a;
}
[data-world="lights"] .arr-group.g2 {
  background: #6d3a45;
}
[data-world="lights"] .cell::after {
  content: "";
  position: absolute;
  inset: 11%;
  background: #13293d;
  box-shadow: inset 0 0 0 1.5px #2a1420;
  transition:
    background 180ms ease-out,
    box-shadow 180ms ease-out;
}
[data-world="lights"] .cell.on::after {
  background: linear-gradient(#ffd98e, #ffaf4e);
  box-shadow:
    inset 0 0 0 1.5px #2a1420,
    0 0 10px #ffb04e88;
}
[data-world="lights"] .g2 .cell.on::after {
  background: linear-gradient(#ffeec8, #ffd79a);
}
[data-world="lights"] .cell.ghost::after {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px #ffffff55;
}

/* The Magpie draws gems on shelves. */
[data-world="magpie"] .arr-group {
  padding-bottom: 2px;
}
[data-world="magpie"] .arr-row {
  border-bottom: 3px solid var(--ink);
  padding: 1px 0;
}
[data-world="magpie"] .cell::after {
  content: "";
  position: absolute;
  inset: 15%;
  clip-path: polygon(50% 0, 100% 42%, 50% 100%, 0 42%);
  background: #c9bfa8;
  transition: background 160ms ease-out;
}
[data-world="magpie"] .cell.on::after {
  background: var(--gold);
}
[data-world="magpie"] .g2 .cell.on::after {
  background: var(--red);
}
[data-world="magpie"] .cell.ghost::after {
  background: transparent;
  box-shadow: none;
  outline: 2px dashed #16120f55;
}

/* ---------- shared buttons ---------- */
.key {
  font-variant-numeric: lining-nums;
}
.pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}
.key:active {
  transform: translateY(2px);
}
.exit {
  position: absolute;
  left: 36px;
  top: 30px;
  width: 56px;
  height: 56px;
  font-size: 28px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
}
.prog {
  position: absolute;
  left: 112px;
  top: 44px;
  display: flex;
  gap: 6px;
  z-index: 5;
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
}
