/* The tooltip that follows: a white toolbar floating on a white page, and one dark tooltip over it. */
:root {
  --page: #ffffff;          /* the page */
  --ink: #1d1c21;
  --muted: #77757d;
  --line: #e7e5e0;
  --pressed: #efeeff;
  --pressed-ink: #4b3fd6;
  --tip: #1d1c21;           /* the tooltip */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Work Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 32px 12px;
}

.bar {
  position: relative;
  max-width: 100%;
}

/* ---------------------------------------------------------------- the toolbar */
.bar__tools {
  display: flex;
  touch-action: none;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  padding: 6px;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(29, 28, 33, 0.05), 0 16px 34px -18px rgba(29, 28, 33, 0.35);
}

.tool {
  display: grid;
  flex: none;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}

@media (hover: hover) {
  .tool:hover {
    background: #f4f3f0;
  }
}

.tool[aria-pressed='true'] {
  background: var(--pressed);
  color: var(--pressed-ink);
}

.tool:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.tool svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bar__split {
  flex: none;
  width: 1px;
  height: 24px;
  margin: 0 5px;
  background: var(--line);
}

/* ---------------------------------------------------------------- the tooltip */
/* placed, sized and stretched by the script; its tail stays on the button it speaks for */
.tip {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  pointer-events: none;
}

/* shown and hidden here (a little scale from its tail); placed on the .tip; stretched on the body */
.tip__in {
  position: relative;
  opacity: 0;
  transform-origin: 50% 100%;
}

.tip__body {
  position: relative;
  display: block;
  overflow: hidden;
  height: 32px;
  border-radius: 9px;
  background: var(--tip);
  color: #ffffff;
}

.tip__words {
  position: absolute;
  left: 50%;
  top: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 550;
  white-space: nowrap;
}

/* a word on its way out, while the new one comes in */
.tip__words.is-old {
  pointer-events: none;
}

.key {
  display: inline-flex;
  gap: 3px;
}

.key kbd {
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.16);
  font: 600 11px 'Work Sans Variable', system-ui, sans-serif;
  color: rgba(255, 255, 255, 0.85);
}

.tip__tail {
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border-radius: 2px;
  background: var(--tip);
}

/* the pretend pointer of the library's preview */
.tool.is-hover {
  background: #f4f3f0;
}

@media (max-width: 440px) {
  .tool {
    width: 36px;
    height: 36px;
  }

  .bar__split {
    margin: 0 3px;
  }
}
