:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", sans-serif;
  color: #f6f0ff;
  background: #100e1b;
  font-synthesis: none;
  --muted: #bab0cc;
  --line: #38304d;
}
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at 38% 0%, #221837 0%, transparent 63%), #100e1b;
}
.layout {
  width: min(100% - 5rem, 78rem);
  display: grid;
  grid-template-columns: minmax(17rem, .78fr) minmax(0, 1.22fr);
  align-items: center;
  gap: clamp(2rem, 6vw, 6rem);
  padding-block: 3.5rem;
}
h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(5.4rem, 9.5vw, 9rem);
  line-height: .85;
  letter-spacing: -.085em;
  font-weight: 400;
  color: #efe3ff;
}
.intro { margin: 2rem 0 .75rem; font-size: clamp(1.05rem, 1.8vw, 1.3rem); }
.instructions, #shortcuts { color: var(--muted); line-height: 1.55; }
.instructions { max-width: 27ch; margin: 0; }
.actions, .faces, .face-controls { display: flex; align-items: center; gap: .5rem; }
.actions { flex-wrap: wrap; margin-top: 1.75rem; }
button {
  border: 1px solid var(--line);
  border-radius: .65rem;
  padding: .62rem .85rem;
  min-height: 2.75rem;
  color: inherit;
  background: #211a31;
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
}
button:hover:not(:disabled), button[aria-pressed="true"] { background: #372853; border-color: #a98ad7; }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .46; cursor: default; }
button:focus-visible, canvas:focus-visible { outline: 2px solid #e5ccff; outline-offset: 3px; }
.primary { background: #dbc0ff; color: #221337; border-color: #dbc0ff; }
.primary:hover:not(:disabled) { background: #eedbff; border-color: #eedbff; }
.puzzle { min-width: 0; border: 1px solid var(--line); border-radius: 1.5rem; box-shadow: 0 26px 80px #08061188; }
.stage {
  border-radius: 1.5rem 1.5rem 0 0;
  position: relative;
  height: clamp(21rem, 43vw, 34rem);
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 54%, #744eb996, transparent 66%),
    radial-gradient(ellipse at 50% 60%, #362351, #20182f 75%);
}
.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: linear-gradient(#ceb4ff17 1px, transparent 1px), linear-gradient(90deg, #ceb4ff17 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse, #000 24%, transparent 83%);
}
.stage::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: 18%;
  right: 18%;
  bottom: 8%;
  height: 17%;
  background: radial-gradient(ellipse, #0a0617bb, transparent 68%);
}
.readout {
  pointer-events: none;
  display: flex;
  justify-content: space-between;
  position: absolute;
  inset: 1rem 1.2rem auto;
  font: .875rem/1.2 ui-monospace, Consolas, monospace;
  color: #e9d8ff;
}
.readout span { padding: .45rem .6rem; background: #1f1537df; border: 1px solid #634b87; border-radius: .5rem; }
#cube { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
#cube:active { cursor: grabbing; }
#cube:focus-visible { outline-offset: -5px; border-radius: 1.5rem 1.5rem 0 0; }
.console { background: #191426; border-radius: 0 0 1.5rem 1.5rem; padding: .9rem 1rem; }
.face-controls { flex-wrap: wrap; justify-content: space-between; }
.faces { gap: clamp(.2rem, .65vw, .55rem); }
.faces button { width: clamp(2.25rem, 4vw, 3rem); min-height: 2.75rem; padding: .45rem .2rem; font-family: ui-monospace, Consolas, monospace; }
.faces button::before { content: ""; display: block; margin: 0 auto .28rem; width: .9rem; height: .19rem; border-radius: 2px; background: var(--dot); }
#shortcuts { margin: .65rem 0 0; font-size: .875rem; }
@media (max-width: 48rem) {
  .layout { width: min(100% - 2rem, 33rem); grid-template-columns: 1fr; gap: 1.5rem; padding-block: 2rem; }
  h1 { font-size: clamp(3.1rem, 11vw, 6rem); }
  h1 br { display: none; }
  .intro { margin-top: 1rem; }
  .instructions { max-width: 48ch; }
  .actions { margin-top: 1rem; }
  .stage { height: clamp(17.5rem, 75vw, 28rem); }
}
@media (prefers-reduced-motion: reduce) {
  button:active:not(:disabled) { transform: none; }
}
