@font-face {
  font-family: "Roboto Condensed";
  src: url("/assets/fonts/type-lab/RobotoCondensed-Variable.ttf") format("truetype");
  font-display: block;
  font-style: normal;
  font-weight: 100 900;
}

:root {
  --bezel-color: #090a09;
  --neutral-flap-color: #111311;
  color-scheme: dark;
  font-family: "Roboto Condensed", "Arial Narrow", sans-serif;
  background: var(--bezel-color);
}

:root[data-display-profile="oled"] {
  --bezel-color: #090a09;
  --neutral-flap-color: #202220;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bezel-color);
}

body {
  user-select: none;
}

.display {
  position: relative;
  display: grid;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 43%, rgb(255 255 255 / 1%), transparent 57%),
    linear-gradient(115deg, transparent 0 44%, rgb(255 255 255 / 0.35%) 50%, transparent 58%),
    var(--bezel-color);
}

.display::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  box-shadow: inset 0 0 9vmin rgb(0 0 0 / 35%);
}

.design-plane {
  position: relative;
  width: min(100vw, calc(100vh * 16 / 9));
  width: min(100vw, calc(100dvh * 16 / 9));
  aspect-ratio: 16 / 9;
  container-type: size;
}

.array-recess {
  position: absolute;
  /* Equal physical margins: 60 px on a 1920 × 1080 display. */
  inset: 5.5556cqh 3.125cqw;
  padding: 0.55cqw;
  background: #070807;
  border: 0.08cqw solid rgb(255 255 255 / 3%);
  border-radius: 0.22cqw;
  box-shadow:
    0 0.42cqw 0.9cqw rgb(0 0 0 / 44%),
    inset 0 0.28cqw 0.6cqw rgb(0 0 0 / 78%),
    inset 0 -0.08cqw 0 rgb(255 255 255 / 2%);
}

.board-grid {
  display: grid;
  width: 100%;
  height: 100%;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  gap: 0.48cqw;
}

.cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  contain: layout paint style;
}

.cell-well {
  position: absolute;
  inset: 0;
  padding: 0.14cqw 0.18cqw 0.16cqw;
  overflow: hidden;
  background:
    radial-gradient(circle at 0.12cqw 51%, #3b3d3a 0 0.035cqw, #111311 0.045cqw 0.075cqw, transparent 0.085cqw),
    radial-gradient(circle at calc(100% - 0.12cqw) 51%, #3b3d3a 0 0.035cqw, #111311 0.045cqw 0.075cqw, transparent 0.085cqw),
    repeating-linear-gradient(to bottom, #050605 0 0.09cqw, #0b0c0b 0.09cqw 0.13cqw),
    #030404;
  border: 0.055cqw solid #171817;
  border-radius: 0.12cqw;
  box-shadow:
    inset 0.07cqw 0.12cqw 0.2cqw rgb(0 0 0 / 94%),
    inset -0.035cqw -0.04cqw 0.08cqw rgb(255 255 255 / 3%),
    0 calc(0.06cqw + var(--recess-shift)) 0.11cqw rgb(0 0 0 / 55%);
}

.cell-well::after {
  position: absolute;
  z-index: 4;
  top: 0.11cqw;
  left: 50%;
  width: 0.3cqw;
  height: 0.34cqw;
  background: linear-gradient(to bottom, #171917, #090a09 75%);
  clip-path: polygon(8% 0, 92% 0, 78% 65%, 50% 100%, 22% 65%);
  content: "";
  filter: drop-shadow(0 0.035cqw 0.025cqw rgb(0 0 0 / 85%));
  transform: translateX(-50%);
}

.flap {
  --flap-color: var(--cell-flap-color, var(--neutral-flap-color));
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #050605;
  border: 0.035cqw solid #111311;
  border-radius: 0.07cqw;
  box-shadow:
    inset 0 0.08cqw 0 rgb(255 255 255 / 3%),
    inset 0 -0.11cqw 0.16cqw rgb(0 0 0 / 30%);
}

.flap-face {
  position: absolute;
  inset: 0;
  display: grid;
  overflow: hidden;
  place-items: center;
  background:
    linear-gradient(102deg, transparent 22%, rgb(255 255 255 / 2.5%) var(--sheen-position), transparent 78%),
    linear-gradient(to bottom, rgb(255 255 255 / 1.5%), transparent 32%, rgb(0 0 0 / 4%)),
    var(--flap-color);
}

.flap-face--top {
  clip-path: inset(0 0 50.4% 0);
}

.flap-face--bottom {
  clip-path: inset(50.4% 0 0 0);
  background:
    linear-gradient(102deg, transparent 22%, rgb(255 255 255 / 1.7%) var(--sheen-position), transparent 78%),
    linear-gradient(to bottom, rgb(0 0 0 / 3%), transparent 35%, rgb(0 0 0 / 7%)),
    var(--flap-color);
}

.flap-stack {
  position: absolute;
  z-index: 4;
  right: 0;
  bottom: 0;
  left: 0;
  height: 7%;
  background:
    repeating-linear-gradient(
      to bottom,
      #151715 0 0.025cqw,
      #030403 0.025cqw 0.06cqw,
      #0a0b0a 0.06cqw 0.095cqw
    ),
    #050605;
  border-top: 0.025cqw solid #020302;
  box-shadow:
    0 -0.045cqw 0.07cqw rgb(0 0 0 / 70%),
    inset 0 0.035cqw rgb(255 255 255 / 2%);
  isolation: isolate;
  pointer-events: none;
}

.surface-1 .flap-face {
  background-position: 14% 0, 0 0, 0 0;
}

.surface-2 .flap-face {
  background-position: 38% 0, 0 0, 0 0;
}

.surface-3 .flap-face {
  background-position: 64% 0, 0 0, 0 0;
}

.glyph {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: #d3d3ca;
  font-family: "Roboto Condensed", "Arial Narrow", sans-serif;
  font-size: 4.75cqh;
  font-weight: 400;
  line-height: 1;
  text-shadow: 0 0.035cqw 0.04cqw rgb(0 0 0 / 85%);
  transform: scaleX(0.96);
}

.glyph--hyphen {
  transform: translateY(-0.22cqw) scaleX(0.96);
}

.flap-seam {
  position: absolute;
  z-index: 3;
  top: 50%;
  right: -0.02cqw;
  left: -0.02cqw;
  height: 0.075cqw;
  background: #070807;
  box-shadow:
    0 -0.025cqw 0 rgb(255 255 255 / 5%),
    0 0.065cqw 0.09cqw rgb(0 0 0 / 72%);
  transform: translateY(-50%);
}

.flap-seam::before,
.flap-seam::after {
  position: absolute;
  top: 50%;
  width: 0.12cqw;
  height: 0.2cqw;
  background: #050605;
  border-radius: 50%;
  content: "";
  transform: translateY(-50%);
  box-shadow: inset 0 0.025cqw 0 rgb(255 255 255 / 5%);
}

.flap-seam::before {
  left: -0.045cqw;
}

.flap-seam::after {
  right: -0.045cqw;
}

/* Version 0.3 physical motion mechanism. The earlier static flap rules remain
   above as the visual baseline; these classes are shared with /motion-lab. */
.motion-well {
  position: absolute;
  inset: 0;
  overflow: hidden;
  perspective: 12cqw;
  background:
    radial-gradient(ellipse at 52% 50%, #4f534c 0 8%, #343832 25%, #1a1d19 58%, #060706 100%) 3.4% 44.5% / 5.2% 44% no-repeat,
    radial-gradient(ellipse at 48% 50%, #4f534c 0 8%, #343832 25%, #1a1d19 58%, #060706 100%) 96.6% 44.5% / 5.2% 44% no-repeat,
    repeating-linear-gradient(to bottom, #050605 0 4%, #0b0c0b 4% 6%),
    #030403;
  border: 0.055cqw solid #171817;
  border-radius: 0.12cqw;
  box-shadow:
    inset 0.07cqw 0.12cqw 0.2cqw rgb(0 0 0 / 94%),
    inset -0.035cqw -0.04cqw 0.08cqw rgb(255 255 255 / 3%),
    0 calc(0.06cqw + var(--recess-shift)) 0.11cqw rgb(0 0 0 / 55%);
}

.motion-well::before,
.motion-well::after {
  position: absolute;
  z-index: 4;
  right: 0;
  left: 0;
  content: "";
  pointer-events: none;
}

.motion-well::before {
  top: 0;
  height: 3.5%;
  background: #030403;
  box-shadow: 0 0.025cqw 0.04cqw rgb(0 0 0 / 78%);
}

.motion-well::after {
  bottom: 0;
  height: 4%;
  background: #030403;
  box-shadow: 0 -0.025cqw 0.04cqw rgb(0 0 0 / 72%);
}

.motion-plane {
  --flap-color: var(--neutral-flap-color);
  position: absolute;
  inset: 3.4% 5.1% 10.3%;
  overflow: hidden;
  border-top: 0.035cqw solid #111311;
  border-bottom: 0.035cqw solid #111311;
  border-radius: 0.8%;
  background: transparent;
  box-shadow:
    inset 0 0.08cqw rgb(255 255 255 / 3%),
    0 0.035cqw 0.07cqw rgb(0 0 0 / 72%);
  backface-visibility: hidden;
  transform-style: preserve-3d;
}

.motion-plane--incoming {
  z-index: 1;
  visibility: hidden;
}

.motion-plane--incoming.motion-plane--preview {
  clip-path: inset(0 0 49.4% 0);
}

.motion-plane--active {
  z-index: 2;
}

.motion-face {
  position: absolute;
  inset: 0;
  display: grid;
  overflow: hidden;
  place-items: center;
  background:
    linear-gradient(102deg, transparent 22%, rgb(255 255 255 / 2.5%) var(--sheen-position), transparent 78%),
    radial-gradient(circle at 38% 24%, rgb(255 255 255 / 4%), transparent 43%),
    linear-gradient(to bottom, rgb(255 255 255 / 1.5%), transparent 32%, rgb(0 0 0 / 5%)),
    var(--face-color, var(--flap-color));
  filter: drop-shadow(0 0 0.03cqw rgb(0 0 0 / 88%));
}

.motion-face--top {
  backface-visibility: hidden;
  clip-path: polygon(
    0 0,
    100% 0,
    100% 25%,
    96.4% 25%,
    96.4% 50.4%,
    3.6% 50.4%,
    3.6% 25%,
    0 25%
  );
  transform-origin: 50% 50.4%;
}

.motion-face--bottom,
.motion-face--flip-back {
  clip-path: polygon(
    0 75.8%,
    3.6% 75.8%,
    3.6% 50.4%,
    96.4% 50.4%,
    96.4% 75.8%,
    100% 75.8%,
    100% 100%,
    0 100%
  );
  background:
    linear-gradient(102deg, transparent 22%, rgb(255 255 255 / 1.7%) var(--sheen-position), transparent 78%),
    radial-gradient(circle at 38% 24%, rgb(255 255 255 / 2.2%), transparent 43%),
    linear-gradient(to bottom, rgb(0 0 0 / 3%), transparent 35%, rgb(0 0 0 / 7%)),
    var(--face-color, var(--flap-color));
}

.motion-face--flip-back {
  z-index: 2;
  visibility: hidden;
  transform-origin: 50% 50.4%;
}

#board[data-transitioning="true"] .motion-plane--active {
  will-change: transform;
}

#board[data-transitioning="true"] .motion-plane--active > .motion-face--top,
#board[data-transitioning="true"] .motion-plane--active > .motion-face--flip-back {
  will-change: transform, opacity;
}

.motion-glyph {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: #d3d3ca;
  font-family: "Roboto Condensed", "Arial Narrow", sans-serif;
  font-size: 4.75cqh;
  font-weight: 400;
  line-height: 1;
  text-shadow: 0 0.035cqw 0.04cqw rgb(0 0 0 / 85%);
  transform: scaleX(0.96);
}

.motion-glyph--hyphen {
  transform: translateY(-0.22cqw) scaleX(0.96);
}

.motion-seam {
  position: absolute;
  z-index: 3;
  top: 50%;
  right: 3.6%;
  left: 3.6%;
  height: 0.075cqw;
  background: #070807;
  box-shadow:
    0 -0.025cqw rgb(255 255 255 / 5%),
    0 0.065cqw 0.09cqw rgb(0 0 0 / 72%);
  transform: translateY(-50%);
}

.motion-stack {
  position: absolute;
  z-index: 1;
  right: 5.1%;
  bottom: 3.8%;
  left: 5.1%;
  height: 6.5%;
  border-top: 0.025cqw solid #020302;
  background:
    repeating-linear-gradient(to bottom, #151715 0 11%, #030403 11% 42%, #0a0b0a 42% 66%),
    #050605;
  box-shadow: 0 -0.045cqw 0.07cqw rgb(0 0 0 / 70%);
}

.motion-retainer {
  position: absolute;
  z-index: 5;
  top: 3.2%;
  left: 50%;
  width: 12%;
  height: 6%;
  filter: drop-shadow(0 0.035cqw 0.025cqw rgb(0 0 0 / 85%));
  transform: translateX(-50%);
}

.motion-retainer::before,
.motion-retainer::after {
  position: absolute;
  background: linear-gradient(to bottom, #181a18, #080908 82%);
  content: "";
}

.motion-retainer::before {
  inset: 0 6% 14%;
  clip-path: polygon(0 0, 100% 0, 72% 100%, 28% 100%);
}

.motion-retainer::after {
  bottom: 0;
  left: 33%;
  width: 34%;
  height: 26%;
  border-radius: 0 0 50% 50%;
}

.surface-1 .motion-face {
  background-position: 14% 0, 0 0, 0 0, 0 0;
}

.surface-2 .motion-face {
  background-position: 38% 0, 0 0, 0 0, 0 0;
}

.surface-3 .motion-face {
  background-position: 64% 0, 0 0, 0 0, 0 0;
}

/* Version 0.3.2 lean full-board renderer. It keeps the same physical timing
   model while replacing clipped full-plane duplicates with four flat faces. */
.lean-plane {
  position: absolute;
  z-index: 2;
  inset: 3.4% 5.1% 10.3%;
  border-top: 0.035cqw solid #111311;
  border-bottom: 0.035cqw solid #111311;
  border-radius: 0.8%;
  box-shadow:
    inset 0 0.08cqw rgb(255 255 255 / 3%),
    0 0.035cqw 0.07cqw rgb(0 0 0 / 72%);
  backface-visibility: hidden;
  transform-style: preserve-3d;
}

.lean-face {
  position: absolute;
  right: 0;
  left: 0;
  overflow: hidden;
  background:
    linear-gradient(102deg, transparent 22%, rgb(255 255 255 / 2.5%) var(--sheen-position), transparent 78%),
    radial-gradient(circle at 38% 24%, rgb(255 255 255 / 4%), transparent 43%),
    linear-gradient(to bottom, rgb(255 255 255 / 1.5%), transparent 32%, rgb(0 0 0 / 5%)),
    var(--face-color, var(--neutral-flap-color));
  backface-visibility: hidden;
}

.lean-face::before {
  position: absolute;
  left: 0;
  display: grid;
  width: 100%;
  place-items: center;
  color: #d3d3ca;
  content: attr(data-glyph);
  font-family: "Roboto Condensed", "Arial Narrow", sans-serif;
  font-size: 4.75cqh;
  font-weight: 400;
  line-height: 1;
  text-shadow: 0 0.035cqw 0.04cqw rgb(0 0 0 / 85%);
  transform: scaleX(0.96);
}

.lean-face--top,
.lean-face--incoming {
  top: 0;
  height: 50.4%;
  transform-origin: 50% 100%;
}

.lean-face--top::before,
.lean-face--incoming::before {
  top: 0;
  height: 198.42%;
}

.lean-face--incoming {
  z-index: 1;
  top: 3.4%;
  right: 5.1%;
  bottom: 53.1%;
  left: 5.1%;
  height: auto;
  visibility: hidden;
}

.lean-face--bottom,
.lean-face--flip-back {
  top: 50.4%;
  bottom: 0;
  background:
    linear-gradient(102deg, transparent 22%, rgb(255 255 255 / 1.7%) var(--sheen-position), transparent 78%),
    radial-gradient(circle at 38% 24%, rgb(255 255 255 / 2.2%), transparent 43%),
    linear-gradient(to bottom, rgb(0 0 0 / 3%), transparent 35%, rgb(0 0 0 / 7%)),
    var(--face-color, var(--neutral-flap-color));
}

.lean-face--bottom::before,
.lean-face--flip-back::before {
  bottom: 0;
  height: 201.62%;
}

.lean-face--flip-back {
  z-index: 3;
  visibility: hidden;
  transform-origin: 50% 0;
}

.lean-face--hyphen::before {
  transform: translateY(-0.22cqw) scaleX(0.96);
}

.lean-seam {
  position: absolute;
  z-index: 4;
  top: 50%;
  right: 3.6%;
  left: 3.6%;
  height: 0.075cqw;
  background: #070807;
  box-shadow:
    0 -0.025cqw rgb(255 255 255 / 5%),
    0 0.065cqw 0.09cqw rgb(0 0 0 / 72%);
  transform: translateY(-50%);
}

.lean-axle-mask {
  position: absolute;
  z-index: 4;
  top: 25%;
  right: 0;
  bottom: 24.2%;
  left: 0;
  pointer-events: none;
}

.lean-axle-mask::before,
.lean-axle-mask::after {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 8.25%;
  background: linear-gradient(to right, #040504 0 48%, #111410 58%, #454a42 77%, #090a09 100%);
  content: "";
  box-shadow: inset 0 0 0.04cqw rgb(0 0 0 / 80%);
}

.lean-axle-mask::before {
  left: 0;
  border-radius: 0 50% 50% 0;
}

.lean-axle-mask::after {
  right: 0;
  border-radius: 50% 0 0 50%;
  transform: scaleX(-1);
}

#board[data-transitioning="true"] .lean-plane--active {
  will-change: transform;
}

#board[data-transitioning="true"] .lean-face--top,
#board[data-transitioning="true"] .lean-face--flip-back {
  will-change: transform, opacity;
}

.surface-1 .lean-face {
  background-position: 14% 0, 0 0, 0 0, 0 0;
}

.surface-2 .lean-face {
  background-position: 38% 0, 0 0, 0 0, 0 0;
}

.surface-3 .lean-face {
  background-position: 64% 0, 0 0, 0 0, 0 0;
}

@media (prefers-contrast: more) {
  .glyph,
  .motion-glyph,
  .lean-face::before {
    color: #eeeeea;
  }
}
