/* the cube, and its overlay's own views (the bar and the overlay themselves: shell.css) */
:root { box-sizing: border-box; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }

*, *::before, *::after { box-sizing: inherit; }
html, body { height: 100%; margin: 0; }
html { background: var(--bg); }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 15px; letter-spacing: 0; line-height: 1.4; font-variant-numeric: lining-nums proportional-nums;
  overflow: hidden; overscroll-behavior: none;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- the bar: the square ---------- */
/* The square: filled while your moves count (an attempt from a fresh scramble until it's solved), empty when they don't;
   a square while the overlay is shut, a diamond while it's open. Filled mid-attempt, the first tap tips it over, asking;
   the second gives the attempt up (it spins back, empty; the overlay stays shut); the third opens the overlay.
   Otherwise a tap opens or closes it. */
.bar { position: fixed; z-index: 3; top: env(safe-area-inset-top, 0px); left: 0; right: 0; display: flex; align-items: center; padding: 22px 22px 0 20px; pointer-events: none; }
.sq.ask span, .sq.open span { transform: rotate(45deg) scale(.9); }   /* asking, or the overlay open: a diamond */
.sq.on span { background: currentColor; }
/* beside the square, in a few words: what a tap or the hold does next (the screen reader hears it from the square) */
.note { font-size: 13.5px; font-weight: 400; letter-spacing: 0; color: var(--ink-2); white-space: nowrap; }

/* ---------- the stage ---------- */
html { touch-action: manipulation; }   /* no zoom on a double tap, anywhere (the square was the worst) */
.stage { position: fixed; inset: 0; z-index: 2; touch-action: none; cursor: grab; background: var(--bg); }
.stage canvas { position: absolute; left: 0; top: 0; display: block; }   /* only as big as the cube and its shadow; placed by the code */
/* the way to the guide, top right; with the overlay open on a wide screen, it moves aside as the moveboard does */
#hop { transition: transform .42s cubic-bezier(.32, .72, 0, 1); }
.bar, .stage { transition: opacity .7s ease; }
.loading .bar, .loading .stage { opacity: 0; }
.nogl { position: absolute; inset: 0; display: grid; place-items: center; margin: 0 auto; padding: 24px; max-width: 34ch; text-align: center; color: var(--ink-2); }

/* ---------- the overlay: one view at a time, each whole ---------- */
/* the overlay's top: close on the left, its buttons on the right */
.p-head { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; min-height: 66px; padding: 20px 14px 8px 10px; border-bottom: 1px solid transparent; transition: border-color .2s; }
.p-back, .p-icon { flex: 0 0 auto; display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--ink-2); cursor: pointer; transition: background .2s, color .2s; }
/* arriving from the guide: the bar is there already and only the cube comes in */
.hop .bar { transition: none; }  .loading.hop .bar { opacity: 1; }  .hop .stage { transition-duration: .35s; }

/* ---------- the overlay: the scramble and your moves on it ---------- */
/* one body: the scramble and your moves, each after its word */
.flow { display: grid; gap: 14px; margin: 0; font-size: 15px; line-height: 1.75; }
.flow p { margin: 0; }
.flow p { display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: baseline; }   /* every row on one grid: */
.flow .k { font-size: 12px; color: var(--ink-3); }   /* the words in one column, what they say in the next, wrapping under itself */
.flow .moves { font-weight: 500; }
.flow .moves .mc { margin-right: .5em; }
.flow .moves.none { font-weight: 400; color: var(--ink-3); }
/* what the square and a hold mean, under the moves, quieter; the square drawn as it is in the bar, small */
.about { margin-top: 40px; font-size: 13.5px; line-height: 1.6; color: var(--ink-2); gap: 8px; text-wrap: pretty; }
.sqi { display: inline-block; width: 10px; height: 10px; border: 1.6px solid var(--ink); border-radius: 2.6px; vertical-align: -1px; }
.sqi.on { background: var(--ink); }
.about .turn { white-space: nowrap; }   /* empty, an arrow, filled: kept on one line */
.about .to { width: 14px; height: 9px; margin: 0 5px; vertical-align: 0; fill: none; stroke: var(--ink-2); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
/* the moveboard: the pad on its own, out of the bottom right corner; up from the bottom on a phone, in from the side
   on a wide screen. Its chevron says which way it comes and goes */
.board { position: fixed; z-index: 6; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom, 0px) + 12px); padding: 12px;
  border: 1px solid var(--panel-edge); border-radius: 28px; background: var(--panel); box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .28);
  visibility: hidden;   /* until the code slides it out (the same curve as everything else that moves) */
  transition: right .42s cubic-bezier(.32, .72, 0, 1), opacity .3s ease, background-color .3s ease; }
.board-tab { position: fixed; z-index: 6; right: 10px; bottom: calc(env(safe-area-inset-bottom, 0px) + 14px); display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 50%; background: none; color: var(--ink); cursor: pointer;
  transition: bottom .42s cubic-bezier(.32, .72, 0, 1), right .42s cubic-bezier(.32, .72, 0, 1), opacity .3s ease; }
.board-tab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transform: rotate(90deg); transition: transform .42s cubic-bezier(.32, .72, 0, 1); }
.board-out .board-tab { bottom: calc(env(safe-area-inset-bottom, 0px) + 12px + var(--board-h, 240px) + 4px); }
.board-out .board-tab svg { transform: rotate(-90deg); }
/* hovered, it nudges the way it points, as the chevrons to the other page do */
@media (hover: hover) { .board-tab:hover { background: var(--hover); } .board-tab:hover svg { transform: rotate(90deg) translateX(-2px); } .board-out .board-tab:hover svg { transform: rotate(-90deg) translateX(-2px); } }
/* the overlay open, the moveboard stays: on a phone the overlay ends above it, on a wide screen it moves aside */
.panel:not(.dbg) { bottom: calc(env(safe-area-inset-bottom, 0px) + 62px); }   /* on a phone the overlay ends above the chevron, or above the moveboard */
.board-out .panel:not(.dbg) { bottom: calc(env(safe-area-inset-bottom, 0px) + 12px + var(--board-h, 240px) + 52px); }
/* the impossible cube solved: nothing but the cube, spinning */
.party .bar, .party .board, .party .board-tab { opacity: 0 !important; pointer-events: none !important; }
.loading .board-tab { opacity: 0; }
/* the signature comes in with the bar, and stays put coming from the guide as the bar does */
.loading .sign { opacity: 0; }  .loading.hop .sign { opacity: 1; transition: none; }
.party .sign { opacity: 0 !important; pointer-events: none !important; }
@media (min-width: 900px), (hover: hover) and (pointer: fine) and (min-width: 520px) {
  :root { --edge: clamp(14px, 3vw, 30px); --side: var(--edge); }
  .panel-open { --side: calc(var(--edge) + clamp(300px, 38vw, 450px) + 16px); }   /* the overlay's column, and a gap */
  .panel:not(.dbg), .board-out .panel:not(.dbg) { bottom: clamp(14px, 3vw, 30px); }
  .panel-open #hop { transform: translateX(calc(-1 * (clamp(300px, 38vw, 450px) + 16px))); }
  .board { left: auto; right: var(--side); bottom: var(--edge); width: 340px; }
  .board-tab { right: calc(var(--side) - 6px); bottom: calc(var(--edge) - 2px); }
  .board-tab svg { transform: none; }
  .board-out .board-tab { right: calc(var(--side) + 340px + 4px); bottom: calc(var(--edge) - 2px); }
  .board-out .board-tab svg { transform: rotate(180deg); }
  @media (hover: hover) { .board-tab:hover svg { transform: translateX(-2px); } .board-out .board-tab:hover svg { transform: rotate(180deg) translateX(-2px); } }
}
/* what the square, the hold and the keys mean: a paragraph each, its term first */

/* ---------- the moveboard's keys: each turns the cube; ' 2 w change the next one ---------- */
/* a column per axis: its three layers as they stand (R M L, U E D, F S B), then the whole cube about it (x y z, which turn
   as R U F do); the rows: the faces in view, the middle layers, the faces behind, the whole cube. ' 2 w and back beside */
.keys { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin: 0; }
.keys button { height: 44px; padding: 0; border: 1px solid var(--line-strong); border-radius: 12px; background: none; color: var(--ink); font-size: 16px; cursor: pointer; touch-action: manipulation; transition: background .12s, border-color .12s, opacity .15s; }
.keys button:active { background: var(--line-strong); }
@media (hover: hover) { .keys button:not(:disabled):hover { background: var(--hover); } }
.keys button:disabled { opacity: .3; cursor: default; }
.keys .mod { color: var(--ink-2); font-size: 18px; }
.keys .mod[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--solid); }
/* pressed, under the pointer: still pressed, a shade lighter (never the plain hover, which would hide it) */
@media (hover: hover) {
  .keys .mod[aria-pressed="true"]:not(:disabled):hover { background: var(--ink); border-color: var(--ink); color: var(--solid); opacity: .82; }
}
.keys .back { color: var(--ink-2); }   /* your last move, turned back */
.keys svg { width: 20px; height: 20px; vertical-align: middle; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- ?debug: the overlay's card, its body the values as the code has them; on a phone the bottom half ---------- */
.dbg-on .bar, .dbg-on #panel, .dbg-on .board, .dbg-on .board-tab, .dbg-on .sign { display: none !important; }
.panel.dbg { top: 50%; }
.dbg-body { padding-top: 0; font: 12.5px/1.75 ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; -webkit-user-select: text; user-select: text; }
.code { color: var(--ink); white-space: nowrap; }
.c-blk { margin: 0 0 16px; }
.c-c { color: var(--ink-3); white-space: normal; }
.c-kw { color: var(--ink-2); }
.c-obj { display: grid; grid-template-columns: max-content minmax(0, 1fr); column-gap: 2ch; padding-left: 2ch; }
.c-obj > .c-c { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dbg-v { box-sizing: content-box; min-width: 1ch; height: 1.5em; margin: 0; padding: 0; border: 0; border-bottom: 1px dashed var(--line-strong); border-radius: 0; background: none; color: var(--ink); font: inherit; vertical-align: baseline; }
.dbg-v:hover { border-bottom-color: var(--ink-3); }
.dbg-v:focus { border-bottom: 1px solid var(--ink); outline: none; background: var(--hover); }
.dbg-sw { width: 12px; height: 12px; padding: 0; border: 0; border-radius: 3px; background: none; vertical-align: -1px; cursor: pointer; }
.dbg-sw::-webkit-color-swatch-wrapper { padding: 0; }
.dbg-sw::-webkit-color-swatch { border: 1px solid var(--line); border-radius: 3px; }
.dbg-sw::-moz-color-swatch { border: 1px solid var(--line); border-radius: 3px; }
.dbg-text { display: block; box-sizing: border-box; width: 100%; height: 220px; margin: 0 0 12px; padding: 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: none; color: var(--ink); font: inherit; font-size: 11.5px; line-height: 1.5; resize: vertical; white-space: pre; }
.dbg-foot { display: flex; gap: 8px; margin-top: 4px; font-family: var(--sans); }
@media (min-width: 900px), (hover: hover) and (pointer: fine) and (min-width: 520px) {
  .panel.dbg { top: calc(env(safe-area-inset-top, 0px) + clamp(14px, 2.8vw, 28px)); }
}
@media (min-width: 1080px) {
  .bar { padding: 30px 30px 0 30px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
/* ---------- the signature: she lives behind the bottom left corner, peeking out of the wall or the floor; what she does,
   and where, is sign.js's. Her feet's middle is what she turns about ---------- */
.sign { --w: 140px; position: fixed; z-index: 5; left: 0; bottom: 0; width: var(--w); aspect-ratio: 322 / 350; pointer-events: none;
  transform-origin: 50% 100%; transform: translate(-200%, 0); transition: opacity .7s ease; will-change: transform; }
.sign.out { z-index: 9; }
.peek { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: pointer; pointer-events: none; -webkit-tap-highlight-color: transparent; }
.peek img { display: block; width: 100%; height: 100%; pointer-events: auto; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  transform-origin: 50% 100%; animation: breathe 3.8s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: rotate(-1deg) scale(1, 1); } 50% { transform: rotate(1deg) scale(1.006, .992); } }   /* she's never quite still */
.peek:focus-visible { outline: none; } .peek:focus-visible img { filter: drop-shadow(0 0 3px var(--focus)); }
.sign a { position: absolute; transform: translate(-50%, -50%); padding: 8px 10px; color: var(--focus); font-family: var(--sans); font-size: 15px; font-weight: 500; line-height: 1;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; opacity: 0; pointer-events: none; transition: opacity .15s ease; }
.sign.shown a { opacity: 1; pointer-events: auto; transition: opacity .3s ease; }
.sign .p-cube { left: 6%; top: 10%; }
.sign .p-guide { left: 94%; top: 8%; }
.peek-veil { position: fixed; z-index: 8; inset: 0; }
@media (min-width: 900px), (hover: hover) and (pointer: fine) and (min-width: 520px) { .sign { --w: 170px; } }
@media (prefers-reduced-motion: reduce) { .peek img { animation: none; } }
@media print { .sign, .peek-veil { display: none !important; } }
/* ---------- the cube alone (/-/): nothing but the cube ---------- */
.bare .bar, .bare .board, .bare .board-tab, .bare .panel, .bare .sign, .bare .peek-veil { display: none !important; }
