.tool-wheel {
  --wheel-bottom: 70px;
  --wheel-size: min(320px, calc(100vw - 36px), calc(var(--visible-height, 100dvh) - var(--bar-height) - var(--wheel-bottom) - 26px));
  position: absolute;
  right: 18px;
  bottom: var(--wheel-bottom);
  width: 56px;
  height: 56px;
  z-index: 8;
  isolation: isolate;
  user-select: none;
  -webkit-user-select: none;
}
.tool-wheel[hidden], .tool-wheel-menu[hidden] { display: none; }
.tool-wheel[data-open="true"] { width: var(--wheel-size); height: var(--wheel-size); }
.tool-wheel-launcher {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 1px solid #a8bdae;
  border-radius: 50%;
  color: #315f51;
  background: #fffdf4;
  box-shadow: 0 4px 16px #173d3329, inset 0 0 0 5px #edf2e8;
  cursor: pointer;
  touch-action: manipulation;
}
.tool-wheel-launcher:hover, .tool-wheel-launcher[aria-expanded="true"] { border-color: #315f51; background: #e8f0e1; }
.tool-wheel-launcher:focus-visible { outline: 3px solid #315f51; outline-offset: 3px; }
.tool-wheel-glyph { font: 25px/1 system-ui, sans-serif; }
.tool-wheel-launcher::after { content: ""; position: absolute; inset: 7px; border: 1px dashed #71927d70; border-radius: 50%; pointer-events: none; }
.tool-wheel-menu {
  position: absolute;
  inset: 0;
  border: 1px solid #adbfae;
  border-radius: 50%;
  color: #345445;
  background: #d6e2d4;
  box-shadow: 0 12px 40px #173d3333;
  animation: tool-wheel-reveal 130ms ease-out;
  transform-origin: bottom right;
}
.tool-wheel-option {
  position: absolute;
  padding: 0;
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: #fffdf2;
  color: #42634f;
  cursor: pointer;
  touch-action: manipulation;
}
.tool-wheel-option:hover { background: #e5eddb; }
.tool-wheel-option[aria-checked="true"] { background: #356650; color: #fffdf2; }
.tool-wheel-option:focus-visible { background: #c6dec7; color: #193e2f; outline: none; }
.tool-wheel-option:focus-visible .tool-wheel-label { text-decoration: underline; text-underline-offset: 3px; }
.tool-wheel-option-content { position: absolute; transform: translate(-50%, -50%); width: 86%; max-width: 86px; display: flex; flex-direction: column; align-items: center; gap: 5px; pointer-events: none; }
.tool-wheel-option-content > [aria-hidden] { font: 25px/1 system-ui, sans-serif; }
.tool-wheel-label { font-size: 11px; line-height: 1.15; font-weight: 650; hyphens: none; overflow-wrap: normal; }
.tool-wheel-hub { position: absolute; inset: 32%; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 5px; padding: 8px; text-align: center; pointer-events: none; }
.tool-wheel-heading { font-size: 8px; text-transform: uppercase; letter-spacing: .07em; color: #607461; }
.tool-wheel-current { font-size: 12px; line-height: 1.15; font-weight: 650; }
@keyframes tool-wheel-reveal { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: scale(1); } }
@media (max-width: 900px) {
  .tool-wheel { --wheel-bottom: calc(var(--mobile-dock-height, 66px) + 12px); right: 12px; }
}
@media (max-width: 900px) and (max-height: 500px) and (orientation: landscape) {
  /* The dock already occupies the right corner; use the space beside it. */
  .tool-wheel {
    --wheel-bottom: 12px;
    --wheel-size: min(320px, calc(40vw - 24px), calc(var(--visible-height, 100dvh) - var(--bar-height) - 38px));
    right: calc(min(440px, 60%) + 12px);
  }
  .tool-wheel-launcher { width: 48px; height: 48px; }
  .tool-wheel-option-content { gap: 2px; }
  .tool-wheel-option-content > [aria-hidden] { font-size: 20px; }
  .tool-wheel-label { font-size: 10px; }
  .tool-wheel-heading { display: none; }
  .tool-wheel-current { font-size: 10px; }
}
@media (max-width: 600px) and (max-height: 500px) and (orientation: landscape) {
  .tool-wheel-label { display: none; }
}
@media (prefers-reduced-motion: reduce) { .tool-wheel-menu { animation: none; } }
